@popmelt.com/core 0.8.3 → 0.8.5
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/THIRD_PARTY_NOTICES.md +51 -0
- package/dist/bridge-entry.mjs +115 -299
- package/dist/canvas.mjs +1 -1
- package/dist/chunk-AK32Z7EA.mjs +1 -0
- package/dist/chunk-NOHXTT24.mjs +1 -0
- package/dist/cli.mjs +115 -299
- package/dist/dev-server-rQIWJcSX.d.mts +26 -0
- package/dist/index.d.mts +14 -9
- package/dist/index.mjs +112 -40
- package/dist/memory-legacy.d.mts +446 -0
- package/dist/memory-legacy.mjs +1 -0
- package/dist/memory-store.d.mts +1048 -0
- package/dist/memory-store.mjs +3 -0
- package/dist/memory.d.mts +662 -0
- package/dist/memory.mjs +1 -0
- package/dist/plugin-astro.d.mts +8 -7
- package/dist/plugin-astro.mjs +1 -1
- package/dist/plugin-next.mjs +1 -1
- package/dist/plugin-vite.d.mts +4 -7
- package/dist/plugin-vite.mjs +1 -1
- package/dist/server-AQ4RRAIQ.mjs +241 -0
- package/dist/server.d.mts +274 -3
- package/dist/server.mjs +118 -298
- package/package.json +36 -6
- package/dist/server-2X6UD5RQ.mjs +0 -421
|
@@ -0,0 +1,662 @@
|
|
|
1
|
+
declare const MEMORY_FORMAT_VERSION: 1;
|
|
2
|
+
declare const MEMORY_SCHEMA_VERSION: 1;
|
|
3
|
+
type MemoryFormatVersion = typeof MEMORY_FORMAT_VERSION;
|
|
4
|
+
type MemorySchemaVersion = typeof MEMORY_SCHEMA_VERSION;
|
|
5
|
+
type MemoryId = string;
|
|
6
|
+
type Timestamp = string;
|
|
7
|
+
type JsonPrimitive = string | number | boolean | null;
|
|
8
|
+
type JsonValue = JsonPrimitive | JsonValue[] | {
|
|
9
|
+
[key: string]: JsonValue;
|
|
10
|
+
};
|
|
11
|
+
type SourceReferenceKind = 'thread' | 'message' | 'iteration' | 'artifact' | 'event' | 'record' | 'external';
|
|
12
|
+
type SourceReference = {
|
|
13
|
+
kind: SourceReferenceKind;
|
|
14
|
+
id: string;
|
|
15
|
+
uri?: string;
|
|
16
|
+
excerpt?: string;
|
|
17
|
+
};
|
|
18
|
+
type Provenance = {
|
|
19
|
+
id: MemoryId;
|
|
20
|
+
schemaVersion: MemorySchemaVersion;
|
|
21
|
+
projectId: MemoryId;
|
|
22
|
+
createdAt: Timestamp;
|
|
23
|
+
participantId: MemoryId;
|
|
24
|
+
sourceRefs: SourceReference[];
|
|
25
|
+
};
|
|
26
|
+
type ParticipantKind = 'human' | 'ai' | 'system' | 'integration';
|
|
27
|
+
type AuthorityLevel = 'owner' | 'delegate' | 'contributor';
|
|
28
|
+
type AuthorityMode = 'local_trusted' | 'hosted';
|
|
29
|
+
type ExecutionContext = {
|
|
30
|
+
sessionId?: string;
|
|
31
|
+
provider?: string;
|
|
32
|
+
model?: string;
|
|
33
|
+
deviceId?: string;
|
|
34
|
+
mode?: string;
|
|
35
|
+
};
|
|
36
|
+
type AuthorityContext = {
|
|
37
|
+
level: AuthorityLevel;
|
|
38
|
+
mode: AuthorityMode;
|
|
39
|
+
grantId?: MemoryId;
|
|
40
|
+
authenticatedAt?: Timestamp;
|
|
41
|
+
};
|
|
42
|
+
type ParticipantRecord = Provenance & {
|
|
43
|
+
recordType: 'participant';
|
|
44
|
+
kind: ParticipantKind;
|
|
45
|
+
displayName: string;
|
|
46
|
+
status: 'active' | 'disabled';
|
|
47
|
+
};
|
|
48
|
+
type AuthorityGrantRecord = Provenance & {
|
|
49
|
+
recordType: 'authority_grant';
|
|
50
|
+
granteeId: MemoryId;
|
|
51
|
+
level: AuthorityLevel;
|
|
52
|
+
grantedById: MemoryId;
|
|
53
|
+
subjectIds: MemoryId[];
|
|
54
|
+
startsAt: Timestamp;
|
|
55
|
+
endsAt?: Timestamp;
|
|
56
|
+
revokedAt?: Timestamp;
|
|
57
|
+
};
|
|
58
|
+
type SubjectType = 'project' | 'file' | 'route' | 'component' | 'element' | 'token' | 'interaction';
|
|
59
|
+
type SubjectLocatorKind = 'project_root' | 'source_file' | 'route_pattern' | 'file_export' | 'source_span' | 'dom_selector' | 'token_path' | 'interaction_key' | 'custom';
|
|
60
|
+
type SubjectLocator = {
|
|
61
|
+
id: MemoryId;
|
|
62
|
+
kind: SubjectLocatorKind;
|
|
63
|
+
value: string;
|
|
64
|
+
status: 'current' | 'historical' | 'unresolved';
|
|
65
|
+
validFrom: Timestamp;
|
|
66
|
+
validUntil?: Timestamp;
|
|
67
|
+
sourceRefs: SourceReference[];
|
|
68
|
+
};
|
|
69
|
+
type SubjectRecord = Provenance & {
|
|
70
|
+
recordType: 'subject';
|
|
71
|
+
subjectType: SubjectType;
|
|
72
|
+
label: string;
|
|
73
|
+
aliases: string[];
|
|
74
|
+
locators: SubjectLocator[];
|
|
75
|
+
};
|
|
76
|
+
type ParticipantStance = {
|
|
77
|
+
stance: 'supports' | 'opposes' | 'uncertain' | 'needs_evidence';
|
|
78
|
+
reason?: string;
|
|
79
|
+
};
|
|
80
|
+
type CaptureContext = {
|
|
81
|
+
route?: string;
|
|
82
|
+
subjectIds: MemoryId[];
|
|
83
|
+
artifactIds: MemoryId[];
|
|
84
|
+
};
|
|
85
|
+
type ObservationState = 'open' | 'resolved' | 'dismissed';
|
|
86
|
+
type ObservationRecord = Provenance & {
|
|
87
|
+
recordType: 'observation';
|
|
88
|
+
state: ObservationState;
|
|
89
|
+
statement: string;
|
|
90
|
+
captureContext: CaptureContext;
|
|
91
|
+
stance?: ParticipantStance;
|
|
92
|
+
resolvedByIds: MemoryId[];
|
|
93
|
+
};
|
|
94
|
+
type DecisionKind = 'principle' | 'preference' | 'rule' | 'constraint';
|
|
95
|
+
type ProposalState = 'draft' | 'pending' | 'accepted' | 'rejected' | 'withdrawn' | 'deferred';
|
|
96
|
+
type AssertionOrigin = {
|
|
97
|
+
mode: 'declared' | 'inferred';
|
|
98
|
+
sourceText?: string;
|
|
99
|
+
iterationId?: MemoryId;
|
|
100
|
+
inferredById?: MemoryId;
|
|
101
|
+
reviewedById?: MemoryId;
|
|
102
|
+
};
|
|
103
|
+
type DecisionSubject = {
|
|
104
|
+
subjectId: MemoryId;
|
|
105
|
+
role: 'governed' | 'consumer' | 'provider' | 'context';
|
|
106
|
+
};
|
|
107
|
+
type ProposalRecord = Provenance & {
|
|
108
|
+
recordType: 'proposal';
|
|
109
|
+
state: ProposalState;
|
|
110
|
+
claim: string;
|
|
111
|
+
rationale?: string;
|
|
112
|
+
proposedKind?: DecisionKind;
|
|
113
|
+
subjects: DecisionSubject[];
|
|
114
|
+
subjectSemantics?: string;
|
|
115
|
+
origin: AssertionOrigin;
|
|
116
|
+
stance?: ParticipantStance;
|
|
117
|
+
bundleId?: MemoryId;
|
|
118
|
+
};
|
|
119
|
+
type DecisionState = 'active' | 'superseded' | 'revoked';
|
|
120
|
+
type DecisionRecord = Provenance & {
|
|
121
|
+
recordType: 'decision';
|
|
122
|
+
proposalId: MemoryId;
|
|
123
|
+
acceptanceEventId: MemoryId;
|
|
124
|
+
acceptedById: MemoryId;
|
|
125
|
+
authority: AuthorityContext;
|
|
126
|
+
state: DecisionState;
|
|
127
|
+
kind: DecisionKind;
|
|
128
|
+
claim: string;
|
|
129
|
+
rationale?: string;
|
|
130
|
+
subjects: DecisionSubject[];
|
|
131
|
+
subjectSemantics?: string;
|
|
132
|
+
noChange: boolean;
|
|
133
|
+
effectiveAt?: Timestamp;
|
|
134
|
+
effectiveMilestone?: string;
|
|
135
|
+
bundleId?: MemoryId;
|
|
136
|
+
};
|
|
137
|
+
type ThreadOutcome = 'decision_created' | 'proposal_rejected' | 'observation_resolved' | 'observation_dismissed' | 'question_unresolved' | 'implementation_only' | 'no_outcome';
|
|
138
|
+
type ThreadRecord = Provenance & {
|
|
139
|
+
recordType: 'thread';
|
|
140
|
+
title?: string;
|
|
141
|
+
state: 'open' | 'resolved';
|
|
142
|
+
messageArtifactIds: MemoryId[];
|
|
143
|
+
outcome: ThreadOutcome;
|
|
144
|
+
resultRefs: EntityReference[];
|
|
145
|
+
};
|
|
146
|
+
type IterationOutcome = 'completed' | 'cancelled' | 'question_asked' | 'failed' | 'no_change';
|
|
147
|
+
type IterationRecord = Provenance & {
|
|
148
|
+
recordType: 'iteration';
|
|
149
|
+
threadIds: MemoryId[];
|
|
150
|
+
startedAt: Timestamp;
|
|
151
|
+
completedAt?: Timestamp;
|
|
152
|
+
requestSummary: string;
|
|
153
|
+
responseSummary?: string;
|
|
154
|
+
outcome: IterationOutcome;
|
|
155
|
+
execution: ExecutionContext;
|
|
156
|
+
artifactIds: MemoryId[];
|
|
157
|
+
};
|
|
158
|
+
type EvidenceKind = 'judgment' | 'artifact' | 'eval' | 'log' | 'user_feedback' | 'external_source' | 'project_state';
|
|
159
|
+
type EvidenceRecord = Provenance & {
|
|
160
|
+
recordType: 'evidence';
|
|
161
|
+
kind: EvidenceKind;
|
|
162
|
+
summary: string;
|
|
163
|
+
availability: 'available' | 'missing' | 'redacted' | 'forgotten';
|
|
164
|
+
stance?: ParticipantStance;
|
|
165
|
+
artifactIds: MemoryId[];
|
|
166
|
+
};
|
|
167
|
+
type CoverageClaim = {
|
|
168
|
+
decisionId: MemoryId;
|
|
169
|
+
coverage: 'partial' | 'full';
|
|
170
|
+
claim: string;
|
|
171
|
+
sourceRefs: SourceReference[];
|
|
172
|
+
};
|
|
173
|
+
type ImplementationState = 'planned' | 'in_progress' | 'completed' | 'failed' | 'abandoned';
|
|
174
|
+
type ImplementationAttemptRecord = Provenance & {
|
|
175
|
+
recordType: 'implementation_attempt';
|
|
176
|
+
state: ImplementationState;
|
|
177
|
+
iterationIds: MemoryId[];
|
|
178
|
+
coverageClaims: CoverageClaim[];
|
|
179
|
+
projectStateRef?: SourceReference;
|
|
180
|
+
summary: string;
|
|
181
|
+
artifactIds: MemoryId[];
|
|
182
|
+
};
|
|
183
|
+
type VerificationState = 'queued' | 'running' | 'passed' | 'failed' | 'inconclusive' | 'error' | 'cancelled';
|
|
184
|
+
type VerificationTarget = {
|
|
185
|
+
entityType: 'decision' | 'implementation_attempt' | 'model_entry';
|
|
186
|
+
entityId: MemoryId;
|
|
187
|
+
};
|
|
188
|
+
type EvalSpecState = 'draft' | 'active' | 'retired';
|
|
189
|
+
type EvalDependency = {
|
|
190
|
+
kind: 'model_path' | 'source_file' | 'route' | 'subject';
|
|
191
|
+
value: string;
|
|
192
|
+
subjectId?: MemoryId;
|
|
193
|
+
};
|
|
194
|
+
type EvalScenario = {
|
|
195
|
+
id: string;
|
|
196
|
+
label?: string;
|
|
197
|
+
route?: string;
|
|
198
|
+
routePattern?: string;
|
|
199
|
+
components?: Array<{
|
|
200
|
+
name: string;
|
|
201
|
+
sourceFile?: string;
|
|
202
|
+
exportName?: string;
|
|
203
|
+
}>;
|
|
204
|
+
subjectIds?: MemoryId[];
|
|
205
|
+
states?: Array<{
|
|
206
|
+
kind: 'viewport' | 'theme' | 'auth' | 'locale' | 'feature_flag' | 'fixture' | 'interaction' | 'custom';
|
|
207
|
+
key?: string;
|
|
208
|
+
value: string;
|
|
209
|
+
}>;
|
|
210
|
+
steps?: Array<{
|
|
211
|
+
action: 'navigate' | 'click' | 'type' | 'select';
|
|
212
|
+
target?: string;
|
|
213
|
+
value?: string;
|
|
214
|
+
}>;
|
|
215
|
+
};
|
|
216
|
+
type EvalSpecRecord = Provenance & {
|
|
217
|
+
recordType: 'eval_spec';
|
|
218
|
+
state: EvalSpecState;
|
|
219
|
+
legacyId: string;
|
|
220
|
+
replacesSpecId?: MemoryId;
|
|
221
|
+
title: string;
|
|
222
|
+
category: 'component' | 'layout' | 'copy' | 'interaction' | 'visual' | 'workflow';
|
|
223
|
+
prompt: string;
|
|
224
|
+
assertions: string[];
|
|
225
|
+
rationale: string;
|
|
226
|
+
decisionIds: MemoryId[];
|
|
227
|
+
subjectIds: MemoryId[];
|
|
228
|
+
threadRefs: string[];
|
|
229
|
+
dependencies?: EvalDependency[];
|
|
230
|
+
scenarios?: EvalScenario[];
|
|
231
|
+
targets: VerificationTarget[];
|
|
232
|
+
evaluator: {
|
|
233
|
+
kind: 'human' | 'ai' | 'test' | 'external';
|
|
234
|
+
name: string;
|
|
235
|
+
evidenceTypes: string[];
|
|
236
|
+
};
|
|
237
|
+
scope: {
|
|
238
|
+
kind: 'current_page' | 'project' | 'subject';
|
|
239
|
+
route?: string;
|
|
240
|
+
};
|
|
241
|
+
};
|
|
242
|
+
type VerificationAttemptRecord = Provenance & {
|
|
243
|
+
recordType: 'verification_attempt';
|
|
244
|
+
evalSpecId?: MemoryId;
|
|
245
|
+
scopeFingerprint?: string;
|
|
246
|
+
state: VerificationState;
|
|
247
|
+
evaluator: {
|
|
248
|
+
kind: 'human' | 'ai' | 'test' | 'eval' | 'external';
|
|
249
|
+
participantId?: MemoryId;
|
|
250
|
+
name: string;
|
|
251
|
+
};
|
|
252
|
+
targets: VerificationTarget[];
|
|
253
|
+
summary?: string;
|
|
254
|
+
evidenceIds: MemoryId[];
|
|
255
|
+
/** Compact presentation data for an eval run; raw output remains an artifact/thread detail. */
|
|
256
|
+
evalRun?: {
|
|
257
|
+
id: string;
|
|
258
|
+
threadId?: string;
|
|
259
|
+
createdAt: number;
|
|
260
|
+
completedAt: number;
|
|
261
|
+
durationMs: number;
|
|
262
|
+
scope: {
|
|
263
|
+
type: 'current_page';
|
|
264
|
+
url: string;
|
|
265
|
+
viewport: {
|
|
266
|
+
width: number;
|
|
267
|
+
height: number;
|
|
268
|
+
};
|
|
269
|
+
};
|
|
270
|
+
assertionResults: Array<{
|
|
271
|
+
assertion: string;
|
|
272
|
+
status: 'pass' | 'fail' | 'needs_review';
|
|
273
|
+
summary: string;
|
|
274
|
+
evidence: string[];
|
|
275
|
+
}>;
|
|
276
|
+
tooling: {
|
|
277
|
+
chromeDevtools: 'available' | 'unavailable' | 'unknown';
|
|
278
|
+
evidenceTypes: string[];
|
|
279
|
+
};
|
|
280
|
+
provider?: string;
|
|
281
|
+
model?: string;
|
|
282
|
+
screenshotPath?: string;
|
|
283
|
+
codeFingerprint?: string;
|
|
284
|
+
};
|
|
285
|
+
};
|
|
286
|
+
type ModelEntryRecord = Provenance & {
|
|
287
|
+
recordType: 'model_entry';
|
|
288
|
+
key: string;
|
|
289
|
+
subjectIds: MemoryId[];
|
|
290
|
+
decisionIds: MemoryId[];
|
|
291
|
+
value: JsonValue;
|
|
292
|
+
};
|
|
293
|
+
type ModelProjectionRecord = Provenance & {
|
|
294
|
+
recordType: 'model_projection';
|
|
295
|
+
state: 'applied';
|
|
296
|
+
runId: string;
|
|
297
|
+
presentationJobId?: string;
|
|
298
|
+
appliedById: MemoryId;
|
|
299
|
+
authority: AuthorityContext;
|
|
300
|
+
appliedAt: Timestamp;
|
|
301
|
+
decisionIds: MemoryId[];
|
|
302
|
+
entryIds: MemoryId[];
|
|
303
|
+
coverage: Array<{
|
|
304
|
+
decisionId: MemoryId;
|
|
305
|
+
status: 'unprojected' | 'partially_projected' | 'projected' | 'stale';
|
|
306
|
+
}>;
|
|
307
|
+
};
|
|
308
|
+
type EntityType = 'participant' | 'authority_grant' | 'subject' | 'observation' | 'proposal' | 'decision' | 'thread' | 'iteration' | 'evidence' | 'implementation_attempt' | 'eval_spec' | 'verification_attempt' | 'model_entry' | 'model_projection' | 'freshness_signal';
|
|
309
|
+
type MemoryObjectType = EntityType | 'relationship' | 'lifecycle_event' | 'artifact';
|
|
310
|
+
type EntityReference = {
|
|
311
|
+
entityType: EntityType;
|
|
312
|
+
entityId: MemoryId;
|
|
313
|
+
};
|
|
314
|
+
type RelationshipType = 'supports' | 'contradicts' | 'supersedes' | 'excepts' | 'duplicates' | 'implements' | 'verifies' | 'replaces' | 'derived_from';
|
|
315
|
+
type RelationshipRecord = Provenance & {
|
|
316
|
+
recordType: 'relationship';
|
|
317
|
+
relationshipType: RelationshipType;
|
|
318
|
+
from: EntityReference;
|
|
319
|
+
to: EntityReference;
|
|
320
|
+
reason: string;
|
|
321
|
+
authority?: AuthorityContext;
|
|
322
|
+
};
|
|
323
|
+
type FreshnessSignalType = 'subject_unresolved' | 'implementation_drift' | 'evidence_unavailable' | 'new_conflict' | 'verification_expired' | 'review_interval_elapsed' | 'schema_or_tooling_change';
|
|
324
|
+
type FreshnessTargetKind = 'subject_locator' | 'implementation_presence' | 'verification_result' | 'model_coverage' | 'evidence_reference' | 'decision_applicability';
|
|
325
|
+
type FreshnessSignalRecord = Provenance & {
|
|
326
|
+
recordType: 'freshness_signal';
|
|
327
|
+
signalType: FreshnessSignalType;
|
|
328
|
+
state: 'open' | 'resolved';
|
|
329
|
+
targetKind: FreshnessTargetKind;
|
|
330
|
+
target: EntityReference;
|
|
331
|
+
reason: string;
|
|
332
|
+
evidenceIds: MemoryId[];
|
|
333
|
+
resolvedAt?: Timestamp;
|
|
334
|
+
resolvedByEventId?: MemoryId;
|
|
335
|
+
};
|
|
336
|
+
type ProposalDeferralContext = {
|
|
337
|
+
kind: 'proposal_deferral';
|
|
338
|
+
taskContext?: string;
|
|
339
|
+
subjectIds: MemoryId[];
|
|
340
|
+
resurfaceWhen: Array<'different_action' | 'new_evidence' | 'new_conflict' | 'owner_request' | 'after_date'>;
|
|
341
|
+
revisitAfter?: Timestamp;
|
|
342
|
+
};
|
|
343
|
+
type LifecycleEvent = Provenance & {
|
|
344
|
+
recordType: 'lifecycle_event';
|
|
345
|
+
entity: EntityReference;
|
|
346
|
+
eventType: string;
|
|
347
|
+
fromState: string | null;
|
|
348
|
+
toState: string;
|
|
349
|
+
authority: AuthorityContext;
|
|
350
|
+
execution?: ExecutionContext;
|
|
351
|
+
reason?: string;
|
|
352
|
+
transitionContext?: ProposalDeferralContext;
|
|
353
|
+
};
|
|
354
|
+
type ArtifactKind = 'message' | 'screenshot' | 'image' | 'diff' | 'file_snapshot' | 'log' | 'eval_output' | 'external_document' | 'other';
|
|
355
|
+
type ArtifactManifestEntry = {
|
|
356
|
+
id: MemoryId;
|
|
357
|
+
kind: ArtifactKind;
|
|
358
|
+
mediaType?: string;
|
|
359
|
+
byteSize?: number;
|
|
360
|
+
contentHash?: string;
|
|
361
|
+
location?: string;
|
|
362
|
+
availability: 'available' | 'missing' | 'redacted' | 'forgotten';
|
|
363
|
+
};
|
|
364
|
+
type Tombstone = {
|
|
365
|
+
id: MemoryId;
|
|
366
|
+
schemaVersion: MemorySchemaVersion;
|
|
367
|
+
projectId: MemoryId;
|
|
368
|
+
objectId: MemoryId;
|
|
369
|
+
objectType: MemoryObjectType;
|
|
370
|
+
deletedAt: Timestamp;
|
|
371
|
+
deletedById: MemoryId;
|
|
372
|
+
authority: AuthorityContext;
|
|
373
|
+
reasonCategory: 'privacy' | 'legal' | 'serious_error' | 'intentional_forgetting';
|
|
374
|
+
erasureLevel: 'content' | 'content_and_evidence' | 'full_where_permitted';
|
|
375
|
+
invalidates: EntityReference[];
|
|
376
|
+
};
|
|
377
|
+
type CanonicalRecord = ParticipantRecord | AuthorityGrantRecord | SubjectRecord | ObservationRecord | ProposalRecord | DecisionRecord | ThreadRecord | IterationRecord | EvidenceRecord | ImplementationAttemptRecord | EvalSpecRecord | VerificationAttemptRecord | ModelEntryRecord | ModelProjectionRecord | FreshnessSignalRecord;
|
|
378
|
+
type MemoryFeature = 'authority' | 'subjects' | 'decisions' | 'implementations' | 'verification' | 'eval_specs' | 'model_projection' | 'freshness' | 'portable_artifacts' | 'bounded_retrieval';
|
|
379
|
+
type ProjectMemoryManifest = {
|
|
380
|
+
formatVersion: MemoryFormatVersion;
|
|
381
|
+
projectId: MemoryId;
|
|
382
|
+
createdAt: Timestamp;
|
|
383
|
+
updatedAt: Timestamp;
|
|
384
|
+
features: MemoryFeature[];
|
|
385
|
+
writer: {
|
|
386
|
+
name: string;
|
|
387
|
+
version: string;
|
|
388
|
+
};
|
|
389
|
+
};
|
|
390
|
+
type ProjectMemoryBundle = {
|
|
391
|
+
manifest: ProjectMemoryManifest;
|
|
392
|
+
records: CanonicalRecord[];
|
|
393
|
+
events: LifecycleEvent[];
|
|
394
|
+
relationships: RelationshipRecord[];
|
|
395
|
+
artifacts: ArtifactManifestEntry[];
|
|
396
|
+
tombstones: Tombstone[];
|
|
397
|
+
};
|
|
398
|
+
type SubjectMatch = {
|
|
399
|
+
subjectId?: MemoryId;
|
|
400
|
+
subjectType?: SubjectType;
|
|
401
|
+
label?: string;
|
|
402
|
+
confidence: 'exact' | 'strong' | 'weak' | 'unresolved';
|
|
403
|
+
matchedBy: 'id' | 'locator' | 'alias' | 'semantic' | 'none';
|
|
404
|
+
reason?: string;
|
|
405
|
+
};
|
|
406
|
+
type RetrievalDecision = {
|
|
407
|
+
id: MemoryId;
|
|
408
|
+
kind: DecisionKind;
|
|
409
|
+
claim: string;
|
|
410
|
+
subjectIds: MemoryId[];
|
|
411
|
+
authority: AuthorityContext;
|
|
412
|
+
effectiveState: 'active' | 'excepted' | 'conflicted';
|
|
413
|
+
freshness: FreshnessSignalType[];
|
|
414
|
+
expansionRef: SourceReference;
|
|
415
|
+
};
|
|
416
|
+
type RetrievalConflict = {
|
|
417
|
+
id: string;
|
|
418
|
+
decisionIds: MemoryId[];
|
|
419
|
+
unresolvedQuestion: string;
|
|
420
|
+
expansionRefs: SourceReference[];
|
|
421
|
+
};
|
|
422
|
+
type RetrievalUncertainty = {
|
|
423
|
+
code: 'subject_unresolved' | 'no_applicable_decision' | 'evidence_unavailable' | 'known_conflict' | 'retrieval_truncated';
|
|
424
|
+
message: string;
|
|
425
|
+
expansionRefs: SourceReference[];
|
|
426
|
+
};
|
|
427
|
+
type RetrievalEvidenceSummary = {
|
|
428
|
+
evidenceId: MemoryId;
|
|
429
|
+
summary: string;
|
|
430
|
+
availability: EvidenceRecord['availability'];
|
|
431
|
+
sourceRefs: SourceReference[];
|
|
432
|
+
};
|
|
433
|
+
type RetrievalPacket = {
|
|
434
|
+
contractVersion: 1;
|
|
435
|
+
projectId: MemoryId;
|
|
436
|
+
retrievedAt: Timestamp;
|
|
437
|
+
query: {
|
|
438
|
+
text?: string;
|
|
439
|
+
action?: string;
|
|
440
|
+
subjectHints: string[];
|
|
441
|
+
};
|
|
442
|
+
budget: {
|
|
443
|
+
maxEstimatedTokens: number;
|
|
444
|
+
estimatedTokens: number;
|
|
445
|
+
};
|
|
446
|
+
subjectMatches: SubjectMatch[];
|
|
447
|
+
modelEntries: Array<{
|
|
448
|
+
id: MemoryId;
|
|
449
|
+
key: string;
|
|
450
|
+
value: JsonValue;
|
|
451
|
+
decisionIds: MemoryId[];
|
|
452
|
+
}>;
|
|
453
|
+
evalSpecs: Array<{
|
|
454
|
+
id: MemoryId;
|
|
455
|
+
legacyId: string;
|
|
456
|
+
state: EvalSpecState;
|
|
457
|
+
title: string;
|
|
458
|
+
assertionCount: number;
|
|
459
|
+
decisionIds: MemoryId[];
|
|
460
|
+
expansionRef: SourceReference;
|
|
461
|
+
}>;
|
|
462
|
+
decisions: RetrievalDecision[];
|
|
463
|
+
conflicts: RetrievalConflict[];
|
|
464
|
+
uncertainties: RetrievalUncertainty[];
|
|
465
|
+
implementation: Array<{
|
|
466
|
+
decisionId: MemoryId;
|
|
467
|
+
state: 'unimplemented' | 'partial' | 'implemented' | 'unknown';
|
|
468
|
+
attemptIds: MemoryId[];
|
|
469
|
+
}>;
|
|
470
|
+
verification: Array<{
|
|
471
|
+
target: VerificationTarget;
|
|
472
|
+
state: 'unverified' | 'passing' | 'failing' | 'stale' | 'blocked';
|
|
473
|
+
attemptIds: MemoryId[];
|
|
474
|
+
}>;
|
|
475
|
+
evidence: RetrievalEvidenceSummary[];
|
|
476
|
+
completeness: {
|
|
477
|
+
status: 'complete' | 'truncated';
|
|
478
|
+
omittedDecisionCount: number;
|
|
479
|
+
omittedEvidenceCount: number;
|
|
480
|
+
conflictsComplete: boolean;
|
|
481
|
+
};
|
|
482
|
+
};
|
|
483
|
+
|
|
484
|
+
type SchemaIssue = {
|
|
485
|
+
path: string;
|
|
486
|
+
code: string;
|
|
487
|
+
message: string;
|
|
488
|
+
severity: 'error' | 'warning';
|
|
489
|
+
};
|
|
490
|
+
type SchemaValidationResult = {
|
|
491
|
+
valid: boolean;
|
|
492
|
+
issues: SchemaIssue[];
|
|
493
|
+
};
|
|
494
|
+
declare function isUuidV7(value: string): boolean;
|
|
495
|
+
declare function validateProjectMemoryBundle(bundle: ProjectMemoryBundle): SchemaValidationResult;
|
|
496
|
+
declare function validateRetrievalPacket(packet: RetrievalPacket): SchemaValidationResult;
|
|
497
|
+
|
|
498
|
+
type ContextualReviewQuery = {
|
|
499
|
+
action?: string;
|
|
500
|
+
text?: string;
|
|
501
|
+
subjectIds?: MemoryId[];
|
|
502
|
+
subjectHints?: string[];
|
|
503
|
+
maxPackets?: number;
|
|
504
|
+
maxEstimatedTokens?: number;
|
|
505
|
+
generatedAt?: Timestamp;
|
|
506
|
+
candidateProposalIds?: MemoryId[];
|
|
507
|
+
candidateDecisionIds?: MemoryId[];
|
|
508
|
+
resurface?: {
|
|
509
|
+
differentAction?: boolean;
|
|
510
|
+
newEvidence?: boolean;
|
|
511
|
+
newConflict?: boolean;
|
|
512
|
+
ownerRequested?: boolean;
|
|
513
|
+
};
|
|
514
|
+
};
|
|
515
|
+
type ContextualSubjectMatch = {
|
|
516
|
+
subjectId: MemoryId;
|
|
517
|
+
label: string;
|
|
518
|
+
confidence: 'exact' | 'strong' | 'weak';
|
|
519
|
+
matchedBy: 'id' | 'label' | 'alias' | 'locator' | 'query_text';
|
|
520
|
+
};
|
|
521
|
+
type OwnerReviewAction = 'accept' | 'edit_and_accept' | 'split' | 'bundle' | 'reject' | 'defer' | 'request_evidence';
|
|
522
|
+
type ContextualReviewPacket = {
|
|
523
|
+
contractVersion: 1;
|
|
524
|
+
packetId: string;
|
|
525
|
+
projectId: MemoryId;
|
|
526
|
+
generatedAt: Timestamp;
|
|
527
|
+
trigger: {
|
|
528
|
+
action?: string;
|
|
529
|
+
reason: string;
|
|
530
|
+
subjectMatches: ContextualSubjectMatch[];
|
|
531
|
+
};
|
|
532
|
+
proposal: {
|
|
533
|
+
id: MemoryId;
|
|
534
|
+
claim: string;
|
|
535
|
+
state: 'pending' | 'deferred';
|
|
536
|
+
proposedKind?: DecisionKind;
|
|
537
|
+
subjectIds: MemoryId[];
|
|
538
|
+
origin: ProposalRecord['origin']['mode'];
|
|
539
|
+
};
|
|
540
|
+
authority: 'unaccepted';
|
|
541
|
+
presentation: 'advisory' | 'surface_before_action';
|
|
542
|
+
implementation: {
|
|
543
|
+
state: 'none_found' | 'attempted' | 'completed' | 'mixed';
|
|
544
|
+
attemptIds: MemoryId[];
|
|
545
|
+
};
|
|
546
|
+
evidence: {
|
|
547
|
+
sourceCount: number;
|
|
548
|
+
sourceRefs: SourceReference[];
|
|
549
|
+
};
|
|
550
|
+
actions: OwnerReviewAction[];
|
|
551
|
+
expansionRefs: SourceReference[];
|
|
552
|
+
estimatedTokens: number;
|
|
553
|
+
};
|
|
554
|
+
type ContextualReviewSelection = {
|
|
555
|
+
packets: ContextualReviewPacket[];
|
|
556
|
+
subjectMatches: ContextualSubjectMatch[];
|
|
557
|
+
completeness: {
|
|
558
|
+
status: 'complete' | 'truncated';
|
|
559
|
+
consideredProposalCount: number;
|
|
560
|
+
omittedPacketCount: number;
|
|
561
|
+
maxEstimatedTokens: number;
|
|
562
|
+
estimatedTokens: number;
|
|
563
|
+
};
|
|
564
|
+
uncertainty?: 'subject_unresolved' | 'no_relevant_pending_proposal';
|
|
565
|
+
};
|
|
566
|
+
declare function selectContextualReviewPackets(bundle: ProjectMemoryBundle, query: ContextualReviewQuery): ContextualReviewSelection;
|
|
567
|
+
|
|
568
|
+
type RetrievalQuery = {
|
|
569
|
+
action?: string;
|
|
570
|
+
text?: string;
|
|
571
|
+
subjectIds?: MemoryId[];
|
|
572
|
+
subjectHints?: string[];
|
|
573
|
+
maxEstimatedTokens?: number;
|
|
574
|
+
maxDecisions?: number;
|
|
575
|
+
retrievedAt?: string;
|
|
576
|
+
candidateDecisionIds?: MemoryId[];
|
|
577
|
+
};
|
|
578
|
+
declare function retrieveActionPacket(bundle: ProjectMemoryBundle, query: RetrievalQuery): RetrievalPacket;
|
|
579
|
+
|
|
580
|
+
type ReviewCommandBase = {
|
|
581
|
+
proposalId: MemoryId;
|
|
582
|
+
participantId: MemoryId;
|
|
583
|
+
authority: AuthorityContext;
|
|
584
|
+
occurredAt: Timestamp;
|
|
585
|
+
sourceRefs?: SourceReference[];
|
|
586
|
+
};
|
|
587
|
+
type AcceptReviewCommand = ReviewCommandBase & {
|
|
588
|
+
action: 'accept';
|
|
589
|
+
eventId: MemoryId;
|
|
590
|
+
decisionId: MemoryId;
|
|
591
|
+
kind: DecisionKind;
|
|
592
|
+
rationale?: string;
|
|
593
|
+
reason: string;
|
|
594
|
+
};
|
|
595
|
+
type EditAndAcceptReviewCommand = ReviewCommandBase & {
|
|
596
|
+
action: 'edit_and_accept';
|
|
597
|
+
withdrawalEventId: MemoryId;
|
|
598
|
+
replacementProposalId: MemoryId;
|
|
599
|
+
acceptanceEventId: MemoryId;
|
|
600
|
+
decisionId: MemoryId;
|
|
601
|
+
relationshipId: MemoryId;
|
|
602
|
+
claim: string;
|
|
603
|
+
kind: DecisionKind;
|
|
604
|
+
subjects: DecisionSubject[];
|
|
605
|
+
subjectSemantics?: string;
|
|
606
|
+
rationale?: string;
|
|
607
|
+
reason: string;
|
|
608
|
+
};
|
|
609
|
+
type RejectReviewCommand = ReviewCommandBase & {
|
|
610
|
+
action: 'reject';
|
|
611
|
+
eventId: MemoryId;
|
|
612
|
+
reason: string;
|
|
613
|
+
};
|
|
614
|
+
type DeferReviewCommand = ReviewCommandBase & {
|
|
615
|
+
action: 'defer';
|
|
616
|
+
eventId: MemoryId;
|
|
617
|
+
reason?: string;
|
|
618
|
+
context: Omit<ProposalDeferralContext, 'kind'>;
|
|
619
|
+
};
|
|
620
|
+
type OwnerReviewCommand = AcceptReviewCommand | EditAndAcceptReviewCommand | RejectReviewCommand | DeferReviewCommand;
|
|
621
|
+
type ReviewProjectionUpdate = {
|
|
622
|
+
entityType: 'proposal';
|
|
623
|
+
entityId: MemoryId;
|
|
624
|
+
fromState: ProposalRecord['state'];
|
|
625
|
+
state: ProposalRecord['state'];
|
|
626
|
+
} | {
|
|
627
|
+
entityType: 'decision';
|
|
628
|
+
entityId: MemoryId;
|
|
629
|
+
fromState: DecisionRecord['state'];
|
|
630
|
+
state: DecisionRecord['state'];
|
|
631
|
+
};
|
|
632
|
+
type OwnerReviewActionPlan = {
|
|
633
|
+
action: OwnerReviewCommand['action'];
|
|
634
|
+
proposalId: MemoryId;
|
|
635
|
+
append: {
|
|
636
|
+
records: CanonicalRecord[];
|
|
637
|
+
events: LifecycleEvent[];
|
|
638
|
+
relationships: RelationshipRecord[];
|
|
639
|
+
};
|
|
640
|
+
projectionUpdates: ReviewProjectionUpdate[];
|
|
641
|
+
resultRefs: Array<{
|
|
642
|
+
entityType: 'proposal' | 'decision';
|
|
643
|
+
entityId: MemoryId;
|
|
644
|
+
}>;
|
|
645
|
+
};
|
|
646
|
+
type OwnerReviewPlanResult = {
|
|
647
|
+
ok: true;
|
|
648
|
+
plan: OwnerReviewActionPlan;
|
|
649
|
+
} | {
|
|
650
|
+
ok: false;
|
|
651
|
+
errors: Array<{
|
|
652
|
+
code: string;
|
|
653
|
+
message: string;
|
|
654
|
+
}>;
|
|
655
|
+
};
|
|
656
|
+
declare function planOwnerReviewAction(bundle: ProjectMemoryBundle, command: OwnerReviewCommand): OwnerReviewPlanResult;
|
|
657
|
+
declare function applyOwnerReviewActionPlan(bundle: ProjectMemoryBundle, plan: OwnerReviewActionPlan): {
|
|
658
|
+
bundle: ProjectMemoryBundle;
|
|
659
|
+
validation: SchemaValidationResult;
|
|
660
|
+
};
|
|
661
|
+
|
|
662
|
+
export { type AcceptReviewCommand, type ArtifactKind, type ArtifactManifestEntry, type AssertionOrigin, type AuthorityContext, type AuthorityGrantRecord, type AuthorityLevel, type AuthorityMode, type CanonicalRecord, type CaptureContext, type ContextualReviewPacket, type ContextualReviewQuery, type ContextualReviewSelection, type ContextualSubjectMatch, type CoverageClaim, type DecisionKind, type DecisionRecord, type DecisionState, type DecisionSubject, type DeferReviewCommand, type EditAndAcceptReviewCommand, type EntityReference, type EntityType, type EvalDependency, type EvalScenario, type EvalSpecRecord, type EvalSpecState, type EvidenceKind, type EvidenceRecord, type ExecutionContext, type FreshnessSignalRecord, type FreshnessSignalType, type FreshnessTargetKind, type ImplementationAttemptRecord, type ImplementationState, type IterationOutcome, type IterationRecord, type JsonPrimitive, type JsonValue, type LifecycleEvent, MEMORY_FORMAT_VERSION, MEMORY_SCHEMA_VERSION, type MemoryFeature, type MemoryFormatVersion, type MemoryId, type MemoryObjectType, type MemorySchemaVersion, type ModelEntryRecord, type ModelProjectionRecord, type ObservationRecord, type ObservationState, type OwnerReviewAction, type OwnerReviewActionPlan, type OwnerReviewCommand, type OwnerReviewPlanResult, type ParticipantKind, type ParticipantRecord, type ParticipantStance, type ProjectMemoryBundle, type ProjectMemoryManifest, type ProposalDeferralContext, type ProposalRecord, type ProposalState, type Provenance, type RejectReviewCommand, type RelationshipRecord, type RelationshipType, type RetrievalConflict, type RetrievalDecision, type RetrievalEvidenceSummary, type RetrievalPacket, type RetrievalQuery, type RetrievalUncertainty, type ReviewProjectionUpdate, type SchemaIssue, type SchemaValidationResult, type SourceReference, type SourceReferenceKind, type SubjectLocator, type SubjectLocatorKind, type SubjectMatch, type SubjectRecord, type SubjectType, type ThreadOutcome, type ThreadRecord, type Timestamp, type Tombstone, type VerificationAttemptRecord, type VerificationState, type VerificationTarget, applyOwnerReviewActionPlan, isUuidV7, planOwnerReviewAction, retrieveActionPacket, selectContextualReviewPackets, validateProjectMemoryBundle, validateRetrievalPacket };
|