@popmelt.com/core 0.8.4 → 0.8.6
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 +116 -299
- package/dist/{chunk-RBFQCZQP.mjs → chunk-EYFN72RC.mjs} +1 -1
- package/dist/chunk-NOHXTT24.mjs +1 -0
- package/dist/cli.mjs +116 -299
- package/dist/index.d.mts +7 -4
- 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.mjs +1 -1
- package/dist/plugin-vite.mjs +1 -1
- package/dist/server-KCVEM3PH.mjs +242 -0
- package/dist/server.d.mts +268 -1
- package/dist/server.mjs +119 -298
- package/package.json +19 -2
- package/dist/chunk-3TS7MVTZ.mjs +0 -1
- package/dist/server-7UMGXB6S.mjs +0 -421
|
@@ -0,0 +1,1048 @@
|
|
|
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
|
+
|
|
491
|
+
type ReviewCommandBase = {
|
|
492
|
+
proposalId: MemoryId;
|
|
493
|
+
participantId: MemoryId;
|
|
494
|
+
authority: AuthorityContext;
|
|
495
|
+
occurredAt: Timestamp;
|
|
496
|
+
sourceRefs?: SourceReference[];
|
|
497
|
+
};
|
|
498
|
+
type AcceptReviewCommand = ReviewCommandBase & {
|
|
499
|
+
action: 'accept';
|
|
500
|
+
eventId: MemoryId;
|
|
501
|
+
decisionId: MemoryId;
|
|
502
|
+
kind: DecisionKind;
|
|
503
|
+
rationale?: string;
|
|
504
|
+
reason: string;
|
|
505
|
+
};
|
|
506
|
+
type EditAndAcceptReviewCommand = ReviewCommandBase & {
|
|
507
|
+
action: 'edit_and_accept';
|
|
508
|
+
withdrawalEventId: MemoryId;
|
|
509
|
+
replacementProposalId: MemoryId;
|
|
510
|
+
acceptanceEventId: MemoryId;
|
|
511
|
+
decisionId: MemoryId;
|
|
512
|
+
relationshipId: MemoryId;
|
|
513
|
+
claim: string;
|
|
514
|
+
kind: DecisionKind;
|
|
515
|
+
subjects: DecisionSubject[];
|
|
516
|
+
subjectSemantics?: string;
|
|
517
|
+
rationale?: string;
|
|
518
|
+
reason: string;
|
|
519
|
+
};
|
|
520
|
+
type RejectReviewCommand = ReviewCommandBase & {
|
|
521
|
+
action: 'reject';
|
|
522
|
+
eventId: MemoryId;
|
|
523
|
+
reason: string;
|
|
524
|
+
};
|
|
525
|
+
type DeferReviewCommand = ReviewCommandBase & {
|
|
526
|
+
action: 'defer';
|
|
527
|
+
eventId: MemoryId;
|
|
528
|
+
reason?: string;
|
|
529
|
+
context: Omit<ProposalDeferralContext, 'kind'>;
|
|
530
|
+
};
|
|
531
|
+
type OwnerReviewCommand = AcceptReviewCommand | EditAndAcceptReviewCommand | RejectReviewCommand | DeferReviewCommand;
|
|
532
|
+
type ReviewProjectionUpdate = {
|
|
533
|
+
entityType: 'proposal';
|
|
534
|
+
entityId: MemoryId;
|
|
535
|
+
fromState: ProposalRecord['state'];
|
|
536
|
+
state: ProposalRecord['state'];
|
|
537
|
+
} | {
|
|
538
|
+
entityType: 'decision';
|
|
539
|
+
entityId: MemoryId;
|
|
540
|
+
fromState: DecisionRecord['state'];
|
|
541
|
+
state: DecisionRecord['state'];
|
|
542
|
+
};
|
|
543
|
+
type OwnerReviewActionPlan = {
|
|
544
|
+
action: OwnerReviewCommand['action'];
|
|
545
|
+
proposalId: MemoryId;
|
|
546
|
+
append: {
|
|
547
|
+
records: CanonicalRecord[];
|
|
548
|
+
events: LifecycleEvent[];
|
|
549
|
+
relationships: RelationshipRecord[];
|
|
550
|
+
};
|
|
551
|
+
projectionUpdates: ReviewProjectionUpdate[];
|
|
552
|
+
resultRefs: Array<{
|
|
553
|
+
entityType: 'proposal' | 'decision';
|
|
554
|
+
entityId: MemoryId;
|
|
555
|
+
}>;
|
|
556
|
+
};
|
|
557
|
+
type OwnerReviewPlanResult = {
|
|
558
|
+
ok: true;
|
|
559
|
+
plan: OwnerReviewActionPlan;
|
|
560
|
+
} | {
|
|
561
|
+
ok: false;
|
|
562
|
+
errors: Array<{
|
|
563
|
+
code: string;
|
|
564
|
+
message: string;
|
|
565
|
+
}>;
|
|
566
|
+
};
|
|
567
|
+
|
|
568
|
+
type MemoryJournalMutation = {
|
|
569
|
+
records: CanonicalRecord[];
|
|
570
|
+
events: LifecycleEvent[];
|
|
571
|
+
relationships: RelationshipRecord[];
|
|
572
|
+
artifacts: ArtifactManifestEntry[];
|
|
573
|
+
tombstones: Tombstone[];
|
|
574
|
+
projectionUpdates: ReviewProjectionUpdate[];
|
|
575
|
+
};
|
|
576
|
+
type MemoryJournalTransaction = {
|
|
577
|
+
storageVersion: 1;
|
|
578
|
+
sequence: number;
|
|
579
|
+
transactionId: string;
|
|
580
|
+
projectId: string;
|
|
581
|
+
committedAt: string;
|
|
582
|
+
previousHash: string | null;
|
|
583
|
+
mutation: MemoryJournalMutation;
|
|
584
|
+
hash: string;
|
|
585
|
+
};
|
|
586
|
+
type MemoryJournalManifest = {
|
|
587
|
+
storageVersion: 1;
|
|
588
|
+
projectId: string;
|
|
589
|
+
checkpoint: {
|
|
590
|
+
file: string;
|
|
591
|
+
sequence: number;
|
|
592
|
+
hash: string;
|
|
593
|
+
};
|
|
594
|
+
head: {
|
|
595
|
+
sequence: number;
|
|
596
|
+
hash: string | null;
|
|
597
|
+
};
|
|
598
|
+
updatedAt: string;
|
|
599
|
+
};
|
|
600
|
+
type MemoryJournalLoadReport = {
|
|
601
|
+
checkpointSequence: number;
|
|
602
|
+
appliedTransactions: number;
|
|
603
|
+
recoveredTransactions: number;
|
|
604
|
+
ignoredTemporaryFiles: number;
|
|
605
|
+
headSequence: number;
|
|
606
|
+
headHash: string | null;
|
|
607
|
+
};
|
|
608
|
+
type MemoryJournalLoadResult = {
|
|
609
|
+
bundle: ProjectMemoryBundle;
|
|
610
|
+
report: MemoryJournalLoadReport;
|
|
611
|
+
};
|
|
612
|
+
type CommitReviewPlanOptions = {
|
|
613
|
+
transactionId: string;
|
|
614
|
+
committedAt: string;
|
|
615
|
+
};
|
|
616
|
+
declare function computeTransactionHash(transaction: Omit<MemoryJournalTransaction, 'hash'>): string;
|
|
617
|
+
declare class MemoryJournalStore {
|
|
618
|
+
private readonly memoryDir;
|
|
619
|
+
private readonly journalDir;
|
|
620
|
+
private readonly manifestPath;
|
|
621
|
+
private readonly checkpointPath;
|
|
622
|
+
private readonly lockPath;
|
|
623
|
+
private writeChain;
|
|
624
|
+
constructor(projectRoot: string);
|
|
625
|
+
initialize(bundle: ProjectMemoryBundle): Promise<void>;
|
|
626
|
+
load(): Promise<MemoryJournalLoadResult>;
|
|
627
|
+
recover(): Promise<MemoryJournalLoadResult>;
|
|
628
|
+
rotateCheckpoint(): Promise<MemoryJournalLoadResult>;
|
|
629
|
+
maintain(checkpointInterval?: number): Promise<MemoryJournalLoadResult>;
|
|
630
|
+
commit(mutation: MemoryJournalMutation, options: CommitReviewPlanOptions): Promise<MemoryJournalLoadResult>;
|
|
631
|
+
commitReviewPlan(plan: OwnerReviewActionPlan, options: CommitReviewPlanOptions): Promise<MemoryJournalLoadResult>;
|
|
632
|
+
private loadInternal;
|
|
633
|
+
private enqueueWrite;
|
|
634
|
+
private withWriterLock;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
type ContextualReviewQuery = {
|
|
638
|
+
action?: string;
|
|
639
|
+
text?: string;
|
|
640
|
+
subjectIds?: MemoryId[];
|
|
641
|
+
subjectHints?: string[];
|
|
642
|
+
maxPackets?: number;
|
|
643
|
+
maxEstimatedTokens?: number;
|
|
644
|
+
generatedAt?: Timestamp;
|
|
645
|
+
candidateProposalIds?: MemoryId[];
|
|
646
|
+
candidateDecisionIds?: MemoryId[];
|
|
647
|
+
resurface?: {
|
|
648
|
+
differentAction?: boolean;
|
|
649
|
+
newEvidence?: boolean;
|
|
650
|
+
newConflict?: boolean;
|
|
651
|
+
ownerRequested?: boolean;
|
|
652
|
+
};
|
|
653
|
+
};
|
|
654
|
+
type ContextualSubjectMatch = {
|
|
655
|
+
subjectId: MemoryId;
|
|
656
|
+
label: string;
|
|
657
|
+
confidence: 'exact' | 'strong' | 'weak';
|
|
658
|
+
matchedBy: 'id' | 'label' | 'alias' | 'locator' | 'query_text';
|
|
659
|
+
};
|
|
660
|
+
type OwnerReviewAction = 'accept' | 'edit_and_accept' | 'split' | 'bundle' | 'reject' | 'defer' | 'request_evidence';
|
|
661
|
+
type ContextualReviewPacket = {
|
|
662
|
+
contractVersion: 1;
|
|
663
|
+
packetId: string;
|
|
664
|
+
projectId: MemoryId;
|
|
665
|
+
generatedAt: Timestamp;
|
|
666
|
+
trigger: {
|
|
667
|
+
action?: string;
|
|
668
|
+
reason: string;
|
|
669
|
+
subjectMatches: ContextualSubjectMatch[];
|
|
670
|
+
};
|
|
671
|
+
proposal: {
|
|
672
|
+
id: MemoryId;
|
|
673
|
+
claim: string;
|
|
674
|
+
state: 'pending' | 'deferred';
|
|
675
|
+
proposedKind?: DecisionKind;
|
|
676
|
+
subjectIds: MemoryId[];
|
|
677
|
+
origin: ProposalRecord['origin']['mode'];
|
|
678
|
+
};
|
|
679
|
+
authority: 'unaccepted';
|
|
680
|
+
presentation: 'advisory' | 'surface_before_action';
|
|
681
|
+
implementation: {
|
|
682
|
+
state: 'none_found' | 'attempted' | 'completed' | 'mixed';
|
|
683
|
+
attemptIds: MemoryId[];
|
|
684
|
+
};
|
|
685
|
+
evidence: {
|
|
686
|
+
sourceCount: number;
|
|
687
|
+
sourceRefs: SourceReference[];
|
|
688
|
+
};
|
|
689
|
+
actions: OwnerReviewAction[];
|
|
690
|
+
expansionRefs: SourceReference[];
|
|
691
|
+
estimatedTokens: number;
|
|
692
|
+
};
|
|
693
|
+
type ContextualReviewSelection = {
|
|
694
|
+
packets: ContextualReviewPacket[];
|
|
695
|
+
subjectMatches: ContextualSubjectMatch[];
|
|
696
|
+
completeness: {
|
|
697
|
+
status: 'complete' | 'truncated';
|
|
698
|
+
consideredProposalCount: number;
|
|
699
|
+
omittedPacketCount: number;
|
|
700
|
+
maxEstimatedTokens: number;
|
|
701
|
+
estimatedTokens: number;
|
|
702
|
+
};
|
|
703
|
+
uncertainty?: 'subject_unresolved' | 'no_relevant_pending_proposal';
|
|
704
|
+
};
|
|
705
|
+
declare function selectContextualReviewPackets(bundle: ProjectMemoryBundle, query: ContextualReviewQuery): ContextualReviewSelection;
|
|
706
|
+
|
|
707
|
+
type RetrievalQuery = {
|
|
708
|
+
action?: string;
|
|
709
|
+
text?: string;
|
|
710
|
+
subjectIds?: MemoryId[];
|
|
711
|
+
subjectHints?: string[];
|
|
712
|
+
maxEstimatedTokens?: number;
|
|
713
|
+
maxDecisions?: number;
|
|
714
|
+
retrievedAt?: string;
|
|
715
|
+
candidateDecisionIds?: MemoryId[];
|
|
716
|
+
};
|
|
717
|
+
declare function retrieveActionPacket(bundle: ProjectMemoryBundle, query: RetrievalQuery): RetrievalPacket;
|
|
718
|
+
|
|
719
|
+
type ImprintExplanationState = 'emerging' | 'testing' | 'grounded' | 'challenged' | 'retired';
|
|
720
|
+
type ImprintSummaryKind = 'added' | 'strengthened' | 'refined' | 'challenged' | 'exception' | 'consolidated';
|
|
721
|
+
type ImprintThreadSummary = {
|
|
722
|
+
transactionId: string;
|
|
723
|
+
coalescedTransactionIds?: string[];
|
|
724
|
+
additionalObservationCount?: number;
|
|
725
|
+
kind: ImprintSummaryKind;
|
|
726
|
+
title: string;
|
|
727
|
+
detail: string;
|
|
728
|
+
changes: Array<{
|
|
729
|
+
explanationId: string;
|
|
730
|
+
action: 'added' | 'revised' | 'supported' | 'challenged' | 'retired' | 'related';
|
|
731
|
+
statement: string;
|
|
732
|
+
state: ImprintExplanationState;
|
|
733
|
+
}>;
|
|
734
|
+
grounding?: {
|
|
735
|
+
explanationId: string;
|
|
736
|
+
question: string;
|
|
737
|
+
state: 'testing';
|
|
738
|
+
};
|
|
739
|
+
resolvedAction?: ImprintGroundingAction;
|
|
740
|
+
};
|
|
741
|
+
type ImprintGroundingAction = 'confirm' | 'reason_wrong' | 'narrow' | 'exception' | 'edit' | 'dont_learn' | 'undo';
|
|
742
|
+
|
|
743
|
+
type MemoryReviewReceipt = {
|
|
744
|
+
status: 'committed' | 'not_ready' | 'rejected';
|
|
745
|
+
action: 'accept' | 'edit_and_accept' | 'reject' | 'defer';
|
|
746
|
+
proposalId: string;
|
|
747
|
+
decisionId?: string;
|
|
748
|
+
message: string;
|
|
749
|
+
headSequence?: number;
|
|
750
|
+
};
|
|
751
|
+
|
|
752
|
+
type EvalCaseStatus = 'pending' | 'approved' | 'rejected';
|
|
753
|
+
type EvalCase = {
|
|
754
|
+
id: string;
|
|
755
|
+
title: string;
|
|
756
|
+
status: EvalCaseStatus;
|
|
757
|
+
category: 'component' | 'layout' | 'copy' | 'interaction' | 'visual' | 'workflow';
|
|
758
|
+
prompt: string;
|
|
759
|
+
assertions: string[];
|
|
760
|
+
rationale: string;
|
|
761
|
+
sourceDecisionIds: string[];
|
|
762
|
+
sourceThreadIds: string[];
|
|
763
|
+
dependencies?: EvalDependency[];
|
|
764
|
+
scenarios?: EvalScenario[];
|
|
765
|
+
};
|
|
766
|
+
type EvalRunStatus = 'pass' | 'fail' | 'needs_review';
|
|
767
|
+
type EvalAssertionRunResult = {
|
|
768
|
+
assertion: string;
|
|
769
|
+
status: EvalRunStatus;
|
|
770
|
+
summary: string;
|
|
771
|
+
evidence: string[];
|
|
772
|
+
};
|
|
773
|
+
type EvalRunScope = {
|
|
774
|
+
type: 'current_page';
|
|
775
|
+
url: string;
|
|
776
|
+
viewport: {
|
|
777
|
+
width: number;
|
|
778
|
+
height: number;
|
|
779
|
+
};
|
|
780
|
+
};
|
|
781
|
+
type EvalRun = {
|
|
782
|
+
id: string;
|
|
783
|
+
evalId: string;
|
|
784
|
+
threadId?: string;
|
|
785
|
+
status: EvalRunStatus;
|
|
786
|
+
createdAt: number;
|
|
787
|
+
completedAt: number;
|
|
788
|
+
durationMs: number;
|
|
789
|
+
scope: EvalRunScope;
|
|
790
|
+
summary: string;
|
|
791
|
+
assertionResults: EvalAssertionRunResult[];
|
|
792
|
+
tooling: {
|
|
793
|
+
chromeDevtools: 'available' | 'unavailable' | 'unknown';
|
|
794
|
+
evidenceTypes: string[];
|
|
795
|
+
};
|
|
796
|
+
provider?: string;
|
|
797
|
+
model?: string;
|
|
798
|
+
screenshotPath?: string;
|
|
799
|
+
codeFingerprint?: string;
|
|
800
|
+
scopeFingerprint?: string;
|
|
801
|
+
rawResponse?: string;
|
|
802
|
+
};
|
|
803
|
+
|
|
804
|
+
type ConversationalReviewIntent = {
|
|
805
|
+
proposalId: string;
|
|
806
|
+
action: 'accept' | 'edit_and_accept' | 'reject' | 'defer';
|
|
807
|
+
kind?: DecisionKind;
|
|
808
|
+
claim?: string;
|
|
809
|
+
reason?: string;
|
|
810
|
+
taskContext?: string;
|
|
811
|
+
resurfaceWhen?: Array<'different_action' | 'new_evidence' | 'new_conflict' | 'owner_request'>;
|
|
812
|
+
};
|
|
813
|
+
|
|
814
|
+
type LegacyImportIssue = {
|
|
815
|
+
severity: 'info' | 'warning' | 'error';
|
|
816
|
+
code: string;
|
|
817
|
+
source?: string;
|
|
818
|
+
message: string;
|
|
819
|
+
};
|
|
820
|
+
type LegacyImportReport = {
|
|
821
|
+
projectRoot: string;
|
|
822
|
+
source: {
|
|
823
|
+
threads: number;
|
|
824
|
+
messages: number;
|
|
825
|
+
decisionEnvelopes: number;
|
|
826
|
+
modelEntries: number;
|
|
827
|
+
artifactsReferenced: number;
|
|
828
|
+
};
|
|
829
|
+
imported: Record<string, number>;
|
|
830
|
+
unresolvedAcceptance: number;
|
|
831
|
+
deferredModelEntries: number;
|
|
832
|
+
proofCases: Array<{
|
|
833
|
+
legacyId: string;
|
|
834
|
+
threadFound: boolean;
|
|
835
|
+
decisionEnvelopeFound: boolean;
|
|
836
|
+
recordIds: string[];
|
|
837
|
+
}>;
|
|
838
|
+
issues: LegacyImportIssue[];
|
|
839
|
+
schemaIssues: SchemaIssue[];
|
|
840
|
+
};
|
|
841
|
+
type LegacyImportOptions = {
|
|
842
|
+
projectRoot: string;
|
|
843
|
+
projectKey?: string;
|
|
844
|
+
proofCaseIds?: string[];
|
|
845
|
+
writerVersion?: string;
|
|
846
|
+
};
|
|
847
|
+
|
|
848
|
+
type CompletedJobCapture = {
|
|
849
|
+
jobId: string;
|
|
850
|
+
threadId: string;
|
|
851
|
+
createdAt: number;
|
|
852
|
+
completedAt: number;
|
|
853
|
+
requestSummary: string;
|
|
854
|
+
responseSummary?: string;
|
|
855
|
+
outcome: IterationOutcome;
|
|
856
|
+
execution: {
|
|
857
|
+
provider?: string;
|
|
858
|
+
model?: string;
|
|
859
|
+
sessionId?: string;
|
|
860
|
+
};
|
|
861
|
+
subjectHints: string[];
|
|
862
|
+
filePaths?: string[];
|
|
863
|
+
resolutions: Array<{
|
|
864
|
+
status: string;
|
|
865
|
+
summary: string;
|
|
866
|
+
}>;
|
|
867
|
+
/**
|
|
868
|
+
* Reusable semantic claims explicitly surfaced by the conversation layer.
|
|
869
|
+
* Ordinary successful resolutions are implementation evidence, not proposals.
|
|
870
|
+
*/
|
|
871
|
+
semanticCandidates?: Array<{
|
|
872
|
+
claim: string;
|
|
873
|
+
rationale?: string;
|
|
874
|
+
proposedKind?: ProposalRecord['proposedKind'];
|
|
875
|
+
sourceText?: string;
|
|
876
|
+
}>;
|
|
877
|
+
/** Accepted decisions that materially guided this implementation attempt. */
|
|
878
|
+
governingDecisionIds?: string[];
|
|
879
|
+
};
|
|
880
|
+
|
|
881
|
+
type MemoryServiceStatus = {
|
|
882
|
+
initialized: boolean;
|
|
883
|
+
state: 'absent' | 'initializing' | 'ready' | 'degraded';
|
|
884
|
+
phase?: 'analyzing_legacy' | 'writing_checkpoint';
|
|
885
|
+
error?: string;
|
|
886
|
+
projectId?: string;
|
|
887
|
+
headSequence?: number;
|
|
888
|
+
updatedAt?: string;
|
|
889
|
+
};
|
|
890
|
+
type MemoryReviewResult = {
|
|
891
|
+
source: 'journal' | 'legacy_preview';
|
|
892
|
+
selection: ReturnType<typeof selectContextualReviewPackets>;
|
|
893
|
+
};
|
|
894
|
+
type MemoryContextResult = {
|
|
895
|
+
source: MemoryReviewResult['source'];
|
|
896
|
+
actionPacket: ReturnType<typeof retrieveActionPacket>;
|
|
897
|
+
reviewSelection: ReturnType<typeof selectContextualReviewPackets>;
|
|
898
|
+
};
|
|
899
|
+
type JournalEvalCase = EvalCase & {
|
|
900
|
+
canonicalSpecId: string;
|
|
901
|
+
verificationState: 'draft' | 'unverified' | 'passing' | 'failing' | 'needs_review' | 'stale' | 'retired';
|
|
902
|
+
verifiedScopeFingerprint?: string;
|
|
903
|
+
verificationAttemptId?: string;
|
|
904
|
+
};
|
|
905
|
+
declare class MemoryService {
|
|
906
|
+
private readonly projectRoot;
|
|
907
|
+
private readonly store;
|
|
908
|
+
private readonly manifestPath;
|
|
909
|
+
private readonly indexStore;
|
|
910
|
+
private initializationPromise?;
|
|
911
|
+
private runtimeState?;
|
|
912
|
+
constructor(projectRoot: string);
|
|
913
|
+
status(): Promise<MemoryServiceStatus>;
|
|
914
|
+
beginAutomaticInitialization(options?: {
|
|
915
|
+
projectKey?: string;
|
|
916
|
+
proofCaseIds?: string[];
|
|
917
|
+
writerVersion?: string;
|
|
918
|
+
}): Promise<MemoryServiceStatus>;
|
|
919
|
+
analyzeLegacy(options?: Omit<LegacyImportOptions, 'projectRoot'>): Promise<LegacyImportReport>;
|
|
920
|
+
/** One-time cutover import. Legacy eval files are never read during normal queries. */
|
|
921
|
+
migrateLegacyEvals(): Promise<{
|
|
922
|
+
migrated: boolean;
|
|
923
|
+
specs: number;
|
|
924
|
+
runs: number;
|
|
925
|
+
}>;
|
|
926
|
+
/** One-time identity/evidence bridge from the prototype Imprint journal. */
|
|
927
|
+
migrateImprintSnapshot(): Promise<{
|
|
928
|
+
migrated: boolean;
|
|
929
|
+
explanations: number;
|
|
930
|
+
evidence: number;
|
|
931
|
+
}>;
|
|
932
|
+
review(query: ContextualReviewQuery, options?: Omit<LegacyImportOptions, 'projectRoot'>): Promise<MemoryReviewResult>;
|
|
933
|
+
contextualize(query: ContextualReviewQuery, options?: Omit<LegacyImportOptions, 'projectRoot'>): Promise<MemoryContextResult>;
|
|
934
|
+
planReview(command: OwnerReviewCommand, options?: Omit<LegacyImportOptions, 'projectRoot'>): Promise<{
|
|
935
|
+
source: MemoryReviewResult['source'];
|
|
936
|
+
result: OwnerReviewPlanResult;
|
|
937
|
+
}>;
|
|
938
|
+
initializeFromLegacy(options: {
|
|
939
|
+
confirmed: boolean;
|
|
940
|
+
projectKey?: string;
|
|
941
|
+
proofCaseIds?: string[];
|
|
942
|
+
writerVersion?: string;
|
|
943
|
+
}): Promise<{
|
|
944
|
+
status: MemoryServiceStatus;
|
|
945
|
+
report: LegacyImportReport;
|
|
946
|
+
}>;
|
|
947
|
+
commitReview(command: OwnerReviewCommand, transaction: CommitReviewPlanOptions): Promise<MemoryJournalLoadResult>;
|
|
948
|
+
commitConversationalReview(intent: ConversationalReviewIntent): Promise<MemoryReviewReceipt>;
|
|
949
|
+
captureCompletedJob(capture: CompletedJobCapture): Promise<{
|
|
950
|
+
status: 'captured' | 'not_ready' | 'duplicate';
|
|
951
|
+
iterationId?: string;
|
|
952
|
+
proposalIds: string[];
|
|
953
|
+
headSequence?: number;
|
|
954
|
+
}>;
|
|
955
|
+
/**
|
|
956
|
+
* Mirrors Imprint identity and evidence into the canonical journal without
|
|
957
|
+
* promoting advisory explanations into product decisions.
|
|
958
|
+
*/
|
|
959
|
+
recordImprintEvidence(input: {
|
|
960
|
+
summary: ImprintThreadSummary;
|
|
961
|
+
threadId: string;
|
|
962
|
+
jobId: string;
|
|
963
|
+
action?: ImprintGroundingAction;
|
|
964
|
+
occurredAt?: string;
|
|
965
|
+
}): Promise<void>;
|
|
966
|
+
recover(confirmed: boolean): Promise<MemoryJournalLoadResult>;
|
|
967
|
+
diagnostics(): Promise<{
|
|
968
|
+
status: MemoryServiceStatus;
|
|
969
|
+
journal?: MemoryJournalLoadResult['report'];
|
|
970
|
+
records?: Record<string, number>;
|
|
971
|
+
openFreshnessSignals?: number;
|
|
972
|
+
unavailableEvidence?: number;
|
|
973
|
+
}>;
|
|
974
|
+
getProjectableDecisions(limit?: number): Promise<DecisionRecord[]>;
|
|
975
|
+
getCanonicalModelEntries(): Promise<ModelEntryRecord[]>;
|
|
976
|
+
getModelView(): Promise<{
|
|
977
|
+
decisions: Array<{
|
|
978
|
+
id: string;
|
|
979
|
+
kind: string;
|
|
980
|
+
claim: string;
|
|
981
|
+
projected: boolean;
|
|
982
|
+
verification: string;
|
|
983
|
+
}>;
|
|
984
|
+
entries: Array<{
|
|
985
|
+
id: string;
|
|
986
|
+
key: string;
|
|
987
|
+
value: JsonValue;
|
|
988
|
+
decisionIds: string[];
|
|
989
|
+
}>;
|
|
990
|
+
}>;
|
|
991
|
+
getEvalDependenciesForDecisions(decisionIds: string[]): Promise<EvalDependency[]>;
|
|
992
|
+
recordDirectModelMutation(input: {
|
|
993
|
+
key: string;
|
|
994
|
+
value: JsonValue;
|
|
995
|
+
claim: string;
|
|
996
|
+
}): Promise<{
|
|
997
|
+
decisionId: string;
|
|
998
|
+
entryId: string;
|
|
999
|
+
}>;
|
|
1000
|
+
syncEvalSpecs(cases: EvalCase[]): Promise<JournalEvalCase[]>;
|
|
1001
|
+
getJournalEvalCases(): Promise<JournalEvalCase[]>;
|
|
1002
|
+
findJournalEvalCase(id: string): Promise<JournalEvalCase | null>;
|
|
1003
|
+
updateJournalEvalCase(id: string, patch: Partial<Pick<EvalCase, 'status' | 'title' | 'assertions'>>): Promise<JournalEvalCase | null>;
|
|
1004
|
+
getJournalEvalRuns(): Promise<EvalRun[]>;
|
|
1005
|
+
recordEvalVerification(evalCase: EvalCase, run: EvalRun): Promise<void>;
|
|
1006
|
+
syncLegacyEvalRuns(cases: EvalCase[], runs: EvalRun[]): Promise<void>;
|
|
1007
|
+
markEvalVerificationExpired(input: {
|
|
1008
|
+
evalSpecId: string;
|
|
1009
|
+
verificationAttemptId: string;
|
|
1010
|
+
previousFingerprint?: string;
|
|
1011
|
+
currentFingerprint?: string;
|
|
1012
|
+
}): Promise<void>;
|
|
1013
|
+
reconcileEvalCases(cases: EvalCase[]): Promise<{
|
|
1014
|
+
valid: EvalCase[];
|
|
1015
|
+
discardedIds: string[];
|
|
1016
|
+
}>;
|
|
1017
|
+
private latestEvalSpec;
|
|
1018
|
+
findPendingProposalForLegacyDecision(legacyDecisionId: string): Promise<{
|
|
1019
|
+
proposalId: string;
|
|
1020
|
+
claim: string;
|
|
1021
|
+
} | null>;
|
|
1022
|
+
applyModelProjection(input: {
|
|
1023
|
+
runId: string;
|
|
1024
|
+
presentationJobId?: string;
|
|
1025
|
+
decisionIds: string[];
|
|
1026
|
+
changes: Array<{
|
|
1027
|
+
path: Array<string | number>;
|
|
1028
|
+
value: unknown;
|
|
1029
|
+
decisionIds?: string[];
|
|
1030
|
+
label?: string;
|
|
1031
|
+
}>;
|
|
1032
|
+
coverage?: Array<{
|
|
1033
|
+
decisionId: string;
|
|
1034
|
+
status: 'unprojected' | 'partially_projected' | 'projected';
|
|
1035
|
+
}>;
|
|
1036
|
+
}): Promise<{
|
|
1037
|
+
projectionId: string;
|
|
1038
|
+
entryIds: string[];
|
|
1039
|
+
headSequence: number;
|
|
1040
|
+
}>;
|
|
1041
|
+
private loadSource;
|
|
1042
|
+
private withIndexedCandidates;
|
|
1043
|
+
private refreshIndex;
|
|
1044
|
+
}
|
|
1045
|
+
declare function parseOwnerReviewCommand(value: unknown): OwnerReviewCommand;
|
|
1046
|
+
declare function parseContextualReviewQuery(value: unknown): ContextualReviewQuery;
|
|
1047
|
+
|
|
1048
|
+
export { type CommitReviewPlanOptions, type MemoryJournalLoadReport, type MemoryJournalLoadResult, type MemoryJournalManifest, type MemoryJournalMutation, MemoryJournalStore, type MemoryJournalTransaction, type MemoryReviewResult, MemoryService, type MemoryServiceStatus, computeTransactionHash, parseContextualReviewQuery, parseOwnerReviewCommand };
|