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.
- package/README.md +281 -278
- package/dist/assembler.d.ts +22 -12
- package/dist/assembler.d.ts.map +1 -1
- package/dist/assembler.js +35 -13
- package/dist/assembler.js.map +1 -1
- package/dist/extractors/generate-field-block.d.ts.map +1 -1
- package/dist/extractors/generate-field-block.js +11 -8
- package/dist/extractors/generate-field-block.js.map +1 -1
- package/dist/extractors/profile-prompts.d.ts +10 -7
- package/dist/extractors/profile-prompts.d.ts.map +1 -1
- package/dist/extractors/profile-prompts.js +166 -163
- package/dist/extractors/profile-prompts.js.map +1 -1
- package/dist/schema/edm-schema.d.ts +20 -10
- package/dist/schema/edm-schema.d.ts.map +1 -1
- package/dist/schema/edm-schema.js +19 -3
- package/dist/schema/edm-schema.js.map +1 -1
- package/dist/schema/spec-truth.d.ts +50 -0
- package/dist/schema/spec-truth.d.ts.map +1 -0
- package/dist/schema/spec-truth.js +164 -0
- package/dist/schema/spec-truth.js.map +1 -0
- package/dist/schema/types.d.ts +13 -11
- package/dist/schema/types.d.ts.map +1 -1
- package/dist/schema/types.js +31 -0
- package/dist/schema/types.js.map +1 -1
- package/dist/validator.d.ts +20 -7
- package/dist/validator.d.ts.map +1 -1
- package/dist/validator.js +78 -68
- package/dist/validator.js.map +1 -1
- package/dist/version.d.ts +13 -9
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +31 -4
- package/dist/version.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,278 +1,281 @@
|
|
|
1
|
-
# DeepaData EDM SDK
|
|
2
|
-
|
|
3
|
-
The significance layer for AI memory.
|
|
4
|
-
|
|
5
|
-
> **Versioning:** SDK package semver is independent of the EDM schema
|
|
6
|
-
> version. The schema version this SDK emits is
|
|
7
|
-
> `src/version.ts
|
|
8
|
-
> artifact's `meta.version` —
|
|
9
|
-
>
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
- **
|
|
72
|
-
- **
|
|
73
|
-
- **
|
|
74
|
-
- **
|
|
75
|
-
- **
|
|
76
|
-
- **
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
| **
|
|
86
|
-
| **
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
// -
|
|
157
|
-
// -
|
|
158
|
-
// -
|
|
159
|
-
// -
|
|
160
|
-
// -
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
| **
|
|
217
|
-
| **
|
|
218
|
-
| **
|
|
219
|
-
| **
|
|
220
|
-
| **
|
|
221
|
-
| **
|
|
222
|
-
| **
|
|
223
|
-
| **
|
|
224
|
-
| **
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
-
|
|
243
|
-
-
|
|
244
|
-
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
-
|
|
260
|
-
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
- **
|
|
270
|
-
- **
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
1
|
+
# DeepaData EDM SDK
|
|
2
|
+
|
|
3
|
+
The significance layer for AI memory.
|
|
4
|
+
|
|
5
|
+
> **Versioning:** SDK package semver is independent of the EDM schema
|
|
6
|
+
> version. The schema version this SDK emits is DERIVED from the
|
|
7
|
+
> installed `edm-spec` package (`src/version.ts`, `EDM_SCHEMA_VERSION`)
|
|
8
|
+
> and stamped into every artifact's `meta.version` — bumping the
|
|
9
|
+
> `edm-spec` dependency updates the stamp. An SDK version number never
|
|
10
|
+
> implies a schema version.
|
|
11
|
+
|
|
12
|
+
EDM artifacts encode what mattered at capture time — emotional weight, recall triggers, identity thread, arc type — so every memory architecture gets a richer signal to retrieve against.
|
|
13
|
+
|
|
14
|
+
## Why EDM
|
|
15
|
+
|
|
16
|
+
Most memory systems score relevance at retrieval time. EDM encodes significance at capture time.
|
|
17
|
+
|
|
18
|
+
The difference: a raw conversation chunk tells your retrieval system what was said. An EDM artifact tells it what mattered — and why it might matter again.
|
|
19
|
+
|
|
20
|
+
**What this enables:**
|
|
21
|
+
- Retrieve by emotional significance, not just semantic similarity
|
|
22
|
+
- Surface moments that keyword and vector search miss entirely
|
|
23
|
+
- Give memory platforms five retrieval axes instead of one
|
|
24
|
+
- Portable, governed artifacts that travel with the person across platforms
|
|
25
|
+
|
|
26
|
+
In a controlled retrieval comparison, EDM field routing outperformed raw vector similarity by 55.6 percentage points on significance-typed queries — the class of queries that have zero lexical overlap between the question and the answer. These queries require significance structure. Raw text cannot answer them.
|
|
27
|
+
|
|
28
|
+
The spec is MIT licensed and published on Zenodo. The SDK is the extraction layer.
|
|
29
|
+
|
|
30
|
+
## Installation
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npm install deepadata-edm-sdk
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Quick Start
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
import { extractFromContent, createStatelessArtifact, validateEDM } from 'deepadata-edm-sdk';
|
|
40
|
+
|
|
41
|
+
// Set your Anthropic API key
|
|
42
|
+
process.env.ANTHROPIC_API_KEY = 'your-api-key';
|
|
43
|
+
|
|
44
|
+
// Extract EDM artifact from content
|
|
45
|
+
const artifact = await extractFromContent({
|
|
46
|
+
content: {
|
|
47
|
+
text: "Looking at this old photograph brings back so many memories of summer afternoons at grandmother's house...",
|
|
48
|
+
},
|
|
49
|
+
metadata: {
|
|
50
|
+
subjectId: "vp-01HZ3GKWP7XTJY9QN4RD",
|
|
51
|
+
jurisdiction: "GDPR",
|
|
52
|
+
consentBasis: "consent",
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
// Validate the artifact
|
|
57
|
+
const validation = validateEDM(artifact);
|
|
58
|
+
if (!validation.valid) {
|
|
59
|
+
console.error('Validation errors:', validation.errors);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// For session use: create privacy-preserving stateless version
|
|
63
|
+
const stateless = createStatelessArtifact(artifact);
|
|
64
|
+
|
|
65
|
+
// The artifact is now ready for sealing with ddna-tools
|
|
66
|
+
console.log(JSON.stringify(artifact, null, 2));
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Features
|
|
70
|
+
|
|
71
|
+
- **LLM-Assisted Extraction**: Uses Claude, OpenAI, or Kimi to extract emotional data from text and images
|
|
72
|
+
- **EDM v0.7.0 Compliant**: Full support for all 10 EDM domains
|
|
73
|
+
- **Profile Support**: Essential (~20 fields), Extended (~45 fields), or Full (all fields)
|
|
74
|
+
- **Text + Image Fusion**: Combines text narrative with image context
|
|
75
|
+
- **Stateless Mode**: Privacy-preserving mode for session use
|
|
76
|
+
- **Schema Validation**: Comprehensive Zod-based validation
|
|
77
|
+
- **Crosswalk Mapping**: Automatic mapping to Plutchik and HMD taxonomies
|
|
78
|
+
|
|
79
|
+
## Profiles
|
|
80
|
+
|
|
81
|
+
EDM v0.7.0 introduces profile-aware extraction. Choose the profile that matches your use case:
|
|
82
|
+
|
|
83
|
+
| Profile | Fields | Use Case |
|
|
84
|
+
|---------|--------|----------|
|
|
85
|
+
| **essential** | ~20 | Memory platforms, agent frameworks, AI assistants |
|
|
86
|
+
| **extended** | ~45 | Journaling apps, companion AI, workplace wellness |
|
|
87
|
+
| **full** | all | Therapy tools, clinical applications, research |
|
|
88
|
+
|
|
89
|
+
```typescript
|
|
90
|
+
// Essential profile - minimal extraction
|
|
91
|
+
const artifact = await extractFromContent({
|
|
92
|
+
content: { text: "..." },
|
|
93
|
+
metadata: { consentBasis: "consent" },
|
|
94
|
+
profile: "essential",
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
// Extended profile - balanced extraction
|
|
98
|
+
const artifact = await extractFromContent({
|
|
99
|
+
content: { text: "..." },
|
|
100
|
+
metadata: { consentBasis: "consent" },
|
|
101
|
+
profile: "extended",
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
// Full profile - all fields (default)
|
|
105
|
+
const artifact = await extractFromContent({
|
|
106
|
+
content: { text: "..." },
|
|
107
|
+
metadata: { consentBasis: "consent" },
|
|
108
|
+
profile: "full",
|
|
109
|
+
});
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
See [examples/](examples/) for complete profile artifacts.
|
|
113
|
+
|
|
114
|
+
## API Reference
|
|
115
|
+
|
|
116
|
+
### Extraction
|
|
117
|
+
|
|
118
|
+
#### `extractFromContent(options)`
|
|
119
|
+
|
|
120
|
+
Extract a complete EDM artifact from content.
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
const artifact = await extractFromContent({
|
|
124
|
+
content: {
|
|
125
|
+
text: "User's narrative...",
|
|
126
|
+
image: "base64-encoded-image", // optional
|
|
127
|
+
imageMediaType: "image/jpeg", // optional
|
|
128
|
+
},
|
|
129
|
+
metadata: {
|
|
130
|
+
subjectId: "vp-01HZ3GKWP7XTJY9QN4RD", // optional, null in stateless
|
|
131
|
+
jurisdiction: "GDPR", // optional
|
|
132
|
+
consentBasis: "consent", // required
|
|
133
|
+
locale: "en-us", // optional
|
|
134
|
+
visibility: "private", // optional
|
|
135
|
+
piiTier: "moderate", // optional
|
|
136
|
+
tags: ["family", "memory"], // optional
|
|
137
|
+
},
|
|
138
|
+
model: "claude-sonnet-4-20250514", // optional
|
|
139
|
+
provider: "anthropic", // optional: "anthropic" | "openai" | "kimi"
|
|
140
|
+
profile: "full", // optional: "essential" | "extended" | "full"
|
|
141
|
+
});
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
#### `extractFromContentWithClient(client, options)`
|
|
145
|
+
|
|
146
|
+
Same as above but with a provided Anthropic client.
|
|
147
|
+
|
|
148
|
+
### Stateless Mode
|
|
149
|
+
|
|
150
|
+
#### `createStatelessArtifact(artifact)`
|
|
151
|
+
|
|
152
|
+
Create a privacy-preserving version for session use.
|
|
153
|
+
|
|
154
|
+
```typescript
|
|
155
|
+
const stateless = createStatelessArtifact(artifact);
|
|
156
|
+
// - owner_user_id: null
|
|
157
|
+
// - associated_people: []
|
|
158
|
+
// - location_context: null
|
|
159
|
+
// - recall_triggers: []
|
|
160
|
+
// - retrieval_keys: []
|
|
161
|
+
// - exportability: "restricted"
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
#### `isStateless(artifact)`
|
|
165
|
+
|
|
166
|
+
Check if an artifact is in stateless mode.
|
|
167
|
+
|
|
168
|
+
#### `validateStateless(artifact)`
|
|
169
|
+
|
|
170
|
+
Validate stateless compliance with detailed violations.
|
|
171
|
+
|
|
172
|
+
### Validation
|
|
173
|
+
|
|
174
|
+
#### `validateEDM(artifact)`
|
|
175
|
+
|
|
176
|
+
Validate against the complete EDM v0.7.0 schema.
|
|
177
|
+
|
|
178
|
+
```typescript
|
|
179
|
+
const result = validateEDM(artifact);
|
|
180
|
+
// { valid: boolean, errors: ValidationError[] }
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
#### `validateDomain(domain, data)`
|
|
184
|
+
|
|
185
|
+
Validate a specific domain.
|
|
186
|
+
|
|
187
|
+
```typescript
|
|
188
|
+
const result = validateDomain("constellation", artifact.constellation);
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
#### `validateCompleteness(artifact)`
|
|
192
|
+
|
|
193
|
+
Check field population and completeness.
|
|
194
|
+
|
|
195
|
+
```typescript
|
|
196
|
+
const result = validateCompleteness(artifact);
|
|
197
|
+
// { complete: boolean, missingFields: string[], populationRate: number }
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### Helpers
|
|
201
|
+
|
|
202
|
+
#### `createEmptyArtifact()`
|
|
203
|
+
|
|
204
|
+
Create an empty artifact structure for manual population.
|
|
205
|
+
|
|
206
|
+
#### `createAnthropicClient(apiKey?)`
|
|
207
|
+
|
|
208
|
+
Create an Anthropic client (uses `ANTHROPIC_API_KEY` env var if not provided).
|
|
209
|
+
|
|
210
|
+
## EDM v0.7.0 Domains
|
|
211
|
+
|
|
212
|
+
The SDK supports all 10 EDM domains:
|
|
213
|
+
|
|
214
|
+
| Domain | Description | Extraction |
|
|
215
|
+
|--------|-------------|------------|
|
|
216
|
+
| **meta** | Identity, provenance, consent | From metadata |
|
|
217
|
+
| **core** | Anchor, spark, wound, fuel, bridge, echo, narrative | LLM |
|
|
218
|
+
| **constellation** | Emotional classification, archetypes | LLM |
|
|
219
|
+
| **milky_way** | Contextual grounding (people, place, event) | LLM |
|
|
220
|
+
| **gravity** | Salience, weight, retrieval keys | LLM |
|
|
221
|
+
| **impulse** | Motivational state, drive, coping | LLM |
|
|
222
|
+
| **governance** | Jurisdiction, retention, rights | From metadata |
|
|
223
|
+
| **telemetry** | Extraction confidence, model ID | Auto-populated |
|
|
224
|
+
| **system** | Embeddings, indices (downstream) | Empty |
|
|
225
|
+
| **crosswalks** | External taxonomy mappings | Auto-mapped |
|
|
226
|
+
|
|
227
|
+
## Integration with ddna-tools
|
|
228
|
+
|
|
229
|
+
After extraction, seal the artifact for portability:
|
|
230
|
+
|
|
231
|
+
```typescript
|
|
232
|
+
import { seal } from 'deepadata-ddna-tools';
|
|
233
|
+
|
|
234
|
+
const envelope = await seal(artifact, privateKey, did);
|
|
235
|
+
// Result: signed .ddna envelope
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
## Interpretation Boundary
|
|
239
|
+
|
|
240
|
+
This SDK performs **extraction, not inference**. The LLM extracts what is explicitly stated or clearly implied in the source content. It does not:
|
|
241
|
+
|
|
242
|
+
- Infer psychological states beyond stated emotions
|
|
243
|
+
- Diagnose conditions or suggest treatments
|
|
244
|
+
- Make predictions about future behavior
|
|
245
|
+
- Generate content not grounded in the input
|
|
246
|
+
|
|
247
|
+
See [docs/EXTRACTION_VS_INFERENCE.md](docs/EXTRACTION_VS_INFERENCE.md) for details.
|
|
248
|
+
|
|
249
|
+
## EU AI Act Compliance
|
|
250
|
+
|
|
251
|
+
This SDK is designed for compliance with the EU AI Act. Emotional data extraction with interpretation constraints is considered lower risk than emotion inference systems. See [docs/EU_AI_ACT_COMPLIANCE.md](docs/EU_AI_ACT_COMPLIANCE.md).
|
|
252
|
+
|
|
253
|
+
## Schema Version
|
|
254
|
+
|
|
255
|
+
The EDM schema version this SDK implements and stamps is the installed
|
|
256
|
+
`edm-spec` package version, derived at module load in `src/version.ts` —
|
|
257
|
+
never hardcoded. Historical: key changes introduced at EDM v0.7.0 from v0.6:
|
|
258
|
+
|
|
259
|
+
- Added `meta.profile` field for conformance level declaration
|
|
260
|
+
- Profile-aware extraction with tailored system prompts
|
|
261
|
+
- Profile-aware confidence scoring
|
|
262
|
+
- Three conformance profiles: essential (24 fields), extended (50 fields), full (96 fields)
|
|
263
|
+
- Added Kimi K2 extractor support via MoonshotAI API
|
|
264
|
+
|
|
265
|
+
## Works With Your Memory Stack
|
|
266
|
+
|
|
267
|
+
EDM artifacts are format-agnostic episodic memory records. The structured fields integrate naturally with the retrieval infrastructure you already use:
|
|
268
|
+
|
|
269
|
+
- **Embedding-based retrieval** — embed core.narrative for semantic similarity search against any vector store
|
|
270
|
+
- **Temporal knowledge graphs** — map associated_people and tether_type as graph nodes and edges; temporal_context and recurrence_pattern as edge properties
|
|
271
|
+
- **Lexical search (BM25)** — recall_triggers and retrieval_keys are designed for activation-path matching against conversation fragments
|
|
272
|
+
- **Hybrid retrieval** — combine any of the above; EDM fields give each axis a significance-weighted signal rather than raw text
|
|
273
|
+
- **Significance activation** — the DeepaData activation API returns ranked artifact IDs for the current conversation moment (deepadata.com/docs/activation)
|
|
274
|
+
|
|
275
|
+
EDM encodes the episodic layer. The retrieval architecture is yours.
|
|
276
|
+
|
|
277
|
+
See deepadata.com/docs for integration guides.
|
|
278
|
+
|
|
279
|
+
## License
|
|
280
|
+
|
|
281
|
+
MIT
|
package/dist/assembler.d.ts
CHANGED
|
@@ -8,24 +8,33 @@ import Anthropic from "@anthropic-ai/sdk";
|
|
|
8
8
|
import type { EdmArtifact, ExtractionOptions, LlmExtractedFields, EdmProfile, PartnerProfileId } from "./schema/types.js";
|
|
9
9
|
import { type ConversationMessage, type ChunkConversationOptions } from "./conversation.js";
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* PROFILE MANIFESTS — GUARDED RESTATEMENT of the spec composites.
|
|
12
|
+
*
|
|
13
|
+
* Field membership per profile is defined by the edm-spec composite
|
|
14
|
+
* schemas (edm.v0.8.{essential,extended,full}.schema.json in the installed
|
|
15
|
+
* `edm-spec` package). These literal manifests restate the composites'
|
|
16
|
+
* property sets so the arrays keep literal-union TypeScript types and a
|
|
17
|
+
* stable filter order; tests/spec-drift-guard.test.ts asserts exact set
|
|
18
|
+
* equality with the composites in both directions and fails `npm test`
|
|
19
|
+
* loudly on any drift (tidy-the-house commitment, ADR-0030).
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Essential Profile: 5 domains
|
|
12
23
|
* Target: memory platforms, agent frameworks, AI assistants
|
|
24
|
+
* Field membership = the spec essential composite (drift-guarded).
|
|
13
25
|
*/
|
|
14
26
|
export declare const ESSENTIAL_PROFILE_FIELDS: {
|
|
15
27
|
readonly meta: readonly ["id", "version", "profile", "created_at", "updated_at", "locale", "owner_user_id", "parent_id", "visibility", "pii_tier", "consent_basis"];
|
|
16
28
|
readonly core: readonly ["anchor", "spark", "wound", "fuel", "bridge", "echo"];
|
|
17
29
|
readonly constellation: readonly ["emotion_primary", "emotion_subtone", "narrative_arc"];
|
|
18
|
-
readonly governance: readonly ["jurisdiction", "retention_policy", "subject_rights"];
|
|
19
|
-
readonly telemetry: readonly ["entry_confidence", "extraction_model"];
|
|
30
|
+
readonly governance: readonly ["jurisdiction", "retention_policy", "subject_rights", "exportability", "k_anonymity", "policy_labels", "masking_rules"];
|
|
31
|
+
readonly telemetry: readonly ["entry_confidence", "extraction_model", "extraction_provider", "extraction_notes"];
|
|
20
32
|
};
|
|
21
33
|
/**
|
|
22
|
-
* Extended Profile:
|
|
23
|
-
* Target: journaling apps, companion AI, workplace wellness
|
|
24
|
-
*/
|
|
25
|
-
/**
|
|
26
|
-
* Extended Profile: 7 domains, 50 fields
|
|
34
|
+
* Extended Profile: 7 domains
|
|
27
35
|
* Target: journaling apps, companion AI, workplace wellness
|
|
28
36
|
* Impulse domain is NOT included in Extended profile
|
|
37
|
+
* Field membership = the spec extended composite (drift-guarded).
|
|
29
38
|
*/
|
|
30
39
|
export declare const EXTENDED_PROFILE_FIELDS: {
|
|
31
40
|
readonly meta: readonly ["id", "version", "profile", "created_at", "updated_at", "locale", "owner_user_id", "parent_id", "visibility", "pii_tier", "source_type", "source_context", "consent_basis", "consent_scope", "tags"];
|
|
@@ -33,15 +42,16 @@ export declare const EXTENDED_PROFILE_FIELDS: {
|
|
|
33
42
|
readonly constellation: readonly ["emotion_primary", "emotion_subtone", "higher_order_emotion", "meta_emotional_state", "interpersonal_affect", "narrative_arc", "relational_dynamics", "temporal_context", "memory_type", "media_format", "narrative_archetype", "symbolic_anchor", "relational_perspective", "temporal_rhythm", "identity_thread", "expressed_insight", "transformational_pivot", "somatic_signature", "arc_type"];
|
|
34
43
|
readonly milky_way: readonly ["event_type", "location_context", "associated_people", "visibility_context", "tone_shift"];
|
|
35
44
|
readonly gravity: readonly ["emotional_weight", "valence", "tether_type", "recurrence_pattern", "strength_score"];
|
|
36
|
-
readonly governance: readonly ["jurisdiction", "retention_policy", "subject_rights"];
|
|
37
|
-
readonly telemetry: readonly ["entry_confidence", "extraction_model"];
|
|
45
|
+
readonly governance: readonly ["jurisdiction", "retention_policy", "subject_rights", "exportability", "k_anonymity", "policy_labels", "masking_rules"];
|
|
46
|
+
readonly telemetry: readonly ["entry_confidence", "extraction_model", "extraction_provider", "extraction_notes"];
|
|
38
47
|
};
|
|
39
48
|
/**
|
|
40
49
|
* Full Profile: all 10 domains, all fields
|
|
41
50
|
* Target: therapy platforms, clinical tools, regulated systems
|
|
51
|
+
* Field membership = the spec full composite (drift-guarded).
|
|
42
52
|
*/
|
|
43
53
|
export declare const FULL_PROFILE_FIELDS: {
|
|
44
|
-
readonly meta: readonly ["id", "version", "profile", "created_at", "updated_at", "locale", "owner_user_id", "parent_id", "visibility", "pii_tier", "source_type", "source_context", "consent_basis", "consent_scope", "consent_revoked_at", "tags"];
|
|
54
|
+
readonly meta: readonly ["id", "version", "profile", "created_at", "source_timestamp", "updated_at", "locale", "owner_user_id", "parent_id", "visibility", "pii_tier", "source_type", "source_context", "consent_basis", "consent_scope", "consent_revoked_at", "tags"];
|
|
45
55
|
readonly core: readonly ["anchor", "spark", "wound", "fuel", "bridge", "echo", "narrative"];
|
|
46
56
|
readonly constellation: readonly ["emotion_primary", "emotion_subtone", "higher_order_emotion", "meta_emotional_state", "interpersonal_affect", "narrative_arc", "relational_dynamics", "temporal_context", "memory_type", "media_format", "narrative_archetype", "symbolic_anchor", "relational_perspective", "temporal_rhythm", "identity_thread", "expressed_insight", "transformational_pivot", "somatic_signature", "arc_type"];
|
|
47
57
|
readonly milky_way: readonly ["event_type", "location_context", "associated_people", "visibility_context", "tone_shift"];
|
|
@@ -111,7 +121,7 @@ export interface ConversationChunkArtifact {
|
|
|
111
121
|
* extracted as a conversation input (framed, subject-anchored, stance-guarded),
|
|
112
122
|
* and chunks after the first are threaded to the first chunk's artifact via
|
|
113
123
|
* metadata.parentId. meta.parent_id is defined in ALL profile schemas
|
|
114
|
-
* (essential, extended, full) per the published v0.8
|
|
124
|
+
* (essential, extended, full) per the published v0.8-line schema set, so the
|
|
115
125
|
* linkage appears in the artifact body for every profile — populated for
|
|
116
126
|
* chunks past the first, explicit null otherwise (whitepaper §5.2 No
|
|
117
127
|
* Omission). Short conversations produce exactly one artifact.
|