@duckcodeailabs/dql-cli 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 (147) hide show
  1. package/dist/args.d.ts +6 -0
  2. package/dist/args.d.ts.map +1 -1
  3. package/dist/args.js +28 -0
  4. package/dist/args.js.map +1 -1
  5. package/dist/ask-runtime/analytical-planner.d.ts +14 -0
  6. package/dist/ask-runtime/analytical-planner.d.ts.map +1 -0
  7. package/dist/ask-runtime/analytical-planner.js +197 -0
  8. package/dist/ask-runtime/analytical-planner.js.map +1 -0
  9. package/dist/ask-runtime/readiness.d.ts +36 -0
  10. package/dist/ask-runtime/readiness.d.ts.map +1 -0
  11. package/dist/ask-runtime/readiness.js +65 -0
  12. package/dist/ask-runtime/readiness.js.map +1 -0
  13. package/dist/assets/dql-notebook/assets/{AgentLogPage-DKbGpRQS.js → AgentLogPage-XonDlOVv.js} +1 -1
  14. package/dist/assets/dql-notebook/assets/{AiBuildDialog-DPSu0Mly.js → AiBuildDialog-DwHVVFIS.js} +1 -1
  15. package/dist/assets/dql-notebook/assets/{AiBuildResult-1uaGnpi1.js → AiBuildResult-BImB4Wej.js} +1 -1
  16. package/dist/assets/dql-notebook/assets/{AiSidePanel-BwMREwa7.js → AiSidePanel-D7fFBhgc.js} +1 -1
  17. package/dist/assets/dql-notebook/assets/AnalyticsHome-CHvGWG92.js +6 -0
  18. package/dist/assets/dql-notebook/assets/{AppsView-CM1tPywy.js → AppsView-DNhs0MyO.js} +30 -35
  19. package/dist/assets/dql-notebook/assets/AskObservabilityPage-1WYjAf8-.js +1 -0
  20. package/dist/assets/dql-notebook/assets/AskTracePage-D6_RunIf.js +8 -0
  21. package/dist/assets/dql-notebook/assets/{BlockStudio--S6WFVO4.js → BlockStudio-DWMOCHy5.js} +9 -14
  22. package/dist/assets/dql-notebook/assets/BusinessArtifactView-guqlfQ0j.js +1 -0
  23. package/dist/assets/dql-notebook/assets/{DbtFirstModelingPage-CNyU5MBX.js → DbtFirstModelingPage-DE7ewjMK.js} +3 -3
  24. package/dist/assets/dql-notebook/assets/{GitPage-IcydAai3.js → GitPage-CM3cgHtf.js} +1 -1
  25. package/dist/assets/dql-notebook/assets/{GlobalAiRail-CSKW-5eD.js → GlobalAiRail-BWfeK8lb.js} +1 -1
  26. package/dist/assets/dql-notebook/assets/{GovernedContextPage-CFen0eFT.js → GovernedContextPage-2Ld4yIgE.js} +3 -3
  27. package/dist/assets/dql-notebook/assets/{HelpDocsPage-D0D9UCIz.js → HelpDocsPage-BxBzoxBO.js} +1 -1
  28. package/dist/assets/dql-notebook/assets/{HomePage-CmSxapR3.js → HomePage-D4ZjCFfB.js} +1 -1
  29. package/dist/assets/dql-notebook/assets/LineageDAG-DLdogZMo.js +1 -0
  30. package/dist/assets/dql-notebook/assets/LineageDetailView-CqPB_tFP.js +1 -0
  31. package/dist/assets/dql-notebook/assets/LineageDrawer-LZyR3zHf.js +1 -0
  32. package/dist/assets/dql-notebook/assets/{LineagePathBreadcrumb-CTZJp4_r.js → LineagePathBreadcrumb-BZ7EcIxp.js} +1 -1
  33. package/dist/assets/dql-notebook/assets/MiniLineageGraph-Be_kqIq2.js +1 -0
  34. package/dist/assets/dql-notebook/assets/{NewBlockModal-DMBFB7nE.js → NewBlockModal-C9MKCa6R.js} +1 -1
  35. package/dist/assets/dql-notebook/assets/{NewNotebookModal-DsC9CWlW.js → NewNotebookModal-ZxHbTU9u.js} +1 -1
  36. package/dist/assets/dql-notebook/assets/{NotebookEditor-hs-kw8v9.js → NotebookEditor-Bh39Vsg0.js} +25 -30
  37. package/dist/assets/dql-notebook/assets/{ReadinessPage-DJ83cMik.js → ReadinessPage-jKOBKkED.js} +1 -1
  38. package/dist/assets/dql-notebook/assets/{SetupOnboarding-B1Pu_Bvv.js → SetupOnboarding-BRut9nLO.js} +1 -1
  39. package/dist/assets/dql-notebook/assets/{SkillsPage-BHKDay8n.js → SkillsPage-D9msUOxY.js} +1 -1
  40. package/dist/assets/dql-notebook/assets/{TrustBadge-BkyGgob2.js → TrustBadge-D1CGSj0Y.js} +1 -1
  41. package/dist/assets/dql-notebook/assets/UnifiedAgentRunPanel-BexNjqJd.js +88 -0
  42. package/dist/assets/dql-notebook/assets/{answer-to-notebook-DmNiuLQA.js → answer-to-notebook-zHFOdR6E.js} +1 -1
  43. package/dist/assets/dql-notebook/assets/{arrow-left--1rsrxm8.js → arrow-left-C1tZBhgf.js} +1 -1
  44. package/dist/assets/dql-notebook/assets/{arrow-right-D5TdqY1G.js → arrow-right-BP5vPPNo.js} +1 -1
  45. package/dist/assets/dql-notebook/assets/{book-open-text-Bw7nHbzg.js → book-open-text-BD3-ATYI.js} +1 -1
  46. package/dist/assets/dql-notebook/assets/chevron-left-3opVgscY.js +6 -0
  47. package/dist/assets/dql-notebook/assets/{circle-x-DLe6NNM4.js → circle-x-Bg9-70KN.js} +1 -1
  48. package/dist/assets/dql-notebook/assets/clock-3-DLV5puGW.js +6 -0
  49. package/dist/assets/dql-notebook/assets/dagre.esm-B6nvU4OB.js +1 -0
  50. package/dist/assets/dql-notebook/assets/{external-link-C9Q97sA3.js → external-link-BjD8w9QU.js} +1 -1
  51. package/dist/assets/dql-notebook/assets/{grip-vertical-CztvkIgo.js → grip-vertical-DqIc09oX.js} +1 -1
  52. package/dist/assets/dql-notebook/assets/index-B_kaoARS.css +1 -0
  53. package/dist/assets/dql-notebook/assets/{index-zHHzDn6l.js → index-C9KfoqCR.js} +133 -128
  54. package/dist/assets/dql-notebook/assets/{link-2-CiKAvumL.js → link-2-5s0hUu6w.js} +1 -1
  55. package/dist/assets/dql-notebook/assets/{list-tree-BtnP2nQ5.js → list-tree-67yz_uCY.js} +1 -1
  56. package/dist/assets/dql-notebook/assets/{minimize-2-TSFGxcCP.js → minimize-2-BJw5tlPC.js} +1 -1
  57. package/dist/assets/dql-notebook/assets/{panel-right-open-BfXIUWy0.js → panel-right-open-CyhTG-tw.js} +1 -1
  58. package/dist/assets/dql-notebook/assets/{play-DVbSFJHD.js → play-CsY8D5M2.js} +1 -1
  59. package/dist/assets/dql-notebook/assets/{rotate-ccw-D_cesDcX.js → rotate-ccw-RvwtBcw9.js} +1 -1
  60. package/dist/assets/dql-notebook/assets/{semantic-fields-CoVStdYB.js → semantic-fields-EorgHwAj.js} +1 -1
  61. package/dist/assets/dql-notebook/assets/{sliders-horizontal-l7xV9K5A.js → sliders-horizontal-jQ_fUiYf.js} +1 -1
  62. package/dist/assets/dql-notebook/assets/{star-CSBS0H3b.js → star-N_C8YvbB.js} +1 -1
  63. package/dist/assets/dql-notebook/assets/style-D6AlWDHX.js +23 -0
  64. package/dist/assets/dql-notebook/assets/{triangle-alert-BTrnyY4q.js → triangle-alert-D1WefIrN.js} +1 -1
  65. package/dist/assets/dql-notebook/assets/{upload-sySLq9zb.js → upload-CFJjpPL4.js} +1 -1
  66. package/dist/assets/dql-notebook/assets/{usePersistedAgentThreadId-CzwgGdus.js → usePersistedAgentThreadId-B5pTglEr.js} +1 -1
  67. package/dist/assets/dql-notebook/assets/{user-round-ChlgXi9j.js → user-round-DL6DLw0m.js} +1 -1
  68. package/dist/assets/dql-notebook/assets/{wand-sparkles-CGw0ytyT.js → wand-sparkles-CNUjLDqT.js} +1 -1
  69. package/dist/assets/dql-notebook/assets/{workflow-C_RltiK5.js → workflow-0NUwpoQ4.js} +1 -1
  70. package/dist/assets/dql-notebook/assets/{wrench-D-wLfeu0.js → wrench-QNiznShi.js} +1 -1
  71. package/dist/assets/dql-notebook/assets/{x-B28hIJIC.js → x-BhTl5gZs.js} +1 -1
  72. package/dist/assets/dql-notebook/index.html +2 -2
  73. package/dist/commands/agent-eval-cassette.d.ts.map +1 -1
  74. package/dist/commands/agent-eval-cassette.js +15 -0
  75. package/dist/commands/agent-eval-cassette.js.map +1 -1
  76. package/dist/commands/agent-eval-runtime.d.ts +9 -0
  77. package/dist/commands/agent-eval-runtime.d.ts.map +1 -1
  78. package/dist/commands/agent-eval-runtime.js +7 -0
  79. package/dist/commands/agent-eval-runtime.js.map +1 -1
  80. package/dist/commands/agent-shadow-report.d.ts +17 -0
  81. package/dist/commands/agent-shadow-report.d.ts.map +1 -0
  82. package/dist/commands/agent-shadow-report.js +149 -0
  83. package/dist/commands/agent-shadow-report.js.map +1 -0
  84. package/dist/commands/agent-trace.d.ts +3 -0
  85. package/dist/commands/agent-trace.d.ts.map +1 -0
  86. package/dist/commands/agent-trace.js +169 -0
  87. package/dist/commands/agent-trace.js.map +1 -0
  88. package/dist/commands/agent.d.ts +28 -2
  89. package/dist/commands/agent.d.ts.map +1 -1
  90. package/dist/commands/agent.js +413 -36
  91. package/dist/commands/agent.js.map +1 -1
  92. package/dist/commands/notebook.d.ts +4 -1
  93. package/dist/commands/notebook.d.ts.map +1 -1
  94. package/dist/commands/notebook.js +12 -1
  95. package/dist/commands/notebook.js.map +1 -1
  96. package/dist/index.js +5 -0
  97. package/dist/index.js.map +1 -1
  98. package/dist/llm/providers/ask-v2-analyst-prompt.d.ts +32 -0
  99. package/dist/llm/providers/ask-v2-analyst-prompt.d.ts.map +1 -0
  100. package/dist/llm/providers/ask-v2-analyst-prompt.js +136 -0
  101. package/dist/llm/providers/ask-v2-analyst-prompt.js.map +1 -0
  102. package/dist/llm/providers/dql-agent-provider.d.ts +78 -2
  103. package/dist/llm/providers/dql-agent-provider.d.ts.map +1 -1
  104. package/dist/llm/providers/dql-agent-provider.js +5438 -330
  105. package/dist/llm/providers/dql-agent-provider.js.map +1 -1
  106. package/dist/llm/types.d.ts +144 -3
  107. package/dist/llm/types.d.ts.map +1 -1
  108. package/dist/local-runtime.d.ts +607 -35
  109. package/dist/local-runtime.d.ts.map +1 -1
  110. package/dist/local-runtime.js +7734 -702
  111. package/dist/local-runtime.js.map +1 -1
  112. package/dist/metricflow.d.ts.map +1 -1
  113. package/dist/metricflow.js +80 -11
  114. package/dist/metricflow.js.map +1 -1
  115. package/dist/package.json +10 -10
  116. package/dist/providers/oauth/claude-oauth.d.ts +14 -0
  117. package/dist/providers/oauth/claude-oauth.d.ts.map +1 -1
  118. package/dist/providers/oauth/claude-oauth.js +84 -23
  119. package/dist/providers/oauth/claude-oauth.js.map +1 -1
  120. package/dist/providers/oauth/codex-oauth.d.ts.map +1 -1
  121. package/dist/providers/oauth/codex-oauth.js +72 -44
  122. package/dist/providers/oauth/codex-oauth.js.map +1 -1
  123. package/dist/providers/subscription-cli.d.ts +20 -0
  124. package/dist/providers/subscription-cli.d.ts.map +1 -1
  125. package/dist/providers/subscription-cli.js +69 -11
  126. package/dist/providers/subscription-cli.js.map +1 -1
  127. package/dist/research-lineage-program.d.ts +29 -0
  128. package/dist/research-lineage-program.d.ts.map +1 -0
  129. package/dist/research-lineage-program.js +389 -0
  130. package/dist/research-lineage-program.js.map +1 -0
  131. package/dist/retrieval-health.d.ts.map +1 -1
  132. package/dist/retrieval-health.js +5 -2
  133. package/dist/retrieval-health.js.map +1 -1
  134. package/dist/semantic-runtime.d.ts.map +1 -1
  135. package/dist/semantic-runtime.js +73 -2
  136. package/dist/semantic-runtime.js.map +1 -1
  137. package/package.json +10 -10
  138. package/dist/assets/dql-notebook/assets/AnalyticsHome-BGfey_ve.js +0 -6
  139. package/dist/assets/dql-notebook/assets/BusinessArtifactView-BEAJ-yNW.js +0 -1
  140. package/dist/assets/dql-notebook/assets/LineageDAG-BGUcIt1B.js +0 -1
  141. package/dist/assets/dql-notebook/assets/LineageDetailView-Dx48Zfzb.js +0 -1
  142. package/dist/assets/dql-notebook/assets/LineageDrawer-zaBfSLZO.js +0 -1
  143. package/dist/assets/dql-notebook/assets/MiniLineageGraph-CdivNR1S.js +0 -1
  144. package/dist/assets/dql-notebook/assets/UnifiedAgentRunPanel-BYdrTaEW.js +0 -89
  145. package/dist/assets/dql-notebook/assets/dagre.esm-CW5QZdBt.js +0 -23
  146. package/dist/assets/dql-notebook/assets/index-B3shyZsg.css +0 -1
  147. /package/dist/assets/dql-notebook/assets/{dagre-BZV40eAE.css → style-BZV40eAE.css} +0 -0
@@ -1,11 +1,12 @@
1
1
  import type { ProviderDispatchPhaseV1, ProviderEgressPurpose } from '@duckcodeailabs/dql-core';
2
+ import { watch } from "node:fs";
2
3
  import { QueryExecutor, type ConnectionConfig, type DatabaseConnector, type QueryResult, type SQLParamSpec } from "@duckcodeailabs/dql-connectors";
3
4
  import { type NotebookCell, type SemanticRefResolutionOptions } from '@duckcodeailabs/dql-notebook';
4
- import { type SemanticLayer, type MetricDefinition, type SemanticLayerProviderConfig, type DashboardDocument, type DashboardGridItem, type DQLManifest, type DqlArtifactReference, type ManifestBlock, type DomainInput, type AnalyticalRepairCapabilityV1 } from '@duckcodeailabs/dql-core';
5
- import { type AgenticSqlExecutionCapabilityV1, type SqlAuthorizationCheck } from '@duckcodeailabs/dql-agent';
5
+ import { LineageGraph, type SemanticLayer, type MetricDefinition, type SemanticLayerProviderConfig, type DashboardDocument, type DashboardGridItem, type DQLManifest, type DqlArtifactReference, type ManifestBlock, type DomainInput, type AnalyticalRepairCapabilityV1, type AgentRunTelemetryV1 } from '@duckcodeailabs/dql-core';
6
+ import { type AgenticSqlExecutionCapabilityV1, type AskTraceObserverV1, type SqlAuthorizationCheck } from '@duckcodeailabs/dql-agent';
6
7
  import type { AgentRunner as LLMAgentRunner, ProviderDispatchTerminalEvidence, ProviderDispatchEvidenceSink, ProviderId } from './llm/types.js';
7
- import { type JoinPatternCandidate, type AnalyticalFreshnessRequestV1, type AnalyticalFailedRunV1, type AgentAnswer, type WarehouseSqlFailureV1, type ConversationTurnInput, type AgentResultPayload, type AgentSchemaTable, type RuntimeSchemaSnapshot, type ProposalResult, type ProposePlan, type ProposePlanCandidate, type ProposeConfigInput, type DomainContextEnvelope, type ResolveDomainContextInput, type AgentRun, type AgentRunExecutors, type AgentRunRequest, type AgentRunBudget, type AgentRunRequestedMode, type AgentRunRoute, type AgentRunStopReason, type AgentRunTrustState, type IntentDecision, type ProviderDispatchEvent, type ProviderResultRowEgressPolicy, type AnalyticalTaskV1, type AnalyticalTaskDependencyBindingV1, type AnalyticalTaskDependencyResolution } from '@duckcodeailabs/dql-agent';
8
- import type { NotebookResearchDqlArtifact } from '@duckcodeailabs/dql-project';
8
+ import { type JoinPatternCandidate, SqliteAgentRunStore, type AnalyticalFreshnessRequestV1, type AnalyticalFailedRunV1, type AgentAnswer, type WarehouseSqlFailureV1, type ConversationTurnInput, type AgentResultPayload, type AgentProvider, type AgentSchemaTable, type RuntimeSchemaSnapshot, type MetadataObject, type ProposalResult, type ProposePlan, type ProposePlanCandidate, type ProposeConfigInput, type DomainContextEnvelope, type ResolveDomainContextInput, type AgentRun, type AgentRunExecutors, type AgentRunRequest, type AgentRunBudget, type AgentRunRequestedMode, type AgentRunRoute, type AgentRunStopReason, type AgentRunTrustState, type AgentEvidenceCandidate, type AgentRetrievalEvidence, type AnalyticalRequirementSeedV1, type ResolvedAnalyticalPlan, type IntentDecision, type ProviderDispatchEvent, type ProviderDispatchCompletionEvent, type ProviderDispatchRejectionEvent, type ProviderResultRowEgressPolicy, type AnalyticalTaskV1, type AnalyticalTaskDependencyBindingV1, type AnalyticalTaskDependencyResolution, type AskSemanticEngineV1, type AskSemanticRuntimeSelectionV1, type AskSemanticCapabilityHandleV1, type ResearchLineageEvidenceReceiptV1 } from '@duckcodeailabs/dql-agent';
9
+ import type { NotebookResearchDqlArtifact, NotebookResearchRun } from '@duckcodeailabs/dql-project';
9
10
  import { type InvariantResult } from '@duckcodeailabs/dql-governance';
10
11
  import { type BlockStudioImportInputMode, type BlockStudioImportSource, type BlockStudioImportSourceKind, type DqlGenerationSession } from './block-studio-import.js';
11
12
  import { type ConnectionMetadataScopeInput } from './warehouse-metadata.js';
@@ -59,11 +60,10 @@ export interface ProjectConfig {
59
60
  searchSafeColumns?: string[];
60
61
  };
61
62
  /**
62
- * How many executed rows may reach the AI provider when it writes the answer.
63
- * Defaults to a bounded, redacted sample: a model that cannot see the values
64
- * cannot describe them, and the fallback for that is a `column: value` dump.
65
- * Set `mode: 'disabled'` to keep every cell value on the host — narration
66
- * still runs, grounded in column names and computed statistics only.
63
+ * Maximum redacted result rows that may reach the provider for an explicit
64
+ * Research run with one-run consent. Ordinary Ask and Research without
65
+ * consent keep every result value host-local. Set `mode: 'disabled'` (or
66
+ * zero rows) to disable even opted-in Research row egress.
67
67
  */
68
68
  providerResultRowEgress?: {
69
69
  mode?: 'bounded_sample' | 'disabled';
@@ -141,7 +141,125 @@ export interface LocalServerOptions {
141
141
  agentRunExecutors?: AgentRunExecutors;
142
142
  /** Host-owned rollback seam; never read from client request payloads. */
143
143
  requireMeaningCallForNaturalLanguage?: boolean;
144
+ /** Whole-runtime rollout control; never accepted from browser/MCP payloads. */
145
+ askAnalystRuntimeMode?: 'legacy' | 'shadow' | 'authoritative';
146
+ /** V2 is the default Ask ingress; V1 remains an explicit operator rollback. */
147
+ askAgentRuntimeMode?: AskAgentRuntimeMode;
148
+ /**
149
+ * Host-only Ask-planner provider seam for deterministic local-runtime
150
+ * integration tests. It is never read from HTTP/MCP payloads and does not
151
+ * grant a caller provider, route, or execution authority.
152
+ */
153
+ askAnalyticalPlannerProviderFactory?: (input: {
154
+ projectRoot: string;
155
+ request: AgentRunRequest;
156
+ }) => AgentProvider | null | Promise<AgentProvider | null>;
157
+ /**
158
+ * Host-only watcher seam for local-runtime tests and embeddings. Production
159
+ * uses `fs.watch`; browser/MCP input can never select a watcher or its scope.
160
+ */
161
+ projectWatcherFactory?: typeof watch;
162
+ /**
163
+ * Per-runtime capability minted by the local CLI launcher. Only a matching
164
+ * request header may label a trace as `cli`; public JSON never carries this
165
+ * authority and browser/MCP requests remain their own server-owned surface.
166
+ */
167
+ trustedCliTraceToken?: string;
168
+ }
169
+ /**
170
+ * The Ask rollout mode is an operator-owned server setting. It is never
171
+ * parsed from an Ask HTTP/MCP payload, but the built CLI may select it at
172
+ * startup so an operator can run an explicit authoritative canary.
173
+ */
174
+ export declare const ASK_AGENT_RUNTIME_MODES: readonly ["legacy_v1", "shadow_v2", "authoritative_v2"];
175
+ export type AskAgentRuntimeMode = typeof ASK_AGENT_RUNTIME_MODES[number];
176
+ export declare function resolveAskAgentRuntimeMode(value: unknown, options?: {
177
+ legacyFallback?: boolean;
178
+ }): AskAgentRuntimeMode;
179
+ /**
180
+ * The project's persisted Ask runtime mode, from `agent.askRuntimeMode` in
181
+ * `dql.config.json`.
182
+ *
183
+ * Without this, `authoritative_v2` was reachable only by typing a flag on one
184
+ * command (`dql notebook`), so a canary could not survive a restart and no
185
+ * other Ask surface — `dql serve`, `dql preview`, `dql agent ask` — could
186
+ * enter it at all. An operator selecting a rollout mode is making a project
187
+ * decision, and it should persist like one.
188
+ *
189
+ * Precedence is CLI flag > project config > default. The default stays
190
+ * `shadow_v2`: a rollout control that turns itself on is not a rollout
191
+ * control.
192
+ */
193
+ export declare function readProjectAskRuntimeMode(projectRoot: string): unknown;
194
+ /** One-time local capability lifetime. It is never persisted or sent to a provider. */
195
+ export declare const CLI_ASK_TRACE_CAPABILITY_TTL_MS = 30000;
196
+ export interface LocalCliAskTraceCapabilityV1 {
197
+ capability: string;
198
+ expiresAt: string;
199
+ scope: 'agent-runs';
144
200
  }
201
+ export interface LocalCliAskTraceCapabilityRegistryV1 {
202
+ issue(input?: {
203
+ capability?: string;
204
+ nowMs?: number;
205
+ ttlMs?: number;
206
+ }): LocalCliAskTraceCapabilityV1;
207
+ consume(input: {
208
+ capability: string | string[] | undefined;
209
+ scope: LocalCliAskTraceCapabilityV1['scope'];
210
+ loopbackServer: boolean;
211
+ remoteAddress?: string;
212
+ nowMs?: number;
213
+ }): 'cli' | undefined;
214
+ }
215
+ /**
216
+ * Host-owned, one-shot attribution capabilities for an already-local runtime.
217
+ * A plain client header is never enough: it must be minted by this process,
218
+ * unexpired, scoped to AgentRun admission, and arrive over loopback.
219
+ */
220
+ export declare function createLocalCliAskTraceCapabilityRegistryV1(options?: {
221
+ now?: () => number;
222
+ mint?: () => string;
223
+ }): LocalCliAskTraceCapabilityRegistryV1;
224
+ /**
225
+ * Opaque host-only capability for one cold exact-literal grounding probe.
226
+ * Unlike the trace-header capability above, this is never returned through an
227
+ * HTTP response: the runtime holds the token only long enough to invoke its
228
+ * local callback and strips it before any planner, trace, receipt, or store
229
+ * projection. The registry owns the physical field details.
230
+ */
231
+ export declare const CLI_ASK_LITERAL_PROBE_CAPABILITY_TTL_MS = 45000;
232
+ export interface LocalLiteralProbeCapabilityRegistryV1 {
233
+ issue(input: {
234
+ request: AgentRunRequest;
235
+ snapshotId: string;
236
+ candidate: AgentEvidenceCandidate;
237
+ relation: string;
238
+ column: string;
239
+ token?: string;
240
+ nowMs?: number;
241
+ }): string | undefined;
242
+ consume(input: {
243
+ token: unknown;
244
+ request: AgentRunRequest;
245
+ snapshotId?: string;
246
+ activeSnapshotId?: string;
247
+ candidate: AgentEvidenceCandidate;
248
+ relation: string;
249
+ column: string;
250
+ nowMs?: number;
251
+ }): boolean;
252
+ }
253
+ /**
254
+ * The local process holds the only mapping from an opaque token to its exact
255
+ * request, snapshot, candidate identity, and physical field. `consume` is
256
+ * intentionally fail-closed and deletes a successful authorization before
257
+ * the caller can construct or execute the probe SQL.
258
+ */
259
+ export declare function createLocalLiteralProbeCapabilityRegistryV1(options?: {
260
+ now?: () => number;
261
+ mint?: () => string;
262
+ }): LocalLiteralProbeCapabilityRegistryV1;
145
263
  export interface AppCopilotResearchAgentInput {
146
264
  appId: string;
147
265
  dashboardId?: string;
@@ -164,6 +282,19 @@ export interface AppCopilotResearchAgentInput {
164
282
  }
165
283
  /** AGT-007 / AGT-022: App-specific context adapter into the uniform AgentRun. */
166
284
  export declare function buildAppCopilotResearchAgentRequest(input: AppCopilotResearchAgentInput): AgentRunRequest;
285
+ export declare function askTraceQuestionPreview(question: string): string | undefined;
286
+ /**
287
+ * The notebook has exactly two trace client routes. Decode only the single
288
+ * detail segment for validation so a valid encoded run id (for example
289
+ * `run%3Aoffice-42`) reaches the SPA, while encoded slashes, malformed escapes,
290
+ * and nested paths stay ordinary 404s.
291
+ */
292
+ export declare function isAskTraceClientDetailPath(pathname: string): boolean;
293
+ /**
294
+ * Ask owns only these client-side routes. Keep the static fallback explicit so
295
+ * a notebook reload works while an arbitrary missing path remains a real 404.
296
+ */
297
+ export declare function isAskClientRoutePath(pathname: string): boolean;
167
298
  /** UI catalog fallback labels are not declared project domains. */
168
299
  /**
169
300
  * Resolve a UI-pinned domain scope, tolerating one that no longer exists.
@@ -254,7 +385,7 @@ export declare function scheduleCompoundAnalyticalTasks<T>(input: {
254
385
  /** What kind of narration a settled run has earned, and how many rows may ground it. */
255
386
  export type AgentNarrationPlan = {
256
387
  mode: 'skip';
257
- reason: 'no_answer' | 'no_provider' | 'nothing_to_narrate';
388
+ reason: 'no_answer' | 'no_provider' | 'nothing_to_narrate' | 'ordinary_ask';
258
389
  }
259
390
  /** Claim-verified narration over the immutable fact set (analytical graph lanes). */
260
391
  | {
@@ -270,17 +401,12 @@ export type AgentNarrationAnswer = Pick<AgentAnswer, 'kind'> & Partial<Pick<Agen
270
401
  /**
271
402
  * Decide how a settled answer gets its business-facing prose.
272
403
  *
273
- * This deliberately does NOT read `requestedMode`. Gating narration on
274
- * `requestedMode === 'research'` meant every ordinary Ask which the UI sends
275
- * as `'auto'` skipped synthesis entirely and shipped the answer loop's
276
- * deterministic fact-join as the primary answer: the reported `column: value`
277
- * dump. Narration is owed to any run that actually produced values.
278
- *
279
- * Certification, a DQL artifact, and the exploratory candidate are no longer
280
- * vetoes. EXP-001's grain concern is real, but the answer to "the model might
281
- * relabel an entity-level measure" is to VERIFY the claims against the fact set
282
- * (`verified_facts`) and pass the grain statement in as a caveat — not to refuse
283
- * to write a sentence.
404
+ * An ordinary Ask already spends its one permitted model call resolving meaning.
405
+ * Its settled answer is the deterministic, receipt-bound answer produced by the
406
+ * selected analytical tier; sending result rows to a second narrator would add
407
+ * a hidden provider phase, change the egress receipt, and make a governed
408
+ * semantic run look like Research. Only an explicit Research request may run
409
+ * this optional, fact-checked narration stage.
284
410
  */
285
411
  export declare function planAgentRunNarration(governedAnswer: AgentNarrationAnswer, context: {
286
412
  requestedMode?: AgentRunRequestedMode;
@@ -321,6 +447,37 @@ export declare function compoundTrustState(childTrust: readonly AgentRunTrustSta
321
447
  export declare function compoundStopReason(completedCount: number, childCount: number, trustState: AgentRunTrustState): AgentRunStopReason;
322
448
  export declare function semanticAnswerHasPassedAggregationProof(governedAnswer: Pick<AgentAnswer, 'route' | 'aggregationSafetyProof'>): boolean;
323
449
  export declare function agentAnswerHasExecutionFailure(governedAnswer: Pick<AgentAnswer, 'executionError'>): boolean;
450
+ /**
451
+ * An error-shaped compatibility string is not enough to rewrite an Ask
452
+ * failure into an execution incident when the producer retained a typed
453
+ * analytical boundary. Compiler and result-contract failures can carry the
454
+ * same redacted string for legacy display, but neither statement reached the
455
+ * SQL execution failure boundary. Old payloads without a typed failure retain
456
+ * the legacy compatibility projection.
457
+ */
458
+ export declare function agentAnswerHasExecutionBoundaryFailure(governedAnswer: Pick<AgentAnswer, 'executionError' | 'analyticalFailure'>): boolean;
459
+ /**
460
+ * Keep the producer's original refusal evidence intact, but never present a
461
+ * post-freeze execution failure as a retrieval gap. Older answer-loop paths
462
+ * used `grounding_gap` as their compatibility code even after a connector or
463
+ * SQL attempt failed. The runtime is the presentation/persistence boundary,
464
+ * so it projects that one case to the additive execution code without
465
+ * changing the frozen plan, selected route, or source answer.
466
+ */
467
+ export declare function projectAnswerExecutionFailureForRun(answer: AgentAnswer): AgentAnswer;
468
+ /** A user-facing terminal heading must follow the producer's typed boundary. */
469
+ export declare function terminalFailureTitleForAnswer(answer: Pick<AgentAnswer, 'refusalCode' | 'analyticalFailure' | 'refusalDetails'>): string;
470
+ /**
471
+ * One local-runtime projection supplies all terminal presentation/evaluation
472
+ * consumers. This prevents an execution-shaped legacy string from making the
473
+ * title, telemetry, or evaluation disagree with the typed failure boundary.
474
+ */
475
+ export declare function projectTerminalAnalyticalFailureForRun(answer: AgentAnswer): {
476
+ answer: AgentAnswer;
477
+ executionFailure: boolean;
478
+ fallbackReason?: string;
479
+ title: string;
480
+ };
324
481
  /**
325
482
  * Return only a router/producer-issued analytical gap witness.
326
483
  *
@@ -359,6 +516,28 @@ export declare function repairPresentationContextFromAgentRun(run: AgentRun): Re
359
516
  export declare function analyticalFailureAllowsDeterministicRetry(failure?: WarehouseSqlFailureV1): boolean;
360
517
  /** Structured policy/access refusals stay terminal even when retained SQL exists. */
361
518
  export declare function analyticalFailureAllowsAppRepair(failure?: AgentAnswer['analyticalFailure']): boolean;
519
+ /**
520
+ * Resolve a browser-selected result cell from durable local run storage. This
521
+ * remains valid after a notebook reload because the browser transmits only
522
+ * stable IDs/fingerprints; result values are accepted only after this host
523
+ * checks the persisted canonical result and artifact trust state.
524
+ */
525
+ export declare function hydratePersistedSelectedResultBinding(request: AgentRunRequest, store: Pick<SqliteAgentRunStore, 'get'>): void;
526
+ /**
527
+ * Materialize a plural prior-result reference before the authoritative Ask
528
+ * runtime frames the request. `buildAgentRunContextPack` also classifies
529
+ * follow-ups for retrieval diagnostics, but it runs after the Ask runtime has
530
+ * built its immutable requirement seed. Applying this only after retrieval
531
+ * made "those customers" an explanation-only hint and let a follow-up rank
532
+ * the entire warehouse.
533
+ *
534
+ * This is intentionally an HTTP-host boundary: it accepts only the
535
+ * server-reconstructed conversation envelope for the requested persisted
536
+ * thread. Browser conversation JSON cannot supply this filter, a prior member
537
+ * set, a shape anchor, or a host requirement seed. The values remain local
538
+ * execution context; they are never copied into provider prompts.
539
+ */
540
+ export declare function hydratePersistedPriorResultMemberBinding(request: AgentRunRequest): void;
362
541
  /**
363
542
  * Presentation projection of a run, for anything that SHIPS it — thread history
364
543
  * and the live SSE stream alike.
@@ -395,12 +574,58 @@ export declare function agentRunListEntryForTransport(run: AgentRun): AgentRun;
395
574
  export declare function conversationTurnInputFromRun(run: AgentRun): ConversationTurnInput;
396
575
  /** UI-007 / E2E-005: report the installed CLI version that owns this runtime. */
397
576
  export declare function readDqlRuntimeVersion(runtimeUrl?: string): string;
577
+ /** Server-owned cap for physical provider sends in one Ask run. */
578
+ export interface AgentRunProviderDispatchBudget {
579
+ total: number;
580
+ /** Legacy/no-evidence category calls have their own one-call allowance. */
581
+ classification?: number;
582
+ meaningResolution: number;
583
+ /** Optional stricter cap for planning inside `generationGroup`. */
584
+ planning?: number;
585
+ /**
586
+ * One verifier-directed, same-snapshot revision after a successfully
587
+ * admitted initial analytical planner call. This is deliberately separate
588
+ * from the ordinary planning and SQL-generation limits: it cannot turn into
589
+ * a second free-form plan or consume the SQL generation allowance.
590
+ */
591
+ planningRevision?: number;
592
+ /** One root Research hypothesis plan; separate from child Simple-Ask plans. */
593
+ researchHypothesisPlanning?: number;
594
+ generationGroup: number;
595
+ narration: number;
596
+ repair: number;
597
+ /** Authoritative Ask V2's first LLM-controlled tool turn. */
598
+ agentControl?: number;
599
+ /** Authoritative Ask V2 tool observations/follow-up turns after control. */
600
+ toolFollowup?: number;
601
+ }
602
+ /**
603
+ * The one runtime authority for provider-send caps.
604
+ *
605
+ * Research is limited to twelve physical sends total, one planner, and one
606
+ * narrator. Ordinary generated lookup normally gets two sends across
607
+ * candidate-ID meaning and planning/generation. A router-frozen bounded
608
+ * exploratory plan may use one additional, same-plan provider correction only
609
+ * after the generation response declines SQL. That third send is a `repair`,
610
+ * not an LLM replan: it retains the frozen snapshot, target, closure, output
611
+ * tuple, and route. Classification is a separate legacy/no-evidence phase,
612
+ * but still consumes the total cap and cannot coexist with candidate-ID
613
+ * meaning resolution in the ledger.
614
+ */
615
+ export declare function agentRunProviderDispatchBudgetForMode(requestedMode: AgentRunRequestedMode | undefined): AgentRunProviderDispatchBudget;
398
616
  export declare class RunScopedProviderDispatchEvidence implements ProviderDispatchEvidenceSink {
399
617
  private readonly policy;
400
618
  private readonly runBudget?;
401
619
  private readonly rowEgress;
402
620
  private readonly receipts;
403
621
  private readonly phaseCounts;
622
+ /** Planning revisions have their own verifier-owned admission slot. */
623
+ private planningInitialCount;
624
+ private planningRevisionCount;
625
+ /** The one root Research hypothesis-plan transport. */
626
+ private researchHypothesisPlanningCount;
627
+ /** At most one physical same-provider transient retry may be admitted per run. */
628
+ private retryCount;
404
629
  private currentRoute;
405
630
  /** Wall-clock start of the previous dispatch, used to learn this provider's cost. */
406
631
  private lastDispatchStartedAtMs?;
@@ -423,19 +648,7 @@ export declare class RunScopedProviderDispatchEvidence implements ProviderDispat
423
648
  */
424
649
  private nowMs;
425
650
  private recordDispatchStart;
426
- constructor(policy: {
427
- total: number;
428
- meaningResolution: number;
429
- generationGroup: number;
430
- /**
431
- * Narration has its own bucket. It used to share `generationGroup`, so a
432
- * run that spent its generation attempts had nothing left to write the
433
- * answer with and threw `PROVIDER_DISPATCH_BUDGET_EXHAUSTED` — which is how
434
- * an ordinary Ask ended up shipping its deterministic draft as the answer.
435
- */
436
- narration: number;
437
- repair: number;
438
- }, runBudget?: AgentRunBudget | undefined, rowEgress?: ProviderResultRowEgressPolicy);
651
+ constructor(policy: AgentRunProviderDispatchBudget, runBudget?: AgentRunBudget | undefined, rowEgress?: ProviderResultRowEgressPolicy);
439
652
  setRoute(route: AgentRunRoute | undefined): void;
440
653
  mayStartToolCall(): boolean;
441
654
  observe(event: ProviderDispatchEvent, context: {
@@ -447,9 +660,91 @@ export declare class RunScopedProviderDispatchEvidence implements ProviderDispat
447
660
  columnCount: number;
448
661
  };
449
662
  cumulativeResultRowCount?: number;
663
+ retryOfAttemptIndex?: number;
664
+ /** Server-owned subtype for root Research or the Ask planner. */
665
+ planningKind?: 'initial' | 'targeted_revision' | 'research_hypothesis';
450
666
  }): Record<string, unknown>;
451
667
  snapshot(fallbackReason?: string): ProviderDispatchTerminalEvidence;
452
668
  }
669
+ /**
670
+ * Attach one physical provider transport to the current redacted Ask trace.
671
+ * The caller remains the authority for admission and egress; this wrapper only
672
+ * records the same physical send/settlement with its server-owned phase and
673
+ * purpose. It is intentionally reusable for meaning and Research narration
674
+ * so trace provider-attempt counts cannot drift from egress receipts.
675
+ */
676
+ /**
677
+ * @internal Exported solely for the local runtime boundary harness. It is not
678
+ * an HTTP or durable API: production callers use it to pair the one provider
679
+ * transport with its same-run trace span and egress receipt.
680
+ */
681
+ export declare function createProviderDispatchTrace(input: {
682
+ observer?: AskTraceObserverV1;
683
+ phase: ProviderDispatchPhaseV1;
684
+ purpose: ProviderEgressPurpose;
685
+ admit: (event: ProviderDispatchEvent) => Record<string, unknown>;
686
+ }): {
687
+ options: {
688
+ onProviderDispatch: (event: ProviderDispatchEvent) => Record<string, unknown>;
689
+ onProviderDispatchComplete: (event: ProviderDispatchCompletionEvent) => void;
690
+ onProviderDispatchRejected: (event: ProviderDispatchRejectionEvent) => void;
691
+ };
692
+ settle: (outcome: 'ok' | 'error' | 'cancelled', error?: unknown) => void;
693
+ };
694
+ /**
695
+ * Router interpretation happens before the answer runner's AsyncLocal trace
696
+ * scope exists. Its request already carries the server-owned observer, so
697
+ * adapt the physical category-classification or candidate-ID meaning call to
698
+ * the shared physical-send trace wrapper without changing router authority.
699
+ */
700
+ /**
701
+ * @internal Host-owned physical dispatch bridge for Ask interpretation and
702
+ * planning. Exported only for the local egress integration harness; the
703
+ * runtime never receives a ledger or trace authority from client ingress.
704
+ */
705
+ export declare function createRouterInterpretationProviderTrace(input: {
706
+ request: AgentRunRequest;
707
+ routerPhase: 'classification' | 'meaning_resolution' | 'planning';
708
+ /** The only planning revision admission is minted by AskAnalystRuntime. */
709
+ planningKind?: 'initial' | 'targeted_revision';
710
+ /** Test/host injection only; production resolves the request-local ledger. */
711
+ ledger?: ProviderDispatchEvidenceSink;
712
+ }): ReturnType<typeof createProviderDispatchTrace>;
713
+ /**
714
+ * The hypothesis planner is a real Research provider dispatch, not a local
715
+ * planning convenience. Keep its one bounded call on the same server-owned
716
+ * ledger and trace as meaning, generation, and narration so it cannot evade
717
+ * the Research-12 cap or disappear from the run receipt.
718
+ *
719
+ * `planResearchHypotheses` deliberately accepts a small `generate`-only
720
+ * provider interface. This adapter preserves that seam while keeping the
721
+ * physical transport authority at the local-runtime boundary.
722
+ *
723
+ * @internal Exported for the local runtime planner/egress regression only.
724
+ */
725
+ export declare function createResearchHypothesisPlanningProvider(input: {
726
+ provider: AgentProvider;
727
+ request: AgentRunRequest;
728
+ ledger?: ProviderDispatchEvidenceSink;
729
+ }): AgentProvider;
730
+ /** @internal Exported for the Research-root terminal aggregation regression. */
731
+ export declare function mergeRunScopedProviderDispatchEvidence(run: AgentRun, evidence: ProviderDispatchTerminalEvidence): AgentRun;
732
+ /**
733
+ * Aggregate only durable Research-child evidence into the root telemetry.
734
+ *
735
+ * A child may have a provider/tool counter even when its query ultimately
736
+ * fails, so those counters are retained for every uniquely persisted child.
737
+ * SQL executions use the server-owned child runtime counter as their physical
738
+ * authority. A failed warehouse dispatch has no result fingerprint, but it is
739
+ * still a real SQL attempt and must remain visible at the Research root. A
740
+ * canonical result fingerprint/execution receipt is only the fallback for
741
+ * older child records that predate the counter, and remains the separate
742
+ * authority for observed facts. The child run ID, rather than the result
743
+ * fingerprint, is the de-duplication key because two independently executed
744
+ * hypotheses can legitimately return the same result.
745
+ */
746
+ /** @internal Exported for the focused child-counter aggregation regression. */
747
+ export declare function researchChildTelemetryForRoot(researchRuns: readonly NotebookResearchRun[]): AgentRunTelemetryV1;
453
748
  /**
454
749
  * Final physical generated-SQL boundary.
455
750
  *
@@ -467,7 +762,34 @@ export declare function executePreparedAgenticSqlBoundary<T>(input: {
467
762
  bindings: unknown;
468
763
  scope?: SqlAuthorizationCheck;
469
764
  execute: () => Promise<T>;
765
+ /** Internal harness injection; production obtains the request-local observer. */
766
+ traceObserver?: AskTraceObserverV1;
470
767
  }): Promise<T>;
768
+ /**
769
+ * Physical relationship evidence is captured by the immutable retrieval
770
+ * snapshot, then selected by opaque path handle. Keep the ID derivation and
771
+ * compiled-SQL verification outside the server closure so the same exact
772
+ * predicate can be tested without opening a connection.
773
+ */
774
+ export interface AskV2PhysicalRelationshipPath {
775
+ leftRelation: string;
776
+ leftColumn: string;
777
+ rightRelation: string;
778
+ rightColumn: string;
779
+ }
780
+ export declare function askV2RelationshipPathHandleId(path: AskV2PhysicalRelationshipPath): string;
781
+ /**
782
+ * Reject a compiled governed-relational query unless every physical join is
783
+ * exactly one of the immutable paths selected by the V2 tool. The caller has
784
+ * already validated all referenced relations and columns against its scoped
785
+ * context pack; this function owns the non-interchangeable join-edge proof.
786
+ */
787
+ export declare function assertAskV2BoundRelationshipPathsForSql(input: {
788
+ sql: string;
789
+ relationshipPathIds: readonly string[];
790
+ paths: readonly AskV2PhysicalRelationshipPath[];
791
+ dialect?: string;
792
+ }): void;
471
793
  export declare function startLocalServer(opts: LocalServerOptions): Promise<number>;
472
794
  export declare function assertLocalQueryRuntimeReady(executor: QueryExecutor, connection: ConnectionConfig): Promise<void>;
473
795
  export declare function formatLocalQueryRuntimeError(connection: ConnectionConfig, error: unknown): string;
@@ -507,10 +829,19 @@ export declare function resolveDefaultLLMProvider(projectRoot: string): Provider
507
829
  * answer-loop runner — never the MCP `claudeCodeRunner`, which doesn't emit a governed
508
830
  * answer envelope. Everything else uses the Settings-resolved default runner.
509
831
  */
510
- export declare function resolveGovernedAnswerRunner(projectRoot: string): {
832
+ export declare function resolveGovernedAnswerRunner(projectRoot: string, requestedProvider?: string): {
511
833
  provider: ProviderId;
512
834
  runner: LLMAgentRunner;
513
835
  } | null;
836
+ /**
837
+ * The no-runner outcome is still an authoritative provider preflight result.
838
+ * Preserve an explicit invalid selection as `MODEL_NOT_FOUND` instead of
839
+ * collapsing it into the historical generic authentication error.
840
+ */
841
+ export declare function governedProviderPreflightError(requestedProvider?: string): Error & {
842
+ code: 'MODEL_NOT_FOUND' | 'AUTHENTICATION_FAILED';
843
+ providerPhase: 'preflight';
844
+ };
514
845
  export declare function serializeJSON(value: unknown): string;
515
846
  /**
516
847
  * Extract the single time value returned by an authorized semantic freshness
@@ -769,6 +1100,50 @@ export declare function generateSemanticCompostingDrafts(projectRoot: string, ca
769
1100
  limit?: number;
770
1101
  owner?: string;
771
1102
  }): GenerateSemanticCompostingDraftsResult;
1103
+ /**
1104
+ * Captures the semantic compiler authority for one immutable Ask V2
1105
+ * retrieval snapshot. The map is keyed exclusively by the canonical
1106
+ * qualified evidence ID advertised to the provider. Legacy `id` values are
1107
+ * intentionally never aliases: one card's legacy ID may equal another
1108
+ * card's qualified ID, which would otherwise let a provider select A and
1109
+ * compile B's runtime field.
1110
+ *
1111
+ * A repeated canonical ID is treated as an ambiguous snapshot defect unless
1112
+ * the cards prove the exact same owner + semantic identity. Exact duplicate
1113
+ * cards de-duplicate to one capability; distinct owners/runtime definitions
1114
+ * are removed rather than resolved by insertion order. The tool adapter
1115
+ * retains a typed collision marker and requires a fresh snapshot before a
1116
+ * truly ambiguous capability can execute.
1117
+ */
1118
+ export declare function captureAskV2SemanticCapabilities(input: {
1119
+ candidates: readonly AgentEvidenceCandidate[];
1120
+ snapshotId?: string;
1121
+ isCurrent: () => boolean;
1122
+ /**
1123
+ * Server-selected runtime from the project settings/readiness probe. The
1124
+ * capability may expose it only when this exact candidate is ready for it.
1125
+ */
1126
+ semanticRuntime?: AskSemanticRuntimeSelectionV1;
1127
+ /** Exact target-bound engines captured during retrieval readiness. */
1128
+ semanticCandidateReadiness?: ReadonlyArray<{
1129
+ candidateId: string;
1130
+ status: 'ready' | 'unavailable' | 'unknown';
1131
+ engines?: ReadonlyArray<AskSemanticEngineV1>;
1132
+ nativeCompilerProven?: boolean;
1133
+ }>;
1134
+ }): {
1135
+ capabilities: Map<string, AskSemanticCapabilityHandleV1>;
1136
+ collisionIds: string[];
1137
+ };
1138
+ /**
1139
+ * Opaque browser-cache identity for local Ask conversations. A browser origin
1140
+ * is not a project boundary: a user can stop one `dql notebook` process and
1141
+ * start a different project on the same port. The client therefore receives
1142
+ * only this one-way, server-owned value and never a local path. It is not a
1143
+ * secret: it is intentionally linkable only within the local browser/runtime
1144
+ * across restarts so stale cache can be rejected; never log or export it.
1145
+ */
1146
+ export declare function askConversationProjectIdentity(projectRoot: string): string;
772
1147
  /**
773
1148
  * Materialize drafts for an APPROVED scope (selected slugs / domains). Reuses
774
1149
  * the propose engine's `onlySlugs` path + the draft writer. Plumbing is never
@@ -1336,6 +1711,20 @@ export declare function parseBlockSourceMetadata(source: string): {
1336
1711
  */
1337
1712
  export declare function markBlockStudioSourceReusable(source: string): string;
1338
1713
  export declare function setBlockStudioStatus(projectRoot: string, blockPath: string, newStatus: string): void;
1714
+ /**
1715
+ * Run the real provider/model readiness check at the planner boundary. This
1716
+ * has no provider-generation ledger admission and no connector effect: it
1717
+ * exists solely to retain redacted preflight cause and trace truth before a
1718
+ * natural-language Ask depends on a planner call.
1719
+ *
1720
+ * Exported for the local host integration harness only. It is not an API and
1721
+ * receives its provider exclusively from server-owned configuration/tests.
1722
+ */
1723
+ export declare function preflightAskAnalyticalPlannerProvider(input: {
1724
+ projectRoot: string;
1725
+ request: AgentRunRequest;
1726
+ provider: AgentProvider | null;
1727
+ }): Promise<AgentProvider>;
1339
1728
  export declare function buildConversationContextRecap(context: Record<string, unknown> | undefined): string | undefined;
1340
1729
  /**
1341
1730
  * Explain the latest successful answer from its persisted artifact contract.
@@ -1395,6 +1784,19 @@ export declare function createSemanticBuilderBlock(projectRoot: string, options:
1395
1784
  content: string;
1396
1785
  companionPath: string;
1397
1786
  };
1787
+ /**
1788
+ * Immutable structural evidence captured once for an explicit Research root.
1789
+ * `lineageSourceSignature` includes `dql-manifest.json`, so a manifest edit
1790
+ * between root planning and a child check is observable before any graph walk.
1791
+ */
1792
+ export interface ResearchLineageRootSnapshotV1 {
1793
+ graph?: InstanceType<typeof LineageGraph>;
1794
+ graphFingerprint: string;
1795
+ stableAtCapture: boolean;
1796
+ }
1797
+ export declare function captureResearchLineageRootSnapshotV1(projectRoot: string, semanticLayer: SemanticLayer | null | undefined): ResearchLineageRootSnapshotV1;
1798
+ /** True only while the root-captured graph still matches all lineage inputs. */
1799
+ export declare function researchLineageRootSnapshotIsCurrentV1(snapshot: ResearchLineageRootSnapshotV1, projectRoot: string): boolean;
1398
1800
  export declare function discoverDbtProfileConnections(projectRoot: string, projectConfig: ProjectConfig, explicitPath?: string): DbtProfileConnectionCandidate[];
1399
1801
  export declare function buildDbtParseArgs(dbtProjectDir: string, profilesDir?: string): string[];
1400
1802
  /** CFG-003: use a complete default dbt target when no saved DQL connection exists. */
@@ -1562,6 +1964,115 @@ export declare function ensureLocalRuntimeGitignore(projectRoot: string): void;
1562
1964
  * provider is still respected.
1563
1965
  */
1564
1966
  export declare function predictDispatchMs(observed: readonly number[], assumedMs?: number): number;
1967
+ /**
1968
+ * A Research root owns a fixed 120-second deadline. Reserve the last slice
1969
+ * for durable branch receipts, deterministic synthesis, and run persistence;
1970
+ * otherwise the first slow child can consume the entire investigation and
1971
+ * leave the user with neither an answer nor an explanation of the failure.
1972
+ *
1973
+ * This is deliberately a local runtime scheduling policy, not a second
1974
+ * product deadline. The root AgentRunBudget remains the one hard authority.
1975
+ */
1976
+ export declare const RESEARCH_BRANCH_FINALIZATION_RESERVE_MS = 15000;
1977
+ export declare const RESEARCH_MIN_BRANCH_EXECUTION_MS = 1000;
1978
+ /**
1979
+ * Research branches are independent bounded investigations. Run a small
1980
+ * deterministic wave so a five-hypothesis plan does not divide the root
1981
+ * budget into five unusably short serial windows. This is deliberately below
1982
+ * the provider cap and keeps cancellation/finalization responsive.
1983
+ */
1984
+ export declare const RESEARCH_MAX_CONCURRENT_BRANCHES = 3;
1985
+ export type ResearchBranchStopReasonV1 = 'completed' | 'research_branch_timeout' | 'budget_exhausted' | 'run_deadline'
1986
+ /** The user explicitly stopped the root Research run. */
1987
+ | 'cancelled'
1988
+ /** The admitted branch failed before an execution receipt was produced. */
1989
+ | 'execution_failed';
1990
+ /** Content-safe execution receipt for one bounded Research child. */
1991
+ export interface ResearchBranchReceiptV1 {
1992
+ version: 1;
1993
+ branchId: string;
1994
+ childRunId: string;
1995
+ index: number;
1996
+ state: 'completed' | 'failed' | 'timed_out' | 'skipped';
1997
+ verdict: 'inconclusive' | 'failed' | 'skipped';
1998
+ stopReason: ResearchBranchStopReasonV1;
1999
+ /** Present for an admitted child; skipped children never start provider/SQL work. */
2000
+ branchBudgetMs?: number;
2001
+ /**
2002
+ * Legacy receipts are analytical-result branches. A lineage receipt is an
2003
+ * additive structural program with no provider, SQL, warehouse, or repair
2004
+ * execution; readers that do not know this field retain the V1 behaviour.
2005
+ */
2006
+ evidenceKind?: 'analytical_result' | 'lineage_graph';
2007
+ /** Present only for a content-safe `check_lineage` structural receipt. */
2008
+ lineageStatus?: ResearchLineageEvidenceReceiptV1['status'];
2009
+ }
2010
+ /**
2011
+ * Fair-share one child deadline from the remaining root time. The formula is
2012
+ * intentionally deterministic so a trace can explain why a branch stopped:
2013
+ * after finalization is reserved, divide the usable window by the number of
2014
+ * remaining bounded waves. Every branch in the current wave receives the
2015
+ * same window. A too-small share is a skipped branch, not a late
2016
+ * provider/warehouse admission.
2017
+ */
2018
+ export declare function allocateResearchBranchBudget(input: {
2019
+ remainingMs: number;
2020
+ remainingBranches: number;
2021
+ finalizationReserveMs?: number;
2022
+ minExecutionMs?: number;
2023
+ maxConcurrentBranches?: number;
2024
+ }): {
2025
+ version: 1;
2026
+ remainingMs: number;
2027
+ finalizationReserveMs: number;
2028
+ maxConcurrentBranches: number;
2029
+ remainingWaves: number;
2030
+ branchBudgetMs?: number;
2031
+ stopReason?: 'budget_exhausted';
2032
+ };
2033
+ type ResearchBranchActionProjectionInput = {
2034
+ action: {
2035
+ kind: 'lookup_metric' | 'lookup_block' | 'breakdown' | 'compare_time' | 'check_lineage' | 'compose_app';
2036
+ target: string;
2037
+ };
2038
+ /**
2039
+ * The root's host-owned tuple. It may exist before a root route is
2040
+ * executable, which is intentional: Research children still start from the
2041
+ * reader's requirement rather than a planner sentence or root SQL.
2042
+ */
2043
+ rootRequirementSeed: AnalyticalRequirementSeedV1;
2044
+ /** Optional frozen root facts used only to preserve already-resolved terms. */
2045
+ rootPlan?: Pick<ResolvedAnalyticalPlan, 'query' | 'analyticalFrame'>;
2046
+ };
2047
+ export interface ResearchBranchRequirementProjectionV1 {
2048
+ version: 1;
2049
+ action: ResearchBranchActionProjectionInput['action']['kind'];
2050
+ question: string;
2051
+ /**
2052
+ * A host-owned seed only. It deliberately contains no planner supplied
2053
+ * candidate ID: the child router must retrieve and bind candidates from its
2054
+ * own immutable snapshot before it can freeze a plan.
2055
+ */
2056
+ requirementSeed?: AnalyticalRequirementSeedV1;
2057
+ }
2058
+ /**
2059
+ * Convert one typed Research action into an ordinary Ask requirement seed.
2060
+ *
2061
+ * The older branch runner reduced every action to the final token of its
2062
+ * target. That meant `compare_time` and `breakdown` silently discarded the
2063
+ * root metric (and, for time, its required role/grain), so distinct research
2064
+ * branches could all execute the same baseline. This projection is host-only:
2065
+ * it preserves the root tuple and adds the action's one requested operation,
2066
+ * but never turns a planner label into a trusted candidate or SQL authority.
2067
+ */
2068
+ export declare function buildResearchBranchRequirementProjection(input: ResearchBranchActionProjectionInput): ResearchBranchRequirementProjectionV1;
2069
+ /**
2070
+ * Race a child against its own signal while consuming an eventual late
2071
+ * rejection. `runNotebookResearch` also receives that signal and checks it at
2072
+ * persistence boundaries, so a slow provider/query cannot overwrite the
2073
+ * already-recorded timeout receipt after this promise rejects.
2074
+ */
2075
+ export declare function awaitResearchBranchDeadline<T>(work: Promise<T>, signal: AbortSignal): Promise<T>;
1565
2076
  export declare function boundedAgentMeaningSignal(signal?: AbortSignal, timeoutMs?: number): AbortSignal;
1566
2077
  /**
1567
2078
  * Whether the project's stored live-schema snapshot is missing or older than the
@@ -1656,14 +2167,75 @@ export interface AgentRuntimeValueGroundingPolicy {
1656
2167
  mode: 'disabled' | 'safe_automatic';
1657
2168
  searchSafeColumns: ReadonlySet<string>;
1658
2169
  }
2170
+ /**
2171
+ * Trace-only provenance for the two host-added catalog cards below. This is
2172
+ * not a planner hint or an execution capability: it explains why an exact
2173
+ * physical field was retained when ordinary fused ranking did not select it.
2174
+ */
2175
+ export declare const AGENT_RUNTIME_VALUE_GROUNDING_PIN_REASON = "host configured runtime value grounding pin";
1659
2176
  /**
1660
2177
  * Resolve the project-admin boundary for live value lookup. An absent/malformed
1661
2178
  * policy is deliberately disabled; a broad table or wildcard cannot make an
1662
2179
  * unknown column search-safe.
1663
2180
  */
1664
2181
  export declare function resolveAgentRuntimeValueGrounding(config: ProjectConfig): AgentRuntimeValueGroundingPolicy;
2182
+ /**
2183
+ * Preserve one explicitly configured physical categorical field in the Ask
2184
+ * evidence snapshot before the runtime applies its 32/16 role-balanced caps.
2185
+ *
2186
+ * A cold runtime-value index is not evidence that a literal is absent. The
2187
+ * host may therefore retain exactly one catalog column that an operator named
2188
+ * in `runtimeValueGrounding`, together with exactly one owning dbt relation.
2189
+ * It does not retain a semantic dimension as a value authority, infer a field
2190
+ * from the question, or broaden a configuration with multiple candidate
2191
+ * fields. The later exact value probe and relationship/compiler gates remain
2192
+ * the only ways this card can become a filter or executable plan.
2193
+ */
2194
+ export declare function pinConfiguredRuntimeValueGroundingEvidence(input: {
2195
+ evidence: AgentRetrievalEvidence;
2196
+ question: string;
2197
+ policy: AgentRuntimeValueGroundingPolicy;
2198
+ catalogObjects: readonly MetadataObject[];
2199
+ /**
2200
+ * Ephemeral host token issued by the local server registry after this exact
2201
+ * catalog field was verified. It is opaque: relation/column authority stays
2202
+ * in the registry and the Ask runtime strips this token before projection.
2203
+ */
2204
+ literalProbeToken?: string;
2205
+ }): AgentRetrievalEvidence;
1665
2206
  export declare function isAgentValueProbeColumn(column: AgentSchemaTable['columns'][number]): boolean;
1666
2207
  export declare function buildAgentValueProbeSql(table: AgentSchemaTable, column: string, searchTerms: string[], connection: ConnectionConfig): string;
2208
+ /**
2209
+ * One host-owned literal check used only after the immutable Ask snapshot has
2210
+ * already selected a qualified physical column. Unlike the advisory value
2211
+ * search above, this returns no values: the caller learns only whether the
2212
+ * current literal exists exactly once on this approved field.
2213
+ */
2214
+ /**
2215
+ * Case-insensitive existence probe that also returns the canonical stored
2216
+ * spelling, so a host-bound equality filter matches the warehouse casing
2217
+ * ("ronnie knight" typed, "Ronnie Knight" stored). LIMIT 2 detects two
2218
+ * distinct stored spellings — that is ambiguity, not proof.
2219
+ */
2220
+ export declare function buildAgentCanonicalValueProbeSql(relation: string, column: string, literal: string, connection: ConnectionConfig): string;
2221
+ export declare function buildAgentExactValueProbeSql(table: AgentSchemaTable, column: string, literal: string, connection: ConnectionConfig): string;
2222
+ /**
2223
+ * Resolve a planner-admitted raw field back to exactly one physical relation.
2224
+ * This deliberately accepts only explicit runtime/dbt relation references;
2225
+ * a semantic model name or a bare table leaf is not a warehouse target.
2226
+ */
2227
+ export declare function agentLiteralProbeTarget(candidate: AgentEvidenceCandidate): {
2228
+ table: AgentSchemaTable;
2229
+ column: AgentSchemaTable['columns'][number];
2230
+ } | undefined;
2231
+ /**
2232
+ * Mark only a declared, same-snapshot exploratory path that the canonical
2233
+ * analytical policy has accepted. The marker is deliberately host-local: no
2234
+ * indexed card, provider proposal, client request, or persisted result can
2235
+ * raise a draft edge to this state. The router still keeps it
2236
+ * review-required because `automaticJoinAllowed` remains false.
2237
+ */
2238
+ export declare function attestExploratoryRelationshipEvidence(evidence: AgentRetrievalEvidence, manifest: DQLManifest | undefined): AgentRetrievalEvidence;
1667
2239
  export declare function extractAgentValueSearchTerms(question: string): string[];
1668
2240
  export {};
1669
2241
  //# sourceMappingURL=local-runtime.d.ts.map