Zum Hauptinhalt springen
T

dsh-unreal-python-api

taimoorsiddiquiofficial/dsh-unreal-python-api

Unreal Engine Python API context for DSH agents: symbol inventory listing, symbol search, exact syntax from the Epic docs, and tool scaffolding in four styles (ToolsetRegistry toolset, editor script, MCP tool descriptors, DSH defineTool module).

Installation

dsh plugin --profile web add github:taimoorsiddiquiofficial/dsh-unreal-python-api

README

dsh-unreal-python-api

An Unreal Engine Python API context plugin for DeepSeek Harness. It gives agents the documented Unreal Python surface — listing, search, exact syntax, and tool scaffolding in four flavours — from the symbol inventory Epic publishes beside the Python API documentation. See docs/DETAIL.md for what each tool returns and how the data is kept.

Source: https://github.com/TaimoorSiddiquiOfficial/dsh-unreal-python-api · MIT.

What the agent gets

ToolWhat it does
unreal_python_tools_listThe published symbol surface: totals by kind, one namespace's direct members, or one kind of symbol, each with a documentation link.
unreal_python_search66,849 inventory symbols ranked exact → member-name prefix → substring, filterable by kind or parent.
unreal_python_syntaxThe exact signature, description, parameter table and return type, read from Epic's published page for that symbol.
unreal_python_tool_builderScaffolds a tool from an intent plus verified symbols in four styles: toolset, editor_script, mcp_tool, dsh_tool.
unreal_python_executeRun Python in the editor under a risk class R0-R4; refuses a class below what the code does, needs confirm: "apply" for R3/R4 and expect from R2 up, and reports unverified when the expect fails.
unreal_engine_detectThree separate answers — the .uproject association, the installation's Build.version, the running editor — plus documentation coverage and every conflict between them.
unreal_project_inspectRead-only module, plugin and source inventory, plus the asset/symbol/tag counts the running editor indexed through Monolith, each labelled with its provenance.
unreal_project_scoutRead the project index: type lists assets of one class, search runs full-text search (optional assetClass), references traces depends_on/referenced_by and can walk depth 1-3 in one direction, audit pages a read-only dependency/size audit of a whole scope, stats returns counts and index health. Read-only; a stopped editor is an outage, not an empty project.
unreal_knowledge_noteAppend a dated Markdown block to a note in knowledgeDir (an Obsidian vault folder, or the plugin's own knowledge folder by default), read one note back, or test a self-hosted Obsidian MCP server. Append-only, confined to that folder even through links; knowledgeEnabled: false makes it refuse.
unreal_runtime_capabilitiesAsks the running editor whether named Python symbols exist there: Python version, public unreal attribute count, each symbol's resolved kind, registered toolset count. Absence is not proof of non-existence.
unreal_python_settingsRead or change this plugin's own settings row (scope, workspaces, exclude, knowledgeEnabled, knowledgeDir, workspaceScopedStorage) with one revision-fenced write, or report that the profile exposes no form.

A short system-prompt section tells the agent the tools exist, so it reaches for the published API instead of guessing names. Symbols that are not in the inventory are reported as unresolved and never written into generated code.

What to expect — and what not to

Expect:

  • Correct names and signatures, with a source link. Every symbol the tools return comes from Epic's own inventory for the installed documentation version (5.8 at the time of writing), and unreal_python_syntax reads the published page, so parameter names and defaults match the documentation rather than a model's memory.
  • Scaffolds that compile as far as the API surface goes. Generated artifacts are parse-checked in their own language by test/smoke.mjs; Unreal API calls in the comment block are verified against the inventory.
  • Four output styles for one intent, so the same description can become a ToolsetRegistry toolset for the editor, an MCP tool descriptor set, or a DSH plugin tool module.

Do not expect:

  • Documentation for any engine but the one Epic publishes. The symbol inventory is versioned; a project on another version gets an explicit unavailable_for_version, never a silently reused inventory.
  • Direct, unrestricted run_python. The Monolith client carries an allowlist and only read tools are reachable through it; run_python is excluded and is called only through two fixed envelopes — the runtime probe and the execution ladder, never with arbitrary text.
  • An unguarded execution path. The plugin does own a controlled one: unreal_python_execute (development tier) runs Python in the editor only with an R0–R4 declaration, an expect from R2 up, and confirm: "apply" for R3/R4 — and its expect is evaluated by a restricted interpreter, not by Python's eval. The code itself still runs with the editor's permissions, so the declaration and confirmation are the guarantee, not a sandbox.
  • Read-only project intelligence. unreal_project_scout, engine_detect, project_inspect and runtime_capabilities only read.
  • Behaviour for free. The builder emits structure, verified imports and signatures; the logic inside each tool body is yours to write and test.
  • Version independence. The inventory version follows Epic's published documentation for the URL in docBaseUrl; check it matches your engine when that matters.

Install

From the plugin market or an index source: install dsh-unreal-python-api.

Live on npm since 2026-11-30 (every release is published with provenance from its v<version> tag):

dsh plugin --profile web add dsh-unreal-python-api

npm serves the newest release once its staged-review window passes, so npm view dsh-unreal-python-api version is the honest answer to "which version can I install right now" — the tag on GitHub can be one release ahead of it.

From a local checkout (no publish needed):

dsh plugin --profile web add "<this directory>"

A local install links this directory. Because the link is resolved through its real path, the host-provided packages @deepseek-ai/dsh-tools and @deepseek-ai/schemastery must be reachable from here — run link-deps.ps1 once after cloning, and again after a DSH upgrade moves the install root:

.\link-deps.ps1                       # uses $env:DSH_INSTALL_DIR
.\link-deps.ps1 -InstallRoot "C:\path\to\@deepseek-ai\dsh"

Removing it: dsh plugin --profile web remove dsh-unreal-python-api.

Requirements

  • DeepSeek Harness with the tools and systemPrompt services (0.2.2-rc.5 or newer). @deepseek-ai/dsh-tools is host-provided: the version on npm (0.0.1-rc.1) is older than the one the harness ships, so it is deliberately not declared as a dependency. That bare import resolves by walking up from the installed package to the DSH install; if your profile's node_modules does not sit under the DSH install or its parents, install from a linked checkout and run link-deps.ps1 instead.
  • Node 20+ (global fetch, node:zlib) — no third-party dependencies.
  • Network access on the first run (the inventory is 612 KB, then cached).
  • Optional: Python on PATH, so the smoke test can parse-check the Python artifacts it generates.

Test

npm test

It downloads (or reuses) the inventory, then asserts the published version and symbol total, exact-match ranking and kind filtering in search, direct-member listing, a real signature read from a documentation page, an absent symbol being reported unresolved, scaffolds for all four styles that keep unverified symbols out of the generated code, and that every generated artifact parses with its own compiler (python -c "ast.parse", node --check).

Layout

index.js            plugin entry: Config, the tools, the prompt section
lib/inventory.js    inventory download, cache, parse, search, member listing
lib/docs.js         documentation page reader: signature, description, parameters
lib/builder.js      the four scaffold styles
test/smoke.mjs      live data-path test (network + cache + every capability)
cordis.patch.yml    bundle patch row
locale/, icon.svg   Host display metadata

Memory measurement toolkit

profiling/ ships the scripts this plugin was validated with: registry + OS memory snapshots per state, the B0→B4 teardown sequence, the residency join, the Insights growth merge, and the memreport helpers. They are plain Node scripts with paths relative to the Unreal project root — see profiling/README.md.

Configuration

KeyDefaultMeaning
docBaseUrlEpic's published Python API docsInventory and page root.
cacheDir%LOCALAPPDATA%\dsh-unreal-python-apiWhere the inventory is cached.
refreshHours24Cache freshness window; 0 forces a refetch.
maxResults30Upper bound on rows a tool returns.
fetchTimeoutMs30000Page and inventory timeout.
promptSectiontrueRegister the system-prompt section.
scopeanywhereWhere the development tier is offered: anywhere, unreal-project, or workspaces.
workspaces[]Absolute roots admitted by scope: workspaces.
exclude[]Absolute roots that never get the development tier, in every scope mode.
projectMarkers['.uproject']Files that identify a project root; replaces the default list.
monolithUrlhttp://127.0.0.1:9316/mcpThe editor bridge these tools read through. Read-only tools only; there is no fallback provider.
engines[]Installation roots to resolve an EngineAssociation against, for a machine whose Launcher manifest is missing or stale. Each root is read for the version it actually is.
knowledgeEnabledtrueOffer unreal_knowledge_note; the layer is off while this is false.
knowledgeDirthe platform notes folderWhere notes are appended. The path must stay inside this directory, checked twice (plain and after following links).
workspaceScopedStoragetrueGive every workspace its own subfolder (<name>-<8 hex>) under knowledgeDir and under obsidianVaultPath, so two projects sharing one notes root or one vault never append to the same note. false shares one flat folder.
obsidianUrl''MCP endpoint of a self-hosted Obsidian server, for example https://notes-api.hoptrendy.io/mcp. Empty keeps notes local only.
obsidianApiKey''Key for that server, stored as a secret and never printed. The server answers 401 without it.
obsidianAuthHeaderAuthorizationAuthorization (sent as Bearer <key>) or x-api-key (sent raw).
obsidianAuthSchemeBearerPrefix used with the Authorization header; an empty value sends the key raw.
obsidianVaultPathDSH/UnrealFolder inside the vault where mirrored notes go.
obsidianMirroroffOnly off is accepted. Nothing writes to the remote vault yet, so the settings refuse append and readwrite with not-implemented instead of storing a mode that does nothing.
obsidianTimeoutMs10000How long to wait for the vault, 1000–60000 ms.

This schema is also the GUI. DSH projects a plugin's Config into a form on the plugin's own page (Web sidebar → Plugins → this bundle), with each field's description as its help text and scope as a select. The bundle row in the profile patch stays the source of truth for a machine-level install; both edit the same entry.

Two tiers, and workspace scoping

One profile install serves every workspace, so the tools come in two tiers:

TierToolsOffered
generalunreal_python_tools_list, unreal_python_search, unreal_python_syntax, unreal_engine_detect, unreal_project_inspect, unreal_project_scout, unreal_runtime_capabilities, unreal_knowledge_noteevery workspace, always
developmentunreal_python_tool_builder, unreal_python_execute, unreal_python_settingsonly where scope admits the workspace and exclude does not reject it

unreal_python_settings sits in the development tier on purpose: the settings that decide where the tier applies must not be changeable from a workspace where the tier is absent. The plugin card edits the same row with no gate, so a locked-out workspace is never stuck.

scope decides where the development tier is admitted:

scopeThe development tier is offered when
anywhere (default)always, except the folders named in exclude — nothing else is gated
unreal-projectthe session's working directory, or a parent, holds a *.uproject
workspacesthe working directory is inside one of the workspaces roots

exclude wins over scope in every mode, so the usual setup for one Unreal project among non-Unreal workspaces is to leave scope: anywhere and name the worktrees to skip:

- id: unreal-python-api
  name: 'dsh-unreal-python-api'
  config:
    exclude:
      - D:\HOPRELAY
      - D:\ShopifyApp

An exclusion is a path check with no filesystem access, so it also settles the "this project has no .uproject yet" case that scope: unreal-project cannot judge.

# the dsh-unreal-python-api row's config (profile cordis.patch.yml, or the
# plugin's settings panel in the GUI when it offers one)
config:
  scope: workspaces
  workspaces:
    - D:\Projects\MyGame

The check runs once per prepared step against the session's committed working directory, is cached for ten seconds, and never throws: an unknown directory or a failing lookup counts as not admitted. Comparison is segment-aware and case-insensitive, so …\MyGame admits …\MyGame\Source but not …\MyGame2. Outside the scope the development tool is absent from the model's tool list entirely rather than refused at call time, and the prompt section says so. The general tier is never gated, so documentation lookups keep working in every workspace.

Documentation versus runtime

Two questions, two tools, never merged into one answer:

  • Is this symbol documented for this engine version? unreal_python_search / unreal_python_syntax answer from Epic's published inventory. For a project on an engine other than 5.8, the honest answer is "no published documentation for that version", not a 5.8 signature presented as if it were 5.4's.
  • Does this symbol exist in the editor that is running right now? unreal_runtime_capabilities asks the live unreal module through Monolith. It reports the Python version, the number of public unreal attributes, each symbol's resolved kind, and the registered toolset count.

A "missing" answer from the second tool is not proof of non-existence: Unreal exposes many submodules lazily, so a class can be absent until something imports it. The tool says so in its own description, so the model does not turn a probe result into a false negative.

Which engine, and which project

Documentation answers and runtime facts are different things, so they are never merged:

QuestionAnswered byWhen it is unavailable
What does the project file ask for?EngineAssociation in the .uprojectthe file declares none
What is actually installed?that installation's Engine/Build/Build.versionno installation resolves for the association
What is running right now?the editor, through Monoliththe editor is not running, or the port is not answering

All three are reported separately, and a disagreement becomes a conflicts entry instead of one value quietly replacing another. Documentation coverage follows the editor/build version: a project whose only documentation is 5.8 returns unavailable_for_version rather than borrowing the 5.8 inventory.

unreal_project_inspect keeps declared facts (.uproject, Source/, Plugins/) apart from indexed facts (asset, symbol and tag counts from the editor's index) and labels both with their provenance. When the editor is unreachable the indexed half is null together with the connection error — never zero, never a guess. Both tools are read-only: the Monolith client carries an allowlist, so a mutating action cannot be issued through it, and a broken connection is reported rather than retried against another provider.

Publishing to the market

The market catalog is curated through github.com/awesome-dsh-plugin/awesome-dsh-plugin: add one entry there and the site and in-app market pick it up. Installs prefer an npm package, then a GitHub Release tarball, then the repository itself, all through dsh plugin add. Keep private out of package.json before publishing to npm.

Adding a capability

Tool registration lives in apply() in index.js; each tool is one ctx.tools.register(defineTool({...})) call. Data-layer helpers belong in lib/ and must stay runnable under plain Node so test/smoke.mjs can exercise them without the DSH runtime.

License

MIT — see LICENSE.

Configuration page (GUI)

The Plugins page has an Installed list; open this bundle's card and its page shows a Configure form (the plugins.bundle.config slot) with three fields:

FieldMeaning
Where the development tools are enabledanywhere (default), unreal-project, workspaces
Included workspacesRoots that admit the development tier when the mode is workspaces
Excluded workspacesRoots that never admit it, whatever the mode says

Save writes the profile entry's configuration through the same settings service the Host validates; Reset to defaults clears the fields so each falls back to its schema default.

The same page also carries the knowledge layer: the notes folder, the optional Obsidian connection (URL, key, auth header and scheme, vault folder), the mirror mode (off, append, readwrite), the exact Append tool name the vault offers, and the request timeout. The write-tool field is the one action:"sync" uses: leave it empty to auto-detect an append-named tool, or name it exactly (vault_append is the safer choice on the tested bridge). The card is a bundle loaded by the Web page, so a changed form appears on the next page load; restart dsh web if an old form is still served. unreal_python_settings action: "metrics" reads the same process's counters without touching the row. A read-only profile disables every control. A save applies to new sessions — a session that is already running keeps the tool list it started with.

Knowledge storage

The notes layer needs no setup. knowledgeDir defaults to the platform data folder and knowledgeEnabled defaults to true, so the first append creates the folder and writes the note:

OSDefault folder
Windows%LOCALAPPDATA%\dsh-unreal-python-api\knowledge
macOS~/Library/Application Support/dsh-unreal-python-api/knowledge
Linux$XDG_DATA_HOME/dsh-unreal-python-api/knowledge (falls back to ~/.local/share)

Every append is workspace-scoped by default: the notes root and the vault path each get a <folder name>-<8 hex digest> subfolder for the workspace the tool was called from, so two checkouts — even two folders both named TDA — never append into the same note. Existing flat notes are left where they are; turn workspaceScopedStorage off to keep writing the one flat folder.

Point knowledgeDir at a folder inside an Obsidian vault to keep both tools on the same Markdown files. The local folder stays authoritative: notes work while Monolith is unreachable, and nothing scans the vault.

Optional remote mirror. Set obsidianUrl and obsidianApiKey to reach a self-hosted Obsidian MCP server (for example https://notes-api.hoptrendy.io/mcp), then call unreal_knowledge_note with action: "test". It reports whether the key was accepted, which tools the server exposes and which one it would use to append and to read a note — the mapping comes from each tool's input schema, so a renamed tool is reported instead of guessed. The key is a secret field: the settings service keeps it out of values and schema defaults, and every error this plugin prints is scrubbed. In 1.19.0 the mirror writes nothing; obsidianMirror stays off, so installing this release changes no behaviour. A 401 is reported as an auth problem, never as "unreachable", and a cleartext http:// URL is refused unless the host is localhost.

Set knowledgeEnabled: false (or use Plugins → dsh-unreal-python-api → Configuration → Knowledge storage) to make every read and write refuse. Containment is checked twice — lexically and after following links — so neither a .. note name nor a junction/symlink inside the folder can write outside it.

Auditing asset references (read-only)

unreal_project_scout also takes action: "audit". It pages through the Asset Registry until every discovered package under the given paths (default ["/Game"]) is accounted for, so a full-scope scan is possible and truncated is a claim you can check: the answer carries coverage (scopePaths, registered on one page, enumerated across all pages, deduped, measured, failed, duplicates, pages, complete, truncated). Coverage is counted, not assumed — a page that does not report a metric makes it null, and the report prints it as unknown instead of a zero. For every asset it measures hard and soft dependencies, referencers, fanIn/fanOut, the on-disk package bytes (.uasset, else .umap) and whether the Asset Registry says the asset is loaded. Duplicate paths are rejected and counted; a failing asset is listed instead of dropped. Nothing is loaded, saved, renamed or deleted; the call only asks the Asset Registry, stats the package file, and asks does_asset_exist about the /Game dependency paths it collected.

Edge totals come from counters the envelope produces before any list is capped (hardDependencyCount, softDependencyCount, softHardOverlapCount), so the hard/soft overlap is exact; overlapSource says which rows, if any, fell back to the capped lists. Self-references are decided per row the same way (selfReferenceInDependencies, selfReferenceInReferencers) and each entry says whether it was measured by counters or lists. States the registry did not answer stay separate from known ones: a null loaded flag is notLoadable, not unloaded; an unreported class is counted as unknownClass and kept out of the class distribution; nullDependencies and nullReferencers are counted; and anomalies exports every such row (with attributionConfidence = counted, partial or list-derived) for a later correlation step. Incomplete or malformed scans fail with the named codes audit-incomplete and audit-protocol rather than returning a partial result.

Give outputPath and summaryPath to write ASSET_MEMORY_AUDIT.json (every row) and ASSET_MEMORY_SUMMARY.md (the report) directly; the returned answer is then a 25-row preview plus the summary.

Phase A.1 was run against one real project (UE 5.8, Monolith 0.25.0): 90,197 of 90,197 discovered /Game packages, 451 pages, truncated: false. That report belongs to the project it measured, so it is NOT shipped in this repository: the package keeps no project paths, asset names or per-asset rows. Point outputPath/summaryPath at your own project (or at <project>/Saved/Verification/); the full per-asset rows are about 117 MB. node test/render-audit.mjs <that file> regenerates the summary from the full rows without an editor.

diskBytes is file size, not memory. A soft reference is not a licence to unload anything: candidates are only listed when an asset is loaded and has a high fan-in, and they carry the evidence, not a verdict.

One enumeration, explicit names, and a resume

UE 5.8's Asset Registry has no revision token, and get_assets_by_path hands back a hash-set order, so an offset is not a stable position. Since 1.22.0 a scan first asks for a manifest (every package path in scope, sorted and de-duplicated, plus a SHA-256 of that list), then measures explicit name batches in that order. One enumeration replaces the old per-page re-enumeration — the returned coverage.measures.enumerations says how many the envelope actually performed.

Three parameters follow from that:

ParameterEffect
checkpointtrue (default) appends each page to <project>/Saved/UnrealPythonApi/audit/…ndjson and only then advances the pointer, so a crash costs one page. false keeps the scan in memory. The directory is fixed by the plugin, never passed in.
resumetrue continues after the last committed page when the manifest digest matches the checkpoint. Each state reports resumedFrom.index and wasCheckpointResumed, so nobody has to guess whether a run was partial.
baselinepath to an earlier ASSET_MEMORY_AUDIT.json inside the project. The answer then carries compare: added/removed packages, class changes, dependency-growth proxies, disk-byte delta over packages present in both runs. Two different manifest digests are never diffed into one misleading number.

A scan whose page budget runs out reports complete: false, truncated: true — a partial report is never dressed up as a finished one.

The plugin still exposes 11 tools — nine general and two development (tool_builder, execute). audit is an action of unreal_project_scout, which now has five (type, stats, search, references, audit), so adding it did not grow the model-facing tool surface.

Two-way sync with the vault (1.24.0)

unreal_knowledge_note accepts action: "sync" in addition to append, read and test. A sync is refused unless obsidianMirror is readwrite and the vault offers a read capability. The write tool is obsidianAppendTool by exact name: a name the vault actually offers is trusted, and the tool's own description decides the shape — a tool that says it appends gets one block per call, while a tool that says it creates or overwrites gets the whole note in one call, so vault text is never dropped. With the setting empty, only a tool whose name promises an append is auto-detected, and an overwrite-only vault is refused rather than guessed at.

Under one per-note lock a sync compares (blockId, hash) pairs: blocks that only exist in the vault are imported verbatim into the note, blocks that only exist locally are appended to the vault, and an id present on both sides with different text is reported as a conflict entry instead of being resolved silently. Nothing is replaced, deleted, moved or renamed, and vault text outside a block is counted as unimportedVaultContent, not imported. The result reports writer and writeMode (append or replace) next to appended, so the shape that ran is visible in a receipt.

Local blocks still waiting for their remote append are queued per note under <knowledge dir>/.mirror-queue/. The queue is a failure ledger, not a retry scheduler: a failed write leaves one row per block, the next sync retries it and advances the attempt count (1 → 2 → 3), and a further failure marks it dead. nextAttemptAt is advisory metadata that no timer reads in this version; retries happen only on the next sync, and dead rows are kept as evidence. A valid but partial queue record is recovered, an invalid one is quarantined, and the record is deleted once the exact (blockId, hash) pair is confirmed remotely — an id alone is not enough, because the vault may hold a newer version of the same block.

One canonical lock per note serialises the local append writer, the sync reader and the sync writer, and a second lock per vault note serialises the remote read → append pair shared by sync and mirror. Neither is a distributed lock: Obsidian itself, another DSH process and the vault's own clients are outside it.

A tool that replaces the whole note is refused by default. obsidianAllowReplace is the opt-in; with it on, sync re-reads the note just before the write and refuses with remote-changed when the text moved in between. The vault offers no revision-conditional write, so this narrows the overwrite window but cannot close it — an appending tool remains the safer configuration.

A write the vault refuses with isError is a failed sync (ok: false, reason: "append-refused"), not a success with a note on the side; its queue row stays. A local note larger than the 1 MB read limit is refused with local-note-truncated before anything is written, and the result reports truncated: true, because writing the visible prefix of a truncated note would append its tail again on every sync. Blocks are matched by a hash recomputed from the text, not by the number written in the marker, so a hand-edited block is reported as a conflict and counted in staleMarkers.

Ähnliche Plugins