@duckcodeailabs/dql-cli 1.14.3-rc.1 → 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 (121) hide show
  1. package/dist/args.d.ts +2 -0
  2. package/dist/args.d.ts.map +1 -1
  3. package/dist/args.js +12 -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-Jbyb4so-.js → AgentLogPage-XonDlOVv.js} +1 -1
  14. package/dist/assets/dql-notebook/assets/{AiBuildDialog-Du07X1qO.js → AiBuildDialog-DwHVVFIS.js} +1 -1
  15. package/dist/assets/dql-notebook/assets/{AiBuildResult-xKtGthWv.js → AiBuildResult-BImB4Wej.js} +1 -1
  16. package/dist/assets/dql-notebook/assets/{AiSidePanel-CE_L04dK.js → AiSidePanel-D7fFBhgc.js} +1 -1
  17. package/dist/assets/dql-notebook/assets/{AnalyticsHome-CiUE10uF.js → AnalyticsHome-CHvGWG92.js} +1 -1
  18. package/dist/assets/dql-notebook/assets/{AppsView-DlNaTuwD.js → AppsView-DNhs0MyO.js} +4 -4
  19. package/dist/assets/dql-notebook/assets/{AskObservabilityPage-DracZPI9.js → AskObservabilityPage-1WYjAf8-.js} +1 -1
  20. package/dist/assets/dql-notebook/assets/AskTracePage-D6_RunIf.js +8 -0
  21. package/dist/assets/dql-notebook/assets/{BlockStudio-DQS5Hcq9.js → BlockStudio-DWMOCHy5.js} +1 -1
  22. package/dist/assets/dql-notebook/assets/{BusinessArtifactView-CqV4i9l_.js → BusinessArtifactView-guqlfQ0j.js} +1 -1
  23. package/dist/assets/dql-notebook/assets/{DbtFirstModelingPage-JKhB_Y2H.js → DbtFirstModelingPage-DE7ewjMK.js} +1 -1
  24. package/dist/assets/dql-notebook/assets/{GitPage-DjaNp0o3.js → GitPage-CM3cgHtf.js} +1 -1
  25. package/dist/assets/dql-notebook/assets/{GlobalAiRail-CsV3zlc8.js → GlobalAiRail-BWfeK8lb.js} +1 -1
  26. package/dist/assets/dql-notebook/assets/{GovernedContextPage-uXUHUOIJ.js → GovernedContextPage-2Ld4yIgE.js} +1 -1
  27. package/dist/assets/dql-notebook/assets/{HelpDocsPage-Hbh9IeYB.js → HelpDocsPage-BxBzoxBO.js} +1 -1
  28. package/dist/assets/dql-notebook/assets/{HomePage-CRRl-R_v.js → HomePage-D4ZjCFfB.js} +1 -1
  29. package/dist/assets/dql-notebook/assets/{LineageDAG-OMUP2sbl.js → LineageDAG-DLdogZMo.js} +1 -1
  30. package/dist/assets/dql-notebook/assets/{LineageDetailView-C964BLuV.js → LineageDetailView-CqPB_tFP.js} +1 -1
  31. package/dist/assets/dql-notebook/assets/{LineageDrawer-CzY0nfpD.js → LineageDrawer-LZyR3zHf.js} +1 -1
  32. package/dist/assets/dql-notebook/assets/{LineagePathBreadcrumb-0Gi-Fm1B.js → LineagePathBreadcrumb-BZ7EcIxp.js} +1 -1
  33. package/dist/assets/dql-notebook/assets/{MiniLineageGraph-wn0wLc9m.js → MiniLineageGraph-Be_kqIq2.js} +1 -1
  34. package/dist/assets/dql-notebook/assets/{NewBlockModal-kMAzk91d.js → NewBlockModal-C9MKCa6R.js} +1 -1
  35. package/dist/assets/dql-notebook/assets/{NewNotebookModal-D_cWd_6M.js → NewNotebookModal-ZxHbTU9u.js} +1 -1
  36. package/dist/assets/dql-notebook/assets/{NotebookEditor-Bax0lxaz.js → NotebookEditor-Bh39Vsg0.js} +1 -1
  37. package/dist/assets/dql-notebook/assets/{ReadinessPage-DEUIXQQY.js → ReadinessPage-jKOBKkED.js} +1 -1
  38. package/dist/assets/dql-notebook/assets/{SetupOnboarding-CyE-Ex41.js → SetupOnboarding-BRut9nLO.js} +1 -1
  39. package/dist/assets/dql-notebook/assets/{SkillsPage-QgvKGPxE.js → SkillsPage-D9msUOxY.js} +1 -1
  40. package/dist/assets/dql-notebook/assets/{TrustBadge-D5CGp0cu.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-tACdCsTV.js → answer-to-notebook-zHFOdR6E.js} +1 -1
  43. package/dist/assets/dql-notebook/assets/{arrow-left-CF6wxXU5.js → arrow-left-C1tZBhgf.js} +1 -1
  44. package/dist/assets/dql-notebook/assets/{arrow-right-C7G3M_S8.js → arrow-right-BP5vPPNo.js} +1 -1
  45. package/dist/assets/dql-notebook/assets/{book-open-text-DDBO8G7L.js → book-open-text-BD3-ATYI.js} +1 -1
  46. package/dist/assets/dql-notebook/assets/{chevron-left-DxajrX2v.js → chevron-left-3opVgscY.js} +1 -1
  47. package/dist/assets/dql-notebook/assets/{circle-x-HBvXjnT6.js → circle-x-Bg9-70KN.js} +1 -1
  48. package/dist/assets/dql-notebook/assets/{clock-3-CJIdsPLt.js → clock-3-DLV5puGW.js} +1 -1
  49. package/dist/assets/dql-notebook/assets/{external-link-WciAU8Bu.js → external-link-BjD8w9QU.js} +1 -1
  50. package/dist/assets/dql-notebook/assets/{grip-vertical-DVu7ok6x.js → grip-vertical-DqIc09oX.js} +1 -1
  51. package/dist/assets/dql-notebook/assets/{index-D3wnucQC.js → index-C9KfoqCR.js} +2 -2
  52. package/dist/assets/dql-notebook/assets/{link-2-C6uQx50X.js → link-2-5s0hUu6w.js} +1 -1
  53. package/dist/assets/dql-notebook/assets/{list-tree-DapsIuQB.js → list-tree-67yz_uCY.js} +1 -1
  54. package/dist/assets/dql-notebook/assets/{minimize-2-BlVoipnT.js → minimize-2-BJw5tlPC.js} +1 -1
  55. package/dist/assets/dql-notebook/assets/{panel-right-open-DcnKWxfx.js → panel-right-open-CyhTG-tw.js} +1 -1
  56. package/dist/assets/dql-notebook/assets/{play-CNuRuaAs.js → play-CsY8D5M2.js} +1 -1
  57. package/dist/assets/dql-notebook/assets/{rotate-ccw-B2p953Zh.js → rotate-ccw-RvwtBcw9.js} +1 -1
  58. package/dist/assets/dql-notebook/assets/{semantic-fields-2fWgkTJc.js → semantic-fields-EorgHwAj.js} +1 -1
  59. package/dist/assets/dql-notebook/assets/{sliders-horizontal-DwRTu1w4.js → sliders-horizontal-jQ_fUiYf.js} +1 -1
  60. package/dist/assets/dql-notebook/assets/{star-Cbaj4F3i.js → star-N_C8YvbB.js} +1 -1
  61. package/dist/assets/dql-notebook/assets/{style-NlN9F6JE.js → style-D6AlWDHX.js} +1 -1
  62. package/dist/assets/dql-notebook/assets/{triangle-alert-BPHvH1wA.js → triangle-alert-D1WefIrN.js} +1 -1
  63. package/dist/assets/dql-notebook/assets/{upload-DIqK0KE1.js → upload-CFJjpPL4.js} +1 -1
  64. package/dist/assets/dql-notebook/assets/{usePersistedAgentThreadId-DpQXOEDw.js → usePersistedAgentThreadId-B5pTglEr.js} +1 -1
  65. package/dist/assets/dql-notebook/assets/{user-round-DukNupB_.js → user-round-DL6DLw0m.js} +1 -1
  66. package/dist/assets/dql-notebook/assets/{wand-sparkles-CAwLX0b9.js → wand-sparkles-CNUjLDqT.js} +1 -1
  67. package/dist/assets/dql-notebook/assets/{workflow-bOT-NqdO.js → workflow-0NUwpoQ4.js} +1 -1
  68. package/dist/assets/dql-notebook/assets/{wrench-1m0_kcza.js → wrench-QNiznShi.js} +1 -1
  69. package/dist/assets/dql-notebook/assets/{x-fp82BETM.js → x-BhTl5gZs.js} +1 -1
  70. package/dist/assets/dql-notebook/index.html +1 -1
  71. package/dist/commands/agent-eval-cassette.d.ts.map +1 -1
  72. package/dist/commands/agent-eval-cassette.js +15 -0
  73. package/dist/commands/agent-eval-cassette.js.map +1 -1
  74. package/dist/commands/agent-shadow-report.d.ts +17 -0
  75. package/dist/commands/agent-shadow-report.d.ts.map +1 -0
  76. package/dist/commands/agent-shadow-report.js +149 -0
  77. package/dist/commands/agent-shadow-report.js.map +1 -0
  78. package/dist/commands/agent.d.ts.map +1 -1
  79. package/dist/commands/agent.js +6 -2
  80. package/dist/commands/agent.js.map +1 -1
  81. package/dist/commands/notebook.d.ts +2 -1
  82. package/dist/commands/notebook.d.ts.map +1 -1
  83. package/dist/commands/notebook.js +8 -1
  84. package/dist/commands/notebook.js.map +1 -1
  85. package/dist/index.js +3 -0
  86. package/dist/index.js.map +1 -1
  87. package/dist/llm/providers/ask-v2-analyst-prompt.d.ts +32 -0
  88. package/dist/llm/providers/ask-v2-analyst-prompt.d.ts.map +1 -0
  89. package/dist/llm/providers/ask-v2-analyst-prompt.js +136 -0
  90. package/dist/llm/providers/ask-v2-analyst-prompt.js.map +1 -0
  91. package/dist/llm/providers/dql-agent-provider.d.ts +77 -1
  92. package/dist/llm/providers/dql-agent-provider.d.ts.map +1 -1
  93. package/dist/llm/providers/dql-agent-provider.js +4848 -354
  94. package/dist/llm/providers/dql-agent-provider.js.map +1 -1
  95. package/dist/llm/types.d.ts +124 -2
  96. package/dist/llm/types.d.ts.map +1 -1
  97. package/dist/local-runtime.d.ts +352 -3
  98. package/dist/local-runtime.d.ts.map +1 -1
  99. package/dist/local-runtime.js +4916 -238
  100. package/dist/local-runtime.js.map +1 -1
  101. package/dist/metricflow.d.ts.map +1 -1
  102. package/dist/metricflow.js +80 -11
  103. package/dist/metricflow.js.map +1 -1
  104. package/dist/package.json +10 -10
  105. package/dist/providers/oauth/claude-oauth.d.ts +14 -0
  106. package/dist/providers/oauth/claude-oauth.d.ts.map +1 -1
  107. package/dist/providers/oauth/claude-oauth.js +32 -5
  108. package/dist/providers/oauth/claude-oauth.js.map +1 -1
  109. package/dist/research-lineage-program.d.ts +29 -0
  110. package/dist/research-lineage-program.d.ts.map +1 -0
  111. package/dist/research-lineage-program.js +389 -0
  112. package/dist/research-lineage-program.js.map +1 -0
  113. package/dist/retrieval-health.d.ts.map +1 -1
  114. package/dist/retrieval-health.js +5 -2
  115. package/dist/retrieval-health.js.map +1 -1
  116. package/dist/semantic-runtime.d.ts.map +1 -1
  117. package/dist/semantic-runtime.js +73 -2
  118. package/dist/semantic-runtime.js.map +1 -1
  119. package/package.json +10 -10
  120. package/dist/assets/dql-notebook/assets/AskTracePage-CSMoMw9a.js +0 -8
  121. package/dist/assets/dql-notebook/assets/UnifiedAgentRunPanel-BjsTE6yf.js +0 -89
@@ -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 { 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';
5
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 AgentProvider, 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 AnalyticalRequirementSeedV1, type ResolvedAnalyticalPlan, type IntentDecision, type ProviderDispatchEvent, type ProviderDispatchCompletionEvent, type ProviderDispatchRejectionEvent, 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';
@@ -140,6 +141,24 @@ export interface LocalServerOptions {
140
141
  agentRunExecutors?: AgentRunExecutors;
141
142
  /** Host-owned rollback seam; never read from client request payloads. */
142
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;
143
162
  /**
144
163
  * Per-runtime capability minted by the local CLI launcher. Only a matching
145
164
  * request header may label a trace as `cli`; public JSON never carries this
@@ -147,6 +166,31 @@ export interface LocalServerOptions {
147
166
  */
148
167
  trustedCliTraceToken?: string;
149
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;
150
194
  /** One-time local capability lifetime. It is never persisted or sent to a provider. */
151
195
  export declare const CLI_ASK_TRACE_CAPABILITY_TTL_MS = 30000;
152
196
  export interface LocalCliAskTraceCapabilityV1 {
@@ -177,6 +221,45 @@ export declare function createLocalCliAskTraceCapabilityRegistryV1(options?: {
177
221
  now?: () => number;
178
222
  mint?: () => string;
179
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;
180
263
  export interface AppCopilotResearchAgentInput {
181
264
  appId: string;
182
265
  dashboardId?: string;
@@ -364,6 +447,37 @@ export declare function compoundTrustState(childTrust: readonly AgentRunTrustSta
364
447
  export declare function compoundStopReason(completedCount: number, childCount: number, trustState: AgentRunTrustState): AgentRunStopReason;
365
448
  export declare function semanticAnswerHasPassedAggregationProof(governedAnswer: Pick<AgentAnswer, 'route' | 'aggregationSafetyProof'>): boolean;
366
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
+ };
367
481
  /**
368
482
  * Return only a router/producer-issued analytical gap witness.
369
483
  *
@@ -402,6 +516,28 @@ export declare function repairPresentationContextFromAgentRun(run: AgentRun): Re
402
516
  export declare function analyticalFailureAllowsDeterministicRetry(failure?: WarehouseSqlFailureV1): boolean;
403
517
  /** Structured policy/access refusals stay terminal even when retained SQL exists. */
404
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;
405
541
  /**
406
542
  * Presentation projection of a run, for anything that SHIPS it — thread history
407
543
  * and the live SSE stream alike.
@@ -446,9 +582,22 @@ export interface AgentRunProviderDispatchBudget {
446
582
  meaningResolution: number;
447
583
  /** Optional stricter cap for planning inside `generationGroup`. */
448
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;
449
594
  generationGroup: number;
450
595
  narration: number;
451
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;
452
601
  }
453
602
  /**
454
603
  * The one runtime authority for provider-send caps.
@@ -470,6 +619,11 @@ export declare class RunScopedProviderDispatchEvidence implements ProviderDispat
470
619
  private readonly rowEgress;
471
620
  private readonly receipts;
472
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;
473
627
  /** At most one physical same-provider transient retry may be admitted per run. */
474
628
  private retryCount;
475
629
  private currentRoute;
@@ -507,6 +661,8 @@ export declare class RunScopedProviderDispatchEvidence implements ProviderDispat
507
661
  };
508
662
  cumulativeResultRowCount?: number;
509
663
  retryOfAttemptIndex?: number;
664
+ /** Server-owned subtype for root Research or the Ask planner. */
665
+ planningKind?: 'initial' | 'targeted_revision' | 'research_hypothesis';
510
666
  }): Record<string, unknown>;
511
667
  snapshot(fallbackReason?: string): ProviderDispatchTerminalEvidence;
512
668
  }
@@ -535,6 +691,25 @@ export declare function createProviderDispatchTrace(input: {
535
691
  };
536
692
  settle: (outcome: 'ok' | 'error' | 'cancelled', error?: unknown) => void;
537
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>;
538
713
  /**
539
714
  * The hypothesis planner is a real Research provider dispatch, not a local
540
715
  * planning convenience. Keep its one bounded call on the same server-owned
@@ -552,6 +727,24 @@ export declare function createResearchHypothesisPlanningProvider(input: {
552
727
  request: AgentRunRequest;
553
728
  ledger?: ProviderDispatchEvidenceSink;
554
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;
555
748
  /**
556
749
  * Final physical generated-SQL boundary.
557
750
  *
@@ -572,6 +765,31 @@ export declare function executePreparedAgenticSqlBoundary<T>(input: {
572
765
  /** Internal harness injection; production obtains the request-local observer. */
573
766
  traceObserver?: AskTraceObserverV1;
574
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;
575
793
  export declare function startLocalServer(opts: LocalServerOptions): Promise<number>;
576
794
  export declare function assertLocalQueryRuntimeReady(executor: QueryExecutor, connection: ConnectionConfig): Promise<void>;
577
795
  export declare function formatLocalQueryRuntimeError(connection: ConnectionConfig, error: unknown): string;
@@ -882,6 +1100,41 @@ export declare function generateSemanticCompostingDrafts(projectRoot: string, ca
882
1100
  limit?: number;
883
1101
  owner?: string;
884
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
+ };
885
1138
  /**
886
1139
  * Opaque browser-cache identity for local Ask conversations. A browser origin
887
1140
  * is not a project boundary: a user can stop one `dql notebook` process and
@@ -1458,6 +1711,20 @@ export declare function parseBlockSourceMetadata(source: string): {
1458
1711
  */
1459
1712
  export declare function markBlockStudioSourceReusable(source: string): string;
1460
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>;
1461
1728
  export declare function buildConversationContextRecap(context: Record<string, unknown> | undefined): string | undefined;
1462
1729
  /**
1463
1730
  * Explain the latest successful answer from its persisted artifact contract.
@@ -1517,6 +1784,19 @@ export declare function createSemanticBuilderBlock(projectRoot: string, options:
1517
1784
  content: string;
1518
1785
  companionPath: string;
1519
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;
1520
1800
  export declare function discoverDbtProfileConnections(projectRoot: string, projectConfig: ProjectConfig, explicitPath?: string): DbtProfileConnectionCandidate[];
1521
1801
  export declare function buildDbtParseArgs(dbtProjectDir: string, profilesDir?: string): string[];
1522
1802
  /** CFG-003: use a complete default dbt target when no saved DQL connection exists. */
@@ -1718,6 +1998,14 @@ export interface ResearchBranchReceiptV1 {
1718
1998
  stopReason: ResearchBranchStopReasonV1;
1719
1999
  /** Present for an admitted child; skipped children never start provider/SQL work. */
1720
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'];
1721
2009
  }
1722
2010
  /**
1723
2011
  * Fair-share one child deadline from the remaining root time. The formula is
@@ -1879,14 +2167,75 @@ export interface AgentRuntimeValueGroundingPolicy {
1879
2167
  mode: 'disabled' | 'safe_automatic';
1880
2168
  searchSafeColumns: ReadonlySet<string>;
1881
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";
1882
2176
  /**
1883
2177
  * Resolve the project-admin boundary for live value lookup. An absent/malformed
1884
2178
  * policy is deliberately disabled; a broad table or wildcard cannot make an
1885
2179
  * unknown column search-safe.
1886
2180
  */
1887
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;
1888
2206
  export declare function isAgentValueProbeColumn(column: AgentSchemaTable['columns'][number]): boolean;
1889
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;
1890
2239
  export declare function extractAgentValueSearchTerms(question: string): string[];
1891
2240
  export {};
1892
2241
  //# sourceMappingURL=local-runtime.d.ts.map