hoi4-agent-tools 4.3.0 → 4.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 +33 -1
- package/dist/hoi4_agent_tools/core/bounded-source.js +31 -9
- package/dist/hoi4_agent_tools/core/configuration.js +11 -0
- package/dist/hoi4_agent_tools/core/managed-outputs.js +26 -6
- package/dist/hoi4_agent_tools/core/operation-context.js +17 -1
- package/dist/hoi4_agent_tools/core/source/encoding.js +56 -2
- package/dist/hoi4_agent_tools/core/source/parser.js +16 -1
- package/dist/hoi4_agent_tools/core/temporary-directories.js +7 -2
- package/dist/hoi4_agent_tools/core/transaction-limits.js +18 -4
- package/dist/hoi4_agent_tools/core/transactions.js +23 -4
- package/dist/hoi4_agent_tools/core/workspace-json.js +54 -0
- package/dist/hoi4_agent_tools/core/workspace.js +42 -6
- package/dist/hoi4_agent_tools/focus/drift.js +34 -0
- package/dist/hoi4_agent_tools/focus/service.js +9 -3
- package/dist/hoi4_agent_tools/focus/tool-operations.js +2 -0
- package/dist/hoi4_agent_tools/map/appearance-validation.js +1110 -0
- package/dist/hoi4_agent_tools/map/bmp.js +9 -1
- package/dist/hoi4_agent_tools/map/border-quality-input.js +209 -0
- package/dist/hoi4_agent_tools/map/border-quality.js +1180 -0
- package/dist/hoi4_agent_tools/map/colormap.js +128 -0
- package/dist/hoi4_agent_tools/map/geography/geometry.js +284 -0
- package/dist/hoi4_agent_tools/map/geography/index.js +6 -0
- package/dist/hoi4_agent_tools/map/geography/model.js +196 -0
- package/dist/hoi4_agent_tools/map/geography/preparation.js +120 -0
- package/dist/hoi4_agent_tools/map/geography/preview.js +647 -0
- package/dist/hoi4_agent_tools/map/geography/raster.js +253 -0
- package/dist/hoi4_agent_tools/map/geography/resolve.js +1467 -0
- package/dist/hoi4_agent_tools/map/model.js +17 -3
- package/dist/hoi4_agent_tools/map/operations.js +284 -14
- package/dist/hoi4_agent_tools/map/partition-fields.js +398 -0
- package/dist/hoi4_agent_tools/map/partition-geography.js +113 -0
- package/dist/hoi4_agent_tools/map/partition-graph.js +165 -0
- package/dist/hoi4_agent_tools/map/partition-groups.js +164 -0
- package/dist/hoi4_agent_tools/map/partition-provinces.js +727 -0
- package/dist/hoi4_agent_tools/map/partition-tuning.js +101 -0
- package/dist/hoi4_agent_tools/map/partition-watershed.js +252 -0
- package/dist/hoi4_agent_tools/map/partition.js +163 -0
- package/dist/hoi4_agent_tools/map/reference-import.js +333 -0
- package/dist/hoi4_agent_tools/map/reference-preparation.js +142 -6
- package/dist/hoi4_agent_tools/map/reference-sheets.js +231 -0
- package/dist/hoi4_agent_tools/map/reference-world.js +104 -13
- package/dist/hoi4_agent_tools/map/relief/checks.js +281 -0
- package/dist/hoi4_agent_tools/map/relief/fields.js +15 -0
- package/dist/hoi4_agent_tools/map/relief/full-resolution.js +133 -0
- package/dist/hoi4_agent_tools/map/relief/grid.js +190 -0
- package/dist/hoi4_agent_tools/map/relief/hydrology.js +1315 -0
- package/dist/hoi4_agent_tools/map/relief/index.js +27 -0
- package/dist/hoi4_agent_tools/map/relief/land.js +110 -0
- package/dist/hoi4_agent_tools/map/relief/macro-relief.js +535 -0
- package/dist/hoi4_agent_tools/map/relief/math.js +93 -0
- package/dist/hoi4_agent_tools/map/relief/river-raster.js +680 -0
- package/dist/hoi4_agent_tools/map/relief/terrain-synthesis.js +304 -0
- package/dist/hoi4_agent_tools/map/render.js +36 -0
- package/dist/hoi4_agent_tools/map/service.js +206 -16
- package/dist/hoi4_agent_tools/map/tool-operations.js +249 -3
- package/dist/hoi4_agent_tools/map/validation.js +9 -0
- package/dist/hoi4_agent_tools/map/water.js +227 -0
- package/dist/hoi4_agent_tools/map/world-context.js +47 -1
- package/dist/hoi4_agent_tools/map/world-edge.js +335 -0
- package/dist/hoi4_agent_tools/map/world-noise.js +34 -0
- package/dist/hoi4_agent_tools/map/world-outputs.js +22 -10
- package/dist/hoi4_agent_tools/map/world-partition.js +119 -0
- package/dist/hoi4_agent_tools/map/world-provinces.js +131 -56
- package/dist/hoi4_agent_tools/map/world-realms.js +152 -0
- package/dist/hoi4_agent_tools/map/world.js +562 -163
- package/dist/hoi4_agent_tools/mcp/tools/map.js +69 -1
- package/dist/hoi4_agent_tools/reference/operations.js +3 -2
- package/dist/hoi4_agent_tools/schemas/geography.js +325 -0
- package/dist/hoi4_agent_tools/schemas/map-requests.js +20 -2
- package/dist/hoi4_agent_tools/schemas/map.js +280 -15
- package/dist/hoi4_agent_tools/schemas/reference-sheets.js +92 -0
- package/dist/hoi4_agent_tools/version.js +1 -1
- package/docs/configuration.md +17 -14
- package/docs/focus.md +6 -0
- package/docs/map.md +292 -15
- package/docs/tools.md +4 -4
- package/docs/troubleshooting.md +11 -11
- package/npm-shrinkwrap.json +109 -91
- package/package.json +3 -3
- package/schemas/configuration.schema.json +65 -58
- package/schemas/continuous-focus-palette.schema.json +1 -1
- package/schemas/custom-weighted-pool.schema.json +1 -1
- package/schemas/decision-inspect-input.schema.json +1 -1
- package/schemas/error-log-input.schema.json +1 -1
- package/schemas/event-feature-manifest.schema.json +1 -1
- package/schemas/focus-plan.schema.json +1 -1
- package/schemas/focus-planning-sidecar.schema.json +1 -1
- package/schemas/geography-model.schema.json +1148 -0
- package/schemas/gui-animation-source.schema.json +1 -1
- package/schemas/gui-helper.schema.json +5 -11
- package/schemas/gui-scenario.schema.json +1 -1
- package/schemas/helper-expansion-request.schema.json +1 -1
- package/schemas/helper-expansion-summary.schema.json +1 -1
- package/schemas/impact-inspect-input.schema.json +1 -1
- package/schemas/map-operation.schema.json +2325 -292
- package/schemas/mechanic-test-input.schema.json +1 -1
- package/schemas/mod-index-input.schema.json +1 -1
- package/schemas/operation-result.schema.json +1 -1
- package/schemas/package-check-input.schema.json +1 -1
- package/schemas/package-manifest.schema.json +1 -1
- package/schemas/probability-analysis-result.schema.json +25 -7
- package/schemas/probability-compare-input.schema.json +1 -1
- package/schemas/probability-evaluate-input.schema.json +1 -1
- package/schemas/probability-inspect-input.schema.json +1 -1
- package/schemas/probability-render-input.schema.json +1 -1
- package/schemas/probability-scenario-set.schema.json +1 -1
- package/schemas/probability-sequence-input.schema.json +1 -1
- package/schemas/probability-simulate-input.schema.json +1 -1
- package/schemas/probability-sweep-input.schema.json +1 -1
- package/schemas/reference-context-input.schema.json +1 -1
- package/schemas/reference-read-input.schema.json +1 -1
- package/schemas/reference-search-input.schema.json +1 -1
- package/schemas/reference-sheets.schema.json +267 -0
- package/schemas/scenario-suite.schema.json +1 -1
- package/schemas/scenario-test-input.schema.json +1 -1
- package/schemas/script-validate-input.schema.json +1 -1
- package/schemas/shared-scenario.schema.json +1 -1
- package/schemas/source-lookup-input.schema.json +1 -1
- package/server.json +2 -2
|
@@ -72,6 +72,40 @@ export function assertFocusPlanAuthority(drift, authority) {
|
|
|
72
72
|
currentPlanHash: drift.currentPlanHash,
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* True when the source changed in meaning after the plan was imported, so regenerating from the
|
|
77
|
+
* plan would overwrite those changes. A formatting-only change (the source still imports to the
|
|
78
|
+
* plan's original baseline), a source that already equals the plan, and an unchanged source are not
|
|
79
|
+
* semantic drift. This is deliberately independent of whether the plan itself was edited: a plan
|
|
80
|
+
* edit plus an external formatting change reports `conflict`, which is still safe to apply.
|
|
81
|
+
*/
|
|
82
|
+
export function hasSemanticSourceDrift(drift) {
|
|
83
|
+
if (!drift.sourceChanged)
|
|
84
|
+
return false;
|
|
85
|
+
if (drift.status === 'tree_removed')
|
|
86
|
+
return true;
|
|
87
|
+
return (drift.currentPlanHash !== drift.importedPlanHash &&
|
|
88
|
+
drift.currentPlanHash !== drift.savedPlanHash);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Refuses to regenerate a tree from a plan when the source changed in meaning after the plan was
|
|
92
|
+
* imported. Applying the plan would overwrite those external changes with stale plan values.
|
|
93
|
+
* Re-import the source with the inspect tool, reapply the intended change to the fresh plan, and
|
|
94
|
+
* retry.
|
|
95
|
+
*/
|
|
96
|
+
export function assertNoSemanticSourceDrift(drift, sourcePath) {
|
|
97
|
+
if (!hasSemanticSourceDrift(drift))
|
|
98
|
+
return;
|
|
99
|
+
throw new ServiceError('FOCUS_SOURCE_CHANGED_SINCE_PLAN', 'The focus source changed in meaning after the plan was imported; rewriting from the plan would overwrite those changes. Import the current source with hoi4.focus_inspect, reapply the intended edit to the fresh plan, and retry', {
|
|
100
|
+
relativePath: sourcePath,
|
|
101
|
+
status: drift.status,
|
|
102
|
+
savedSourceHash: drift.savedSourceHash,
|
|
103
|
+
currentSourceHash: drift.currentSourceHash,
|
|
104
|
+
savedPlanHash: drift.savedPlanHash,
|
|
105
|
+
currentPlanHash: drift.currentPlanHash,
|
|
106
|
+
importedPlanHash: drift.importedPlanHash,
|
|
107
|
+
});
|
|
108
|
+
}
|
|
75
109
|
export function detectContinuousFocusDrift(savedPlan, currentDocument) {
|
|
76
110
|
const currentSourceHash = sha256Bytes(currentDocument.bytes);
|
|
77
111
|
const savedPlanHash = focusPlanHash(savedPlan);
|
|
@@ -5,7 +5,7 @@ import { ServiceError } from '../core/result.js';
|
|
|
5
5
|
import { parseClausewitz } from '../core/source/index.js';
|
|
6
6
|
import { TRANSACTION_MAX_DIAGNOSTICS } from '../core/transaction-limits.js';
|
|
7
7
|
import { PACKAGE_VERSION } from '../version.js';
|
|
8
|
-
import { assertFocusPlanAuthority, detectContinuousFocusDrift, detectFocusDrift, } from './drift.js';
|
|
8
|
+
import { assertFocusPlanAuthority, assertNoSemanticSourceDrift, detectContinuousFocusDrift, detectFocusDrift, } from './drift.js';
|
|
9
9
|
import { importContinuousFocusPalettes, importFocusTrees } from './importer.js';
|
|
10
10
|
import { layoutFocusTree, layoutFocusTreeAsync } from './layout.js';
|
|
11
11
|
import { lintContinuousFocusPalette, lintFocusTree } from './lint.js';
|
|
@@ -191,8 +191,11 @@ export class FocusWorkbench {
|
|
|
191
191
|
const drift = targetCreated
|
|
192
192
|
? missingTargetDrift(input.plan, document)
|
|
193
193
|
: detectFocusDrift(input.plan, document, input.references);
|
|
194
|
-
if (!targetCreated)
|
|
194
|
+
if (!targetCreated) {
|
|
195
|
+
if (input.onSemanticSourceDrift === 'refuse')
|
|
196
|
+
assertNoSemanticSourceDrift(drift, input.relativePath);
|
|
195
197
|
assertFocusPlanAuthority(drift, input.authority ?? 'plan');
|
|
198
|
+
}
|
|
196
199
|
const layout = input.layout ??
|
|
197
200
|
(await layoutFocusTreeAsync(input.plan, input.signal === undefined ? {} : { signal: input.signal }));
|
|
198
201
|
const after = updateFocusTreeSource(document, targetCreated ? undefined : drift.currentSourcePlan, input.plan, layout);
|
|
@@ -414,8 +417,11 @@ export class FocusWorkbench {
|
|
|
414
417
|
const drift = targetCreated
|
|
415
418
|
? missingTargetDrift(input.plan, document)
|
|
416
419
|
: detectContinuousFocusDrift(input.plan, document);
|
|
417
|
-
if (!targetCreated)
|
|
420
|
+
if (!targetCreated) {
|
|
421
|
+
if (input.onSemanticSourceDrift === 'refuse')
|
|
422
|
+
assertNoSemanticSourceDrift(drift, input.relativePath);
|
|
418
423
|
assertFocusPlanAuthority(drift, input.authority ?? 'plan');
|
|
424
|
+
}
|
|
419
425
|
const after = updateContinuousFocusPaletteSource(document, targetCreated ? undefined : drift.currentSourcePlan, input.plan);
|
|
420
426
|
const afterHash = sha256Bytes(after);
|
|
421
427
|
const operationId = deterministicId('continuous_focus_change', {
|
|
@@ -147,6 +147,7 @@ export async function prepareFocusRewrite(engine, workbench, input, context) {
|
|
|
147
147
|
plan,
|
|
148
148
|
createIfMissing,
|
|
149
149
|
authority: 'plan',
|
|
150
|
+
onSemanticSourceDrift: 'refuse',
|
|
150
151
|
...(context.principal === undefined ? {} : { principal: context.principal }),
|
|
151
152
|
artifacts: reviewArtifacts,
|
|
152
153
|
readDependencies: readDependenciesFromScannedFiles(snapshot.files),
|
|
@@ -301,6 +302,7 @@ export async function prepareFocusRewrite(engine, workbench, input, context) {
|
|
|
301
302
|
plan,
|
|
302
303
|
createIfMissing,
|
|
303
304
|
authority: 'plan',
|
|
305
|
+
onSemanticSourceDrift: 'refuse',
|
|
304
306
|
layout: proposed.layout,
|
|
305
307
|
...(context.principal === undefined ? {} : { principal: context.principal }),
|
|
306
308
|
index: snapshot.index,
|