@spellkave/world-author 0.0.0-bootstrap
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/LICENSE +89 -0
- package/README.md +62 -0
- package/package.json +57 -0
- package/src/applyset-diff-types.ts +158 -0
- package/src/applyset.ts +82 -0
- package/src/authoring-harness.ts +487 -0
- package/src/browser.ts +114 -0
- package/src/compose.ts +699 -0
- package/src/corpus.generated.ts +279 -0
- package/src/corpus.ts +1180 -0
- package/src/damage.ts +75 -0
- package/src/diagnostics.ts +59 -0
- package/src/diff-manifest-core.ts +393 -0
- package/src/diff-manifest.ts +5 -0
- package/src/docs-index.ts +105 -0
- package/src/dsl.ts +10 -0
- package/src/evaluate.ts +100 -0
- package/src/explain-core.ts +219 -0
- package/src/explain.ts +43 -0
- package/src/filter-manifest-core.ts +122 -0
- package/src/filter-manifest.ts +41 -0
- package/src/grants-core.ts +38 -0
- package/src/grants.ts +10 -0
- package/src/included-manifest-metadata-core.ts +63 -0
- package/src/included-manifest-metadata.ts +21 -0
- package/src/index.ts +30 -0
- package/src/inspect.ts +35 -0
- package/src/inspection.ts +239 -0
- package/src/lint.ts +540 -0
- package/src/manifest-text.ts +21 -0
- package/src/manifest.ts +403 -0
- package/src/metadata.ts +137 -0
- package/src/npc-dm-authority-projection.ts +95 -0
- package/src/npc-dm-documents.ts +339 -0
- package/src/npc-dm-presentation.ts +17 -0
- package/src/npc-dm-srd.ts +51 -0
- package/src/npc-dm-types.ts +723 -0
- package/src/npc-kinds.ts +404 -0
- package/src/npc-quests.ts +319 -0
- package/src/observation-tokens.browser.ts +31 -0
- package/src/observation-tokens.ts +27 -0
- package/src/owner-instance-read.ts +765 -0
- package/src/patch.ts +47 -0
- package/src/ref-tags.ts +149 -0
- package/src/reference.ts +48 -0
- package/src/row-identity.ts +105 -0
- package/src/row-kinds-data.ts +35 -0
- package/src/row-kinds.ts +93 -0
- package/src/scenario-guidance.ts +180 -0
- package/src/scoped-instance-read.ts +187 -0
- package/src/service-only-audience.ts +14 -0
- package/src/session-predicates.ts +6 -0
- package/src/spell.ts +119 -0
- package/src/tag-prefix-families.ts +143 -0
- package/src/tooling.browser.ts +397 -0
- package/src/tooling.ts +38 -0
- package/src/validate.ts +255 -0
package/src/corpus.ts
ADDED
|
@@ -0,0 +1,1180 @@
|
|
|
1
|
+
// The authoring corpus is a curated INDEX over the package-local docs in
|
|
2
|
+
// `packages/spellkave-world-author/docs/**` (physically moved off
|
|
3
|
+
// `docs/modding/**`, #1968/R1) — full prose, self-contained, no repo checkout
|
|
4
|
+
// needed. Two halves:
|
|
5
|
+
//
|
|
6
|
+
// • PROSE_DOCS below — hand-authored id/title/kind/tags for the
|
|
7
|
+
// guide/reference prose (`docs/*.md`). Every such `.md` (except the
|
|
8
|
+
// generated reference docs and README) must have a pointer here, enforced
|
|
9
|
+
// by the coverage guard in `__tests__/corpus.test.ts` (ADR-0047 D-3). The
|
|
10
|
+
// `body` is NOT hand-written — it is always the doc's full text, ingested
|
|
11
|
+
// by `scripts/generate-authoring-corpus.ts` into `GENERATED_PROSE_BODIES`
|
|
12
|
+
// (`./corpus.generated`) and merged in below.
|
|
13
|
+
// • The EXAMPLE half — `EXAMPLES[]` and the `kind: "example"` DOCS entries —
|
|
14
|
+
// is GENERATED from `docs/examples/<id>.toml` + `<id>.meta.json` by
|
|
15
|
+
// `scripts/generate-authoring-corpus.ts` and imported from
|
|
16
|
+
// `./corpus.generated`. Do not hand-edit example TOML here; edit the `.toml`
|
|
17
|
+
// and regenerate (ADR-0047 D-2). `--check`-gated in CI.
|
|
18
|
+
//
|
|
19
|
+
// The `dsl-grammar` / `manifest-format` reference docs are themselves generated
|
|
20
|
+
// from the Rust crate (`scripts/generate-authoring-reference-docs.ts`); the same
|
|
21
|
+
// crate truth is also exposed structurally here via `reference.ts`.
|
|
22
|
+
//
|
|
23
|
+
// Consts stay inline (no runtime fs): `@spellkave/world-author` ships only
|
|
24
|
+
// `src/`, so `docs/**` is absent from the published tarball — the corpus must
|
|
25
|
+
// be self-contained within `src/` (ADR-0047 D-4). All single-sourcing happens
|
|
26
|
+
// at generate/CI time, not import time.
|
|
27
|
+
|
|
28
|
+
import type { DocsMetadata } from "@spellkave/tool-contracts";
|
|
29
|
+
import {
|
|
30
|
+
GENERATED_CORPUS_REVISION,
|
|
31
|
+
GENERATED_EXAMPLE_DOCS,
|
|
32
|
+
GENERATED_EXAMPLES,
|
|
33
|
+
GENERATED_PACKAGE_GUIDES,
|
|
34
|
+
GENERATED_PATTERN_DOCS,
|
|
35
|
+
GENERATED_PROSE_BODIES,
|
|
36
|
+
} from "./corpus.generated";
|
|
37
|
+
|
|
38
|
+
export const authoringCorpusRevision = GENERATED_CORPUS_REVISION;
|
|
39
|
+
|
|
40
|
+
export type AuthoringDocKind = "reference" | "guide" | "example" | "repair";
|
|
41
|
+
|
|
42
|
+
export interface AuthoringDoc {
|
|
43
|
+
id: string;
|
|
44
|
+
title: string;
|
|
45
|
+
kind: AuthoringDocKind;
|
|
46
|
+
/** One-line, browsable-index-friendly summary (#1968) — hand-authored for
|
|
47
|
+
* prose docs (PROSE_DOCS below), the example's own `intent` for example
|
|
48
|
+
* docs (`scripts/generate-authoring-corpus.ts`). Never the doc body. */
|
|
49
|
+
summary: string;
|
|
50
|
+
tags: string[];
|
|
51
|
+
body: string;
|
|
52
|
+
/** Repository-relative build input for a guide owned by another product package. */
|
|
53
|
+
source_path?: string;
|
|
54
|
+
/** Authored publication facts; omitted for established corpus material. */
|
|
55
|
+
publication?: Pick<
|
|
56
|
+
DocsMetadata,
|
|
57
|
+
"content_status" | "supported_surfaces" | "feature_prerequisites"
|
|
58
|
+
>;
|
|
59
|
+
/**
|
|
60
|
+
* The worked manifest for an example-backed doc (#1983). Present exactly
|
|
61
|
+
* when `docs/examples/<id>.toml` exists — which is what made a separate
|
|
62
|
+
* `examples show` command necessary before: the doc `body` is the prose
|
|
63
|
+
* companion ("Companion to `<id>.toml`"), never the copyable TOML itself,
|
|
64
|
+
* so a caller who found the right doc still could not act on it. Carrying
|
|
65
|
+
* the payload on the doc collapses "search the corpus" and "fetch the
|
|
66
|
+
* example" into one lookup over one id space.
|
|
67
|
+
*/
|
|
68
|
+
toml?: string;
|
|
69
|
+
/** Diagnostics {@link toml} is expected to produce, empty for a clean example. */
|
|
70
|
+
expectedDiagnostics?: string[];
|
|
71
|
+
/**
|
|
72
|
+
* The example's own `docs/examples/<id>.md` walkthrough, set ONLY when this
|
|
73
|
+
* id also has separate concept prose (`docs/<id>.md`) that already owns
|
|
74
|
+
* `body`. For an example-only doc the walkthrough IS the body, so carrying
|
|
75
|
+
* it twice would just double the payload of a corpus whose whole design is
|
|
76
|
+
* to pull the smallest useful slice.
|
|
77
|
+
*/
|
|
78
|
+
walkthrough?: string;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface AuthoringExample {
|
|
82
|
+
id: string;
|
|
83
|
+
intent: string;
|
|
84
|
+
tags: string[];
|
|
85
|
+
toml: string;
|
|
86
|
+
expectedDiagnostics: string[];
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export interface CorpusQueryResult<T> {
|
|
90
|
+
item: T;
|
|
91
|
+
score: number;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Hand-authored id/title/kind/tags for the guide/reference prose under
|
|
95
|
+
// `packages/spellkave-world-author/docs/`. Example-kind docs are NOT listed
|
|
96
|
+
// here — they are generated (see header). No `body` here: it always comes
|
|
97
|
+
// from `GENERATED_PROSE_BODIES` (full ingested prose, R1), looked up below.
|
|
98
|
+
type ProseDocMeta = Omit<AuthoringDoc, "body">;
|
|
99
|
+
|
|
100
|
+
const PROSE_DOCS: ProseDocMeta[] = [
|
|
101
|
+
{
|
|
102
|
+
id: "containment-policies",
|
|
103
|
+
title: "Containment exposure and access",
|
|
104
|
+
kind: "guide",
|
|
105
|
+
summary:
|
|
106
|
+
"Author definition defaults and instance overrides for perceived contents and removal access, preserving personal possession.",
|
|
107
|
+
tags: ["containment", "policy", "visibility", "ownership", "inventory"],
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
id: "parameterized-scenes",
|
|
111
|
+
title: "Parameterized scene setup",
|
|
112
|
+
kind: "guide",
|
|
113
|
+
summary:
|
|
114
|
+
"Preview a data package, explicitly stage separate graph and population phases, and inspect partial receipts and cleanup limits.",
|
|
115
|
+
tags: ["scene", "blueprint", "setup", "figures", "cleanup", "author"],
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
id: "find-an-authoring-pattern",
|
|
119
|
+
title: "Find an authoring pattern without a checkout",
|
|
120
|
+
kind: "guide",
|
|
121
|
+
summary:
|
|
122
|
+
"Search by task, retrieve a complete pattern and worked example, and distinguish source evidence from installed or hosted proof.",
|
|
123
|
+
tags: ["task", "pattern", "search", "installed", "example", "evidence", "recovery"],
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
id: "hosted-authoring-workflow",
|
|
127
|
+
title: "Author or run a session through hosted tools",
|
|
128
|
+
kind: "guide",
|
|
129
|
+
summary:
|
|
130
|
+
"Retrieve public help, choose a caller-owned presence and use offered scoped portable tools without server files.",
|
|
131
|
+
tags: ["hosted", "author", "DM", "presence", "payload", "task", "recovery"],
|
|
132
|
+
publication: {
|
|
133
|
+
content_status: "implemented",
|
|
134
|
+
supported_surfaces: ["cli", "local-mcp", "hosted-mcp", "web"],
|
|
135
|
+
feature_prerequisites: [],
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
id: "hosted-authoring-guidance",
|
|
140
|
+
title: "Hosted compound workflows — evidence and remaining stories",
|
|
141
|
+
kind: "guide",
|
|
142
|
+
summary:
|
|
143
|
+
"Reference verified local scene setup and the remaining atomic DM hand-over story, with explicit hosted deployment limits.",
|
|
144
|
+
tags: ["hosted", "authoring", "planning", "prerequisites"],
|
|
145
|
+
publication: {
|
|
146
|
+
content_status: "planned",
|
|
147
|
+
supported_surfaces: ["cli", "local-mcp"],
|
|
148
|
+
feature_prerequisites: [
|
|
149
|
+
{
|
|
150
|
+
feature: "parameterized-scene-setups",
|
|
151
|
+
status: "implemented",
|
|
152
|
+
minimum_revision: "dd6f2d57e394ebe303f6c7426640c809c27226ec",
|
|
153
|
+
},
|
|
154
|
+
{ feature: "role-binding-hand-over", status: "planned", minimum_revision: "unknown" },
|
|
155
|
+
],
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
id: "index",
|
|
160
|
+
title: "Authoring docs — corpus index",
|
|
161
|
+
kind: "reference",
|
|
162
|
+
summary:
|
|
163
|
+
"Generated index of every corpus doc, grouped by kind, with a one-line summary each (#1968 browsable docs).",
|
|
164
|
+
tags: ["index", "navigation", "overview", "toc"],
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
id: "behavior-composition",
|
|
168
|
+
title: "Behavior composition — the ActorBehavior layer",
|
|
169
|
+
kind: "guide",
|
|
170
|
+
summary:
|
|
171
|
+
"Turn one declarative ActorBehavior object into the full capability/outcome/affordance/action/consequence chain.",
|
|
172
|
+
tags: [
|
|
173
|
+
"behavior",
|
|
174
|
+
"compose",
|
|
175
|
+
"actor-behavior",
|
|
176
|
+
"shape",
|
|
177
|
+
"spell",
|
|
178
|
+
"monster-action",
|
|
179
|
+
"driver",
|
|
180
|
+
"programmatic",
|
|
181
|
+
],
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
id: "onramp",
|
|
185
|
+
title: "Modding onramp",
|
|
186
|
+
kind: "guide",
|
|
187
|
+
summary:
|
|
188
|
+
"Start-here: AUTHOR + PLAYER tools, with TOML as the underlying model — not a gotcha encyclopedia.",
|
|
189
|
+
tags: ["bundle", "seed", "validate", "manifest", "author", "player", "tools", "onramp"],
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
id: "authoring-process",
|
|
193
|
+
title: "Authoring process — shared agent contract",
|
|
194
|
+
kind: "guide",
|
|
195
|
+
summary:
|
|
196
|
+
"The shared query-first, pre-check, proof-then-escalate process every authoring agent role builds on.",
|
|
197
|
+
tags: ["process", "pre-check", "duplicate", "query-first", "proof", "escalation"],
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
id: "patterns",
|
|
201
|
+
title: "Patterns of Spellkave Manifest Authoring",
|
|
202
|
+
kind: "guide",
|
|
203
|
+
summary:
|
|
204
|
+
"Problem-indexed pattern catalog (extra action, hazards, XP grants, dialog slots, …) — look here before filing a kernel gap.",
|
|
205
|
+
tags: [
|
|
206
|
+
"patterns",
|
|
207
|
+
"catalog",
|
|
208
|
+
"problem-indexed",
|
|
209
|
+
"ModifyChannel",
|
|
210
|
+
"composition",
|
|
211
|
+
"action-surge",
|
|
212
|
+
"authoring",
|
|
213
|
+
],
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
id: "place-graph-occupancy",
|
|
217
|
+
title: "Intent — place graph + occupancy (who is where)",
|
|
218
|
+
kind: "guide",
|
|
219
|
+
summary:
|
|
220
|
+
"Two-call playbook: map_graph for the picture, entities fields=preferred for names by place_node_id.",
|
|
221
|
+
tags: [
|
|
222
|
+
"intent",
|
|
223
|
+
"place-graph",
|
|
224
|
+
"map",
|
|
225
|
+
"occupancy",
|
|
226
|
+
"who-is-where",
|
|
227
|
+
"entities",
|
|
228
|
+
"map_graph",
|
|
229
|
+
"spatial",
|
|
230
|
+
"actors",
|
|
231
|
+
],
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
id: "manifest-format",
|
|
235
|
+
title: "Manifest format reference",
|
|
236
|
+
kind: "reference",
|
|
237
|
+
summary:
|
|
238
|
+
"Generated TOML row/field reference for every manifest row kind, derived from the Rust schema crate.",
|
|
239
|
+
tags: ["schema", "toml", "row-kind", "field"],
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
id: "dsl-grammar",
|
|
243
|
+
title: "DSL grammar reference",
|
|
244
|
+
kind: "reference",
|
|
245
|
+
summary:
|
|
246
|
+
"Generated operator reference for the predicate/outcome DSL used inside `_source` fields.",
|
|
247
|
+
tags: ["dsl", "predicate", "outcome", "operator"],
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
id: "interaction-dsl-and-world-authoring",
|
|
251
|
+
title: "Interaction model and world authoring",
|
|
252
|
+
kind: "reference",
|
|
253
|
+
summary:
|
|
254
|
+
"The broader interaction model: entities, containment, affordances, niches, outcomes, conditions, target refs.",
|
|
255
|
+
tags: [
|
|
256
|
+
"interaction",
|
|
257
|
+
"affordance",
|
|
258
|
+
"niche",
|
|
259
|
+
"consequence",
|
|
260
|
+
"frame-write",
|
|
261
|
+
"condition",
|
|
262
|
+
"equipment",
|
|
263
|
+
"aoe",
|
|
264
|
+
],
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
id: "damage-type-routing",
|
|
268
|
+
title: "Damage-type routing pattern",
|
|
269
|
+
kind: "guide",
|
|
270
|
+
summary:
|
|
271
|
+
"Author typed damage via a delta_source DSL expression that reads target resistance/immunity tags.",
|
|
272
|
+
tags: ["damage", "routing", "delta-source", "has-tag", "resistance", "immunity"],
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
id: "metadata-attachments",
|
|
276
|
+
title: "Metadata attachments",
|
|
277
|
+
kind: "guide",
|
|
278
|
+
summary:
|
|
279
|
+
"Validated annotations (provenance, art, narration, persona) that are for humans/tools, never server behavior.",
|
|
280
|
+
tags: [
|
|
281
|
+
"metadata",
|
|
282
|
+
"provenance",
|
|
283
|
+
"editorial",
|
|
284
|
+
"observer",
|
|
285
|
+
"art",
|
|
286
|
+
"narration",
|
|
287
|
+
"persona",
|
|
288
|
+
"placement-ladder",
|
|
289
|
+
],
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
id: "lingering-hazard-zones",
|
|
293
|
+
title: "Lingering hazard zones (caster-attributed pulses)",
|
|
294
|
+
kind: "guide",
|
|
295
|
+
summary:
|
|
296
|
+
"Author a self-pulsing hazard zone (Cloudkill, Stinking Cloud) that damages occupants each round, then fades.",
|
|
297
|
+
tags: [
|
|
298
|
+
"hazard",
|
|
299
|
+
"cloudkill",
|
|
300
|
+
"autonomy-job",
|
|
301
|
+
"schedule",
|
|
302
|
+
"pulse",
|
|
303
|
+
"duration",
|
|
304
|
+
"liveness",
|
|
305
|
+
"concentration",
|
|
306
|
+
],
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
id: "long-running-actions",
|
|
310
|
+
title: "Long-running actions, busy policy, and resumable progress",
|
|
311
|
+
kind: "guide",
|
|
312
|
+
summary:
|
|
313
|
+
"Author actions with real in-world duration (rituals, crafting, rests): the §5.10 promotion threshold, busy allow/break predicates, authored expiry, and opt-in resumable progress.",
|
|
314
|
+
tags: [
|
|
315
|
+
"long-running",
|
|
316
|
+
"cost_time_ms",
|
|
317
|
+
"promotion",
|
|
318
|
+
"session",
|
|
319
|
+
"busy",
|
|
320
|
+
"busy_allow_pred",
|
|
321
|
+
"busy_break_pred",
|
|
322
|
+
"resumable",
|
|
323
|
+
"progress",
|
|
324
|
+
"interrupted_work",
|
|
325
|
+
"duration",
|
|
326
|
+
"ritual",
|
|
327
|
+
"rest",
|
|
328
|
+
],
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
id: "action-economy",
|
|
332
|
+
title: "Action economy: channels, boundaries, and fiction time",
|
|
333
|
+
kind: "guide",
|
|
334
|
+
summary:
|
|
335
|
+
"Author fiction-ms channel pools, action costs, boundary refreshes, condition modifiers, and autonomy firing modes.",
|
|
336
|
+
tags: [
|
|
337
|
+
"action-economy",
|
|
338
|
+
"channel",
|
|
339
|
+
"cost-time-ms",
|
|
340
|
+
"boundary",
|
|
341
|
+
"fire-boundary",
|
|
342
|
+
"autonomy",
|
|
343
|
+
"modifier",
|
|
344
|
+
"fiction-time",
|
|
345
|
+
],
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
id: "spell-authoring-best-practices",
|
|
349
|
+
title: "Spell authoring best practices",
|
|
350
|
+
kind: "guide",
|
|
351
|
+
summary:
|
|
352
|
+
"How to add a spell without hand-wiring a dozen rows or drifting into lint-flagged duplication.",
|
|
353
|
+
tags: [
|
|
354
|
+
"spell",
|
|
355
|
+
"identity",
|
|
356
|
+
"emit-spell",
|
|
357
|
+
"lint",
|
|
358
|
+
"render-discipline",
|
|
359
|
+
"dedup",
|
|
360
|
+
"best-practice",
|
|
361
|
+
],
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
id: "running-an-authored-act",
|
|
365
|
+
title: "Running an authored act through r_manipulate",
|
|
366
|
+
kind: "repair",
|
|
367
|
+
summary:
|
|
368
|
+
"Runbook of non-obvious requirements for an authored act to actually fire through r_manipulate, in bite order.",
|
|
369
|
+
tags: ["manipulate", "affordance", "capability", "act", "runbook", "troubleshooting"],
|
|
370
|
+
},
|
|
371
|
+
// Situational repairs extracted from the pre-split onramp (authoring-docs-tool-first-onramp).
|
|
372
|
+
// Bodies: docs/repairs/<id>.md (except running-an-authored-act, top-level).
|
|
373
|
+
{
|
|
374
|
+
id: "actor-identity-bindings",
|
|
375
|
+
title: "Actor Identity Bindings",
|
|
376
|
+
kind: "repair",
|
|
377
|
+
summary: "[[actor_identities]] binds a SpacetimeDB login identity to an authored actor.",
|
|
378
|
+
tags: [
|
|
379
|
+
"repair",
|
|
380
|
+
"troubleshooting",
|
|
381
|
+
"gotcha",
|
|
382
|
+
"actor_identities",
|
|
383
|
+
"$sender",
|
|
384
|
+
"actor_authorization_failed",
|
|
385
|
+
"binding",
|
|
386
|
+
],
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
id: "actor-stat-self-only",
|
|
390
|
+
title:
|
|
391
|
+
"`actor.stat(...)` and a self-eligible `ModifyResource`'s `TargetActor` only ever read/write the ACTING entity's own row \u2014 never a third party",
|
|
392
|
+
kind: "repair",
|
|
393
|
+
summary: "Gotcha \u2014 there is no cross-actor resource read/write shape. In an",
|
|
394
|
+
tags: [
|
|
395
|
+
"repair",
|
|
396
|
+
"troubleshooting",
|
|
397
|
+
"gotcha",
|
|
398
|
+
"actor.stat",
|
|
399
|
+
"ModifyResource",
|
|
400
|
+
"TargetActor",
|
|
401
|
+
"self_eligible",
|
|
402
|
+
],
|
|
403
|
+
},
|
|
404
|
+
{
|
|
405
|
+
id: "adjacent-moves-ungated",
|
|
406
|
+
title:
|
|
407
|
+
"`adjacentMoves()` lists raw graph geometry, not gated traversability; to prove an edge now rejects, attempt `.move()` and check the status",
|
|
408
|
+
kind: "repair",
|
|
409
|
+
summary: "listAdjacentMoves (packages/spellkave-sdk/src/core/movement.ts) iterates",
|
|
410
|
+
tags: ["repair", "troubleshooting", "gotcha", "adjacentMoves", "traversability", "move"],
|
|
411
|
+
},
|
|
412
|
+
{
|
|
413
|
+
id: "affordance-needs-niche-attachment",
|
|
414
|
+
title:
|
|
415
|
+
"An affordance `niche_id` needs a `spatial_niche_attachment` only when its niche is place-provided \u2014 pick the niche's `provider` deliberately",
|
|
416
|
+
kind: "repair",
|
|
417
|
+
summary: "**Gotcha \u2014 granting a capability via actor_capabilities does not, by",
|
|
418
|
+
tags: [
|
|
419
|
+
"repair",
|
|
420
|
+
"troubleshooting",
|
|
421
|
+
"gotcha",
|
|
422
|
+
"niche_id",
|
|
423
|
+
"spatial_niche_attachment",
|
|
424
|
+
"self_eligible",
|
|
425
|
+
],
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
id: "apply-status-claim-lock",
|
|
429
|
+
title:
|
|
430
|
+
"Any consequence containing `ApplyStatus` acquires a 10-tick claim-lock on its target \u2014 a second actor's manipulate against that same target can hit `claim_contended`",
|
|
431
|
+
kind: "repair",
|
|
432
|
+
summary: "r_manipulate classifies a resolved action's consequence as *steering-shaped*",
|
|
433
|
+
tags: ["repair", "troubleshooting", "gotcha", "ApplyStatus", "claim_contended", "claim-lock"],
|
|
434
|
+
},
|
|
435
|
+
{
|
|
436
|
+
id: "authoring-observability",
|
|
437
|
+
title: "Observability",
|
|
438
|
+
kind: "repair",
|
|
439
|
+
summary: "Observer knowledge is the canonical read surface for fog-of-war style",
|
|
440
|
+
tags: ["repair", "troubleshooting", "gotcha", "observability", "events", "knowledge", "doctor"],
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
id: "edge-traversal-resource-seed",
|
|
444
|
+
title:
|
|
445
|
+
"an edge-traversal affordance predicate reading a resource via `actor.stat(...)` needs that resource seeded on EVERY actor who might traverse the edge, and multiple `place_edge_affordance` rows on one `edge_key` AND-chain",
|
|
446
|
+
kind: "repair",
|
|
447
|
+
summary: "Two facts compound here. First, evaluate_edge_traversal_affordances",
|
|
448
|
+
tags: [
|
|
449
|
+
"repair",
|
|
450
|
+
"troubleshooting",
|
|
451
|
+
"gotcha",
|
|
452
|
+
"place_edge_affordance",
|
|
453
|
+
"actor.stat",
|
|
454
|
+
"edge_key",
|
|
455
|
+
],
|
|
456
|
+
},
|
|
457
|
+
{
|
|
458
|
+
id: "effective-condition-modifiers",
|
|
459
|
+
title: "Numeric condition modifiers need explicit `effective(...)` consumers",
|
|
460
|
+
kind: "repair",
|
|
461
|
+
summary: 'actor.stat("my/state") and target.stat("my/state") always read the authored',
|
|
462
|
+
tags: ["repair", "troubleshooting", "gotcha", "effective", "modifier", "condition"],
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
id: "empty-predicate-source",
|
|
466
|
+
title:
|
|
467
|
+
"An empty `predicate_source` needs `predicate_bool = true`, or the affordance silently never resolves",
|
|
468
|
+
kind: "repair",
|
|
469
|
+
summary: "**Gotcha \u2014 predicate_bool is not a decorative default; it is the literal",
|
|
470
|
+
tags: [
|
|
471
|
+
"repair",
|
|
472
|
+
"troubleshooting",
|
|
473
|
+
"gotcha",
|
|
474
|
+
"predicate_source",
|
|
475
|
+
"predicate_bool",
|
|
476
|
+
"affordance",
|
|
477
|
+
],
|
|
478
|
+
},
|
|
479
|
+
{
|
|
480
|
+
id: "equip-item-target-ref",
|
|
481
|
+
title: "Equipping items: target-ref prefix, ownership depth, and `core/drop`'s real scope",
|
|
482
|
+
kind: "repair",
|
|
483
|
+
summary: "**Gotcha \u2014 entity:<id> vs item:<id> target refs resolve through DIFFERENT",
|
|
484
|
+
tags: [
|
|
485
|
+
"repair",
|
|
486
|
+
"troubleshooting",
|
|
487
|
+
"gotcha",
|
|
488
|
+
"item:",
|
|
489
|
+
"entity:",
|
|
490
|
+
"equip",
|
|
491
|
+
"out_of_range",
|
|
492
|
+
"drop",
|
|
493
|
+
],
|
|
494
|
+
},
|
|
495
|
+
{
|
|
496
|
+
id: "condition-capability-grant-and-suppression",
|
|
497
|
+
title:
|
|
498
|
+
"`grants_capability_while_active` grants a capability while a condition holds \u2014 and `suppresses_capability_while_active` takes one away",
|
|
499
|
+
kind: "repair",
|
|
500
|
+
summary: "Both fields on `[[condition_definitions]]` are lists of `capability_id`s, and",
|
|
501
|
+
tags: [
|
|
502
|
+
"repair",
|
|
503
|
+
"troubleshooting",
|
|
504
|
+
"gotcha",
|
|
505
|
+
"grants_capability_while_active",
|
|
506
|
+
"suppresses_capability_while_active",
|
|
507
|
+
"capability",
|
|
508
|
+
"condition",
|
|
509
|
+
"ApplyStatus",
|
|
510
|
+
],
|
|
511
|
+
},
|
|
512
|
+
{
|
|
513
|
+
id: "grid-anchor-forfeits-kill-zone",
|
|
514
|
+
title:
|
|
515
|
+
"Placing an actor's manifest position on a session's grid ANCHOR node forfeits its authored kill-zone cell \u2014 it row-major-falls-back instead",
|
|
516
|
+
kind: "repair",
|
|
517
|
+
summary: "An actor's combat_grid_blueprint seat is normally snapped from its authored",
|
|
518
|
+
tags: ["repair", "troubleshooting", "gotcha", "grid", "anchor", "kill-zone", "session"],
|
|
519
|
+
},
|
|
520
|
+
{
|
|
521
|
+
id: "has-item-dead-in-manipulate",
|
|
522
|
+
title:
|
|
523
|
+
"`has_item` works inside a manipulate predicate \u2014 RETIRED gotcha, kept for readers of old manifests",
|
|
524
|
+
kind: "repair",
|
|
525
|
+
summary: "**This gotcha no longer applies.** Since bead sk-vjh.7,",
|
|
526
|
+
tags: [
|
|
527
|
+
"repair",
|
|
528
|
+
"troubleshooting",
|
|
529
|
+
"retired",
|
|
530
|
+
"has_item",
|
|
531
|
+
"manipulate",
|
|
532
|
+
"predicate",
|
|
533
|
+
"possession-gate",
|
|
534
|
+
],
|
|
535
|
+
},
|
|
536
|
+
{
|
|
537
|
+
id: "hosted-world-observability",
|
|
538
|
+
title: "Hosted-world observability for authors",
|
|
539
|
+
kind: "repair",
|
|
540
|
+
summary: "A hosted world's NPC cycles and tool outcomes are visible to the world",
|
|
541
|
+
tags: ["repair", "observability", "hosted", "author", "openobserve", "control-plane"],
|
|
542
|
+
},
|
|
543
|
+
{
|
|
544
|
+
id: "join-session-global-scope",
|
|
545
|
+
title:
|
|
546
|
+
"`JoinSession`/`LeaveSession` read a GLOBAL `turn_state.scope_session_id` \u2014 the acting entity does not need to be a participant, but the room-alarm gate it often pairs with is a `spatial_environment_state`, not an `object_state`",
|
|
547
|
+
kind: "repair",
|
|
548
|
+
summary: 'A JoinSession { participant_ref: "Actor" } frame-write (mid-combat',
|
|
549
|
+
tags: [
|
|
550
|
+
"repair",
|
|
551
|
+
"troubleshooting",
|
|
552
|
+
"gotcha",
|
|
553
|
+
"JoinSession",
|
|
554
|
+
"LeaveSession",
|
|
555
|
+
"scope_session_id",
|
|
556
|
+
"spatial_environment_state",
|
|
557
|
+
],
|
|
558
|
+
},
|
|
559
|
+
{
|
|
560
|
+
id: "leave-session-relocates",
|
|
561
|
+
title:
|
|
562
|
+
"`LeaveSession` always relocates the leaver off the tactical grid \u2014 it removes a participant from the turn order at the cost of taking the body out of the scene, so it is the wrong tool for a corpse",
|
|
563
|
+
kind: "repair",
|
|
564
|
+
summary:
|
|
565
|
+
"Skip a body without removing it via turn_eligibility_pred; LeaveSession relocates the leaver",
|
|
566
|
+
tags: [
|
|
567
|
+
"repair",
|
|
568
|
+
"troubleshooting",
|
|
569
|
+
"gotcha",
|
|
570
|
+
"LeaveSession",
|
|
571
|
+
"turn-order",
|
|
572
|
+
"turn_eligibility_pred",
|
|
573
|
+
"corpse",
|
|
574
|
+
"condition-hook",
|
|
575
|
+
"core/session_id",
|
|
576
|
+
],
|
|
577
|
+
},
|
|
578
|
+
{
|
|
579
|
+
id: "manipulate-ref-niche-attachment",
|
|
580
|
+
title:
|
|
581
|
+
'An item-scoped place niche needs a `spatial_niche_attachment` (or `provider = "entity"`), however the manipulate ref is built',
|
|
582
|
+
kind: "repair",
|
|
583
|
+
summary: "**Gotcha \u2014 the generic (entity:<id>/item:<id>) manipulate-target",
|
|
584
|
+
tags: [
|
|
585
|
+
"repair",
|
|
586
|
+
"troubleshooting",
|
|
587
|
+
"gotcha",
|
|
588
|
+
"entity:",
|
|
589
|
+
"item:",
|
|
590
|
+
"spatial_niche_attachment",
|
|
591
|
+
"target_ref",
|
|
592
|
+
],
|
|
593
|
+
},
|
|
594
|
+
{
|
|
595
|
+
id: "manipulate-success-on-provenance",
|
|
596
|
+
title:
|
|
597
|
+
"`manipulate()`'s `successPredicate` has no fixed world-state signal for a stochastic (d20-driven) action \u2014 pass `successOnProvenance: true` on the client instead",
|
|
598
|
+
kind: "repair",
|
|
599
|
+
summary: "createActorClient(session, id, { successOnProvenance: true }) makes",
|
|
600
|
+
tags: [
|
|
601
|
+
"repair",
|
|
602
|
+
"troubleshooting",
|
|
603
|
+
"gotcha",
|
|
604
|
+
"successOnProvenance",
|
|
605
|
+
"manipulate",
|
|
606
|
+
"stochastic",
|
|
607
|
+
"d20",
|
|
608
|
+
],
|
|
609
|
+
},
|
|
610
|
+
{
|
|
611
|
+
id: "mass-stand-down-apply-status",
|
|
612
|
+
title: "Mass stand-down: `ForEachActorInRadius` + `ApplyStatus`, not per-entity writes",
|
|
613
|
+
kind: "repair",
|
|
614
|
+
summary: "A single deterministic act (e.g. an NPC leader calling off its allies) can",
|
|
615
|
+
tags: ["repair", "troubleshooting", "gotcha", "ForEachActorInRadius", "ApplyStatus", "aoe"],
|
|
616
|
+
},
|
|
617
|
+
{
|
|
618
|
+
id: "milestone-gate-terminal-flags",
|
|
619
|
+
title:
|
|
620
|
+
"A milestone gate composing over a prior beat's terminal flags only needs the ONE action each flag's own predicate requires \u2014 not a full re-derivation of that beat",
|
|
621
|
+
kind: "repair",
|
|
622
|
+
summary: "A milestone/advancement beat that gates on flags a much larger prior beat",
|
|
623
|
+
tags: ["repair", "troubleshooting", "gotcha", "milestone", "predicate", "walkthrough"],
|
|
624
|
+
},
|
|
625
|
+
{
|
|
626
|
+
id: "modify-resource-floored-noop",
|
|
627
|
+
title:
|
|
628
|
+
"A `ModifyResource` against an already-floored resource is a silent no-op \u2014 use a dedicated counter to prove repeated harm",
|
|
629
|
+
kind: "repair",
|
|
630
|
+
summary: "Resources clamp at min_value (srd/hp's is 0). A consequence that deals",
|
|
631
|
+
tags: ["repair", "troubleshooting", "gotcha", "ModifyResource", "floor", "silent", "counter"],
|
|
632
|
+
},
|
|
633
|
+
{
|
|
634
|
+
id: "no-knowledge-seed-primitive",
|
|
635
|
+
title: "No manifest knowledge-seed primitive \u2014 OR-extend the reading predicate instead",
|
|
636
|
+
kind: "repair",
|
|
637
|
+
summary: "**Gotcha \u2014 the only manifest knowledge-writer is CopyKnowledgeRow",
|
|
638
|
+
tags: ["repair", "troubleshooting", "gotcha", "knowledge", "predicate", "seed"],
|
|
639
|
+
},
|
|
640
|
+
{
|
|
641
|
+
id: "npc-needs-driver",
|
|
642
|
+
title: "NPCs need a driver \u2014 there is no autonomous NPC behavior",
|
|
643
|
+
kind: "repair",
|
|
644
|
+
summary: "Spellkave's module has a hard rule: **it contains no actor decision",
|
|
645
|
+
tags: ["repair", "troubleshooting", "gotcha", "npc", "driver", "autonomy", "schedule"],
|
|
646
|
+
},
|
|
647
|
+
{
|
|
648
|
+
id: "ordered-resource-grants",
|
|
649
|
+
title: "Ordered resource grants can read earlier frame writes",
|
|
650
|
+
kind: "repair",
|
|
651
|
+
summary: "consequence_frame_writes execute by ascending ordinal, and each",
|
|
652
|
+
tags: ["repair", "troubleshooting", "gotcha", "frame_write", "ordinal", "resource"],
|
|
653
|
+
},
|
|
654
|
+
{
|
|
655
|
+
id: "region-scale-geography",
|
|
656
|
+
title: "Region-scale geography: check the live place graph, not a stale brief",
|
|
657
|
+
kind: "repair",
|
|
658
|
+
summary: '**Gotcha \u2014 a beat brief\'s "region nodes: ZERO" open flank can go stale the',
|
|
659
|
+
tags: ["repair", "troubleshooting", "gotcha", "region", "place_graph", "foundry", "geography"],
|
|
660
|
+
},
|
|
661
|
+
{
|
|
662
|
+
id: "relocate-entity-ungated",
|
|
663
|
+
title:
|
|
664
|
+
"`RelocateEntity` is the un-gated, world-scoped forced-move leaf \u2014 no `place_edge` required, unlike `JoinSession`/`LeaveSession` it never touches a session",
|
|
665
|
+
kind: "repair",
|
|
666
|
+
summary: "A consequence that must move an actor somewhere it did NOT choose to walk",
|
|
667
|
+
tags: ["repair", "troubleshooting", "gotcha", "RelocateEntity", "forced-move"],
|
|
668
|
+
},
|
|
669
|
+
{
|
|
670
|
+
id: "remove-item-deletes-stack",
|
|
671
|
+
title:
|
|
672
|
+
"`RemoveItem` deletes a fully-consumed stack \u2014 it does not leave a zero-quantity row",
|
|
673
|
+
kind: "repair",
|
|
674
|
+
summary: "RemoveItem's quantity split (remove_item.rs::decide_quantity) has two",
|
|
675
|
+
tags: ["repair", "troubleshooting", "gotcha", "RemoveItem", "quantity", "stack"],
|
|
676
|
+
},
|
|
677
|
+
{
|
|
678
|
+
id: "sibling-resource-predicate-seeds",
|
|
679
|
+
title: "Sibling resource pools each need their OWN predicate-safety seed",
|
|
680
|
+
kind: "repair",
|
|
681
|
+
summary: "**Gotcha \u2014 seeding one resource pool does NOT seed a sibling pool with the",
|
|
682
|
+
tags: ["repair", "troubleshooting", "gotcha", "resource", "predicate", "seed", "object_state"],
|
|
683
|
+
},
|
|
684
|
+
{
|
|
685
|
+
id: "target-has-capability-dead",
|
|
686
|
+
title:
|
|
687
|
+
"`target.has_capability(...)` is dead \u2014 capability facts are Actor-only; gate a TARGET's kind via `target.has_niche(...)` (an entity-def tag) instead",
|
|
688
|
+
kind: "repair",
|
|
689
|
+
summary: "**Gotcha \u2014 target.has_capability(...) parses and seeds cleanly, then never",
|
|
690
|
+
tags: ["repair", "troubleshooting", "gotcha", "has_capability", "has_niche", "dead"],
|
|
691
|
+
},
|
|
692
|
+
{
|
|
693
|
+
id: "weapon-stricter-affordance-variant",
|
|
694
|
+
title:
|
|
695
|
+
"Opting ONE weapon copy into a stricter affordance variant without regressing its siblings",
|
|
696
|
+
kind: "repair",
|
|
697
|
+
summary: 'Two entity_definitions can represent "the same" item (e.g. srd/item/shortbow',
|
|
698
|
+
tags: ["repair", "troubleshooting", "gotcha", "weapon", "affordance", "variant"],
|
|
699
|
+
},
|
|
700
|
+
{
|
|
701
|
+
id: "self-eligible-reaction-budget",
|
|
702
|
+
title:
|
|
703
|
+
"MF-VAL-263's budget requirement narrowed to self-eligible REACTIONS (2026-08-01, PR #2079) — a plain self-target action needs no `spends_channel` or `ModifyResource`",
|
|
704
|
+
kind: "repair",
|
|
705
|
+
summary: "The rule, as it stands today. self_eligible = true has two independent",
|
|
706
|
+
tags: [
|
|
707
|
+
"repair",
|
|
708
|
+
"troubleshooting",
|
|
709
|
+
"gotcha",
|
|
710
|
+
"self_eligible",
|
|
711
|
+
"mf-val-263",
|
|
712
|
+
"reaction_eligibility",
|
|
713
|
+
"reaction_trigger",
|
|
714
|
+
"spends_channel",
|
|
715
|
+
"ModifyResource",
|
|
716
|
+
],
|
|
717
|
+
},
|
|
718
|
+
{
|
|
719
|
+
id: "can-i",
|
|
720
|
+
title: "Ask whether an actor may act",
|
|
721
|
+
kind: "guide",
|
|
722
|
+
summary:
|
|
723
|
+
"Ask a running world whether one body may perform one action now, and which check decides.",
|
|
724
|
+
tags: ["probe", "admission", "can-i", "authority"],
|
|
725
|
+
},
|
|
726
|
+
{
|
|
727
|
+
id: "dm-oversight",
|
|
728
|
+
title: "Defining a DM: region oversight (see-as extent)",
|
|
729
|
+
kind: "guide",
|
|
730
|
+
summary:
|
|
731
|
+
"Bind a DM role to a principal through a separate presence body, with bounded read oversight and authorised handover.",
|
|
732
|
+
tags: [
|
|
733
|
+
"dm",
|
|
734
|
+
"visibility",
|
|
735
|
+
"hidden",
|
|
736
|
+
"extent",
|
|
737
|
+
"place-graph",
|
|
738
|
+
"capability",
|
|
739
|
+
"oversight",
|
|
740
|
+
"binding",
|
|
741
|
+
"presence",
|
|
742
|
+
],
|
|
743
|
+
},
|
|
744
|
+
{
|
|
745
|
+
id: "grants",
|
|
746
|
+
title: "Granting and recovering runtime roles",
|
|
747
|
+
kind: "guide",
|
|
748
|
+
summary:
|
|
749
|
+
"Delegate roles as the caller, inspect private bindings, expand a complete world snapshot and export/restore with explicit expiry recovery.",
|
|
750
|
+
tags: ["role", "grant", "revoke", "binding", "extent", "export", "restore", "authority"],
|
|
751
|
+
},
|
|
752
|
+
{
|
|
753
|
+
id: "roles",
|
|
754
|
+
title: "Roles as authored content",
|
|
755
|
+
kind: "guide",
|
|
756
|
+
summary:
|
|
757
|
+
"Define and aggregate capability vocabulary, bind roles to principals through presences, and inspect composition and realised or inert bindings with explain.",
|
|
758
|
+
tags: ["role", "binding", "presence", "capability", "aggregation", "explain", "authority"],
|
|
759
|
+
},
|
|
760
|
+
{
|
|
761
|
+
id: "privileges",
|
|
762
|
+
title: "Privileges: who may do and see what",
|
|
763
|
+
kind: "reference",
|
|
764
|
+
summary:
|
|
765
|
+
"Every authority gate compiled into the server: named capabilities, operator identity, and elevation grants.",
|
|
766
|
+
tags: ["privilege", "capability", "operator", "elevation", "authority", "visibility", "dm"],
|
|
767
|
+
},
|
|
768
|
+
{
|
|
769
|
+
id: "reading-a-world",
|
|
770
|
+
title: "Reading a running world",
|
|
771
|
+
kind: "guide",
|
|
772
|
+
summary:
|
|
773
|
+
"get and describe read admitted authored instances through publisher or role-scoped readers; inspect reads files; query reads definitions and the workspace.",
|
|
774
|
+
tags: ["get", "describe", "query", "inspect", "owner", "publisher"],
|
|
775
|
+
},
|
|
776
|
+
{
|
|
777
|
+
id: "playable-seats",
|
|
778
|
+
title: "Discovering playable seats",
|
|
779
|
+
kind: "guide",
|
|
780
|
+
summary:
|
|
781
|
+
"Distinguish authored SRD seat offers from current live claimed/embodied state, with Explorer searches and the existing seat reader.",
|
|
782
|
+
tags: ["playable", "seats", "claim", "player", "explore", "inventory"],
|
|
783
|
+
},
|
|
784
|
+
{
|
|
785
|
+
id: "getting-started-with-verbs",
|
|
786
|
+
title: "Getting started with verbs",
|
|
787
|
+
kind: "guide",
|
|
788
|
+
summary:
|
|
789
|
+
"AUTHOR verb deep-dive (4-call fireball) linked from onramp — not a rival start-here door.",
|
|
790
|
+
tags: [
|
|
791
|
+
"verb",
|
|
792
|
+
"getting-started",
|
|
793
|
+
"fireball",
|
|
794
|
+
"smart-default",
|
|
795
|
+
"idempotent",
|
|
796
|
+
"upsert",
|
|
797
|
+
"target",
|
|
798
|
+
"stage-then-commit",
|
|
799
|
+
"agent",
|
|
800
|
+
],
|
|
801
|
+
},
|
|
802
|
+
{
|
|
803
|
+
id: "osm-mapping",
|
|
804
|
+
title: "OSM mapping — how authored places become a map",
|
|
805
|
+
kind: "reference",
|
|
806
|
+
summary:
|
|
807
|
+
"What to author (origin cell, sheet positions, portal edges, floors, extents, map layers) for a place to appear on the OSM-native world map, and the tags external OSM tools see (ADR-0123).",
|
|
808
|
+
tags: [
|
|
809
|
+
"osm",
|
|
810
|
+
"map",
|
|
811
|
+
"spatial",
|
|
812
|
+
"place-graph",
|
|
813
|
+
"indoor",
|
|
814
|
+
"level",
|
|
815
|
+
"coordinates",
|
|
816
|
+
"h3",
|
|
817
|
+
"map_layers",
|
|
818
|
+
"reference",
|
|
819
|
+
],
|
|
820
|
+
},
|
|
821
|
+
{
|
|
822
|
+
id: "tool-reference",
|
|
823
|
+
title: "Tool reference — AUTHOR surface",
|
|
824
|
+
kind: "reference",
|
|
825
|
+
summary:
|
|
826
|
+
"Generated schema reference for the AUTHOR verb registry (`authorFacingToolDefinitions` / `AUTHOR_TOOL_NAMES`), walked structurally from their own TypeBox parameters.",
|
|
827
|
+
tags: ["verb", "tool", "schema", "parameter", "reference", "agent"],
|
|
828
|
+
},
|
|
829
|
+
{
|
|
830
|
+
id: "fixture-correctness",
|
|
831
|
+
title: "Fixture correctness — the catalog",
|
|
832
|
+
kind: "reference",
|
|
833
|
+
summary:
|
|
834
|
+
"The single source of truth for authoring a world-fixtures bundle correctly — every enforcer points here.",
|
|
835
|
+
tags: [
|
|
836
|
+
"correctness",
|
|
837
|
+
"lint",
|
|
838
|
+
"mf-val",
|
|
839
|
+
"hygiene",
|
|
840
|
+
"bundle-scope",
|
|
841
|
+
"depends-on",
|
|
842
|
+
"layering",
|
|
843
|
+
"sourcing",
|
|
844
|
+
],
|
|
845
|
+
},
|
|
846
|
+
{
|
|
847
|
+
id: "rule-bench",
|
|
848
|
+
title: "Offline rule evaluation bench (`spellkave_eval` / `sk eval`)",
|
|
849
|
+
kind: "guide",
|
|
850
|
+
summary:
|
|
851
|
+
"Offline DSL expression and rule benching without a running node: facts shapes, chosen dice mechanics, traces, and resolution timing.",
|
|
852
|
+
tags: [
|
|
853
|
+
"rule-bench",
|
|
854
|
+
"eval",
|
|
855
|
+
"dsl",
|
|
856
|
+
"predicate",
|
|
857
|
+
"offline",
|
|
858
|
+
"formula",
|
|
859
|
+
"trace",
|
|
860
|
+
"dice",
|
|
861
|
+
"facts",
|
|
862
|
+
"resolution",
|
|
863
|
+
],
|
|
864
|
+
},
|
|
865
|
+
];
|
|
866
|
+
|
|
867
|
+
/** Packaged source path relative to docs/ for a prose corpus id (tests + errors). */
|
|
868
|
+
export function authoringDocSourcePath(id: string): string {
|
|
869
|
+
if (id === "onramp") return "README.md";
|
|
870
|
+
// Problem-indexed pattern catalog lives under docs/patterns/ (sk-609b.12.7).
|
|
871
|
+
if (id === "patterns") return "patterns/index.md";
|
|
872
|
+
if (id.startsWith("patterns/")) return `${id}.md`;
|
|
873
|
+
// Historical top-level repair keeps its original path; newer repairs live under docs/repairs/.
|
|
874
|
+
const meta = PROSE_DOCS.find((doc) => doc.id === id);
|
|
875
|
+
if (meta?.kind === "repair" && id !== "running-an-authored-act") {
|
|
876
|
+
return `repairs/${id}.md`;
|
|
877
|
+
}
|
|
878
|
+
return `${id}.md`;
|
|
879
|
+
}
|
|
880
|
+
|
|
881
|
+
/** Full ingested prose for a `PROSE_DOCS` id, or a loud failure if it's missing. */
|
|
882
|
+
function proseBody(id: string): string {
|
|
883
|
+
const body = GENERATED_PROSE_BODIES[id];
|
|
884
|
+
if (body === undefined) {
|
|
885
|
+
throw new Error(
|
|
886
|
+
`corpus.ts: PROSE_DOCS entry "${id}" has no ingested prose — add ` +
|
|
887
|
+
`packages/spellkave-world-author/docs/${authoringDocSourcePath(id)} (or fix the id) and regenerate ` +
|
|
888
|
+
`(scripts/generate-authoring-corpus.ts)`,
|
|
889
|
+
);
|
|
890
|
+
}
|
|
891
|
+
return body;
|
|
892
|
+
}
|
|
893
|
+
|
|
894
|
+
/**
|
|
895
|
+
* The corpus, keyed by id — a MERGE of the prose and example halves, not a
|
|
896
|
+
* concatenation (#1983).
|
|
897
|
+
*
|
|
898
|
+
* Concatenating them let one id name two different docs: `damage-type-routing`
|
|
899
|
+
* and `dm-oversight` each existed as a `docs/<id>.md` concept guide AND a
|
|
900
|
+
* `docs/examples/<id>.*` worked example, so the "stable packaged corpus id"
|
|
901
|
+
* every consumer keys on (`DocIndexEntry.rel`, `doc_paths`, `getAuthoringDoc`)
|
|
902
|
+
* silently resolved to whichever copy a caller happened to reach first.
|
|
903
|
+
*
|
|
904
|
+
* Merging is the right repair rather than renaming, because those two halves
|
|
905
|
+
* are not a name collision — they are one subject written twice on purpose,
|
|
906
|
+
* and each half explicitly links the other ("The concept guide is
|
|
907
|
+
* `dm-oversight.md`", "Companion to `damage-type-routing.toml`"). One id, one
|
|
908
|
+
* doc, carrying the example's `toml` so a caller can read the explanation and
|
|
909
|
+
* copy the manifest from a single hit.
|
|
910
|
+
*
|
|
911
|
+
* `body` stays BYTE-EQUAL to the concept `.md` — the walkthrough goes to its
|
|
912
|
+
* own field rather than being appended. That is not cosmetic: the ADR-0047 D-3
|
|
913
|
+
* single-source guard (`__tests__/corpus.test.ts`) proves every guide body
|
|
914
|
+
* against its packaged source precisely so a hand-edited const can never drift
|
|
915
|
+
* from the doc it claims to serve, and a merge that concatenated prose would
|
|
916
|
+
* have had to weaken it.
|
|
917
|
+
*
|
|
918
|
+
* An id with only one half keeps exactly its previous shape — a prose-only doc
|
|
919
|
+
* has no `toml`, an example-only doc is unchanged apart from gaining one.
|
|
920
|
+
*/
|
|
921
|
+
function mergeCorpus(): AuthoringDoc[] {
|
|
922
|
+
const byId = new Map(
|
|
923
|
+
composePublicDocCorpora([
|
|
924
|
+
PROSE_DOCS.map((doc) => ({ ...doc, body: proseBody(doc.id) })),
|
|
925
|
+
GENERATED_PATTERN_DOCS,
|
|
926
|
+
GENERATED_PACKAGE_GUIDES,
|
|
927
|
+
]).map((doc) => [doc.id, doc]),
|
|
928
|
+
);
|
|
929
|
+
for (const example of GENERATED_EXAMPLE_DOCS) {
|
|
930
|
+
const toml = GENERATED_EXAMPLES.find((ex) => ex.id === example.id);
|
|
931
|
+
const withToml: AuthoringDoc = {
|
|
932
|
+
...example,
|
|
933
|
+
...(toml === undefined
|
|
934
|
+
? {}
|
|
935
|
+
: { toml: toml.toml, expectedDiagnostics: toml.expectedDiagnostics }),
|
|
936
|
+
};
|
|
937
|
+
const prose = byId.get(example.id);
|
|
938
|
+
if (prose === undefined) {
|
|
939
|
+
byId.set(example.id, withToml);
|
|
940
|
+
continue;
|
|
941
|
+
}
|
|
942
|
+
byId.set(example.id, mergeAuthoringDocExample(prose, withToml));
|
|
943
|
+
}
|
|
944
|
+
return [...byId.values()];
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
const DOCS: AuthoringDoc[] = mergeCorpus();
|
|
948
|
+
|
|
949
|
+
/** Canonical concept identity/publication wins; example supplies its payload. */
|
|
950
|
+
export function mergeAuthoringDocExample(prose: AuthoringDoc, example: AuthoringDoc): AuthoringDoc {
|
|
951
|
+
if (prose.id !== example.id) throw new Error("cannot merge different document IDs");
|
|
952
|
+
return {
|
|
953
|
+
...example,
|
|
954
|
+
...prose,
|
|
955
|
+
tags: [...new Set([...prose.tags, ...example.tags])],
|
|
956
|
+
walkthrough: example.body,
|
|
957
|
+
};
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
export function isSupportedAuthoringDoc(doc: AuthoringDoc): boolean {
|
|
961
|
+
return !doc.publication || doc.publication.content_status === "implemented";
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
/** Package-owned corpora cannot silently replace another package's document. */
|
|
965
|
+
export function composePublicDocCorpora(
|
|
966
|
+
corpora: readonly (readonly AuthoringDoc[])[],
|
|
967
|
+
): AuthoringDoc[] {
|
|
968
|
+
const byId = new Map<string, AuthoringDoc>();
|
|
969
|
+
for (const corpus of corpora)
|
|
970
|
+
for (const doc of corpus) {
|
|
971
|
+
if (byId.has(doc.id)) throw new Error(`duplicate public document id "${doc.id}"`);
|
|
972
|
+
byId.set(doc.id, doc);
|
|
973
|
+
}
|
|
974
|
+
return [...byId.values()];
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
const EXAMPLES: AuthoringExample[] = GENERATED_EXAMPLES;
|
|
978
|
+
|
|
979
|
+
function terms(query: string): string[] {
|
|
980
|
+
return query
|
|
981
|
+
.toLowerCase()
|
|
982
|
+
.split(/[^a-z0-9_/-]+/)
|
|
983
|
+
.filter(Boolean);
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
function scoreText(queryTerms: string[], fields: string[]): number {
|
|
987
|
+
const haystack = fields.join(" ").toLowerCase();
|
|
988
|
+
return queryTerms.reduce((score, term) => score + (haystack.includes(term) ? 1 : 0), 0);
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
export function listAuthoringDocs(): AuthoringDoc[] {
|
|
992
|
+
return [...DOCS];
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
export function getAuthoringDoc(id: string): AuthoringDoc | undefined {
|
|
996
|
+
return DOCS.find((doc) => doc.id === id);
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
/** Resolve source-relative Markdown links into corpus IDs without IO. */
|
|
1000
|
+
export const DOC_LINK_LIMIT = 16;
|
|
1001
|
+
export const DOC_LINK_BYTES = 2000;
|
|
1002
|
+
|
|
1003
|
+
export function authoringDocMetadata(id: string, deliveredBody?: string): DocsMetadata | undefined {
|
|
1004
|
+
const doc = getAuthoringDoc(id);
|
|
1005
|
+
if (!doc) return undefined;
|
|
1006
|
+
const docSource = (entry: AuthoringDoc) =>
|
|
1007
|
+
entry.source_path ??
|
|
1008
|
+
`packages/spellkave-world-author/docs/${entry.kind === "example" ? `examples/${entry.id}.md` : authoringDocSourcePath(entry.id)}`;
|
|
1009
|
+
const source = docSource(doc);
|
|
1010
|
+
const directory = source.split("/").slice(0, -1);
|
|
1011
|
+
const links: NonNullable<DocsMetadata["links"]> = [];
|
|
1012
|
+
const seen = new Set<string>();
|
|
1013
|
+
let linksTotal = 0;
|
|
1014
|
+
let linkBytes = 2;
|
|
1015
|
+
for (const match of (deliveredBody ?? doc.body).matchAll(/\]\(([^\s)]+)\)/g)) {
|
|
1016
|
+
const href = match[1];
|
|
1017
|
+
if (!href) continue;
|
|
1018
|
+
if (seen.has(href)) continue;
|
|
1019
|
+
seen.add(href);
|
|
1020
|
+
if (/^[a-z][a-z0-9+.-]*:|^\//i.test(href)) continue;
|
|
1021
|
+
const [path, section] = href.split("#");
|
|
1022
|
+
const parts = [...directory];
|
|
1023
|
+
if (path)
|
|
1024
|
+
for (const part of path.split("/")) {
|
|
1025
|
+
if (part === "..") parts.pop();
|
|
1026
|
+
else if (part && part !== ".") parts.push(part);
|
|
1027
|
+
}
|
|
1028
|
+
const target = path ? DOCS.find((candidate) => docSource(candidate) === parts.join("/")) : doc;
|
|
1029
|
+
if (target) {
|
|
1030
|
+
linksTotal += 1;
|
|
1031
|
+
const link = { href, document_id: target.id, ...(section ? { section } : {}) };
|
|
1032
|
+
// UTF-8 byte budget, portable to browser builds without a Node import.
|
|
1033
|
+
const bytes = new TextEncoder().encode(JSON.stringify(link)).length + 1;
|
|
1034
|
+
if (links.length < DOC_LINK_LIMIT && linkBytes + bytes <= DOC_LINK_BYTES) {
|
|
1035
|
+
links.push(link);
|
|
1036
|
+
linkBytes += bytes;
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
return {
|
|
1041
|
+
document_id: id,
|
|
1042
|
+
corpus_revision: authoringCorpusRevision,
|
|
1043
|
+
content_status: doc.publication?.content_status ?? "implemented",
|
|
1044
|
+
// Surface claims are authored publication facts, not inferred from generation.
|
|
1045
|
+
supported_surfaces: doc.publication?.supported_surfaces ?? ["cli", "local-mcp"],
|
|
1046
|
+
...(doc.publication?.feature_prerequisites
|
|
1047
|
+
? { feature_prerequisites: doc.publication.feature_prerequisites }
|
|
1048
|
+
: {}),
|
|
1049
|
+
server_revision: "unknown",
|
|
1050
|
+
compatibility: "unknown",
|
|
1051
|
+
...(links.length ? { links } : {}),
|
|
1052
|
+
...(linksTotal ? { links_total: linksTotal } : {}),
|
|
1053
|
+
...(linksTotal > links.length
|
|
1054
|
+
? {
|
|
1055
|
+
links_truncated: true,
|
|
1056
|
+
links_hint:
|
|
1057
|
+
"Retrieve a section by heading to resolve that section's links within the same budget.",
|
|
1058
|
+
}
|
|
1059
|
+
: {}),
|
|
1060
|
+
};
|
|
1061
|
+
}
|
|
1062
|
+
|
|
1063
|
+
export function queryAuthoringDocs(query: string, limit = 5): CorpusQueryResult<AuthoringDoc>[] {
|
|
1064
|
+
const queryTerms = terms(query);
|
|
1065
|
+
return DOCS.filter(isSupportedAuthoringDoc)
|
|
1066
|
+
.map((doc) => {
|
|
1067
|
+
const base = scoreText(queryTerms, [
|
|
1068
|
+
doc.id,
|
|
1069
|
+
doc.title,
|
|
1070
|
+
doc.kind,
|
|
1071
|
+
doc.summary,
|
|
1072
|
+
doc.tags.join(" "),
|
|
1073
|
+
doc.body,
|
|
1074
|
+
]);
|
|
1075
|
+
// Prefer repair entries when scores are otherwise comparable so symptom
|
|
1076
|
+
// queries surface a short fix sheet ahead of a long guide body.
|
|
1077
|
+
let score = base;
|
|
1078
|
+
if (base > 0 && doc.kind === "repair") score += 0.5;
|
|
1079
|
+
// Exact tag / id hits beat incidental body mentions (symptom search).
|
|
1080
|
+
const tagHay = new Set([doc.id, ...doc.tags.map((tag) => tag.toLowerCase())]);
|
|
1081
|
+
for (const term of queryTerms) {
|
|
1082
|
+
if (
|
|
1083
|
+
tagHay.has(term) ||
|
|
1084
|
+
tagHay.has(term.replace(/_/g, "-")) ||
|
|
1085
|
+
tagHay.has(term.replace(/-/g, "_"))
|
|
1086
|
+
) {
|
|
1087
|
+
score += 2;
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
return { item: doc, score };
|
|
1091
|
+
})
|
|
1092
|
+
.filter((result) => result.score > 0)
|
|
1093
|
+
.sort((a, b) => b.score - a.score || a.item.id.localeCompare(b.item.id))
|
|
1094
|
+
.slice(0, limit);
|
|
1095
|
+
}
|
|
1096
|
+
|
|
1097
|
+
/** Heading text → github-like anchor slug. */
|
|
1098
|
+
export function authoringHeadingAnchor(heading: string): string {
|
|
1099
|
+
return heading
|
|
1100
|
+
.trim()
|
|
1101
|
+
.toLowerCase()
|
|
1102
|
+
.replace(/[`*_~]/g, "")
|
|
1103
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
1104
|
+
.replace(/^-+|-+$/g, "");
|
|
1105
|
+
}
|
|
1106
|
+
|
|
1107
|
+
export interface AuthoringDocSection {
|
|
1108
|
+
heading: string;
|
|
1109
|
+
anchor: string;
|
|
1110
|
+
body: string;
|
|
1111
|
+
level: number;
|
|
1112
|
+
}
|
|
1113
|
+
|
|
1114
|
+
/** Split a markdown body into heading sections (ATX #..###### only). */
|
|
1115
|
+
export function listAuthoringDocSections(body: string): AuthoringDocSection[] {
|
|
1116
|
+
const lines = body.split("\n");
|
|
1117
|
+
const sections: AuthoringDocSection[] = [];
|
|
1118
|
+
let current: AuthoringDocSection | undefined;
|
|
1119
|
+
for (const line of lines) {
|
|
1120
|
+
const match = /^(#{1,6})\s+(.+?)\s*$/.exec(line);
|
|
1121
|
+
if (match) {
|
|
1122
|
+
if (current) sections.push(current);
|
|
1123
|
+
const heading = match[2] ?? "";
|
|
1124
|
+
current = {
|
|
1125
|
+
heading,
|
|
1126
|
+
anchor: authoringHeadingAnchor(heading),
|
|
1127
|
+
level: (match[1] ?? "#").length,
|
|
1128
|
+
body: `${line}\n`,
|
|
1129
|
+
};
|
|
1130
|
+
continue;
|
|
1131
|
+
}
|
|
1132
|
+
if (current) current.body += `${line}\n`;
|
|
1133
|
+
}
|
|
1134
|
+
if (current) sections.push(current);
|
|
1135
|
+
return sections;
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
/**
|
|
1139
|
+
* Return one section of a doc body by heading text or anchor (first match).
|
|
1140
|
+
* Matching is case-insensitive; heading may be a substring of the full heading.
|
|
1141
|
+
*/
|
|
1142
|
+
export function extractAuthoringDocSection(
|
|
1143
|
+
body: string,
|
|
1144
|
+
section: string,
|
|
1145
|
+
): AuthoringDocSection | undefined {
|
|
1146
|
+
const needle = section.trim().toLowerCase();
|
|
1147
|
+
const needleAnchor = authoringHeadingAnchor(section);
|
|
1148
|
+
if (!needle) return undefined;
|
|
1149
|
+
const sections = listAuthoringDocSections(body);
|
|
1150
|
+
return (
|
|
1151
|
+
sections.find(
|
|
1152
|
+
(s) =>
|
|
1153
|
+
s.heading.toLowerCase() === needle ||
|
|
1154
|
+
s.anchor === needleAnchor ||
|
|
1155
|
+
s.heading.toLowerCase().includes(needle),
|
|
1156
|
+
) ?? undefined
|
|
1157
|
+
);
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
export function listAuthoringExamples(): AuthoringExample[] {
|
|
1161
|
+
return [...EXAMPLES];
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
export function getAuthoringExample(id: string): AuthoringExample | undefined {
|
|
1165
|
+
return EXAMPLES.find((example) => example.id === id);
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
export function queryAuthoringExamples(
|
|
1169
|
+
query: string,
|
|
1170
|
+
limit = 5,
|
|
1171
|
+
): CorpusQueryResult<AuthoringExample>[] {
|
|
1172
|
+
const queryTerms = terms(query);
|
|
1173
|
+
return EXAMPLES.map((example) => ({
|
|
1174
|
+
item: example,
|
|
1175
|
+
score: scoreText(queryTerms, [example.id, example.intent, example.tags.join(" ")]),
|
|
1176
|
+
}))
|
|
1177
|
+
.filter((result) => result.score > 0)
|
|
1178
|
+
.sort((a, b) => b.score - a.score || a.item.id.localeCompare(b.item.id))
|
|
1179
|
+
.slice(0, limit);
|
|
1180
|
+
}
|