@keb-org/consol 0.1.1 → 0.3.0

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.
@@ -0,0 +1,96 @@
1
+ import { type CallOptions, type Context, type Transport } from "./transport";
2
+ import type { Reply } from "./types";
3
+ /** A contextualized-embeddings endpoint (`POST {url}/contextualizedembeddings`); without it recall stays lexical-only. */
4
+ export interface EmbeddingOptions {
5
+ url: string;
6
+ /** Omit for endpoints that take no key. */
7
+ apiKey?: string;
8
+ model: string;
9
+ dims?: number;
10
+ timeoutMs?: number;
11
+ }
12
+ /** Jev advice (experimental). */
13
+ export interface JevOptions {
14
+ url?: string;
15
+ apiKey?: string;
16
+ model?: string;
17
+ /** `false` turns automatic triage off. */
18
+ auto?: boolean;
19
+ }
20
+ /**
21
+ * What starts the in-process engine. Options become its settings (the CONSOL_* map); this process's
22
+ * own CONSOL_* variables are never read, except CONSOL_DB_URL as the default database.
23
+ */
24
+ export interface EngineOptions {
25
+ /** Database URL: PostgreSQL with pgvector, or CockroachDB. Without it this process's `CONSOL_DB_URL` applies; the engine needs one. */
26
+ db?: string;
27
+ embedding?: EmbeddingOptions;
28
+ jev?: JevOptions;
29
+ /** Explicit `consol.node`; otherwise CONSOL_ADDON, then the platform package. */
30
+ addonPath?: string;
31
+ /** Any other engine setting (a CONSOL_* name), applied last. */
32
+ env?: Record<string, string>;
33
+ /** Default per-call deadline in ms (300000); 0 disables it. */
34
+ timeoutMs?: number;
35
+ /** Receives each engine log line. One sink is shared by every engine in the process. */
36
+ onLog?: (line: string) => void;
37
+ /** Which engine lines reach `onLog`: an EnvFilter directive such as `info` or `consol_engine=debug` (default `warn`). Process-wide like the sink: the latest one set wins. */
38
+ logLevel?: string;
39
+ }
40
+ export declare function engineSettings(o: EngineOptions): Record<string, string>;
41
+ /** One opened engine of `consol.node`. A frame is the JSON of `{op, ...}`; the answer is the Reply JSON. */
42
+ export interface NativeEngine {
43
+ request(frame: string): Promise<string>;
44
+ close(): Promise<void>;
45
+ }
46
+ /** What the SDK uses of `consol.node`. Failures reject with an Error whose message is JSON `{code, message, field?}`. */
47
+ export interface Addon {
48
+ version(): string;
49
+ /** `location` is the JSON `{"vaultRoot"}` or `{"vault"}`. */
50
+ openEngine(location: string, settings: Record<string, string>): Promise<NativeEngine>;
51
+ setLogSink(sink: ((line: string) => void) | null, level?: string): void;
52
+ /** JSON `{instructions, tools: [{name, description, inputSchema}]}` of the MCP server. Needs no engine. */
53
+ mcpSurface(): string;
54
+ /** The MCP `CallToolResult` (JSON) of a wire reply (JSON) of `tool`. Needs no engine. */
55
+ mcpResult(tool: string, reply: string): string;
56
+ }
57
+ /**
58
+ * Explicit path authoritative (a missing file fails here), then CONSOL_ADDON authoritative, then the
59
+ * platform package resolved relative to this SDK file. CONSOL_ADDON is read only here. Loaded on
60
+ * first use, so importing the SDK never fails.
61
+ */
62
+ export declare function loadAddon(explicit?: string): Addon;
63
+ export interface NativeOptions extends EngineOptions {
64
+ location: {
65
+ vaultRoot: string;
66
+ } | {
67
+ vault: string;
68
+ };
69
+ /** After opening the engine: create or open this vault. */
70
+ boot?: {
71
+ vault: string;
72
+ create: boolean;
73
+ };
74
+ /** The SDK version the addon's major.minor must match. */
75
+ sdkVersion: string;
76
+ }
77
+ /** The engine of `consol.node` in this process: one frame per call, answered by a Reply JSON, in any order. */
78
+ export declare class NativeTransport implements Transport {
79
+ private readonly engine;
80
+ readonly version: string;
81
+ private readonly timeoutMs;
82
+ private readonly unsubscribe;
83
+ private readonly closed;
84
+ private closing;
85
+ private constructor();
86
+ /** Loads the addon, checks its version, opens the engine and runs the boot step; a failure leaves nothing open. */
87
+ static start(opts: NativeOptions): Promise<NativeTransport>;
88
+ /** Final and idempotent: in-flight and later calls fail with `closed`. Every close() returns the same promise. */
89
+ close(): Promise<void>;
90
+ private shutdown;
91
+ private send;
92
+ /** Runs one envelope under `ctx`. The reply is returned untouched, tool errors included. */
93
+ handle(body: unknown, ctx: Context, options?: CallOptions): Promise<Reply>;
94
+ /** Create or open a vault by name; a refusal arrives as the reply's `vault_exists` / `vault_not_found`. */
95
+ vaultOp(op: "create_vault" | "open_vault", vault: string, options?: CallOptions): Promise<Reply>;
96
+ }
@@ -12,9 +12,9 @@ export interface Context {
12
12
  /** Pins the agent; the request cannot name another one. */
13
13
  agent?: string | null;
14
14
  }
15
- /** One way to move an envelope: a stdio child or HTTP. Internal: only Vault and Consol are public. */
15
+ /** One way to move an envelope: the in-process engine or HTTP. Internal: only Vault and Consol are public. */
16
16
  export interface Transport {
17
- /** Server version of the last reply; null before the first. */
17
+ /** Engine version (known at start) or, over HTTP, that of the last reply; null before the first. */
18
18
  readonly version: string | null;
19
19
  handle(body: unknown, ctx: Context, options?: CallOptions): Promise<Reply>;
20
20
  /** Final and idempotent. */
@@ -24,6 +24,7 @@ export interface Transport {
24
24
  export declare function deadline(ms: number | undefined, fallback: number): number;
25
25
  /** Server major.minor must equal the SDK's; returns the server version. */
26
26
  export declare function checkVersion(got: unknown, sdk: string): string;
27
+ export declare const anySignal: (signals: AbortSignal[]) => AbortSignal;
27
28
  /** POSTs the envelope to `url`; the caller's headers are the backend's auth. Stateless. */
28
29
  export declare class HttpTransport implements Transport {
29
30
  private readonly url;
package/dist/types.d.ts CHANGED
@@ -3,7 +3,7 @@ import type { ConsolErrorCode } from "./errors";
3
3
  type Open<T extends string> = T | (string & {});
4
4
  /**
5
5
  * The wire reply, the same on every transport. `text` is rendered for an LLM, `result` is the
6
- * contract payload (receipt fields next to `error` for a failed reflection-bound write). Tool
6
+ * contract payload (receipt fields next to `error` for a failed token-bound write). Tool
7
7
  * errors are replies with `error`, never exceptions.
8
8
  */
9
9
  export interface Reply {
@@ -19,7 +19,7 @@ export interface ToolError {
19
19
  code: ConsolErrorCode;
20
20
  retryable: boolean;
21
21
  message: string;
22
- /** Input at fault as a path, e.g. `decisions[2].temporal.evidence[0]`; only when one input is to blame. */
22
+ /** Input at fault as a path, e.g. `decisions[2].refs[0]`; only when one input is to blame. */
23
23
  field?: string;
24
24
  }
25
25
  /** Part of a successful call that could not be done; an empty list means nothing was degraded. */
@@ -106,11 +106,11 @@ export interface RecallCard {
106
106
  }
107
107
  /** Every `jev`, `jev_triage` and `jev_advisory` field is experimental: present only with Jev configured. */
108
108
  export type Experimental = Record<string, unknown>;
109
- /** `recall` payload: at most `limit` cards, linked companions included. */
109
+ /** `recall` payload: at most 30 cards (100 for a `*` query), linked companions included. */
110
110
  export interface RecallResult {
111
111
  /**
112
112
  * The progressive disclosure as a model reads it: full cards with excerpts, lead and id cards,
113
- * the question's intent block and the hints. `candidates` are the same cards as data.
113
+ * the blocks its query symbols ask for and the hints. `candidates` are the same cards as data.
114
114
  */
115
115
  text: string;
116
116
  candidates: RecallCard[];
@@ -131,7 +131,7 @@ export interface EntityAffectedGroup {
131
131
  entity: string;
132
132
  docs: AffectedDoc[];
133
133
  }
134
- /** `remember` receipt; a reflection-bound write adds `reflection_write` to this same shape. */
134
+ /** `remember` receipt; a token-bound write adds `reflection_write` to this same shape. */
135
135
  export interface RememberResult {
136
136
  changed: boolean;
137
137
  indexed: boolean;
@@ -145,8 +145,10 @@ export interface RememberResult {
145
145
  affected: AffectedDoc[];
146
146
  entity_affected: EntityAffectedGroup[];
147
147
  unavailable: Unavailable[];
148
- /** Outcome of a reflection-bound write (and of the resume form). */
148
+ /** Outcome of a token-bound write (and of the write-token resume form). */
149
149
  reflection_write?: WriteOutcome;
150
+ /** `meta.<key>` for each `meta` key the server does not know; absent when there are none. */
151
+ ignored?: string[];
150
152
  jev?: Experimental;
151
153
  }
152
154
  /** `remove` receipt: the note is archived, its body stays readable and editable. */
@@ -163,7 +165,7 @@ export interface RemoveResult {
163
165
  reflection_write?: WriteOutcome;
164
166
  jev?: Experimental;
165
167
  }
166
- /** Durable state of a reflection-bound write (open); only `succeeded` published bytes. */
168
+ /** Durable state of a token-bound write (open); only `succeeded` published bytes. */
167
169
  export type WriteState = Open<"pending" | "succeeded" | "conflicted" | "abandoned">;
168
170
  /** Why a reflection write has not succeeded yet (open); resume or abandon it explicitly. */
169
171
  export type WriteFailureCode = Open<"source_conflict" | "basis_changed" | "index_pending" | "publication_pending" | "receipt_pending">;
@@ -180,10 +182,13 @@ export interface WriteResolution {
180
182
  inspected: SourceRef | null;
181
183
  reason: string;
182
184
  }
183
- /** Outcome of one reflection-bound write; a write never completes the work by itself. */
185
+ /** Outcome of one token-bound write; a write never completes the work by itself. */
184
186
  export interface WriteOutcome {
185
- work_id: string;
186
- action_key: string;
187
+ /** Write token: resume the write with it through `tool`, or abandon it through `reflect`. */
188
+ token: string;
189
+ tool: "remember" | "remove";
190
+ /** The note the write targets. */
191
+ id: string;
187
192
  state: WriteState;
188
193
  /** True for a replayed terminal outcome: it describes history, not the current source. */
189
194
  historical: boolean;
@@ -193,8 +198,16 @@ export interface WriteOutcome {
193
198
  resolution: WriteResolution | null;
194
199
  failure_code: WriteFailureCode | null;
195
200
  }
196
- /** Queue state of a work item; only an accepted decision completes it. */
197
- export type WorkStatus = "pending" | "completed" | "blocked" | "retryable" | "stale";
201
+ /** An unresolved (pending or conflicted) write, as `reflect` lists every one of them on every call. */
202
+ export interface UnresolvedWrite {
203
+ token: string;
204
+ tool: "remember" | "remove";
205
+ id: string;
206
+ state: WriteState;
207
+ failure_code: WriteFailureCode | null;
208
+ }
209
+ /** Queue state of a work item that is not open for a decision; only an accepted decision completes work. */
210
+ export type ItemStatus = Open<"completed" | "stale">;
198
211
  /** Pair found through a link authored in `owner`. */
199
212
  export interface AuthoredLead {
200
213
  route: "authored";
@@ -208,11 +221,6 @@ export interface SharedFacetLead {
208
221
  route: "shared_facet";
209
222
  value: string;
210
223
  }
211
- /** Pair found through a shared numeric value. */
212
- export interface SharedNumericLead {
213
- route: "shared_numeric";
214
- value: string;
215
- }
216
224
  /** Pair found through embedding similarity (embeddings on only). */
217
225
  export interface SemanticLead {
218
226
  route: "semantic";
@@ -224,7 +232,7 @@ export interface SemanticLead {
224
232
  score: number;
225
233
  }
226
234
  /** Discovery witness of a pair; one witness, not an exhaustive list or a truth judgment. */
227
- export type PairLead = AuthoredLead | SharedFacetLead | SharedNumericLead | SemanticLead;
235
+ export type PairLead = AuthoredLead | SharedFacetLead | SemanticLead;
228
236
  /** Hub witness; `target` is null when a new hub would be formed. Unstable: checked against Rust source only. */
229
237
  export interface HubLead {
230
238
  route: "hub";
@@ -241,43 +249,6 @@ export interface PromotionLead {
241
249
  scope: "skills" | "core";
242
250
  existing: string[];
243
251
  }
244
- /** Sources a work item was judged on; the basis hash binds decisions to exactly these versions. */
245
- export interface WorkBasis<L> {
246
- subjects: SourceRef[];
247
- sources: SourceRef[];
248
- lead: L;
249
- }
250
- /** Shared by every work kind, so they stay readable before narrowing on `kind`. */
251
- export interface WorkBase {
252
- work_id: string;
253
- basis_hash: string;
254
- status: WorkStatus;
255
- }
256
- /** Review one note; source work carries no lead. */
257
- export interface SourceWork extends WorkBase {
258
- kind: "source";
259
- basis: {
260
- subjects: SourceRef[];
261
- sources: SourceRef[];
262
- };
263
- }
264
- /** Compare two notes. */
265
- export interface PairWork extends WorkBase {
266
- kind: "pair";
267
- basis: WorkBasis<PairLead>;
268
- }
269
- /** Form, attach to or bridge a hub. Unstable: checked against Rust source only. */
270
- export interface HubWork extends WorkBase {
271
- kind: "hub_attachment" | "hub_formation" | "hub_bridge";
272
- basis: WorkBasis<HubLead>;
273
- }
274
- /** Promote recurring knowledge to skills/core. Unstable: checked against Rust source only. */
275
- export interface PromotionWork extends WorkBase {
276
- kind: "promotion";
277
- basis: WorkBasis<PromotionLead>;
278
- }
279
- /** A delivered work item, discriminated on `kind`. */
280
- export type ReflectionWork = SourceWork | PairWork | HubWork | PromotionWork;
281
252
  /** Markdown block of a delivered source, as a suggested excerpt boundary. */
282
253
  export interface CandidateBlock {
283
254
  byte_range: ByteRange;
@@ -292,50 +263,62 @@ export interface DeliveredSource {
292
263
  /** Suggested body spans, not a replacement for inspection. */
293
264
  candidate_blocks: CandidateBlock[];
294
265
  }
295
- /** Work delivered with every source body; deliver, write and decide are separate steps. */
296
- export interface CompleteDelivery {
297
- work: ReflectionWork;
266
+ /** Shared by every work kind, so they stay readable before narrowing on `kind`. */
267
+ export interface ItemBase {
268
+ /** Work token: pass it to `remember` / `remove` to bind a write, and in a decision. Opaque. */
269
+ token: string;
270
+ /** What the server offers for this item (open: it grows without a schema change); empty when `status` is set. */
271
+ verdicts: string[];
272
+ /** The evidence each verdict requires. */
273
+ needs: string[];
274
+ subjects: SourceRef[];
275
+ /** The complete Markdown of every source the item was judged on. */
298
276
  sources: DeliveredSource[];
299
- complete: true;
277
+ /** Present only when the work is not open for a decision (`verdicts` is then empty). */
278
+ status?: ItemStatus;
300
279
  jev_advisory?: Experimental;
301
280
  }
302
- /** Work or a requested source that could not be delivered this call; the call itself succeeded. */
303
- export interface FailedDelivery {
304
- /** Present when the work is known. */
305
- work_id?: string;
306
- /** Present for a requested source (`ids` mode). */
307
- requested_id?: string;
308
- complete: false;
309
- error: ToolError;
281
+ /** Review one note; source work carries no lead. */
282
+ export interface SourceItem extends ItemBase {
283
+ kind: "source";
310
284
  }
311
- /** One entry of `reflect().deliveries`; narrow on `complete`. */
312
- export type ReflectDelivery = CompleteDelivery | FailedDelivery;
313
- /** Allowed `disposition` values of a source decision. */
314
- export type SourceDisposition = "synthesize" | "connect" | "archive" | "retained_raw" | "blocked" | "retryable_error" | "stale";
315
- /** Allowed `disposition` values of a pair decision. */
316
- export type PairDisposition = "linked" | "no_relation" | "unresolved" | "blocked" | "retryable_error" | "stale";
317
- /** Allowed `disposition` values of a hub or promotion decision. */
318
- export type ConsolidationDisposition = "applied" | "reused" | "rejected" | "retained_raw" | "blocked" | "retryable_error" | "stale";
319
- /** Accepted source/pair/hub/promotion decision; `status` echoes the disposition. */
320
- export interface AcceptedDecision {
321
- work_id: string;
322
- accepted: true;
323
- status: SourceDisposition | PairDisposition | ConsolidationDisposition;
285
+ /** Compare two notes. `validity` is computed from their bounds; where it is `unknown` a verdict may carry a second word. */
286
+ export interface PairItem extends ItemBase {
287
+ kind: "pair";
288
+ lead: PairLead;
289
+ validity?: Open<"overlap" | "disjoint" | "empty" | "unknown">;
324
290
  }
325
- /** Accepted `abandon_write`; the resulting outcome is in `writes`. */
326
- export interface AcceptedAbandon {
327
- work_id: string;
328
- action_key: string;
291
+ /** Form, attach to or bridge a hub. Unstable: checked against Rust source only. */
292
+ export interface HubItem extends ItemBase {
293
+ kind: "hub_attachment" | "hub_formation" | "hub_bridge";
294
+ lead: HubLead;
295
+ }
296
+ /** Promote recurring knowledge to skills/core. Unstable: checked against Rust source only. */
297
+ export interface PromotionItem extends ItemBase {
298
+ kind: "promotion";
299
+ lead: PromotionLead;
300
+ }
301
+ /** A delivered work item, discriminated on `kind`. */
302
+ export type ReflectItem = SourceItem | PairItem | HubItem | PromotionItem;
303
+ /** Accepted decision; `verdict` repeats the outcome (and a pair's validity word). */
304
+ export interface AcceptedDecision {
305
+ token: string;
329
306
  accepted: true;
307
+ verdict: string;
330
308
  }
331
309
  /** Failed decision; the call still succeeds and later decisions still run. */
332
310
  export interface RejectedDecision {
333
- work_id: string;
311
+ token: string;
334
312
  accepted: false;
335
313
  error: ToolError;
336
314
  }
337
315
  /** One entry of `reflect().decisions`, in submission order. */
338
- export type DecisionReceipt = AcceptedDecision | AcceptedAbandon | RejectedDecision;
316
+ export type DecisionReceipt = AcceptedDecision | RejectedDecision;
317
+ /** A `focus` target that could not be delivered, or a work that failed to deliver; the call itself succeeded. */
318
+ export interface FocusError {
319
+ focus: string;
320
+ error: ToolError;
321
+ }
339
322
  /** Discovery lanes in the order the server reports them. */
340
323
  export type ReflectionLane = "source" | "semantic_pairs" | "structural_pairs" | "hubs" | "promotions";
341
324
  /** Progress of one discovery page. */
@@ -364,7 +347,7 @@ export type DiscoveryLane = {
364
347
  error: ToolError;
365
348
  current_complete?: boolean;
366
349
  };
367
- /** Queue counters; `done` is true only when every lane is exhausted and nothing is open. */
350
+ /** Queue counters; `done` is true only when every lane is current and nothing is open. */
368
351
  export interface ReflectCounters {
369
352
  pending: number;
370
353
  blocked: number;
@@ -372,17 +355,25 @@ export interface ReflectCounters {
372
355
  unresolved_writes: number;
373
356
  done: boolean;
374
357
  }
375
- /** `reflect` payload for every mode; unused sections are empty. Check `counters.done` before assuming nothing is left. */
358
+ /** What to do next: `resume` unresolved writes, `decide` the delivered items, `continue` the scan, or `done`. */
359
+ export type ReflectNext = Open<"resume" | "decide" | "continue" | "done">;
360
+ /**
361
+ * `reflect` payload. One call applies its decisions, then delivers work, so a loop is: call with the
362
+ * decisions so far and follow `next`. `writes` lists every unresolved write on every call.
363
+ */
376
364
  export interface ReflectResult {
377
- deliveries: ReflectDelivery[];
365
+ next: ReflectNext;
366
+ items: ReflectItem[];
367
+ writes: UnresolvedWrite[];
368
+ /** Work tokens of blocked work; pass one in `focus` to reopen it. */
369
+ blocked: string[];
378
370
  decisions: DecisionReceipt[];
379
- writes: WriteOutcome[];
380
- /** Lanes are filled by discovery (no targets) only. */
381
- discovery: {
382
- completion_checked: boolean;
383
- lanes: DiscoveryLane[];
384
- };
385
371
  counters: ReflectCounters;
372
+ /** Empty when `focus` named targets. */
373
+ lanes: DiscoveryLane[];
374
+ /** `focus` symbols this version does not know. */
375
+ ignored?: string[];
376
+ errors?: FocusError[];
386
377
  jev?: Experimental;
387
378
  jev_triage?: Experimental;
388
379
  }
package/dist/vault.d.ts CHANGED
@@ -1,12 +1,12 @@
1
- import { type EngineOptions } from "./stdio";
1
+ import { type EngineOptions } from "./native";
2
2
  import { type CallOptions } from "./transport";
3
- import type { ConsolidationDisposition, PairDisposition, ReadResult, RecallResult, Reply, ReflectResult, RememberResult, RemoveResult, Scope, SourceDisposition } from "./types";
3
+ import type { ReadResult, RecallResult, Reply, ReflectResult, RememberResult, RemoveResult, Scope } from "./types";
4
4
  export { sliceUtf8 } from "./types";
5
5
  export declare const CLIENT_INFO: {
6
6
  name: string;
7
7
  version: string;
8
8
  };
9
- /** Local vault: the SDK spawns `consol stdio` for it. */
9
+ /** Local vault: the engine runs in this process. */
10
10
  export interface VaultOptions extends EngineOptions {
11
11
  /** Local directory, or `s3://bucket[/prefix]/<name>` (needs `db`; AWS_* from the environment). */
12
12
  path: string;
@@ -24,85 +24,24 @@ export interface HostedOptions {
24
24
  /** Default per-call deadline in ms (300000); 0 disables it. */
25
25
  timeoutMs?: number;
26
26
  }
27
- /** Binds one recoverable write to inspected work; a write never completes the work. */
28
- export interface ReflectionContext {
29
- work_id: string;
30
- basis_hash: string;
31
- action_key: string;
32
- }
33
- /** Decision input source reference; unlike results it never carries `review_version`. */
34
- export interface InspectedSource {
35
- id: string;
36
- owner: string;
37
- content_version: string;
38
- }
39
- /** Body byte range (UTF-8, frontmatter excluded) that a decision cites as evidence. */
40
- export interface InspectedSpan {
41
- source: InspectedSource;
42
- byte_range: [number, number];
43
- }
44
- /** Required for completed pair decisions so validity periods are compared, not assumed. */
45
- export interface TemporalAssessment {
46
- validity: "overlap" | "disjoint" | "empty" | "unknown";
47
- reason: string;
48
- evidence: InspectedSpan[];
49
- correction_reason?: string;
50
- }
51
- /** Names the authored link a `linked` pair decision relies on. */
52
- export interface PairAssertion {
53
- owner: InspectedSource;
54
- src: string;
55
- dst: string;
56
- relation: "derives" | "causes" | "contradicts" | "questions";
57
- }
58
27
  /**
59
- * One explicit outcome for `reflect({ decisions })`; the tool schema defines each kind's required
60
- * evidence. `retry_after_ms` is an epoch-ms timestamp within the next day, only for `retryable_error`.
61
- * Hub and promotion decisions are experimental.
28
+ * One outcome for `reflect({ decisions })`. `token` is an item's work token, or a write token to
29
+ * abandon that write. `verdict` is one of the item's `verdicts` (`abandon` for a write token); a
30
+ * pair verdict may add `overlap`, `disjoint` or `empty` only where the item's `validity` is unknown.
31
+ * `refs` is what you inspected: `id@version` (a whole source) or `id@version#start-end` (a body
32
+ * span, UTF-8 byte offsets). `outputs` are the notes the work produced or relied on, `id@version`.
62
33
  */
63
- export type Decision = {
64
- kind: "source";
65
- work_id: string;
66
- basis_hash: string;
67
- disposition: SourceDisposition;
68
- reason: string;
69
- outputs?: InspectedSource[];
70
- action_keys?: string[];
71
- retry_after_ms?: number;
72
- } | {
73
- kind: "pair";
74
- work_id: string;
75
- basis_hash: string;
76
- disposition: PairDisposition;
77
- reason: string;
78
- temporal?: TemporalAssessment;
79
- assertion?: PairAssertion;
80
- action_keys?: string[];
81
- retry_after_ms?: number;
82
- } | {
83
- kind: "hub" | "promotion";
84
- work_id: string;
85
- basis_hash: string;
86
- disposition: ConsolidationDisposition;
34
+ export interface Decision {
35
+ token: string;
36
+ verdict: string;
87
37
  reason: string;
88
- outputs?: InspectedSource[];
89
- evidence?: InspectedSpan[];
90
- action_keys?: string[];
91
- retry_after_ms?: number;
92
- } | {
93
- kind: "abandon_write";
94
- work_id: string;
95
- basis_hash: string;
96
- action_key: string;
97
- inspected: InspectedSource | null;
98
- reason: string;
99
- };
38
+ refs?: string[];
39
+ outputs?: string[];
40
+ }
100
41
  /** Flat wire args for recall. */
101
42
  export interface RecallArgs {
102
43
  query: string;
103
44
  agent?: string;
104
- include_history?: boolean;
105
- limit?: number;
106
45
  }
107
46
  /** Flat wire args for read. */
108
47
  export interface ReadArgs {
@@ -111,8 +50,8 @@ export interface ReadArgs {
111
50
  continuation?: string;
112
51
  }
113
52
  /**
114
- * Flat wire args for remember. Omitted or null metadata preserves the stored value; "" or [] clears
115
- * it. Without `expected_version` the write is create-only.
53
+ * Wire args for remember. Omitted or null `content` preserves the body. Without `expected_version`
54
+ * the write is create-only.
116
55
  */
117
56
  export interface RememberArgs {
118
57
  id: string;
@@ -120,44 +59,50 @@ export interface RememberArgs {
120
59
  /** Markdown body only, never frontmatter. */
121
60
  content?: string | null;
122
61
  expected_version?: string;
123
- entities?: string[] | null;
124
- facets?: string[] | null;
125
- scope?: Scope | null;
126
- summary?: string | null;
127
- team?: string | null;
128
- /** `YYYY-MM-DD` or RFC 3339 with `Z`/offset; "" clears the bound. */
129
- valid_from?: string | null;
130
- valid_to?: string | null;
131
- reflection?: ReflectionContext;
62
+ /**
63
+ * A key left out keeps its value; null, "" or [] clears it (not `scope` or `team`: null keeps
64
+ * them). `valid_from`/`valid_to` are `YYYY-MM-DD` or RFC 3339 with `Z`/offset. A key the server
65
+ * does not know is ignored and listed in the receipt's `ignored`.
66
+ */
67
+ meta?: {
68
+ summary?: string | null;
69
+ entities?: string[] | null;
70
+ facets?: string[] | null;
71
+ scope?: Scope | null;
72
+ team?: string | null;
73
+ valid_from?: string | null;
74
+ valid_to?: string | null;
75
+ [key: string]: unknown;
76
+ };
77
+ /** An item's work token from `reflect` binds this write to that work; the server derives its action key. */
78
+ token?: string;
132
79
  }
133
80
  /** Flat wire args for remove (archives the note; its body stays readable). */
134
81
  export interface RemoveArgs {
135
82
  id: string;
136
83
  expected_version: string;
137
84
  agent?: string;
138
- reflection?: ReflectionContext;
85
+ /** An item's work token from `reflect` records this archive as one write of that work. */
86
+ token?: string;
139
87
  }
140
- /** Resume a pending reflection-bound write with the same context and tool. */
88
+ /** Resume (or replay) a write by its write token, with the tool that wrote it. */
141
89
  export interface ResumeArgs {
142
- resume: true;
143
- reflection: ReflectionContext;
90
+ token: string;
144
91
  agent?: string;
145
92
  }
146
- /** Flat wire args for reflect. */
93
+ /** Flat wire args for reflect. `focus` is whitespace-separated work tokens and note ids. */
147
94
  export interface ReflectArgs {
148
95
  agent?: string;
149
- ids?: string[];
150
- work_ids?: string[];
151
- limit?: number;
96
+ focus?: string;
152
97
  decisions?: Decision[];
153
98
  }
154
- /** One vault behind a transport (a local child or a hosted backend). Build it with createVault or openVault; close() is final. */
99
+ /** One vault behind a transport (the in-process engine or a hosted backend). Build it with createVault or openVault; close() is final. */
155
100
  export declare class Vault {
156
101
  private readonly transport;
157
102
  private readonly vault;
158
103
  private readonly agent;
159
104
  private constructor();
160
- /** Server version of the last reply; null before the first. */
105
+ /** Engine version (known once opened); a hosted vault's is that of the last reply, null before the first. */
161
106
  get serverVersion(): string | null;
162
107
  /** Final and idempotent; concurrent calls share one completion. Later calls fail with `closed`. */
163
108
  close(): Promise<void>;
@@ -171,10 +116,10 @@ export declare class Vault {
171
116
  remove(args: RemoveArgs | ResumeArgs, options?: CallOptions): Promise<RemoveResult>;
172
117
  reflect(args?: ReflectArgs, options?: CallOptions): Promise<ReflectResult>;
173
118
  }
174
- /** Creates the vault and starts its child; fails with `vault_exists` when a vault marker exists. */
119
+ /** Creates the vault and opens its engine; fails with `vault_exists` when a vault marker exists. */
175
120
  export declare function createVault(options: VaultOptions): Promise<Vault>;
176
121
  /**
177
- * Local: starts the child of an existing vault (`vault_not_found` when no marker exists). Hosted
122
+ * Local: opens the engine of an existing vault (`vault_not_found` when no marker exists). Hosted
178
123
  * (`url`): no round trip here, a missing vault is `vault_not_found` on the first call.
179
124
  */
180
125
  export declare function openVault(options: VaultOptions | HostedOptions): Promise<Vault>;