@miadi/episodic-memory-schema 0.5.1 → 0.6.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/dist/adapters/common.d.ts +37 -1
- package/dist/adapters/common.d.ts.map +1 -1
- package/dist/adapters/common.js +66 -0
- package/dist/adapters/common.js.map +1 -1
- 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/observation.d.ts +185 -1
- package/dist/observation.d.ts.map +1 -1
- package/dist/observation.js +96 -1
- package/dist/observation.js.map +1 -1
- package/package.json +8 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ArtifactKind, EpisodeSourceFormat } from "../observation.js";
|
|
1
|
+
import type { ArtifactKind, CaptureProvenance, EpisodeSourceFormat } from "../observation.js";
|
|
2
2
|
export type JsonRecord = Record<string, unknown>;
|
|
3
3
|
export declare function isRecord(value: unknown): value is JsonRecord;
|
|
4
4
|
export declare function cloneValue(value: unknown): unknown;
|
|
@@ -6,6 +6,42 @@ export declare function cloneRecordExcept(input: JsonRecord, excluded: readonly
|
|
|
6
6
|
export declare function validateRelativePath(value: string): string;
|
|
7
7
|
export declare function tryValidateRelativePath(value: string): string | undefined;
|
|
8
8
|
export declare function observationId(format: EpisodeSourceFormat, relativePath: string): string;
|
|
9
|
+
export interface StableArtifactIdInput {
|
|
10
|
+
kind: ArtifactKind;
|
|
11
|
+
/**
|
|
12
|
+
* A key belonging to the artifact itself — a content hash is ideal. Supplied
|
|
13
|
+
* by the caller because hashing is I/O, and this package does no I/O.
|
|
14
|
+
*/
|
|
15
|
+
stableKey?: string;
|
|
16
|
+
/** Used when no `stableKey` is given: the device and the instant it began. */
|
|
17
|
+
capture?: CaptureProvenance;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The capture identity of a take: which device, and which instant it began.
|
|
21
|
+
*
|
|
22
|
+
* One device cannot start two recordings in the same second — the recording
|
|
23
|
+
* spec refuses a second start while one is active — so this pair identifies a
|
|
24
|
+
* take without consulting the file. Returns undefined when either half is
|
|
25
|
+
* missing, because half an identity is not a weaker identity, it is none.
|
|
26
|
+
*/
|
|
27
|
+
export declare function captureStableKey(capture: CaptureProvenance): string | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* An artifact id derived from the artifact's own properties.
|
|
30
|
+
*
|
|
31
|
+
* Adapters mint ids from the containing document's path, which means an
|
|
32
|
+
* artifact has no identity until some manifest names it — a recording that
|
|
33
|
+
* exists on a device is nameless until it is written into a manifest, and the
|
|
34
|
+
* same take referenced from two manifests becomes two ids. This derivation
|
|
35
|
+
* gives an artifact an identity it carries on its own, before and independent of
|
|
36
|
+
* any document.
|
|
37
|
+
*
|
|
38
|
+
* Throws when no key can be resolved, mirroring `validateRelativePath`; use
|
|
39
|
+
* `tryStableArtifactId` where an absence should be handled rather than raised.
|
|
40
|
+
*/
|
|
41
|
+
export declare function stableArtifactId(input: StableArtifactIdInput): string;
|
|
42
|
+
export declare function tryStableArtifactId(input: StableArtifactIdInput): string | undefined;
|
|
43
|
+
/** Whether an id was derived from the artifact itself rather than from a document. */
|
|
44
|
+
export declare function isStableArtifactId(id: string): boolean;
|
|
9
45
|
export declare function resolveSiblingPath(sourceDocumentPath: string, artifactPath: string): string | undefined;
|
|
10
46
|
export declare function resolveChildPath(directoryPath: string, childPath: string): string | undefined;
|
|
11
47
|
export declare function inferArtifactKind(filename: string, defaultKind?: ArtifactKind): ArtifactKind;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/adapters/common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/adapters/common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,mBAAmB,CAAA;AAE1B,M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MAAM,EACrB,SAAS,EAAE,MAAM,GAChB,MAAM,GAAG,SAAS,CAIpB;AAED,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,EAChB,WAAW,GAAE,YAAsB,GAClC,YAAY,CAUd;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAGtE;AAED,wBAAgB,YAAY,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAIzD"}
|
package/dist/adapters/common.js
CHANGED
|
@@ -55,6 +55,72 @@ export function tryValidateRelativePath(value) {
|
|
|
55
55
|
export function observationId(format, relativePath) {
|
|
56
56
|
return `episode-observation:${format}:${encodeURIComponent(relativePath)}`;
|
|
57
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Marks an id derived from the artifact itself rather than from the document
|
|
60
|
+
* that named it. `encodeURIComponent` escapes "@" to "%40", so no path-derived
|
|
61
|
+
* id can ever begin its key segment with this sentinel — the two id namespaces
|
|
62
|
+
* are disjoint by construction, and existing ids keep their exact spelling.
|
|
63
|
+
*/
|
|
64
|
+
const SELF_DERIVED_KEY_SENTINEL = "@";
|
|
65
|
+
/**
|
|
66
|
+
* The capture identity of a take: which device, and which instant it began.
|
|
67
|
+
*
|
|
68
|
+
* One device cannot start two recordings in the same second — the recording
|
|
69
|
+
* spec refuses a second start while one is active — so this pair identifies a
|
|
70
|
+
* take without consulting the file. Returns undefined when either half is
|
|
71
|
+
* missing, because half an identity is not a weaker identity, it is none.
|
|
72
|
+
*/
|
|
73
|
+
export function captureStableKey(capture) {
|
|
74
|
+
const device = capture.device?.trim();
|
|
75
|
+
const startedAt = capture.startedAt?.trim();
|
|
76
|
+
if (!device || !startedAt)
|
|
77
|
+
return undefined;
|
|
78
|
+
return `capture:${device}@${startedAt}`;
|
|
79
|
+
}
|
|
80
|
+
function resolveStableKey(input) {
|
|
81
|
+
const explicit = input.stableKey?.trim();
|
|
82
|
+
if (explicit)
|
|
83
|
+
return explicit;
|
|
84
|
+
if (input.capture)
|
|
85
|
+
return captureStableKey(input.capture);
|
|
86
|
+
return undefined;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* An artifact id derived from the artifact's own properties.
|
|
90
|
+
*
|
|
91
|
+
* Adapters mint ids from the containing document's path, which means an
|
|
92
|
+
* artifact has no identity until some manifest names it — a recording that
|
|
93
|
+
* exists on a device is nameless until it is written into a manifest, and the
|
|
94
|
+
* same take referenced from two manifests becomes two ids. This derivation
|
|
95
|
+
* gives an artifact an identity it carries on its own, before and independent of
|
|
96
|
+
* any document.
|
|
97
|
+
*
|
|
98
|
+
* Throws when no key can be resolved, mirroring `validateRelativePath`; use
|
|
99
|
+
* `tryStableArtifactId` where an absence should be handled rather than raised.
|
|
100
|
+
*/
|
|
101
|
+
export function stableArtifactId(input) {
|
|
102
|
+
if (typeof input.kind !== "string" || input.kind.length === 0) {
|
|
103
|
+
throw new TypeError("stableArtifactId requires an artifact kind");
|
|
104
|
+
}
|
|
105
|
+
const key = resolveStableKey(input);
|
|
106
|
+
if (key === undefined) {
|
|
107
|
+
throw new TypeError("stableArtifactId requires a stableKey, or a capture carrying both device and startedAt");
|
|
108
|
+
}
|
|
109
|
+
return `artifact:${input.kind}:${SELF_DERIVED_KEY_SENTINEL}${encodeURIComponent(key)}`;
|
|
110
|
+
}
|
|
111
|
+
export function tryStableArtifactId(input) {
|
|
112
|
+
try {
|
|
113
|
+
return stableArtifactId(input);
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
return undefined;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/** Whether an id was derived from the artifact itself rather than from a document. */
|
|
120
|
+
export function isStableArtifactId(id) {
|
|
121
|
+
const key = id.split(":").slice(2).join(":");
|
|
122
|
+
return id.startsWith("artifact:") && key.startsWith(SELF_DERIVED_KEY_SENTINEL);
|
|
123
|
+
}
|
|
58
124
|
export function resolveSiblingPath(sourceDocumentPath, artifactPath) {
|
|
59
125
|
const normalizedArtifact = tryValidateRelativePath(artifactPath);
|
|
60
126
|
if (normalizedArtifact === undefined)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/adapters/common.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/adapters/common.ts"],"names":[],"mappings":"AAQA,MAAM,UAAU,QAAQ,CAAC,KAAc;IACrC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;AAC7E,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,IAAI,KAAK,YAAY,IAAI;QAAE,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;IAC3D,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;IACtD,IAAI,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACpB,MAAM,KAAK,GAA4B,EAAE,CAAA;QACzC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;YAAE,KAAK,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,CAAA;QAChF,OAAO,KAAK,CAAA;IACd,CAAC;IACD,OAAO,KAAK,CAAA;AACd,CAAC;AAED,MAAM,UAAU,iBAAiB,CAC/B,KAAiB,EACjB,QAA2B;IAE3B,MAAM,MAAM,GAA4B,EAAE,CAAA;IAC1C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACjD,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC;YAAE,MAAM,CAAC,GAAG,CAAC,GAAG,UAAU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AA;AAC3C,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -13,4 +13,10 @@ export * from "./adapters/segment-grammar.js";
|
|
|
13
13
|
* drifting copy of the traversal validator.
|
|
14
14
|
*/
|
|
15
15
|
export { inferArtifactKind, extractEpisodeNumber, validateRelativePath, tryValidateRelativePath, resolveSiblingPath, resolveChildPath, observationId, pathBasename, } from "./adapters/common.js";
|
|
16
|
+
/**
|
|
17
|
+
* Artifact identity derived from the artifact itself, so a take has a name
|
|
18
|
+
* before any manifest gives it one. Document-derived ids are unchanged.
|
|
19
|
+
*/
|
|
20
|
+
export { stableArtifactId, tryStableArtifactId, isStableArtifactId, captureStableKey, } from "./adapters/common.js";
|
|
21
|
+
export type { StableArtifactIdInput } from "./adapters/common.js";
|
|
16
22
|
//# 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"}
|
|
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"}
|
package/dist/index.js
CHANGED
|
@@ -13,4 +13,9 @@ export * from "./adapters/segment-grammar.js";
|
|
|
13
13
|
* drifting copy of the traversal validator.
|
|
14
14
|
*/
|
|
15
15
|
export { inferArtifactKind, extractEpisodeNumber, validateRelativePath, tryValidateRelativePath, resolveSiblingPath, resolveChildPath, observationId, pathBasename, } from "./adapters/common.js";
|
|
16
|
+
/**
|
|
17
|
+
* Artifact identity derived from the artifact itself, so a take has a name
|
|
18
|
+
* before any manifest gives it one. Document-derived ids are unchanged.
|
|
19
|
+
*/
|
|
20
|
+
export { stableArtifactId, tryStableArtifactId, isStableArtifactId, captureStableKey, } from "./adapters/common.js";
|
|
16
21
|
//# 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"}
|
|
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"}
|
package/dist/observation.d.ts
CHANGED
|
@@ -15,13 +15,140 @@ export interface EpisodeIdentityCandidate {
|
|
|
15
15
|
kind: "episode-number" | "slug" | "title" | "path";
|
|
16
16
|
value: string;
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
/**
|
|
19
|
+
* The kinds, as a value rather than only as a type.
|
|
20
|
+
*
|
|
21
|
+
* A TypeScript union vanishes at compile time. The device side of this contract
|
|
22
|
+
* — `gmtermux`'s recorder — is plain JavaScript, so a union it cannot import is
|
|
23
|
+
* a contract it cannot check: a misspelled `"capture"` reaches the manifest and
|
|
24
|
+
* is indistinguishable from an absence. Every axis below is therefore published
|
|
25
|
+
* as a frozen array with its type derived FROM the array, so the value and the
|
|
26
|
+
* type cannot drift apart the way two hand-kept copies would.
|
|
27
|
+
*/
|
|
28
|
+
export declare const ARTIFACT_KINDS: readonly ["audio", "transcript", "image", "text", "midi", "video", "other"];
|
|
29
|
+
export type ArtifactKind = (typeof ARTIFACT_KINDS)[number];
|
|
30
|
+
/** Narrows an unvalidated string to {@link ArtifactKind}. */
|
|
31
|
+
export declare function isArtifactKind(value: unknown): value is ArtifactKind;
|
|
32
|
+
/**
|
|
33
|
+
* How an artifact came to exist — the axis that says what you must never lose.
|
|
34
|
+
*
|
|
35
|
+
* `captured` is unrepeatable: a device, an instant, one chance. A take that is
|
|
36
|
+
* deleted is gone, because the moment it recorded will not happen twice.
|
|
37
|
+
* `derived` is regenerable from something else that is still held — a
|
|
38
|
+
* transcript, a rendered mix, a thumbnail. `authored` was written elsewhere by
|
|
39
|
+
* someone, then brought in: a downloaded deep-search markdown, an imported doc.
|
|
40
|
+
*
|
|
41
|
+
* Flattening these three loses the only property that distinguishes an
|
|
42
|
+
* irreplaceable recording from a file that can be rebuilt on demand.
|
|
43
|
+
*/
|
|
44
|
+
export declare const ARTIFACT_ORIGINS: readonly ["captured", "derived", "authored"];
|
|
45
|
+
export type ArtifactOrigin = (typeof ARTIFACT_ORIGINS)[number];
|
|
46
|
+
/**
|
|
47
|
+
* Narrows an unvalidated string to {@link ArtifactOrigin}.
|
|
48
|
+
*
|
|
49
|
+
* This is the guard that matters most: `origin` is the only field saying what
|
|
50
|
+
* must never be lost, and a value that fails this check must be treated as
|
|
51
|
+
* unknown — never defaulted to `"derived"`, which would mark an unrepeatable
|
|
52
|
+
* take as regenerable.
|
|
53
|
+
*/
|
|
54
|
+
export declare function isArtifactOrigin(value: unknown): value is ArtifactOrigin;
|
|
55
|
+
/**
|
|
56
|
+
* What a capture records about itself, per `gmtermux/rispecs/recording.spec.md`:
|
|
57
|
+
* "the filename, the instants it started and stopped, its duration in seconds,
|
|
58
|
+
* its size, and the device that made it."
|
|
59
|
+
*
|
|
60
|
+
* An audio take is the sharpest case of this shape, not its only one — a camera
|
|
61
|
+
* roll, a film take, and a live MIDI performance are all a device, an instant,
|
|
62
|
+
* and one chance. Nothing here is specific to audio.
|
|
63
|
+
*
|
|
64
|
+
* Every field is optional because provenance is observed, not demanded. A take
|
|
65
|
+
* whose device is unknown is still a take; an absent field is an absence, not
|
|
66
|
+
* an error, and must not be filled in with a guess.
|
|
67
|
+
*/
|
|
68
|
+
export interface CaptureProvenance {
|
|
69
|
+
/** The device that made the capture, as it named itself. */
|
|
70
|
+
device?: string;
|
|
71
|
+
/** ISO 8601 instant the capture began. */
|
|
72
|
+
startedAt?: string;
|
|
73
|
+
/** ISO 8601 instant the capture finished. */
|
|
74
|
+
stoppedAt?: string;
|
|
75
|
+
/** Duration of the finished take. Segments joined by a pause are one duration. */
|
|
76
|
+
durationSeconds?: number;
|
|
77
|
+
/** Size of the finished file in bytes. */
|
|
78
|
+
bytes?: number;
|
|
79
|
+
}
|
|
19
80
|
export interface ArtifactReference {
|
|
20
81
|
id: string;
|
|
21
82
|
kind: ArtifactKind;
|
|
22
83
|
relativePath: string;
|
|
23
84
|
label?: string;
|
|
85
|
+
/**
|
|
86
|
+
* The derived-from pointer: the artifact this one was made from. This is the
|
|
87
|
+
* `origin: "derived"` lineage edge — a transcript points at the audio it was
|
|
88
|
+
* transcribed from, a mixdown at its session. Absent on a `captured` artifact,
|
|
89
|
+
* which was made from a moment rather than from another artifact.
|
|
90
|
+
*/
|
|
24
91
|
sourceArtifact?: string;
|
|
92
|
+
/**
|
|
93
|
+
* How this artifact came to exist. Absent means unknown — an absence, not an
|
|
94
|
+
* error. Sources predating this field say nothing about origin, and a reader
|
|
95
|
+
* must not infer one from the file extension.
|
|
96
|
+
*/
|
|
97
|
+
origin?: ArtifactOrigin;
|
|
98
|
+
/**
|
|
99
|
+
* Capture provenance, meaningful when `origin` is `"captured"`. Absent on a
|
|
100
|
+
* derived or authored artifact, and absent on a capture whose source document
|
|
101
|
+
* never recorded it.
|
|
102
|
+
*/
|
|
103
|
+
capture?: CaptureProvenance;
|
|
104
|
+
metadata: Record<string, unknown>;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* What a set gathers.
|
|
108
|
+
*
|
|
109
|
+
* Composition, Episode, Melody and Film are siblings at the same level — none is
|
|
110
|
+
* an extension of another, and none is a special case of a recording. `inquiry`
|
|
111
|
+
* is the IAIP folder. Absent means the gathering was observed without being
|
|
112
|
+
* classified — an absence, not an error — and `other` is a set whose source
|
|
113
|
+
* named a kind this list does not carry yet.
|
|
114
|
+
*/
|
|
115
|
+
export declare const ARTIFACT_SET_KINDS: readonly ["inquiry", "composition", "episode", "melody", "film", "other"];
|
|
116
|
+
export type ArtifactSetKind = (typeof ARTIFACT_SET_KINDS)[number];
|
|
117
|
+
/** Narrows an unvalidated string to {@link ArtifactSetKind}. */
|
|
118
|
+
export declare function isArtifactSetKind(value: unknown): value is ArtifactSetKind;
|
|
119
|
+
/**
|
|
120
|
+
* A directory that gathers artifacts and carries its own identity.
|
|
121
|
+
*
|
|
122
|
+
* A set is the same concept as a leaf artifact at a larger scale: an IAIP
|
|
123
|
+
* inquiry folder (`ep<NNN>-<slug>-<YYMMDD>-<uuid>`), a composition folder, a
|
|
124
|
+
* melody, and a film are all sets — things you can point at, relate, and lose.
|
|
125
|
+
* Nothing here is shaped around audio; a film set is not a recording with extra
|
|
126
|
+
* fields, it is a peer.
|
|
127
|
+
*
|
|
128
|
+
* Members are held as artifact ids rather than inlined references, so a set can
|
|
129
|
+
* name an artifact that a different document observed — and so a set can hold
|
|
130
|
+
* another set, ids being uniform across both scales.
|
|
131
|
+
*
|
|
132
|
+
* Observation only: nothing here scans a filesystem to discover members.
|
|
133
|
+
*/
|
|
134
|
+
export interface ArtifactSet {
|
|
135
|
+
id: string;
|
|
136
|
+
/** Directory name as it appears on disk — the inquiry vessel's own name. */
|
|
137
|
+
name: string;
|
|
138
|
+
/** Short stable name when the directory name is not itself one. */
|
|
139
|
+
slug?: string;
|
|
140
|
+
/** Path to the directory, relative to the observed root. */
|
|
141
|
+
relativePath: string;
|
|
142
|
+
kind?: ArtifactSetKind;
|
|
143
|
+
/** How the gathering came to exist; same axis and same absence rule as a leaf. */
|
|
144
|
+
origin?: ArtifactOrigin;
|
|
145
|
+
label?: string;
|
|
146
|
+
/**
|
|
147
|
+
* Artifact ids gathered here. An empty array is meaningful: `scaffoldVessel`
|
|
148
|
+
* creates a named, empty inquiry directory on purpose, and that emptiness is
|
|
149
|
+
* the state of the inquiry, not missing data.
|
|
150
|
+
*/
|
|
151
|
+
members: string[];
|
|
25
152
|
metadata: Record<string, unknown>;
|
|
26
153
|
}
|
|
27
154
|
export type EpisodeRelationKind = "related-to" | "branch-of" | "continues-from";
|
|
@@ -31,6 +158,52 @@ export interface EpisodeRelation {
|
|
|
31
158
|
target: EpisodeIdentityCandidate;
|
|
32
159
|
metadata?: Record<string, unknown>;
|
|
33
160
|
}
|
|
161
|
+
/**
|
|
162
|
+
* Membership direction. Both are carried because a source document states one
|
|
163
|
+
* or the other, and observation does not invent the inverse it did not read.
|
|
164
|
+
*/
|
|
165
|
+
export declare const ARTIFACT_RELATION_KINDS: readonly ["member-of", "gathers"];
|
|
166
|
+
export type ArtifactRelationKind = (typeof ARTIFACT_RELATION_KINDS)[number];
|
|
167
|
+
/** Narrows an unvalidated string to {@link ArtifactRelationKind}. */
|
|
168
|
+
export declare function isArtifactRelationKind(value: unknown): value is ArtifactRelationKind;
|
|
169
|
+
/**
|
|
170
|
+
* What can sit on the container end of a membership edge. Composition, Episode,
|
|
171
|
+
* Melody and Film are named at the same level because they are peers under one
|
|
172
|
+
* root; `artifact-set` covers a gathering whose kind is unclassified, and
|
|
173
|
+
* `artifact` lets a set be a member of another set.
|
|
174
|
+
*/
|
|
175
|
+
export declare const ARTIFACT_RELATION_TARGET_KINDS: readonly ["episode", "composition", "melody", "film", "artifact-set", "artifact"];
|
|
176
|
+
export type ArtifactRelationTargetKind = (typeof ARTIFACT_RELATION_TARGET_KINDS)[number];
|
|
177
|
+
/** Narrows an unvalidated string to {@link ArtifactRelationTargetKind}. */
|
|
178
|
+
export declare function isArtifactRelationTargetKind(value: unknown): value is ArtifactRelationTargetKind;
|
|
179
|
+
/**
|
|
180
|
+
* The other end of a membership edge.
|
|
181
|
+
*
|
|
182
|
+
* `id` is present when the target is already an observed artifact, set, or node;
|
|
183
|
+
* `identity` carries an unresolved episode candidate instead. Both may be
|
|
184
|
+
* absent-but-one: a target naming neither identifies nothing, which callers
|
|
185
|
+
* should diagnose rather than store.
|
|
186
|
+
*/
|
|
187
|
+
export interface ArtifactRelationTarget {
|
|
188
|
+
kind: ArtifactRelationTargetKind;
|
|
189
|
+
id?: string;
|
|
190
|
+
identity?: EpisodeIdentityCandidate;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* An artifact ↔ container edge, which `EpisodeRelation` cannot express: that
|
|
194
|
+
* relation targets an episode identity from an episode, so it has no way to say
|
|
195
|
+
* "this recording belongs to that composition".
|
|
196
|
+
*
|
|
197
|
+
* A pure observation concern — reading an edge a source stated. No I/O.
|
|
198
|
+
*/
|
|
199
|
+
export interface ArtifactRelation {
|
|
200
|
+
id: string;
|
|
201
|
+
kind: ArtifactRelationKind;
|
|
202
|
+
/** The artifact or artifact-set this edge starts from, by id. */
|
|
203
|
+
artifactId: string;
|
|
204
|
+
target: ArtifactRelationTarget;
|
|
205
|
+
metadata?: Record<string, unknown>;
|
|
206
|
+
}
|
|
34
207
|
export interface CompatibilityDiagnostic {
|
|
35
208
|
level: "info" | "warning" | "error";
|
|
36
209
|
code: string;
|
|
@@ -95,6 +268,17 @@ export interface EpisodeObservation {
|
|
|
95
268
|
sourceMetadata: EpisodeSourceMetadata;
|
|
96
269
|
artifacts: ArtifactReference[];
|
|
97
270
|
relations: EpisodeRelation[];
|
|
271
|
+
/**
|
|
272
|
+
* Sets observed in the source. Absent means the source named no gathering —
|
|
273
|
+
* an absence, not an empty result. The adapters in this package do not infer
|
|
274
|
+
* sets from directory shape, so today only callers supply these.
|
|
275
|
+
*/
|
|
276
|
+
artifactSets?: ArtifactSet[];
|
|
277
|
+
/**
|
|
278
|
+
* Membership edges the source stated. Absent means none were stated; it is
|
|
279
|
+
* never a claim that an artifact belongs nowhere.
|
|
280
|
+
*/
|
|
281
|
+
artifactRelations?: ArtifactRelation[];
|
|
98
282
|
diagnostics: CompatibilityDiagnostic[];
|
|
99
283
|
/** Present only for sources carrying musical metadata. */
|
|
100
284
|
musical?: CompositionMusicalMetadata;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observation.d.ts","sourceRoot":"","sources":["../src/observation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,MAAM,iBAAiB,GACzB,oBAAoB,GACpB,WAAW,GACX,oBAAoB,CAAA;AAExB,MAAM,MAAM,mBAAmB,GAC3B,kBAAkB,GAClB,cAAc,GACd,oBAAoB,GACpB,iBAAiB,CAAA;AAErB,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,mBAAmB,CAAA;IAC3B,YAAY,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,gBAAgB,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAA;IAClD,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"observation.d.ts","sourceRoot":"","sources":["../src/observation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,MAAM,iBAAiB,GACzB,oBAAoB,GACpB,WAAW,GACX,oBAAoB,CAAA;AAExB,MAAM,MAAM,mBAAmB,GAC3B,kBAAkB,GAClB,cAAc,GACd,oBAAoB,GACpB,iBAAiB,CAAA;AAErB,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,mBAAmB,CAAA;IAC3B,YAAY,EAAE,MAAM,CAAA;CACrB;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,gBAAgB,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,C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AAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACxC;AAED,MAAM,WAAW,iCAAiC;IAChD,YAAY,EAAE,MAAM,CAAA;IACpB,IAAI,CAAC,EAAE,oBAAoB,CAAA;CAC5B;AAED,MAAM,WAAW,iCAAiC;IAChD,YAAY,EAAE,MAAM,CAAA;IACpB,IAAI,CAAC,EAAE,WAAW,CAAA;CACnB;AAED,MAAM,WAAW,qBAAqB;IACpC,YAAY,EAAE,MAAM,CAAA;IACpB,IAAI,CAAC,EAAE,MAAM,GAAG,WAAW,CAAA;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,SAAS,CAAC,MAAM,GAAG,qBAAqB,CAAC,EAAE,CAAA;CACrD;AAED,MAAM,WAAW,8BAA8B;IAC7C,YAAY,EAAE,MAAM,CAAA;IACpB,IAAI,CAAC,EAAE,WAAW,CAAA;CACnB"}
|
package/dist/observation.js
CHANGED
|
@@ -5,5 +5,100 @@
|
|
|
5
5
|
* authored EpisodicMemory schema. Consumers can inspect the diagnostics and
|
|
6
6
|
* decide whether a later, explicit projection is appropriate.
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
/**
|
|
9
|
+
* The kinds, as a value rather than only as a type.
|
|
10
|
+
*
|
|
11
|
+
* A TypeScript union vanishes at compile time. The device side of this contract
|
|
12
|
+
* — `gmtermux`'s recorder — is plain JavaScript, so a union it cannot import is
|
|
13
|
+
* a contract it cannot check: a misspelled `"capture"` reaches the manifest and
|
|
14
|
+
* is indistinguishable from an absence. Every axis below is therefore published
|
|
15
|
+
* as a frozen array with its type derived FROM the array, so the value and the
|
|
16
|
+
* type cannot drift apart the way two hand-kept copies would.
|
|
17
|
+
*/
|
|
18
|
+
export const ARTIFACT_KINDS = Object.freeze([
|
|
19
|
+
"audio",
|
|
20
|
+
"transcript",
|
|
21
|
+
"image",
|
|
22
|
+
"text",
|
|
23
|
+
"midi",
|
|
24
|
+
"video",
|
|
25
|
+
"other",
|
|
26
|
+
]);
|
|
27
|
+
/** Narrows an unvalidated string to {@link ArtifactKind}. */
|
|
28
|
+
export function isArtifactKind(value) {
|
|
29
|
+
return typeof value === "string" && ARTIFACT_KINDS.includes(value);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* How an artifact came to exist — the axis that says what you must never lose.
|
|
33
|
+
*
|
|
34
|
+
* `captured` is unrepeatable: a device, an instant, one chance. A take that is
|
|
35
|
+
* deleted is gone, because the moment it recorded will not happen twice.
|
|
36
|
+
* `derived` is regenerable from something else that is still held — a
|
|
37
|
+
* transcript, a rendered mix, a thumbnail. `authored` was written elsewhere by
|
|
38
|
+
* someone, then brought in: a downloaded deep-search markdown, an imported doc.
|
|
39
|
+
*
|
|
40
|
+
* Flattening these three loses the only property that distinguishes an
|
|
41
|
+
* irreplaceable recording from a file that can be rebuilt on demand.
|
|
42
|
+
*/
|
|
43
|
+
export const ARTIFACT_ORIGINS = Object.freeze(["captured", "derived", "authored"]);
|
|
44
|
+
/**
|
|
45
|
+
* Narrows an unvalidated string to {@link ArtifactOrigin}.
|
|
46
|
+
*
|
|
47
|
+
* This is the guard that matters most: `origin` is the only field saying what
|
|
48
|
+
* must never be lost, and a value that fails this check must be treated as
|
|
49
|
+
* unknown — never defaulted to `"derived"`, which would mark an unrepeatable
|
|
50
|
+
* take as regenerable.
|
|
51
|
+
*/
|
|
52
|
+
export function isArtifactOrigin(value) {
|
|
53
|
+
return typeof value === "string" && ARTIFACT_ORIGINS.includes(value);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* What a set gathers.
|
|
57
|
+
*
|
|
58
|
+
* Composition, Episode, Melody and Film are siblings at the same level — none is
|
|
59
|
+
* an extension of another, and none is a special case of a recording. `inquiry`
|
|
60
|
+
* is the IAIP folder. Absent means the gathering was observed without being
|
|
61
|
+
* classified — an absence, not an error — and `other` is a set whose source
|
|
62
|
+
* named a kind this list does not carry yet.
|
|
63
|
+
*/
|
|
64
|
+
export const ARTIFACT_SET_KINDS = Object.freeze([
|
|
65
|
+
"inquiry",
|
|
66
|
+
"composition",
|
|
67
|
+
"episode",
|
|
68
|
+
"melody",
|
|
69
|
+
"film",
|
|
70
|
+
"other",
|
|
71
|
+
]);
|
|
72
|
+
/** Narrows an unvalidated string to {@link ArtifactSetKind}. */
|
|
73
|
+
export function isArtifactSetKind(value) {
|
|
74
|
+
return typeof value === "string" && ARTIFACT_SET_KINDS.includes(value);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Membership direction. Both are carried because a source document states one
|
|
78
|
+
* or the other, and observation does not invent the inverse it did not read.
|
|
79
|
+
*/
|
|
80
|
+
export const ARTIFACT_RELATION_KINDS = Object.freeze(["member-of", "gathers"]);
|
|
81
|
+
/** Narrows an unvalidated string to {@link ArtifactRelationKind}. */
|
|
82
|
+
export function isArtifactRelationKind(value) {
|
|
83
|
+
return typeof value === "string" && ARTIFACT_RELATION_KINDS.includes(value);
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* What can sit on the container end of a membership edge. Composition, Episode,
|
|
87
|
+
* Melody and Film are named at the same level because they are peers under one
|
|
88
|
+
* root; `artifact-set` covers a gathering whose kind is unclassified, and
|
|
89
|
+
* `artifact` lets a set be a member of another set.
|
|
90
|
+
*/
|
|
91
|
+
export const ARTIFACT_RELATION_TARGET_KINDS = Object.freeze([
|
|
92
|
+
"episode",
|
|
93
|
+
"composition",
|
|
94
|
+
"melody",
|
|
95
|
+
"film",
|
|
96
|
+
"artifact-set",
|
|
97
|
+
"artifact",
|
|
98
|
+
]);
|
|
99
|
+
/** Narrows an unvalidated string to {@link ArtifactRelationTargetKind}. */
|
|
100
|
+
export function isArtifactRelationTargetKind(value) {
|
|
101
|
+
return (typeof value === "string" &&
|
|
102
|
+
ARTIFACT_RELATION_TARGET_KINDS.includes(value));
|
|
103
|
+
}
|
|
9
104
|
//# sourceMappingURL=observation.js.map
|
package/dist/observation.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"observation.js","sourceRoot":"","sources":["../src/observation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
|
|
1
|
+
{"version":3,"file":"observation.js","sourceRoot":"","sources":["../src/observation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAuBH;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC;IAC1C,OAAO;IACP,YAAY;IACZ,OAAO;IACP,MAAM;IACN,MAAM;IACN,OAAO;IACP,OAAO;CACC,CAAC,CAAA;AAIX,6DAA6D;AAC7D,MAAM,UAAU,cAAc,CAAC,KAAc;IAC3C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAK,cAAoC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;AAC3F,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,SAAS,EAAE,UAAU,CAAU,CAAC,CAAA;AAI3F;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAK,gBAAsC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;AAC7F,CAAC;AAuDD;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,CAAC;IAC9C,SAAS;IACT,aAAa;IACb,SAAS;IACT,QAAQ;IACR,MAAM;IACN,OAAO;CACC,CAAC,CAAA;AAIX,gEAAgE;AAChE,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC9C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAK,kBAAwC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;AAC/F,CAAC;AA+CD;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,SAAS,CAAU,CAAC,CAAA;AAIvF,qEAAqE;AACrE,MAAM,UAAU,sBAAsB,CAAC,KAAc;IACnD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAK,uBAA6C,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;AACpG,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,MAAM,CAAC,MAAM,CAAC;IAC1D,SAAS;IACT,aAAa;IACb,QAAQ;IACR,MAAM;IACN,cAAc;IACd,UAAU;CACF,CAAC,CAAA;AAIX,2EAA2E;AAC3E,MAAM,UAAU,4BAA4B,CAC1C,KAAc;IAEd,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACxB,8BAAoD,CAAC,QAAQ,CAAC,KAAK,CAAC,CACtE,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@miadi/episodic-memory-schema",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
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",
|
|
@@ -39,15 +39,16 @@
|
|
|
39
39
|
"README.md",
|
|
40
40
|
"LICENSE"
|
|
41
41
|
],
|
|
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
|
+
},
|
|
42
48
|
"devDependencies": {
|
|
43
49
|
"typescript": "^5.4.0"
|
|
44
50
|
},
|
|
45
51
|
"publishConfig": {
|
|
46
52
|
"access": "public"
|
|
47
|
-
},
|
|
48
|
-
"scripts": {
|
|
49
|
-
"build": "tsc",
|
|
50
|
-
"type-check": "tsc --noEmit",
|
|
51
|
-
"test": "npm run build && node --test test/*.test.mjs"
|
|
52
53
|
}
|
|
53
|
-
}
|
|
54
|
+
}
|