omnius 1.0.954 → 1.0.955

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.
Files changed (45) hide show
  1. package/dist/_types/execution/native-file-write-observation.d.ts +19 -0
  2. package/dist/_types/execution/native-memory-view-provider.d.ts +84 -0
  3. package/dist/_types/execution/shell-runs.d.ts +4 -0
  4. package/dist/_types/execution/tool-output-spool.d.ts +61 -0
  5. package/dist/_types/execution/tools/file-write.d.ts +53 -0
  6. package/dist/_types/execution/types.d.ts +34 -0
  7. package/dist/_types/execution/work-mode-capability.d.ts +23 -0
  8. package/dist/_types/memory/candidateCoverage.d.ts +23 -0
  9. package/dist/_types/memory/embeddings.d.ts +1 -1
  10. package/dist/_types/memory/memoryCapability.d.ts +259 -0
  11. package/dist/_types/memory/memorySourceResolver.d.ts +131 -0
  12. package/dist/_types/memory/memoryTypes.d.ts +16 -0
  13. package/dist/_types/memory/structuredMemoryStore.d.ts +63 -6
  14. package/dist/_types/memory/unifiedMemoryStore.d.ts +12 -1
  15. package/dist/_types/orchestrator/agenticRunner.d.ts +234 -46
  16. package/dist/_types/orchestrator/authored-instruction-context.d.ts +59 -0
  17. package/dist/_types/orchestrator/authored-instruction-revisions.d.ts +56 -0
  18. package/dist/_types/orchestrator/authored-instruction-sources.d.ts +60 -0
  19. package/dist/_types/orchestrator/auxiliary-context-operation.d.ts +196 -0
  20. package/dist/_types/orchestrator/brokered-tool-composition.d.ts +141 -0
  21. package/dist/_types/orchestrator/completionReadiness.d.ts +2 -2
  22. package/dist/_types/orchestrator/confined-composition-worker.d.ts +45 -0
  23. package/dist/_types/orchestrator/contentAddressedArtifactStore.d.ts +173 -0
  24. package/dist/_types/orchestrator/contextWindowDump.d.ts +4 -0
  25. package/dist/_types/orchestrator/explicit-work-mode.d.ts +92 -0
  26. package/dist/_types/orchestrator/interruption-lifecycle.d.ts +3 -0
  27. package/dist/_types/orchestrator/memory-capability-context.d.ts +49 -0
  28. package/dist/_types/orchestrator/owned-inference-wait.d.ts +123 -0
  29. package/dist/_types/orchestrator/owned-model-wait.d.ts +26 -0
  30. package/dist/_types/orchestrator/provider-context-contract.d.ts +78 -0
  31. package/dist/_types/orchestrator/request-tool-capabilities.d.ts +52 -0
  32. package/dist/_types/orchestrator/structured-memory-extraction-worker.d.ts +20 -0
  33. package/dist/_types/orchestrator/structuredMemoryInference.d.ts +12 -0
  34. package/dist/_types/orchestrator/successful-procedure-memory.d.ts +35 -0
  35. package/dist/api/py-embed.js +70 -17
  36. package/dist/index.js +2 -2
  37. package/dist/library.js +115253 -108001
  38. package/dist/memory-maintenance-worker.js +486 -81
  39. package/dist/omni-setup-worker.js +83 -30
  40. package/dist/tui/native/worker.js +3 -1
  41. package/dist/update-worker-runtime.js +270 -126
  42. package/docs/DISCOVERY.json +63 -0
  43. package/docs/DISCOVERY.md +1 -0
  44. package/npm-shrinkwrap.json +2 -2
  45. package/package.json +1 -1
@@ -0,0 +1,19 @@
1
+ export interface NativeFileWriteInvocationScope {
2
+ readonly workspaceRoot: string;
3
+ readonly sessionId: string;
4
+ readonly runId: string;
5
+ readonly taskEpoch: number;
6
+ readonly ownerId: string;
7
+ readonly ownerGeneration: number;
8
+ readonly callId: string;
9
+ }
10
+ export interface NativeFileWriteObservation {
11
+ readonly schema: 'omnius.native-file-write-observation.v1';
12
+ readonly kind: 'pre_effect_overwrite_refusal' | 'committed_mutation';
13
+ readonly canonicalTarget: string;
14
+ readonly beforeSha256: string;
15
+ readonly afterSha256: string;
16
+ readonly scope: Readonly<NativeFileWriteInvocationScope>;
17
+ }
18
+ /** Public reader only; issuance is sealed inside the actual FileWrite producer. */
19
+ export { readIssuedNativeFileWriteObservation } from "./tools/file-write.js";
@@ -0,0 +1,84 @@
1
+ /** Host-only native memory views. The opaque token is not serializable authority. */
2
+ import type { HostMemoryBindingV1, MemorySourceV1, MemorySearchResultV1 } from "../memory/memoryCapability.js";
3
+ /** Host-only native memory views. The opaque token is not serializable authority. */
4
+ import type { MemorySourceCurrent, MemorySourceKind, MemorySourceLocator } from "../memory/memorySourceResolver.js";
5
+ /** Host-only native memory views. The opaque token is not serializable authority. */
6
+ import type { MemoryCandidateCoverage } from "../memory/candidateCoverage.js";
7
+ import type { ToolInvocationContext } from "./types.js";
8
+ export interface NativeMemoryViewBinding {
9
+ readonly __nativeMemoryViewBinding?: never;
10
+ }
11
+ export declare const NATIVE_MEMORY_STORES: readonly [
12
+ "structured_records",
13
+ "project_temporal_graph",
14
+ "successful_procedures"
15
+ ];
16
+ export type NativeMemoryStore = typeof NATIVE_MEMORY_STORES[number];
17
+ export interface NativeMemoryViewRequest {
18
+ store: NativeMemoryStore;
19
+ query: string;
20
+ limit: number;
21
+ validAt?: string;
22
+ recordedAsOf?: string;
23
+ scopeIds?: string[];
24
+ }
25
+ export interface NativeMemoryViewItem {
26
+ namespace: string;
27
+ scopeRef: string;
28
+ id: string;
29
+ version: string;
30
+ text: string;
31
+ sourceKind: MemorySourceKind;
32
+ title?: string;
33
+ parentIds?: string[];
34
+ /** Private native occurrence key; never model-rendered or an opener. */
35
+ nativeId: string;
36
+ }
37
+ export interface NativeMemoryViewResult {
38
+ candidateCoverage?: MemoryCandidateCoverage[];
39
+ routeId: string;
40
+ items: NativeMemoryViewItem[];
41
+ status: "ready" | "partial" | "unsupported" | "unhealthy" | "deferred";
42
+ reasonCode?: string;
43
+ }
44
+ export interface NativeMemoryViewProvider {
45
+ availability?(store: NativeMemoryStore): "ready" | "deferred";
46
+ query(request: NativeMemoryViewRequest, binding: HostMemoryBindingV1, context?: ToolInvocationContext): Promise<NativeMemoryViewResult>;
47
+ read(locator: MemorySourceLocator, source: MemorySourceV1, binding: HostMemoryBindingV1, context?: ToolInvocationContext): Promise<MemorySourceCurrent>;
48
+ }
49
+ export declare function issueNativeMemoryViewBinding(provider: NativeMemoryViewProvider): NativeMemoryViewBinding;
50
+ /** Internal constructor registration; native class identity, not a tool name or schema. */
51
+ export declare function registerNativeMemoryViewConsumer(consumer: object): void;
52
+ export declare function readNativeMemoryViewProvider(consumer: object, token: unknown): NativeMemoryViewProvider | undefined;
53
+ export declare function nativeMemoryViewRequest(args: Record<string, unknown>, now?: string): NativeMemoryViewRequest | undefined;
54
+ /** Observational only: possession never authorizes a source read or execution. */
55
+ export interface NativeMemoryViewObservation {
56
+ schema: "omnius.native-memory-view-observation.v1";
57
+ queryId: string;
58
+ issuerRef: string;
59
+ bindingRevision: string;
60
+ status: MemorySearchResultV1["status"];
61
+ outcome: MemorySearchResultV1["outcome"];
62
+ requested: {
63
+ store: NativeMemoryStore;
64
+ validAt?: string;
65
+ recordedAsOf?: string;
66
+ };
67
+ effective: NativeMemoryViewRequest;
68
+ items: Array<{
69
+ nativeId: string;
70
+ itemKey: string;
71
+ namespace: string;
72
+ storeRef: string;
73
+ scopeRef: string;
74
+ sourceRef: string;
75
+ version: string;
76
+ sourceKind: MemorySourceKind;
77
+ capturedContentSha256: string;
78
+ fullContentSha256: string;
79
+ parentSourceRefs: string[];
80
+ }>;
81
+ }
82
+ /** Internal native-consumer writer. Observation failures never discard valid retrieval. */
83
+ export declare function rememberNativeMemoryViewObservation(consumer: object, data: MemorySearchResultV1, value: NativeMemoryViewObservation): void;
84
+ export declare function readNativeMemoryViewObservation(data: unknown): Readonly<NativeMemoryViewObservation> | undefined;
@@ -1,5 +1,7 @@
1
1
  /** Host-provided correlation only. Command arguments cannot create this identity. */
2
2
  export interface ShellRunInvocation {
3
+ /** Canonical current host workspace; never a model-provided cwd or owner. */
4
+ workspaceRoot?: string;
3
5
  callId?: string;
4
6
  runId?: string;
5
7
  sessionId?: string;
@@ -26,6 +28,7 @@ export interface ShellRunSnapshot {
26
28
  outputTail: string;
27
29
  omittedBytes: number;
28
30
  invocation?: ShellRunInvocation;
31
+ outputCoverage?: import("./tool-output-spool.js").ToolOutputCoverage;
29
32
  }
30
33
  export type ShellRunEvent = {
31
34
  type: "start" | "end";
@@ -62,6 +65,7 @@ export declare class ShellRunRegistry implements ShellRunSource {
62
65
  private listeners;
63
66
  subscribeRuns(listener: (event: ShellRunEvent) => void): () => void;
64
67
  snapshotRuns(): readonly ShellRunSnapshot[];
68
+ observeOutputCoverage(id: string | undefined, value: import("./tool-output-spool.js").ToolOutputCoverage): void;
65
69
  stopRun(id: string): Promise<boolean>;
66
70
  start(input: Omit<ShellRunSnapshot, "id" | "state" | "sequence" | "outputTail" | "omittedBytes" | "exitCode" | "signal">, stop: () => boolean | void, initialOutput?: {
67
71
  outputTail: string;
@@ -0,0 +1,61 @@
1
+ import type { ShellRunInvocation } from "./shell-runs.js";
2
+ export type OutputChannel = "stdout" | "stderr";
3
+ export interface ToolOutputCoverage {
4
+ schema: "omnius.tool-output-coverage.v1";
5
+ sourceRef: string;
6
+ generation: string;
7
+ state: "capturing" | "complete" | "partial";
8
+ reason?: "quota" | "write_failed" | "interrupted";
9
+ streams: Record<OutputChannel, {
10
+ observedBytes: number;
11
+ storedBytes: number;
12
+ sha256?: string;
13
+ }>;
14
+ }
15
+ export interface ToolOutputPage {
16
+ sourceRef: string;
17
+ channel: OutputChannel;
18
+ fromByte: number;
19
+ toByte: number;
20
+ text: string;
21
+ encoding: "utf8" | "base64";
22
+ nextCursor: string | null;
23
+ coverage: ToolOutputCoverage;
24
+ }
25
+ export declare const TOOL_OUTPUT_LIMITS: Readonly<{
26
+ perProcessBytes: number;
27
+ workspaceBytes: number;
28
+ pageBytes: 65536;
29
+ entries: 4096;
30
+ }>;
31
+ /** A display cap cannot split a UTF16 surrogate pair from a valid decoded stream. */
32
+ export declare function boundedOutputPrefix(text: string, maxChars: number): string;
33
+ export declare function sameOutputOwner(producer: ShellRunInvocation | undefined, reader: ShellRunInvocation | undefined): boolean;
34
+ /** Native byte custody, independent of decoded previews and process/effect truth.
35
+ * A restored spool grants observation access only, never stop/restart authority. */
36
+ export declare class ToolOutputSpool {
37
+ readonly sourceRef: string;
38
+ private manifest;
39
+ private directory;
40
+ private handles;
41
+ private hashes;
42
+ private closed;
43
+ private capacity;
44
+ constructor(workspace: string, owner?: ShellRunInvocation, options?: {
45
+ perProcessBytes?: number;
46
+ workspaceBytes?: number;
47
+ });
48
+ static storageRoot(workspace: string): string;
49
+ private fail;
50
+ private persist;
51
+ append(channel: OutputChannel, bytes: Buffer): void;
52
+ snapshot(): ToolOutputCoverage;
53
+ finish(complete?: boolean): ToolOutputCoverage;
54
+ /** Byte cursor pages cannot invent full producer coverage or process truth.
55
+ * Invalid/non-UTF8 bytes remain exactly recoverable as base64. */
56
+ static read(workspace: string, sourceRef: string, reader: ShellRunInvocation | undefined, options?: {
57
+ channel?: OutputChannel;
58
+ cursor?: string;
59
+ maxBytes?: number;
60
+ }): ToolOutputPage;
61
+ }
@@ -0,0 +1,53 @@
1
+ import type { Tool, ToolResult, ToolInvocationContext } from "../types.js";
2
+ import type { NativeFileWriteObservation } from "../native-file-write-observation.js";
3
+ /** Identity only: a serialized observation can never become a producer receipt. */
4
+ export declare function readIssuedNativeFileWriteObservation(value: unknown): Readonly<NativeFileWriteObservation> | undefined;
5
+ export declare class FileWriteTool implements Tool {
6
+ #private;
7
+ name: string;
8
+ description: string;
9
+ parameters: {
10
+ type: string;
11
+ properties: {
12
+ path: {
13
+ type: string;
14
+ description: string;
15
+ };
16
+ content: {
17
+ type: string;
18
+ description: string;
19
+ };
20
+ content_base64: {
21
+ type: string;
22
+ description: string;
23
+ };
24
+ content_encoding: {
25
+ type: string;
26
+ enum: string[];
27
+ description: string;
28
+ };
29
+ overwrite: {
30
+ type: string;
31
+ description: string;
32
+ };
33
+ expected_hash: {
34
+ type: string;
35
+ description: string;
36
+ };
37
+ dry_run: {
38
+ type: string;
39
+ description: string;
40
+ };
41
+ };
42
+ required: string[];
43
+ anyOf: {
44
+ required: string[];
45
+ }[];
46
+ };
47
+ private workingDir;
48
+ getNativeFileWriteObservation(args: Record<string, unknown>, result: ToolResult): unknown;
49
+ constructor(workingDir: string);
50
+ acceptsInvocationContext: boolean;
51
+ execute(args: Record<string, unknown>, context?: ToolInvocationContext): Promise<ToolResult>;
52
+ private executeLocked;
53
+ }
@@ -1,3 +1,5 @@
1
+ import type { NativeMemoryViewBinding } from "./native-memory-view-provider.js";
2
+ import type { HostMemoryBindingV1, MemoryCapabilityV1, MemorySearchResultV1 } from "../memory/memoryCapability.js";
1
3
  import type { EvidenceEvent } from "./evidence.js";
2
4
  import type { DesktopVerificationScope, DesktopVerificationReceipt } from "./rapid-computer-use/desktop-verification.js";
3
5
  import type { PdfNativeTables } from "./tools/pdf-native-tables.js";
@@ -183,6 +185,9 @@ export interface ToolRuntimeSession {
183
185
  * use only `sessionId`.
184
186
  */
185
187
  export interface ToolExecutionScope {
188
+ nativeMemoryViews?: NativeMemoryViewBinding;
189
+ /** Host-only memory authority; model arguments cannot supply or widen it. */
190
+ memory?: HostMemoryBindingV1;
186
191
  sessionId: string;
187
192
  taskEpoch?: number;
188
193
  ownerId?: string;
@@ -217,7 +222,17 @@ export interface CorpusPreparedInputRead {
217
222
  leaseMs?: number;
218
223
  }
219
224
  /** Per-invocation authority supplied by the host, never parsed from tool args. */
225
+ /** Host-issued opaque identity; only the issuing runner can recognize it. */
226
+ export interface AuxiliaryOperationBinding {
227
+ readonly __auxiliaryOperationBinding?: never;
228
+ }
220
229
  export interface ToolInvocationContext {
230
+ /** Native FileWrite result correlation only; never supplied by model arguments. */
231
+ nativeFileWriteInvocation?: Readonly<import("./native-file-write-observation.js").NativeFileWriteInvocationScope>;
232
+ /** Preserve this exact host identity while composing cell-local guards. JSON copies grant nothing. */
233
+ auxiliaryOperationBinding?: AuxiliaryOperationBinding;
234
+ /** Current native work-mode permission fence, never model arguments. */
235
+ workModeFileGuard?: import("./work-mode-capability.js").WorkModeFileGuard;
221
236
  signal?: AbortSignal;
222
237
  /** Host-owned operation fence. Late work must check before publishing artifacts. */
223
238
  assertCurrent?: () => void;
@@ -351,6 +366,18 @@ export interface Tool {
351
366
  setAvailableTools?: (names: ReadonlySet<string>) => string;
352
367
  /** Bind durable tool state to one host-owned runner identity. */
353
368
  bindExecutionScope?: (scope: ToolExecutionScope) => void;
369
+ /** Side-effect-free descriptors from the adapter's current lifecycle snapshot. */
370
+ getMemoryCapabilities?: () => MemoryCapabilityV1[];
371
+ /** Accept only this adapter's current host-issued result, never lookalike JSON. */
372
+ readIssuedMemoryResult?: (data: unknown) => MemorySearchResultV1 | undefined;
373
+ readIssuedMemoryModelView?: (data: unknown) => string | undefined;
374
+ setMemorySourceArchive?: (archive: import("../memory/memorySourceResolver.js").MemorySourceArchive) => void;
375
+ setMemoryTopicPolicy?: (policy: {
376
+ namespace: string;
377
+ storeRef: string;
378
+ scopeRef: string;
379
+ topicPrefix: string;
380
+ }) => void;
354
381
  /** Verify an actual returned read against private scoped immutable inputs. */
355
382
  prepareCorpusInputExposure?: (data: unknown) => CorpusPreparedInputRead | Promise<CorpusPreparedInputRead>;
356
383
  /** Host-only successful model-transport exposure; never a callable tool. */
@@ -436,6 +463,10 @@ export interface Tool {
436
463
  isObservationOnly?: (args: Record<string, unknown>) => boolean;
437
464
  /** Private execution-time identity for encoding historical observations only. */
438
465
  getHistoryObservationIdentity?: (args: Record<string, unknown>, result: ToolResult) => string | null;
466
+ /** Exact native command result custody, including failures; model JSON cannot issue it. */
467
+ getCommandExecutionObservation?: (args: Record<string, unknown>, result: ToolResult) => unknown;
468
+ /** Original native FileWrite result proof; JSON/copies cannot issue it. */
469
+ getNativeFileWriteObservation?: (args: Record<string, unknown>, result: ToolResult) => unknown;
439
470
  /** Current provider desktop/session identity. Host-only; unavailable is fail-closed. */
440
471
  getDesktopVerificationScope?: () => DesktopVerificationScope | undefined;
441
472
  /** Host-owned semantic identity evaluated before external-effect dispatch. */
@@ -462,6 +493,9 @@ export interface ToolResult {
462
493
  evidenceOrigin?: "executed" | "reused" | "control";
463
494
  /** Actual process-local shell identity, including a still-running background start. */
464
495
  shellRunId?: string;
496
+ /** Native producer bytes retained independently of a bounded display transcript.
497
+ * Observation custody only; never process success or effect authority. */
498
+ outputCoverage?: import("./tool-output-spool.js").ToolOutputCoverage;
465
499
  /** Observation/dispatch custody only, never external-effect or task-success proof. */
466
500
  desktopVerificationReceipt?: DesktopVerificationReceipt;
467
501
  /**
@@ -0,0 +1,23 @@
1
+ /** Native handler qualifications. Names, tool text and JSON never issue these. */
2
+ type Handler = {
3
+ execute: unknown;
4
+ executeStream?: unknown;
5
+ normalizeInput?: unknown;
6
+ inputSchema?: unknown;
7
+ parameters?: unknown;
8
+ acceptsInvocationContext?: unknown;
9
+ };
10
+ export type NativeWorkModeToolKind = "read" | "file_mutation" | "runtime_control";
11
+ /** Trusted native constructors/host adapters only; never called from model arguments. */
12
+ export declare function qualifyNativeWorkModeTool(tool: Handler, kind: NativeWorkModeToolKind): void;
13
+ /** Preserve qualification through an audited adapter, retaining original handler identity. */
14
+ export declare function adaptNativeWorkModeTool(source: Handler, adapter: Handler): void;
15
+ export declare function nativeWorkModeToolKind(tool: Handler): NativeWorkModeToolKind | undefined;
16
+ export interface WorkModeFileGuard {
17
+ /** Canonical targets are computed by the actual mutation handler, never declared in model JSON. */
18
+ assertPaths(paths: ReadonlyArray<{
19
+ requestedPath: string;
20
+ canonicalPath: string;
21
+ }>): void;
22
+ }
23
+ export {};
@@ -0,0 +1,23 @@
1
+ /** Query-local coverage receipts. They describe a bounded stage, never recall or truth. */
2
+ export interface MemoryCandidateCoverage {
3
+ route: string;
4
+ population: number | null;
5
+ /** Eligible scoped records before a route-specific compatibility filter. */
6
+ eligiblePopulation?: number;
7
+ examined: number;
8
+ selected: number;
9
+ limit: number;
10
+ complete: boolean;
11
+ reasonCode?: string;
12
+ }
13
+ export type MemoryCandidateObserver = (coverage: Readonly<MemoryCandidateCoverage>) => void;
14
+ export declare function observeCandidates(observer: MemoryCandidateObserver | undefined, coverage: MemoryCandidateCoverage): void;
15
+ export declare function candidateLimit(value: number | undefined, fallback: number, maximum?: number): number;
16
+ /** Keep code punctuation in cues; these are literal lexical candidates, not entity identity facts. */
17
+ export declare function memoryCueTerms(query: string): string[];
18
+ export declare function literalLike(text: string): string;
19
+ export declare function lexicalPredicate(fields: string[], terms: string[]): {
20
+ sql: string;
21
+ params: string[];
22
+ scoreSql: string;
23
+ };
@@ -21,7 +21,7 @@ export interface EmbeddingResult {
21
21
  export interface EmbeddingConfig {
22
22
  /** Ollama base URL (default: http://localhost:11434) */
23
23
  baseUrl?: string;
24
- /** Explicit model; otherwise OMNIUS_EMBEDDING_MODEL, EMBED_MODEL, or nomic-embed-text. */
24
+ /** Explicit model; otherwise explicitly configured OMNIUS_EMBEDDING_MODEL or EMBED_MODEL. No implicit model. */
25
25
  model?: string;
26
26
  /** Request timeout in ms (default: 30000) */
27
27
  timeoutMs?: number;
@@ -0,0 +1,259 @@
1
+ import type { MemorySourceOpenItem, MemorySourceKind } from "./memorySourceResolver.js";
2
+ import type { MemoryCandidateCoverage } from "./candidateCoverage.js";
3
+ export type MemoryAvailability = "ready" | "deferred" | "disabled" | "unsupported" | "unhealthy" | "partial";
4
+ export type MemoryOperation = "search" | "read_exact" | "expand" | "enumerate_sources" | "weighted_prefill";
5
+ export type MemorySearchOutcome = "matches" | "empty" | "partial" | "unavailable" | "error";
6
+ export declare const MEMORY_NAMESPACES: Readonly<{
7
+ projectUnified: "project_unified_memory";
8
+ projectLegacy: "project_legacy_memory";
9
+ telegramChat: "telegram_chat";
10
+ task: "task_evidence";
11
+ structured: "structured_records";
12
+ folds: "context_folds";
13
+ procedures: "successful_procedures";
14
+ }>;
15
+ export declare const MEMORY_CONTRACT_LIMITS: Readonly<{
16
+ scopes: 64;
17
+ scopeIds: 256;
18
+ matches: 100;
19
+ branches: 16;
20
+ stages: 64;
21
+ sourceRefs: 512;
22
+ spans: 128;
23
+ parents: 128;
24
+ textChars: 65536;
25
+ fieldChars: 512;
26
+ routes: 32;
27
+ traceBytes: 262144;
28
+ }>;
29
+ export interface HostMemoryBindingV1 {
30
+ schema: "omnius.memory-binding.v1";
31
+ revision: string;
32
+ workspaceRef: string;
33
+ surface: string;
34
+ sessionId: string;
35
+ taskEpoch?: number;
36
+ ownerId?: string;
37
+ taskMemoryOwnerKey?: string;
38
+ nativeScopeRef?: string;
39
+ nativeScopeSha256?: string;
40
+ /** Names are explicit store names, never UUID aliases; resolve them only during an authorized query. */
41
+ authorizedScopes: Array<{
42
+ namespace: string;
43
+ storeRef: string;
44
+ scopeIds: string[];
45
+ scopeNames?: string[];
46
+ }>;
47
+ }
48
+ export interface MemoryOperationCapabilityV1 {
49
+ status: MemoryAvailability;
50
+ reasonCode?: string;
51
+ toolNames: string[];
52
+ routeIds: string[];
53
+ }
54
+ export interface MemoryCapabilityV1 {
55
+ schema: "omnius.memory-capability.v1";
56
+ revision: string;
57
+ issuerRef: string;
58
+ adapterId: string;
59
+ adapterVersion: string;
60
+ bindingRevision: string;
61
+ storeKind: string;
62
+ operations: Partial<Record<MemoryOperation, MemoryOperationCapabilityV1>>;
63
+ embedding?: {
64
+ profileRef: string;
65
+ coverage: "known" | "partial" | "unknown";
66
+ };
67
+ }
68
+ export interface MemoryByteSpan {
69
+ unit: "utf8_bytes";
70
+ start: number;
71
+ end: number;
72
+ }
73
+ export interface MemorySourceV1 {
74
+ schema: "omnius.memory-source.v1";
75
+ namespace: string;
76
+ storeRef: string;
77
+ occurrenceId: string;
78
+ version: string;
79
+ contentSha256: string;
80
+ scopeRef: string;
81
+ scopeName?: string;
82
+ byteLength: number;
83
+ spans: MemoryByteSpan[];
84
+ coverage: "full" | "partial" | "unavailable";
85
+ observedAt?: string | null;
86
+ recordedAt?: string | null;
87
+ derivation?: {
88
+ id: string;
89
+ version: string;
90
+ parentSourceRefs: string[];
91
+ };
92
+ }
93
+ export interface MemoryQueryStageV1 {
94
+ stage: "availability" | "scope" | "stored" | "candidate" | "ranked" | "expanded" | "rendered" | "admitted";
95
+ state: "observed" | "skipped" | "unavailable" | "failed";
96
+ reasonCode?: string;
97
+ sourceRefs: string[];
98
+ count?: number;
99
+ omittedCount?: number;
100
+ coverage: "full" | "partial" | "unknown";
101
+ budgetRef?: string;
102
+ requestFingerprint?: string;
103
+ }
104
+ export interface MemoryQueryTraceV1 {
105
+ schema: "omnius.memory-query-trace.v1";
106
+ queryId: string;
107
+ issuerRef: string;
108
+ bindingRevision: string;
109
+ descriptorRevision: string;
110
+ requestedMode: string;
111
+ executedRoutes: string[];
112
+ stages: MemoryQueryStageV1[];
113
+ telemetry: {
114
+ status: "pending" | "recorded" | "unavailable" | "disabled";
115
+ reasonCode?: string;
116
+ };
117
+ requestFingerprint?: string;
118
+ }
119
+ /** Graph relations are retrieval proposals supported by the captured source, not identity or truth attestations. */
120
+ export interface MemoryRelationCandidateV1 {
121
+ edgeRef: string;
122
+ relation: string;
123
+ fromRef: string;
124
+ toRef: string;
125
+ sourceRef: string;
126
+ }
127
+ export interface MemorySearchMatchV1 {
128
+ source: MemorySourceV1;
129
+ text: string;
130
+ score?: number;
131
+ title?: string;
132
+ routeId?: string;
133
+ relationCandidates?: MemoryRelationCandidateV1[];
134
+ }
135
+ export interface MemorySearchBranchV1 {
136
+ branchId: string;
137
+ queryId?: string;
138
+ issuerRef?: string;
139
+ status: MemoryAvailability;
140
+ outcome: MemorySearchOutcome;
141
+ executedRoutes: string[];
142
+ sourceRefs: string[];
143
+ traceRef?: string;
144
+ reasonCode?: string;
145
+ nextCursor?: string;
146
+ }
147
+ export interface MemorySourceAccessV1 {
148
+ sourceRef: string;
149
+ status: "ready" | "unavailable";
150
+ reasonCode?: string;
151
+ sourceKind?: MemorySourceKind;
152
+ }
153
+ export interface MemorySearchResultV1 {
154
+ schema: "omnius.memory-search-result.v1";
155
+ queryId: string;
156
+ issuerRef: string;
157
+ bindingRevision: string;
158
+ descriptorRevision: string;
159
+ requestedMode: string;
160
+ executedRoutes: string[];
161
+ status: MemoryAvailability;
162
+ outcome: MemorySearchOutcome;
163
+ nextCursor?: string;
164
+ sourceAccess?: MemorySourceAccessV1[];
165
+ expansions?: MemorySourceOpenItem[];
166
+ candidateCoverage?: MemoryCandidateCoverage[];
167
+ matches: MemorySearchMatchV1[];
168
+ branches: MemorySearchBranchV1[];
169
+ traceRef: string;
170
+ trace?: MemoryQueryTraceV1;
171
+ reasonCode?: string;
172
+ }
173
+ export type MemoryCapabilityInput = Pick<MemoryCapabilityV1, "storeKind" | "operations" | "embedding">;
174
+ export type MemorySearchResultInput = Omit<MemorySearchResultV1, "schema" | "issuerRef" | "bindingRevision" | "branches" | "traceRef"> & {
175
+ branches?: MemorySearchBranchV1[];
176
+ traceRef?: string;
177
+ };
178
+ export interface MemoryContractIssuer {
179
+ readonly issuerRef: string;
180
+ issueCapability(input: MemoryCapabilityInput): MemoryCapabilityV1;
181
+ issueResult(input: MemorySearchResultInput): MemorySearchResultV1;
182
+ readIssuedResult(data: unknown): MemorySearchResultV1 | undefined;
183
+ }
184
+ export declare class MemoryContractError extends Error {
185
+ readonly code: string;
186
+ constructor(code: string);
187
+ }
188
+ export declare const memoryContentHash: (value: string | Uint8Array) => string;
189
+ export declare const stableMemoryHash: (value: unknown) => string;
190
+ export declare const memoryWorkspaceRef: (canonicalRoot: string) => string;
191
+ export declare const memoryStoreRef: (workspaceRef: string, storeKind: string) => string;
192
+ export declare const memorySourceRef: (source: MemorySourceV1) => string;
193
+ export declare function isHostMemoryBindingV1(x: unknown): x is HostMemoryBindingV1;
194
+ export declare function createHostMemoryBinding(input: Omit<HostMemoryBindingV1, "schema" | "revision">): HostMemoryBindingV1;
195
+ export declare function intersectMemoryScopeIds(binding: HostMemoryBindingV1 | undefined, namespace: string, storeRef: string, requestedIds?: readonly string[]): string[];
196
+ export declare function isMemoryCapabilityV1(x: unknown): x is MemoryCapabilityV1;
197
+ export declare function isMemorySourceV1(x: unknown, capturedText?: string): x is MemorySourceV1;
198
+ export declare function captureMemorySource(input: Omit<MemorySourceV1, "schema" | "contentSha256" | "byteLength" | "spans" | "coverage"> & {
199
+ text: string;
200
+ coverage?: MemorySourceV1["coverage"];
201
+ }): MemorySourceV1;
202
+ export declare function captureMemorySourceFromUtf16Span(input: Omit<Parameters<typeof captureMemorySource>[0], "text"> & {
203
+ fullText: string;
204
+ start: number;
205
+ end: number;
206
+ chunkText: string;
207
+ expectedContentSha256?: string;
208
+ }): MemorySourceV1;
209
+ export declare function isMemoryQueryStageV1(x: unknown): x is MemoryQueryStageV1;
210
+ export declare function isMemoryQueryTraceV1(x: unknown): x is MemoryQueryTraceV1;
211
+ /**
212
+ * Query-match v1 carries the complete bytes of its captured version, including
213
+ * previews explicitly marked partial relative to the unavailable producer.
214
+ * A full-document hash plus an excerpt requires separate proof not supported
215
+ * by this result schema. Source metadata alone cannot attest different text.
216
+ */
217
+ export declare function isMemorySearchMatchV1(x: unknown): x is MemorySearchMatchV1;
218
+ export declare function isMemoryCandidateCoverage(x: unknown): x is MemoryCandidateCoverage;
219
+ export declare function isMemorySearchResultV1(x: unknown): x is MemorySearchResultV1;
220
+ export declare function createMemoryIssuer(options: {
221
+ adapterId: string;
222
+ adapterVersion: string;
223
+ issuerRef?: string;
224
+ getBinding: () => HostMemoryBindingV1 | undefined;
225
+ }): MemoryContractIssuer;
226
+ export declare const createMemoryContractIssuer: typeof createMemoryIssuer;
227
+ export declare function composeMemoryResults(issuer: MemoryContractIssuer, input: {
228
+ queryId: string;
229
+ descriptorRevision: string;
230
+ requestedMode: string;
231
+ branches: Array<{
232
+ branchId: string;
233
+ result?: MemorySearchResultV1;
234
+ status?: MemoryAvailability;
235
+ reasonCode?: string;
236
+ }>;
237
+ }): MemorySearchResultV1;
238
+ export declare function memoryQueryStage(stage: MemoryQueryStageV1["stage"], state: MemoryQueryStageV1["state"], input?: Omit<MemoryQueryStageV1, "stage" | "state" | "sourceRefs" | "coverage"> & {
239
+ sourceRefs?: string[];
240
+ coverage?: MemoryQueryStageV1["coverage"];
241
+ }): MemoryQueryStageV1;
242
+ export declare function createMemoryQueryTrace(input: Omit<MemoryQueryTraceV1, "schema" | "telemetry"> & {
243
+ telemetry?: MemoryQueryTraceV1["telemetry"];
244
+ }): MemoryQueryTraceV1;
245
+ /** Telemetry errors never turn a completed query into an empty/fallback result. */
246
+ export declare function preserveMemoryResultOnTelemetryFailure<T>(result: T, sink: () => void | Promise<void>, timeoutMs?: number): Promise<{
247
+ result: T;
248
+ telemetry: "recorded" | "unavailable";
249
+ }>;
250
+ export declare function renderMemoryCapabilitiesForModel(capabilities: readonly MemoryCapabilityV1[], options?: {
251
+ maxChars?: number;
252
+ }): string;
253
+ export declare const renderMemoryCapabilityForModel: (capability: MemoryCapabilityV1, options?: {
254
+ maxChars?: number;
255
+ }) => string;
256
+ export declare function renderMemorySearchResultForModel(result: MemorySearchResultV1, options?: {
257
+ maxChars?: number;
258
+ includeText?: boolean;
259
+ }): string;