dsh-unreal-python-api 1.3.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,45 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.5.0 — 2026-11-30
4
+
5
+ - The configuration is now a real GUI form. The Host projects a plugin's
6
+ `Config` schema into a form, and that form needed two things this package was
7
+ missing: a description per field (it becomes the help text) and a constrained
8
+ `scope`. Every one of the twelve fields now carries one, and `scope` is a
9
+ three-way choice (`anywhere` / `unreal-project` / `workspaces`) instead of a
10
+ free-text string, so it renders as a select and an invalid value is refused at
11
+ load with `$.scope expected "anywhere" | "unreal-project" | "workspaces"`.
12
+ - No behaviour change: the defaults, the scope gate and the tools are untouched.
13
+
14
+ ## 1.4.0 — 2026-11-30
15
+
16
+ - Two new general tools, so the plugin knows *which* engine it is talking about
17
+ before it answers API questions:
18
+ - `unreal_engine_detect` reports three separate answers — the `.uproject`
19
+ `EngineAssociation`, the resolved installation's `Build.version`, and the
20
+ running editor — plus whether Epic publishes Python API documentation for
21
+ that version. Disagreement is reported as a conflict; no source overwrites
22
+ another.
23
+ - `unreal_project_inspect` returns a read-only inventory: the modules and
24
+ plugins the project declares, the source and `.uplugin` files present on
25
+ disk, and the asset/symbol counts the running editor indexed through
26
+ Monolith. Declared facts and indexed facts are labelled with their
27
+ provenance; without an editor the indexed half is `null` with the
28
+ connection error and nothing is substituted.
29
+ - The editor is reached only through Monolith (`monolithUrl`, default
30
+ `http://127.0.0.1:9316/mcp`) over a read-only allowlist. There is no second
31
+ bridge and no automatic provider fallback: an unreachable editor is an error,
32
+ never a silent empty result.
33
+ - `engines` (a list of installation roots) is read for the version each root
34
+ actually is; a root without a readable `Engine/Build/Build.version` is named in
35
+ the tool's `notes` instead of being dropped.
36
+ - Project inventory understands both Unreal source layouts — one directory per
37
+ module and the flat `Source/<Module>.cpp` form TDA itself uses — and searches
38
+ plugins to depth 6.
39
+ - Fixed a `ReferenceError` in `lib/engine.js` (the editor version parser was
40
+ called under a name the module never imported), which had silently turned a
41
+ reachable editor into an error branch.
42
+
3
43
  ## 1.3.0 — 2026-11-30
4
44
 
5
45
  - New `exclude` setting: a list of directories that never get the development
package/README.md CHANGED
@@ -16,6 +16,8 @@ Source: <https://github.com/TaimoorSiddiquiOfficial/dsh-unreal-python-api> · MI
16
16
  | `unreal_python_search` | 66,849 inventory symbols ranked exact → member-name prefix → substring, filterable by kind or parent. |
17
17
  | `unreal_python_syntax` | The exact signature, description, parameter table and return type, read from Epic's published page for that symbol. |
18
18
  | `unreal_python_tool_builder` | Scaffolds a tool from an intent plus verified symbols in four styles: `toolset`, `editor_script`, `mcp_tool`, `dsh_tool`. |
19
+ | `unreal_engine_detect` | Three separate answers — the `.uproject` association, the installation's `Build.version`, the running editor — plus documentation coverage and every conflict between them. |
20
+ | `unreal_project_inspect` | Read-only module, plugin and source inventory, plus the asset/symbol/tag counts the running editor indexed through Monolith, each labelled with its provenance. |
19
21
 
20
22
  A short system-prompt section tells the agent the tools exist, so it reaches for
21
23
  the published API instead of guessing names. Symbols that are not in the inventory
@@ -132,6 +134,13 @@ locale/, icon.svg Host display metadata
132
134
  | `scope` | `anywhere` | Where the development tier is offered: `anywhere`, `unreal-project`, or `workspaces`. |
133
135
  | `workspaces` | `[]` | Absolute roots admitted by `scope: workspaces`. |
134
136
  | `exclude` | `[]` | Absolute roots that never get the development tier, in every `scope` mode. |
137
+ | `monolithUrl` | `http://127.0.0.1:9316/mcp` | The editor bridge these tools read through. Read-only tools only; there is no fallback provider. |
138
+ | `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. |
139
+
140
+ This schema is also the GUI. DSH projects a plugin's `Config` into a form on the
141
+ plugin's own page (Web sidebar → **Plugins** → this bundle), with each field's
142
+ `description` as its help text and `scope` as a select. The YAML above stays the
143
+ source of truth for a machine-level install; both edit the same entry.
135
144
  | `projectMarkers` | `['.uproject']` | Files that identify a project root; replaces the default list. |
136
145
 
137
146
  ### Two tiers, and workspace scoping
@@ -140,7 +149,7 @@ One profile install serves every workspace, so the tools come in two tiers:
140
149
 
141
150
  | Tier | Tools | Offered |
142
151
  |---|---|---|
143
- | general | `unreal_python_tools_list`, `unreal_python_search`, `unreal_python_syntax` | every workspace, always |
152
+ | general | `unreal_python_tools_list`, `unreal_python_search`, `unreal_python_syntax`, `unreal_engine_detect`, `unreal_project_inspect` | every workspace, always |
144
153
  | development | `unreal_python_tool_builder` | only inside `scope` |
145
154
 
146
155
  `scope` decides where the development tier is admitted:
@@ -185,6 +194,30 @@ scope the development tool is absent from the model's tool list entirely rather
185
194
  than refused at call time, and the prompt section says so. The general tier is
186
195
  never gated, so documentation lookups keep working in every workspace.
187
196
 
197
+ ### Which engine, and which project
198
+
199
+ Documentation answers and runtime facts are different things, so they are never
200
+ merged:
201
+
202
+ | Question | Answered by | When it is unavailable |
203
+ |---|---|---|
204
+ | What does the project file ask for? | `EngineAssociation` in the `.uproject` | the file declares none |
205
+ | What is actually installed? | that installation's `Engine/Build/Build.version` | no installation resolves for the association |
206
+ | What is running right now? | the editor, through Monolith | the editor is not running, or the port is not answering |
207
+
208
+ All three are reported separately, and a disagreement becomes a `conflicts` entry
209
+ instead of one value quietly replacing another. Documentation coverage follows the
210
+ *editor/build* version: a project whose only documentation is 5.8 returns
211
+ `unavailable_for_version` rather than borrowing the 5.8 inventory.
212
+
213
+ `unreal_project_inspect` keeps declared facts (`.uproject`, `Source/`, `Plugins/`)
214
+ apart from indexed facts (asset, symbol and tag counts from the editor's index) and
215
+ labels both with their provenance. When the editor is unreachable the indexed half
216
+ is `null` together with the connection error — never zero, never a guess. Both
217
+ tools are read-only: the Monolith client carries an allowlist, so a mutating
218
+ action cannot be issued through it, and a broken connection is reported rather than
219
+ retried against another provider.
220
+
188
221
  ## Publishing to the market
189
222
 
190
223
  The market catalog is curated through
package/index.js CHANGED
@@ -23,6 +23,9 @@ import {
23
23
  } from './lib/inventory.js'
24
24
  import { readSymbolDoc } from './lib/docs.js'
25
25
  import { DEFAULT_REGISTRY_IMPORT, buildToolset } from './lib/builder.js'
26
+ import { detectEngine, readBuildVersion } from './lib/engine.js'
27
+ import { DEFAULT_MONOLITH_URL, createMonolithClient } from './lib/monolith.js'
28
+ import { inspectProject } from './lib/project.js'
26
29
  import {
27
30
  DEFAULT_PROJECT_MARKERS,
28
31
  DEFAULT_SCOPE,
@@ -35,17 +38,57 @@ export const name = 'unreal-python-api'
35
38
 
36
39
  export const inject = ['tools', 'systemPrompt', 'workingDirectory']
37
40
 
41
+ // Every field carries a description because the Host projects this schema into a
42
+ // configuration form, where the description is the field's help text.
38
43
  export const Config = z.object({
39
- docBaseUrl: z.string().default(DEFAULT_DOC_BASE_URL),
40
- cacheDir: z.string().default(''),
41
- refreshHours: z.number().default(24),
42
- maxResults: z.number().default(30),
43
- fetchTimeoutMs: z.number().default(30_000),
44
- promptSection: z.boolean().default(true),
45
- scope: z.string().default(DEFAULT_SCOPE),
46
- workspaces: z.array(z.string()).default([]),
47
- projectMarkers: z.array(z.string()).default(DEFAULT_PROJECT_MARKERS),
48
- exclude: z.array(z.string()).default([]),
44
+ docBaseUrl: z
45
+ .string()
46
+ .default(DEFAULT_DOC_BASE_URL)
47
+ .description('Base URL of the published Unreal Python API documentation. The symbol inventory and the signature pages are read from here.'),
48
+ cacheDir: z
49
+ .string()
50
+ .default('')
51
+ .description('Directory for the cached symbol inventory. Empty uses DSH_UNREAL_PYTHON_API_CACHE, then the platform cache directory.'),
52
+ refreshHours: z
53
+ .number()
54
+ .default(24)
55
+ .description('Re-download the inventory when the cached copy is older than this many hours. 0 always re-downloads.'),
56
+ maxResults: z
57
+ .number()
58
+ .default(30)
59
+ .description('Largest number of rows a listing or search returns before it reports truncation.'),
60
+ fetchTimeoutMs: z
61
+ .number()
62
+ .default(30_000)
63
+ .description('Timeout for one documentation or editor request, in milliseconds.'),
64
+ promptSection: z
65
+ .boolean()
66
+ .default(true)
67
+ .description('Add a short system-prompt section so the model knows these tools exist.'),
68
+ scope: z
69
+ .union([z.const('anywhere'), z.const('unreal-project'), z.const('workspaces')])
70
+ .default(DEFAULT_SCOPE)
71
+ .description('Where the development tier (the tool builder) is offered: anywhere never gates it; unreal-project needs a *.uproject in the session directory or a parent; workspaces needs the directory inside one of the listed roots.'),
72
+ workspaces: z
73
+ .array(z.string())
74
+ .default([])
75
+ .description('Absolute roots that count as members when scope is workspaces.'),
76
+ projectMarkers: z
77
+ .array(z.string())
78
+ .default(DEFAULT_PROJECT_MARKERS)
79
+ .description('Files or directories that mark an Unreal project root for scope unreal-project. A leading dot matches a file extension.'),
80
+ exclude: z
81
+ .array(z.string())
82
+ .default([])
83
+ .description('Absolute roots that never get the development tier, in every scope mode.'),
84
+ monolithUrl: z
85
+ .string()
86
+ .default(DEFAULT_MONOLITH_URL)
87
+ .description('The Unreal editor bridge the engine and project tools read through (Monolith MCP). Read-only tools only, no fallback provider.'),
88
+ engines: z
89
+ .array(z.string())
90
+ .default([])
91
+ .description('Engine installation roots to resolve EngineAssociation against when the launcher manifest is missing or stale.'),
49
92
  })
50
93
 
51
94
  /** Largest row count any tool returns, whatever a caller asks for. */
@@ -111,6 +154,11 @@ function countSchema() {
111
154
  }
112
155
  }
113
156
 
157
+ /** A string that may be absent in the source data. @returns {object} Value spec. */
158
+ function nullableString() {
159
+ return { oneOf: [{ type: 'string' }, { type: 'null' }] }
160
+ }
161
+
114
162
  /**
115
163
  * Render symbol rows as compact lines.
116
164
  * @param {string} header First line.
@@ -141,6 +189,26 @@ export function apply(ctx, config) {
141
189
  if (!Number.isFinite(maxResults) || maxResults < 1) throw new Error('maxResults must be a positive number')
142
190
  if (!Number.isFinite(fetchTimeoutMs) || fetchTimeoutMs < 1_000) throw new Error('fetchTimeoutMs must be at least 1000')
143
191
  if (!Number.isFinite(refreshHours) || refreshHours < 0) throw new Error('refreshHours must not be negative')
192
+ const monolithUrl = String(config.monolithUrl ?? DEFAULT_MONOLITH_URL)
193
+ if (!/^https?:\/\//.test(monolithUrl)) throw new Error('monolithUrl must be an http(s) URL')
194
+ // `engines` is configured as a list of installation roots. resolveInstallation
195
+ // keys installations by the EngineAssociation they answer for, so each root is
196
+ // read for the version it actually is. A root without a readable
197
+ // Engine/Build/Build.version is reported in the tool output, not dropped quietly.
198
+ /** @type {Record<string, string>} */
199
+ const engines = {}
200
+ /** @type {string[]} */
201
+ const engineNotes = []
202
+ for (const entry of Array.isArray(config.engines) ? config.engines : []) {
203
+ if (typeof entry !== 'string' || entry.trim() === '') continue
204
+ const enginePath = entry.trim()
205
+ const build = readBuildVersion(enginePath)
206
+ if (build !== null && build.version !== null) {
207
+ engines[build.version] = enginePath
208
+ continue
209
+ }
210
+ engineNotes.push(`configured engine ${enginePath} has no readable Engine/Build/Build.version and was ignored`)
211
+ }
144
212
 
145
213
  const scope = resolveScope({
146
214
  scope: config.scope,
@@ -168,6 +236,37 @@ export function apply(ctx, config) {
168
236
  ? registerGeneral
169
237
  : (definition) => ctx.tools.register(definition, { when: (context) => gate.admits(context.agent) })
170
238
 
239
+ // The editor is reached only through Monolith's read-only tools. No second
240
+ // bridge, and no provider fallback: when Monolith is unreachable the caller
241
+ // gets the connection error instead of an empty result.
242
+ const monolith = createMonolithClient({
243
+ url: monolithUrl,
244
+ timeoutMs: Math.min(fetchTimeoutMs, 15_000),
245
+ clientName: 'dsh-unreal-python-api',
246
+ })
247
+
248
+ /**
249
+ * Resolve the project directory: an explicit argument, otherwise the agent's
250
+ * current workspace. Nothing is guessed.
251
+ * @param {{ directory?: unknown }} args Validated tool arguments.
252
+ * @param {{ agent?: { session?: unknown } } | undefined} exec Tool execution context.
253
+ * @returns {string} Absolute project directory.
254
+ */
255
+ function projectDirectory(args, exec) {
256
+ const requested = typeof args.directory === 'string' ? args.directory.trim() : ''
257
+ if (requested !== '') return requested
258
+ try {
259
+ const session = exec?.agent?.session
260
+ if (session !== undefined) {
261
+ const current = ctx.workingDirectory.get(session)
262
+ if (typeof current === 'string' && current !== '') return current
263
+ }
264
+ } catch {
265
+ // fall through to the explicit error below
266
+ }
267
+ throw new Error('directory is required: pass the project directory, or run this tool inside a workspace')
268
+ }
269
+
171
270
  let loaded = null
172
271
  /**
173
272
  * Load the inventory once per process, re-reading it when a caller asks to refresh.
@@ -530,14 +629,336 @@ export function apply(ctx, config) {
530
629
  },
531
630
  }))
532
631
 
632
+ registerGeneral(defineTool({
633
+ name: 'unreal_engine_detect',
634
+ description: 'Report which Unreal Engine version a project uses, from three independent sources: the .uproject EngineAssociation, the resolved installation Build.version, and the running editor reached through Monolith. Also reports whether Epic publishes Python API documentation for that version. Disagreements are reported as conflicts, never resolved by letting one source overwrite another.',
635
+ parameters: {
636
+ directory: { type: 'string', description: 'Project directory; defaults to the current workspace.' },
637
+ },
638
+ output: {
639
+ schema: {
640
+ type: 'object',
641
+ additionalProperties: false,
642
+ properties: {
643
+ directory: { type: 'string', required: true },
644
+ engineAssociation: nullableString(),
645
+ installation: {
646
+ oneOf: [
647
+ { type: 'null' },
648
+ {
649
+ type: 'object',
650
+ additionalProperties: false,
651
+ properties: {
652
+ version: nullableString(),
653
+ path: nullableString(),
654
+ source: nullableString(),
655
+ buildVersion: nullableString(),
656
+ changelist: { oneOf: [{ type: 'number' }, { type: 'null' }] },
657
+ branch: nullableString(),
658
+ },
659
+ },
660
+ ],
661
+ },
662
+ editor: {
663
+ type: 'object',
664
+ additionalProperties: false,
665
+ properties: {
666
+ connected: { type: 'boolean', required: true },
667
+ version: nullableString(),
668
+ projectName: nullableString(),
669
+ serverVersion: nullableString(),
670
+ port: { oneOf: [{ type: 'number' }, { type: 'null' }] },
671
+ actions: { oneOf: [{ type: 'number' }, { type: 'null' }] },
672
+ error: {
673
+ type: 'object',
674
+ additionalProperties: false,
675
+ properties: {
676
+ code: { type: 'string', required: true },
677
+ message: { type: 'string', required: true },
678
+ },
679
+ },
680
+ },
681
+ },
682
+ documentation: {
683
+ type: 'object',
684
+ additionalProperties: false,
685
+ properties: {
686
+ status: { type: 'string', required: true },
687
+ version: nullableString(),
688
+ documentedVersions: { type: 'array', items: { type: 'string' } },
689
+ url: { type: 'string' },
690
+ note: { type: 'string' },
691
+ },
692
+ },
693
+ conflicts: { type: 'array', required: true, items: { type: 'string' } },
694
+ notes: { type: 'array', required: true, items: { type: 'string' } },
695
+ verified: {
696
+ type: 'object',
697
+ additionalProperties: false,
698
+ properties: {
699
+ fromProjectFile: { type: 'boolean', required: true },
700
+ fromInstallation: { type: 'boolean', required: true },
701
+ fromEditor: { type: 'boolean', required: true },
702
+ },
703
+ },
704
+ },
705
+ },
706
+ render: (_args, value) => {
707
+ const lines = [`Unreal Engine detection for ${value.directory}`]
708
+ lines.push(` project association : ${value.engineAssociation ?? 'not declared'}`)
709
+ const installation = value.installation
710
+ if (installation === null) {
711
+ lines.push(' installation : no installation resolved for this association')
712
+ } else {
713
+ lines.push(` installation : ${installation.version ?? 'unknown'} at ${installation.path ?? 'unknown path'} (${installation.source ?? 'unknown source'})`)
714
+ if (installation.buildVersion !== null) {
715
+ const changelist = installation.changelist === null ? '' : ` CL-${installation.changelist}`
716
+ lines.push(` Build.version : ${installation.buildVersion}${installation.branch === null ? '' : ` ${installation.branch}`}${changelist}`)
717
+ }
718
+ }
719
+ if (value.editor.connected) {
720
+ lines.push(` running editor : ${value.editor.version ?? 'unknown version'} for ${value.editor.projectName ?? 'unknown project'} (monolith ${value.editor.serverVersion ?? '?'}, ${value.editor.actions ?? '?'} actions)`)
721
+ } else {
722
+ lines.push(` running editor : unreachable (${value.editor.error?.code ?? 'error'}: ${value.editor.error?.message ?? ''})`)
723
+ }
724
+ lines.push(` documentation : ${value.documentation.status}${value.documentation.note === undefined ? '' : ` — ${value.documentation.note}`}`)
725
+ if (value.conflicts.length > 0) {
726
+ lines.push(' conflicts:')
727
+ for (const conflict of value.conflicts) lines.push(` ${conflict}`)
728
+ }
729
+ if (value.notes.length > 0) {
730
+ lines.push(' notes:')
731
+ for (const note of value.notes) lines.push(` ${note}`)
732
+ }
733
+ return [{ type: 'text', text: lines.join('\n') }]
734
+ },
735
+ },
736
+ timeoutMs: 20_000,
737
+ async execute(args, exec) {
738
+ const directory = projectDirectory(args, exec)
739
+ const result = await detectEngine({ directory, engines, docBaseUrl, client: monolith })
740
+ const installation = result.installation
741
+ const build = installation?.build ?? null
742
+ return {
743
+ directory,
744
+ engineAssociation: result.project?.engineAssociation ?? null,
745
+ installation:
746
+ installation === null || installation === undefined
747
+ ? null
748
+ : {
749
+ version: installation.version ?? null,
750
+ path: installation.path ?? null,
751
+ source: installation.source ?? null,
752
+ buildVersion: build?.version ?? null,
753
+ changelist: typeof build?.changelist === 'number' ? build.changelist : null,
754
+ branch: build?.branch ?? null,
755
+ },
756
+ editor: {
757
+ connected: result.editor.connected,
758
+ version: result.editor.version ?? null,
759
+ projectName: result.editor.projectName ?? null,
760
+ serverVersion: result.editor.serverVersion ?? null,
761
+ port: result.editor.port ?? null,
762
+ actions: result.editor.actions ?? null,
763
+ ...(result.editor.error === null || result.editor.error === undefined ? {} : { error: result.editor.error }),
764
+ },
765
+ documentation: {
766
+ status: result.documentation.status,
767
+ version: result.documentation.version ?? null,
768
+ documentedVersions: result.documentation.documentedVersions ?? [],
769
+ url: result.documentation.url ?? docBaseUrl,
770
+ note: result.documentation.note ?? '',
771
+ },
772
+ conflicts: result.conflicts,
773
+ notes: engineNotes,
774
+ verified: result.verified,
775
+ }
776
+ },
777
+ }))
778
+
779
+ registerGeneral(defineTool({
780
+ name: 'unreal_project_inspect',
781
+ description: 'Read-only inventory of an Unreal project: the modules and plugins the .uproject declares, the source and plugin files present on disk, and the asset/symbol counts the running editor has indexed through Monolith. Declared facts and indexed facts are labelled separately; when the editor is unreachable the indexed half is null with the connection error, and nothing is substituted for it. This tool never mutates the project.',
782
+ parameters: {
783
+ directory: { type: 'string', description: 'Project directory; defaults to the current workspace.' },
784
+ },
785
+ output: {
786
+ schema: {
787
+ type: 'object',
788
+ additionalProperties: false,
789
+ properties: {
790
+ directory: { type: 'string', required: true },
791
+ project: {
792
+ type: 'object',
793
+ additionalProperties: false,
794
+ properties: {
795
+ file: { type: 'string', required: true },
796
+ name: { type: 'string', required: true },
797
+ engineAssociation: nullableString(),
798
+ description: { type: 'string' },
799
+ modules: {
800
+ type: 'array',
801
+ required: true,
802
+ items: {
803
+ type: 'object',
804
+ additionalProperties: false,
805
+ properties: {
806
+ name: { type: 'string', required: true },
807
+ type: nullableString(),
808
+ loadingPhase: nullableString(),
809
+ sourceDirectory: nullableString(),
810
+ sourceLayout: nullableString(),
811
+ sourceFiles: { type: 'number', required: true },
812
+ sourceFilesTruncated: { type: 'boolean', required: true },
813
+ },
814
+ },
815
+ },
816
+ },
817
+ },
818
+ plugins: {
819
+ type: 'object',
820
+ additionalProperties: false,
821
+ properties: {
822
+ declared: {
823
+ type: 'array',
824
+ required: true,
825
+ items: {
826
+ type: 'object',
827
+ additionalProperties: false,
828
+ properties: {
829
+ name: { type: 'string', required: true },
830
+ enabled: { type: 'boolean', required: true },
831
+ },
832
+ },
833
+ },
834
+ onDisk: {
835
+ type: 'object',
836
+ additionalProperties: false,
837
+ properties: {
838
+ count: { type: 'number', required: true },
839
+ truncated: { type: 'boolean', required: true },
840
+ unlisted: { type: 'array', required: true, items: { type: 'string' } },
841
+ },
842
+ },
843
+ },
844
+ },
845
+ editor: {
846
+ type: 'object',
847
+ additionalProperties: false,
848
+ properties: {
849
+ connected: { type: 'boolean', required: true },
850
+ projectName: nullableString(),
851
+ engineVersion: nullableString(),
852
+ serverVersion: nullableString(),
853
+ actions: { oneOf: [{ type: 'number' }, { type: 'null' }] },
854
+ error: {
855
+ type: 'object',
856
+ additionalProperties: false,
857
+ properties: {
858
+ code: { type: 'string', required: true },
859
+ message: { type: 'string', required: true },
860
+ },
861
+ },
862
+ },
863
+ },
864
+ counts: {
865
+ type: 'array',
866
+ required: true,
867
+ items: {
868
+ type: 'object',
869
+ additionalProperties: false,
870
+ properties: {
871
+ name: { type: 'string', required: true },
872
+ value: { type: 'number', required: true },
873
+ },
874
+ },
875
+ },
876
+ indexHealth: {
877
+ oneOf: [
878
+ { type: 'null' },
879
+ {
880
+ type: 'object',
881
+ additionalProperties: false,
882
+ properties: {
883
+ state: { type: 'string', required: true },
884
+ detail: { type: 'string', required: true },
885
+ },
886
+ },
887
+ ],
888
+ },
889
+ provenance: {
890
+ type: 'object',
891
+ additionalProperties: false,
892
+ properties: {
893
+ modules: { type: 'string', required: true },
894
+ plugins: { type: 'string', required: true },
895
+ contentCounts: { type: 'string' },
896
+ editor: { type: 'string' },
897
+ },
898
+ },
899
+ readOnly: { type: 'boolean', required: true },
900
+ },
901
+ },
902
+ render: (_args, value) => {
903
+ const lines = [`${value.project.name} (${value.project.file})`]
904
+ lines.push(` engine association : ${value.project.engineAssociation ?? 'not declared'}`)
905
+ const modules = value.project.modules
906
+ .map((module) => `${module.name}${module.type === null ? '' : ` [${module.type}]`}${module.sourceFiles === 0 ? ' (no source files)' : ` (${module.sourceFiles}${module.sourceFilesTruncated ? '+' : ''} source files)`}`)
907
+ .join(', ')
908
+ lines.push(` modules : ${modules === '' ? 'none declared' : modules}`)
909
+ lines.push(` plugins declared : ${value.plugins.declared.length}`)
910
+ lines.push(` plugins on disk : ${value.plugins.onDisk.count}${value.plugins.onDisk.truncated ? '+' : ''}${value.plugins.onDisk.unlisted.length === 0 ? '' : `, ${value.plugins.onDisk.unlisted.length} not declared in the .uproject`}`)
911
+ if (value.editor.connected) {
912
+ lines.push(` editor : ${value.editor.projectName ?? 'unknown project'} on ${value.editor.engineVersion ?? 'unknown engine'} (monolith ${value.editor.serverVersion ?? '?'}, ${value.editor.actions ?? '?'} actions)`)
913
+ lines.push(` indexed counts : ${value.counts.map((entry) => `${entry.name} ${entry.value}`).join(', ')}`)
914
+ if (value.indexHealth !== null) {
915
+ lines.push(` index health : ${value.indexHealth.state}${value.indexHealth.detail === '' ? '' : ` — ${value.indexHealth.detail}`}`)
916
+ }
917
+ } else {
918
+ lines.push(` editor : unreachable (${value.editor.error?.code ?? 'error'}: ${value.editor.error?.message ?? ''})`)
919
+ lines.push(' indexed counts : unavailable, the editor is not reachable; no substitute values are reported')
920
+ }
921
+ lines.push(` provenance : modules ${value.provenance.modules}; plugins ${value.provenance.plugins}${value.provenance.contentCounts === undefined ? '' : `; counts ${value.provenance.contentCounts}`}`)
922
+ return [{ type: 'text', text: lines.join('\n') }]
923
+ },
924
+ },
925
+ timeoutMs: 20_000,
926
+ async execute(args, exec) {
927
+ const directory = projectDirectory(args, exec)
928
+ const result = await inspectProject({ directory, client: monolith })
929
+ const counts =
930
+ result.index === null
931
+ ? []
932
+ : Object.entries(result.index)
933
+ .filter(([, value]) => typeof value === 'number')
934
+ .map(([name, value]) => ({ name, value }))
935
+ return {
936
+ directory: result.directory,
937
+ project: {
938
+ file: result.project.file,
939
+ name: result.project.name,
940
+ engineAssociation: result.project.engineAssociation,
941
+ description: result.project.description,
942
+ modules: result.project.modules,
943
+ },
944
+ plugins: result.plugins,
945
+ editor: result.editor,
946
+ counts,
947
+ indexHealth: result.indexHealth,
948
+ provenance: result.provenance,
949
+ readOnly: true,
950
+ }
951
+ },
952
+ }))
953
+
533
954
  if (config.promptSection) {
534
955
  ctx.systemPrompt.section({
535
956
  name: 'plugin:unreal-python-api',
536
957
  order: 350,
537
958
  text:
538
959
  scope.scope === 'anywhere'
539
- ? `Unreal Python API (published 5.8 documentation): unreal_python_tools_list and unreal_python_search find documented symbols, unreal_python_syntax returns their exact signatures and parameters, and unreal_python_tool_builder scaffolds a tool from verified symbols in one of four styles — a ToolsetRegistry toolset, an editor script, MCP tool descriptors with their Python handlers, or a DSH tool module built on defineTool. Documentation root: ${docBaseUrl}`
540
- : `Unreal Python API (published 5.8 documentation): unreal_python_tools_list, unreal_python_search and unreal_python_syntax are available here; unreal_python_tool_builder is admitted only inside ${describeScope(scope)}, so it is absent when you work elsewhere. Documentation root: ${docBaseUrl}`,
960
+ ? `Unreal Python API (published 5.8 documentation): unreal_python_tools_list and unreal_python_search find documented symbols, unreal_python_syntax returns their exact signatures and parameters, unreal_python_tool_builder scaffolds a tool from verified symbols in one of four styles — a ToolsetRegistry toolset, an editor script, MCP tool descriptors with their Python handlers, or a DSH tool module built on defineTool, unreal_engine_detect reports the project, installation and running-editor versions separately with any conflict, and unreal_project_inspect returns a read-only module, plugin and indexed-asset inventory through Monolith. Documentation root: ${docBaseUrl}`
961
+ : `Unreal Python API (published 5.8 documentation): unreal_python_tools_list, unreal_python_search, unreal_python_syntax, unreal_engine_detect and unreal_project_inspect are available here; unreal_python_tool_builder is admitted only inside ${describeScope(scope)}, so it is absent when you work elsewhere. Documentation root: ${docBaseUrl}`,
541
962
  })
542
963
  }
543
964
  }