@popmelt.com/core 0.10.1 → 0.10.3

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
@@ -48,12 +48,15 @@ type ImprintRelationType = ImprintTopologyRelationType | LegacyImprintRelationTy
48
48
  type ImprintRelation = {
49
49
  id: string;
50
50
  type: ImprintRelationType;
51
+ /** The source explanation is always owned by this relation's store. */
51
52
  fromId: string;
53
+ /** Omitted for a target in this relation's owning store. */
54
+ toStoreId?: string;
52
55
  toId: string;
53
56
  rationale: string;
54
57
  createdAt: string;
55
58
  };
56
- type QualifiedImprintRelation = Omit<ImprintRelation, 'fromId' | 'toId'> & {
59
+ type QualifiedImprintRelation = Omit<ImprintRelation, 'fromId' | 'toId' | 'toStoreId'> & {
57
60
  from: ImprintExplanationRef;
58
61
  to: ImprintExplanationRef;
59
62
  };
@@ -144,11 +147,23 @@ type ImprintGroundingAction = 'yes' | 'this_time' | 'no';
144
147
  type ImprintContext = {
145
148
  explanations: Array<Pick<ImprintExplanation, 'id' | 'kind' | 'statement' | 'rationale' | 'scope' | 'state'> & {
146
149
  concrete: Array<Pick<ImprintConcrete, 'id' | 'modelPath' | 'value'>>;
150
+ /** Internal canonical-memory address; omitted from model-facing prompts. */
151
+ memoryId?: string;
152
+ storeId?: string;
153
+ storeRoot?: string;
154
+ readOnly?: boolean;
147
155
  }>;
148
156
  truncated: boolean;
149
157
  pendingGroundingExplanationIds?: string[];
150
158
  correctionExplanationIds?: string[];
151
- relations?: Array<Pick<ImprintRelation, 'id' | 'type' | 'fromId' | 'toId' | 'rationale'>>;
159
+ relations?: Array<Pick<ImprintRelation, 'id' | 'type' | 'fromId' | 'toId' | 'toStoreId' | 'rationale'> & {
160
+ /** The store that owns the relation record. */
161
+ storeId?: string;
162
+ readOnly?: boolean;
163
+ /** Present for composed reads; local single-store callers retain fromId/toId. */
164
+ from?: ImprintExplanationRef;
165
+ to?: ImprintExplanationRef;
166
+ }>;
152
167
  /** Explicit target/reference language detected in the current request. */
153
168
  retrievalIntent?: {
154
169
  target: string;
@@ -158,7 +173,13 @@ type ImprintContext = {
158
173
  * Directly relevant rejected history. These are warnings, not active
159
174
  * explanations, and therefore cannot be cited as Imprint usage.
160
175
  */
161
- historicalCaveats?: Array<Pick<ImprintExplanation, 'id' | 'kind' | 'statement' | 'rationale' | 'scope' | 'state'>>;
176
+ historicalCaveats?: Array<Pick<ImprintExplanation, 'id' | 'kind' | 'statement' | 'rationale' | 'scope' | 'state'> & {
177
+ storeId?: string;
178
+ storeRoot?: string;
179
+ readOnly?: boolean;
180
+ }>;
181
+ unavailableStoreIds?: string[];
182
+ unavailableTopologyStoreIds?: string[];
162
183
  };
163
184
 
164
185
  type Provider = 'claude' | 'codex' | 'copilot';
@@ -186,6 +207,17 @@ type PopmeltHandle = {
186
207
  close: () => Promise<void>;
187
208
  };
188
209
 
210
+ type ImprintManifest = {
211
+ version: 1;
212
+ topologyVersion?: 2;
213
+ projectId: string;
214
+ createdAt: string;
215
+ updatedAt: string;
216
+ head: {
217
+ sequence: number;
218
+ hash: string | null;
219
+ };
220
+ };
189
221
  type ImprintLoadResult = {
190
222
  graph: ImprintGraph;
191
223
  transactions: ImprintTransaction[];
@@ -200,6 +232,7 @@ declare class ImprintStore {
200
232
  private readonly journalDir;
201
233
  private writeChain;
202
234
  constructor(projectRoot: string, projectId: string);
235
+ readHead(): Promise<ImprintManifest['head']>;
203
236
  private readManifest;
204
237
  private loadRaw;
205
238
  load(): Promise<ImprintLoadResult>;
@@ -225,6 +258,9 @@ declare class ImprintStore {
225
258
  recover(): Promise<ImprintLoadResult>;
226
259
  }
227
260
 
261
+ type ProposedExplanationRef = Omit<ImprintExplanationRef, 'storeId'> & {
262
+ storeId?: string;
263
+ };
228
264
  type ProposedMutation = {
229
265
  op: 'add';
230
266
  clientId?: string;
@@ -248,8 +284,8 @@ type ProposedMutation = {
248
284
  } | {
249
285
  op: 'relation';
250
286
  type: ImprintTopologyRelationType;
251
- fromId: string;
252
- toId: string;
287
+ from: ProposedExplanationRef;
288
+ to: ProposedExplanationRef;
253
289
  rationale: string;
254
290
  } | {
255
291
  op: 'supersede';
@@ -323,6 +359,10 @@ type ImprintCaptureInput = {
323
359
  concreteModel?: Record<string, unknown> | null;
324
360
  pendingGroundingExplanationIds?: string[];
325
361
  applicationOccurred?: boolean;
362
+ /** The only store this capture is authorized to mutate. */
363
+ storeId?: string;
364
+ /** Surfaced mounted-store addresses available for qualified relation targets. */
365
+ context?: ImprintContext;
326
366
  };
327
367
  declare function parseImprintDraft(responseText: string, parseContext?: ImprintParseContext): {
328
368
  draft?: ImprintDraft;
@@ -336,6 +376,7 @@ declare class ImprintService {
336
376
  readonly store: ImprintStore;
337
377
  private readonly noopCounts;
338
378
  private readonly assessmentFailures;
379
+ private contextualGraphCache?;
339
380
  constructor(projectRoot: string, projectId: string);
340
381
  recordNoop(reason: ImprintNoopReason): void;
341
382
  recordAssessmentFailure(state: 'missing' | 'invalid'): void;
@@ -343,6 +384,8 @@ declare class ImprintService {
343
384
  noopDecisions: Partial<Record<ImprintNoopReason, number>>;
344
385
  assessmentFailures: Partial<Record<'missing' | 'invalid', number>>;
345
386
  };
387
+ private contextualGraph;
388
+ explanationsByIds(ids: string[]): Promise<ImprintContext['explanations']>;
346
389
  contextualize(input: {
347
390
  text?: string;
348
391
  subjectHints?: string[];