hoi4-agent-tools 0.1.6 → 0.2.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 +46 -0
- package/README.md +44 -27
- package/SECURITY.md +4 -2
- package/dist/bin/setup.js +43 -6
- package/dist/bin/setup.js.map +1 -1
- package/dist/hoi4_agent_tools/core/configuration.d.ts +1 -0
- package/dist/hoi4_agent_tools/core/configuration.d.ts.map +1 -1
- package/dist/hoi4_agent_tools/core/configuration.js +3 -3
- package/dist/hoi4_agent_tools/core/configuration.js.map +1 -1
- package/dist/hoi4_agent_tools/core/engine.d.ts +1 -0
- package/dist/hoi4_agent_tools/core/engine.d.ts.map +1 -1
- package/dist/hoi4_agent_tools/core/engine.js +1 -0
- package/dist/hoi4_agent_tools/core/engine.js.map +1 -1
- package/dist/hoi4_agent_tools/core/index.d.ts.map +1 -1
- package/dist/hoi4_agent_tools/core/index.js +10 -2
- package/dist/hoi4_agent_tools/core/index.js.map +1 -1
- package/dist/hoi4_agent_tools/core/transactions.d.ts +2 -0
- package/dist/hoi4_agent_tools/core/transactions.d.ts.map +1 -1
- package/dist/hoi4_agent_tools/core/transactions.js +49 -6
- package/dist/hoi4_agent_tools/core/transactions.js.map +1 -1
- package/dist/hoi4_agent_tools/core/workspace.js +1 -1
- package/dist/hoi4_agent_tools/core/workspace.js.map +1 -1
- package/dist/hoi4_agent_tools/focus/compiler.d.ts +2 -1
- package/dist/hoi4_agent_tools/focus/compiler.d.ts.map +1 -1
- package/dist/hoi4_agent_tools/focus/compiler.js +12 -2
- package/dist/hoi4_agent_tools/focus/compiler.js.map +1 -1
- package/dist/hoi4_agent_tools/focus/importer.d.ts.map +1 -1
- package/dist/hoi4_agent_tools/focus/importer.js +13 -2
- package/dist/hoi4_agent_tools/focus/importer.js.map +1 -1
- package/dist/hoi4_agent_tools/focus/layout.d.ts.map +1 -1
- package/dist/hoi4_agent_tools/focus/layout.js +165 -42
- package/dist/hoi4_agent_tools/focus/layout.js.map +1 -1
- package/dist/hoi4_agent_tools/focus/lint.d.ts.map +1 -1
- package/dist/hoi4_agent_tools/focus/lint.js +37 -8
- package/dist/hoi4_agent_tools/focus/lint.js.map +1 -1
- package/dist/hoi4_agent_tools/focus/model.d.ts +5 -1
- package/dist/hoi4_agent_tools/focus/model.d.ts.map +1 -1
- package/dist/hoi4_agent_tools/focus/model.js +2 -0
- package/dist/hoi4_agent_tools/focus/model.js.map +1 -1
- package/dist/hoi4_agent_tools/focus/presentation.d.ts.map +1 -1
- package/dist/hoi4_agent_tools/focus/presentation.js +13 -5
- package/dist/hoi4_agent_tools/focus/presentation.js.map +1 -1
- package/dist/hoi4_agent_tools/focus/render.d.ts +4 -0
- package/dist/hoi4_agent_tools/focus/render.d.ts.map +1 -1
- package/dist/hoi4_agent_tools/focus/render.js +17 -3
- package/dist/hoi4_agent_tools/focus/render.js.map +1 -1
- package/dist/hoi4_agent_tools/focus/service.d.ts.map +1 -1
- package/dist/hoi4_agent_tools/focus/service.js +142 -97
- package/dist/hoi4_agent_tools/focus/service.js.map +1 -1
- package/dist/hoi4_agent_tools/focus/source-update.d.ts.map +1 -1
- package/dist/hoi4_agent_tools/focus/source-update.js +9 -4
- package/dist/hoi4_agent_tools/focus/source-update.js.map +1 -1
- package/dist/hoi4_agent_tools/gui/studio.d.ts.map +1 -1
- package/dist/hoi4_agent_tools/gui/studio.js +3 -2
- package/dist/hoi4_agent_tools/gui/studio.js.map +1 -1
- package/dist/hoi4_agent_tools/map/service.d.ts.map +1 -1
- package/dist/hoi4_agent_tools/map/service.js +11 -5
- package/dist/hoi4_agent_tools/map/service.js.map +1 -1
- package/dist/hoi4_agent_tools/mcp/prompts/register.d.ts +2 -1
- package/dist/hoi4_agent_tools/mcp/prompts/register.d.ts.map +1 -1
- package/dist/hoi4_agent_tools/mcp/prompts/register.js +35 -13
- package/dist/hoi4_agent_tools/mcp/prompts/register.js.map +1 -1
- package/dist/hoi4_agent_tools/mcp/registry/metadata.d.ts +1 -1
- package/dist/hoi4_agent_tools/mcp/resources/register.d.ts.map +1 -1
- package/dist/hoi4_agent_tools/mcp/resources/register.js +1 -0
- package/dist/hoi4_agent_tools/mcp/resources/register.js.map +1 -1
- package/dist/hoi4_agent_tools/mcp/security/auth.d.ts.map +1 -1
- package/dist/hoi4_agent_tools/mcp/security/auth.js +1 -4
- package/dist/hoi4_agent_tools/mcp/security/auth.js.map +1 -1
- package/dist/hoi4_agent_tools/mcp/server/base-tools.d.ts +12 -0
- package/dist/hoi4_agent_tools/mcp/server/base-tools.d.ts.map +1 -1
- package/dist/hoi4_agent_tools/mcp/server/base-tools.js +297 -218
- package/dist/hoi4_agent_tools/mcp/server/base-tools.js.map +1 -1
- package/dist/hoi4_agent_tools/mcp/server/create.d.ts.map +1 -1
- package/dist/hoi4_agent_tools/mcp/server/create.js +8 -2
- package/dist/hoi4_agent_tools/mcp/server/create.js.map +1 -1
- package/dist/hoi4_agent_tools/mcp/server/output-schemas.d.ts +5 -0
- package/dist/hoi4_agent_tools/mcp/server/output-schemas.d.ts.map +1 -1
- package/dist/hoi4_agent_tools/mcp/server/output-schemas.js +1 -0
- package/dist/hoi4_agent_tools/mcp/server/output-schemas.js.map +1 -1
- package/dist/hoi4_agent_tools/mcp/server/result.js +1 -1
- package/dist/hoi4_agent_tools/mcp/server/result.js.map +1 -1
- package/dist/hoi4_agent_tools/mcp/server/transaction-execution.d.ts +31 -0
- package/dist/hoi4_agent_tools/mcp/server/transaction-execution.d.ts.map +1 -0
- package/dist/hoi4_agent_tools/mcp/server/transaction-execution.js +127 -0
- package/dist/hoi4_agent_tools/mcp/server/transaction-execution.js.map +1 -0
- package/dist/hoi4_agent_tools/mcp/tools/focus.d.ts.map +1 -1
- package/dist/hoi4_agent_tools/mcp/tools/focus.js +131 -30
- package/dist/hoi4_agent_tools/mcp/tools/focus.js.map +1 -1
- package/dist/hoi4_agent_tools/mcp/tools/gui.d.ts +6 -0
- package/dist/hoi4_agent_tools/mcp/tools/gui.d.ts.map +1 -1
- package/dist/hoi4_agent_tools/mcp/tools/gui.js +40 -12
- package/dist/hoi4_agent_tools/mcp/tools/gui.js.map +1 -1
- package/dist/hoi4_agent_tools/mcp/tools/map.d.ts.map +1 -1
- package/dist/hoi4_agent_tools/mcp/tools/map.js +39 -12
- package/dist/hoi4_agent_tools/mcp/tools/map.js.map +1 -1
- package/dist/hoi4_agent_tools/mcp/transports/http.d.ts.map +1 -1
- package/dist/hoi4_agent_tools/mcp/transports/http.js +3 -0
- package/dist/hoi4_agent_tools/mcp/transports/http.js.map +1 -1
- package/dist/hoi4_agent_tools/schemas/focus.d.ts +1 -1
- package/dist/hoi4_agent_tools/schemas/focus.d.ts.map +1 -1
- package/dist/hoi4_agent_tools/schemas/focus.js +16 -2
- package/dist/hoi4_agent_tools/schemas/focus.js.map +1 -1
- package/dist/hoi4_agent_tools/version.d.ts +1 -1
- package/dist/hoi4_agent_tools/version.js +1 -1
- package/docs/README.md +3 -2
- package/docs/adr/0012-autonomous-rewrites.md +55 -0
- package/docs/adr/README.md +1 -0
- package/docs/agent-integration.md +146 -0
- package/docs/architecture.md +20 -4
- package/docs/artifacts.md +8 -5
- package/docs/completion-report.md +109 -79
- package/docs/configuration.md +30 -10
- package/docs/focus-workflow.md +134 -5
- package/docs/gui-workflow.md +7 -3
- package/docs/limitations.md +4 -2
- package/docs/map-workflow.md +15 -9
- package/docs/performance.md +1 -1
- package/docs/release.md +12 -7
- package/docs/research/mcp-2026-07-10.md +9 -3
- package/docs/security.md +12 -6
- package/docs/self-hosting.md +8 -6
- package/docs/transactions.md +45 -27
- package/docs/troubleshooting.md +12 -4
- package/package.json +7 -3
- package/schemas/configuration.schema.json +3 -2
- package/schemas/continuous-focus-palette.schema.json +1 -1
- package/schemas/focus-plan.schema.json +74 -49
- package/schemas/focus-planning-sidecar.schema.json +33 -18
- package/schemas/gui-animation-source.schema.json +1 -1
- package/schemas/gui-helper.schema.json +1 -1
- package/schemas/gui-scenario.schema.json +1 -1
- package/schemas/map-operation.schema.json +1 -1
- package/schemas/operation-result.schema.json +1 -1
- package/schemas/transaction-manifest.schema.json +1 -1
- package/server.json +4 -4
|
@@ -1,92 +1,122 @@
|
|
|
1
|
-
# Completion report: 0.1.
|
|
1
|
+
# Completion report: 0.1.7 public release
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
- Report date: 2026-07-11
|
|
5
|
-
- Status: fix-forward implementation in qualification; public delivery incomplete
|
|
3
|
+
> Historical release record. Version 0.2.0 supersedes the agent-facing write workflow described here; see [ADR 0012](adr/0012-autonomous-rewrites.md) and the current workflow documentation.
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
- Released version: `0.1.7`
|
|
6
|
+
- Report date: 2026-07-12
|
|
7
|
+
- Status: complete; public delivery, installation, and a real external-workspace transaction are verified
|
|
8
|
+
- Release commit: `9718388626a29dc4b584ae235bdbe325689e44b0`
|
|
9
|
+
- Annotated tag object: `d06a18d106a53007e12a202468cd85356ca91ef7`
|
|
10
|
+
- Exact-source CI: [run 29183088020](https://github.com/klimPaskov/hoi4-agent-tools/actions/runs/29183088020)
|
|
11
|
+
- Release workflow: [run 29183455724](https://github.com/klimPaskov/hoi4-agent-tools/actions/runs/29183455724)
|
|
8
12
|
|
|
9
|
-
|
|
13
|
+
## Outcome
|
|
10
14
|
|
|
11
|
-
The
|
|
15
|
+
The release provides one source-preserving engine for the Focus Tree Workbench, Scripted GUI Studio, Agent Nudger map workflow, MCP handlers, workspace resolution, Clausewitz parsing, symbol indexing, diagnostics, configuration, transactions, artifacts, diffs, and rollback data. It starts read-only, supports local stdio and secured Streamable HTTP, and is published as an installable package, a dual-platform container, an immutable GitHub Release, and an active/latest MCP Registry server.
|
|
16
|
+
|
|
17
|
+
The coding agent selects the server from repository and task context once its MCP host has a persistent registration. No special activation phrase or background daemon is required. The public documentation covers pinned `npx`, optional global installation, durable configuration, Codex and generic client registration, self-hosted HTTP, safe transactions, and large focus-tree repair and creation.
|
|
18
|
+
|
|
19
|
+
Version `0.1.7` additionally qualifies:
|
|
20
|
+
|
|
21
|
+
- uniform `reviewScale` output for large national-tree baseline, transaction, and final artifacts without changing logical geometry or compiled coordinates;
|
|
22
|
+
- exact import, schema, compilation, and targeted-update support for safe symbolic focus-cost constants;
|
|
23
|
+
- complete proposed and post-write focus diagnostics as MCP resources while the bounded inline/manifest limits remain enforced;
|
|
24
|
+
- sidecar-aware post-write focus validation without treating adjacent JSON planning metadata as Clausewitz focus source;
|
|
25
|
+
- agent-first discovery and setup wording, with no human-request activation framing.
|
|
26
|
+
|
|
27
|
+
No installed-game data, external-mod data, local configuration, runtime artifacts, test fixtures, source files, or tests are included in the npm payload.
|
|
12
28
|
|
|
13
29
|
## Qualification evidence
|
|
14
30
|
|
|
15
|
-
|
|
31
|
+
All 46 portable test files passed: 503 tests passed and one POSIX-only case was intentionally skipped on Windows. Enforced coverage is 88.58% statements, 78.34% branches, 91.38% functions, and 90.03% lines.
|
|
16
32
|
|
|
17
|
-
|
|
33
|
+
The release gate and exact-source CI also verified:
|
|
18
34
|
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
- official MCP
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
- read-only production-container checks proving OAuth metadata discovery, unauthenticated `401`, invalid-Origin `403`, protocol-only stdio initialization/discovery of all 26 tools, and a real read-only `hoi4.project_status` call from the non-root Node 22.23.1 runtime;
|
|
29
|
-
- reusable bounded GUI helper templates, source-valid typed helper output, explicit state variants, deterministic scrolling and static meter handoffs, and refusal tests for unsafe or ambiguous helper compilation;
|
|
30
|
-
- explicit even-odd province polygons with raster-boundary bounds checking before rasterization, pixel-center sampling, and refusal rather than clipping;
|
|
31
|
-
- interrupted GitHub release recovery through a uniquely selected, byte-verified draft without asset overwrite or deletion, followed by exact immutable-release verification;
|
|
32
|
-
- three installed-data qualifications covering a large vanilla/external focus workflow, a real GUI/GFX/font graph with deterministic full/annotated renders, and full province-map scan/render/storage without launching the game; the 302,497,021-byte canonical GUI graph was stored exactly as three bounded resources plus its one-read index while the default 128 MiB per-object ceiling remained enabled;
|
|
33
|
-
- deterministic cold/warm benchmark output for the 255-focus, 203-visible-element GUI, and all-layer map workloads, including same-size/same-mtime content-hash invalidation.
|
|
35
|
+
- deterministic project-owned focus, GUI, and map fixtures and generated schemas;
|
|
36
|
+
- a 417-file package allowlist and clean installed entry points;
|
|
37
|
+
- official MCP Inspector discovery against the production stdio server;
|
|
38
|
+
- Node 22 and 24 on Windows and Linux plus the production container build;
|
|
39
|
+
- zero dependency vulnerabilities, 448 dependency registry signatures, and 128 dependency attestations in the pinned release checkout;
|
|
40
|
+
- live official MCP Registry schema/API validation;
|
|
41
|
+
- strict tag, main ancestry, release ordering, immutable-release settings, and exact artifact identity;
|
|
42
|
+
- stdio stdout isolation, authenticated/Origin-validated Streamable HTTP, limits, isolation, progress, cancellation, sessions, and resource reads;
|
|
43
|
+
- source preservation, deterministic rendering, bitmap diffs, stale-plan rejection, atomic multi-file apply, post-write validation, exact rollback, symlink/path/cross-workspace security, and end-to-end coding-agent workflows.
|
|
34
44
|
|
|
35
|
-
|
|
45
|
+
Independent final code and documentation reviews found no actionable defects. The code review covered symbolic cost preservation, uniform review scaling, complete diagnostic resources, capacity accounting, rollback behavior, sidecar filtering, and security boundaries.
|
|
36
46
|
|
|
37
47
|
## Public delivery status
|
|
38
48
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
##
|
|
82
|
-
|
|
83
|
-
1.
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
49
|
+
| Surface | Verified public evidence | Status |
|
|
50
|
+
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
|
|
51
|
+
| GitHub source | Public repository, annotated tag object `d06a18d...`, peeled commit `97183886...`, and green exact-source CI | Verified |
|
|
52
|
+
| npm | `hoi4-agent-tools@0.1.7`, Registry signature, npm publish attestation, and SLSA provenance v1 | Verified |
|
|
53
|
+
| GitHub Release | Immutable [Release v0.1.7](https://github.com/klimPaskov/hoi4-agent-tools/releases/tag/v0.1.7), ID `352694363`, with exactly four byte-verified assets | Verified |
|
|
54
|
+
| GHCR | Anonymous `ghcr.io/klimpaskov/hoi4-agent-tools:0.1.7` OCI index with exact amd64/arm64 runtimes and attached attestations | Verified |
|
|
55
|
+
| MCP Registry | Exact `io.github.klimPaskov/hoi4-agent-tools@0.1.7` record with official `active` and `isLatest: true` state | Verified |
|
|
56
|
+
| Public install | Clean install, signature/attestation audit, stdio discovery, and authenticated Streamable HTTP qualification | Verified |
|
|
57
|
+
|
|
58
|
+
### npm and provenance
|
|
59
|
+
|
|
60
|
+
- Published at `2026-07-12T07:09:58.926Z`; `latest` resolves to `0.1.7`.
|
|
61
|
+
- Tarball: `688,684` bytes at `https://registry.npmjs.org/hoi4-agent-tools/-/hoi4-agent-tools-0.1.7.tgz`.
|
|
62
|
+
- SHA-1: `6c34d998f664b846de4a9b60a6dbadd39898a6cc`.
|
|
63
|
+
- SHA-256: `e0c08ca4db2347dfadc767eea230d4c24071b6f54b1927c7e2a9aa2eec524b0e`.
|
|
64
|
+
- SRI: `sha512-PmCgPyh/qA5dj6jgCpMKsKqFcQCVk0PdMa2PwATfcJ4EETbKgknJEKuaxHLb+UoPaFiDkHSQEJu2fF/UV8EGfQ==`.
|
|
65
|
+
- The npm and GitHub Release tarballs are byte-identical. The npm publish attestation is recorded at Rekor log index `2148574615`; SLSA provenance v1 is recorded at index `2148573874` and binds `release.yml`, `refs/tags/v0.1.7`, release commit `9718388626a29dc4b584ae235bdbe325689e44b0`, and release run `29183455724`.
|
|
66
|
+
|
|
67
|
+
### Immutable GitHub Release
|
|
68
|
+
|
|
69
|
+
The GitHub Actions bot published Release ID `352694363` at `2026-07-12T07:15:14Z`. It is neither a draft nor a prerelease and reports `immutable: true`.
|
|
70
|
+
|
|
71
|
+
| Asset | Bytes | SHA-256 |
|
|
72
|
+
| ---------------------------- | ------: | ------------------------------------------------------------------ |
|
|
73
|
+
| `container-image.json` | 361 | `06695fa817a1ac9bc2fbb94840c817732875fec0988fe6caa23d46fec75983cb` |
|
|
74
|
+
| `hoi4-agent-tools-0.1.7.tgz` | 688,684 | `e0c08ca4db2347dfadc767eea230d4c24071b6f54b1927c7e2a9aa2eec524b0e` |
|
|
75
|
+
| `npm-pack.json` | 50,050 | `9417225028ae5f516c5f727785eedf8764842d96e98a9674caab0c671dea3312` |
|
|
76
|
+
| `release-identity.json` | 431 | `49318a7d830e410520e61c6d7f9e67af2be8f072ecde50645f2d19cb962c5a79` |
|
|
77
|
+
|
|
78
|
+
### GHCR image and attestations
|
|
79
|
+
|
|
80
|
+
- OCI index: `sha256:b9651c3647d6f0efe563f82a7973ab4dcde7165546507a7fe6e4e429b0c31f0c`.
|
|
81
|
+
- `linux/amd64`: `sha256:c4927b19b736ced1e528694e8f53bffd8f28066463ab806eacce1ee064715741`.
|
|
82
|
+
- `linux/arm64`: `sha256:372c9ac76ced1cd7afb03e985cbb17855f9e44500257ca816c5f376ad233db7b`.
|
|
83
|
+
- The index exposes exactly two runtime manifests and one attached attestation manifest per runtime. The checked-in release workflow verifies SPDX SBOM and SLSA statements, anonymous access, exact source identity, non-root execution, read-only container behavior, and both supported architectures.
|
|
84
|
+
|
|
85
|
+
### MCP Registry and public installation
|
|
86
|
+
|
|
87
|
+
The official Registry returned `io.github.klimPaskov/hoi4-agent-tools@0.1.7` with `status: active` and `isLatest: true`. `publishedAt`, `updatedAt`, and `statusChangedAt` are all `2026-07-12T07:15:29.426439Z`.
|
|
88
|
+
|
|
89
|
+
A fresh independent public install fetched 132 packages. Its signature audit verified 131 installed-package signatures and 17 attestations with no invalid or missing records. Installed stdio and authenticated, Origin-validated Streamable HTTP initialization/discovery and protocol workflows passed.
|
|
90
|
+
|
|
91
|
+
## Real large-focus transaction proof
|
|
92
|
+
|
|
93
|
+
The published `0.1.7` stdio server was exercised against a 238-focus external mod workspace without copying that workspace into this repository or package.
|
|
94
|
+
|
|
95
|
+
- Baseline import preserved all 238 focus IDs and symbolic costs and reported 15 avoidable connector crossings.
|
|
96
|
+
- The structured plan used 14 branch groups, 12 ordered lanes, 16 fixed anchors, and 222 automatically placed nodes.
|
|
97
|
+
- The proposed layout has 238 unique coordinates, zero parent-order violations, zero connector-crossing findings, and zero errors or blockers.
|
|
98
|
+
- Source and semantic projections are byte-identical after normalising only focus `x`/`y` and `continuous_focus_position`; prerequisites, exclusions, rewards, triggers, comments, unknown fields, raw blocks, ordering, encoding, and symbolic costs are preserved.
|
|
99
|
+
- The dry run emitted one complete transaction-diff page with 14 artifacts. A second fresh dry run reproduced every non-manifest artifact byte-for-byte.
|
|
100
|
+
- A public-package apply passed all eight validation checks. Explicit rollback restored the exact baseline source hash and removed the newly created planning sidecar. A fresh transaction was then applied and retained.
|
|
101
|
+
- Final scan/lint/render recovered all planning metadata and reproduced the reviewed 6317 by 1997 PNG exactly at `reviewScale: 0.4`.
|
|
102
|
+
- Complete proposed and post-write diagnostic resources retained 116 content-specific repeated-reward warnings with zero hard findings. The fixed transaction diagnostic ceiling was not raised or bypassed.
|
|
103
|
+
|
|
104
|
+
## Acceptance coverage
|
|
105
|
+
|
|
106
|
+
| Acceptance source | Completion evidence |
|
|
107
|
+
| ------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
108
|
+
| `00_standalone_project_bootstrap.md` | Independent public Git repository, Apache-2.0 licensing, project-owned instructions/docs/tests/workflows, installable npm package, immutable Release, and Registry metadata |
|
|
109
|
+
| `01_shared_architecture.md` | One engine and shared workspace/source/index/diagnostic/configuration/transaction/artifact services across Focus, GUI, map, and MCP tests |
|
|
110
|
+
| `02_focus_tree_workbench.md` | Source-preserving import/layout/lint/render/create/update workflows, complex route metadata, deterministic HTML/SVG/PNG/JSON, and source-linked diagnostics |
|
|
111
|
+
| `03_scripted_gui_studio.md` | Deterministic full/crop/annotation/state/resolution/click-region/hierarchy/comparison rendering, integrated source graphs, bitmap diffs, and mandatory fidelity reports |
|
|
112
|
+
| `04_agent_nudger.md` | Declarative state/province/geometry/region/adjacency/supply/railway transactions, global ID/color scans, split-data blockers, map artifacts, and rollback tests |
|
|
113
|
+
| `05_validation_delivery_and_agent_integration.md` | 503 portable tests, enforced coverage, synthetic CI fixtures, installed-data qualification, official Inspector, package/install checks, and coding-agent workflows |
|
|
114
|
+
| `06_public_mcp_server.md` | Read-only-default stdio and secured Streamable HTTP, OAuth/origin/isolation/limit checks, typed handlers, resource-backed artifacts, package/Release/GHCR/Registry publication, and client examples |
|
|
115
|
+
|
|
116
|
+
## Simplifications, omissions, and blockers
|
|
117
|
+
|
|
118
|
+
No required feature was replaced by a mock tool, static placeholder diagram, manual editor, interactive dashboard, game automation, or unpublished package. No required acceptance item or release blocker remains.
|
|
119
|
+
|
|
120
|
+
Engine-unknown syntax and renderer fields are preserved and explicitly reported through refusal diagnostics and fidelity reports. Supported boundaries remain listed in [Known limitations](limitations.md), not hidden behind fallback rewrites. The real external focus workflow deliberately preserved 116 gameplay-design warnings because it was a layout-only transaction; those warnings are reported above and are not suppressed by the server.
|
|
121
|
+
|
|
122
|
+
Detailed release commands, ordering, recovery behavior, and the immutable earlier release-attempt history remain in [Release and MCP Registry publication](release.md).
|
package/docs/configuration.md
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
# Configuration and workspaces
|
|
2
2
|
|
|
3
|
-
Pass a config with `--config PATH` or `HOI4_AGENT_CONFIG`.
|
|
3
|
+
Pass a config with `--config PATH` or `HOI4_AGENT_CONFIG`. Without either override, the server uses
|
|
4
|
+
`~/.config/hoi4-agent-tools/config.json` on every platform (for example,
|
|
5
|
+
`C:\\Users\\name\\.config\\hoi4-agent-tools\\config.json` on Windows). A different durable absolute
|
|
6
|
+
path is equally valid when the client registration sets `HOI4_AGENT_CONFIG`. Unknown fields are
|
|
7
|
+
rejected.
|
|
4
8
|
The read-only setup discovery command also checks `HOI4_GAME_ROOT` and the path-delimited `HOI4_MOD_ROOTS`; it reports candidates without registering or modifying them.
|
|
5
9
|
|
|
10
|
+
Setup stays read-only unless a write flag is explicit. The recommended write configuration is generated with:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
hoi4-agent-tools-setup --init-config /absolute/path/config.json --workspace /absolute/path/mod --autonomous-writes --server-state /separate/operator/state
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
That writes `"writePolicy": "autonomous"` and `"writeEnabled": true` for the supplied mod. Use `--reviewed-writes` only for the legacy separate review/apply tool sequence; `--enable-writes` remains a compatibility alias for reviewed mode. Autonomous and reviewed flags are mutually exclusive, and both require `--server-state`.
|
|
17
|
+
|
|
6
18
|
The stdio executable accepts newline-delimited JSON-RPC frames up to a fixed 16,777,216-byte
|
|
7
19
|
ceiling, excluding the line-feed delimiter. This transport safety limit is deliberately not a
|
|
8
20
|
configuration field; malformed UTF-8 and oversized terminated or unterminated frames close the
|
|
@@ -12,7 +24,7 @@ separately configured `http.maxBodyBytes`.
|
|
|
12
24
|
```json
|
|
13
25
|
{
|
|
14
26
|
"version": 1,
|
|
15
|
-
"writePolicy": "
|
|
27
|
+
"writePolicy": "autonomous",
|
|
16
28
|
"serverStateRoot": "/var/lib/hoi4-agent-tools-state",
|
|
17
29
|
"transactionTtlSeconds": 3600,
|
|
18
30
|
"transactionMaxJournalBytes": 536870912,
|
|
@@ -43,7 +55,7 @@ separately configured `http.maxBodyBytes`.
|
|
|
43
55
|
"replacePaths": ["common/national_focus"],
|
|
44
56
|
"artifactRoot": "/srv/hoi4/workspaces/example/.hoi4-agent/artifacts",
|
|
45
57
|
"cacheRoot": "/srv/hoi4/workspaces/example/.hoi4-agent/cache",
|
|
46
|
-
"writeEnabled":
|
|
58
|
+
"writeEnabled": true
|
|
47
59
|
}
|
|
48
60
|
]
|
|
49
61
|
}
|
|
@@ -56,8 +68,8 @@ All byte values are exact bytes. Defaults are applied when a field is omitted.
|
|
|
56
68
|
| Field | Default | Validation and behavior |
|
|
57
69
|
| ---------------------------- | ----------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
58
70
|
| `version` | required | Must equal the current configuration version, `1`. |
|
|
59
|
-
| `writePolicy` | `"read-only"` | `"read-only"` or `"transactions"`.
|
|
60
|
-
| `serverStateRoot` | omitted | Required for
|
|
71
|
+
| `writePolicy` | `"read-only"` | `"read-only"`, recommended `"autonomous"`, or compatibility `"transactions"`. |
|
|
72
|
+
| `serverStateRoot` | omitted | Required for either write policy; absolute canonical operator state used for the private journal key and replay-protection heads. |
|
|
61
73
|
| `transactionTtlSeconds` | `3600` | 60 through 86,400 seconds. |
|
|
62
74
|
| `transactionMaxJournalBytes` | `536870912` | At least 1 MiB; aggregate transaction-journal retention ceiling and per-plan work ceiling. |
|
|
63
75
|
| `transactionMaxJournals` | `128` | 1 through 10,000 journals per workspace cache. |
|
|
@@ -78,7 +90,7 @@ The configuration also rejects unsafe combined budgets: `scanMaxBytes` multiplie
|
|
|
78
90
|
`maxConcurrentRequests` must be at most 16 MiB. HTTP concurrency has a fixed maximum of two so two
|
|
79
91
|
simultaneous offline renders cannot exceed the supported process-safety model.
|
|
80
92
|
|
|
81
|
-
`serverStateRoot` is mandatory whenever `writePolicy` is `"
|
|
93
|
+
`serverStateRoot` is mandatory whenever `writePolicy` is not `"read-only"`. It must be absolute,
|
|
82
94
|
resolve to a canonical directory through components that contain no symbolic links or junctions,
|
|
83
95
|
and it must not overlap any configured or runtime source, fixture, artifact, cache, registration,
|
|
84
96
|
writable-registration, or storage root. The server stores the native canonical spelling, including
|
|
@@ -97,7 +109,7 @@ protocol when those primitives are unavailable.
|
|
|
97
109
|
| Field | Default | Validation and behavior |
|
|
98
110
|
| ----------------- | ------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
99
111
|
| `id` | required | Lowercase identifier matching `[a-z][a-z0-9_-]{0,63}`; unique in the configuration. |
|
|
100
|
-
| `name` | required |
|
|
112
|
+
| `name` | required | Display name, 1 through 200 characters. |
|
|
101
113
|
| `root` | required | Primary source root. Its root kind is selected by `kind`. |
|
|
102
114
|
| `kind` | `"mod"` | `"mod"`, `"game"`, or `"dependency"`. Only a mod primary root can ever be writable. |
|
|
103
115
|
| `gameRoot` | omitted | Optional additional read-only base-game source; it must not overlap another source in the workspace. |
|
|
@@ -108,7 +120,7 @@ protocol when those primitives are unavailable.
|
|
|
108
120
|
| `artifactRoot` | mod default; otherwise required | A mod defaults to `<root>/.hoi4-agent/artifacts`. A game/dependency primary workspace must name an operator-owned path under `storageRoots`. |
|
|
109
121
|
| `cacheRoot` | mod default; otherwise required | A mod defaults to `<root>/.hoi4-agent/cache`. A game/dependency primary workspace must name an operator-owned path under `storageRoots`. |
|
|
110
122
|
| `fixtureRoot` | omitted | Optional read-only fixture source. |
|
|
111
|
-
| `writeEnabled` | `false` | Effective only for `kind: "mod"` when global `writePolicy` is `"transactions"`.
|
|
123
|
+
| `writeEnabled` | `false` | Effective only for `kind: "mod"` when global `writePolicy` is `"autonomous"` or `"transactions"`. |
|
|
112
124
|
|
|
113
125
|
`registrationRoots`, `writableRegistrationRoots`, and `storageRoots` grant different capabilities:
|
|
114
126
|
|
|
@@ -166,11 +178,19 @@ path samples, so a workspace with many `replace_path` entries cannot inflate a t
|
|
|
166
178
|
|
|
167
179
|
## Read and write policy
|
|
168
180
|
|
|
169
|
-
`writePolicy` defaults to `read-only`.
|
|
181
|
+
`writePolicy` defaults to `read-only`. In this mode the server exposes analysis and evidence tools but no source-mutation path.
|
|
182
|
+
|
|
183
|
+
`autonomous` is the recommended write policy. With `writeEnabled: true` on a mod workspace, it exposes `hoi4.focus_rewrite`, `hoi4.gui_rewrite`, and `hoi4.map_rewrite`. Each tool plans, validates, journals, applies, rebuilds the index, and post-validates inside one call. If application or post-validation fails, exact original bytes are restored automatically. The transaction status/diff/apply/rollback tools are not registered in autonomous mode.
|
|
184
|
+
|
|
185
|
+
`transactions` is an optional compatibility policy for clients that still need a distinct reviewed plan and apply boundary. It exposes the `*_plan_changes`/`map_plan` tools plus `hoi4.transaction_status`, `hoi4.transaction_diff`, `hoi4.transaction_apply`, and `hoi4.transaction_rollback`. It uses the same journal, hash checks, post-validation, and automatic failure recovery as autonomous mode.
|
|
186
|
+
|
|
187
|
+
Both write policies require `serverStateRoot` and `writeEnabled: true` on the target mod. A dependency or game registration remains read-only even if misconfigured. Changing the global policy changes the MCP tool surface; restart the server and reinitialize the MCP session after changing it.
|
|
188
|
+
|
|
189
|
+
The autonomous rewrite tools advertise `destructiveHint: true`. MCP does not require per-call prompts from that annotation, and server configuration cannot override a client's host approval or filesystem policy. A client may still prompt for or refuse a rewrite.
|
|
170
190
|
|
|
171
191
|
`registrationRoots` controls runtime `hoi4.project_register`. A requested root must canonicalize beneath one of these roots, and a runtime mod additionally requires `writableRegistrationRoots`. HTTP principals also need `allowRegistration`. Granting `allowRegistration` permits that principal to register unclaimed sources beneath the configured capability roots, so use narrow roots or static reviewed workspaces for multi-user deployments. Runtime registration does not edit a client configuration or persist raw paths. It atomically records a hash-only owner/workspace claim in the canonical artifact root; later registrations of that physical store must match it. Reassigning a claimed store is therefore an explicit operator operation: stop the server, review/archive the claim and existing evidence, and choose whether to preserve or separately migrate data. The server never deletes or silently rebinds it.
|
|
172
192
|
|
|
173
|
-
|
|
193
|
+
Write modes do not accept pre-upgrade unauthenticated journal manifests. Preserve their
|
|
174
194
|
cache directories for operator review, then explicitly archive or remove them together with the
|
|
175
195
|
corresponding protected state decision; the server never guesses a migration or treats a public
|
|
176
196
|
integrity hash as authorization.
|
package/docs/focus-workflow.md
CHANGED
|
@@ -15,6 +15,11 @@ Decision categories are additive database fragments: the category definition und
|
|
|
15
15
|
The shared index retains those fragments without reporting a duplicate-definition collision while
|
|
16
16
|
still honoring same-relative-file shadowing and load-order source ownership.
|
|
17
17
|
|
|
18
|
+
National focus `cost` values support finite numbers and safe file-scoped constants such as
|
|
19
|
+
`@focus_cost_standard`. Targeted layout updates preserve the exact existing cost lexeme, including
|
|
20
|
+
numeric formatting and comments. A cost token outside the typed model is retained unchanged when
|
|
21
|
+
the plan does not explicitly replace it; the compiler refuses to generate an arbitrary scalar.
|
|
22
|
+
|
|
18
23
|
National focuses and continuous focuses use their actual HOI4 source models. National trees come from the workspace registration's configured `roots.focus` paths. Continuous focuses come from `common/continuous_focus/*.txt` as `continuous_focus_palette = { ... focus = { ... } }`; matching country palettes take precedence over the default palette, and the compiler never emits a `continuous` field inside a national `focus = { ... }` block.
|
|
19
24
|
|
|
20
25
|
## Agent workflow
|
|
@@ -23,9 +28,126 @@ National focuses and continuous focuses use their actual HOI4 source models. Nat
|
|
|
23
28
|
2. `hoi4.focus_scan` imports active national trees, matching continuous-focus palettes, active localisation, sprite definitions, and only the exact texture paths referenced by those sprites.
|
|
24
29
|
3. `hoi4.focus_lint` separates syntax, reference, layout, and design diagnostics. Omit `mode` for national-tree compatibility, or pass `mode: "continuous"` with an optional `paletteId` to lint a palette directly.
|
|
25
30
|
4. `hoi4.focus_layout` calculates stable integer coordinates. Pinned positions and existing coordinates anchor incremental changes.
|
|
26
|
-
5. `hoi4.focus_render` returns deterministic HTML, SVG, PNG, JSON, and generated-source-map resources. National mode also returns the graph layout and hash-bound planning sidecar;
|
|
27
|
-
6. `hoi4.
|
|
28
|
-
7.
|
|
31
|
+
5. `hoi4.focus_render` returns deterministic HTML, SVG, PNG, JSON, and generated-source-map resources. National mode also returns the graph layout and hash-bound planning sidecar; a uniform `reviewScale` from `0.25` through `1.0` keeps unusually wide or deep trees within bounded raster limits without changing logical geometry or source coordinates. Continuous mode accepts palette columns and renders the actual continuous-focus source model.
|
|
32
|
+
6. In autonomous mode, `hoi4.focus_rewrite` accepts either a national plan (the default when `mode` is omitted) or `mode: "continuous"` with a continuous-palette plan. It makes source-preserving range edits where possible, produces before/proposed/bitmap-diff evidence, journals exact recovery bytes, applies, rebuilds the index, and post-validates in one call. National plans may set `horizontalSpacing`, `verticalSpacing`, `padding`, and a uniform `reviewScale` for both review renders; those pixel-space settings do not alter focus coordinates or compiled HOI4 source. National plans also maintain the adjacent planning sidecar. To create a first tree or palette in a new mod source file, set `createIfMissing: true`; without it, missing sources and IDs refuse. Creation never appends a different target to an existing source file, never copies a read-only game/dependency file into a shadowing mod path, and restores newly created source and sidecar files automatically if the rewrite fails.
|
|
33
|
+
7. Check `execution`, drift, diagnostics, validation, changed files, source maps, and diff artifacts. `execution: "planned"` means validation blocked the proposal without changing source; `execution: "applied"` means post-write validation succeeded.
|
|
34
|
+
|
|
35
|
+
With the optional `"transactions"` compatibility policy, use `hoi4.focus_plan_changes`, page through `hoi4.transaction_diff`, and call `hoi4.transaction_apply` with the exact plan hash instead. The same core validation and recovery engine is used.
|
|
36
|
+
|
|
37
|
+
## Repairing an existing large tree
|
|
38
|
+
|
|
39
|
+
Imported authored coordinates are fixed by design. A plain `hoi4.focus_layout` call therefore
|
|
40
|
+
audits an existing layout without silently rearranging it. To opt a badly structured tree into a
|
|
41
|
+
full cleanup, the coding agent must make the movement policy explicit:
|
|
42
|
+
|
|
43
|
+
1. Scan, lint, and render the baseline, then read the complete imported plan resource. Use the same
|
|
44
|
+
national `reviewScale` for baseline, transaction, and final renders when the default canvas is too
|
|
45
|
+
large.
|
|
46
|
+
2. Preserve every prerequisite group, exclusion, route lock, reward, raw passthrough entry, source
|
|
47
|
+
location, and provenance value.
|
|
48
|
+
3. Model the intended route architecture with `branchGroups`, `laneGroups`, `branchId`, and
|
|
49
|
+
`laneId`. Give lanes stable order and, where appropriate, horizontal bounds.
|
|
50
|
+
4. Keep only deliberate trunk or convergence anchors fixed/pinned. Change every movable focus to
|
|
51
|
+
`{ "mode": "auto", "pinned": false }`; `preferredX` and `preferredY` may retain the authored
|
|
52
|
+
route intent without making those coordinates mandatory.
|
|
53
|
+
5. Submit the complete plan to `hoi4.focus_rewrite`. The call performs layout, compilation,
|
|
54
|
+
lint, source-preserving range edits, deterministic before/proposed rendering, bitmap diffing,
|
|
55
|
+
journaling, application, index rebuild, and post-write validation.
|
|
56
|
+
For an unusually wide or deep tree, set a uniform national `reviewScale` between `0.25` and
|
|
57
|
+
`1.0`; `0.4` is appropriate for a very large comparison. It scales nodes, text, connectors, and
|
|
58
|
+
the viewport together, avoiding artificial overlap. The same scale governs both sides of the
|
|
59
|
+
comparison and affects only artifact pixels, never source-grid coordinates. Explicit spacing and
|
|
60
|
+
padding remain available when the artifact's logical presentation itself needs adjustment.
|
|
61
|
+
6. Inspect the returned validation and evidence links. Rescan, lint, and render when additional
|
|
62
|
+
final evidence is useful. A blocked proposal changes nothing; failure after replacement begins
|
|
63
|
+
restores every affected file automatically.
|
|
64
|
+
|
|
65
|
+
This workflow is suitable for hundreds of focuses. The solver keeps parents above children,
|
|
66
|
+
rejects visible overlap and duplicate coordinates, separates bounded lanes, validates relative
|
|
67
|
+
chains, and minimizes avoidable connector crossings. It never changes gameplay relationships to
|
|
68
|
+
make a picture look cleaner.
|
|
69
|
+
|
|
70
|
+
## Authoring a large tree
|
|
71
|
+
|
|
72
|
+
For a new tree, translate route requirements into the strict public schema at
|
|
73
|
+
`hoi4-agent://schema/focus-plan`. A robust plan uses a centered entry/trunk, bounded political or
|
|
74
|
+
strategic lanes, separately modelled shared-support lanes, exact AND/OR prerequisite groups,
|
|
75
|
+
reciprocal route exclusions, explicit convergence and capstones, automatic positions, and complete
|
|
76
|
+
localisation/icon/AI/link metadata. Unsupported Clausewitz blocks belong in `rawPassthrough` so they
|
|
77
|
+
round-trip instead of being approximated.
|
|
78
|
+
|
|
79
|
+
This minimal national plan is schema-valid. It intentionally omits an icon and reward; a production
|
|
80
|
+
tree should add complete presentation and gameplay data before rewriting:
|
|
81
|
+
|
|
82
|
+
```json
|
|
83
|
+
{
|
|
84
|
+
"schemaVersion": 1,
|
|
85
|
+
"id": "example_tree",
|
|
86
|
+
"default": false,
|
|
87
|
+
"branchGroups": [
|
|
88
|
+
{
|
|
89
|
+
"id": "constitutional",
|
|
90
|
+
"label": "Constitutional route",
|
|
91
|
+
"family": "politics",
|
|
92
|
+
"focusIds": ["example_entry"],
|
|
93
|
+
"laneId": "centre",
|
|
94
|
+
"major": true,
|
|
95
|
+
"hidden": false,
|
|
96
|
+
"crisis": false,
|
|
97
|
+
"conditional": false,
|
|
98
|
+
"aiStrategyIds": []
|
|
99
|
+
}
|
|
100
|
+
],
|
|
101
|
+
"laneGroups": [
|
|
102
|
+
{ "id": "left", "label": "Left route", "order": 0, "minimumX": -12, "maximumX": -5 },
|
|
103
|
+
{ "id": "centre", "label": "Constitutional trunk", "order": 1, "minimumX": -2, "maximumX": 2 },
|
|
104
|
+
{ "id": "right", "label": "Right route", "order": 2, "minimumX": 5, "maximumX": 12 }
|
|
105
|
+
],
|
|
106
|
+
"entryFocusIds": ["example_entry"],
|
|
107
|
+
"focuses": [
|
|
108
|
+
{
|
|
109
|
+
"id": "example_entry",
|
|
110
|
+
"label": "Example entry",
|
|
111
|
+
"branchId": "constitutional",
|
|
112
|
+
"laneId": "centre",
|
|
113
|
+
"prerequisites": { "operator": "and", "groups": [] },
|
|
114
|
+
"mutuallyExclusive": [],
|
|
115
|
+
"routeLocks": [],
|
|
116
|
+
"position": { "mode": "auto", "pinned": false, "preferredX": 0, "preferredY": 0 },
|
|
117
|
+
"visibility": "normal",
|
|
118
|
+
"convergence": false,
|
|
119
|
+
"sharedSupport": false,
|
|
120
|
+
"icons": [],
|
|
121
|
+
"localisation": {
|
|
122
|
+
"titleKey": "example_entry",
|
|
123
|
+
"descriptionKey": "example_entry_desc",
|
|
124
|
+
"workingLabel": "Example entry"
|
|
125
|
+
},
|
|
126
|
+
"ai": { "majorRoute": true, "strategyIds": [] },
|
|
127
|
+
"filters": ["FOCUS_FILTER_POLITICAL"],
|
|
128
|
+
"links": [],
|
|
129
|
+
"rawPassthrough": []
|
|
130
|
+
}
|
|
131
|
+
],
|
|
132
|
+
"sharedFocusIds": [],
|
|
133
|
+
"continuousFocusPaletteIds": [],
|
|
134
|
+
"continuousFocusIds": [],
|
|
135
|
+
"rawPassthrough": [],
|
|
136
|
+
"provenance": {
|
|
137
|
+
"sourcePath": "plan:example_tree",
|
|
138
|
+
"sourceHash": "0000000000000000000000000000000000000000000000000000000000000000",
|
|
139
|
+
"importedPlanHash": "0000000000000000000000000000000000000000000000000000000000000000"
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Within each focus, one `prerequisites.groups` entry represents one Clausewitz `prerequisite` block
|
|
145
|
+
whose listed focuses are OR alternatives. Multiple group entries are AND requirements. For a new
|
|
146
|
+
target, use `sourcePath: "plan:<tree-id>"` and 64 zeroes for both initial hashes, then call
|
|
147
|
+
`hoi4.focus_rewrite` with `createIfMissing: true`. Use that convention only for a missing
|
|
148
|
+
target. Existing sources normally use imported, hash-bound provenance; resolving intentional
|
|
149
|
+
plan/source drift additionally requires explicit `authority: "plan"`. The server refuses to append
|
|
150
|
+
a different tree to an occupied source file and still requires complete pre-write and post-write validation.
|
|
29
151
|
|
|
30
152
|
## Prerequisite and route semantics
|
|
31
153
|
|
|
@@ -47,7 +169,7 @@ Raster discovery is deliberately exact: the shared workspace scan does not walk
|
|
|
47
169
|
|
|
48
170
|
## Layout contract
|
|
49
171
|
|
|
50
|
-
Hard constraints keep parents above children, coordinates unique, visible nodes non-overlapping,
|
|
172
|
+
Hard constraints keep parents above children, coordinates unique, visible nodes non-overlapping, automatic nodes inside configured lane bounds, pinned nodes fixed, and relative-position chains valid. Automatic preferred coordinates are clamped to their lane; a full lane raises `FOCUS_LAYOUT_LANE_CAPACITY_BLOCKED`. Fixed, relative, or prior-stable coordinates outside their declared lane are preserved as evidence but produce a blocking `FOCUS_LAYOUT_LANE_BOUNDS_VIOLATION`. The solver records every move and unsatisfied constraint. It never changes a prerequisite, silently stacks nodes, or invents a route.
|
|
51
173
|
|
|
52
174
|
Mutual-exclusion relationships are also layout constraints: newly placed automatic endpoints must retain at least the configured `nodeSpacing` in horizontal focus-grid columns. Fixed, relative, pinned, and prior-layout coordinates are stability anchors. The solver does not move those anchors to improve mutual-exclusion spacing or connector routing; it emits `FOCUS_LAYOUT_MUTUAL_EXCLUSION_SPACING_UNSATISFIED` with the movable and preserved endpoints when authored constraints make the gap impossible.
|
|
53
175
|
|
|
@@ -59,10 +181,17 @@ Weak dangling branches, terminal payoff, missing AI, and repeated generic reward
|
|
|
59
181
|
|
|
60
182
|
The plan records imported source and semantic hashes. If both saved plan and hand-edited script diverge, regeneration is blocked until the coding agent explicitly identifies the authoritative source. Raw fields remain attached to source ranges either way. An explicitly created target reports `target_missing` drift with `requiresAuthority: false`; that status means there is no prior target to reconcile, not that an existing source was overwritten.
|
|
61
183
|
|
|
62
|
-
Every compiled or proposed focus block receives a source-map entry containing the focus ID, generated location, planning-node location when available, and imported source location when available. National render artifacts use `<tree>.focus.source-map.json`; continuous renders use `<palette>.continuous.source-map.json`.
|
|
184
|
+
Every compiled or proposed focus block receives a source-map entry containing the focus ID, generated location, planning-node location when available, and imported source location when available. National render artifacts use `<tree>.focus.source-map.json`; continuous renders use `<palette>.continuous.source-map.json`. Rewrite journals retain the corresponding proposed source map and all review artifacts after success or automatic restoration.
|
|
63
185
|
|
|
64
186
|
## Artifacts
|
|
65
187
|
|
|
66
188
|
Each rendered node includes its ID, resolved title/working label, resolved icon frame or diagnostic, coordinates, prerequisite type, exclusions, branch family, planner visibility/convergence/terminal state, AI metadata, and source-linked diagnostics. HTML search and filters inspect evidence only; they cannot write source.
|
|
67
189
|
|
|
68
190
|
National-tree renders store `<tree>.focus.html`, `.svg`, `.png`, `.json`, `.source-map.json`, and `.plan.json`. Continuous-palette renders use the same core artifact store and produce `<palette>.continuous.html`, `.svg`, `.png`, `.json`, and `.source-map.json`. The JSON embeds the same complete generated-source map that is also stored separately, and all formats carry content hashes plus source/render provenance.
|
|
191
|
+
|
|
192
|
+
A national focus rewrite also stores `<tree>.focus.proposed-validation.json`. It contains every
|
|
193
|
+
diagnostic and validation check from re-importing, laying out, and linting the compiled proposal.
|
|
194
|
+
When that complete set is larger than the fixed transaction-manifest allowance, the manifest keeps
|
|
195
|
+
a blocker-first bounded summary and an explicit resource diagnostic; it never drops findings from
|
|
196
|
+
the validation decision. The rewrite boundary uses the same pattern for oversized post-write
|
|
197
|
+
diagnostics.
|
package/docs/gui-workflow.md
CHANGED
|
@@ -63,11 +63,15 @@ BMFont text inputs stop at 2,097,152 bytes, 50,000 records, 32 fields per record
|
|
|
63
63
|
|
|
64
64
|
## Source-preserving plans
|
|
65
65
|
|
|
66
|
-
Existing `.gui` files accept only hash-bound patches at parser-proven ranges. A patch may replace one known scalar assignment or scalar value, delete one known scalar assignment, or insert complete parsed entries immediately before a block close. Whole-file ranges, block rewrites, unknown-field rewrites, malformed insertions, stale text, and ambiguous ranges are refused. New files may be supplied in full only when no mod, dependency, or game source already owns the path. Every proposal is reparsed and rendered before it can
|
|
66
|
+
Existing `.gui` files accept only hash-bound patches at parser-proven ranges. A patch may replace one known scalar assignment or scalar value, delete one known scalar assignment, or insert complete parsed entries immediately before a block close. Whole-file ranges, block rewrites, unknown-field rewrites, malformed insertions, stale text, and ambiguous ranges are refused. New files may be supplied in full only when no mod, dependency, or game source already owns the path. Every proposal is reparsed and rendered before it can be journaled or applied.
|
|
67
|
+
|
|
68
|
+
With `writePolicy: "autonomous"`, call `hoi4.gui_rewrite` in `source`, `patches`, or `helpers` mode. The one call validates the proposal, persists exact recovery bytes, applies under the workspace lock, rebuilds the index, and post-validates. A successful result reports `execution: "applied"`; a blocked proposal reports `execution: "blocked"` and changes no source; a valid no-change request reports `execution: "unchanged"`. Any application or post-validation failure restores the original bytes automatically. No transaction diff/apply/rollback tools are exposed in autonomous mode.
|
|
69
|
+
|
|
70
|
+
The optional `"transactions"` compatibility policy exposes `hoi4.gui_plan_changes` and the separate transaction review/apply tools instead. Both policies use the same source-preserving compiler, validation, journal, and recovery implementation.
|
|
67
71
|
|
|
68
72
|
## Declarative helper compilation
|
|
69
73
|
|
|
70
|
-
`hoi4.
|
|
74
|
+
`hoi4.gui_rewrite` in `helpers` mode compiles a strict, build-time helper document into explicit `.gui` source and runs it through the normal autonomous rewrite path. In compatibility mode, use `hoi4.gui_plan_changes` with the same input. The generated mod has no runtime dependency on `hoi4-agent-tools` or its server.
|
|
71
75
|
|
|
72
76
|
A document has one `root` and may declare reusable `templates`. A template instance uses `kind: "template"` plus `templateId`; its instance ID becomes the deterministic prefix for every expanded ID and name. For example, instance `left_status` of a template whose root is named `status_card` produces `left_status__status_card`. Instance fields may override the template root, but templates do not provide parameters, slots, or appended children. Missing references, duplicate template IDs, duplicate node IDs, reference cycles, duplicate compiled GUI names, and source or expanded budget overflow refuse compilation. Expanded identifiers stop at 1,024 UTF-8 bytes; conservative source-construction work stops at 16 MiB, and final source stops at the 8 MiB Clausewitz parser ceiling before a transaction is planned.
|
|
73
77
|
|
|
@@ -95,7 +99,7 @@ The structured helpers compile as follows:
|
|
|
95
99
|
|
|
96
100
|
Structured leaf output is type-aware. `iconType` accepts sprite/frame fields, `instantTextBoxType` accepts text/font plus `maxWidth` and `maxHeight`, and `buttonType` accepts sprite/frame plus `buttonText` and `buttonFont`. Leaf elements never receive a fabricated `size` block and cannot contain child GUI elements. Hardcoded or legacy forms such as `checkboxType`, `guiButtonType`, and `textBoxType` are refused by the structured helper; use `raw` only when an exact engine precedent justifies them.
|
|
97
101
|
|
|
98
|
-
Selecting a custom UI `state` requires a matching `stateVariants` entry. Its frame, sprite, text, font, and allowlisted scalar attributes replace the base values in the emitted source; no preview-state comment or inferred frame is written. The engine-managed `normal`, `hover`, `pressed`, and `disabled` states may be named on `buttonType` without a custom variant, but the compiler does not fabricate their frame mapping. Attribute keys must be both safe identifiers and documented scalar fields for the selected container, icon, text, or button type; structured fields, misspellings, and type-incompatible fields cannot be smuggled through `attributes`. `raw` remains the explicit escape hatch for complete advanced Clausewitz GUI source and is counted in
|
|
102
|
+
Selecting a custom UI `state` requires a matching `stateVariants` entry. Its frame, sprite, text, font, and allowlisted scalar attributes replace the base values in the emitted source; no preview-state comment or inferred frame is written. The engine-managed `normal`, `hover`, `pressed`, and `disabled` states may be named on `buttonType` without a custom variant, but the compiler does not fabricate their frame mapping. Attribute keys must be both safe identifiers and documented scalar fields for the selected container, icon, text, or button type; structured fields, misspellings, and type-incompatible fields cannot be smuggled through `attributes`. `raw` remains the explicit escape hatch for complete advanced Clausewitz GUI source and is counted in rewrite evidence.
|
|
99
103
|
|
|
100
104
|
## Validation
|
|
101
105
|
|
package/docs/limitations.md
CHANGED
|
@@ -6,6 +6,7 @@ These are precise safety boundaries, not silent fallbacks.
|
|
|
6
6
|
- Workspace scans default to 20,000 enumerated files, 134,217,728 aggregate content bytes, and 67,108,864 bytes for one file. Operators may lower these values per request but cannot raise them above server policy. Exceeding any ceiling refuses the complete scan with `SCAN_FILE_LIMIT` or `SCAN_BYTE_LIMIT`; a partial index is not returned. The configuration additionally requires aggregate scan bytes multiplied by HTTP request concurrency to remain at or below 512 MiB.
|
|
7
7
|
- Stdio uses strictly decoded UTF-8 newline-delimited JSON-RPC with a fixed 16,777,216-byte frame ceiling, excluding the line-feed delimiter. A malformed UTF-8 frame is refused without replacement decoding; an oversized frame is refused as soon as it crosses the ceiling, even without a newline or end-of-input. Either condition closes the local transport without emitting protocol output. Use workspace files and MCP resources instead of oversized inline payloads.
|
|
8
8
|
- Clausewitz/localisation parsing is bounded to 8,388,608 source bytes and 250,000 lines per file; Clausewitz tokenization is bounded to 250,000 tokens, block nesting to 256 levels, and localisation parsing to 100,000 entries. Broad project and GUI inventories skip the entire active source when one of these bounds is crossed, return `complete: false` with a bounded skipped-source list, and do not walk or publish symbols from the partial parse. An unresolved reference is downgraded only when the skipped source's path family could define that reference kind. Targeted reads and writes still refuse the affected source with an explicit blocker; content beyond a limit is never treated as a complete parse.
|
|
9
|
+
- The aggregate shared index is bounded to 500,000 symbol records and 500,000 reference records. Reaching either ceiling returns an explicitly incomplete inventory. A symbol-ceiling drop records the affected symbol kind so unresolved definitions are reported as partial only where dropped symbols could contain them; the reference ceiling reports incomplete outbound-reference coverage without implying that a missing definition might exist. The server never presents a capped inventory as complete.
|
|
9
10
|
- Source diagnostics are capped at 100 per file. When additional findings exist, 99 findings are retained and the final slot becomes `SOURCE_DIAGNOSTICS_TRUNCATED`, a blocker rather than a silent truncation.
|
|
10
11
|
- Renderer coverage is field-by-field. Parsed engine-only GUI properties are retained raw and reported as ignored or unsupported; source changes crossing an unknown field or parsed block are blocked rather than normalized away. Special `textSpriteType`, `corneredTileSpriteType`, GFX `progressbarType`, and `maskedShieldType` semantics, secondary textures, and effect files currently produce only a partial primary-texture appearance with explicit fidelity items and a warning.
|
|
11
12
|
- Offline GUI output is not guaranteed pixel-identical to the game engine and is never called a screenshot. Modelled geometry and asset composition are deterministic for the recorded render profile.
|
|
@@ -14,6 +15,7 @@ These are precise safety boundaries, not silent fallbacks.
|
|
|
14
15
|
- Declarative GUI helper documents admit at most 1,024 one-root templates and 64 state variants per node; both source and expanded trees remain subject to the 128-level and 10,000-node ceilings. Grid columns stop at 10,000, expanded identifiers at 1,024 UTF-8 bytes, conservative source-construction work at 16 MiB, and final generated source at 8 MiB. Templates have root overrides but no parameters, slots, or appended children. Scroll-list helpers emit deterministic grid and entry-container handoff names but do not create `dynamic_lists` scripted-GUI bindings or verify an external scrollbar definition's axis. Meter helpers choose one static icon frame from a validated range and do not provide runtime progress behavior. Advanced, hardcoded, legacy, or non-allowlisted scalar GUI fields require the counted raw escape hatch.
|
|
15
16
|
- Focus design diagnostics such as weak branches, payoff quality, avoidable crossings, or generic rewards are deterministic heuristics and do not rewrite gameplay.
|
|
16
17
|
- Plan/script drift requires an explicit authoritative-source choice.
|
|
18
|
+
- Autonomous mode deliberately exposes only `hoi4.focus_rewrite`, `hoi4.gui_rewrite`, and `hoi4.map_rewrite`; it does not expose transaction diff, status, apply, or explicit rollback tools. Failed application and post-validation restore automatically. An intentional later reversal requires Git or another explicit domain rewrite. The tools advertise `destructiveHint: true`, but MCP does not mandate per-tool confirmation and the server cannot override its host's approval policy.
|
|
17
19
|
- Map geometry requires an exact polygon with explicit `fillRule: "even-odd"`, a canonical hash-bound raster-mask manifest, or absolute pixel selection. Polygon vertices are integer raster-boundary coordinates: `0` through raster width/height are valid, greater coordinates are refused before work allocation, and polygons are never clipped. Inclusion is determined at pixel centers. Descriptive geography alone cannot apply.
|
|
18
20
|
- Province hole detection is a deterministic four-connected digital-topology review. It warns on enclosed components but does not declare every enclave invalid; provinces touching the horizontally wrapping map seam are excluded from the planar hole calculation.
|
|
19
21
|
- Map text tables are limited to 16,777,216 bytes and 500,000 records so the bounded parser admits the current vanilla unit-position table. Province rasters are limited to the documented 13,238,272-pixel engine area, exact raster masks to 20,000,000 cells, and polygon rasterization to 50,000,000 cell-point comparisons. Every exact selection/recolor operation is additionally limited to 1,000,000 pixels, including explicit pixels, selected mask cells, rasterized polygons, normal-adjacency transfers, whole-province color updates, and merges. Known counts are refused before dangerous decoding/scanning/materialization with `MAP_SELECTED_PIXEL_BUDGET_BLOCKED`. Selected pixels use four-byte numeric offsets, so the primary operation-owned offset buffer remains below 4 MiB (4,000,000 bytes); coordinate-string keys and per-pixel coordinate/color object arrays are not materialized. Map diagnostics are capped at 2,000; overflow retains 1,999 findings and replaces the last slot with a blocking `MAP_DIAGNOSTICS_TRUNCATED`. Undefined bitmap colors retain at most 256 individual samples and add a blocker when more distinct colors exist.
|
|
@@ -23,8 +25,8 @@ These are precise safety boundaries, not silent fallbacks.
|
|
|
23
25
|
- State `capital` is derived from exact victory points for inspection; Agent Nudger does not write a generic state `capital` assignment.
|
|
24
26
|
- Map ID allocation obeys scanned format/contiguity evidence from every root's own `default.map`-selected definition database; it refuses an allocation when the current source family cannot safely represent a gap or append. A present selector with any syntax or parser-limit diagnostic blocks the whole map model, including when it belongs to a lower game/dependency root, because falling back could hide an ID or color collision.
|
|
25
27
|
- Province merge/removal supports arbitrary compatible source IDs and compacts every connected province reference; it refuses renumbering only when the active definition table is already gapped or ambiguous by ID/color, or when source and target type/state/region membership is incompatible.
|
|
26
|
-
- Recoverable logical multi-file atomicity cannot prevent an unrelated process from briefly reading a replacement sequence. Success follows the server's post-write validation and final hash check, and persisted before-bytes support rollback. This is not a race-proof filesystem transaction: hostile concurrent symlink, junction, mount, directory, or file replacement by another operating-system principal is outside the application security boundary.
|
|
27
|
-
- Artifact retention defaults to 536,870,912 bytes, 5,000 manifests, and 134,217,728 bytes per content object; each provenance manifest is separately capped at 1 MiB before parsing. Broad project, focus, GUI, and map manifests retain a bounded source-hash sample plus a digest commitment to the complete inventory, while exact structured artifact content retains the complete hashes. Opt-in oversized logical evidence is preserved as bounded binary chunks plus a one-read JSON index, not as a larger content object: every chunk/index manifest counts against the same quotas, an index above 1 MiB is refused, and one logical preparation batch has a fixed 536,870,912-byte in-memory ceiling (or the lower configured aggregate ceiling). The whole logical batch is admitted before copying or hashing; preflight and hashing yield to cancellation.
|
|
28
|
+
- Recoverable logical multi-file atomicity cannot prevent an unrelated process from briefly reading a replacement sequence. Success follows the server's post-write validation and final hash check, and persisted before-bytes support automatic failure restoration (plus explicit rollback in reviewed compatibility mode). This is not a race-proof filesystem transaction: hostile concurrent symlink, junction, mount, directory, or file replacement by another operating-system principal is outside the application security boundary. Git supplies project history but is not required for the internal recovery guarantee.
|
|
29
|
+
- Artifact retention defaults to 536,870,912 bytes, 5,000 manifests, and 134,217,728 bytes per content object; each provenance manifest is separately capped at 1 MiB before parsing. Broad project, focus, GUI, and map manifests retain a bounded source-hash sample plus a digest commitment to the complete inventory, while exact structured artifact content retains the complete hashes. Opt-in oversized logical evidence is preserved as bounded binary chunks plus a one-read JSON index, not as a larger content object: every chunk/index manifest counts against the same quotas, an index above 1 MiB is refused, and one logical preparation batch has a fixed 536,870,912-byte in-memory ceiling (or the lower configured aggregate ceiling). The whole logical batch is admitted before copying or hashing; preflight and hashing yield to cancellation. Internal rewrite/transaction journals default to 536,870,912 bytes and 128 entries, with a fixed 16 MiB ceiling per authenticated manifest; only expired authenticated planned/rolled-back journals, authenticated safe cache-without-head remnants, head-without-cache remnants, or old manifest-less directories are pruned, while other terminal/interrupted or unauthenticated states remain fail-closed and count against quota. See [artifacts](artifacts.md) and [autonomous rewrites and transactions](transactions.md).
|
|
28
30
|
- Installed-game and external-workspace font files are read locally and are never published as raw MCP resources or redistributed by this package. Their glyph outlines or bounded BMFont atlas crops may appear inside an authorized generated review artifact. Portable fixtures and tool-owned artifact labels use the pinned Roboto package under OFL-1.1; unavailable workspace glyph data is visibly classified as an approximation rather than delegated to a host font.
|
|
29
31
|
- Local external integration depends on environment-provided paths and is not a substitute for portable CI.
|
|
30
32
|
- The server never launches, automates, controls, or captures Hearts of Iron IV. Offline previews are not game screenshots and do not prove in-engine rendering or gameplay behavior.
|