@duckcodeailabs/dql-agent 1.14.2 → 1.14.4

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 (196) hide show
  1. package/dist/agent-run-engine.d.ts +239 -4
  2. package/dist/agent-run-engine.d.ts.map +1 -1
  3. package/dist/agent-run-engine.js +2924 -85
  4. package/dist/agent-run-engine.js.map +1 -1
  5. package/dist/agent-run-gates.d.ts.map +1 -1
  6. package/dist/agent-run-gates.js +51 -3
  7. package/dist/agent-run-gates.js.map +1 -1
  8. package/dist/agent-run-planner.d.ts +6 -0
  9. package/dist/agent-run-planner.d.ts.map +1 -1
  10. package/dist/agent-run-planner.js +2 -0
  11. package/dist/agent-run-planner.js.map +1 -1
  12. package/dist/agent-run-store.d.ts.map +1 -1
  13. package/dist/agent-run-store.js +591 -11
  14. package/dist/agent-run-store.js.map +1 -1
  15. package/dist/agentic/analyst-loop.d.ts +9 -1
  16. package/dist/agentic/analyst-loop.d.ts.map +1 -1
  17. package/dist/agentic/analyst-loop.js +204 -4
  18. package/dist/agentic/analyst-loop.js.map +1 -1
  19. package/dist/agentic/assumptions.d.ts +1 -1
  20. package/dist/agentic/assumptions.d.ts.map +1 -1
  21. package/dist/agentic/assumptions.js.map +1 -1
  22. package/dist/agentic/ledger-tools.d.ts.map +1 -1
  23. package/dist/agentic/ledger-tools.js +8 -1
  24. package/dist/agentic/ledger-tools.js.map +1 -1
  25. package/dist/agentic/orchestrator-policy.d.ts +3 -1
  26. package/dist/agentic/orchestrator-policy.d.ts.map +1 -1
  27. package/dist/agentic/orchestrator-policy.js +1 -1
  28. package/dist/agentic/orchestrator-policy.js.map +1 -1
  29. package/dist/agentic/research-agent.d.ts.map +1 -1
  30. package/dist/agentic/research-agent.js +10 -1
  31. package/dist/agentic/research-agent.js.map +1 -1
  32. package/dist/agentic/sql-authorization.d.ts +8 -0
  33. package/dist/agentic/sql-authorization.d.ts.map +1 -1
  34. package/dist/agentic/sql-authorization.js +3 -0
  35. package/dist/agentic/sql-authorization.js.map +1 -1
  36. package/dist/agentic/tool-loop.d.ts +13 -1
  37. package/dist/agentic/tool-loop.d.ts.map +1 -1
  38. package/dist/agentic/tool-loop.js +441 -32
  39. package/dist/agentic/tool-loop.js.map +1 -1
  40. package/dist/analytical-compatibility.d.ts.map +1 -1
  41. package/dist/analytical-compatibility.js +8 -1
  42. package/dist/analytical-compatibility.js.map +1 -1
  43. package/dist/analytical-failure-repair.d.ts.map +1 -1
  44. package/dist/analytical-failure-repair.js +6 -2
  45. package/dist/analytical-failure-repair.js.map +1 -1
  46. package/dist/analytical-frame.d.ts +42 -1
  47. package/dist/analytical-frame.d.ts.map +1 -1
  48. package/dist/analytical-frame.js +490 -26
  49. package/dist/analytical-frame.js.map +1 -1
  50. package/dist/analytical-orchestration.d.ts +1259 -9
  51. package/dist/analytical-orchestration.d.ts.map +1 -1
  52. package/dist/analytical-orchestration.js +970 -84
  53. package/dist/analytical-orchestration.js.map +1 -1
  54. package/dist/answer-loop.d.ts +230 -10
  55. package/dist/answer-loop.d.ts.map +1 -1
  56. package/dist/answer-loop.js +1182 -85
  57. package/dist/answer-loop.js.map +1 -1
  58. package/dist/answer-shape.d.ts +27 -0
  59. package/dist/answer-shape.d.ts.map +1 -1
  60. package/dist/answer-shape.js +55 -0
  61. package/dist/answer-shape.js.map +1 -1
  62. package/dist/ask-observability/index.d.ts +11 -0
  63. package/dist/ask-observability/index.d.ts.map +1 -0
  64. package/dist/ask-observability/index.js +7 -0
  65. package/dist/ask-observability/index.js.map +1 -0
  66. package/dist/ask-observability/instrumentation.d.ts +35 -0
  67. package/dist/ask-observability/instrumentation.d.ts.map +1 -0
  68. package/dist/ask-observability/instrumentation.js +523 -0
  69. package/dist/ask-observability/instrumentation.js.map +1 -0
  70. package/dist/ask-observability/observer.d.ts +62 -0
  71. package/dist/ask-observability/observer.d.ts.map +1 -0
  72. package/dist/ask-observability/observer.js +537 -0
  73. package/dist/ask-observability/observer.js.map +1 -0
  74. package/dist/ask-observability/portable.d.ts +98 -0
  75. package/dist/ask-observability/portable.d.ts.map +1 -0
  76. package/dist/ask-observability/portable.js +1089 -0
  77. package/dist/ask-observability/portable.js.map +1 -0
  78. package/dist/ask-observability/store.d.ts +130 -0
  79. package/dist/ask-observability/store.d.ts.map +1 -0
  80. package/dist/ask-observability/store.js +1114 -0
  81. package/dist/ask-observability/store.js.map +1 -0
  82. package/dist/ask-observability/types.d.ts +380 -0
  83. package/dist/ask-observability/types.d.ts.map +1 -0
  84. package/dist/ask-observability/types.js +2 -0
  85. package/dist/ask-observability/types.js.map +1 -0
  86. package/dist/ask-observability/utils.d.ts +21 -0
  87. package/dist/ask-observability/utils.d.ts.map +1 -0
  88. package/dist/ask-observability/utils.js +102 -0
  89. package/dist/ask-observability/utils.js.map +1 -0
  90. package/dist/ask-runtime/ask-agent-runtime-v2.d.ts +850 -0
  91. package/dist/ask-runtime/ask-agent-runtime-v2.d.ts.map +1 -0
  92. package/dist/ask-runtime/ask-agent-runtime-v2.js +1716 -0
  93. package/dist/ask-runtime/ask-agent-runtime-v2.js.map +1 -0
  94. package/dist/ask-runtime/ask-analyst-runtime.d.ts +95 -0
  95. package/dist/ask-runtime/ask-analyst-runtime.d.ts.map +1 -0
  96. package/dist/ask-runtime/ask-analyst-runtime.js +8280 -0
  97. package/dist/ask-runtime/ask-analyst-runtime.js.map +1 -0
  98. package/dist/conversation/session-store.d.ts +31 -0
  99. package/dist/conversation/session-store.d.ts.map +1 -1
  100. package/dist/conversation/session-store.js +38 -0
  101. package/dist/conversation/session-store.js.map +1 -1
  102. package/dist/conversation/snapshot.d.ts +4 -1
  103. package/dist/conversation/snapshot.d.ts.map +1 -1
  104. package/dist/conversation/snapshot.js +85 -3
  105. package/dist/conversation/snapshot.js.map +1 -1
  106. package/dist/conversation/turn-trust.d.ts.map +1 -1
  107. package/dist/conversation/turn-trust.js +2 -0
  108. package/dist/conversation/turn-trust.js.map +1 -1
  109. package/dist/embeddings/provider.d.ts +1 -0
  110. package/dist/embeddings/provider.d.ts.map +1 -1
  111. package/dist/embeddings/provider.js +18 -0
  112. package/dist/embeddings/provider.js.map +1 -1
  113. package/dist/generated-analytical-proposal.d.ts +37 -1
  114. package/dist/generated-analytical-proposal.d.ts.map +1 -1
  115. package/dist/generated-analytical-proposal.js +246 -3
  116. package/dist/generated-analytical-proposal.js.map +1 -1
  117. package/dist/governed-relational-compiler.d.ts +15 -0
  118. package/dist/governed-relational-compiler.d.ts.map +1 -1
  119. package/dist/governed-relational-compiler.js +99 -1
  120. package/dist/governed-relational-compiler.js.map +1 -1
  121. package/dist/index.d.ts +21 -12
  122. package/dist/index.d.ts.map +1 -1
  123. package/dist/index.js +14 -7
  124. package/dist/index.js.map +1 -1
  125. package/dist/intent-controller.d.ts +87 -1
  126. package/dist/intent-controller.d.ts.map +1 -1
  127. package/dist/intent-controller.js +2 -2
  128. package/dist/intent-controller.js.map +1 -1
  129. package/dist/kg/build.js +32 -2
  130. package/dist/kg/build.js.map +1 -1
  131. package/dist/meaning-resolution.d.ts +207 -6
  132. package/dist/meaning-resolution.d.ts.map +1 -1
  133. package/dist/meaning-resolution.js +439 -53
  134. package/dist/meaning-resolution.js.map +1 -1
  135. package/dist/metadata/analysis-planner.d.ts.map +1 -1
  136. package/dist/metadata/analysis-planner.js +78 -7
  137. package/dist/metadata/analysis-planner.js.map +1 -1
  138. package/dist/metadata/catalog.d.ts +14 -0
  139. package/dist/metadata/catalog.d.ts.map +1 -1
  140. package/dist/metadata/catalog.js +29 -2
  141. package/dist/metadata/catalog.js.map +1 -1
  142. package/dist/metadata/meaning-evidence.d.ts +28 -2
  143. package/dist/metadata/meaning-evidence.d.ts.map +1 -1
  144. package/dist/metadata/meaning-evidence.js +373 -16
  145. package/dist/metadata/meaning-evidence.js.map +1 -1
  146. package/dist/plan-execution-adapter.d.ts +9 -1
  147. package/dist/plan-execution-adapter.d.ts.map +1 -1
  148. package/dist/plan-execution-adapter.js +93 -13
  149. package/dist/plan-execution-adapter.js.map +1 -1
  150. package/dist/provider-egress.d.ts +28 -11
  151. package/dist/provider-egress.d.ts.map +1 -1
  152. package/dist/provider-egress.js +72 -22
  153. package/dist/provider-egress.js.map +1 -1
  154. package/dist/providers/claude.d.ts +2 -2
  155. package/dist/providers/claude.d.ts.map +1 -1
  156. package/dist/providers/claude.js +201 -37
  157. package/dist/providers/claude.js.map +1 -1
  158. package/dist/providers/dispatch.d.ts +27 -1
  159. package/dist/providers/dispatch.d.ts.map +1 -1
  160. package/dist/providers/dispatch.js +63 -1
  161. package/dist/providers/dispatch.js.map +1 -1
  162. package/dist/providers/gemini.js +10 -10
  163. package/dist/providers/gemini.js.map +1 -1
  164. package/dist/providers/index.d.ts +2 -2
  165. package/dist/providers/index.d.ts.map +1 -1
  166. package/dist/providers/index.js +1 -1
  167. package/dist/providers/index.js.map +1 -1
  168. package/dist/providers/ollama.js +15 -15
  169. package/dist/providers/ollama.js.map +1 -1
  170. package/dist/providers/openai.d.ts +2 -2
  171. package/dist/providers/openai.d.ts.map +1 -1
  172. package/dist/providers/openai.js +213 -43
  173. package/dist/providers/openai.js.map +1 -1
  174. package/dist/providers/types.d.ts +131 -1
  175. package/dist/providers/types.d.ts.map +1 -1
  176. package/dist/providers/types.js.map +1 -1
  177. package/dist/relationship-proof.d.ts +81 -0
  178. package/dist/relationship-proof.d.ts.map +1 -1
  179. package/dist/relationship-proof.js +228 -4
  180. package/dist/relationship-proof.js.map +1 -1
  181. package/dist/requirement-clauses.d.ts +23 -0
  182. package/dist/requirement-clauses.d.ts.map +1 -0
  183. package/dist/requirement-clauses.js +70 -0
  184. package/dist/requirement-clauses.js.map +1 -0
  185. package/dist/resolved-analytical-plan.d.ts +18 -4
  186. package/dist/resolved-analytical-plan.d.ts.map +1 -1
  187. package/dist/resolved-analytical-plan.js +953 -50
  188. package/dist/resolved-analytical-plan.js.map +1 -1
  189. package/dist/router.d.ts +118 -2
  190. package/dist/router.d.ts.map +1 -1
  191. package/dist/router.js +2481 -232
  192. package/dist/router.js.map +1 -1
  193. package/dist/semantic-bridge/compose.d.ts.map +1 -1
  194. package/dist/semantic-bridge/compose.js +23 -4
  195. package/dist/semantic-bridge/compose.js.map +1 -1
  196. package/package.json +4 -4
@@ -0,0 +1,850 @@
1
+ /**
2
+ * Ask Agent Runtime V2
3
+ *
4
+ * V1 made a deterministic interpretation/coverage check the authority for a
5
+ * natural-language Ask. That is safe, but it is the wrong authority for an
6
+ * open-ended business question: an incomplete certified or semantic candidate
7
+ * is an observation for the agent, not proof that a safe generated route does
8
+ * not exist. V2 keeps the existing execution guards and moves only business
9
+ * interpretation and route progression behind one bounded tool kernel.
10
+ *
11
+ * This module is intentionally host-neutral. The CLI adapts its existing
12
+ * answer-loop, MetricFlow and analyst-loop tools to this contract; no provider
13
+ * payload, SQL, result row, credential, file path, or hidden reasoning is
14
+ * persisted here.
15
+ */
16
+ import type { AgentRouter, AgentRunRequest } from '../agent-run-engine.js';
17
+ import type { EvidenceCandidateRoleV1 } from '../analytical-orchestration.js';
18
+ import type { ResearchEvidenceLedgerV3 } from '../analytical-orchestration.js';
19
+ import type { AgentEvidenceCandidate, AgentRetrievalEvidence } from '../meaning-resolution.js';
20
+ /** Explicit operator rollout control. Browser/MCP request bodies never set it. */
21
+ export type AskRuntimeModeV2 = 'legacy_v1' | 'shadow_v2' | 'authoritative_v2';
22
+ /** V2 has one turn owner; classification is an LLM/tool-runtime responsibility. */
23
+ export type AskTurnClassV2 = 'analytics' | 'definition' | 'business_context' | 'prior_result' | 'general' | 'clarification_response' | 'research';
24
+ export type AskToolNameV2 = 'inspect_ask_context' | 'inspect_conversation_result' | 'inspect_business_context' | 'inspect_certified_candidates' | 'run_certified' | 'inspect_semantic_candidates' | 'compile_and_run_semantic' | 'inspect_relational_context' | 'compile_and_run_dql' | 'validate_and_run_sql' | 'search_values' | 'request_clarification' | 'finish_answer';
25
+ export declare const ASK_V2_CANONICAL_TOOLS: readonly AskToolNameV2[];
26
+ /** Opaque proof that a candidate belongs to this immutable retrieval snapshot. */
27
+ export interface AskEvidenceHandleV1 {
28
+ version: 1;
29
+ id: string;
30
+ role: EvidenceCandidateRoleV1;
31
+ source: 'certified' | 'semantic' | 'governed_relational' | 'dbt_manifest' | 'runtime_schema' | 'vector' | 'conversation' | 'business';
32
+ snapshotId?: string;
33
+ }
34
+ /**
35
+ * A relationship path is atomic evidence. A planner may select a handle, but
36
+ * it must never splice together edges from separate paths or mint a new join
37
+ * from their display names. The host keeps the physical edge payload in its
38
+ * request-scoped workspace; this persisted projection deliberately contains
39
+ * identities only.
40
+ */
41
+ export interface AskRelationshipPathHandleV1 {
42
+ version: 1;
43
+ id: string;
44
+ edgeIds: string[];
45
+ /**
46
+ * Snapshot-qualified relation/column cards covered by this exact path. The
47
+ * model may choose the path handle, but it cannot splice a new join from
48
+ * labels or cards that were not admitted with the path.
49
+ */
50
+ candidateIds?: string[];
51
+ snapshotId?: string;
52
+ }
53
+ /**
54
+ * A certified artifact is captured while the retrieval lease is current. The
55
+ * executable payload stays server-only, but its revision proof is part of the
56
+ * request-scoped capability and is checked again immediately before freeze.
57
+ * It deliberately has no JSON representation.
58
+ */
59
+ export interface AskCertifiedArtifactHandleV1 {
60
+ version: 1;
61
+ artifact: unknown;
62
+ revisionFingerprint: string;
63
+ /** Host-owned recheck against the same local project/snapshot. */
64
+ isCurrent(): boolean;
65
+ }
66
+ /**
67
+ * Canonical semantic compiler identifiers which an Ask V2 host may advertise
68
+ * for one immutable semantic capability. These are deliberately adapter
69
+ * identifiers, not candidate IDs, display labels, MetricFlow field names, or
70
+ * provider-authored aliases.
71
+ */
72
+ export type AskSemanticEngineV1 = 'native' | 'metricflow-cli' | 'dbt-cloud';
73
+ /**
74
+ * Redacted, host-owned semantic runtime selection for one immutable Ask
75
+ * workspace. The controller never chooses this value: it is resolved from
76
+ * the project's configured preference and target-bound adapter readiness
77
+ * before a semantic capability is offered as executable.
78
+ *
79
+ * `selectedEngine` is optional for backwards-readable receipts/workspaces
80
+ * created before this additive contract. New hosts set it only when the
81
+ * selected project runtime is actually available for the candidate.
82
+ */
83
+ export interface AskSemanticRuntimeSelectionV1 {
84
+ version: 1;
85
+ preference: 'auto' | AskSemanticEngineV1;
86
+ selectedEngine?: AskSemanticEngineV1;
87
+ readiness: 'ready' | 'unavailable';
88
+ }
89
+ /**
90
+ * Host-captured semantic capability. The provider sees the opaque candidate
91
+ * ID and safe card only; immediately before compilation the runtime resolves
92
+ * that ID through this immutable mapping to the adapter's authored name.
93
+ */
94
+ export interface AskSemanticCapabilityHandleV1 {
95
+ version: 1;
96
+ candidateId: string;
97
+ runtimeName: string;
98
+ /**
99
+ * Host-observed ready engines for this exact captured capability. This is
100
+ * retained for diagnostics/backwards readers; it is never model-facing
101
+ * routing input.
102
+ */
103
+ engines: readonly AskSemanticEngineV1[];
104
+ /**
105
+ * The one project-selected, target-bound engine for this capability. The
106
+ * V2 compiler uses this server-owned value exclusively. A missing value
107
+ * means semantic execution is unavailable before freeze.
108
+ */
109
+ selectedEngine?: AskSemanticEngineV1;
110
+ roles: Array<'metric' | 'dimension' | 'time_dimension' | 'filter_dimension'>;
111
+ /**
112
+ * Stable fingerprint of the complete compiler-authority projection of the
113
+ * retained candidate. The host and provider both recompute this before an
114
+ * opaque ID is resolved, so two cards with the same ID cannot silently bind
115
+ * different MetricFlow/dbt time, dimension, or model contracts.
116
+ */
117
+ fingerprint: string;
118
+ isCurrent(): boolean;
119
+ }
120
+ /**
121
+ * Server-only execution handle for a Research child whose analytical tuple was
122
+ * already frozen by the root snapshot. It deliberately carries neither SQL
123
+ * nor a provider prompt: the host callback executes the exact pre-authorized
124
+ * certified/semantic capability and returns its own V2 state/receipt. A
125
+ * provider may select only a handle the workspace advertised; it cannot mint
126
+ * one, alter its bindings, or cause a second planning dispatch.
127
+ */
128
+ export interface AskFrozenResearchChildHandleV1 {
129
+ version: 1;
130
+ id: string;
131
+ snapshotId: string;
132
+ sourceFingerprint: string;
133
+ tier: Extract<AskExecutionTierV2, 'certified' | 'semantic'>;
134
+ candidateIds: string[];
135
+ /**
136
+ * The host-frozen execution binding. This is intentionally an opaque,
137
+ * content-free receipt rather than a provider-authored plan: parameters,
138
+ * trust, and the artifact/capability fingerprint were fixed before the root
139
+ * Research planner saw this child ID.
140
+ */
141
+ binding: {
142
+ version: 1;
143
+ parameters: Record<string, string | number | boolean | null>;
144
+ trustState: 'certified' | 'governed';
145
+ planFingerprint: string;
146
+ /** Present for a certified artifact frozen from its captured source. */
147
+ artifactRevisionFingerprint?: string;
148
+ /** Present for one or more immutable semantic compiler capabilities. */
149
+ capabilityFingerprints?: string[];
150
+ };
151
+ /** Re-check captured artifact/capability freshness immediately before use. */
152
+ isCurrent(): boolean;
153
+ /** The active root is supplied by the V2 handler, never captured from a pre-router request. */
154
+ execute(root: AskAgentStateV4): Promise<{
155
+ state: AskAgentStateV4;
156
+ /** AgentAnswer stays in the CLI adapter; this host bridge remains neutral. */
157
+ answer: unknown;
158
+ }>;
159
+ }
160
+ /**
161
+ * The host, not a provider inspection flag, owns whether a tier can already
162
+ * satisfy the full requested tuple. `available` is useful retrieval context;
163
+ * only `complete` blocks a lower-tier execution before a plan is frozen.
164
+ */
165
+ export interface AskTierStateV1 {
166
+ version: 1;
167
+ status: 'complete' | 'available' | 'unavailable' | 'ineligible' | 'ambiguous';
168
+ candidateIds: string[];
169
+ /** Atomic path handles selected for a governed relational execution. */
170
+ relationshipPathIds?: string[];
171
+ reasonCode: string;
172
+ safeNextTools?: AskToolNameV2[];
173
+ /**
174
+ * Host-issued, stable choices for a material ambiguity. A provider may only
175
+ * reference these opaque IDs; it cannot manufacture alternatives or labels.
176
+ * Distinct result fingerprints prove that choosing an option changes the
177
+ * answer rather than merely restating the same business meaning.
178
+ */
179
+ clarificationChoices?: AskClarificationChoiceV1[];
180
+ }
181
+ export interface AskClarificationChoiceV1 {
182
+ version: 1;
183
+ id: string;
184
+ label: string;
185
+ candidateIds: string[];
186
+ resultFingerprint: string;
187
+ }
188
+ /**
189
+ * Ephemeral host bridge between retrieval and the provider/tool adapter.
190
+ *
191
+ * This is intentionally a function-bearing, server-only value: JSON ingress
192
+ * cannot hydrate it, it is never persisted, and the raw context pack remains
193
+ * inside the local runtime. Its stable handle fields allow the adapter to
194
+ * reject a stale pack before it exposes any metadata to a provider.
195
+ */
196
+ export interface AskAgentRuntimeWorkspaceBridgeV2 {
197
+ version: 2;
198
+ snapshotId?: string;
199
+ sourceFingerprint?: string;
200
+ /**
201
+ * Host-owned execution readiness for the captured certified artifacts.
202
+ *
203
+ * Presence in a context pack is never execution authority. The local host
204
+ * supplies this only when it can invoke its snapshot-bound certified
205
+ * executor for this request; omitted bridges fail closed for the engine's
206
+ * zero-provider shortcut. The provider adapter additionally verifies its
207
+ * own execution callback before exposing Tier 1 as complete.
208
+ */
209
+ isCertifiedExecutionAvailable?(): boolean;
210
+ /** Optional so a persisted V4 receipt written before this additive field remains readable. */
211
+ relationshipPathHandles?: AskRelationshipPathHandleV1[];
212
+ getContextPack(): unknown;
213
+ /**
214
+ * Server-only snapshot workspace for the V2 tool adapter. Unlike the
215
+ * context-pack accessor this is an explicit, bounded projection: it carries
216
+ * the exact admitted cards and any immutable executable artifacts captured
217
+ * during retrieval. A tool adapter must never replace it with a KG search.
218
+ */
219
+ getToolWorkspace?(): AskAgentToolWorkspaceV2 | undefined;
220
+ }
221
+ /**
222
+ * Ephemeral, immutable-at-request workspace consumed by canonical V2 tools.
223
+ * The host may retain executable artifacts and physical path facts here, but
224
+ * this value is neither JSON ingress nor a persisted receipt. Provider-facing
225
+ * code must project only safe cards from it.
226
+ */
227
+ export interface AskAgentToolWorkspaceV2 {
228
+ version: 1;
229
+ snapshotId?: string;
230
+ sourceFingerprint?: string;
231
+ /** Up to 128 retained candidates from the one retrieval snapshot. */
232
+ candidates: AgentEvidenceCandidate[];
233
+ /** Atomic relationship paths; raw edges are host-only and never re-searched. */
234
+ relationshipPathHandles: AskRelationshipPathHandleV1[];
235
+ /**
236
+ * Snapshot-captured certified block nodes keyed by candidate identity. The
237
+ * value is deliberately unknown here so the runtime stays host-neutral.
238
+ */
239
+ certifiedArtifacts?: ReadonlyMap<string, AskCertifiedArtifactHandleV1 | unknown>;
240
+ /** Host-only opaque-ID -> compiler-name capability mapping. */
241
+ semanticCapabilities?: ReadonlyMap<string, AskSemanticCapabilityHandleV1>;
242
+ /** Server-selected semantic runtime; safe to receipt, never provider-selected. */
243
+ semanticRuntime?: AskSemanticRuntimeSelectionV1;
244
+ /**
245
+ * Snapshot-declared fiscal binding. It stays server-only so a controller
246
+ * cannot invent a calendar, date role, or fiscal-period field from prose.
247
+ * New workspaces include all three identities when a fiscal question is
248
+ * eligible for semantic execution; old persisted workspaces simply remain
249
+ * unable to satisfy a fiscal invocation.
250
+ */
251
+ fiscalCalendar?: {
252
+ id: string;
253
+ fiscalPeriodFieldId: string;
254
+ dateRoleId?: string;
255
+ };
256
+ /**
257
+ * Canonical semantic candidate IDs that collided while the host captured
258
+ * this retrieval snapshot. A collision is not recoverable by choosing the
259
+ * last card or falling back to a legacy ID: the affected capability is
260
+ * deliberately withheld until a fresh, unambiguous snapshot is available.
261
+ * This remains server-only alongside `semanticCapabilities`.
262
+ */
263
+ semanticCapabilityCollisionIds?: readonly string[];
264
+ /**
265
+ * Candidate identities whose own certified-output contract proved the full
266
+ * requested tuple during this immutable retrieval pass. This is separate
267
+ * from artifact presence: an admitted block can be useful context without
268
+ * being allowed to freeze the certified tier for this question.
269
+ */
270
+ certifiedCompleteCandidateIds?: readonly string[];
271
+ /**
272
+ * Subset of `certifiedCompleteCandidateIds` for which the retrieval snapshot
273
+ * proved a direct certified-question contract: one exact authored example,
274
+ * block title, or approved alias. This remains distinct from tuple
275
+ * completeness and is retained for diagnostics/legacy consumers. An
276
+ * authoritative V2 implicit ranking may alternatively use one uniquely
277
+ * complete snapshot fit, but only with an independently proven immutable
278
+ * primary sort and row-bound execution contract.
279
+ */
280
+ exactCertifiedQuestionCandidateIds?: readonly string[];
281
+ /**
282
+ * Server-owned execution capability for a certified block that has no
283
+ * authored outer SQL LIMIT. When true, the host binds the question-derived
284
+ * overall row limit into the frozen invocation and enforces it at the
285
+ * read-only SQL boundary before result normalisation. This is intentionally
286
+ * not inferred from provider-visible cards or persisted client state.
287
+ */
288
+ certifiedHostEnforcesInvocationRowLimit?: boolean;
289
+ /**
290
+ * Host-computed tuple state for the current request. The provider may
291
+ * inspect this, but cannot upgrade `available` to `complete` or mint a
292
+ * state for an unadmitted candidate.
293
+ */
294
+ tierStates?: Partial<Record<AskExecutionTierV2, AskTierStateV1>>;
295
+ /** Safe, bounded business/context projection for the contextual tools. */
296
+ businessContext?: {
297
+ available: boolean;
298
+ objectCount: number;
299
+ cards?: Array<{
300
+ id: string;
301
+ name: string;
302
+ description?: string;
303
+ kind?: string;
304
+ }>;
305
+ };
306
+ /**
307
+ * Explicit-Research-only, root-frozen structural lineage program. It is a
308
+ * host callback rather than a provider tool: the provider can choose the
309
+ * lineage branch, but cannot select a graph, widen a snapshot, or turn the
310
+ * structural walk into SQL/provider work.
311
+ */
312
+ runDedicatedLineageProgram?: (input: {
313
+ snapshotId?: string;
314
+ targetCandidateIds: string[];
315
+ relationshipPathIds: string[];
316
+ }) => {
317
+ status: 'completed' | 'missing' | 'ambiguous' | 'stale' | 'truncated' | 'unavailable';
318
+ evidenceHandleIds: string[];
319
+ validatorEvidenceHandleIds?: string[];
320
+ counterEvidenceHandleIds?: string[];
321
+ receiptFingerprint?: string;
322
+ };
323
+ /**
324
+ * Optional root-frozen analytical children for explicit Research. They are
325
+ * not a fallback path: each one was separately authorized by the host and
326
+ * must remain on this exact snapshot. A missing/mismatched handle is a
327
+ * typed branch failure, never a reason to rerun retrieval or call a planner.
328
+ */
329
+ frozenResearchChildren?: ReadonlyMap<string, AskFrozenResearchChildHandleV1>;
330
+ }
331
+ /** Host-validated continuity; raw browser rows are never an authority. */
332
+ export interface AskConversationContextV2 {
333
+ version: 2;
334
+ sourceTurnId?: string;
335
+ priorPlanId?: string;
336
+ resultFingerprint?: string;
337
+ selectedMemberId?: string;
338
+ selectedMemberBinding?: string;
339
+ clarificationId?: string;
340
+ availableResultHandleIds: string[];
341
+ /**
342
+ * Members an ambiguous prior-result reference could have meant, when the
343
+ * host found candidates but could not choose between them. The analyst
344
+ * offers these in a clarification instead of guessing; they are display
345
+ * labels the user already saw, never new identity.
346
+ */
347
+ ambiguousMemberLabels?: string[];
348
+ }
349
+ /** Agent proposal is identifiers and an intended next tool only, never SQL/trust. */
350
+ export interface AskCandidatePlanV1 {
351
+ version: 1;
352
+ turnClass: AskTurnClassV2;
353
+ candidateIds: string[];
354
+ intendedTool?: AskToolNameV2;
355
+ requestedExpansion?: boolean;
356
+ requirementFingerprint: string;
357
+ }
358
+ export type AskToolObservationOutcomeV1 = 'eligible' | 'executed' | 'ineligible' | 'unavailable' | 'ambiguous' | 'needs_input' | 'denied' | 'error';
359
+ /** Redacted, typed outcome supplied back to the same agent after every tool call. */
360
+ export interface AskToolObservationV1 {
361
+ version: 1;
362
+ tool: AskToolNameV2;
363
+ outcome: AskToolObservationOutcomeV1;
364
+ tier?: AskExecutionTierV2;
365
+ reasonCode: string;
366
+ candidateIds: string[];
367
+ /** Atomic selected relationship path handles, when this is a DQL execution. */
368
+ relationshipPathIds?: string[];
369
+ planId?: string;
370
+ frozen?: boolean;
371
+ /**
372
+ * Set only by the local host after it has minted an execution capability
373
+ * (or bound an immutable certified artifact). This is the freeze point:
374
+ * compiler and warehouse failures which follow cannot reopen routing.
375
+ */
376
+ executionAuthorized?: boolean;
377
+ /** The one permitted post-freeze retry, bound to the existing plan. */
378
+ samePlanRepair?: boolean;
379
+ retryable?: boolean;
380
+ safeAction?: string;
381
+ /** Wall-clock duration of the physical tool/host boundary, never prompt text. */
382
+ durationMs?: number;
383
+ /** Content-free correlations for input/output payloads where the host has one. */
384
+ inputFingerprint?: string;
385
+ outputFingerprint?: string;
386
+ /** The component that produced this observation or final incident. */
387
+ origin?: 'retrieval' | 'agent_control' | 'tool' | 'validation' | 'freeze' | 'execution' | 'provider' | 'narration';
388
+ /** Redacted provider classification. Model names, URLs, and responses stay out. */
389
+ provider?: {
390
+ phase: 'preflight' | 'classification' | 'meaning_resolution' | 'planning' | 'generation' | 'repair' | 'narration' | 'agent_control' | 'tool_followup' | 'unknown';
391
+ cause: 'authentication' | 'model_not_found' | 'rate_limited' | 'gateway' | 'network' | 'provider_timeout' | 'run_deadline' | 'admission_denied' | 'dispatch_budget' | 'cancelled' | 'unknown';
392
+ retryable: boolean;
393
+ safeAction: string;
394
+ };
395
+ }
396
+ export type AskExecutionTierV2 = 'certified' | 'semantic' | 'governed_relational' | 'exploratory_sql';
397
+ /** A safe plan becomes immutable only after an execution tool reports executable. */
398
+ export interface ResolvedAnalyticalPlanV3 {
399
+ version: 3;
400
+ id: string;
401
+ snapshotId?: string;
402
+ tier: AskExecutionTierV2;
403
+ candidateIds: string[];
404
+ frozen: boolean;
405
+ reviewRequired: boolean;
406
+ /** Immutable selected targets/bindings, deliberately not raw SQL/DQL. */
407
+ bindingFingerprint?: string;
408
+ /** Bound relationship paths for governed-relational execution. */
409
+ relationshipPathIds?: string[];
410
+ /** Redacted warehouse/connection identity when the host has one. */
411
+ targetFingerprint?: string;
412
+ fingerprint: string;
413
+ }
414
+ /** Every tier interaction is durable even when it did not freeze a plan. */
415
+ export interface AskCascadeTierAttemptV2 {
416
+ version: 2;
417
+ tier: AskExecutionTierV2;
418
+ outcome: AskToolObservationOutcomeV1;
419
+ reasonCode: string;
420
+ candidateIds: string[];
421
+ frozen: boolean;
422
+ durationMs?: number;
423
+ }
424
+ /**
425
+ * Count-only projection of the immutable retrieval workspace. It separates a
426
+ * source that was empty/unavailable from a card that was simply outside the
427
+ * bounded workspace, so a trace never calls a pruned card "not modeled".
428
+ */
429
+ export interface AskContextCoverageV2 {
430
+ version: 2;
431
+ source: AskEvidenceHandleV1['source'];
432
+ status: 'available' | 'empty' | 'stale' | 'unavailable' | 'errored' | 'skipped';
433
+ admittedCandidateCount: number;
434
+ excludedCandidateCount: number;
435
+ reasonCodes: string[];
436
+ }
437
+ /** Typed terminal result of the V2 tool runtime, independent of V1 prose. */
438
+ export type AskAgentTerminalOutcomeKindV2 = 'finish_answer' | 'clarification' | 'gap' | 'provider_failure' | 'execution_failure' | 'denied' | 'budget_exhausted';
439
+ export interface AskAgentTerminalOutcomeV2 {
440
+ version: 2;
441
+ kind: AskAgentTerminalOutcomeKindV2;
442
+ reasonCode: string;
443
+ safeAction?: string;
444
+ origin: NonNullable<AskToolObservationV1['origin']>;
445
+ }
446
+ /**
447
+ * Server-minted proof that an authoritative V2 tool run froze and executed
448
+ * one immutable plan. This is an internal runner-to-host handoff only: it is
449
+ * never accepted from browser/MCP input and it deliberately contains no SQL,
450
+ * result rows, credentials, or provider content.
451
+ */
452
+ export interface AskV2ExecutionReceipt {
453
+ version: 1;
454
+ mode: 'authoritative_v2';
455
+ /**
456
+ * Opaque ID minted by the engine for this one physical run. A receipt with
457
+ * the right-looking plan fields is not sufficient: the engine also checks
458
+ * its process-local attestation before it can suppress the legacy gate.
459
+ */
460
+ capabilityId?: string;
461
+ /** The engine run to which this receipt is bound. */
462
+ runId?: string;
463
+ snapshotId: string;
464
+ sourceFingerprint?: string;
465
+ /** Digest of the server-retained candidate universe, never a provider hint. */
466
+ retainedCandidateFingerprint?: string;
467
+ planId: string;
468
+ planFingerprint?: string;
469
+ tier: AskExecutionTierV2;
470
+ candidateIds: string[];
471
+ /** Fingerprint of the exact canonical execution result returned to the engine. */
472
+ resultFingerprint?: string;
473
+ frozen: true;
474
+ executed: true;
475
+ }
476
+ /**
477
+ * A process-local capability issued by `AgentRunEngine` after immutable
478
+ * retrieval. It is not parsed from HTTP/MCP input and is intentionally useful
479
+ * only to the runner that received this request object. The capability's
480
+ * opaque attestation is kept in a module-private WeakMap below, so copying
481
+ * receipt-shaped JSON cannot make a terminal V2 execution authoritative.
482
+ */
483
+ export interface AskV2ExecutionCapabilityV1 {
484
+ version: 1;
485
+ id: string;
486
+ runId: string;
487
+ snapshotId: string;
488
+ sourceFingerprint?: string;
489
+ retainedCandidateFingerprint: string;
490
+ exactCertifiedCandidateId?: string;
491
+ }
492
+ /**
493
+ * Fingerprint only the snapshot-local facts the semantic compiler can consume.
494
+ * Retrieval rank, descriptions, lane membership, and display prose are
495
+ * deliberately absent: they do not change a compiler authority. Conversely,
496
+ * the full analytical capability stays present, including its model-qualified
497
+ * time dimensions, joins, outputs, and parameter contract. This is used both
498
+ * when the host captures capabilities and when the provider resolves an
499
+ * opaque ID, so exact duplicate cards are safe while divergent duplicates are
500
+ * withheld before compiler execution.
501
+ */
502
+ export declare function askV2SemanticCandidateAuthorityFingerprint(candidate: AgentEvidenceCandidate): string;
503
+ /**
504
+ * Return only the semantic object roles that can be bound directly by a
505
+ * compiler. A semantic model, saved query, and other context/container card
506
+ * may be useful retrieval evidence, but it is never an executable field just
507
+ * because its display/runtime name resembles one. Keep this classification
508
+ * deliberately structural: the V2 host captures a capability only from an
509
+ * exact object type (or the legacy qualified-ID segment where old snapshots
510
+ * omitted that type), never from a trust tier or a fuzzy name.
511
+ */
512
+ export declare function askV2ExecutableSemanticRoles(candidate: AgentEvidenceCandidate): AskSemanticCapabilityHandleV1['roles'] | undefined;
513
+ /** Stable digest of the admitted immutable candidate closure. */
514
+ export declare function askV2RetainedCandidateFingerprint(candidateIds: readonly string[]): string;
515
+ /**
516
+ * Return the canonical execution-result identity without retaining the result
517
+ * in a receipt. Existing connector fingerprints win; the fallback covers
518
+ * host-faithful test/local result envelopes that predate that field.
519
+ */
520
+ export declare function askV2ExecutionResultFingerprint(result: unknown): string | undefined;
521
+ /** Mint one server-owned capability for an authoritative V2 run. */
522
+ export declare function createAskV2ExecutionCapabilityV1(input: {
523
+ id: string;
524
+ runId: string;
525
+ state: AskAgentStateV4;
526
+ }): AskV2ExecutionCapabilityV1 | undefined;
527
+ /**
528
+ * Mint the only receipt accepted by the engine's V2 terminal boundary. This
529
+ * is called after a real tool execution advances the cloned provider state.
530
+ * It rejects pre-freeze, non-executed, stale-snapshot, or mismatched-result
531
+ * states before an attestation is ever registered.
532
+ */
533
+ export declare function mintAskV2ExecutionReceiptV1(input: {
534
+ state: AskAgentStateV4 | undefined;
535
+ capability: AskV2ExecutionCapabilityV1 | undefined;
536
+ result: unknown;
537
+ }): AskV2ExecutionReceipt | undefined;
538
+ /**
539
+ * Verify a live receipt at the engine boundary. A persisted, copied, forged,
540
+ * stale, legacy, or pre-freeze receipt has no WeakMap attestation and cannot
541
+ * skip the generic evaluator.
542
+ */
543
+ export declare function isAskV2ExecutionReceiptAuthorizedV1(input: {
544
+ receipt: AskV2ExecutionReceipt | undefined;
545
+ capability: AskV2ExecutionCapabilityV1 | undefined;
546
+ state: AskAgentStateV4 | undefined;
547
+ result: unknown;
548
+ runId: string;
549
+ }): boolean;
550
+ /** The one durable server-side state record for a V2 Ask. */
551
+ export interface AskAgentStateV4 {
552
+ version: 4;
553
+ mode: AskRuntimeModeV2;
554
+ turnClass: AskTurnClassV2;
555
+ snapshotId?: string;
556
+ sourceFingerprint?: string;
557
+ retainedCandidateIds: string[];
558
+ initialCandidateIds: string[];
559
+ expansionCandidateIds: string[];
560
+ /** Additive count-only source state; V4 readers written before V2 omit it. */
561
+ contextCoverage?: AskContextCoverageV2[];
562
+ /** Bounded-workspace exclusions are never a source-absence claim. */
563
+ excludedCandidateCount?: number;
564
+ exclusionReasonCodes?: string[];
565
+ relationshipPathHandles: AskRelationshipPathHandleV1[];
566
+ conversation: AskConversationContextV2;
567
+ observations: AskToolObservationV1[];
568
+ /**
569
+ * Ephemeral host-owned tier truth carried with the live state. It is
570
+ * additive/optional so receipts produced before V2 remain readable. The
571
+ * durable trace records its outcomes through observations and tier attempts.
572
+ */
573
+ tierStates?: Partial<Record<AskExecutionTierV2, AskTierStateV1>>;
574
+ /** Additive redacted host runtime choice used for semantic V2 execution. */
575
+ semanticRuntime?: AskSemanticRuntimeSelectionV1;
576
+ /** Optional so a persisted V4 receipt written before this additive field remains readable. */
577
+ tierAttempts?: AskCascadeTierAttemptV2[];
578
+ /**
579
+ * Live, pre-freeze controller commitment. An inspection may set this only
580
+ * after the host has proved that the tier has an executable capability in
581
+ * the immutable workspace. It narrows the *next* model turn to that
582
+ * tier's execution tool; it is not a frozen plan and never bypasses the
583
+ * earlier-complete-tier guard.
584
+ */
585
+ controllerTier?: AskExecutionTierV2;
586
+ /**
587
+ * A narrowly-scoped priority exception for an explicit, snapshot-qualified
588
+ * semantic or DQL artifact reference. It is host-derived from an admitted
589
+ * canonical ID; ordinary natural-language relevance never populates it.
590
+ * Keeping this on the state makes a reload repeat the same Tier 1 decision
591
+ * instead of trusting a stale lower-tier controller commitment.
592
+ */
593
+ explicitQualifiedArtifactReference?: {
594
+ version: 1;
595
+ tier: Extract<AskExecutionTierV2, 'semantic' | 'governed_relational'>;
596
+ candidateId: string;
597
+ };
598
+ candidatePlan?: AskCandidatePlanV1;
599
+ /**
600
+ * Host-proven Tier 1 shortcut for an ordinary Ask. This is set only when
601
+ * the immutable retrieval workspace captured one admitted certified
602
+ * artifact whose output contract already proves the complete tuple. It is
603
+ * deliberately an opaque candidate ID rather than a plan or a provider
604
+ * instruction: the host still mints the execution capability and rechecks
605
+ * artifact freshness immediately before execution.
606
+ *
607
+ * Exact certified fits are a contractual zero-provider path. Leaving this
608
+ * fact implicit forced the authoritative V2 agent loop to ask a model to
609
+ * rediscover an already-proven block, which could exhaust the dispatch
610
+ * budget before any Tier 1 execution occurred.
611
+ */
612
+ exactCertifiedCandidateId?: string;
613
+ resolvedPlan?: ResolvedAnalyticalPlanV3;
614
+ /** Actual V2 Research branch receipts; V3 projections remain readable. */
615
+ researchLedgerV4?: ResearchEvidenceLedgerV4;
616
+ terminal?: 'completed' | 'clarification' | 'denied' | 'budget_exhausted' | 'error';
617
+ terminalOutcome?: AskAgentTerminalOutcomeV2;
618
+ }
619
+ /** Egress default for a remote provider; the local provider may use bounded rows. */
620
+ export interface ProviderResultEgressPolicyV2 {
621
+ version: 2;
622
+ transport: 'local' | 'remote';
623
+ maximumRows: number;
624
+ maximumColumns: number;
625
+ maximumCells: number;
626
+ allowRows: boolean;
627
+ allowedKinds: Array<'facts' | 'aggregates' | 'schema' | 'fingerprints' | 'bounded_rows'>;
628
+ }
629
+ /** Provider egress is a host policy, not something the LLM may request. */
630
+ export declare function defaultProviderResultEgressPolicyV2(input: {
631
+ transport: 'local' | 'remote';
632
+ /** Remote rows require an explicit project setting and retain the same cap. */
633
+ allowRemoteRows?: boolean;
634
+ }): ProviderResultEgressPolicyV2;
635
+ /** Additive V8 receipt. Existing V1-V7 readers stay untouched. */
636
+ export interface AgentRunDiagnosticReceiptV8 {
637
+ version: 8;
638
+ mode: AskRuntimeModeV2;
639
+ turnClass: AskTurnClassV2;
640
+ snapshotId?: string;
641
+ retainedCandidateCount: number;
642
+ initialCandidateCount: number;
643
+ expansionCount: number;
644
+ /** Objective is the typed turn class, never the user question or prompt. */
645
+ objective: AskTurnClassV2;
646
+ /** Count-only context story; no names, definitions, values, or raw rows. */
647
+ contextCoverage: AskContextCoverageV2[];
648
+ excludedCandidateCount: number;
649
+ exclusionReasonCodes: string[];
650
+ observations: AskToolObservationV1[];
651
+ tierAttempts: AskCascadeTierAttemptV2[];
652
+ /**
653
+ * Server-owned current controller progression for an unfrozen V2 run.
654
+ * This is deliberately not inferred from the first eligible inspection:
655
+ * an earlier semantic card may already have become unavailable while the
656
+ * controller has advanced to governed relational or exploratory SQL.
657
+ */
658
+ controllerTier?: AskExecutionTierV2;
659
+ /** Redacted host-selected semantic runtime/readiness, never model input. */
660
+ semanticRuntime?: AskSemanticRuntimeSelectionV1;
661
+ planFrozen: boolean;
662
+ terminalOutcome?: AskAgentTerminalOutcomeV2;
663
+ /** Engine-owned final result facts; no result values or narration text. */
664
+ outcome: {
665
+ connectionAttempted: boolean;
666
+ executionAttempts: number;
667
+ factCount: number;
668
+ narration: 'fact_bound' | 'deterministic_fallback' | 'not_retained' | 'not_applicable';
669
+ };
670
+ /**
671
+ * Canonical physical/accounted activity for compact trace projections.
672
+ * Provider dispatches are supplied by the server egress wrapper when it is
673
+ * available; the kernel never infers a physical send from a planner stage.
674
+ */
675
+ activity: {
676
+ providerDispatches: number;
677
+ toolCalls: number;
678
+ executionAttempts: number;
679
+ repairs: number;
680
+ };
681
+ /** Compact timing only; content and raw provider data never enter the receipt. */
682
+ toolDurationMs: number;
683
+ finalStopReason: string;
684
+ }
685
+ /** V4 adds branch/tool facts without reinterpreting V1-V3 research receipts. */
686
+ export interface ResearchEvidenceLedgerV4 {
687
+ version: 4;
688
+ rootQuestionFingerprint: string;
689
+ snapshotId?: string;
690
+ branches: Array<{
691
+ id: string;
692
+ verdict: 'supported' | 'contradicted' | 'inconclusive' | 'failed' | 'skipped';
693
+ evidenceHandleIds: string[];
694
+ /** Evidence that a deterministic result/receipt validator actually checked. */
695
+ validatorEvidenceHandleIds?: string[];
696
+ /** Independent evidence that qualifies a branch; never inferred from rows. */
697
+ counterEvidenceHandleIds?: string[];
698
+ /** Opaque child receipt correlation; no SQL, rows, or provider response. */
699
+ childReceiptFingerprint?: string;
700
+ lineageProgram?: 'dedicated' | 'not_run';
701
+ }>;
702
+ limitedScope: boolean;
703
+ }
704
+ /**
705
+ * An explicit Research controller supplies these only after it has run a
706
+ * branch. A generic tool observation is not a hypothesis and must never be
707
+ * converted into one merely to make an empty ledger look complete.
708
+ */
709
+ export interface AskV2ResearchBranchReceiptInput {
710
+ id: string;
711
+ verdict: ResearchEvidenceLedgerV4['branches'][number]['verdict'];
712
+ evidenceHandleIds: string[];
713
+ validatorEvidenceHandleIds?: string[];
714
+ counterEvidenceHandleIds?: string[];
715
+ childReceiptFingerprint?: string;
716
+ lineageProgram?: 'dedicated' | 'not_run';
717
+ }
718
+ /**
719
+ * Build a V4 ledger from the V2 tool boundary itself. In particular lineage
720
+ * is represented by its own atomic relationship handles; it is never inferred
721
+ * from (or reused as) an analytical result branch.
722
+ */
723
+ export declare function recordAskV2ResearchLedger(state: AskAgentStateV4, branchReceipts?: readonly AskV2ResearchBranchReceiptInput[]): ResearchEvidenceLedgerV4 | undefined;
724
+ /**
725
+ * Project the existing mixed V3 Research ledger into the V2 tool-runtime
726
+ * reader contract. This is deliberately a projection, not a second research
727
+ * planner: it retains opaque receipt/fact identities and the dedicated local
728
+ * lineage marker while excluding question text, SQL, rows, prompts, and
729
+ * provider material.
730
+ */
731
+ export declare function projectResearchEvidenceLedgerV4(ledger: ResearchEvidenceLedgerV3): ResearchEvidenceLedgerV4;
732
+ export declare const ASK_V2_BUDGETS: {
733
+ readonly ask: {
734
+ readonly durationMs: 45000;
735
+ readonly providerDispatches: 6;
736
+ readonly toolCalls: 8;
737
+ readonly expansions: 2;
738
+ readonly executions: 2;
739
+ readonly repairs: 1;
740
+ readonly valueSearches: 1;
741
+ readonly clarifications: 1;
742
+ };
743
+ readonly contextual: {
744
+ readonly durationMs: 15000;
745
+ readonly providerDispatches: 2;
746
+ readonly toolCalls: 4;
747
+ };
748
+ readonly research: {
749
+ readonly durationMs: 120000;
750
+ readonly providerDispatches: 12;
751
+ readonly toolCalls: 24;
752
+ readonly branches: 6;
753
+ readonly repairs: 2;
754
+ };
755
+ };
756
+ export interface AskToolKernelV2 {
757
+ readonly state: AskAgentStateV4;
758
+ observe(observation: AskToolObservationV1): AskToolObservationV1;
759
+ /**
760
+ * Server-owned current tool availability for the next model transport.
761
+ * This constrains repeated discovery after a tier has enough compatible
762
+ * evidence, but never executes a query on the model's behalf.
763
+ */
764
+ toolPolicy(): {
765
+ allowedToolNames: AskToolNameV2[];
766
+ instruction?: string;
767
+ terminalActionToolNames?: AskToolNameV2[];
768
+ };
769
+ canCall(tool: AskToolNameV2, input?: {
770
+ repair?: boolean;
771
+ expansion?: boolean;
772
+ /**
773
+ * Host-only zero-provider shortcut for one uniquely exact, current,
774
+ * executable Tier 1 artifact. This is never part of a model tool schema:
775
+ * callers must still bind the state-owned exact candidate below.
776
+ */
777
+ directExactCertifiedExecution?: boolean;
778
+ /** Snapshot-qualified selected IDs for post-freeze same-plan comparison. */
779
+ candidateIds?: readonly string[];
780
+ relationshipPathIds?: readonly string[];
781
+ /** Stable selected-target/binding proof; never raw program or SQL. */
782
+ bindingFingerprint?: string;
783
+ }): {
784
+ ok: boolean;
785
+ reasonCode?: string;
786
+ safeNextTools?: AskToolNameV2[];
787
+ };
788
+ diagnosticReceipt(finalStopReason?: string, outcome?: AgentRunDiagnosticReceiptV8['outcome'], activity?: Partial<AgentRunDiagnosticReceiptV8['activity']>): AgentRunDiagnosticReceiptV8;
789
+ }
790
+ /**
791
+ * Tool-kernel safety is deliberately deterministic: it does not decide business
792
+ * meaning, but it prevents a model from skipping a complete earlier tier,
793
+ * widening a snapshot, recursively asking itself, or retrying indefinitely.
794
+ */
795
+ export declare function createAskToolKernelV2(state: AskAgentStateV4): AskToolKernelV2;
796
+ /** Record a live host/tool observation against the shared V2 kernel. */
797
+ export declare function observeAskAgentV2Tool(state: AskAgentStateV4 | undefined, observation: AskToolObservationV1): AskToolObservationV1 | undefined;
798
+ /** Record the host's tuple-completeness verdict without treating cards as SQL authority. */
799
+ export declare function setAskV2TierState(state: AskAgentStateV4 | undefined, tier: AskExecutionTierV2, next: Omit<AskTierStateV1, 'version'>): AskTierStateV1 | undefined;
800
+ /** Seal a V2 terminal without converting it into a legacy business verdict. */
801
+ export declare function finishAskAgentV2Turn(state: AskAgentStateV4 | undefined, outcome: AskAgentTerminalOutcomeV2): void;
802
+ /** A stale bridge must never become a second retrieval or a prompt source. */
803
+ export declare function askAgentV2WorkspaceMatches(state: AskAgentStateV4 | undefined, bridge: AskAgentRuntimeWorkspaceBridgeV2 | undefined): boolean;
804
+ /**
805
+ * Materialize Tier 1 tuple completeness from the immutable server workspace
806
+ * before the first V2 tool policy is calculated. The old fast-path-only
807
+ * behavior exposed this truth only when there was one certified candidate,
808
+ * allowing a semantic inspector to commit a lower tier while two complete
809
+ * certified artifacts were present. The workspace is the authority here;
810
+ * provider cards and persisted controller state never create completeness.
811
+ *
812
+ * `certifiedExecutionAvailable` is deliberately host-provided rather than
813
+ * inferred from an artifact card. A complete fit with no authorized local
814
+ * executor is a pre-freeze unavailable observation, not a Tier 1 priority
815
+ * trap. The provider adapter passes its actual execution callback; the engine
816
+ * uses the bridge's host readiness hook for the zero-provider shortcut.
817
+ */
818
+ export declare function materializeAskV2WorkspaceTierTruth(state: AskAgentStateV4 | undefined, bridge: AskAgentRuntimeWorkspaceBridgeV2 | undefined, reference?: {
819
+ question?: string;
820
+ selectedEvidenceId?: string;
821
+ certifiedExecutionAvailable?: boolean;
822
+ }): AskAgentToolWorkspaceV2 | undefined;
823
+ export interface AskAgentRuntimeV2 extends AgentRouter {
824
+ readonly mode: AskRuntimeModeV2;
825
+ }
826
+ export interface AskAgentRuntimeOptionsV2 {
827
+ mode?: AskRuntimeModeV2;
828
+ /** The sole V2 retrieval boundary for an ordinary natural-language turn. */
829
+ getEvidence?: (request: AgentRunRequest) => AgentRetrievalEvidence | undefined | Promise<AgentRetrievalEvidence | undefined>;
830
+ /** Explicit V1 rollback / shadow comparison only; V2 never uses it after serving. */
831
+ legacyRouter: AgentRouter;
832
+ }
833
+ /**
834
+ * Retrieval-first V2 ingress. It deliberately does not prove a business
835
+ * tuple or choose a compiler. That choice is made by the bounded provider
836
+ * tool runtime after it sees the immutable candidate workspace.
837
+ */
838
+ export declare function createAskAgentRuntimeV2(options: AskAgentRuntimeOptionsV2): AskAgentRuntimeV2;
839
+ /**
840
+ * Release a certified tier claim that turned out to be unprovable in flight.
841
+ *
842
+ * The fast path narrows the tool policy to `run_certified` and nothing else.
843
+ * When the downstream admission/proof then refuses that one tool, the policy
844
+ * used to have no exit: the turn looped run_certified → denied → finish
845
+ * denied until the deadline, and the user saw a fabricated "validation"
846
+ * message. The bridge now avoids taking an unprovable claim at all; this
847
+ * release is the in-flight defense for anything the bridge could not know.
848
+ */
849
+ export declare function releaseAskV2CertifiedTierLock(state: AskAgentStateV4, reasonCode: string): void;
850
+ //# sourceMappingURL=ask-agent-runtime-v2.d.ts.map