@miadi/episodic-memory-schema 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/attention.d.ts +55 -0
- package/dist/attention.d.ts.map +1 -0
- package/dist/attention.js +73 -0
- package/dist/attention.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/story-library-manifest.d.ts +22 -1
- package/dist/story-library-manifest.d.ts.map +1 -1
- package/dist/story-library-manifest.js +40 -2
- package/dist/story-library-manifest.js.map +1 -1
- package/package.json +9 -9
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The chronicle ATTENTION contract — what needs a human, as data.
|
|
3
|
+
*
|
|
4
|
+
* William's requirement (2026-08-15, ep332): agents store "what needs
|
|
5
|
+
* attention from a human" WITHIN the chronicle, and surfaces render it — he
|
|
6
|
+
* opens no terminal and no markdown file. The store is `attention.json` at an
|
|
7
|
+
* episode folder's root; every consumer (the Miadi /chronicle app, the
|
|
8
|
+
* passages CLI verbs, inquiry-weave's wheel projection, forgewright's
|
|
9
|
+
* chronicle view) types against THIS module, so the shape has one owner and
|
|
10
|
+
* cannot fork into drifting copies.
|
|
11
|
+
*
|
|
12
|
+
* This module is pure — no fs, no fetch — so browser bundles and CJS CLIs can
|
|
13
|
+
* both consume it. Reading files and walking folders stays with the consumer.
|
|
14
|
+
*/
|
|
15
|
+
/** The filename, at an episode folder's root. */
|
|
16
|
+
export declare const ATTENTION_FILE = "attention.json";
|
|
17
|
+
/** Stamped into wheel projections so a reader knows which shape it holds. */
|
|
18
|
+
export declare const ATTENTION_SCHEMA_VERSION = "chronicle.attention.v1";
|
|
19
|
+
export interface AttentionItem {
|
|
20
|
+
/** Stable per-episode identity, e.g. "d1-consent-render". */
|
|
21
|
+
id: string;
|
|
22
|
+
/** One line: what is asked of the human. */
|
|
23
|
+
question: string;
|
|
24
|
+
/** What answering it releases. */
|
|
25
|
+
unlocks?: string;
|
|
26
|
+
/** ISO date the question was raised. */
|
|
27
|
+
asked?: string;
|
|
28
|
+
state: "open" | "answered";
|
|
29
|
+
answer?: string | null;
|
|
30
|
+
answered_at?: string | null;
|
|
31
|
+
/** Where the full record lives — paths, owner/repo#n refs, chart ids. */
|
|
32
|
+
depth?: string[];
|
|
33
|
+
}
|
|
34
|
+
export interface AttentionStore {
|
|
35
|
+
attention: 1;
|
|
36
|
+
items: AttentionItem[];
|
|
37
|
+
}
|
|
38
|
+
export interface ParsedAttentionStore {
|
|
39
|
+
items: AttentionItem[];
|
|
40
|
+
/** Set when the raw value could not be read as a store — surfaced, never
|
|
41
|
+
* swallowed, so an empty answer stays distinguishable from a failed look. */
|
|
42
|
+
parseError?: string;
|
|
43
|
+
}
|
|
44
|
+
/** Tolerant per-item reader: id + question are required, the rest optional. */
|
|
45
|
+
export declare function toAttentionItem(raw: unknown): AttentionItem | null;
|
|
46
|
+
/**
|
|
47
|
+
* Parse a raw `attention.json` payload (string or already-parsed value).
|
|
48
|
+
* Malformed input yields `{ items: [], parseError }` — the error travels with
|
|
49
|
+
* the result instead of throwing, matching the render-path tolerance the
|
|
50
|
+
* Miadi app shipped in jgwill/Miadi#615.
|
|
51
|
+
*/
|
|
52
|
+
export declare function parseAttentionStore(raw: unknown): ParsedAttentionStore;
|
|
53
|
+
/** Serialize a store canonically (stable field order, trailing newline). */
|
|
54
|
+
export declare function serializeAttentionStore(items: AttentionItem[]): string;
|
|
55
|
+
//# sourceMappingURL=attention.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attention.d.ts","sourceRoot":"","sources":["../src/attention.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,iDAAiD;AACjD,eAAO,MAAM,cAAc,mBAAmB,CAAA;AAE9C,6EAA6E;AAC7E,eAAO,MAAM,wBAAwB,2BAA2B,CAAA;AAEhE,MAAM,WAAW,aAAa;IAC5B,6DAA6D;IAC7D,EAAE,EAAE,MAAM,CAAA;IACV,4CAA4C;IAC5C,QAAQ,EAAE,MAAM,CAAA;IAChB,kCAAkC;IAClC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,wCAAwC;IACxC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,MAAM,GAAG,UAAU,CAAA;IAC1B,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,yEAAyE;IACzE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,CAAC,CAAA;IACZ,KAAK,EAAE,aAAa,EAAE,CAAA;CACvB;AAED,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,aAAa,EAAE,CAAA;IACtB;kFAC8E;IAC9E,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAMD,+EAA+E;AAC/E,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,aAAa,GAAG,IAAI,CAkBlE;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,oBAAoB,CAetE;AAED,4EAA4E;AAC5E,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,aAAa,EAAE,GAAG,MAAM,CAGtE"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The chronicle ATTENTION contract — what needs a human, as data.
|
|
3
|
+
*
|
|
4
|
+
* William's requirement (2026-08-15, ep332): agents store "what needs
|
|
5
|
+
* attention from a human" WITHIN the chronicle, and surfaces render it — he
|
|
6
|
+
* opens no terminal and no markdown file. The store is `attention.json` at an
|
|
7
|
+
* episode folder's root; every consumer (the Miadi /chronicle app, the
|
|
8
|
+
* passages CLI verbs, inquiry-weave's wheel projection, forgewright's
|
|
9
|
+
* chronicle view) types against THIS module, so the shape has one owner and
|
|
10
|
+
* cannot fork into drifting copies.
|
|
11
|
+
*
|
|
12
|
+
* This module is pure — no fs, no fetch — so browser bundles and CJS CLIs can
|
|
13
|
+
* both consume it. Reading files and walking folders stays with the consumer.
|
|
14
|
+
*/
|
|
15
|
+
/** The filename, at an episode folder's root. */
|
|
16
|
+
export const ATTENTION_FILE = "attention.json";
|
|
17
|
+
/** Stamped into wheel projections so a reader knows which shape it holds. */
|
|
18
|
+
export const ATTENTION_SCHEMA_VERSION = "chronicle.attention.v1";
|
|
19
|
+
function str(v) {
|
|
20
|
+
return typeof v === "string" && v.trim() ? v : undefined;
|
|
21
|
+
}
|
|
22
|
+
/** Tolerant per-item reader: id + question are required, the rest optional. */
|
|
23
|
+
export function toAttentionItem(raw) {
|
|
24
|
+
if (typeof raw !== "object" || raw === null)
|
|
25
|
+
return null;
|
|
26
|
+
const r = raw;
|
|
27
|
+
const id = str(r.id);
|
|
28
|
+
const question = str(r.question);
|
|
29
|
+
if (!id || !question)
|
|
30
|
+
return null;
|
|
31
|
+
return {
|
|
32
|
+
id,
|
|
33
|
+
question,
|
|
34
|
+
unlocks: str(r.unlocks),
|
|
35
|
+
asked: str(r.asked),
|
|
36
|
+
state: r.state === "answered" ? "answered" : "open",
|
|
37
|
+
answer: str(r.answer) ?? null,
|
|
38
|
+
answered_at: str(r.answered_at) ?? null,
|
|
39
|
+
depth: Array.isArray(r.depth)
|
|
40
|
+
? r.depth.filter((d) => typeof d === "string")
|
|
41
|
+
: undefined,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Parse a raw `attention.json` payload (string or already-parsed value).
|
|
46
|
+
* Malformed input yields `{ items: [], parseError }` — the error travels with
|
|
47
|
+
* the result instead of throwing, matching the render-path tolerance the
|
|
48
|
+
* Miadi app shipped in jgwill/Miadi#615.
|
|
49
|
+
*/
|
|
50
|
+
export function parseAttentionStore(raw) {
|
|
51
|
+
let value = raw;
|
|
52
|
+
if (typeof raw === "string") {
|
|
53
|
+
try {
|
|
54
|
+
value = JSON.parse(raw);
|
|
55
|
+
}
|
|
56
|
+
catch (e) {
|
|
57
|
+
return { items: [], parseError: e instanceof Error ? e.message : String(e) };
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (typeof value !== "object" || value === null) {
|
|
61
|
+
return { items: [], parseError: "attention store is not an object" };
|
|
62
|
+
}
|
|
63
|
+
const items = value.items;
|
|
64
|
+
if (!Array.isArray(items))
|
|
65
|
+
return { items: [] };
|
|
66
|
+
return { items: items.map(toAttentionItem).filter((i) => i !== null) };
|
|
67
|
+
}
|
|
68
|
+
/** Serialize a store canonically (stable field order, trailing newline). */
|
|
69
|
+
export function serializeAttentionStore(items) {
|
|
70
|
+
const store = { attention: 1, items };
|
|
71
|
+
return JSON.stringify(store, null, 2) + "\n";
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=attention.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attention.js","sourceRoot":"","sources":["../src/attention.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,iDAAiD;AACjD,MAAM,CAAC,MAAM,cAAc,GAAG,gBAAgB,CAAA;AAE9C,6EAA6E;AAC7E,MAAM,CAAC,MAAM,wBAAwB,GAAG,wBAAwB,CAAA;AA8BhE,SAAS,GAAG,CAAC,CAAU;IACrB,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;AAC1D,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,eAAe,CAAC,GAAY;IAC1C,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI;QAAE,OAAO,IAAI,CAAA;IACxD,MAAM,CAAC,GAAG,GAA8B,CAAA;IACxC,MAAM,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,C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AI,KAAK,KAAK,IAAI,EAAE,CAAC;QAChD,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,UAAU,EAAE,kCAAkC,EAAE,CAAA;IACtE,CAAC;IACD,MAAM,KAAK,GAAI,KAA+B,CAAC,KAAK,CAAA;IACpD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,CAAA;IAC/C,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAsB,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,EAAE,CAAA;AAC5F,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,uBAAuB,CAAC,KAAsB;IAC5D,MAAM,KAAK,GAAmB,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,CAAA;IACrD,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAA;AAC9C,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -19,4 +19,10 @@ export { inferArtifactKind, extractEpisodeNumber, validateRelativePath, tryValid
|
|
|
19
19
|
*/
|
|
20
20
|
export { stableArtifactId, tryStableArtifactId, isStableArtifactId, captureStableKey, } from "./adapters/common.js";
|
|
21
21
|
export type { StableArtifactIdInput } from "./adapters/common.js";
|
|
22
|
+
/**
|
|
23
|
+
* The ATTENTION contract — what needs a human, as data (ep332,
|
|
24
|
+
* jgwill/Miadi#615). One owner for the shape every surface renders.
|
|
25
|
+
*/
|
|
26
|
+
export { ATTENTION_FILE, ATTENTION_SCHEMA_VERSION, toAttentionItem, parseAttentionStore, serializeAttentionStore, } from "./attention.js";
|
|
27
|
+
export type { AttentionItem, AttentionStore, ParsedAttentionStore, } from "./attention.js";
|
|
22
28
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,kBAAkB,CAAA;AAChC,cAAc,yBAAyB,CAAA;AACvC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,2BAA2B,CAAA;AACzC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,yBAAyB,CAAA;AACvC,cAAc,+BAA+B,CAAA;AAE7C;;;;GAIG;AACH,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACb,YAAY,GACb,MAAM,sBAAsB,CAAA;AAE7B;;;GAGG;AACH,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,sBAAsB,CAAA;AAC7B,YAAY,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,kBAAkB,CAAA;AAChC,cAAc,yBAAyB,CAAA;AACvC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,2BAA2B,CAAA;AACzC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,yBAAyB,CAAA;AACvC,cAAc,+BAA+B,CAAA;AAE7C;;;;GAIG;AACH,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACb,YAAY,GACb,MAAM,sBAAsB,CAAA;AAE7B;;;GAGG;AACH,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,sBAAsB,CAAA;AAC7B,YAAY,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAEjE;;;GAGG;AACH,OAAO,EACL,cAAc,EACd,wBAAwB,EACxB,eAAe,EACf,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,gBAAgB,CAAA;AACvB,YAAY,EACV,aAAa,EACb,cAAc,EACd,oBAAoB,GACrB,MAAM,gBAAgB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -18,4 +18,9 @@ export { inferArtifactKind, extractEpisodeNumber, validateRelativePath, tryValid
|
|
|
18
18
|
* before any manifest gives it one. Document-derived ids are unchanged.
|
|
19
19
|
*/
|
|
20
20
|
export { stableArtifactId, tryStableArtifactId, isStableArtifactId, captureStableKey, } from "./adapters/common.js";
|
|
21
|
+
/**
|
|
22
|
+
* The ATTENTION contract — what needs a human, as data (ep332,
|
|
23
|
+
* jgwill/Miadi#615). One owner for the shape every surface renders.
|
|
24
|
+
*/
|
|
25
|
+
export { ATTENTION_FILE, ATTENTION_SCHEMA_VERSION, toAttentionItem, parseAttentionStore, serializeAttentionStore, } from "./attention.js";
|
|
21
26
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,kBAAkB,CAAA;AAChC,cAAc,yBAAyB,CAAA;AACvC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,2BAA2B,CAAA;AACzC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,yBAAyB,CAAA;AACvC,cAAc,+BAA+B,CAAA;AAE7C;;;;GAIG;AACH,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACb,YAAY,GACb,MAAM,sBAAsB,CAAA;AAE7B;;;GAGG;AACH,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,sBAAsB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,kBAAkB,CAAA;AAChC,cAAc,yBAAyB,CAAA;AACvC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,2BAA2B,CAAA;AACzC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,yBAAyB,CAAA;AACvC,cAAc,+BAA+B,CAAA;AAE7C;;;;GAIG;AACH,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,uBAAuB,EACvB,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACb,YAAY,GACb,MAAM,sBAAsB,CAAA;AAE7B;;;GAGG;AACH,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,sBAAsB,CAAA;AAG7B;;;GAGG;AACH,OAAO,EACL,cAAc,EACd,wBAAwB,EACxB,eAAe,EACf,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,gBAAgB,CAAA"}
|
|
@@ -10,6 +10,12 @@
|
|
|
10
10
|
* and validates what it is handed so the app and forgewright never fork the
|
|
11
11
|
* read-side.
|
|
12
12
|
*
|
|
13
|
+
* OWNERSHIP (jgwill/Miadi#592, packages/CLAUDE.md): this module is the *declaration*
|
|
14
|
+
* of the chronicle→book edge. `@miadi/inquiry-weave` owns its *enumeration* and never
|
|
15
|
+
* authors a story; `packages/passages` owns the *derivation* of a book from a vessel,
|
|
16
|
+
* as a read-only projection of the chronicle; `app/chronicle` renders and serves.
|
|
17
|
+
* No new package is created for this edge.
|
|
18
|
+
*
|
|
13
19
|
* A story maps to an episode by the episode number parsed from its name
|
|
14
20
|
* (`Episode_040___…`, `Episode-044-…`). Stories with no parseable episode number
|
|
15
21
|
* (a pilot title like `The_Room_Lent_It_Ears.html`, or `dummy1.html`) are still
|
|
@@ -64,6 +70,14 @@ export interface ObserveStoryLibraryOptions {
|
|
|
64
70
|
export declare function observeStoryLibrary(inputs: ReadonlyArray<string | StoryLibraryEntryInput>, options?: ObserveStoryLibraryOptions): StoryLibraryManifest;
|
|
65
71
|
/** Index the library's stories by the episode number they declare. */
|
|
66
72
|
export declare function indexStoriesByEpisode(manifest: StoryLibraryManifest): Map<number, StoryManifestEntry[]>;
|
|
73
|
+
export interface LinkStoryFormsOptions {
|
|
74
|
+
/**
|
|
75
|
+
* Sink for link-time diagnostics (`story-library.episode-link-ambiguous`).
|
|
76
|
+
* Linking stays fail-open either way — the shelf is a garnish, never a gate —
|
|
77
|
+
* so an ambiguity refuses the link and reports; it never throws.
|
|
78
|
+
*/
|
|
79
|
+
diagnostics?: CompatibilityDiagnostic[];
|
|
80
|
+
}
|
|
67
81
|
/**
|
|
68
82
|
* Non-destructively attach each episode's book form(s) to its chronicle entry.
|
|
69
83
|
*
|
|
@@ -71,6 +85,13 @@ export declare function indexStoriesByEpisode(manifest: StoryLibraryManifest): M
|
|
|
71
85
|
* published story gains a `stories` array — the seam the `/chronicle` surface
|
|
72
86
|
* uses to link an episode to its interactive-book form. Episodes without a
|
|
73
87
|
* published story are returned unchanged (no `stories` field).
|
|
88
|
+
*
|
|
89
|
+
* Episode numbers collide in the chronicle — the folder name is the true key
|
|
90
|
+
* (011, 016, 043, 078, 083, 098, 120 each name two folders today). A story
|
|
91
|
+
* number owned by MORE THAN ONE episode folder is therefore ambiguous: the
|
|
92
|
+
* story is linked to NONE of them — never a silent first match — and a
|
|
93
|
+
* `story-library.episode-link-ambiguous` warning naming every candidate folder
|
|
94
|
+
* is pushed to `options.diagnostics` when a sink is supplied.
|
|
74
95
|
*/
|
|
75
|
-
export declare function linkStoryForms(episodes: readonly EpisodeManifestEntry[], library: StoryLibraryManifest): EpisodeManifestEntry[];
|
|
96
|
+
export declare function linkStoryForms(episodes: readonly EpisodeManifestEntry[], library: StoryLibraryManifest, options?: LinkStoryFormsOptions): EpisodeManifestEntry[];
|
|
76
97
|
//# sourceMappingURL=story-library-manifest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"story-library-manifest.d.ts","sourceRoot":"","sources":["../src/story-library-manifest.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"story-library-manifest.d.ts","sourceRoot":"","sources":["../src/story-library-manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAA;AAEzF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAA;AAEnE,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,WAAW,GAAG,OAAO,CAAA;AAEtD,kEAAkE;AAClE,MAAM,WAAW,kBAAkB;IACjC,iDAAiD;IACjD,IAAI,EAAE,MAAM,CAAA;IACZ,iCAAiC;IACjC,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE,SAAS,CAAA;IACf,yCAAyC;IACzC,YAAY,EAAE,MAAM,CAAA;IACpB,yDAAyD;IACzD,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,6EAA6E;IAC7E,kBAAkB,EAAE,wBAAwB,EAAE,CAAA;IAC9C,6CAA6C;IAC7C,KAAK,EAAE,MAAM,CAAA;CACd;AAED,uEAAuE;AACvE,MAAM,WAAW,sBAAsB;IACrC,8EAA8E;IAC9E,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,GAAG,WAAW,CAAA;CAC5B;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,eAAe,CAAA;IACrB,6EAA6E;IAC7E,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,EAAE,kBAAkB,EAAE,CAAA;IAC7B,WAAW,EAAE,uBAAuB,EAAE,CAAA;CACvC;AAED,MAAM,WAAW,0BAA0B;IACzC,iEAAiE;IACjE,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,8EAA8E;IAC9E,GAAG,CAAC,EAAE,MAAM,IAAI,CAAA;CACjB;AAgCD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,aAAa,CAAC,MAAM,GAAG,sBAAsB,CAAC,EACtD,OAAO,GAAE,0BAA+B,GACvC,oBAAoB,CA6DtB;AAED,sEAAsE;AACtE,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,oBAAoB,GAC7B,GAAG,CAAC,MAAM,EAAE,kBAAkB,EAAE,CAAC,CASnC;AAED,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,WAAW,CAAC,EAAE,uBAAuB,EAAE,CAAA;CACxC;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,SAAS,oBAAoB,EAAE,EACzC,OAAO,EAAE,oBAAoB,EAC7B,OAAO,GAAE,qBAA0B,GAClC,oBAAoB,EAAE,CAkCxB"}
|
|
@@ -10,6 +10,12 @@
|
|
|
10
10
|
* and validates what it is handed so the app and forgewright never fork the
|
|
11
11
|
* read-side.
|
|
12
12
|
*
|
|
13
|
+
* OWNERSHIP (jgwill/Miadi#592, packages/CLAUDE.md): this module is the *declaration*
|
|
14
|
+
* of the chronicle→book edge. `@miadi/inquiry-weave` owns its *enumeration* and never
|
|
15
|
+
* authors a story; `packages/passages` owns the *derivation* of a book from a vessel,
|
|
16
|
+
* as a read-only projection of the chronicle; `app/chronicle` renders and serves.
|
|
17
|
+
* No new package is created for this edge.
|
|
18
|
+
*
|
|
13
19
|
* A story maps to an episode by the episode number parsed from its name
|
|
14
20
|
* (`Episode_040___…`, `Episode-044-…`). Stories with no parseable episode number
|
|
15
21
|
* (a pilot title like `The_Room_Lent_It_Ears.html`, or `dummy1.html`) are still
|
|
@@ -121,11 +127,43 @@ export function indexStoriesByEpisode(manifest) {
|
|
|
121
127
|
* published story gains a `stories` array — the seam the `/chronicle` surface
|
|
122
128
|
* uses to link an episode to its interactive-book form. Episodes without a
|
|
123
129
|
* published story are returned unchanged (no `stories` field).
|
|
130
|
+
*
|
|
131
|
+
* Episode numbers collide in the chronicle — the folder name is the true key
|
|
132
|
+
* (011, 016, 043, 078, 083, 098, 120 each name two folders today). A story
|
|
133
|
+
* number owned by MORE THAN ONE episode folder is therefore ambiguous: the
|
|
134
|
+
* story is linked to NONE of them — never a silent first match — and a
|
|
135
|
+
* `story-library.episode-link-ambiguous` warning naming every candidate folder
|
|
136
|
+
* is pushed to `options.diagnostics` when a sink is supplied.
|
|
124
137
|
*/
|
|
125
|
-
export function linkStoryForms(episodes, library) {
|
|
138
|
+
export function linkStoryForms(episodes, library, options = {}) {
|
|
126
139
|
const byEpisode = indexStoriesByEpisode(library);
|
|
127
|
-
|
|
140
|
+
const foldersByNumber = new Map();
|
|
141
|
+
for (const episode of episodes) {
|
|
128
142
|
if (episode.number === undefined)
|
|
143
|
+
continue;
|
|
144
|
+
const folders = foldersByNumber.get(episode.number) ?? [];
|
|
145
|
+
folders.push(episode.name);
|
|
146
|
+
foldersByNumber.set(episode.number, folders);
|
|
147
|
+
}
|
|
148
|
+
const ambiguous = new Set();
|
|
149
|
+
for (const [number, folders] of foldersByNumber) {
|
|
150
|
+
const stories = byEpisode.get(number);
|
|
151
|
+
if (folders.length < 2 || !stories || stories.length === 0)
|
|
152
|
+
continue;
|
|
153
|
+
ambiguous.add(number);
|
|
154
|
+
if (options.diagnostics) {
|
|
155
|
+
for (const story of stories) {
|
|
156
|
+
options.diagnostics.push({
|
|
157
|
+
level: "warning",
|
|
158
|
+
code: "story-library.episode-link-ambiguous",
|
|
159
|
+
message: `story carries episode number ${number}, which ${folders.length} episode folders share (${folders.join(", ")}); the story is linked to none of them — the folder name is the key, and a first match would be silent`,
|
|
160
|
+
path: story.relativePath,
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
return episodes.map((episode) => {
|
|
166
|
+
if (episode.number === undefined || ambiguous.has(episode.number))
|
|
129
167
|
return episode;
|
|
130
168
|
const matched = byEpisode.get(episode.number);
|
|
131
169
|
if (!matched || matched.length === 0)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"story-library-manifest.js","sourceRoot":"","sources":["../src/story-library-manifest.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"story-library-manifest.js","sourceRoot":"","sources":["../src/story-library-manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AA6C3D,MAAM,YAAY,GAAG,WAAW,CAAA;AAEhC,SAAS,cAAc,CAAC,IAAY;IAClC,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAA;AACrC,CAAC;AAED,SAAS,UAAU,CAAC,IAAY;IAC9B,OAAO,cAAc,CAAC,IAAI,CAAC;SACxB,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC;SACtB,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC;SACpB,IAAI,EAAE,CAAA;AACX,CAAC;AAED,SAAS,oBAAoB,CAAC,IAAY,EAAE,YAAoB;IAI9D,MAAM,UAAU,GAA+B,EAAE,CAAA;IACjD,MAAM,IAAI,GAAG,cAAc,CAAC,IAAI,CAAC,CAAA;IACjC,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC;QAAE,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;IAEnE,MAAM,MAAM,GAAG,oBAAoB,CAAC,IAAI,CAAC,CAAA;IACzC,MAAM,aAAa,GAAG,MAAM,KAAK,SAAS,CA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
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "TypeScript types and JSON Schema for episodic memory — the durable session-to-session memory layer in the Miadi orchestration kit. Narrative layer is NCP-aligned; provenance layer is W3C PROV-DM and OAIS-informed.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"miadi",
|
|
@@ -27,7 +27,8 @@
|
|
|
27
27
|
"exports": {
|
|
28
28
|
".": {
|
|
29
29
|
"types": "./dist/index.d.ts",
|
|
30
|
-
"import": "./dist/index.js"
|
|
30
|
+
"import": "./dist/index.js",
|
|
31
|
+
"default": "./dist/index.js"
|
|
31
32
|
},
|
|
32
33
|
"./schema": "./schema/episodic-memory.schema.json",
|
|
33
34
|
"./package.json": "./package.json"
|
|
@@ -39,16 +40,15 @@
|
|
|
39
40
|
"README.md",
|
|
40
41
|
"LICENSE"
|
|
41
42
|
],
|
|
42
|
-
"scripts": {
|
|
43
|
-
"build": "tsc",
|
|
44
|
-
"type-check": "tsc --noEmit",
|
|
45
|
-
"test": "npm run build && node --test test/*.test.mjs",
|
|
46
|
-
"prepublishOnly": "npm run build"
|
|
47
|
-
},
|
|
48
43
|
"devDependencies": {
|
|
49
44
|
"typescript": "^5.4.0"
|
|
50
45
|
},
|
|
51
46
|
"publishConfig": {
|
|
52
47
|
"access": "public"
|
|
48
|
+
},
|
|
49
|
+
"scripts": {
|
|
50
|
+
"build": "tsc",
|
|
51
|
+
"type-check": "tsc --noEmit",
|
|
52
|
+
"test": "npm run build && node --test test/*.test.mjs"
|
|
53
53
|
}
|
|
54
|
-
}
|
|
54
|
+
}
|