omnius 1.0.923 → 1.0.925

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 (239) hide show
  1. package/dist/{providerRegistry.d.ts → _types/backend-vllm/providerRegistry.d.ts} +0 -1
  2. package/dist/_types/backend-vllm/types.d.ts +209 -0
  3. package/dist/_types/execution/av/media-capability.d.ts +94 -0
  4. package/dist/_types/execution/delegation-contract.d.ts +102 -0
  5. package/dist/_types/execution/evidence.d.ts +68 -0
  6. package/dist/_types/execution/html-source-evidence.d.ts +65 -0
  7. package/dist/_types/execution/mcp/types.d.ts +169 -0
  8. package/dist/_types/execution/mutation-contract.d.ts +102 -0
  9. package/dist/_types/execution/nol/artifacts.d.ts +39 -0
  10. package/dist/_types/execution/nol/checkpoint-edits.d.ts +98 -0
  11. package/dist/_types/execution/nol/distributions.d.ts +128 -0
  12. package/dist/_types/execution/nol/gguf-checkpoint-edits.d.ts +194 -0
  13. package/dist/_types/execution/nol/gguf-control-reader.d.ts +224 -0
  14. package/dist/_types/execution/nol/lora-exports.d.ts +129 -0
  15. package/dist/_types/execution/nol/neuronary.d.ts +212 -0
  16. package/dist/_types/execution/nol/pytorch-control-reader.d.ts +143 -0
  17. package/dist/_types/execution/nol/qwen35-head-sites.d.ts +61 -0
  18. package/dist/_types/execution/nol/worker-assets.d.ts +82 -0
  19. package/dist/_types/execution/nol/worker-protocol.d.ts +94 -0
  20. package/dist/_types/execution/page-content-source.d.ts +40 -0
  21. package/dist/_types/execution/rapid-computer-use/artifact-store.d.ts +21 -0
  22. package/dist/_types/execution/rapid-computer-use/contracts.d.ts +320 -0
  23. package/dist/_types/execution/rapid-computer-use/decision.d.ts +70 -0
  24. package/dist/_types/execution/rapid-computer-use/desktop-verification.d.ts +23 -0
  25. package/dist/_types/execution/rapid-computer-use/geometry.d.ts +57 -0
  26. package/dist/_types/execution/rapid-computer-use/planner.d.ts +78 -0
  27. package/dist/_types/execution/rapid-computer-use/trace.d.ts +80 -0
  28. package/dist/_types/execution/rapid-computer-use/visual.d.ts +48 -0
  29. package/dist/_types/execution/shell-runs.d.ts +78 -0
  30. package/dist/_types/execution/streamed-web-source.d.ts +64 -0
  31. package/dist/_types/execution/tools/browser-page-fallback.d.ts +25 -0
  32. package/dist/_types/execution/tools/network-egress-policy.d.ts +30 -0
  33. package/dist/_types/execution/tools/pdf-native-tables.d.ts +46 -0
  34. package/dist/_types/execution/tools/todo-store.d.ts +133 -0
  35. package/dist/_types/execution/tools/web-fetch.d.ts +57 -0
  36. package/dist/_types/execution/tools/workboard.d.ts +1223 -0
  37. package/dist/_types/execution/types.d.ts +549 -0
  38. package/dist/_types/execution/web-source.d.ts +14 -0
  39. package/dist/_types/memory/artifactReviewSourceIndex.d.ts +133 -0
  40. package/dist/_types/memory/contextMemoryLedger.d.ts +213 -0
  41. package/dist/_types/memory/db.d.ts +12 -0
  42. package/dist/_types/memory/embeddings.d.ts +36 -0
  43. package/dist/_types/memory/immutableEvidenceStore.d.ts +165 -0
  44. package/dist/_types/memory/memoryIngestion.d.ts +65 -0
  45. package/dist/_types/memory/memoryTypes.d.ts +312 -0
  46. package/dist/_types/memory/sourceCorpusStore.d.ts +331 -0
  47. package/dist/_types/memory/structuredMemoryStore.d.ts +105 -0
  48. package/dist/_types/memory/unifiedMemoryStore.d.ts +127 -0
  49. package/dist/_types/memory/virtualMemory.d.ts +187 -0
  50. package/dist/_types/orchestrator/agentic-page-content-receipt.d.ts +20 -0
  51. package/dist/_types/orchestrator/agentic-web-fetch-receipt.d.ts +20 -0
  52. package/dist/_types/orchestrator/agenticRunner.d.ts +5219 -0
  53. package/dist/_types/orchestrator/app-state.d.ts +171 -0
  54. package/dist/_types/orchestrator/artifactClaimCritic.d.ts +63 -0
  55. package/dist/_types/orchestrator/artifactQuality.d.ts +15 -0
  56. package/dist/_types/orchestrator/artifactSemanticIntegrity.d.ts +203 -0
  57. package/dist/_types/orchestrator/canonical-context-projection.d.ts +254 -0
  58. package/dist/_types/orchestrator/canonical-source-body-projection.d.ts +51 -0
  59. package/dist/_types/orchestrator/completion-review-pending.d.ts +24 -0
  60. package/dist/_types/orchestrator/completionContract.d.ts +103 -0
  61. package/dist/_types/orchestrator/completionFinalization.d.ts +224 -0
  62. package/dist/_types/orchestrator/completionLedger.d.ts +429 -0
  63. package/dist/_types/orchestrator/completionReadiness.d.ts +234 -0
  64. package/dist/_types/orchestrator/context-admission.d.ts +93 -0
  65. package/dist/_types/orchestrator/context-dump-retention.d.ts +25 -0
  66. package/dist/_types/orchestrator/context-fabric.d.ts +133 -0
  67. package/dist/_types/orchestrator/contextEngine.d.ts +68 -0
  68. package/dist/_types/orchestrator/contextWindowDump.d.ts +327 -0
  69. package/dist/_types/orchestrator/convergence-breaker.d.ts +225 -0
  70. package/dist/_types/orchestrator/convergence-progress.d.ts +66 -0
  71. package/dist/_types/orchestrator/deliveryCoverage.d.ts +181 -0
  72. package/dist/_types/orchestrator/document-persistence-goal-binding.d.ts +106 -0
  73. package/dist/_types/orchestrator/durable-document-worker.d.ts +85 -0
  74. package/dist/_types/orchestrator/evidenceBranch.d.ts +291 -0
  75. package/dist/_types/orchestrator/expected-inference-response.d.ts +55 -0
  76. package/dist/_types/orchestrator/expectedOutcomeContract.d.ts +58 -0
  77. package/dist/_types/orchestrator/failure-taxonomy.d.ts +36 -0
  78. package/dist/_types/orchestrator/focusSupervisor.d.ts +436 -0
  79. package/dist/_types/orchestrator/forced-update-requirement-recovery.d.ts +105 -0
  80. package/dist/_types/orchestrator/hooks.d.ts +100 -0
  81. package/dist/_types/orchestrator/inference-pressure.d.ts +61 -0
  82. package/dist/_types/orchestrator/integrationClosure.d.ts +89 -0
  83. package/dist/_types/orchestrator/interruption-lifecycle.d.ts +154 -0
  84. package/dist/_types/orchestrator/live-memory-passages.d.ts +51 -0
  85. package/dist/_types/orchestrator/liveVirtualContext.d.ts +84 -0
  86. package/dist/_types/orchestrator/memory-compiler.d.ts +254 -0
  87. package/dist/_types/orchestrator/memory-consolidation.d.ts +134 -0
  88. package/dist/_types/orchestrator/model-router.d.ts +17 -0
  89. package/dist/_types/orchestrator/modelResponseDiagnostics.d.ts +71 -0
  90. package/dist/_types/orchestrator/nativeRequirementAmendment.d.ts +63 -0
  91. package/dist/_types/orchestrator/nol/coordinator.d.ts +204 -0
  92. package/dist/_types/orchestrator/nol/datasets.d.ts +58 -0
  93. package/dist/_types/orchestrator/nol/discovery.d.ts +286 -0
  94. package/dist/_types/orchestrator/nol/evaluation.d.ts +59 -0
  95. package/dist/_types/orchestrator/nol/model-validation.d.ts +198 -0
  96. package/dist/_types/orchestrator/nol/statistics.d.ts +142 -0
  97. package/dist/_types/orchestrator/nol/store.d.ts +133 -0
  98. package/dist/_types/orchestrator/nol/variant-registry.d.ts +292 -0
  99. package/dist/_types/orchestrator/ollama-context-policy.d.ts +34 -0
  100. package/dist/_types/orchestrator/personality.d.ts +66 -0
  101. package/dist/_types/orchestrator/prompt-cache.d.ts +24 -0
  102. package/dist/_types/orchestrator/remote-inference-fallback.d.ts +224 -0
  103. package/dist/_types/orchestrator/remote-inference-policy.d.ts +58 -0
  104. package/dist/_types/orchestrator/request-budget.d.ts +75 -0
  105. package/dist/_types/orchestrator/requirementCoverage.d.ts +69 -0
  106. package/dist/_types/orchestrator/reviewedInterpretation.d.ts +111 -0
  107. package/dist/_types/orchestrator/runEvents.d.ts +115 -0
  108. package/dist/_types/orchestrator/runtime-rollout.d.ts +63 -0
  109. package/dist/_types/orchestrator/semanticVerification.d.ts +135 -0
  110. package/dist/_types/orchestrator/source-wide-extraction.d.ts +202 -0
  111. package/dist/_types/orchestrator/steeringIntake.d.ts +123 -0
  112. package/dist/_types/orchestrator/structured-memory-extraction-worker.d.ts +89 -0
  113. package/dist/_types/orchestrator/structuredMemoryInference.d.ts +62 -0
  114. package/dist/_types/orchestrator/successful-procedure-memory.d.ts +127 -0
  115. package/dist/_types/orchestrator/supportedAnswer.d.ts +68 -0
  116. package/dist/_types/orchestrator/taskEffectEvidence.d.ts +38 -0
  117. package/dist/_types/orchestrator/taskExecutionSnapshot.d.ts +67 -0
  118. package/dist/_types/orchestrator/taskObjective.d.ts +310 -0
  119. package/dist/_types/orchestrator/taskObjectiveContinuation.d.ts +134 -0
  120. package/dist/_types/orchestrator/taskRequirementReview.d.ts +246 -0
  121. package/dist/_types/orchestrator/taskRequirements.d.ts +80 -0
  122. package/dist/_types/orchestrator/taskSemanticAdmission.d.ts +159 -0
  123. package/dist/_types/orchestrator/taskWorkDelegation.d.ts +147 -0
  124. package/dist/_types/orchestrator/taskWorkPlan.d.ts +177 -0
  125. package/dist/_types/orchestrator/telegram-passive-history.d.ts +42 -0
  126. package/dist/_types/orchestrator/terminalTaskReport.d.ts +91 -0
  127. package/dist/_types/orchestrator/todoObservability.d.ts +147 -0
  128. package/dist/_types/orchestrator/tool-exposure-policy.d.ts +100 -0
  129. package/dist/_types/orchestrator/trajectory-checkpoint.d.ts +159 -0
  130. package/dist/_types/orchestrator/types.d.ts +185 -0
  131. package/dist/_types/schemas/dispatch.d.ts +53 -0
  132. package/dist/_types/schemas/feature-workflow.d.ts +362 -0
  133. package/dist/_types/schemas/messages.d.ts +15 -0
  134. package/dist/_types/schemas/nol-assets.d.ts +955 -0
  135. package/dist/_types/schemas/nol-json.d.ts +2 -0
  136. package/dist/_types/schemas/nol.d.ts +3995 -0
  137. package/dist/_types/schemas/patch.d.ts +47 -0
  138. package/dist/_types/schemas/plan.d.ts +47 -0
  139. package/dist/_types/schemas/repoProfile.d.ts +116 -0
  140. package/dist/_types/schemas/retrieval.d.ts +44 -0
  141. package/dist/_types/schemas/task.d.ts +57 -0
  142. package/dist/_types/schemas/tools.d.ts +16 -0
  143. package/dist/_types/schemas/verification.d.ts +31 -0
  144. package/dist/api/py-embed.js +3353 -1829
  145. package/dist/assets/nol-checkpoint-editor.py +701 -0
  146. package/dist/assets/nol-gguf-checkpoint-editor.py +785 -0
  147. package/dist/assets/nol-gguf-control-reader.py +428 -0
  148. package/dist/assets/nol-gne-tools-worker.py +425 -0
  149. package/dist/assets/nol-gne-worker.py +1081 -0
  150. package/dist/assets/nol-lora-exporter.py +349 -0
  151. package/dist/assets/nol-pytorch-control-reader.py +470 -0
  152. package/dist/assets/nol-transformers-nnsight-worker.py +512 -0
  153. package/dist/assets/nol-transformers-peft-validation-worker.py +385 -0
  154. package/dist/assets/nol-transformers-peft-worker.py +488 -0
  155. package/dist/assets/nol-transformers-research-worker.py +472 -0
  156. package/dist/assets/nol-transformers-worker.py +920 -0
  157. package/dist/assets/nol-vllm-owned-worker.py +803 -0
  158. package/dist/assets/nol-vllm-runtime.py +695 -0
  159. package/dist/assets/nol-vllm-tokenizer.py +93 -0
  160. package/dist/assets/nol-vllm-worker.py +201 -0
  161. package/dist/computer-use/configured-planner.d.ts +37 -0
  162. package/dist/computer-use/configured-point.d.ts +35 -0
  163. package/dist/computer-use/host-session.d.ts +60 -0
  164. package/dist/computer-use/runner-ui-port.d.ts +37 -0
  165. package/dist/computer-use/session-review.d.ts +14 -0
  166. package/dist/computer-use/task-spec.d.ts +84 -0
  167. package/dist/discovery.d.ts +16 -2
  168. package/dist/index.js +2 -2
  169. package/dist/library.d.ts +94 -10
  170. package/dist/library.js +144003 -87414
  171. package/dist/memory-maintenance-worker.js +1676 -511
  172. package/dist/nol/cpu-control-reader-profile.d.ts +93 -0
  173. package/dist/nol/cpu-control-reader-service.d.ts +87 -0
  174. package/dist/nol/cuda-lease.d.ts +111 -0
  175. package/dist/nol/cuda-mutations.d.ts +34 -0
  176. package/dist/nol/export-runtime-config.d.ts +114 -0
  177. package/dist/nol/export-service.d.ts +143 -0
  178. package/dist/nol/facade.d.ts +147 -0
  179. package/dist/nol/gguf-cpu-control-reader-profile.d.ts +106 -0
  180. package/dist/nol/gguf-cpu-control-reader-service.d.ts +91 -0
  181. package/dist/nol/gguf-model-control-verifier.d.ts +120 -0
  182. package/dist/nol/gguf-parameter-inventory.d.ts +28 -0
  183. package/dist/nol/gne-adapter.d.ts +134 -0
  184. package/dist/nol/gne-agent-evaluation.d.ts +84 -0
  185. package/dist/nol/gne-profile.d.ts +124 -0
  186. package/dist/nol/gne-tools-profile.d.ts +148 -0
  187. package/dist/nol/gne-tools-transport.d.ts +194 -0
  188. package/dist/nol/model-actions.d.ts +662 -0
  189. package/dist/nol/model-control-verifier.d.ts +135 -0
  190. package/dist/nol/model-json-scorer.d.ts +13 -0
  191. package/dist/nol/model-runtime-config.d.ts +830 -0
  192. package/dist/nol/model-serving.d.ts +130 -0
  193. package/dist/nol/model-subject-adapter.d.ts +72 -0
  194. package/dist/nol/model-validation-factory.d.ts +113 -0
  195. package/dist/nol/neuronary-catalog.d.ts +130 -0
  196. package/dist/nol/orphan-custody.d.ts +72 -0
  197. package/dist/nol/peft-conformance.d.ts +48 -0
  198. package/dist/nol/peft-control-types.d.ts +137 -0
  199. package/dist/nol/peft-control-verifier.d.ts +8 -0
  200. package/dist/nol/peft-model-actions.d.ts +41 -0
  201. package/dist/nol/peft-model-authority.d.ts +146 -0
  202. package/dist/nol/peft-model-controls.d.ts +20 -0
  203. package/dist/nol/peft-model-host.d.ts +47 -0
  204. package/dist/nol/peft-model-profile.d.ts +161 -0
  205. package/dist/nol/peft-model-runtime-config.d.ts +174 -0
  206. package/dist/nol/peft-model-subject-adapter.d.ts +36 -0
  207. package/dist/nol/peft-validation.d.ts +105 -0
  208. package/dist/nol/persistent-parameter-inventory.d.ts +32 -0
  209. package/dist/nol/runtime.d.ts +100 -0
  210. package/dist/nol/sqlite-store.d.ts +80 -0
  211. package/dist/nol/transformers-adapter.d.ts +119 -0
  212. package/dist/nol/transformers-nnsight.d.ts +87 -0
  213. package/dist/nol/transformers-peft.d.ts +107 -0
  214. package/dist/nol/transformers-research.d.ts +114 -0
  215. package/dist/nol/variant-service.d.ts +143 -0
  216. package/dist/nol/variant-store.d.ts +51 -0
  217. package/dist/nol/vllm-actions.d.ts +774 -0
  218. package/dist/nol/vllm-adapter.d.ts +1473 -0
  219. package/dist/nol/vllm-authority.d.ts +55 -0
  220. package/dist/nol/vllm-conformance.d.ts +662 -0
  221. package/dist/nol/vllm-profile.d.ts +850 -0
  222. package/dist/nol/vllm-protocol.d.ts +1505 -0
  223. package/dist/nol/vllm-runtime-config.d.ts +120 -0
  224. package/dist/nol/vllm-runtime.d.ts +34 -0
  225. package/dist/nol/vllm-startup.d.ts +235 -0
  226. package/dist/omni-setup-worker.js +3433 -1909
  227. package/dist/service-version.d.ts +0 -1
  228. package/dist/tui/async-process.d.ts +27 -0
  229. package/dist/tui/native/worker.js +3 -1
  230. package/dist/tui/telegram-action-session-registry.d.ts +136 -0
  231. package/dist/tui/telegram-cognition-queue.d.ts +154 -0
  232. package/dist/tui/telegram-context-packet-v2.d.ts +99 -0
  233. package/dist/tui/telegram-input-ownership.d.ts +78 -0
  234. package/dist/tui/telegram-turn-contract-v2.d.ts +62 -0
  235. package/dist/update-worker-runtime.js +4216 -2603
  236. package/docs/DISCOVERY.json +389 -0
  237. package/docs/DISCOVERY.md +4 -0
  238. package/npm-shrinkwrap.json +28 -12
  239. package/package.json +3 -2
@@ -0,0 +1,291 @@
1
+ /**
2
+ * evidenceBranch.ts — branch → explore → extract → inject for reads.
3
+ *
4
+ * The shared engine behind both the auto-routed large-read interception and
5
+ * the explicit extract_evidence tool. It reads a (possibly huge) artifact in a
6
+ * TRANSIENT, isolated context, distills only what the current intent needs, and
7
+ * returns a small evidence node with provenance — so the main agent loop never
8
+ * ingests the raw content. This dissolves the two root causes observed in real
9
+ * sessions at once:
10
+ * - amnesia: the main loop's context never balloons, so compaction never
11
+ * churns away the read result (the 27× re-read loop can't start);
12
+ * - preview-thrash: large-file navigation happens here, in a disposable
13
+ * budget, and dies with the branch instead of polluting the main thread.
14
+ *
15
+ * Strategy: keyword-narrow then extract. We avoid feeding the whole file to the
16
+ * model — we select the windows most relevant to the query (by term overlap),
17
+ * cap the explored span, and run one extraction call per batch. For small files
18
+ * we extract in a single pass. The result carries source line provenance and a
19
+ * file version so the evidence ledger can mark it stale on mutation.
20
+ */
21
+ export interface BranchBackendLike {
22
+ chatCompletion(req: {
23
+ messages: Array<{
24
+ role: string;
25
+ content: string;
26
+ }>;
27
+ tools: never[];
28
+ temperature: number;
29
+ maxTokens: number;
30
+ timeoutMs: number;
31
+ }): Promise<{
32
+ choices: Array<{
33
+ message: {
34
+ content: string | null;
35
+ };
36
+ }>;
37
+ }>;
38
+ }
39
+ export interface ExtractedEvidence {
40
+ path: string;
41
+ query: string;
42
+ /** Distilled evidence that goes into the main loop. */
43
+ claim: string;
44
+ /** Provenance: the line span the claim was drawn from (1-based), or null. */
45
+ sourceStart: number | null;
46
+ sourceEnd: number | null;
47
+ fileVersion: number;
48
+ confidence: number;
49
+ /** Raw lines explored inside the branch (stayed out of main). */
50
+ exploredLines: number;
51
+ /** Approx chars returned to main (the distilled size). */
52
+ injectedChars: number;
53
+ /** Canonical, non-contiguous source segments. Never infer continuity between them. */
54
+ segments: CuratedEvidenceSegment[];
55
+ /** Separately validated semantic requirements; retrieval alone resolves none. */
56
+ satisfiedRequirementIds: string[];
57
+ /** Requirements the bounded branch could not resolve. */
58
+ unresolvedRequirementIds: string[];
59
+ /**
60
+ * Explicit coverage for every declared discovery requirement. A branch is
61
+ * never considered complete merely because it found one convenient anchor.
62
+ */
63
+ requirementCoverage: BranchRequirementCoverage[];
64
+ /** Semantic completion; literal retrieval and model-selected spans alone do not establish it. */
65
+ contractComplete: boolean;
66
+ /** Auditable search/provenance record; raw file content is never included. */
67
+ provenance: BranchExtractionProvenance;
68
+ /** Untrusted model observations about relevance; never requirement acceptance. */
69
+ extractionAssessments?: BranchExtractionAssessment[];
70
+ }
71
+ export interface BranchExtractionAssessment {
72
+ source: {
73
+ path: string;
74
+ contentHash: string;
75
+ fileVersion: number;
76
+ };
77
+ query: string;
78
+ assessment: string;
79
+ refinedSearchTerms: string[];
80
+ /** Exact source windows shown to this extraction attempt; not a complete read. */
81
+ presentedRanges: Array<{
82
+ startLine: number;
83
+ endLine: number;
84
+ }>;
85
+ /** A model selector is recorded only when wholly inside a presented window. */
86
+ selectedRange?: {
87
+ startLine: number;
88
+ endLine: number;
89
+ };
90
+ }
91
+ export interface BranchRequirementCoverage {
92
+ id: string;
93
+ question: string;
94
+ status: "satisfied" | "unresolved";
95
+ /** Anchors that support this particular requirement. */
96
+ anchors: Array<{
97
+ startLine: number;
98
+ endLine: number;
99
+ }>;
100
+ /** Lexical retrieval is independent of unassessed semantic satisfaction. */
101
+ retrieval?: {
102
+ /** Missing from these candidates never establishes absence from the source. */
103
+ scope: "returned_candidates";
104
+ status: "complete" | "partial" | "unmatched";
105
+ matchedTerms: string[];
106
+ missingTerms: string[];
107
+ anchors: Array<{
108
+ startLine: number;
109
+ endLine: number;
110
+ }>;
111
+ };
112
+ /** Present for unresolved requirements; never leave a partial result vague. */
113
+ reason?: string;
114
+ /** Deterministic, bounded recovery action for an unresolved requirement. */
115
+ recovery?: string;
116
+ }
117
+ export interface CuratedEvidenceSegment {
118
+ id: string;
119
+ requirementIds: string[];
120
+ summary: string;
121
+ /** Verbatim, line-numbered source excerpt reconstructed by the runtime. */
122
+ excerpt: string;
123
+ confidence: number;
124
+ anchor: {
125
+ path: string;
126
+ startLine: number;
127
+ endLine: number;
128
+ contentHash: string;
129
+ segmentHash: string;
130
+ };
131
+ }
132
+ export interface BranchExtractionProvenance {
133
+ contentHash: string;
134
+ byteCount: number;
135
+ lineCount: number;
136
+ fileVersion: number;
137
+ exploredRanges: Array<{
138
+ startLine: number;
139
+ endLine: number;
140
+ }>;
141
+ searchRounds: Array<{
142
+ round: number;
143
+ strategy: "literal" | "refined" | "semantic" | "structural";
144
+ query: string;
145
+ matches: number;
146
+ }>;
147
+ truncated: boolean;
148
+ }
149
+ export interface BranchDiscoveryRequirement {
150
+ id: string;
151
+ question: string;
152
+ required: boolean;
153
+ expectedEvidence: string;
154
+ searchTerms: string[];
155
+ }
156
+ export interface BranchDiscoveryContract {
157
+ version: 1;
158
+ path: string;
159
+ goalAnchor: string;
160
+ query: string;
161
+ requirements: BranchDiscoveryRequirement[];
162
+ completionCriteria: string[];
163
+ budget: {
164
+ maxRounds: number;
165
+ maxWindowsPerRound: number;
166
+ maxTotalWindows: number;
167
+ maxPresentedLines: number;
168
+ /** Hard character ceiling for source excerpts placed in the isolated worker. */
169
+ maxPresentedChars: number;
170
+ maxInjectedChars: number;
171
+ };
172
+ }
173
+ /**
174
+ * A bounded request from the active agent loop to its isolated read branch.
175
+ * Unlike a user-goal seed, this says why the branch is needed now and what
176
+ * evidence must come back for the parent to choose its next action.
177
+ */
178
+ export interface BranchExtractionBrief {
179
+ request: string;
180
+ triggerEvidence: string[];
181
+ returnContract: string;
182
+ retrievalQuery: string;
183
+ /** Machine-checkable discovery contract injected into the isolated branch. */
184
+ discoveryContract?: BranchDiscoveryContract;
185
+ /** Bounded requested region. When set, local search stays inside it. */
186
+ requestedRange?: {
187
+ offset?: number;
188
+ limit?: number;
189
+ };
190
+ }
191
+ export interface BuildBranchExtractionBriefInput {
192
+ path: string;
193
+ lineCount: number;
194
+ byteCount: number;
195
+ /** Current visible agent intent, never raw user-message text. */
196
+ assistantIntent?: string;
197
+ /** Current trajectory's model-generated situation assessment, when present. */
198
+ trajectoryAssessment?: string;
199
+ trajectoryNextAction?: string;
200
+ trajectoryOpenQuestion?: string;
201
+ currentStep?: string;
202
+ recentFailure?: string;
203
+ /** Bounded task anchor. Do not pass an unbounded raw conversation transcript. */
204
+ goalAnchor?: string;
205
+ requestedRange?: {
206
+ offset?: number;
207
+ limit?: number;
208
+ };
209
+ projectedReadTokens?: number;
210
+ contextWindowTokens?: number;
211
+ routingReason?: string;
212
+ }
213
+ export declare function buildBranchExtractionBrief(input: BuildBranchExtractionBriefInput): BranchExtractionBrief;
214
+ /** Compact parent-facing proof that no declared branch requirement vanished. */
215
+ export declare function renderBranchRequirementCoverage(evidence: Pick<ExtractedEvidence, "requirementCoverage" | "contractComplete">): string[];
216
+ export interface ExtractEvidenceOptions {
217
+ path: string;
218
+ query: string;
219
+ /** Structured current-turn request; falls back to `query` for legacy callers. */
220
+ brief?: BranchExtractionBrief;
221
+ content: string;
222
+ /** Whole-source hash when `content` is only a requested range. */
223
+ contentHash?: string;
224
+ /** Zero-based number of source lines preceding `content` (for ranged reads). */
225
+ sourceLineOffset?: number;
226
+ /** Bounded requested region. When set, local search stays inside it. */
227
+ requestedRange?: {
228
+ offset?: number;
229
+ limit?: number;
230
+ };
231
+ fileVersion: number;
232
+ /** Optional: deterministic extraction remains available without inference. */
233
+ backend?: BranchBackendLike;
234
+ timeoutMs?: number;
235
+ }
236
+ /**
237
+ * Run the branch extraction. `content` is the full file body (read inside the
238
+ * branch — it never reaches main). Returns a distilled evidence node.
239
+ */
240
+ export declare function extractEvidence(opts: ExtractEvidenceOptions): Promise<ExtractedEvidence>;
241
+ /**
242
+ * Legacy size-only fallback used when no context window is available.
243
+ * `hasExplicitSmallRange` is retained for API compatibility, but a requested
244
+ * range is never trusted as proof that the materialized payload is small.
245
+ */
246
+ export declare function shouldBranchRead(contentLength: number, lineCount: number, _hasExplicitSmallRange: boolean, thresholdChars?: number): boolean;
247
+ export declare const DEFAULT_BRANCH_READ_CONTEXT_FRACTION = 0.2;
248
+ export interface BranchReadRoutingInput {
249
+ /** UTF-8/transport bytes of the selected payload, excluding model gutters. */
250
+ sourceBytes: number;
251
+ sourceLines: number;
252
+ /** Exact model-facing estimate when already known. */
253
+ projectedReadTokens?: number;
254
+ /** Total/effective model context. Unknown/zero falls back to the legacy gate. */
255
+ contextWindowTokens: number;
256
+ residentContextTokens?: number;
257
+ reservedTokens?: number;
258
+ pendingInlineReadTokens?: number;
259
+ /** Optional safer ceiling such as the runner compaction threshold. */
260
+ safeContextTokens?: number;
261
+ requestedRange?: {
262
+ offset?: number;
263
+ limit?: number;
264
+ };
265
+ maxInlineFraction?: number;
266
+ }
267
+ export type BranchReadRoutingReason = "read_fraction" | "headroom" | "batch_budget" | "legacy_size";
268
+ export interface BranchReadRoutingDecision {
269
+ branch: boolean;
270
+ reasons: BranchReadRoutingReason[];
271
+ projectedReadTokens: number;
272
+ fractionLimitTokens: number;
273
+ availableHeadroomTokens: number;
274
+ projectedFraction: number;
275
+ requestedRange?: {
276
+ offset?: number;
277
+ limit?: number;
278
+ };
279
+ }
280
+ /**
281
+ * Conservative estimate of what a numbered file-read payload costs after the
282
+ * tool header, six-character line gutters, separators, and message framing.
283
+ */
284
+ export declare function estimateFileReadInjectionTokens(sourceBytes: number, sourceLines: number): number;
285
+ /**
286
+ * Read-routing decision. A large read is still first-class evidence: branch
287
+ * extraction is selected only when the exact pending context cannot carry the
288
+ * full body with its real reservations. The fraction is retained as telemetry
289
+ * for observability, never as a coercive exploration gate.
290
+ */
291
+ export declare function assessBranchRead(input: BranchReadRoutingInput): BranchReadRoutingDecision;
@@ -0,0 +1,55 @@
1
+ import type { ToolDefinition } from "../backend-vllm/types.js";
2
+ export declare enum InputValidationFailure {
3
+ JsonSyntax = "json_syntax",
4
+ SchemaMismatch = "schema_mismatch",
5
+ UnsupportedSchema = "unsupported_schema",
6
+ ToolChoice = "tool_choice",
7
+ UnknownTool = "unknown_tool",
8
+ ToolArguments = "tool_arguments",
9
+ Truncated = "truncated"
10
+ }
11
+ export type ExpectedInferenceResponseKind = "text" | "native_tools" | "json_object" | "json_schema";
12
+ export interface ExpectedInferenceResponseContract {
13
+ tools?: readonly ToolDefinition[];
14
+ toolChoice?: "auto" | "none" | "required" | {
15
+ type: "function";
16
+ function: {
17
+ name: string;
18
+ };
19
+ };
20
+ responseFormat?: Record<string, unknown>;
21
+ response_format?: Record<string, unknown>;
22
+ completeStructuredResponse?: (value: unknown) => boolean;
23
+ }
24
+ export interface InferenceResponseCandidate {
25
+ content?: unknown;
26
+ toolCalls?: readonly {
27
+ id?: unknown;
28
+ name?: unknown;
29
+ arguments?: unknown;
30
+ }[];
31
+ }
32
+ export interface ExpectedInferenceValidationResult {
33
+ expectedKind: ExpectedInferenceResponseKind;
34
+ structuredValue?: unknown;
35
+ /** Exact JSON text after whitespace or one complete Markdown fence is removed; never repaired. */
36
+ normalizedContent?: string;
37
+ }
38
+ /** Whitelisted diagnostics only. Never retains a provider body, field value, nested error or cause. */
39
+ export declare class ExpectedInferenceResponseError extends Error {
40
+ readonly reason: InputValidationFailure;
41
+ readonly expectedKind: ExpectedInferenceResponseKind;
42
+ constructor(reason: InputValidationFailure, expectedKind: ExpectedInferenceResponseKind);
43
+ }
44
+ export declare function expectedInferenceResponseKind(contract: ExpectedInferenceResponseContract): ExpectedInferenceResponseKind;
45
+ /** Parse one complete requested JSON value, optionally in one whole JSON Markdown fence. */
46
+ export declare function parseExpectedInferenceJson(content: unknown, contract: ExpectedInferenceResponseContract): ExpectedInferenceValidationResult & {
47
+ structuredValue: unknown;
48
+ normalizedContent: string;
49
+ };
50
+ /** Contract validation confers no execution, factual-completion or delivery authority. */
51
+ export declare function validateExpectedInferenceResponse(message: InferenceResponseCandidate | undefined, contract: ExpectedInferenceResponseContract, options?: {
52
+ outputTruncated?: boolean;
53
+ }): ExpectedInferenceValidationResult;
54
+ /** Trusted request guidance only; contains the actual schema, never a provider response or conversation. */
55
+ export declare function formatExpectedInferenceInstructions(contract: ExpectedInferenceResponseContract): string;
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Host-authored terminal outcome contract.
3
+ *
4
+ * The host obtains this contract from a typed inference boundary. The runner
5
+ * deliberately does not derive it from task text, completion prose, tool
6
+ * names, or keyword rules. It only compares the declared required effects to
7
+ * effects observed from typed runtime results.
8
+ */
9
+ export type ExpectedOutcomeKindV1 = "conversation" | "read_only" | "mutation" | "delivery";
10
+ export type ExpectedOutcomeRouteV1 = "chat" | "action";
11
+ export type ExpectedOutcomeContinuityV1 = "new" | "continue_active" | "status_probe" | "replace";
12
+ export type ExpectedOutcomePlanningModeV1 = "none" | "checklist";
13
+ export type ExpectedOutcomeRequiredEffectV1 = "visible_response" | "observation" | "mutation" | "verification" | "delivery";
14
+ export interface ExpectedOutcomeContractV1 {
15
+ schema: "omnius.expected-outcome-contract.v1";
16
+ route: ExpectedOutcomeRouteV1;
17
+ continuity: ExpectedOutcomeContinuityV1;
18
+ activeScopeId?: string;
19
+ citedEvidenceIds: string[];
20
+ confidence: number;
21
+ reason: string;
22
+ planningMode: ExpectedOutcomePlanningModeV1;
23
+ outcome: ExpectedOutcomeKindV1;
24
+ requiredEffects: ExpectedOutcomeRequiredEffectV1[];
25
+ /** Optional host correlation identifiers; never interpreted as task text. */
26
+ inputId?: string;
27
+ decisionId?: string;
28
+ }
29
+ export interface CompletionDeliveryReceipt {
30
+ schema: "omnius.completion-delivery-receipt.v1";
31
+ provider: string;
32
+ target: string;
33
+ receiptId: string;
34
+ deliveredAtIso: string;
35
+ artifactPaths?: string[];
36
+ }
37
+ export interface ExpectedOutcomeAssessmentV1 {
38
+ schema: "omnius.expected-outcome-assessment.v1";
39
+ outcome: ExpectedOutcomeKindV1;
40
+ requiredEffects: ExpectedOutcomeRequiredEffectV1[];
41
+ observedEffects: ExpectedOutcomeRequiredEffectV1[];
42
+ missingEffects: ExpectedOutcomeRequiredEffectV1[];
43
+ satisfied: boolean;
44
+ }
45
+ /** Share the canonical invariant with inference instructions and diagnostics. */
46
+ export declare function expectedOutcomeCoreEffectV1(outcome: unknown): ExpectedOutcomeRequiredEffectV1 | undefined;
47
+ /** Validate and canonicalize a contract supplied by a trusted host boundary. */
48
+ export declare function normalizeExpectedOutcomeContractV1(value: unknown): ExpectedOutcomeContractV1 | null;
49
+ export declare function assessExpectedOutcomeContractV1(contract: ExpectedOutcomeContractV1, observed: Iterable<ExpectedOutcomeRequiredEffectV1>): ExpectedOutcomeAssessmentV1;
50
+ /**
51
+ * Text-only completion is an explicit contract capability, never a profile
52
+ * guess. A read-only action can finish with ordinary assistant text only when
53
+ * the host required both a real observation and a visible response. The
54
+ * runner separately verifies that both effects were observed before it
55
+ * accepts the text, so an intake promise cannot terminate research early.
56
+ */
57
+ export declare function expectedOutcomeAllowsTextOnlyCompletion(contract: ExpectedOutcomeContractV1 | undefined): boolean;
58
+ export declare function normalizeCompletionDeliveryReceipt(value: unknown): CompletionDeliveryReceipt | null;
@@ -0,0 +1,36 @@
1
+ export type FailureDiagnosisKind = "schema_mismatch" | "stale_hash" | "text_mismatch" | "module_resolution" | "type_error" | "missing_tool" | "environment_invariant_poison" | "verifier_cache_short_circuit" | "unsafe_recovery_attempt" | "mutation_scope_conflict" | "proposal_mode_required" | "background_inference_skipped" | "background_inference_contention" | "cached_evidence_invalidated" | "completion_hold" | "capability_unavailable" | "verifier_runtime_error" | "compile_error" | "workboard_noop" | "permission_denied" | "timeout" | "not_found" | "network" | "syntax" | "runtime_error" | "runtime_unknown";
2
+ export type FailureSeverity = "info" | "warning" | "error";
3
+ export interface FailureDiagnosis {
4
+ kind: FailureDiagnosisKind;
5
+ tool: string;
6
+ patternKey: string;
7
+ severity: FailureSeverity;
8
+ retryable: boolean;
9
+ summary: string;
10
+ guidance: string;
11
+ workboardTitle: string;
12
+ workboardDescription: string;
13
+ workboardEvidenceRequirements: string[];
14
+ createRecoveryCard: boolean;
15
+ }
16
+ export interface ClassifyFailureInput {
17
+ /** Executor-issued facts take precedence over diagnostic wording. */
18
+ failure?: {
19
+ kind: "hash_conflict" | "text_mismatch" | "schema_validation" | "filesystem_not_found" | "compiler" | "module_resolution" | "syntax" | "type";
20
+ path?: string;
21
+ expectedHash?: string;
22
+ actualHash?: string;
23
+ field?: string;
24
+ expectedField?: string;
25
+ };
26
+ toolName: string;
27
+ args?: Record<string, unknown> | null;
28
+ errorText?: string | null;
29
+ outputText?: string | null;
30
+ }
31
+ export declare function classifyRuntimeFailure(input: ClassifyFailureInput): FailureDiagnosis;
32
+ export declare function normalizeFailurePatternSignature(signature: string): string;
33
+ export declare function failureCardId(diagnosis: Pick<FailureDiagnosis, "patternKey">, identity?: {
34
+ taskEpoch?: number;
35
+ targetKey?: string;
36
+ }): string;