omnius 1.0.953 → 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 +236 -48
  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 +115267 -108004
  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,173 @@
1
+ /** On-disk JSONL format shared with native streamed web sources. */
2
+ export interface ArtifactStreamSegment {
3
+ index: number;
4
+ byteStart: number;
5
+ byteEndExclusive: number;
6
+ charStart: number;
7
+ charEndExclusive: number;
8
+ lineStart: number;
9
+ lineEnd: number;
10
+ sha256: string;
11
+ }
12
+ export interface ArtifactStreamIndex {
13
+ schema: "omnius.utf8-segment-index.v1";
14
+ utf16Chars: number;
15
+ segmentCount: number;
16
+ indexSha256: string;
17
+ indexBytes: number;
18
+ endsWithNewline: boolean;
19
+ }
20
+ export type ArtifactFidelity = "full";
21
+ /** A one-based, inclusive source location. */
22
+ export interface ArtifactLineRange {
23
+ start: number;
24
+ end: number;
25
+ }
26
+ export interface CanonicalArtifactProvenance {
27
+ /** Logical source path; it is metadata and is never dereferenced by this store. */
28
+ path: string;
29
+ /** Caller-supplied source revision, such as a file hash or write epoch. */
30
+ revision: string;
31
+ /** Source line locations represented by the canonical body. */
32
+ ranges?: readonly ArtifactLineRange[];
33
+ /** Canonical writes are deliberately restricted to exact full source. */
34
+ fidelity?: ArtifactFidelity;
35
+ }
36
+ export interface StoreCanonicalArtifactInput extends CanonicalArtifactProvenance {
37
+ /** Exact UTF-8 body. The store rejects oversize inputs; it never truncates them. */
38
+ content: string;
39
+ }
40
+ /** Host-owned source path. This API must never receive an agent-supplied path. */
41
+ export interface StoreCanonicalArtifactFileInput extends CanonicalArtifactProvenance {
42
+ filePath: string;
43
+ expectedSha256?: string;
44
+ expectedBytes?: number;
45
+ expectedUtf16Chars?: number;
46
+ }
47
+ export interface ArtifactFileOperationOptions {
48
+ signal?: AbortSignal;
49
+ assertCurrent?: () => void;
50
+ }
51
+ /** Zero-based, exclusive-end UTF-16 code-unit or UTF-8 byte range. */
52
+ export interface ArtifactFileRangeOptions extends ArtifactFileOperationOptions {
53
+ start: number;
54
+ end: number;
55
+ /** Internal planning/validation windows only. Public artifact reads keep complete Unicode scalars. */
56
+ allowSplitSurrogates?: true;
57
+ }
58
+ export interface ArtifactFileLineRangeOptions extends ArtifactFileOperationOptions {
59
+ startLine: number;
60
+ endLine: number;
61
+ }
62
+ export interface ArtifactFileRangeReadResult {
63
+ hash: string;
64
+ reference: string;
65
+ content: string;
66
+ manifest: ContentAddressedArtifactManifest;
67
+ range: {
68
+ start: number;
69
+ end: number;
70
+ unit: "utf16" | "utf8";
71
+ };
72
+ }
73
+ export interface ArtifactManifestRecord {
74
+ path: string;
75
+ revision: string;
76
+ ranges: ArtifactLineRange[];
77
+ fidelity: ArtifactFidelity;
78
+ recordedAt: string;
79
+ }
80
+ export interface ContentAddressedArtifactManifest {
81
+ schemaVersion: 1 | 2;
82
+ hash: string;
83
+ bytes: number;
84
+ encoding: "utf-8";
85
+ lineCount: number;
86
+ createdAt: string;
87
+ records: ArtifactManifestRecord[];
88
+ /** Version 2 only. The exact complete object remains addressed by its raw UTF-8 SHA. */
89
+ streamIndex?: ArtifactStreamIndex;
90
+ }
91
+ export interface StoredCanonicalArtifact {
92
+ hash: string;
93
+ reference: string;
94
+ manifest: ContentAddressedArtifactManifest;
95
+ /** True when this call had to write a new immutable object. */
96
+ created: boolean;
97
+ }
98
+ export interface ArtifactReadOptions {
99
+ /** Omit to read the exact complete stored body. */
100
+ range?: ArtifactLineRange;
101
+ }
102
+ export interface ArtifactReadResult {
103
+ hash: string;
104
+ reference: string;
105
+ content: string;
106
+ manifest: ContentAddressedArtifactManifest;
107
+ /** Present only when a line range was requested. */
108
+ range?: ArtifactLineRange;
109
+ }
110
+ export interface ContentAddressedArtifactStoreOptions {
111
+ /** Root containing the objects and manifests directories. Defaults to .omnius/artifact-store. */
112
+ rootDir?: string;
113
+ /** Largest exact body accepted in one store operation. Default: 32 MiB. */
114
+ maxArtifactBytes?: number;
115
+ /** Maximum combined object bytes. Overrides root-local limits.json; otherwise defaults to 512 MiB. */
116
+ maxStoreBytes?: number;
117
+ /** Maximum provenance records attached to one content hash. Default: 64. */
118
+ maxManifestRecords?: number;
119
+ }
120
+ /** Default durable location used by callers that do not need a custom state directory. */
121
+ export declare function contentAddressedArtifactStoreRoot(cwd?: string, stateDir?: string): string;
122
+ /** Construct the only valid opaque artifact reference. */
123
+ export declare function artifactReference(hash: string): string;
124
+ /**
125
+ * Strictly parse references before any path construction. Query strings,
126
+ * fragments, encoded slashes, and traversal are intentionally invalid rather
127
+ * than being normalized into a potentially surprising object path.
128
+ */
129
+ export declare function parseArtifactReference(reference: string): string;
130
+ export declare class ContentAddressedArtifactStore {
131
+ readonly rootDir: string;
132
+ readonly maxArtifactBytes: number;
133
+ readonly maxStoreBytes: number;
134
+ readonly maxManifestRecords: number;
135
+ private fileCommitTail;
136
+ constructor(options?: ContentAddressedArtifactStoreOptions);
137
+ /** Persist an exact canonical UTF-8 body, returning a restart-safe opaque reference. */
138
+ put(input: StoreCanonicalArtifactInput): StoredCanonicalArtifact;
139
+ /**
140
+ * Archive a complete host-owned UTF-8 file using bounded memory. Unlike put,
141
+ * this path has no legacy per-object/store byte ceiling: disk/I/O failures and
142
+ * caller cancellation fail explicitly. Expected producer fixity is checked
143
+ * before any manifest is published. No supplied path enters an artifact URI.
144
+ */
145
+ importFile(input: StoreCanonicalArtifactFileInput, options?: ArtifactFileOperationOptions): Promise<StoredCanonicalArtifact>;
146
+ putFile(input: StoreCanonicalArtifactFileInput, options?: ArtifactFileOperationOptions): Promise<StoredCanonicalArtifact>;
147
+ /** Exact UTF-16 ranges, bounded to 256 Ki code units per call, with segment proof. */
148
+ readUtf16Range(reference: string, options: ArtifactFileRangeOptions): Promise<ArtifactFileRangeReadResult>;
149
+ /** Exact strict UTF-8 byte ranges, bounded to 1 MiB; split scalars are rejected. */
150
+ readUtf8Range(reference: string, options: ArtifactFileRangeOptions): Promise<ArtifactFileRangeReadResult>;
151
+ /** Exact inclusive lines; long minified lines require explicit character ranges. */
152
+ readLineRange(reference: string, options: ArtifactFileLineRangeOptions): Promise<ArtifactReadResult>;
153
+ private readFileRange;
154
+ /** Validate the entire index, retaining only one bounded line at a time. */
155
+ private verifyStreamIndex;
156
+ /** Full streaming fixity/durability validation, without a complete-body allocation. */
157
+ flushFile(reference: string, options?: ArtifactFileOperationOptions): Promise<void>;
158
+ /** Resolve a durable immutable full body or exact inclusive line range. */
159
+ read(reference: string, options?: ArtifactReadOptions): ArtifactReadResult;
160
+ /**
161
+ * Establish disk durability before another durable record depends on this
162
+ * archive. Validate and sync the same open object/manifest descriptors, then
163
+ * sync their directory entries from the leaves through the store root.
164
+ * Any failure propagates so callers cannot retire the source transcript.
165
+ */
166
+ flush(reference: string): void;
167
+ getManifest(reference: string): ContentAddressedArtifactManifest;
168
+ private objectsRoot;
169
+ private objectPath;
170
+ private manifestPath;
171
+ private streamIndexPath;
172
+ private readManifestByHash;
173
+ }
@@ -83,6 +83,10 @@ export interface ContextWindowReferenceContractTrace {
83
83
  * The exact outbound request remains the source of truth for rendered text.
84
84
  */
85
85
  export interface ContextWindowRequestCompilation {
86
+ authoredInstructionSources?: import("./authored-instruction-context.js").AuthoredInstructionAdmissionAudit;
87
+ explicitWorkMode?: import("./explicit-work-mode.js").ExplicitWorkModeAudit;
88
+ /** Observed capability and query/source admission; not model comprehension or use. */
89
+ memoryCapabilityContext?: import("./memory-capability-context.js").MemoryCapabilityContextAudit;
86
90
  schemaVersion: 1;
87
91
  taskEpoch: number;
88
92
  modelTier: string;
@@ -0,0 +1,92 @@
1
+ import { type WorkModeFileGuard } from "../execution/work-mode-capability.js";
2
+ import type { ChatMessage, AgenticTool } from "./agenticRunner.js";
3
+ export declare class ExplicitWorkModeStorageError extends Error {
4
+ readonly conversationId: string;
5
+ readonly surface: "terminal" | "telegram_private";
6
+ readonly code = "explicit_work_mode_storage_unavailable";
7
+ readonly workspaceRoot: string;
8
+ constructor(workspace: string, conversationId: string, surface: "terminal" | "telegram_private", cause: unknown);
9
+ }
10
+ export declare const EXPLICIT_WORK_MODE_MARKER = "[EXPLICIT WORK MODE v1]";
11
+ export type ExplicitWorkMode = "plan" | "implement" | "default";
12
+ export interface ExplicitWorkModeRequest {
13
+ mode: ExplicitWorkMode;
14
+ artifactPaths: string[];
15
+ }
16
+ export interface ExplicitWorkModeSelection {
17
+ schema: "omnius.explicit-work-mode-selection.v1";
18
+ workspaceRoot: string;
19
+ sessionId: string;
20
+ selectionRef: string;
21
+ revision: number;
22
+ mode: ExplicitWorkMode;
23
+ artifactPaths: readonly string[];
24
+ source: {
25
+ surface: "terminal" | "telegram_private";
26
+ inputRef: string;
27
+ inputSha256: string;
28
+ };
29
+ }
30
+ export interface ExplicitWorkModeOwner {
31
+ workspaceRoot: string;
32
+ sessionId: string;
33
+ runId: string;
34
+ taskEpoch: number;
35
+ ownerId: string;
36
+ controlRoots: string[];
37
+ }
38
+ export interface ExplicitWorkModeCustody {
39
+ schema: "omnius.explicit-work-mode-custody.v1";
40
+ selectionRef: string;
41
+ mode: ExplicitWorkMode;
42
+ revision: number;
43
+ workspaceRoot: string;
44
+ sessionId: string;
45
+ }
46
+ export interface ExplicitWorkModeAudit {
47
+ schema: "omnius.explicit-work-mode-admission.v1";
48
+ selectionRef: string;
49
+ mode: ExplicitWorkMode;
50
+ revision: number;
51
+ runId: string;
52
+ taskEpoch: number;
53
+ ownerId: string;
54
+ status: "projected" | "admitted" | "overflow";
55
+ requestFingerprint?: string;
56
+ }
57
+ /** This host is created by an authenticated frontend, never a callable tool. */
58
+ export declare class ExplicitWorkModeHost {
59
+ readonly sessionId: string;
60
+ private revision;
61
+ private selected?;
62
+ readonly workspaceRoot: string;
63
+ constructor(workspaceRoot: string, sessionId: string);
64
+ select(request: ExplicitWorkModeRequest, source: ExplicitWorkModeSelection["source"], assertNative: () => void): ExplicitWorkModeSelection;
65
+ current(): ExplicitWorkModeSelection | undefined;
66
+ restoreCurrent(value: ExplicitWorkModeSelection | undefined): void;
67
+ }
68
+ export declare function readIssuedExplicitWorkMode(value: unknown, workspace: string, sessionId: string): ExplicitWorkModeSelection | undefined;
69
+ export declare class ExplicitWorkModeContext {
70
+ private current?;
71
+ private requiresFresh;
72
+ private owner?;
73
+ private readonly owned;
74
+ private readonly waiters;
75
+ private lastAudit;
76
+ private ownerInput;
77
+ configure(value: unknown, owner: ExplicitWorkModeOwner): void;
78
+ fingerprint(): string;
79
+ needsSelection(): boolean;
80
+ rollbackNativeSelection(value: ExplicitWorkModeSelection | undefined, owner: ExplicitWorkModeOwner, requiresFresh: boolean): void;
81
+ wait(signal: AbortSignal): Promise<void>;
82
+ toolProblem(tool: AgenticTool | undefined, nativeControl?: boolean): string | null;
83
+ fileGuard(assertCurrent: () => void): WorkModeFileGuard;
84
+ private scope;
85
+ private content;
86
+ project(messages: ChatMessage[]): ChatMessage[];
87
+ admit(messages: ChatMessage[], fingerprint: string, rejected?: boolean): ExplicitWorkModeAudit | null;
88
+ audit(): ExplicitWorkModeAudit | null;
89
+ checkpoint(): ExplicitWorkModeCustody | undefined;
90
+ private historical?;
91
+ restore(value: ExplicitWorkModeCustody, owner: ExplicitWorkModeOwner): void;
92
+ }
@@ -137,6 +137,9 @@ export declare class InterruptionLifecycle {
137
137
  ownerId: string;
138
138
  }): InterruptionOperationTicket | null;
139
139
  acknowledgeOperation(ticket: InterruptionOperationTicket, outcome?: "completed" | "cancelled" | "unknown"): boolean;
140
+ /** Reopen client observation of the same retained read-only model operation.
141
+ * This is not provider admission, cancellation acknowledgement, or a new job. */
142
+ resumeModelObservation(ticket: InterruptionOperationTicket): boolean;
140
143
  canCommit(ticket: InterruptionOperationTicket): boolean;
141
144
  resolveAmbiguousEffect(operationId: string, state: "confirmed_applied" | "confirmed_absent", evidenceId: string): boolean;
142
145
  /** Repair the old ASR classification, without supplying a transcription
@@ -0,0 +1,49 @@
1
+ import { type HostMemoryBindingV1, type MemoryAvailability, type MemoryCapabilityV1, type MemoryQueryTraceV1, type MemorySearchResultV1 } from "../memory/memoryCapability.js";
2
+ import type { ChatMessage } from "./agenticRunner.js";
3
+ export interface RuntimeMemoryAvailability {
4
+ storeKind: string;
5
+ status: MemoryAvailability;
6
+ reasonCode?: string;
7
+ operations: Array<"search" | "read_exact" | "expand" | "enumerate_sources">;
8
+ toolNames: string[];
9
+ routeIds: string[];
10
+ }
11
+ export interface MemoryCapabilityContextAudit {
12
+ schema: "omnius.memory-context-audit.v1";
13
+ bindingRevision: string;
14
+ descriptorSha256: string;
15
+ capabilityCount: number;
16
+ renderedCapabilityRevisions: string[];
17
+ admittedCapabilityRevisions: string[];
18
+ omittedCapabilities: number;
19
+ descriptorRendered: boolean;
20
+ descriptorAdmitted: boolean;
21
+ requestFingerprint: string;
22
+ queries: MemoryQueryTraceV1[];
23
+ droppedQueries: number;
24
+ droppedTelemetry: number;
25
+ }
26
+ /** Observational request projection. It never opens a store or selects an action. */
27
+ export declare class MemoryCapabilityContext {
28
+ private readonly sink?;
29
+ private binding?;
30
+ private readonly issuer;
31
+ private readonly carriers;
32
+ private readonly queries;
33
+ private content;
34
+ private capabilityCount;
35
+ private renderedCapabilityRevisions;
36
+ private droppedQueries;
37
+ private droppedTelemetry;
38
+ private pendingSinks;
39
+ private lastAudit;
40
+ constructor(sink?: ((trace: MemoryQueryTraceV1) => void | Promise<void>) | undefined);
41
+ bind(binding: HostMemoryBindingV1): void;
42
+ capabilities(runtime: RuntimeMemoryAvailability[], adapters: readonly MemoryCapabilityV1[]): MemoryCapabilityV1[];
43
+ project(messages: ChatMessage[], capabilities: readonly MemoryCapabilityV1[], maxChars?: number): ChatMessage[];
44
+ /** Caller must obtain result from the registered adapter's identity-checking hook. */
45
+ observe(result: MemorySearchResultV1, callId: string, output: string): void;
46
+ admit(messages: ChatMessage[], requestFingerprint: string): MemoryCapabilityContextAudit | null;
47
+ audit(): MemoryCapabilityContextAudit | null;
48
+ private sendTrace;
49
+ }
@@ -0,0 +1,123 @@
1
+ /** Host ownership, never inferred from a model-authored object or provider prose. */
2
+ export interface OwnedInferenceWaitOwnerV1 {
3
+ sessionId: string;
4
+ runId: string;
5
+ taskEpoch: number;
6
+ ownerId: string;
7
+ ownerGeneration: number;
8
+ operationId: string;
9
+ }
10
+ export type OwnedInferenceWaitState = "ambiguous" | "retained_queue" | "in_progress" | "completed" | "completed_unavailable" | "unresolved";
11
+ export interface OwnedInferenceWaitReceiptV1 {
12
+ readonly schema: "omnius.owned-inference-wait.v1";
13
+ readonly custodyRef: string;
14
+ readonly owner: Readonly<OwnedInferenceWaitOwnerV1>;
15
+ readonly endpoint: string;
16
+ readonly model: string;
17
+ readonly url: string;
18
+ readonly logicalRequestId: string;
19
+ readonly bodySha256: string;
20
+ readonly scopeSha256: string;
21
+ readonly capturedAt: string;
22
+ readonly observedAt: string;
23
+ readonly state: OwnedInferenceWaitState;
24
+ readonly reason: string;
25
+ readonly semanticProgress: boolean;
26
+ readonly initialResponseBudgetMs: number;
27
+ readonly brokerRequestId?: string;
28
+ readonly retryAfterMs?: number;
29
+ }
30
+ export interface OwnedInferenceWaitContext {
31
+ owner: OwnedInferenceWaitOwnerV1;
32
+ stateDir: string;
33
+ onObservation?: (receipt: OwnedInferenceWaitReceiptV1) => void;
34
+ /** Host may narrow resource limits; the implementation's hard caps cannot be raised. */
35
+ storageLimits?: {
36
+ maxBytes?: number;
37
+ maxCaptures?: number;
38
+ };
39
+ }
40
+ export interface OwnedInferenceDispatchFailureV1 {
41
+ readonly schema: "omnius.owned-inference-dispatch-failure.v1";
42
+ readonly code: "owned_inference_dispatch_blocked";
43
+ readonly dispatchAttempted: false;
44
+ readonly owner: Readonly<OwnedInferenceWaitOwnerV1>;
45
+ readonly endpoint: string;
46
+ readonly model: string;
47
+ readonly logicalRequestId: string;
48
+ readonly reason: "storage_quota" | "storage_unavailable" | "custody_invalid";
49
+ readonly observedAt: string;
50
+ readonly storageCode?: string;
51
+ }
52
+ export declare class OwnedInferenceDispatchBlockedError extends Error {
53
+ readonly code = "owned_inference_dispatch_blocked";
54
+ readonly dispatchAttempted = false;
55
+ readonly fatal = true;
56
+ readonly retryable = false;
57
+ constructor(input: {
58
+ context: OwnedInferenceWaitContext;
59
+ endpoint: string;
60
+ model: string;
61
+ logicalRequestId: string;
62
+ }, reason: OwnedInferenceDispatchFailureV1["reason"], cause: unknown);
63
+ }
64
+ export declare function readOwnedInferenceDispatchFailure(error: unknown): OwnedInferenceDispatchFailureV1 | undefined;
65
+ export interface OwnedInferenceWaitObserveOptions {
66
+ owner: OwnedInferenceWaitOwnerV1;
67
+ signal?: AbortSignal;
68
+ timeoutMs: number;
69
+ assertCurrent?: () => void;
70
+ onObservation?: (receipt: OwnedInferenceWaitReceiptV1) => void;
71
+ }
72
+ interface Custody {
73
+ schema: "omnius.owned-inference-custody.v1";
74
+ owner: OwnedInferenceWaitOwnerV1;
75
+ endpoint: string;
76
+ model: string;
77
+ url: string;
78
+ logicalRequestId: string;
79
+ body: string;
80
+ bodySha256: string;
81
+ scopeSha256: string;
82
+ request: Record<string, unknown>;
83
+ capturedAt: string;
84
+ captureNonce: string;
85
+ }
86
+ export declare const OWNED_INFERENCE_STORE_MAX_BYTES: number;
87
+ export declare const OWNED_INFERENCE_STORE_MAX_CAPTURES = 2048;
88
+ /** Credential material is hashed, never persisted. Scope includes client/GPU/queue constraints. */
89
+ export declare function ownedInferenceScopeSha256(url: string, headers: ConstructorParameters<typeof Headers>[0] | undefined): string;
90
+ /** Called only after the backend identifies its selected managed-broker protocol. */
91
+ declare function captureOwnedInferenceWaitInternal(input: {
92
+ context: OwnedInferenceWaitContext;
93
+ endpoint: string;
94
+ model: string;
95
+ url: string;
96
+ logicalRequestId: string;
97
+ body: string;
98
+ scopeSha256: string;
99
+ request: Record<string, unknown>;
100
+ }): OwnedInferenceWaitReceiptV1;
101
+ /** Only this pre-fetch capture boundary can issue confirmed non-dispatch failure. */
102
+ export declare function captureOwnedInferenceWait(input: Parameters<typeof captureOwnedInferenceWaitInternal>[0]): OwnedInferenceWaitReceiptV1;
103
+ /** A checkpoint carries only the reference. Explicit current host ownership reopens private custody. */
104
+ export declare function restoreOwnedInferenceWait(input: {
105
+ stateDir: string;
106
+ reference: string;
107
+ owner: OwnedInferenceWaitOwnerV1;
108
+ endpoint: string;
109
+ model: string;
110
+ }): OwnedInferenceWaitReceiptV1;
111
+ export declare function readIssuedOwnedInferenceWait(value: unknown): OwnedInferenceWaitReceiptV1 | undefined;
112
+ export declare function readOwnedInferenceWait(error: unknown): OwnedInferenceWaitReceiptV1 | undefined;
113
+ export declare function attachOwnedInferenceWait(error: unknown, receipt: OwnedInferenceWaitReceiptV1): void;
114
+ export declare function inspectOwnedInferenceWait(receipt: OwnedInferenceWaitReceiptV1, owner: OwnedInferenceWaitOwnerV1): {
115
+ custody: Custody;
116
+ observation: OwnedInferenceWaitReceiptV1;
117
+ stateDir: string;
118
+ };
119
+ export declare function observeOwnedInferenceWaitReceipt(receipt: OwnedInferenceWaitReceiptV1, observation: Pick<OwnedInferenceWaitReceiptV1, "state" | "reason"> & Partial<Pick<OwnedInferenceWaitReceiptV1, "semanticProgress" | "brokerRequestId" | "retryAfterMs">>): OwnedInferenceWaitReceiptV1;
120
+ export declare function notifyOwnedInferenceWait(handler: OwnedInferenceWaitContext["onObservation"], receipt: OwnedInferenceWaitReceiptV1): void;
121
+ /** Managed-port identity alone does not prove support for the body-free resume protocol. */
122
+ export declare function supportsOwnedInferenceWaitProtocol(document: unknown, endpoint: string): boolean;
123
+ export {};
@@ -0,0 +1,26 @@
1
+ import type { OwnedInferenceWaitOwnerV1 } from "./owned-inference-wait.js";
2
+ /** Host attempt custody. This is not a provider admission or observer grant. */
3
+ export interface OwnedModelWaitCheckpointV1 {
4
+ schema: "omnius.owned-model-wait-checkpoint.v1";
5
+ owner: OwnedInferenceWaitOwnerV1;
6
+ operationOwnerId: string;
7
+ logicalRequestId: string;
8
+ turn: number;
9
+ requestFingerprint: string;
10
+ endpoint: string;
11
+ model: string;
12
+ workspaceRoot: string;
13
+ policySha256: string;
14
+ toolCatalogueSha256: string;
15
+ taskBindingSha256: string;
16
+ runtimeFingerprint: string;
17
+ authoredManifestRef?: string;
18
+ custodyRef?: string;
19
+ state: "pending" | "waiting" | "unsupported" | "unresolved" | "semantic_progress" | "response_received";
20
+ reason: string;
21
+ semanticProgress: boolean;
22
+ retiredByInputId?: string;
23
+ startedAtMs: number;
24
+ observationBudgetMs: number;
25
+ }
26
+ export declare function isOwnedModelWaitCheckpointV1(value: unknown): value is OwnedModelWaitCheckpointV1;
@@ -0,0 +1,78 @@
1
+ export declare const PROMPT_CONTEXT_SELECTION: unique symbol;
2
+ export declare const PROVIDER_RESPONSE_PARSER: unique symbol;
3
+ export declare const REQUIRED_PROVIDER_SOURCES: unique symbol;
4
+ export interface RequiredProviderSource {
5
+ readonly id: string;
6
+ readonly version: string;
7
+ readonly sha256: string;
8
+ readonly bytes: number;
9
+ }
10
+ /** Host-issued visibility requirement only. A visible source never grants execution authority. */
11
+ export declare function issueRequiredProviderSource(input: {
12
+ id: string;
13
+ version: string;
14
+ text: string;
15
+ }): RequiredProviderSource;
16
+ export interface PromptContextSelection {
17
+ schema: "omnius.prompt-selection.v1";
18
+ source: "model_led_core" | "custom_system";
19
+ version: string;
20
+ sha256: string;
21
+ bytes: number;
22
+ }
23
+ /** Host evidence only. This selection grants no tool, source or task authority. */
24
+ export declare function issuePromptContext(input: {
25
+ source: PromptContextSelection["source"];
26
+ version: string;
27
+ text: string;
28
+ }): PromptContextSelection;
29
+ export interface ProviderContextAudit {
30
+ schema: "omnius.provider-context-audit.v1";
31
+ stage: "before_fetch";
32
+ logicalRequestId?: string;
33
+ hostRequestFingerprint?: string;
34
+ protocol: string;
35
+ path: string;
36
+ wireModel?: string;
37
+ payloadKind: "generation" | "body_free_observation";
38
+ wireBodySha256?: string;
39
+ wireBytes: number;
40
+ streaming?: boolean;
41
+ prompt: {
42
+ status: "observed" | "unattributed" | "not_observed" | "unavailable";
43
+ selection?: PromptContextSelection;
44
+ };
45
+ reasonCode?: string;
46
+ systemContentSha256?: string;
47
+ requiredSources?: Array<RequiredProviderSource & {
48
+ status: "observed" | "not_observed";
49
+ }>;
50
+ toolProtocol: "ollama_native" | "openai_native" | "anthropic_native" | "none" | "unobserved";
51
+ responseParser: "native" | "json" | "hermes-xml";
52
+ toolCatalogueSha256?: string;
53
+ toolCount?: number;
54
+ think?: boolean;
55
+ contextTokens?: number;
56
+ outputLimitTokens?: number;
57
+ tokenAccounting: "not_measured";
58
+ weightedPrefill: "not_requested" | "requested_unqualified";
59
+ }
60
+ export declare class ProviderContextContractError extends Error {
61
+ readonly reasonCode: "selected_prompt_missing" | "required_source_missing" | "required_source_invalid" | "wire_audit_limit" | "wire_body_invalid";
62
+ readonly logicalRequestId?: string | undefined;
63
+ readonly dispatchAttempted = false;
64
+ constructor(reasonCode: "selected_prompt_missing" | "required_source_missing" | "required_source_invalid" | "wire_audit_limit" | "wire_body_invalid", logicalRequestId?: string | undefined);
65
+ }
66
+ /** Observe the final serialized body, after provider adaptation. Never retain prompt bodies or credentials. */
67
+ export declare function observeProviderContext(input: {
68
+ request: {
69
+ logicalRequestId?: string;
70
+ [PROMPT_CONTEXT_SELECTION]?: PromptContextSelection;
71
+ [PROVIDER_RESPONSE_PARSER]?: ProviderContextAudit["responseParser"];
72
+ [REQUIRED_PROVIDER_SOURCES]?: readonly RequiredProviderSource[];
73
+ weightedMemoryPrefill?: unknown;
74
+ };
75
+ protocol: string;
76
+ url: string;
77
+ body: unknown;
78
+ }): ProviderContextAudit;
@@ -0,0 +1,52 @@
1
+ /** Host invocation identity. Schema exposure and execution permission remain separate. */
2
+ export interface RequestToolIdentity {
3
+ name: string;
4
+ aliases?: readonly string[];
5
+ parameters: Record<string, unknown>;
6
+ modelFacingParameters?: Record<string, unknown>;
7
+ executionScope?: string;
8
+ purpose?: string;
9
+ schemaExposure?: string;
10
+ acceptsInvocationContext?: boolean;
11
+ interruptionKind?: string;
12
+ interruptionEffect?: string;
13
+ inputSchema?: unknown;
14
+ execute: unknown;
15
+ executeStream?: unknown;
16
+ normalizeInput?: unknown;
17
+ validateInput?: unknown;
18
+ isReadOnly?: unknown;
19
+ isConcurrencySafe?: unknown;
20
+ isObservationOnly?: unknown;
21
+ objectiveEffectIntent?: unknown;
22
+ }
23
+ export interface RequestToolCapabilitySnapshot {
24
+ readonly schema: "omnius.request-tool-capabilities.v1";
25
+ readonly fingerprint: string;
26
+ readonly names: readonly string[];
27
+ }
28
+ /** Capture trusted registry state before the provider can yield. Never hydrate this from JSON. */
29
+ export declare function captureRequestToolCapabilities(input: {
30
+ binding: string;
31
+ identities?: readonly unknown[];
32
+ tools: Iterable<readonly [
33
+ string,
34
+ RequestToolIdentity
35
+ ]>;
36
+ allowedNames: ReadonlySet<string>;
37
+ }): RequestToolCapabilitySnapshot;
38
+ /** Read-only construction custody. This does not issue a snapshot or grant
39
+ * any tool; callers must rebuild actual definitions when this context drifts. */
40
+ export declare function requestToolCapabilityContextProblem(snapshot: unknown, input: {
41
+ binding: string;
42
+ identities?: readonly unknown[];
43
+ }): string | null;
44
+ /** Every acceptance also intersects current permission and the exact current resolver result. */
45
+ export declare function requestToolCapabilityProblem(snapshot: unknown, input: {
46
+ binding: string;
47
+ identities?: readonly unknown[];
48
+ requestedName: string;
49
+ canonicalName: string;
50
+ tool: RequestToolIdentity;
51
+ allowedNow: boolean;
52
+ }): string | null;
@@ -64,6 +64,20 @@ export declare class StructuredMemoryExtractionQueue {
64
64
  constructor(db: ReturnType<typeof initDb>, options?: {
65
65
  now?: () => Date;
66
66
  });
67
+ /** Side-effect-free status of this already-open store; counts do not attest worker activation. */
68
+ getJobSnapshot(context: StructuredMemoryExtractionContext): {
69
+ schema: "omnius.structured-memory-extraction-status.v1";
70
+ state: "stored_queue" | "not_initialized";
71
+ scopeId: string | null;
72
+ profileSha256: string;
73
+ counts: {
74
+ pending: number;
75
+ running: number;
76
+ completed: number;
77
+ failed: number;
78
+ };
79
+ executionReadiness: "not_established_from_storage";
80
+ };
67
81
  private ownerScope;
68
82
  private assertSources;
69
83
  enqueue(input: StructuredMemoryExtractionJobInput): string[];
@@ -83,6 +97,12 @@ export declare function openStructuredMemoryExtractionWorker(options: Structured
83
97
  databasePath: string;
84
98
  intervalMs?: number;
85
99
  }): {
100
+ getStatus(): {
101
+ state: "open";
102
+ queue: ReturnType<StructuredMemoryExtractionQueue["getJobSnapshot"]>;
103
+ } | {
104
+ state: "closed";
105
+ };
86
106
  runOnce(): Promise<StructuredMemoryExtractionRunResult>;
87
107
  releaseRun(input: StructuredMemoryExtractionReleaseInput): void;
88
108
  stopAndWait(): Promise<void>;
@@ -43,6 +43,7 @@ export declare function assertStructuredMemoryExtractionBatchCurrent(input: {
43
43
  scopeId: string;
44
44
  batch: StructuredMemoryExtractionBatch;
45
45
  }): void;
46
+ export declare const STRUCTURED_MEMORY_EXTRACTOR_VERSION = "source-backed-structured-memory-v2";
46
47
  /**
47
48
  * Run bounded model-authored extraction batches and commit only schema-valid,
48
49
  * source-resolvable memories. The host never infers a semantic class from
@@ -58,5 +59,16 @@ export declare function extractStructuredMemoriesWithInference(input: {
58
59
  assertCurrent?: () => void;
59
60
  recordIdPrefix?: string;
60
61
  validFrom?: string;
62
+ /** Host-supplied admission metadata, never inferred from model output. */
63
+ derivationContext?: {
64
+ jobId?: string;
65
+ profile?: {
66
+ endpoint: string;
67
+ model: string;
68
+ protocol: string;
69
+ revision: string;
70
+ };
71
+ owner?: Record<string, unknown>;
72
+ };
61
73
  commitBatch?: (records: StructuredMemoryInput[], rejected: string[]) => StructuredMemoryRecord[];
62
74
  }): Promise<InferenceMemoryExtractionResult>;