deepadata-edm-sdk 0.8.10 → 0.8.11

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.
@@ -0,0 +1,50 @@
1
+ export interface SpecSchemaNode {
2
+ type?: string | string[];
3
+ enum?: (string | null)[];
4
+ "x-edm-canonical"?: string[];
5
+ properties?: Record<string, SpecSchemaNode>;
6
+ required?: string[];
7
+ $ref?: string;
8
+ oneOf?: SpecSchemaNode[];
9
+ [k: string]: unknown;
10
+ }
11
+ export type CanonicalProfile = "essential" | "extended" | "full";
12
+ /**
13
+ * Composite schema path inside the installed spec for a profile. The
14
+ * filename version segment is the LINE (edm.v0.8.*) — derived from the
15
+ * installed version, not restated.
16
+ */
17
+ export declare function specCompositePath(profile: CanonicalProfile): string;
18
+ export declare function specFragmentPath(domain: string): string;
19
+ export declare function loadComposite(profile: CanonicalProfile): SpecSchemaNode;
20
+ export declare function loadFragment(domain: string): SpecSchemaNode;
21
+ export interface SpecProfileShape {
22
+ /** Domains the profile contains, in composite order. */
23
+ domains: string[];
24
+ /** Domains the composite marks required. */
25
+ requiredDomains: string[];
26
+ /** Allowed field set per domain (the composite property set). */
27
+ fields: Record<string, string[]>;
28
+ /** Required field set per domain (composite/fragment `required`). */
29
+ requiredFields: Record<string, string[]>;
30
+ }
31
+ /**
32
+ * The spec's shape for a canonical profile: domain membership, field
33
+ * membership, and required-ness — the mechanical truth the validator and
34
+ * the drift guard consume.
35
+ */
36
+ export declare function specProfileShape(profile: CanonicalProfile): SpecProfileShape;
37
+ /**
38
+ * Canonical vocabulary of a field, searched across all fragments:
39
+ * hard-enum fields contribute `enum` (nulls stripped); two-tier free-text
40
+ * fields contribute `x-edm-canonical`. Throws when the field exists but
41
+ * has neither, or is not found at all — a missing vocabulary is a wiring
42
+ * error, never a silent empty list.
43
+ */
44
+ export declare function specVocabOf(field: string): readonly string[];
45
+ /**
46
+ * Vocabulary of a NESTED field (e.g. governance.retention_policy.basis),
47
+ * addressed as "<fragment>.<field>.<nested>".
48
+ */
49
+ export declare function specNestedVocabOf(fragment: string, field: string, nested: string): readonly string[];
50
+ //# sourceMappingURL=spec-truth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spec-truth.d.ts","sourceRoot":"","sources":["../../src/schema/spec-truth.ts"],"names":[],"mappings":"AAgCA,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACzB,IAAI,CAAC,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,CAAC;IACzB,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAC5C,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,cAAc,EAAE,CAAC;IACzB,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtB;AAKD,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,UAAU,GAAG,MAAM,CAAC;AAEjE;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,gBAAgB,GAAG,MAAM,CAEnE;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEvD;AAKD,wBAAgB,aAAa,CAAC,OAAO,EAAE,gBAAgB,GAAG,cAAc,CAOvE;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,cAAc,CAO3D;AAiBD,MAAM,WAAW,gBAAgB;IAC/B,wDAAwD;IACxD,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,4CAA4C;IAC5C,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,iEAAiE;IACjE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACjC,qEAAqE;IACrE,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CAC1C;AAID;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,gBAAgB,GAAG,gBAAgB,CA4B5E;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CA2B5D;AAWD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAQpG"}
@@ -0,0 +1,164 @@
1
+ /**
2
+ * Spec truth loader (ADR-0030, amended).
3
+ *
4
+ * Reads the INSTALLED `edm-spec` package — composite profile schemas and
5
+ * domain fragments — and derives, at runtime:
6
+ *
7
+ * - which domains a profile contains, and which are required
8
+ * (composite top-level `properties` / `required`)
9
+ * - which fields belong to each domain of a profile, and which are
10
+ * required (inline composite properties when present, else the
11
+ * $ref'd fragment; same rule for `required`)
12
+ * - the canonical vocabulary of a field (`enum`, nulls stripped, or
13
+ * `x-edm-canonical` for two-tier free-text fields)
14
+ *
15
+ * These are DERIVED surfaces: they can never drift from the spec because
16
+ * they ARE the spec. The SDK's literal restatements (the zod schema in
17
+ * edm-schema.ts, the profile manifests in assembler.ts, the convenience
18
+ * constants in types.ts — kept literal because their TypeScript
19
+ * literal-union types are public API) are GUARDED against these loaders by
20
+ * tests/spec-drift-guard.test.ts, which is wired into `npm test` and fails
21
+ * loudly on any mismatch in either direction.
22
+ */
23
+ import { readFileSync } from "node:fs";
24
+ import { createRequire } from "node:module";
25
+ import { EDM_VERSION_LINE } from "../version.js";
26
+ const require = createRequire(import.meta.url);
27
+ const loadJson = (specPath) => JSON.parse(readFileSync(require.resolve(specPath), "utf8"));
28
+ /**
29
+ * Composite schema path inside the installed spec for a profile. The
30
+ * filename version segment is the LINE (edm.v0.8.*) — derived from the
31
+ * installed version, not restated.
32
+ */
33
+ export function specCompositePath(profile) {
34
+ return `edm-spec/schema/edm.v${EDM_VERSION_LINE}.${profile}.schema.json`;
35
+ }
36
+ export function specFragmentPath(domain) {
37
+ return `edm-spec/schema/fragments/${domain}.json`;
38
+ }
39
+ const compositeCache = new Map();
40
+ const fragmentCache = new Map();
41
+ export function loadComposite(profile) {
42
+ let c = compositeCache.get(profile);
43
+ if (!c) {
44
+ c = loadJson(specCompositePath(profile));
45
+ compositeCache.set(profile, c);
46
+ }
47
+ return c;
48
+ }
49
+ export function loadFragment(domain) {
50
+ let f = fragmentCache.get(domain);
51
+ if (!f) {
52
+ f = loadJson(specFragmentPath(domain));
53
+ fragmentCache.set(domain, f);
54
+ }
55
+ return f;
56
+ }
57
+ /**
58
+ * Resolve a composite's domain node: inline node when it carries its own
59
+ * `properties`, else the $ref'd fragment (fragment name taken from the
60
+ * $ref URL's trailing `fragments/<name>.json` segment).
61
+ */
62
+ function resolveDomainNode(domain, node) {
63
+ if (node.properties)
64
+ return node;
65
+ if (typeof node.$ref === "string") {
66
+ const m = node.$ref.match(/fragments\/([a-z_]+)\.json/);
67
+ if (m && m[1])
68
+ return loadFragment(m[1]);
69
+ }
70
+ // Last resort: fragment named after the domain.
71
+ return loadFragment(domain);
72
+ }
73
+ const shapeCache = new Map();
74
+ /**
75
+ * The spec's shape for a canonical profile: domain membership, field
76
+ * membership, and required-ness — the mechanical truth the validator and
77
+ * the drift guard consume.
78
+ */
79
+ export function specProfileShape(profile) {
80
+ let shape = shapeCache.get(profile);
81
+ if (shape)
82
+ return shape;
83
+ const composite = loadComposite(profile);
84
+ const props = composite.properties ?? {};
85
+ const domains = Object.keys(props);
86
+ const fields = {};
87
+ const requiredFields = {};
88
+ for (const domain of domains) {
89
+ const nodeRaw = props[domain];
90
+ if (!nodeRaw)
91
+ continue;
92
+ const node = resolveDomainNode(domain, nodeRaw);
93
+ fields[domain] = Object.keys(node.properties ?? {});
94
+ // Required-ness: the inline composite node's `required` wins when the
95
+ // node is inline; a $ref'd domain takes the fragment's `required`.
96
+ requiredFields[domain] = (nodeRaw.properties ? nodeRaw.required : node.required) ?? [];
97
+ }
98
+ shape = {
99
+ domains,
100
+ requiredDomains: composite.required ?? [],
101
+ fields,
102
+ requiredFields,
103
+ };
104
+ shapeCache.set(profile, shape);
105
+ return shape;
106
+ }
107
+ /**
108
+ * Canonical vocabulary of a field, searched across all fragments:
109
+ * hard-enum fields contribute `enum` (nulls stripped); two-tier free-text
110
+ * fields contribute `x-edm-canonical`. Throws when the field exists but
111
+ * has neither, or is not found at all — a missing vocabulary is a wiring
112
+ * error, never a silent empty list.
113
+ */
114
+ export function specVocabOf(field) {
115
+ const FRAGMENTS = [
116
+ "meta",
117
+ "core",
118
+ "constellation",
119
+ "milky_way",
120
+ "gravity",
121
+ "impulse",
122
+ "governance",
123
+ "telemetry",
124
+ "system",
125
+ "crosswalks",
126
+ ];
127
+ for (const fragName of FRAGMENTS) {
128
+ const frag = loadFragment(fragName);
129
+ const def = frag.properties?.[field];
130
+ if (!def)
131
+ continue;
132
+ const values = def.enum ?? def["x-edm-canonical"] ?? firstOneOfEnum(def);
133
+ if (!values) {
134
+ throw new Error(`spec-truth: field "${field}" found in fragment "${fragName}" but has ` +
135
+ `neither an enum nor an x-edm-canonical vocabulary`);
136
+ }
137
+ return values.filter((v) => typeof v === "string");
138
+ }
139
+ throw new Error(`spec-truth: field "${field}" not found in any spec fragment`);
140
+ }
141
+ /** meta.profile models its enum inside oneOf — surface it. */
142
+ function firstOneOfEnum(def) {
143
+ if (!Array.isArray(def.oneOf))
144
+ return undefined;
145
+ for (const branch of def.oneOf) {
146
+ if (Array.isArray(branch.enum))
147
+ return branch.enum;
148
+ }
149
+ return undefined;
150
+ }
151
+ /**
152
+ * Vocabulary of a NESTED field (e.g. governance.retention_policy.basis),
153
+ * addressed as "<fragment>.<field>.<nested>".
154
+ */
155
+ export function specNestedVocabOf(fragment, field, nested) {
156
+ const frag = loadFragment(fragment);
157
+ const def = frag.properties?.[field]?.properties?.[nested];
158
+ const values = def?.enum ?? def?.["x-edm-canonical"];
159
+ if (!values) {
160
+ throw new Error(`spec-truth: no vocabulary at ${fragment}.${field}.${nested}`);
161
+ }
162
+ return values.filter((v) => typeof v === "string");
163
+ }
164
+ //# sourceMappingURL=spec-truth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spec-truth.js","sourceRoot":"","sources":["../../src/schema/spec-truth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAiB/C,MAAM,QAAQ,GAAG,CAAC,QAAgB,EAAkB,EAAE,CACpD,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,CAAmB,CAAC;AAIhF;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAyB;IACzD,OAAO,wBAAwB,gBAAgB,IAAI,OAAO,cAAc,CAAC;AAC3E,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,MAAc;IAC7C,OAAO,6BAA6B,MAAM,OAAO,CAAC;AACpD,CAAC;AAED,MAAM,cAAc,GAAG,IAAI,GAAG,EAAoC,CAAC;AACnE,MAAM,aAAa,GAAG,IAAI,GAAG,EAA0B,CAAC;AAExD,MAAM,UAAU,aAAa,CAAC,OAAyB;IACrD,IAAI,CAAC,GAAG,cAAc,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACpC,IAAI,CAAC,CAAC,EAAE,CAAC;QACP,CAAC,GAAG,QAAQ,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,CAAC;QACzC,cAAc,CAAC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OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAe,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC;AAClE,CAAC"}
@@ -73,10 +73,12 @@ export interface ExtractionMetadata {
73
73
  export type PartnerProfileId = `partner:${string}`;
74
74
  /**
75
75
  * EDM Implementation Profile
76
- * - essential: ~20 required fields, minimal extraction for memory platforms
77
- * - extended: ~45 fields, adds full Constellation and key Gravity fields
78
- * - full: all 96 fields, complete extraction
76
+ * - essential: minimal extraction for memory platforms
77
+ * - extended: adds full Constellation and key Gravity fields
78
+ * - full: the complete field set, complete extraction
79
79
  * - partner:<profile_id>: partner-defined profile per ADR-0017
80
+ * Field membership per profile is defined by the edm-spec composite
81
+ * schemas (installed `edm-spec` package) — see assembler.ts manifests.
80
82
  */
81
83
  export type EdmProfile = 'essential' | 'extended' | 'full' | PartnerProfileId;
82
84
  export interface ExtractionOptions {
@@ -86,9 +88,9 @@ export interface ExtractionOptions {
86
88
  metadata: ExtractionMetadata;
87
89
  /**
88
90
  * EDM profile to extract (default: 'full')
89
- * - essential: ~20 fields, for memory platforms and agent frameworks
90
- * - extended: ~45 fields, for journaling and companion AI
91
- * - full: all 96 fields, for therapy and regulated systems
91
+ * - essential: minimal, for memory platforms and agent frameworks
92
+ * - extended: mid-tier, for journaling and companion AI
93
+ * - full: the complete field set, for therapy and regulated systems
92
94
  */
93
95
  profile?: EdmProfile;
94
96
  /** LLM provider to use for extraction (default: 'anthropic') */
@@ -123,14 +125,14 @@ export interface ValidationError {
123
125
  message: string;
124
126
  code: string;
125
127
  }
126
- export declare const EMOTION_PRIMARY: readonly ["joy", "sadness", "fear", "anger", "wonder", "peace", "tenderness", "reverence"];
127
- export declare const NARRATIVE_ARC: readonly ["overcoming", "transformation", "connection", "reflection", "closure"];
128
- export declare const RELATIONAL_DYNAMICS: readonly ["parent_child", "romantic_partnership", "sibling_bond", "friendship", "companionship", "mentorship", "reunion", "community_ritual", "grief", "self_reflection"];
128
+ export declare const EMOTION_PRIMARY: readonly ["joy", "sadness", "fear", "anger", "wonder", "peace", "tenderness", "reverence", "pride", "anxiety", "gratitude", "longing", "hope", "shame", "disappointment", "relief", "frustration"];
129
+ export declare const NARRATIVE_ARC: readonly ["overcoming", "transformation", "connection", "reflection", "closure", "loss", "confrontation"];
130
+ export declare const RELATIONAL_DYNAMICS: readonly ["parent_child", "grandparent_grandchild", "romantic_partnership", "couple", "sibling_bond", "family", "friendship", "friend", "companionship", "colleague", "mentorship", "reunion", "community_ritual", "grief", "self_reflection", "professional", "therapeutic", "service", "adversarial"];
129
131
  export declare const TEMPORAL_CONTEXT: readonly ["childhood", "early_adulthood", "midlife", "late_life", "recent", "future", "timeless"];
130
132
  export declare const MEMORY_TYPE: readonly ["legacy_artifact", "fleeting_moment", "milestone", "reflection", "formative_experience"];
131
133
  export declare const NARRATIVE_ARCHETYPE: readonly ["hero", "caregiver", "seeker", "sage", "lover", "outlaw", "innocent", "magician", "creator", "everyman", "jester", "ruler"];
132
- export declare const DRIVE_STATE: readonly ["explore", "approach", "avoid", "repair", "persevere", "share"];
133
- export declare const MOTIVATIONAL_ORIENTATION: readonly ["belonging", "safety", "mastery", "meaning", "autonomy"];
134
+ export declare const DRIVE_STATE: readonly ["explore", "approach", "avoid", "repair", "persevere", "share", "confront", "protect", "process"];
135
+ export declare const MOTIVATIONAL_ORIENTATION: readonly ["belonging", "safety", "mastery", "meaning", "autonomy", "authenticity"];
134
136
  export interface ActivateResult {
135
137
  activationId: string | null;
136
138
  arcTypes: string[];
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/schema/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,UAAU,EACV,UAAU,EACV,mBAAmB,EACnB,cAAc,EACd,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,YAAY,EACZ,gBAAgB,EA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AM,CAAC;CAClB;AAKD,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,MAAM,WAAW,oBAAoB;IACnC,wFAAwF;IACxF,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,8FAA8F;IAC9F,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,2EAA2E;IAC3E,OAAO,EAAE,oBAAoB,EAAE,CAAC;IAChC,iDAAiD;IACjD,mBAAmB,EAAE,MAAM,EAAE,CAAC;IAC9B,gDAAgD;IAChD,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,sCAAsC;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,4EAA4E;IAC5E,gBAAgB,EAAE,OAAO,CAAC;IAC1B,4EAA4E;IAC5E,cAAc,EAAE,MAAM,CAAC;IACvB,0GAA0G;IAC1G,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,gDAAgD;IAChD,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,MAAM,WAAW,qBAAqB;IACpC,6CAA6C;IAC7C,SAAS,EAAE,MAAM,CAAC;IAClB,oEAAoE;IACpE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sEAAsE;IACtE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kFAAkF;IAClF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oEAAoE;IACpE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
@@ -12,6 +12,13 @@ export const EXPERIENTIAL_STANCE = [
12
12
  ];
13
13
  // =============================================================================
14
14
  // Enum Constants (for convenience)
15
+ //
16
+ // GUARDED RESTATEMENT: these literal arrays restate the edm-spec fragment
17
+ // vocabularies (`enum` for hard enums, `x-edm-canonical` for two-tier
18
+ // free-text fields) so they keep literal-union TypeScript types — deriving
19
+ // them at runtime would collapse the types to string[]. They are asserted
20
+ // equal to the installed spec's vocabularies, both directions, by
21
+ // tests/spec-drift-guard.test.ts; any drift fails `npm test` loudly.
15
22
  // =============================================================================
16
23
  export const EMOTION_PRIMARY = [
17
24
  "joy",
@@ -22,6 +29,15 @@ export const EMOTION_PRIMARY = [
22
29
  "peace",
23
30
  "tenderness",
24
31
  "reverence",
32
+ "pride",
33
+ "anxiety",
34
+ "gratitude",
35
+ "longing",
36
+ "hope",
37
+ "shame",
38
+ "disappointment",
39
+ "relief",
40
+ "frustration",
25
41
  ];
26
42
  export const NARRATIVE_ARC = [
27
43
  "overcoming",
@@ -29,18 +45,29 @@ export const NARRATIVE_ARC = [
29
45
  "connection",
30
46
  "reflection",
31
47
  "closure",
48
+ "loss",
49
+ "confrontation",
32
50
  ];
33
51
  export const RELATIONAL_DYNAMICS = [
34
52
  "parent_child",
53
+ "grandparent_grandchild",
35
54
  "romantic_partnership",
55
+ "couple",
36
56
  "sibling_bond",
57
+ "family",
37
58
  "friendship",
59
+ "friend",
38
60
  "companionship",
61
+ "colleague",
39
62
  "mentorship",
40
63
  "reunion",
41
64
  "community_ritual",
42
65
  "grief",
43
66
  "self_reflection",
67
+ "professional",
68
+ "therapeutic",
69
+ "service",
70
+ "adversarial",
44
71
  ];
45
72
  export const TEMPORAL_CONTEXT = [
46
73
  "childhood",
@@ -79,6 +106,9 @@ export const DRIVE_STATE = [
79
106
  "repair",
80
107
  "persevere",
81
108
  "share",
109
+ "confront",
110
+ "protect",
111
+ "process",
82
112
  ];
83
113
  export const MOTIVATIONAL_ORIENTATION = [
84
114
  "belonging",
@@ -86,5 +116,6 @@ export const MOTIVATIONAL_ORIENTATION = [
86
116
  "mastery",
87
117
  "meaning",
88
118
  "autonomy",
119
+ "authenticity",
89
120
  ];
90
121
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/schema/types.ts"],"names":[],"mappings":"AA4EA;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,OAAO;IACP,WAAW;IACX,oBAAoB;IACpB,qBAAqB;IACrB,cAAc;CACN,CAAC;AA0FX,gFAAgF;AAChF,mCAAmC;AACnC,gFAAgF;AAChF,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,KAAK;IACL,SAAS;IACT,MAAM;IACN,OAAO;IACP,QAAQ;IACR,OAAO;IACP,YAAY;IACZ,WAAW;CACH,CAAC;AAEX,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,YAAY;IACZ,gBAAgB;IAChB,YAAY;IACZ,YAAY;IACZ,SAAS;CACD,CAAC;AAEX,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,cAAc;IACd,sBAAsB;IACtB,cAAc;IACd,YAAY;IACZ,eAAe;IACf,YAAY;IACZ,SAAS;IACT,kBAAkB;IAClB,OAAO;IACP,iBAAiB;CACT,CAAC;AAEX,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,WAAW;IACX,iBAAiB;IACjB,SAAS;IACT,WAAW;IACX,QAAQ;IACR,QAAQ;IACR,UAAU;CACF,CAAC;AAEX,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,iBAAiB;IACjB,iBAAiB;IACjB,WAAW;IACX,YAAY;IACZ,sBAAsB;CACd,CAAC;AAEX,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,MAAM;IACN,WAAW;IACX,QAAQ;IACR,MAAM;IACN,OAAO;IACP,QAAQ;IACR,UAAU;IACV,UAAU;IACV,SAAS;IACT,UAAU;IACV,QAAQ;IACR,OAAO;CACC,CAAC;AAEX,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,SAAS;IACT,UAAU;IACV,OAAO;IACP,QAAQ;IACR,WAAW;IACX,OAAO;CACC,CAAC;AAEX,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,WAAW;IACX,QAAQ;IACR,SAAS;IACT,SAAS;IACT,UAAU;CACF,CAAC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/schema/types.ts"],"names":[],"mappings":"AA4EA;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,OAAO;IACP,WAAW;IACX,oBAAoB;IACpB,qBAAqB;IACrB,cAAc;CACN,CAAC;AA4FX,gFAAgF;AAChF,mCAAmC;AACnC,EAAE;AACF,0EAA0E;AAC1E,sEAAsE;AACtE,2EAA2E;AAC3E,0EAA0E;AAC1E,kEAAkE;AAClE,qEAAqE;AACrE,gFAAgF;AAChF,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,KAAK;IACL,SAAS;IACT,MAAM;IACN,OAAO;IACP,QAAQ;IACR,OAAO;IACP,YAAY;IACZ,WAAW;IACX,OAAO;IACP,SAAS;IACT,WAAW;IACX,SAAS;IACT,MAAM;IACN,OAAO;IACP,gBAAgB;IAChB,QAAQ;IACR,aAAa;CACL,CAAC;AAEX,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,YAAY;IACZ,gBAAgB;IAChB,YAAY;IACZ,YAAY;IACZ,SAAS;IACT,MAAM;IACN,eAAe;CACP,CAAC;AAEX,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,cAAc;IACd,wBAAwB;IACxB,sBAAsB;IACtB,QAAQ;IACR,cAAc;IACd,QAAQ;IACR,YAAY;IACZ,QAAQ;IACR,eAAe;IACf,WAAW;IACX,YAAY;IACZ,SAAS;IACT,kBAAkB;IAClB,OAAO;IACP,iBAAiB;IACjB,cAAc;IACd,aAAa;IACb,SAAS;IACT,aAAa;CACL,CAAC;AAEX,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,WAAW;IACX,iBAAiB;IACjB,SAAS;IACT,WAAW;IACX,QAAQ;IACR,QAAQ;IACR,UAAU;CACF,CAAC;AAEX,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,iBAAiB;IACjB,iBAAiB;IACjB,WAAW;IACX,YAAY;IACZ,sBAAsB;CACd,CAAC;AAEX,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,MAAM;IACN,WAAW;IACX,QAAQ;IACR,MAAM;IACN,OAAO;IACP,QAAQ;IACR,UAAU;IACV,UAAU;IACV,SAAS;IACT,UAAU;IACV,QAAQ;IACR,OAAO;CACC,CAAC;AAEX,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,SAAS;IACT,UAAU;IACV,OAAO;IACP,QAAQ;IACR,WAAW;IACX,OAAO;IACP,UAAU;IACV,SAAS;IACT,SAAS;CACD,CAAC;AAEX,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,WAAW;IACX,QAAQ;IACR,SAAS;IACT,SAAS;IACT,UAAU;IACV,cAAc;CACN,CAAC"}
@@ -27,15 +27,28 @@ export interface ProfileConformanceError {
27
27
  */
28
28
  export declare function validateProfileConformance(artifact: unknown): ProfileConformanceResult;
29
29
  /**
30
- * Validate an EDM artifact against its declared profile schema
30
+ * Validate an EDM artifact against its DECLARED profile's schema surface.
31
31
  *
32
- * Profile-aware validation:
33
- * - Detects meta.profile value (defaults to "full" if not specified)
34
- * - Essential/Extended profiles: validates domain/field conformance only
35
- * - Full profile: validates against complete Zod schema
32
+ * Profile-aware validation (defect fix, 2026-07-22 — validateEDM used to
33
+ * value-check essential/extended domains against the FULL domain zod
34
+ * schemas, whose required keys meta.source_type, core.narrative,
35
+ * governance.exportability, telemetry.extraction_notes do not exist at
36
+ * those profiles, so an essential artifact could never pass):
36
37
  *
37
- * This ensures Essential (5 domains) and Extended (7 domains) artifacts
38
- * pass validation without requiring all 10 domains.
38
+ * 1. detect meta.profile (defaults to "full" when absent/invalid)
39
+ * 2. structural conformance domain/field membership from the profile
40
+ * manifests (drift-guarded restatements of the spec composites);
41
+ * required-ness from the spec composites/fragments
42
+ * 3. value validation — each present domain is checked against the full
43
+ * domain zod schema NARROWED to the profile's field set and made
44
+ * partial (`pick(profileFields).partial()`): every present field's
45
+ * VALUE is validated, while required-ness stays with step 2 where the
46
+ * spec, not zod key-optionality, is the authority
47
+ *
48
+ * Partner profiles (`partner:<id>`): structural completeness is skipped
49
+ * pending registry lookup (ADR-0012); values of canonical domains that
50
+ * are present are still validated against the full domain schemas
51
+ * (partial), so a partner artifact with a malformed canonical field fails.
39
52
  */
40
53
  export declare function validateEDM(artifact: unknown): ValidationResult;
41
54
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../src/validator.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAmB,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAapG,MAAM,MAAM,UAAU,GAClB,MAAM,GACN,MAAM,GACN,eAAe,GACf,WAAW,GACX,SAAS,GACT,SAAS,GACT,YAAY,GACZ,WAAW,GACX,QAAQ,GACR,YAAY,CAAC;AAmBjB,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,iBAAiB,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,wBAAwB;IACvC,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,UAAU,CAAC;IACpB,MAAM,EAAE,uBAAuB,EAAE,CAAC;IAClC,QAAQ,CAAC,EAAE,yBAAyB,EAAE,CAAC;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,gBAAgB,GAAG,cAAc,GAAG,eAAe,GAAG,aAAa,CAAC;IAC1E,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,OAAO,GAAG,wBAA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AAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,gBAAgB,GAAG,cAAc,GAAG,eAAe,GAAG,aAAa,CAAC;IAC1E,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,OAAO,GAAG,wBAAwB,CAoJtF;AAuDD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,OAAO,GAAG,gBAAgB,CAmB/D;AAgED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,OAAO,GAAG,gBAAgB,GAAG;IAAE,aAAa,EAAE,wBAAwB,CAAA;CAAE,CAuBxH;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,OAAO,GAAG,WAAW,CAEhE;AAaD;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,GAAG,gBAAgB,CAkBlF;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,OAAO,CAAC;IAClB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,WAAW,GAAG,kBAAkB,CA4E9E"}
package/dist/validator.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { EdmArtifactSchema, MetaSchema, CoreSchema, ConstellationSchema, MilkyWaySchema, GravitySchema, ImpulseSchema, GovernanceSchema, TelemetrySchema, SystemSchema, CrosswalksSchema, } from "./schema/edm-schema.js";
2
2
  import { getProfileFields, getProfileDomains, } from "./assembler.js";
3
+ import { specProfileShape } from "./schema/spec-truth.js";
3
4
  const domainSchemas = {
4
5
  meta: MetaSchema,
5
6
  core: CoreSchema,
@@ -120,8 +121,16 @@ export function validateProfileConformance(artifact) {
120
121
  fieldCount++;
121
122
  }
122
123
  }
123
- // Check for missing required fields
124
- for (const requiredField of allowedFields) {
124
+ // Check for missing required fields. Required-ness follows the spec
125
+ // composite (inline `required`, else the $ref'd fragment's `required`)
126
+ // — NOT the full manifest: the manifest is the ALLOWED set; the spec
127
+ // marks most fields optional (e.g. governance requires only
128
+ // jurisdiction/retention_policy/subject_rights). The SDK still EMITS
129
+ // every manifest field (whitepaper §5.2 No Omission), but validation
130
+ // must accept spec-conformant artifacts that omit optional fields —
131
+ // the spec's own profile examples do.
132
+ const requiredFields = specProfileShape(declaredProfile).requiredFields[domain] ?? [];
133
+ for (const requiredField of requiredFields) {
125
134
  if (!(requiredField in domainObj)) {
126
135
  errors.push({
127
136
  type: "missing_field",
@@ -178,71 +187,55 @@ function validateGovernanceNested(governance, profile, errors) {
178
187
  }
179
188
  }
180
189
  }
181
- // Full profile allows additional governance fields
182
- if (profile !== "full") {
183
- const extraGovFields = ["k_anonymity", "policy_labels", "masking_rules"];
184
- for (const field of extraGovFields) {
185
- if (field in governance) {
186
- errors.push({
187
- type: "extra_field",
188
- domain: "governance",
189
- field,
190
- message: `Field 'governance.${field}' is not allowed in ${profile} profile`,
191
- });
192
- }
193
- }
194
- }
190
+ // NOTE: k_anonymity/policy_labels/masking_rules were previously banned
191
+ // outside the full profile. The spec composites $ref the full governance
192
+ // fragment for EVERY profile, so all seven governance fields are allowed
193
+ // (optional) at essential and extended too — the ban was manifest drift,
194
+ // removed with the 0.8.3 reconciliation.
195
195
  }
196
196
  // =============================================================================
197
197
  // Schema Validation
198
198
  // =============================================================================
199
199
  /**
200
- * Validate an EDM artifact against its declared profile schema
200
+ * Validate an EDM artifact against its DECLARED profile's schema surface.
201
+ *
202
+ * Profile-aware validation (defect fix, 2026-07-22 — validateEDM used to
203
+ * value-check essential/extended domains against the FULL domain zod
204
+ * schemas, whose required keys — meta.source_type, core.narrative,
205
+ * governance.exportability, telemetry.extraction_notes — do not exist at
206
+ * those profiles, so an essential artifact could never pass):
201
207
  *
202
- * Profile-aware validation:
203
- * - Detects meta.profile value (defaults to "full" if not specified)
204
- * - Essential/Extended profiles: validates domain/field conformance only
205
- * - Full profile: validates against complete Zod schema
208
+ * 1. detect meta.profile (defaults to "full" when absent/invalid)
209
+ * 2. structural conformance domain/field membership from the profile
210
+ * manifests (drift-guarded restatements of the spec composites);
211
+ * required-ness from the spec composites/fragments
212
+ * 3. value validation — each present domain is checked against the full
213
+ * domain zod schema NARROWED to the profile's field set and made
214
+ * partial (`pick(profileFields).partial()`): every present field's
215
+ * VALUE is validated, while required-ness stays with step 2 where the
216
+ * spec, not zod key-optionality, is the authority
206
217
  *
207
- * This ensures Essential (5 domains) and Extended (7 domains) artifacts
208
- * pass validation without requiring all 10 domains.
218
+ * Partner profiles (`partner:<id>`): structural completeness is skipped
219
+ * pending registry lookup (ADR-0012); values of canonical domains that
220
+ * are present are still validated against the full domain schemas
221
+ * (partial), so a partner artifact with a malformed canonical field fails.
209
222
  */
210
223
  export function validateEDM(artifact) {
211
224
  // Detect profile from artifact
212
225
  const profile = detectProfile(artifact);
213
- // For Essential and Extended profiles, use profile conformance validation
214
- // (Zod schema expects all 10 domains which would fail for lighter profiles)
215
- if (profile === "essential" || profile === "extended") {
216
- const profileResult = validateProfileConformance(artifact);
217
- if (profileResult.conformant) {
218
- // Also validate the domains that ARE present using Zod
219
- const domainErrors = validatePresentDomains(artifact, profile);
220
- if (domainErrors.length > 0) {
221
- return { valid: false, errors: domainErrors };
222
- }
223
- return { valid: true, errors: [] };
224
- }
225
- return {
226
- valid: false,
227
- errors: profileResult.errors.map(e => ({
228
- path: e.field ? `${e.domain}.${e.field}` : e.domain,
229
- message: e.message,
230
- code: e.type,
231
- })),
232
- };
233
- }
234
- // Full profile: use complete Zod schema validation
235
- const result = EdmArtifactSchema.safeParse(artifact);
236
- if (result.success) {
237
- return {
238
- valid: true,
239
- errors: [],
240
- };
241
- }
242
- return {
243
- valid: false,
244
- errors: formatZodErrors(result.error),
245
- };
226
+ const profileResult = validateProfileConformance(artifact);
227
+ const structuralErrors = profileResult.conformant
228
+ ? []
229
+ : profileResult.errors.map(e => ({
230
+ path: e.field ? `${e.domain}.${e.field}` : e.domain,
231
+ message: e.message,
232
+ code: e.type,
233
+ }));
234
+ // Value validation runs regardless of structural conformance so callers
235
+ // see structural AND value errors in one pass (present domains only).
236
+ const valueErrors = validatePresentDomains(artifact, profile);
237
+ const errors = [...structuralErrors, ...valueErrors];
238
+ return { valid: errors.length === 0, errors };
246
239
  }
247
240
  /**
248
241
  * Detect profile from artifact's meta.profile field
@@ -257,11 +250,30 @@ function detectProfile(artifact) {
257
250
  if (profile === "essential" || profile === "extended" || profile === "full") {
258
251
  return profile;
259
252
  }
253
+ if (typeof profile === "string" && profile.startsWith("partner:")) {
254
+ return profile;
255
+ }
260
256
  return "full"; // Default to full if not specified or invalid
261
257
  }
262
258
  /**
263
- * Validate present domains using their individual Zod schemas
264
- * Used for Essential/Extended profiles where not all domains are present
259
+ * Zod schema for one domain of one profile: the full domain schema
260
+ * narrowed to the profile's field set, all keys optional. Field VALUES are
261
+ * validated; key required-ness is the conformance layer's job (spec
262
+ * required arrays). Unknown keys are ignored here — the conformance layer
263
+ * already reports them as extra_field.
264
+ */
265
+ function profileDomainSchema(domain, profile) {
266
+ const full = domainSchemas[domain];
267
+ const fields = getProfileFields(profile)[domain] ?? [];
268
+ const mask = {};
269
+ for (const f of fields) {
270
+ if (f in full.shape)
271
+ mask[f] = true;
272
+ }
273
+ return full.pick(mask).partial();
274
+ }
275
+ /**
276
+ * Validate present domains using their profile-narrowed Zod schemas.
265
277
  */
266
278
  function validatePresentDomains(artifact, profile) {
267
279
  const errors = [];
@@ -269,16 +281,14 @@ function validatePresentDomains(artifact, profile) {
269
281
  const profileDomains = getProfileDomains(profile);
270
282
  for (const domain of profileDomains) {
271
283
  const domainData = obj[domain];
272
- if (domainData !== undefined) {
273
- const schema = domainSchemas[domain];
274
- if (schema) {
275
- const result = schema.safeParse(domainData);
276
- if (!result.success) {
277
- errors.push(...formatZodErrors(result.error).map(err => ({
278
- ...err,
279
- path: `${domain}.${err.path}`,
280
- })));
281
- }
284
+ if (domainData !== undefined && domain in domainSchemas) {
285
+ const schema = profileDomainSchema(domain, profile);
286
+ const result = schema.safeParse(domainData);
287
+ if (!result.success) {
288
+ errors.push(...formatZodErrors(result.error).map(err => ({
289
+ ...err,
290
+ path: `${domain}.${err.path}`,
291
+ })));
282
292
  }
283
293
  }
284
294
  }