@popmelt.com/core 0.8.13 → 0.8.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/server.d.mts CHANGED
@@ -33,7 +33,13 @@ type ImprintConcrete = {
33
33
  createdAt: string;
34
34
  updatedAt: string;
35
35
  };
36
- type ImprintRelationType = 'operationalizes' | 'refines' | 'supports' | 'contradicts' | 'excepts' | 'instantiates' | 'supersedes';
36
+ type ImprintTopologyRelationType = 'expresses' | 'excepts';
37
+ /**
38
+ * Historical relation names remain readable so append-only Imprint journals can
39
+ * be replayed. New writers must use ImprintTopologyRelationType.
40
+ */
41
+ type LegacyImprintRelationType = 'operationalizes' | 'refines' | 'supports' | 'contradicts' | 'instantiates' | 'supersedes';
42
+ type ImprintRelationType = ImprintTopologyRelationType | LegacyImprintRelationType;
37
43
  type ImprintRelation = {
38
44
  id: string;
39
45
  type: ImprintRelationType;
@@ -95,7 +101,7 @@ type ImprintTransaction = {
95
101
  previousHash: string | null;
96
102
  hash: string;
97
103
  source: {
98
- kind: 'automatic' | 'grounding' | 'correction' | 'undo';
104
+ kind: 'automatic' | 'grounding' | 'correction' | 'migration' | 'undo';
99
105
  threadId: string;
100
106
  jobId: string;
101
107
  };
@@ -125,7 +131,7 @@ type ImprintThreadSummary = {
125
131
  };
126
132
  resolvedAction?: ImprintGroundingAction;
127
133
  };
128
- type ImprintGroundingAction = 'confirm' | 'reason_wrong' | 'narrow' | 'exception' | 'edit' | 'dont_learn' | 'undo';
134
+ type ImprintGroundingAction = 'yes' | 'this_time' | 'no';
129
135
  type ImprintContext = {
130
136
  explanations: Array<Pick<ImprintExplanation, 'id' | 'kind' | 'statement' | 'rationale' | 'scope' | 'state'> & {
131
137
  concrete: Array<Pick<ImprintConcrete, 'id' | 'modelPath' | 'value'>>;
@@ -174,7 +180,12 @@ declare class ImprintStore {
174
180
  private writeChain;
175
181
  constructor(projectRoot: string, projectId: string);
176
182
  private readManifest;
183
+ private loadRaw;
177
184
  load(): Promise<ImprintLoadResult>;
185
+ migrateTopology(): Promise<{
186
+ migrated: boolean;
187
+ relationMutations: number;
188
+ }>;
178
189
  commit(input: {
179
190
  transactionId: string;
180
191
  committedAt: string;
@@ -215,7 +226,7 @@ type ProposedMutation = {
215
226
  summary: string;
216
227
  } | {
217
228
  op: 'relation';
218
- type: ImprintRelationType;
229
+ type: ImprintTopologyRelationType;
219
230
  fromId: string;
220
231
  toId: string;
221
232
  rationale: string;
@@ -249,9 +260,36 @@ type ImprintMutationDraft = {
249
260
  question: string;
250
261
  };
251
262
  };
252
- type ImprintDraft = ImprintMutationDraft | {
263
+ type ImprintApplicationDraft = {
264
+ decision: 'apply';
265
+ summary: {
266
+ title: string;
267
+ detail: string;
268
+ };
269
+ appliedExplanationIds: string[];
270
+ grounding?: {
271
+ explanationId: string;
272
+ question: string;
273
+ };
274
+ };
275
+ type ImprintRecognitionDraft = {
276
+ decision: 'recognize';
277
+ explanationId: string;
278
+ summary: {
279
+ title: string;
280
+ detail: string;
281
+ };
282
+ };
283
+ type ImprintDraft = ImprintMutationDraft | ImprintApplicationDraft | ImprintRecognitionDraft | {
253
284
  decision: 'none';
254
285
  reason: ImprintNoopReason;
286
+ duplicateOfExplanationId?: string;
287
+ scopeComparison?: 'equivalent' | 'existing_broader';
288
+ };
289
+ type ImprintParseContext = {
290
+ context?: ImprintContext;
291
+ requestText?: string;
292
+ applicationOccurred?: boolean;
255
293
  };
256
294
  type ImprintCaptureInput = {
257
295
  threadId: string;
@@ -259,20 +297,26 @@ type ImprintCaptureInput = {
259
297
  occurredAt?: string;
260
298
  concreteModel?: Record<string, unknown> | null;
261
299
  pendingGroundingExplanationIds?: string[];
300
+ applicationOccurred?: boolean;
262
301
  };
263
- declare function parseImprintDraft(responseText: string): {
302
+ declare function parseImprintDraft(responseText: string, parseContext?: ImprintParseContext): {
264
303
  draft?: ImprintDraft;
265
304
  visibleText: string;
266
305
  error?: string;
267
306
  };
268
- declare function formatImprintPrompt(context: ImprintContext | undefined): string;
307
+ declare function formatImprintPrompt(context: ImprintContext | undefined, options?: {
308
+ requestText?: string;
309
+ }): string;
269
310
  declare class ImprintService {
270
311
  readonly store: ImprintStore;
271
312
  private readonly noopCounts;
313
+ private readonly assessmentFailures;
272
314
  constructor(projectRoot: string, projectId: string);
273
315
  recordNoop(reason: ImprintNoopReason): void;
316
+ recordAssessmentFailure(state: 'missing' | 'invalid'): void;
274
317
  diagnostics(): {
275
318
  noopDecisions: Partial<Record<ImprintNoopReason, number>>;
319
+ assessmentFailures: Partial<Record<'missing' | 'invalid', number>>;
276
320
  };
277
321
  contextualize(input: {
278
322
  text?: string;
@@ -280,11 +324,10 @@ declare class ImprintService {
280
324
  maxExplanations?: number;
281
325
  pendingGroundingExplanationIds?: string[];
282
326
  }): Promise<ImprintContext | undefined>;
283
- capture(draft: ImprintMutationDraft, input: ImprintCaptureInput): Promise<ImprintThreadSummary | undefined>;
327
+ capture(draft: ImprintMutationDraft | ImprintApplicationDraft, input: ImprintCaptureInput): Promise<ImprintThreadSummary | undefined>;
284
328
  applyGroundingAction(input: {
285
329
  summary: ImprintThreadSummary;
286
330
  action: ImprintGroundingAction;
287
- value?: string;
288
331
  threadId: string;
289
332
  jobId: string;
290
333
  occurredAt?: string;