@its-not-rocket-science/ananke 0.1.68 → 0.5.1
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 +274 -0
- package/README.md +150 -431
- package/STABLE_API.md +113 -490
- package/conformance/README.md +46 -44
- package/conformance/lockstep-sequence.json +395 -395
- package/conformance/phase-order.json +21 -0
- package/conformance/replay-parity.json +65 -65
- package/conformance/state-hash-regression.json +39 -0
- package/conformance/state-hash.json +23 -22
- package/dist/src/conformance.d.ts +8 -2
- package/dist/src/content/index.d.ts +3 -0
- package/dist/src/content/index.js +2 -0
- package/dist/src/content/injector.d.ts +19 -0
- package/dist/src/content/injector.js +61 -0
- package/dist/src/content/loader.d.ts +3 -0
- package/dist/src/content/loader.js +170 -0
- package/dist/src/content/types.d.ts +56 -0
- package/dist/src/content/types.js +1 -0
- package/dist/src/content/validator.d.ts +6 -0
- package/dist/src/content/validator.js +14 -0
- package/dist/src/content-pack.d.ts +3 -2
- package/dist/src/content-pack.js +205 -10
- package/dist/src/data-governance.d.ts +73 -0
- package/dist/src/data-governance.js +188 -0
- package/dist/src/debug.d.ts +6 -0
- package/dist/src/debug.js +9 -0
- package/dist/src/determinism.d.ts +12 -0
- package/dist/src/determinism.js +93 -0
- package/dist/src/dialogue.d.ts +41 -0
- package/dist/src/dialogue.js +113 -2
- package/dist/src/economy.d.ts +97 -3
- package/dist/src/economy.js +191 -37
- package/dist/src/history/autosave.d.ts +19 -0
- package/dist/src/history/autosave.js +98 -0
- package/dist/src/history/timetravel.d.ts +28 -0
- package/dist/src/history/timetravel.js +61 -0
- package/dist/src/index.d.ts +19 -31
- package/dist/src/index.js +20 -38
- package/dist/src/model3d.js +63 -2
- package/dist/src/narrative/combat-logger.d.ts +25 -0
- package/dist/src/narrative/combat-logger.js +97 -0
- package/dist/src/narrative/plausibility.d.ts +30 -0
- package/dist/src/narrative/plausibility.js +70 -0
- package/dist/src/narrative-layer.d.ts +2 -0
- package/dist/src/narrative-layer.js +2 -0
- package/dist/src/navigation/causal-chain.d.ts +26 -0
- package/dist/src/navigation/causal-chain.js +74 -0
- package/dist/src/netcode.d.ts +1 -1
- package/dist/src/netcode.js +1 -1
- package/dist/src/performance/adaptive-tick.d.ts +23 -0
- package/dist/src/performance/adaptive-tick.js +50 -0
- package/dist/src/plugins/loader.d.ts +23 -0
- package/dist/src/plugins/loader.js +86 -0
- package/dist/src/plugins/registry.d.ts +11 -0
- package/dist/src/plugins/registry.js +28 -0
- package/dist/src/plugins/types.d.ts +31 -0
- package/dist/src/plugins/types.js +7 -0
- package/dist/src/replay.js +5 -2
- package/dist/src/scenario.js +2 -1
- package/dist/src/serialization/binary.d.ts +5 -0
- package/dist/src/serialization/binary.js +193 -0
- package/dist/src/session.d.ts +115 -0
- package/dist/src/session.js +228 -0
- package/dist/src/sim/ai/decide.js +1 -1
- package/dist/src/sim/ai/personality.js +2 -2
- package/dist/src/sim/bodyplan.d.ts +30 -0
- package/dist/src/sim/context.d.ts +2 -0
- package/dist/src/sim/kernel.js +80 -1294
- package/dist/src/sim/normalization.d.ts +12 -0
- package/dist/src/sim/normalization.js +92 -0
- package/dist/src/sim/resolvers/attack-resolver.d.ts +30 -0
- package/dist/src/sim/resolvers/attack-resolver.js +310 -0
- package/dist/src/sim/resolvers/capability-resolver.d.ts +15 -0
- package/dist/src/sim/resolvers/capability-resolver.js +270 -0
- package/dist/src/sim/resolvers/grapple-resolver.d.ts +28 -0
- package/dist/src/sim/resolvers/grapple-resolver.js +70 -0
- package/dist/src/sim/resolvers/shoot-resolver.d.ts +27 -0
- package/dist/src/sim/resolvers/shoot-resolver.js +212 -0
- package/dist/src/sim/resolvers/treat-resolver.d.ts +16 -0
- package/dist/src/sim/resolvers/treat-resolver.js +77 -0
- package/dist/src/sim/step/apply/intents.d.ts +6 -0
- package/dist/src/sim/step/apply/intents.js +83 -0
- package/dist/src/sim/step/kernel-pipeline.d.ts +9 -0
- package/dist/src/sim/step/kernel-pipeline.js +15 -0
- package/dist/src/sim/step/phases/capability-phase.d.ts +8 -0
- package/dist/src/sim/step/phases/capability-phase.js +65 -0
- package/dist/src/sim/step/phases/cooldowns-phase.d.ts +3 -0
- package/dist/src/sim/step/phases/cooldowns-phase.js +37 -0
- package/dist/src/sim/step/phases/prepare-phase.d.ts +10 -0
- package/dist/src/sim/step/phases/prepare-phase.js +33 -0
- package/dist/src/sim/step/pipeline.d.ts +2 -0
- package/dist/src/sim/step/pipeline.js +15 -0
- package/dist/src/sim/step/resolvers/impact-resolver.d.ts +9 -0
- package/dist/src/sim/step/resolvers/impact-resolver.js +55 -0
- package/dist/src/sim/step/world-phases.d.ts +7 -0
- package/dist/src/sim/step/world-phases.js +15 -0
- package/dist/src/sim/step/world-step-context.d.ts +23 -0
- package/dist/src/sim/step/world-step-context.js +1 -0
- package/dist/src/sim/systemic-toxicology.js +1 -1
- package/dist/src/sim/team.js +2 -2
- package/dist/src/sim/testing.js +4 -3
- package/dist/src/sim/toxicology.d.ts +1 -1
- package/dist/src/sim/toxicology.js +1 -1
- package/dist/src/sim/world.d.ts +17 -24
- package/dist/src/snapshot.js +3 -6
- package/dist/src/tier2.d.ts +19 -0
- package/dist/src/tier2.js +21 -0
- package/dist/src/tier3.d.ts +10 -0
- package/dist/src/tier3.js +12 -0
- package/dist/src/version.d.ts +6 -0
- package/dist/src/version.js +8 -0
- package/dist/src/wasm/bridge.d.ts +14 -0
- package/dist/src/wasm/bridge.js +84 -0
- package/dist/src/wasm-kernel.d.ts +2 -0
- package/dist/src/wasm-kernel.js +1 -0
- package/dist/src/world-evolution-backend/engine.d.ts +4 -0
- package/dist/src/world-evolution-backend/engine.js +347 -0
- package/dist/src/world-evolution-backend/host-schema.d.ts +145 -0
- package/dist/src/world-evolution-backend/host-schema.js +375 -0
- package/dist/src/world-evolution-backend/index.d.ts +1 -0
- package/dist/src/world-evolution-backend/index.js +1 -0
- package/dist/src/world-evolution-backend/open-world-host-adapter.d.ts +96 -0
- package/dist/src/world-evolution-backend/open-world-host-adapter.js +208 -0
- package/dist/src/world-evolution-backend/profiles.d.ts +4 -0
- package/dist/src/world-evolution-backend/profiles.js +136 -0
- package/dist/src/world-evolution-backend/public.d.ts +11 -0
- package/dist/src/world-evolution-backend/public.js +7 -0
- package/dist/src/world-evolution-backend/reproducibility.d.ts +8 -0
- package/dist/src/world-evolution-backend/reproducibility.js +35 -0
- package/dist/src/world-evolution-backend/timeline.d.ts +6 -0
- package/dist/src/world-evolution-backend/timeline.js +337 -0
- package/dist/src/world-evolution-backend/types.d.ts +138 -0
- package/dist/src/world-evolution-backend/types.js +1 -0
- package/dist/src/world-evolution-host-backend.d.ts +51 -0
- package/dist/src/world-evolution-host-backend.js +97 -0
- package/dist/src/world-evolution.d.ts +201 -0
- package/dist/src/world-evolution.js +543 -0
- package/dist/src/world-factory.js +2 -1
- package/dist/tools/pack-cli.js +55 -2
- package/docs/bridge-contract.md +140 -332
- package/docs/completion-evidence-dashboard.md +63 -0
- package/docs/host-contract.md +86 -310
- package/docs/host-world-evolution-schema.md +155 -0
- package/docs/integration-primer.md +29 -22
- package/docs/migration-monolith-to-modular.md +102 -120
- package/docs/package-architecture.md +116 -323
- package/docs/plugins/README.md +42 -0
- package/docs/plugins/hooks.md +22 -0
- package/docs/plugins/publishing.md +29 -0
- package/docs/plugins/security-model.md +273 -0
- package/docs/project-overview.md +30 -30
- package/docs/release-dashboard.md +47 -0
- package/docs/session-api.md +127 -0
- package/docs/stable-api-manifest.json +52 -0
- package/docs/trust-dashboard.md +37 -0
- package/docs/versioning.md +256 -245
- package/docs/wire-protocol.md +140 -209
- package/docs/world-evolution-backend.md +200 -0
- package/docs/world-evolution-engine.md +150 -0
- package/docs/world-evolution-host-backend.md +70 -0
- package/docs/world-evolution-orchestration.md +248 -0
- package/package.json +125 -6
- package/schema/content-pack.schema.json +85 -0
- package/schema/plugin.schema.json +57 -0
- package/schema/world-evolution-input.schema.json +196 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# Session API (Tier 2 / experimental)
|
|
2
|
+
|
|
3
|
+
`@its-not-rocket-science/ananke/session` is a **host-oriented facade** over existing public simulation APIs.
|
|
4
|
+
|
|
5
|
+
> Stability: this subpath is **Tier 2 / experimental**. It is shipped, but it is not covered by Tier 1 stability guarantees.
|
|
6
|
+
|
|
7
|
+
## Why this API exists
|
|
8
|
+
|
|
9
|
+
Most hosts need a consistent lifecycle (`create`, `run`, `fork`, save/load) across different simulation modes.
|
|
10
|
+
The session API wraps that lifecycle so hosts can use one integration shape instead of hand-wiring separate tactical and world-evolution loops.
|
|
11
|
+
|
|
12
|
+
## When to use this vs. low-level functions
|
|
13
|
+
|
|
14
|
+
Use `@its-not-rocket-science/ananke/session` when you want:
|
|
15
|
+
|
|
16
|
+
- a mode-aware session handle (`tactical` or `world_evolution`),
|
|
17
|
+
- a common run/fork/serialize flow,
|
|
18
|
+
- host-level orchestration with minimal glue code.
|
|
19
|
+
|
|
20
|
+
Use low-level functions from `@its-not-rocket-science/ananke` (and other subpaths) when you need:
|
|
21
|
+
|
|
22
|
+
- full control over each tick and command map internals,
|
|
23
|
+
- mode-specific custom scheduling,
|
|
24
|
+
- direct access to domain primitives without facade constraints.
|
|
25
|
+
|
|
26
|
+
## Supported modes
|
|
27
|
+
|
|
28
|
+
- `"tactical"`
|
|
29
|
+
- `"world_evolution"`
|
|
30
|
+
|
|
31
|
+
## Runtime portability notes (Node vs browser/worker)
|
|
32
|
+
|
|
33
|
+
`./session` is designed to be importable in browser/worker embedders, but some behavior still varies by runtime:
|
|
34
|
+
|
|
35
|
+
- **Portable by default**
|
|
36
|
+
- Core tactical/session lifecycle (`createSession`, `runSession`, `stepSession`, `forkSession`, `serializeSession`, `deserializeSession`) is runtime-neutral and does not require Node globals.
|
|
37
|
+
- **Optional/conditional behavior**
|
|
38
|
+
- `runSession` strict determinism env override (`ANANKE_STRICT_DETERMINISM`) now only applies when a Node-style `process.env` exists; browser/worker hosts should set `context.strictDeterminism` explicitly instead.
|
|
39
|
+
- Pack checksum validation (`registry.checksum`) is available from the session path without Node-only imports.
|
|
40
|
+
- **Current limits**
|
|
41
|
+
- Session pack loading still mutates in-memory global registries (weapons/armour/archetypes/scenario maps) in-process. This is host-runtime portable, but not yet isolated by namespace/sandbox.
|
|
42
|
+
- `./session` does not provide fetch/file I/O adapters; hosts must supply already-loaded JSON payloads for scenarios/packs.
|
|
43
|
+
|
|
44
|
+
## Public API surface
|
|
45
|
+
|
|
46
|
+
### Types
|
|
47
|
+
|
|
48
|
+
- `SessionMode = "tactical" | "world_evolution"`
|
|
49
|
+
- `SessionConfig`
|
|
50
|
+
- `SessionHandle`
|
|
51
|
+
- `RunSessionRequest`
|
|
52
|
+
- `RunSessionResult`
|
|
53
|
+
- `SessionSummary`
|
|
54
|
+
- `ForkSessionRequest`
|
|
55
|
+
- `LoadSessionPackResult`
|
|
56
|
+
|
|
57
|
+
### Functions
|
|
58
|
+
|
|
59
|
+
- `createSession(config)`
|
|
60
|
+
- `runSession(session, request)`
|
|
61
|
+
- `stepSession(session, request?)`
|
|
62
|
+
- `getSessionSummary(session)`
|
|
63
|
+
- `forkSession(session, request?)`
|
|
64
|
+
- `loadSessionPack(manifestOrRequest)`
|
|
65
|
+
- `serializeSession(session)`
|
|
66
|
+
- `deserializeSession(json)`
|
|
67
|
+
|
|
68
|
+
## Lifecycle
|
|
69
|
+
|
|
70
|
+
1. **create** — `createSession(config)`
|
|
71
|
+
2. **run** — `runSession(session, { steps, ... })` (or single-step via `stepSession`)
|
|
72
|
+
3. **fork** — `forkSession(session, { ... })`
|
|
73
|
+
4. **pack load** — `loadSessionPack(packJson, { ... })`
|
|
74
|
+
5. **serialize** — `serializeSession(session)`
|
|
75
|
+
6. **deserialize** — `deserializeSession(serialized)`
|
|
76
|
+
|
|
77
|
+
## Tactical example
|
|
78
|
+
|
|
79
|
+
```ts no-check-example
|
|
80
|
+
import { createSession, runSession, forkSession, serializeSession, deserializeSession } from "@its-not-rocket-science/ananke/session";
|
|
81
|
+
|
|
82
|
+
const tactical = createSession({
|
|
83
|
+
mode: "tactical",
|
|
84
|
+
worldSeed: 7,
|
|
85
|
+
entities: [
|
|
86
|
+
{ id: 1, teamId: 1, seed: 11, archetype: "AMATEUR_BOXER", weaponId: "fists" },
|
|
87
|
+
{ id: 2, teamId: 2, seed: 22, archetype: "AMATEUR_BOXER", weaponId: "fists" },
|
|
88
|
+
],
|
|
89
|
+
enableReplay: true,
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
runSession(tactical, { steps: 10 });
|
|
93
|
+
const branch = forkSession(tactical, { id: "what-if-branch" });
|
|
94
|
+
|
|
95
|
+
const snapshot = serializeSession(branch);
|
|
96
|
+
const restored = deserializeSession(snapshot);
|
|
97
|
+
runSession(restored, { steps: 5 });
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## World-evolution example
|
|
101
|
+
|
|
102
|
+
```ts no-check-example
|
|
103
|
+
import { createSession, runSession, serializeSession, deserializeSession } from "@its-not-rocket-science/ananke/session";
|
|
104
|
+
|
|
105
|
+
const worldEvolution = createSession({
|
|
106
|
+
mode: "world_evolution",
|
|
107
|
+
canonicalSnapshot: {
|
|
108
|
+
tick: 0,
|
|
109
|
+
worldSeed: 42,
|
|
110
|
+
settlements: [],
|
|
111
|
+
actors: [],
|
|
112
|
+
metrics: {},
|
|
113
|
+
activeEvents: [],
|
|
114
|
+
},
|
|
115
|
+
rulesetId: "standard",
|
|
116
|
+
checkpointInterval: 25,
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
runSession(worldEvolution, {
|
|
120
|
+
steps: 50,
|
|
121
|
+
evolution: { includeDeltas: true },
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
const packed = serializeSession(worldEvolution);
|
|
125
|
+
const resumed = deserializeSession(packed);
|
|
126
|
+
runSession(resumed, { steps: 10 });
|
|
127
|
+
```
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"package": "@its-not-rocket-science/ananke",
|
|
4
|
+
"tier": "tier-1",
|
|
5
|
+
"entrypoint": "src/index.ts",
|
|
6
|
+
"symbols": [
|
|
7
|
+
"AnankeScenario",
|
|
8
|
+
"AnankeScenarioEntity",
|
|
9
|
+
"AnimationHints",
|
|
10
|
+
"Command",
|
|
11
|
+
"CommandMap",
|
|
12
|
+
"Entity",
|
|
13
|
+
"EntitySpec",
|
|
14
|
+
"G_mps2",
|
|
15
|
+
"I32",
|
|
16
|
+
"IndividualAttributes",
|
|
17
|
+
"KernelContext",
|
|
18
|
+
"LoadedPlugin",
|
|
19
|
+
"PluginHookContext",
|
|
20
|
+
"PluginHooks",
|
|
21
|
+
"PluginManifest",
|
|
22
|
+
"PluginModule",
|
|
23
|
+
"PluginPermission",
|
|
24
|
+
"PluginRuntimeApi",
|
|
25
|
+
"Q",
|
|
26
|
+
"Replay",
|
|
27
|
+
"ReplayFrame",
|
|
28
|
+
"ReplayRecorder",
|
|
29
|
+
"RigSnapshot",
|
|
30
|
+
"SCALE",
|
|
31
|
+
"WorldState",
|
|
32
|
+
"clampQ",
|
|
33
|
+
"createWorld",
|
|
34
|
+
"deriveAnimationHints",
|
|
35
|
+
"deserializeReplay",
|
|
36
|
+
"extractRigSnapshots",
|
|
37
|
+
"from",
|
|
38
|
+
"installPluginFromRegistry",
|
|
39
|
+
"loadPlugin",
|
|
40
|
+
"loadScenario",
|
|
41
|
+
"mulDiv",
|
|
42
|
+
"q",
|
|
43
|
+
"qDiv",
|
|
44
|
+
"qMul",
|
|
45
|
+
"replayTo",
|
|
46
|
+
"serializeReplay",
|
|
47
|
+
"sqrtQ",
|
|
48
|
+
"stepWorld",
|
|
49
|
+
"to",
|
|
50
|
+
"validateScenario"
|
|
51
|
+
]
|
|
52
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Trust Dashboard
|
|
2
|
+
|
|
3
|
+
> GENERATED FILE: produced by `npm run generate-trust-dashboard`.
|
|
4
|
+
> Do not edit manually; update source artifacts and regenerate.
|
|
5
|
+
|
|
6
|
+
_Last updated: 2026-04-13T19:44:52.475Z_
|
|
7
|
+
|
|
8
|
+
## Status rules (machine-derived)
|
|
9
|
+
|
|
10
|
+
- **verified**: all required artifacts exist and all checks pass.
|
|
11
|
+
- **partially verified**: required artifacts exist, checks are runnable, and coverage is below threshold.
|
|
12
|
+
- **unverified**: one or more required artifacts are missing or required checks fail.
|
|
13
|
+
|
|
14
|
+
## Thresholds
|
|
15
|
+
|
|
16
|
+
- docs coherence: semantic inconsistencies must equal **0**.
|
|
17
|
+
- test coverage: line coverage must be **>= 85%**.
|
|
18
|
+
- determinism: CI matrix must pass, wasm coverage must meet threshold (default **90%** unless CI output overrides), and fuzz executions must meet threshold (default **2000** unless CI output overrides).
|
|
19
|
+
|
|
20
|
+
## Inputs
|
|
21
|
+
|
|
22
|
+
- CI outputs: `docs/dashboard/ci-trust-report.json`
|
|
23
|
+
- Test coverage: `coverage/coverage-summary.json`
|
|
24
|
+
- Doc validation reports: `docs/doc-consistency-report.json`
|
|
25
|
+
|
|
26
|
+
## Status matrix
|
|
27
|
+
|
|
28
|
+
| Area | Status | Computed summary | Evidence |
|
|
29
|
+
| --- | --- | --- | --- |
|
|
30
|
+
| docs coherence | verified | semantic inconsistencies = 0/0 | doc validation report: `docs/doc-consistency-report.json` |
|
|
31
|
+
| test coverage | unverified | missing coverage summary | coverage summary: `coverage/coverage-summary.json` (missing) |
|
|
32
|
+
| determinism | verified | ci matrix passes=true; wasm coverage 90.00%/90%; fuzz executions 2000/2000 | ci output: `docs/dashboard/ci-trust-report.json` |
|
|
33
|
+
|
|
34
|
+
## CI stale-file rule
|
|
35
|
+
|
|
36
|
+
- CI must run `npm run check-trust-dashboard-artifacts`.
|
|
37
|
+
- The check re-renders `docs/trust-dashboard.md` in-memory and fails if the committed file differs.
|