@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
|
@@ -1,323 +1,116 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
### @ananke/core
|
|
118
|
-
```
|
|
119
|
-
src/units.ts
|
|
120
|
-
src/rng.ts
|
|
121
|
-
src/types.ts
|
|
122
|
-
src/replay.ts
|
|
123
|
-
src/sim/entity.ts
|
|
124
|
-
src/sim/kernel.ts
|
|
125
|
-
src/sim/seeds.ts
|
|
126
|
-
src/sim/world.ts
|
|
127
|
-
src/sim/kinds.ts
|
|
128
|
-
src/sim/condition.ts
|
|
129
|
-
src/sim/body.ts
|
|
130
|
-
src/sim/bodyplan.ts
|
|
131
|
-
src/sim/limb.ts
|
|
132
|
-
src/sim/tick.ts
|
|
133
|
-
src/sim/indexing.ts
|
|
134
|
-
src/sim/events.ts
|
|
135
|
-
src/sim/commands.ts
|
|
136
|
-
src/sim/commandBuilders.ts
|
|
137
|
-
src/sim/context.ts
|
|
138
|
-
src/sim/intent.ts
|
|
139
|
-
src/sim/vec3.ts
|
|
140
|
-
src/sim/spatial.ts
|
|
141
|
-
src/sim/skills.ts
|
|
142
|
-
src/sim/traits.ts
|
|
143
|
-
src/sim/terrain.ts
|
|
144
|
-
src/sim/action.ts
|
|
145
|
-
src/sim/step/ (all 10 step files)
|
|
146
|
-
src/bridge/ (all 5 bridge files)
|
|
147
|
-
src/presets.ts
|
|
148
|
-
src/generate.ts
|
|
149
|
-
src/derive.ts
|
|
150
|
-
src/describe.ts
|
|
151
|
-
src/traits.ts
|
|
152
|
-
src/metrics.ts
|
|
153
|
-
src/dist.ts
|
|
154
|
-
src/wasm-kernel.ts
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
### @ananke/combat
|
|
158
|
-
```
|
|
159
|
-
src/sim/combat.ts
|
|
160
|
-
src/sim/injury.ts
|
|
161
|
-
src/sim/wound-aging.ts
|
|
162
|
-
src/sim/medical.ts
|
|
163
|
-
src/sim/morale.ts
|
|
164
|
-
src/sim/grapple.ts
|
|
165
|
-
src/sim/ranged.ts
|
|
166
|
-
src/sim/stamina.ts (if present)
|
|
167
|
-
src/sim/impairment.ts
|
|
168
|
-
src/sim/knockback.ts
|
|
169
|
-
src/sim/cover.ts
|
|
170
|
-
src/sim/cone.ts
|
|
171
|
-
src/sim/formation.ts
|
|
172
|
-
src/sim/formation-combat.ts
|
|
173
|
-
src/sim/formation-unit.ts
|
|
174
|
-
src/sim/frontage.ts
|
|
175
|
-
src/sim/density.ts
|
|
176
|
-
src/sim/occlusion.ts
|
|
177
|
-
src/sim/ai/ (all 8 AI files)
|
|
178
|
-
src/combat.ts
|
|
179
|
-
src/equipment.ts
|
|
180
|
-
src/weapons.ts
|
|
181
|
-
src/anatomy/ (all 5 anatomy files)
|
|
182
|
-
src/competence/ (all 13 competence files)
|
|
183
|
-
src/arena.ts
|
|
184
|
-
src/dialogue.ts
|
|
185
|
-
src/party.ts
|
|
186
|
-
src/faction.ts
|
|
187
|
-
src/downtime.ts
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
### @ananke/campaign
|
|
191
|
-
```
|
|
192
|
-
src/campaign.ts
|
|
193
|
-
src/campaign-layer.ts
|
|
194
|
-
src/polity.ts
|
|
195
|
-
src/polity-vassals.ts
|
|
196
|
-
src/social.ts
|
|
197
|
-
src/relationships.ts
|
|
198
|
-
src/relationships-effects.ts
|
|
199
|
-
src/emotional-contagion.ts
|
|
200
|
-
src/narrative.ts
|
|
201
|
-
src/narrative-layer.ts
|
|
202
|
-
src/narrative-prose.ts
|
|
203
|
-
src/narrative-render.ts
|
|
204
|
-
src/narrative-stress.ts
|
|
205
|
-
src/story-arcs.ts
|
|
206
|
-
src/quest.ts
|
|
207
|
-
src/quest-generators.ts
|
|
208
|
-
src/chronicle.ts
|
|
209
|
-
src/legend.ts
|
|
210
|
-
src/mythology.ts
|
|
211
|
-
src/renown.ts
|
|
212
|
-
src/kinship.ts
|
|
213
|
-
src/succession.ts
|
|
214
|
-
src/calendar.ts
|
|
215
|
-
src/feudal.ts
|
|
216
|
-
src/diplomacy.ts
|
|
217
|
-
src/migration.ts
|
|
218
|
-
src/espionage.ts
|
|
219
|
-
src/trade-routes.ts
|
|
220
|
-
src/siege.ts
|
|
221
|
-
src/faith.ts
|
|
222
|
-
src/demography.ts
|
|
223
|
-
src/granary.ts
|
|
224
|
-
src/epidemic.ts
|
|
225
|
-
src/infrastructure.ts
|
|
226
|
-
src/unrest.ts
|
|
227
|
-
src/research.ts
|
|
228
|
-
src/taxation.ts
|
|
229
|
-
src/military-campaign.ts
|
|
230
|
-
src/governance.ts
|
|
231
|
-
src/resources.ts
|
|
232
|
-
src/climate.ts
|
|
233
|
-
src/famine.ts
|
|
234
|
-
src/containment.ts
|
|
235
|
-
src/mercenaries.ts
|
|
236
|
-
src/wonders.ts
|
|
237
|
-
src/monetary.ts
|
|
238
|
-
src/collective-activities.ts
|
|
239
|
-
src/economy.ts
|
|
240
|
-
src/economy-gen.ts
|
|
241
|
-
src/tech-diffusion.ts
|
|
242
|
-
src/culture.ts
|
|
243
|
-
src/settlement.ts
|
|
244
|
-
src/settlement-services.ts
|
|
245
|
-
src/channels.ts
|
|
246
|
-
src/inheritance.ts
|
|
247
|
-
src/progression.ts
|
|
248
|
-
src/sim/disease.ts
|
|
249
|
-
src/sim/aging.ts
|
|
250
|
-
src/sim/sleep.ts
|
|
251
|
-
src/sim/mount.ts
|
|
252
|
-
src/sim/hazard.ts
|
|
253
|
-
src/sim/nutrition.ts
|
|
254
|
-
src/sim/thermoregulation.ts
|
|
255
|
-
src/sim/toxicology.ts
|
|
256
|
-
src/sim/systemic-toxicology.ts
|
|
257
|
-
src/sim/substance.ts
|
|
258
|
-
src/sim/weather.ts
|
|
259
|
-
src/sim/biome.ts
|
|
260
|
-
src/sim/tech.ts
|
|
261
|
-
```
|
|
262
|
-
|
|
263
|
-
### @ananke/content
|
|
264
|
-
```
|
|
265
|
-
src/species.ts
|
|
266
|
-
src/catalog.ts
|
|
267
|
-
src/character.ts
|
|
268
|
-
src/archetypes.ts
|
|
269
|
-
src/crafting/ (all 5 crafting files)
|
|
270
|
-
src/inventory.ts
|
|
271
|
-
src/item-durability.ts
|
|
272
|
-
src/snapshot.ts
|
|
273
|
-
src/world-generation.ts
|
|
274
|
-
src/world-factory.ts
|
|
275
|
-
src/scenario.ts
|
|
276
|
-
src/modding.ts
|
|
277
|
-
src/lod.ts
|
|
278
|
-
src/model3d.ts
|
|
279
|
-
```
|
|
280
|
-
|
|
281
|
-
---
|
|
282
|
-
|
|
283
|
-
## Phase 2: Source Migration Plan
|
|
284
|
-
|
|
285
|
-
1. **Create workspace package directories** with their own `tsconfig.build.json`.
|
|
286
|
-
2. **Move source files** from `src/` into `packages/NAME/src/` following the table above.
|
|
287
|
-
3. **Update internal imports** — use `@ananke/core` etc. instead of relative paths that cross
|
|
288
|
-
package boundaries.
|
|
289
|
-
4. **Wire inter-package dependencies** — `@ananke/combat` lists `@ananke/core` as a dependency.
|
|
290
|
-
5. **Update the monolith meta-package** (`@its-not-rocket-science/ananke`) to re-export from
|
|
291
|
-
the five sub-packages instead of from `src/`.
|
|
292
|
-
6. **Verify** that all existing tests pass without modification (test paths remain unchanged).
|
|
293
|
-
|
|
294
|
-
The most complex step is (3) — identifying which imports cross package boundaries. A planned
|
|
295
|
-
tool (`tools/check-package-boundaries.ts`) will analyse the import graph and report violations.
|
|
296
|
-
|
|
297
|
-
---
|
|
298
|
-
|
|
299
|
-
## What Changes for Package Consumers
|
|
300
|
-
|
|
301
|
-
### Phase 1 (now — stubs)
|
|
302
|
-
```typescript
|
|
303
|
-
// Before (monolith)
|
|
304
|
-
import { resolveHit } from "@its-not-rocket-science/ananke/combat";
|
|
305
|
-
|
|
306
|
-
// After (modular stub — same bundle size, cleaner import path)
|
|
307
|
-
import { resolveHit } from "@ananke/combat";
|
|
308
|
-
```
|
|
309
|
-
|
|
310
|
-
### Phase 2 (source migration — smaller bundles)
|
|
311
|
-
```typescript
|
|
312
|
-
// Same import — but now @ananke/combat has no campaign dependency
|
|
313
|
-
import { resolveHit } from "@ananke/combat";
|
|
314
|
-
```
|
|
315
|
-
|
|
316
|
-
The import path is the same in Phase 1 and Phase 2; only the bundle contents change.
|
|
317
|
-
|
|
318
|
-
---
|
|
319
|
-
|
|
320
|
-
## Backwards Compatibility
|
|
321
|
-
|
|
322
|
-
`@its-not-rocket-science/ananke` will remain published indefinitely as a meta-package.
|
|
323
|
-
All 41 subpath exports will continue to work. Existing hosts do not need to migrate.
|
|
1
|
+
# Package architecture: shipped state, partial modularization, and target state
|
|
2
|
+
|
|
3
|
+
This document reconciles three different things that are easy to blur together:
|
|
4
|
+
|
|
5
|
+
1. What the repository and npm package ship **today**.
|
|
6
|
+
2. What is **partially implemented** toward modular packages.
|
|
7
|
+
3. What the **target architecture** is intended to be.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Current state (shipped now)
|
|
12
|
+
|
|
13
|
+
### What is published today
|
|
14
|
+
|
|
15
|
+
The primary published package is still the monolith:
|
|
16
|
+
|
|
17
|
+
- Package name: `@its-not-rocket-science/ananke`
|
|
18
|
+
- Root entrypoint: `.` → `dist/src/index.js`
|
|
19
|
+
- Many subpath exports (for example `./combat`, `./campaign`, `./species`, `./content`, etc.) from the same monolith build output.
|
|
20
|
+
|
|
21
|
+
In other words: consumers can import many domain-specific entrypoints, but they are exported from one package build at the root.
|
|
22
|
+
|
|
23
|
+
### Filesystem/layout reality
|
|
24
|
+
|
|
25
|
+
- Main implementation is in `src/`.
|
|
26
|
+
- Workspaces exist at `packages/*`.
|
|
27
|
+
- `packages/core`, `packages/combat`, `packages/campaign`, and `packages/content` currently contain thin Phase 1 wrappers (`index.js` + `index.d.ts`) that re-export monolith entrypoints.
|
|
28
|
+
- `packages/cli` exists, but it is private and points to root `dist/tools/*` binaries.
|
|
29
|
+
|
|
30
|
+
### Current architecture diagram (monolith-first)
|
|
31
|
+
|
|
32
|
+
```mermaid
|
|
33
|
+
flowchart LR
|
|
34
|
+
App[Consumer app]
|
|
35
|
+
Mono[@its-not-rocket-science/ananke]
|
|
36
|
+
Dist[dist/src/*]
|
|
37
|
+
Src[src/* implementation]
|
|
38
|
+
|
|
39
|
+
App --> Mono
|
|
40
|
+
Mono --> Dist
|
|
41
|
+
Dist --> Src
|
|
42
|
+
|
|
43
|
+
subgraph Phase 1 workspace wrappers
|
|
44
|
+
Core[@ananke/core]
|
|
45
|
+
Combat[@ananke/combat]
|
|
46
|
+
Campaign[@ananke/campaign]
|
|
47
|
+
Content[@ananke/content]
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
Core -.re-exports.-> Mono
|
|
51
|
+
Combat -.re-exports.-> Mono
|
|
52
|
+
Campaign -.re-exports.-> Mono
|
|
53
|
+
Content -.re-exports.-> Mono
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## In progress (partially implemented)
|
|
59
|
+
|
|
60
|
+
Modularization work is in progress and incomplete.
|
|
61
|
+
|
|
62
|
+
### Already implemented
|
|
63
|
+
|
|
64
|
+
- A modular ownership map and allowed dependency graph exist in `tools/package-boundaries.config.json`.
|
|
65
|
+
- Boundary checking/report tooling exists (`tools/check-package-boundaries.ts`, `npm run check-boundaries*`).
|
|
66
|
+
- Workspace package names and import surfaces for `@ananke/core`, `@ananke/combat`, `@ananke/campaign`, and `@ananke/content` are present.
|
|
67
|
+
|
|
68
|
+
### Not complete yet
|
|
69
|
+
|
|
70
|
+
- Boundary compliance is not yet achieved. The latest checked-in report (`docs/package-boundary-report.md`, generated 2026-04-09) still shows:
|
|
71
|
+
- hard violations,
|
|
72
|
+
- suspicious imports,
|
|
73
|
+
- and unmapped files.
|
|
74
|
+
- Workspace packages are still wrappers; they do not yet own independent implementation/source trees.
|
|
75
|
+
- Because wrappers re-export from the monolith, modular import paths do **not** yet imply full package isolation.
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Target state (planned)
|
|
80
|
+
|
|
81
|
+
The target architecture is modular-first:
|
|
82
|
+
|
|
83
|
+
- Each `@ananke/*` package owns its code, build output, and tests.
|
|
84
|
+
- Cross-package imports follow the declared DAG (for example, `content -> core`, `combat -> core/content`, `campaign -> core/content`).
|
|
85
|
+
- The monolith package remains as a compatibility/meta layer that re-exports modular packages for adopters who want one dependency.
|
|
86
|
+
|
|
87
|
+
### Target architecture diagram (modular-first)
|
|
88
|
+
|
|
89
|
+
```mermaid
|
|
90
|
+
flowchart TD
|
|
91
|
+
Core[@ananke/core]
|
|
92
|
+
Content[@ananke/content]
|
|
93
|
+
Combat[@ananke/combat]
|
|
94
|
+
Campaign[@ananke/campaign]
|
|
95
|
+
|
|
96
|
+
Content --> Core
|
|
97
|
+
Combat --> Core
|
|
98
|
+
Combat --> Content
|
|
99
|
+
Campaign --> Core
|
|
100
|
+
Campaign --> Content
|
|
101
|
+
|
|
102
|
+
Meta[@its-not-rocket-science/ananke (compat/meta)]
|
|
103
|
+
Meta --> Core
|
|
104
|
+
Meta --> Content
|
|
105
|
+
Meta --> Combat
|
|
106
|
+
Meta --> Campaign
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## What this means for adopters today
|
|
112
|
+
|
|
113
|
+
- You can safely use the monolith package now; it is the most direct reflection of shipped structure.
|
|
114
|
+
- You can also use `@ananke/*` imports today, but treat them as import-path aliases/wrappers rather than fully independent packages.
|
|
115
|
+
- Do not assume current modular imports provide maximum tree-shaking or strict package-boundary guarantees yet.
|
|
116
|
+
- Migration to modular import paths can reduce future refactors, because those paths are intended to remain valid as ownership moves into `@ananke/*` packages.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Ananke Plugin SDK
|
|
2
|
+
|
|
3
|
+
Ananke plugins are third-party extensions that register one or more runtime hooks (for example `beforeStep`, `afterStep`, `afterDamage`, or `matchEnd`) and run in a constrained runtime.
|
|
4
|
+
|
|
5
|
+
> ⚠️ **Security caveat (public plugin loading):** `loadPlugin(...)` is not, by itself, a complete security boundary for hostile third-party code. If you load public/untrusted plugins, read `docs/plugins/security-model.md` and apply `docs/plugins/deployment-checklist.md` before production enablement.
|
|
6
|
+
|
|
7
|
+
## Write your first plugin in 10 minutes
|
|
8
|
+
|
|
9
|
+
1. Create a folder under `plugins/`.
|
|
10
|
+
2. Add `plugin.json` using `schema/plugin.schema.json`.
|
|
11
|
+
3. Add an `index.js` file exporting `setup(api)`.
|
|
12
|
+
4. Return handlers keyed by hook name.
|
|
13
|
+
5. Load with `loadPlugin(path)` and call hooks with `runHook(...)`.
|
|
14
|
+
|
|
15
|
+
### `plugin.json`
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"id": "ananke-plugin-hello",
|
|
20
|
+
"version": "1.0.0",
|
|
21
|
+
"hooks": ["afterStep"],
|
|
22
|
+
"dependencies": {},
|
|
23
|
+
"permissions": ["read:worldState", "write:telemetry"]
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### `index.js`
|
|
28
|
+
|
|
29
|
+
```js
|
|
30
|
+
module.exports = {
|
|
31
|
+
setup(api) {
|
|
32
|
+
return {
|
|
33
|
+
afterStep(ctx) {
|
|
34
|
+
const world = api.readWorldState(ctx.worldState);
|
|
35
|
+
api.emitTelemetry("hello.entities", { count: world.entities.length });
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
See `docs/plugins/hooks.md` for the hook contract, `docs/plugins/publishing.md` for registry publication, and `docs/plugins/security-model.md` for production threat modeling.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Hook reference
|
|
2
|
+
|
|
3
|
+
## Core lifecycle hooks
|
|
4
|
+
|
|
5
|
+
- `beforeStep(context)` — called before simulation step execution.
|
|
6
|
+
- `afterStep(context)` — called after a simulation step has completed.
|
|
7
|
+
- `afterDamage(context)` — called after a damage event resolves.
|
|
8
|
+
- `matchEnd(context)` — called once at end-of-match with summary fields.
|
|
9
|
+
|
|
10
|
+
## Plugin runtime API
|
|
11
|
+
|
|
12
|
+
- `hasPermission(permission)`
|
|
13
|
+
- `readWorldState(value)`
|
|
14
|
+
- `mutateWorld(worldState, mutator)` (requires `write:worldState`)
|
|
15
|
+
- `emitTelemetry(metric, payload)` (requires `write:telemetry`)
|
|
16
|
+
- `writeArtifact(path, contents)` (requires `write:artifacts`)
|
|
17
|
+
|
|
18
|
+
## Permission examples
|
|
19
|
+
|
|
20
|
+
- Read-only observer plugin: `permissions: ["read:worldState"]`
|
|
21
|
+
- Analytics plugin with reports: `permissions: ["read:events", "write:artifacts"]`
|
|
22
|
+
- Full gameplay mutator: `permissions: ["read:worldState", "write:worldState"]`
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Publishing plugins to `ananke-plugins`
|
|
2
|
+
|
|
3
|
+
The plugin registry is a GitHub repository that exposes a JSON index consumed by `ananke install <plugin>`.
|
|
4
|
+
|
|
5
|
+
> ⚠️ **Security caveat (public registry):** Registry publication increases exposure to untrusted plugin code paths. Production operators should treat all third-party plugins as untrusted by default and apply `docs/plugins/security-model.md` and `docs/plugins/deployment-checklist.md` before enabling plugins.
|
|
6
|
+
|
|
7
|
+
## Registry structure
|
|
8
|
+
|
|
9
|
+
- `index.json` at repo root
|
|
10
|
+
- one directory per plugin containing `plugin.json` and `index.js`
|
|
11
|
+
|
|
12
|
+
Example entry:
|
|
13
|
+
|
|
14
|
+
```json
|
|
15
|
+
{
|
|
16
|
+
"name": "ananke-plugin-logger",
|
|
17
|
+
"manifestUrl": "https://raw.githubusercontent.com/its-not-rocket-science/ananke-plugins/main/ananke-plugin-logger/plugin.json",
|
|
18
|
+
"moduleUrl": "https://raw.githubusercontent.com/its-not-rocket-science/ananke-plugins/main/ananke-plugin-logger/index.js"
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## CI validation workflow
|
|
23
|
+
|
|
24
|
+
1. Install latest Ananke package.
|
|
25
|
+
2. Validate each `plugin.json` against `schema/plugin.schema.json`.
|
|
26
|
+
3. Load each plugin with `loadPlugin` smoke test.
|
|
27
|
+
4. Run plugin-specific test suite.
|
|
28
|
+
|
|
29
|
+
This keeps registry plugins compatible with the latest API.
|