@dataflint/mcp-server 1.0.21 → 1.0.32

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 (34) hide show
  1. package/dist/auth/secrets/aws-secrets-provider.js +1 -1
  2. package/dist/auth/secrets/aws-secrets-provider.js.map +1 -1
  3. package/dist/dataflint-server-models.d.ts +747 -25
  4. package/dist/dataflint-server-models.d.ts.map +1 -1
  5. package/dist/dataflint-server-service.d.ts +20 -4
  6. package/dist/dataflint-server-service.d.ts.map +1 -1
  7. package/dist/dataflint-server-service.js +76 -9
  8. package/dist/dataflint-server-service.js.map +1 -1
  9. package/dist/standalone/config.js +1 -1
  10. package/dist/standalone/config.js.map +1 -1
  11. package/dist/tools/constants.d.ts +3 -0
  12. package/dist/tools/constants.d.ts.map +1 -1
  13. package/dist/tools/constants.js +5 -1
  14. package/dist/tools/constants.js.map +1 -1
  15. package/dist/tools/core-tools.js +56 -41
  16. package/dist/tools/core-tools.js.map +1 -1
  17. package/dist/tools/expertise-tools.js +16 -8
  18. package/dist/tools/expertise-tools.js.map +1 -1
  19. package/dist/tools/highlight-tools.js +2 -2
  20. package/dist/tools/highlight-tools.js.map +1 -1
  21. package/dist/tools/index.d.ts.map +1 -1
  22. package/dist/tools/index.js +2 -0
  23. package/dist/tools/index.js.map +1 -1
  24. package/dist/tools/listing-tools.js +15 -7
  25. package/dist/tools/listing-tools.js.map +1 -1
  26. package/dist/tools/schemas.d.ts +1 -0
  27. package/dist/tools/schemas.d.ts.map +1 -1
  28. package/dist/tools/schemas.js +8 -1
  29. package/dist/tools/schemas.js.map +1 -1
  30. package/dist/tools/workflow-tools.d.ts +6 -0
  31. package/dist/tools/workflow-tools.d.ts.map +1 -0
  32. package/dist/tools/workflow-tools.js +187 -0
  33. package/dist/tools/workflow-tools.js.map +1 -0
  34. package/package.json +4 -4
@@ -43,6 +43,7 @@ export interface OpportunityDetail {
43
43
  opportunity_type: string;
44
44
  expected_reduction_percentage?: number;
45
45
  description?: string;
46
+ impact_value?: number | null;
46
47
  }
47
48
  /**
48
49
  * Recommendation with implementation details
@@ -99,6 +100,8 @@ export interface DataFlintPromptMetadata {
99
100
  export interface DataFlintPromptsResponse {
100
101
  system_prompt: string;
101
102
  api_prompts: Array<Prompt>;
103
+ /** Versioning metadata — present when server supports the versioning protocol. */
104
+ _meta?: VersioningMeta;
102
105
  }
103
106
  /**
104
107
  * Service status information
@@ -146,7 +149,7 @@ export type FindingStatus = "active" | "dismissed" | "applied" | "stale";
146
149
  * Legacy values: simple/moderate/complex (deprecated)
147
150
  */
148
151
  export type FixComplexity = "XS" | "S" | "M" | "L" | "XL" | "simple" | "moderate" | "complex";
149
- export type SortBy = "opportunities" | "cost" | "latest_job_alert_count" | "duration_ms" | "idle_cores_ratio" | "start_time";
152
+ export type SortBy = "opportunities" | "cost" | "total_cost" | "latest_job_alert_count" | "duration_ms" | "avgDuration" | "idle_cores_ratio" | "start_time" | "run_count" | "name" | "last_updated" | "last_job_status" | "team" | "domain" | "env" | "platform";
150
153
  export type TimeFilter = "all" | "quarter" | "month" | "week" | "1 day" | "6 hours" | "1 hour";
151
154
  export type HighlightSeverity = "critical" | "warning" | "info";
152
155
  export type RemapReason = "content_changed" | "user_request" | "file_renamed";
@@ -161,6 +164,7 @@ export interface CopilotApplicationRichResponse {
161
164
  team: string | null;
162
165
  domain: string | null;
163
166
  platform: string | null;
167
+ is_streaming?: boolean | null;
164
168
  last_updated: string;
165
169
  last_job_status: JobStatus | null;
166
170
  last_job_duration_ms: number | null;
@@ -172,6 +176,27 @@ export interface CopilotApplicationRichResponse {
172
176
  duration_opportunity: number | null;
173
177
  workflow_name: string | null;
174
178
  latest_job_id: number | null;
179
+ /** Trigram similarity score (0.0–1.0), present when `search` param is used */
180
+ match_score?: number | null;
181
+ /** Server-constructed canonical URL to the latest run in the web dashboard */
182
+ dashboard_url?: string | null;
183
+ }
184
+ /**
185
+ * Metadata about the date range and pagination of retrieved data
186
+ */
187
+ export interface DateRangeMetadata {
188
+ time_period: string;
189
+ from_date: string;
190
+ to_date: string;
191
+ total_count: number;
192
+ returned_count: number;
193
+ }
194
+ /**
195
+ * Wrapper response for applications with date range metadata
196
+ */
197
+ export interface CopilotApplicationsResponse {
198
+ data_range: DateRangeMetadata;
199
+ applications: CopilotApplicationRichResponse[];
175
200
  }
176
201
  /**
177
202
  * Rich job response with comprehensive metadata
@@ -183,8 +208,8 @@ export interface CopilotJobRichResponse {
183
208
  start_time: string;
184
209
  end_time: string;
185
210
  duration_ms: number;
186
- history_server_url: string;
187
- env: string;
211
+ history_server_url: string | null;
212
+ env: string | null;
188
213
  team: string | null;
189
214
  domain: string | null;
190
215
  platform: string | null;
@@ -195,12 +220,12 @@ export interface CopilotJobRichResponse {
195
220
  cost_unit: string;
196
221
  infrastructure_cost: number | null;
197
222
  compute_cost: number | null;
198
- idle_cores_ratio: number;
199
- task_error_rate: number;
200
- container_memory_gb: number;
201
- executor_peak_memory_bytes: number;
202
- core_hour_usage: number;
203
- memory_gb_hour: number;
223
+ idle_cores_ratio: number | null;
224
+ task_error_rate: number | null;
225
+ container_memory_gb: number | null;
226
+ executor_peak_memory_bytes: number | null;
227
+ core_hour_usage: number | null;
228
+ memory_gb_hour: number | null;
204
229
  total_input_bytes: number;
205
230
  total_output_bytes: number;
206
231
  total_shuffle_read_bytes: number;
@@ -210,12 +235,19 @@ export interface CopilotJobRichResponse {
210
235
  duration_opportunity: number | null;
211
236
  workflow_run_id: string | null;
212
237
  workflow_name: string | null;
238
+ application_id: number | null;
239
+ application_name: string | null;
240
+ /** Cluster configuration (platform_details stripped in list endpoints) */
241
+ cluster?: CopilotClusterInfo | null;
242
+ /** Server-constructed canonical URL to this job in the web dashboard */
243
+ dashboard_url?: string | null;
213
244
  }
214
245
  /**
215
246
  * Query parameters for get_applications
216
247
  */
217
248
  export interface GetApplicationsParams {
218
249
  search?: string;
250
+ env?: string;
219
251
  team?: string;
220
252
  domain?: string;
221
253
  platform?: "databricks" | "emr";
@@ -225,10 +257,11 @@ export interface GetApplicationsParams {
225
257
  limit?: number;
226
258
  }
227
259
  /**
228
- * Query parameters for get_jobs_rich
260
+ * Query parameters for get_application_jobs (unified endpoint)
229
261
  */
230
- export interface GetJobsRichParams {
262
+ export interface GetApplicationJobsParams {
231
263
  application_id: number;
264
+ detail?: "full" | "minimal";
232
265
  time?: TimeFilter;
233
266
  limit?: number;
234
267
  }
@@ -261,8 +294,9 @@ export interface NodeContribution {
261
294
  sqlId: number;
262
295
  nodeId: number;
263
296
  nodeName: string;
264
- durationPct: number;
265
- metricsLine: string;
297
+ durationPctOfQuery: number;
298
+ durationPctOfJob: number;
299
+ metricsLine: string | null;
266
300
  code: string;
267
301
  queryStatus?: string;
268
302
  queryDescription?: string;
@@ -294,8 +328,26 @@ export interface AggregatedHighlight {
294
328
  hasFix?: boolean;
295
329
  /** Number of additional items beyond the top one */
296
330
  additionalCount?: number;
331
+ isActionTrigger?: boolean;
332
+ actionInfo?: {
333
+ actionSyntax?: string;
334
+ durationMs: number;
335
+ resourceDurationMs: number;
336
+ durationFormatted: string;
337
+ resourceDurationFormatted: string;
338
+ stageCount: number;
339
+ metricsLine: string;
340
+ };
297
341
  combinedMetrics: string;
298
342
  contributions: NodeContribution[];
343
+ alerts?: Array<{
344
+ name: string;
345
+ title: string;
346
+ message: string;
347
+ severity: string;
348
+ suggestions?: string;
349
+ nodeIds?: number[];
350
+ }>;
299
351
  }
300
352
  /**
301
353
  * Response from highlight endpoints
@@ -312,15 +364,134 @@ export interface HighlightResponse {
312
364
  */
313
365
  history_server_url?: string;
314
366
  }
367
+ /**
368
+ * Pinpoints issue in source code.
369
+ * Maps to SHS /dataflint/code/combined endpoint.
370
+ *
371
+ * Privacy: The `code_snippet` field is controlled by privacy.sendSourceCode
372
+ * setting (default: false). When enabled, code is automatically obfuscated
373
+ * (variables→v1, strings→"str_1") before transmission. If obfuscation is
374
+ * unavailable, code is NOT sent (privacy-first).
375
+ */
376
+ export interface CodeLocation {
377
+ /** Source file path (e.g., "etl.py") - always sent */
378
+ file: string;
379
+ /** Line number in source file (1-indexed) - always sent */
380
+ line: number;
381
+ /** Index in code/combined mapping (for ?map= parameter) - always sent */
382
+ mapping_index?: number;
383
+ /** The actual code line or snippet - PRIVACY CONTROLLED: obfuscated or stripped */
384
+ code_snippet?: string;
385
+ }
386
+ /**
387
+ * Pinpoints issue in Spark execution plan.
388
+ * Maps to SHS /dataflint/plan/enriched/json endpoint.
389
+ */
390
+ export interface PlanLocation {
391
+ /** Human-readable operator name (e.g., "Read parquet") */
392
+ node_name: string;
393
+ /** Spark operator class (e.g., "FileSourceScanExec") */
394
+ operator_type?: string;
395
+ /** Spark stage ID (-1 for pre-shuffle cluster) */
396
+ stage_id?: number;
397
+ /** Parent nodes in the execution DAG */
398
+ parent_node_ids?: number[];
399
+ }
400
+ /**
401
+ * Version and context for reproducibility.
402
+ * Helps track which version of analysis data was used.
403
+ */
404
+ export interface DataContext {
405
+ /** Codegen version string from SHS */
406
+ codegen_version?: string;
407
+ /** When the LLM analysis was performed (ISO 8601) */
408
+ analysis_timestamp?: string;
409
+ }
410
+ /**
411
+ * Legacy: Structured evidence supporting the finding.
412
+ * @deprecated Use evidence[] and reasoning_steps[] instead
413
+ */
414
+ export interface ReasoningEvidence {
415
+ /** Key metrics (e.g., { duration_pct: 45.5, rows: "1.2M" }) */
416
+ metrics_observed?: Record<string, unknown>;
417
+ /** Pattern identifier (e.g., "sequential_read_anti_pattern") */
418
+ pattern_detected?: string;
419
+ /** Factors contributing to confidence score */
420
+ confidence_factors?: string[];
421
+ }
422
+ /**
423
+ * Evidence entry - metrics examined with source path and actual value
424
+ */
425
+ export interface EvidenceEntry {
426
+ /** Evidence type (e.g., "Partition count", "SerDe overhead") */
427
+ type: string;
428
+ /** Path in plan data (e.g., "executions[3].stages[12].timeBreakdown.serDeser") */
429
+ source: string;
430
+ /** Actual value observed (e.g., "53.2%", "10000 partitions") */
431
+ value: string;
432
+ }
433
+ /**
434
+ * Missing data entry - what would have helped the analysis
435
+ */
436
+ export interface MissingDataEntry {
437
+ /** What data was missing */
438
+ data: string;
439
+ /** Why it would help */
440
+ reason: string;
441
+ /** Impact level */
442
+ impact: "low" | "medium" | "high";
443
+ }
444
+ /**
445
+ * Source location for code pinpointing
446
+ */
447
+ export interface SourceLocation {
448
+ /** Source file path (e.g., "etl.py") */
449
+ file: string;
450
+ /** Line number (1-indexed) */
451
+ line: number;
452
+ /** Code snippet - PRIVACY CONTROLLED */
453
+ snippet?: string;
454
+ /** Index in code/combined mapping */
455
+ mapping_index?: number;
456
+ }
457
+ /**
458
+ * Fix option with complexity and impact
459
+ */
460
+ export interface FixOption {
461
+ /** What to do (e.g., "Reduce partitions to 50") */
462
+ description: string;
463
+ /** Implementation effort */
464
+ complexity: "XS" | "S" | "M" | "L" | "XL";
465
+ /** Expected improvement (e.g., "3 min faster") */
466
+ impact: string;
467
+ /** Example code - PRIVACY CONTROLLED */
468
+ code_example?: string;
469
+ }
470
+ /**
471
+ * Related node with relationship type
472
+ */
473
+ export interface RelatedNode {
474
+ /** SQL query ID */
475
+ sql_id: number;
476
+ /** Node ID */
477
+ node_id: number;
478
+ /** Relationship type */
479
+ relationship: "causes" | "executes" | "reads_from" | "writes_to" | "depends_on";
480
+ }
481
+ /**
482
+ * Downstream impact entry
483
+ */
484
+ export interface DownstreamImpact {
485
+ /** Affected SQL query ID */
486
+ sql_id: number;
487
+ /** How it's affected */
488
+ impact: string;
489
+ }
315
490
  /**
316
491
  * LLM-identified finding for submission
317
492
  *
318
- * Aligned with SHS Alert structure:
319
- * - title: Short display (like Alert.title)
320
- * - message: Detailed explanation (like Alert.message)
321
- * - type/severity: critical/warning/hint/insight/context
322
- * - suggestion: What to do (like Alert.suggestions)
323
- * - fix_complexity: XS/S/M/L/XL (like Alert.easeOfImplementation)
493
+ * Rich evidence structure aligned with Analysis Reports.
494
+ * Server enriches with SHS visualization URLs.
324
495
  */
325
496
  export interface LLMFinding {
326
497
  node_id: number;
@@ -328,11 +499,33 @@ export interface LLMFinding {
328
499
  title: string;
329
500
  message?: string;
330
501
  confidence: number;
502
+ /** Evidence examined: metrics with paths and actual values */
503
+ evidence?: EvidenceEntry[];
504
+ /** Reasoning steps: calculations, threshold comparisons */
505
+ reasoning_steps?: string[];
506
+ /** What data would have helped the analysis */
507
+ missing_data?: MissingDataEntry[];
508
+ /** Source code locations (array for multi-location findings) */
509
+ source_locations?: SourceLocation[];
510
+ /** Spark plan pinpointing */
511
+ plan_location?: PlanLocation;
512
+ /** Multiple fix options with complexity and impact */
513
+ fix_options?: FixOption[];
331
514
  suggestion?: string;
332
515
  code_snippet?: string;
333
516
  fix_complexity?: FixComplexity;
334
517
  estimated_impact?: string;
518
+ /** Related nodes with relationship type */
519
+ related_nodes?: RelatedNode[];
520
+ /** Downstream queries impacted */
521
+ downstream_impact?: DownstreamImpact[];
335
522
  related_node_ids?: number[];
523
+ /** @deprecated Use source_locations[] instead */
524
+ code_location?: CodeLocation;
525
+ /** @deprecated */
526
+ data_context?: DataContext;
527
+ /** @deprecated Use evidence[] and reasoning_steps[] instead */
528
+ reasoning?: ReasoningEvidence;
336
529
  }
337
530
  /**
338
531
  * Request body for submit_highlight_findings
@@ -357,6 +550,8 @@ export interface FindingsResponse {
357
550
  stored_count: number;
358
551
  skipped_count: number;
359
552
  updated_metrics: UpdatedMetric[];
553
+ /** Server-assigned IDs for persisted findings. Used to link findings to analysis reports. */
554
+ finding_ids?: number[];
360
555
  }
361
556
  /**
362
557
  * Response from clear_highlights
@@ -475,17 +670,19 @@ export interface MultiNodeFindingsResponse {
475
670
  * Spark expertise document section
476
671
  */
477
672
  export interface ExpertiseDocSection {
478
- title: string;
479
- content: string;
673
+ file: string;
674
+ section: string;
480
675
  }
481
676
  /**
482
677
  * Response from get_spark_expertise
483
678
  */
484
679
  export interface SparkExpertiseResponse {
485
680
  topic: string;
681
+ title: string;
486
682
  quick_advice: string;
487
683
  trigger_patterns: string[];
488
684
  doc_sections?: ExpertiseDocSection[];
685
+ doc_content?: string | null;
489
686
  }
490
687
  /**
491
688
  * Individual expertise topic info
@@ -503,7 +700,7 @@ export interface ExpertiseTopicsResponse {
503
700
  /**
504
701
  * Available prompt layers
505
702
  */
506
- export type PromptLayerType = "core" | "analysis" | "highlight" | "optimize" | "app_analysis";
703
+ export type PromptLayerType = "core" | "analysis" | "streaming" | "highlight" | "highlight_streaming" | "optimize" | "app_analysis";
507
704
  /**
508
705
  * Response from get_prompt_layer
509
706
  */
@@ -591,6 +788,75 @@ export type IssueType = "incorrect_data" | "misplaced" | "both" | "other";
591
788
  * Issue severity level
592
789
  */
593
790
  export type IssueSeverity = "low" | "medium" | "high" | "critical";
791
+ /**
792
+ * Level at which issue is reported
793
+ */
794
+ export type IssueLevel = "job" | "application" | "workflow_run";
795
+ /**
796
+ * Job and workflow context for issue reports
797
+ */
798
+ export interface IssueReportJobContext {
799
+ run_id?: string;
800
+ spark_app_id?: string;
801
+ application_id?: number;
802
+ application_name?: string;
803
+ workflow_run_id?: string;
804
+ workflow_name?: string;
805
+ platform?: string;
806
+ env?: string;
807
+ team?: string;
808
+ domain?: string;
809
+ history_server_url?: string;
810
+ customer_id?: string;
811
+ }
812
+ /**
813
+ * Code location for pinpointing (aligned with LLM Findings)
814
+ */
815
+ export interface IssueReportCodeLocation {
816
+ file: string;
817
+ line: number;
818
+ /** Index in code/combined mapping (for SHS ?map= parameter) */
819
+ mapping_index?: number;
820
+ /** Obfuscated code snippet */
821
+ code_snippet?: string;
822
+ }
823
+ /**
824
+ * Plan location for pinpointing (aligned with LLM Findings)
825
+ */
826
+ export interface IssueReportPlanLocation {
827
+ /** Human-readable operator name (e.g., 'Read parquet', 'HashAggregate') */
828
+ node_name?: string;
829
+ /** Spark operator class (e.g., 'FileSourceScanExec') */
830
+ operator_type?: string;
831
+ /** Spark stage ID */
832
+ stage_id?: number;
833
+ /** Parent nodes in the execution DAG */
834
+ parent_node_ids?: number[];
835
+ }
836
+ /**
837
+ * Data context for version tracking (aligned with LLM Findings)
838
+ */
839
+ export interface IssueReportDataContext {
840
+ /** Codegen version from SHS */
841
+ codegen_version?: string;
842
+ /** Hash of code/mapping data for tracking file state changes */
843
+ mapping_hash?: string;
844
+ /** When the analysis was performed (ISO 8601) */
845
+ analysis_timestamp?: string;
846
+ /** Path to .data.json.gz file */
847
+ data_file?: string;
848
+ }
849
+ /**
850
+ * Highlight contribution for multi-operation highlights
851
+ */
852
+ export interface IssueReportHighlightContribution {
853
+ sql_id: number;
854
+ node_id: number;
855
+ node_name?: string;
856
+ duration_pct?: number;
857
+ metrics_line?: string;
858
+ query_prefix?: string;
859
+ }
594
860
  /**
595
861
  * Issue type option from server metadata
596
862
  */
@@ -619,11 +885,20 @@ export interface DataSharingOption {
619
885
  default_checked?: boolean;
620
886
  }
621
887
  /**
622
- * Response from GET /api/copilot/issue-report/metadata
888
+ * Issue level option from server metadata
889
+ */
890
+ export interface IssueLevelOption {
891
+ value: IssueLevel;
892
+ label: string;
893
+ description: string;
894
+ }
895
+ /**
896
+ * Response from GET /api/copilot/extension/issue-report/metadata
623
897
  */
624
898
  export interface IssueReportMetadataResponse {
625
899
  issue_types: IssueTypeOption[];
626
900
  severity_levels: SeverityLevelOption[];
901
+ issue_levels?: IssueLevelOption[];
627
902
  privacy_notice: string;
628
903
  data_sharing_options: DataSharingOption[];
629
904
  }
@@ -655,11 +930,27 @@ export interface IssueReportHighlightContext {
655
930
  is_hotspot: boolean;
656
931
  severity?: string;
657
932
  query_prefix?: string;
933
+ /** Deep link URL path (e.g., "/graph/?sqlid=2&nodeids=8,10") */
934
+ deep_link_url?: string;
935
+ /** Individual contributions for multi-operation highlights */
936
+ contributions?: IssueReportHighlightContribution[];
937
+ /** Alert count for context */
938
+ alert_count?: number;
939
+ /** Finding count for context */
940
+ finding_count?: number;
658
941
  }
659
942
  /**
660
- * Request body for POST /api/copilot/highlights/{job_id}/report-issue
943
+ * Request body for POST /api/copilot/extension/highlights/{job_id}/report-issue
661
944
  */
662
945
  export interface IssueReportRequest {
946
+ /** Level at which issue is reported (defaults to "job") */
947
+ issue_level?: IssueLevel;
948
+ /** Job ID (for job-level issues, injected from path param) */
949
+ job_id?: number;
950
+ /** Application ID (for application-level issues) */
951
+ application_id?: number;
952
+ /** Workflow run ID (for workflow-level issues) */
953
+ workflow_run_id?: number;
663
954
  issue_type: IssueType;
664
955
  highlight: IssueReportHighlightContext;
665
956
  severity?: IssueSeverity;
@@ -670,11 +961,21 @@ export interface IssueReportRequest {
670
961
  obfuscated_code?: ObfuscatedCodeContext;
671
962
  /** Reason why code was not included (if user opted in but obfuscation failed) */
672
963
  code_omission_reason?: string;
964
+ /** Job, application, and workflow context metadata */
965
+ job_context?: IssueReportJobContext;
966
+ /** Source code pinpointing (file, line, mapping index for SHS ?map= param) */
967
+ code_location?: IssueReportCodeLocation;
968
+ /** Spark plan pinpointing (node name, operator type, stage) */
969
+ plan_location?: IssueReportPlanLocation;
970
+ /** Analysis version context for reproducibility */
971
+ data_context?: IssueReportDataContext;
673
972
  extension_version?: string;
674
973
  editor_type?: "vscode" | "cursor";
974
+ /** LLM model used during session (also sent via X-DF-LLM-MODEL header) */
975
+ llm_model?: string;
675
976
  }
676
977
  /**
677
- * Response from POST /api/copilot/highlights/{job_id}/report-issue
978
+ * Response from POST /api/copilot/extension/highlights/{job_id}/report-issue
678
979
  */
679
980
  export interface IssueReportResponse {
680
981
  report_id: string;
@@ -682,4 +983,425 @@ export interface IssueReportResponse {
682
983
  message: string;
683
984
  created_at: string;
684
985
  }
986
+ /**
987
+ * Platform-agnostic cluster representation for LLM analysis.
988
+ * Common fields are normalized across Databricks, EMR, and Dataproc.
989
+ * `platform_details` is stripped in list endpoints to save tokens.
990
+ */
991
+ export interface CopilotClusterInfo {
992
+ cluster_id: string;
993
+ platform: string;
994
+ worker_instance_type: string | null;
995
+ driver_instance_type: string | null;
996
+ num_workers: number | null;
997
+ autoscaling_enabled: boolean;
998
+ min_workers: number | null;
999
+ max_workers: number | null;
1000
+ spot_enabled: boolean | null;
1001
+ spot_bid_percent: number | null;
1002
+ runtime_version: string | null;
1003
+ cluster_url: string | null;
1004
+ total_cost_usd: number | null;
1005
+ infrastructure_cost_usd: number | null;
1006
+ compute_cost_usd: number | null;
1007
+ platform_details: Record<string, unknown> | null;
1008
+ }
1009
+ export type WorkflowSortBy = "cost" | "opportunities" | "dag_runs_count" | "avg_execution_duration" | "last_updated_job_execution" | "workflow_name" | "dag_id" | "status" | "team" | "domain" | "env" | "platform";
1010
+ export type WorkflowRunSortBy = "started_at" | "cost" | "cost_percentile" | "opportunities" | "duration_ms" | "status" | "total_input_bytes" | "total_output_bytes";
1011
+ export type WorkflowPlatform = "databricks" | "emr" | "eks";
1012
+ /**
1013
+ * Rich workflow response with health and performance indicators.
1014
+ * Returned by GET /api/copilot/workflows
1015
+ */
1016
+ export interface CopilotWorkflowResponse {
1017
+ id: number;
1018
+ name: string | null;
1019
+ workflow_id: string;
1020
+ env: string | null;
1021
+ team: string | null;
1022
+ domain: string | null;
1023
+ platform: string | null;
1024
+ orchestrator_type: string | null;
1025
+ total_steps: number | null;
1026
+ is_active: boolean;
1027
+ last_run_status: string | null;
1028
+ last_run_at: string | null;
1029
+ run_count: number;
1030
+ avg_duration_ms: number | null;
1031
+ total_cost_usd: number | null;
1032
+ avg_cost_usd: number | null;
1033
+ total_opportunity_dollars: number | null;
1034
+ success_rate: number | null;
1035
+ avg_alert_count: number | null;
1036
+ /** Trigram similarity score (0.0–1.0), present when `search` param is used */
1037
+ match_score?: number | null;
1038
+ }
1039
+ /**
1040
+ * Minimal workflow run response (~100 tokens per run).
1041
+ * Returned by GET /api/copilot/workflow/runs?detail=minimal
1042
+ */
1043
+ export interface CopilotWorkflowRunMinimalResponse {
1044
+ id: number;
1045
+ dag_run_id: string | null;
1046
+ started_at: string | null;
1047
+ completed_at: string | null;
1048
+ duration_ms: number | null;
1049
+ status: string;
1050
+ workflow_id: number | null;
1051
+ workflow_name: string | null;
1052
+ }
1053
+ /**
1054
+ * Rich workflow run response for LLM analysis (~300 tokens per run).
1055
+ * Returned by GET /api/copilot/workflow/runs?detail=full
1056
+ */
1057
+ export interface CopilotWorkflowRunRichResponse extends CopilotWorkflowRunMinimalResponse {
1058
+ run_name: string | null;
1059
+ total_steps: number | null;
1060
+ completed_steps: number | null;
1061
+ failed_steps: number | null;
1062
+ completion_percentage: number | null;
1063
+ total_cost_usd: number | null;
1064
+ total_infrastructure_cost: number | null;
1065
+ total_compute_cost: number | null;
1066
+ total_opportunity_dollars: number | null;
1067
+ alert_count: number | null;
1068
+ error_message: string | null;
1069
+ trigger_type: string | null;
1070
+ /** Cluster details (one per unique cluster used in this run, platform_details stripped) */
1071
+ clusters?: CopilotClusterInfo[];
1072
+ }
1073
+ /**
1074
+ * A Spark job within a workflow run, bridging workflow context to job-level analysis.
1075
+ * Returned by GET /api/copilot/workflow/run/jobs
1076
+ */
1077
+ export interface CopilotWorkflowRunJobResponse {
1078
+ step_name: string | null;
1079
+ step_order: number | null;
1080
+ job_id: number | null;
1081
+ application_id: number | null;
1082
+ application_name: string | null;
1083
+ run_id: string | null;
1084
+ history_server_url: string | null;
1085
+ start_time: string | null;
1086
+ end_time: string | null;
1087
+ duration_ms: number | null;
1088
+ status: string | null;
1089
+ cost_usd: number | null;
1090
+ cost_opportunity_dollars: number | null;
1091
+ alert_count: number;
1092
+ idle_cores_ratio: number | null;
1093
+ total_spill_bytes: number | null;
1094
+ total_input_bytes: number | null;
1095
+ total_output_bytes: number | null;
1096
+ /** Cluster configuration (platform_details stripped) */
1097
+ cluster?: CopilotClusterInfo | null;
1098
+ /** Server-constructed canonical URL to this job run in the web dashboard */
1099
+ dashboard_url?: string | null;
1100
+ }
1101
+ /**
1102
+ * Query parameters for get_workflows
1103
+ */
1104
+ export interface GetWorkflowsParams {
1105
+ search?: string;
1106
+ team?: string;
1107
+ domain?: string;
1108
+ platform?: WorkflowPlatform;
1109
+ time?: TimeFilter;
1110
+ sort_by?: WorkflowSortBy;
1111
+ sort_direction?: "desc" | "asc";
1112
+ limit?: number;
1113
+ }
1114
+ /**
1115
+ * Query parameters for get_workflow_runs
1116
+ */
1117
+ export interface GetWorkflowRunsParams {
1118
+ workflow_id: number;
1119
+ detail?: "full" | "minimal";
1120
+ time?: TimeFilter;
1121
+ limit?: number;
1122
+ sort_by?: WorkflowRunSortBy;
1123
+ sort_direction?: "desc" | "asc";
1124
+ }
1125
+ /**
1126
+ * Query parameters for get_workflow_run_jobs
1127
+ */
1128
+ export interface GetWorkflowRunJobsParams {
1129
+ workflow_id: number;
1130
+ workflow_run_id: number;
1131
+ }
1132
+ /**
1133
+ * Trigger type for analysis report
1134
+ */
1135
+ export type AnalysisReportTriggerType = "explain" | "fix" | "analyze" | "optimize" | "highlight" | "ask";
1136
+ /**
1137
+ * Evidence entry from LLM analysis
1138
+ */
1139
+ export interface AnalysisReportEvidenceEntry {
1140
+ type: string;
1141
+ source: string;
1142
+ value: string;
1143
+ }
1144
+ /**
1145
+ * Missing data entry from LLM analysis
1146
+ */
1147
+ export interface AnalysisReportMissingEntry {
1148
+ data: string;
1149
+ reason: string;
1150
+ impact: "low" | "medium" | "high";
1151
+ }
1152
+ /**
1153
+ * Finding from LLM analysis report
1154
+ */
1155
+ export interface AnalysisReportFinding {
1156
+ number: number;
1157
+ title: string;
1158
+ evidence: AnalysisReportEvidenceEntry[];
1159
+ reasoning: string[];
1160
+ missing: AnalysisReportMissingEntry[];
1161
+ actions: string[];
1162
+ }
1163
+ /**
1164
+ * Context for what triggered the analysis
1165
+ */
1166
+ export interface AnalysisReportTriggerContext {
1167
+ sql_id?: number;
1168
+ node_id?: number;
1169
+ alert_type?: string;
1170
+ }
1171
+ /**
1172
+ * Summary statistics of the report
1173
+ */
1174
+ export interface AnalysisReportSummary {
1175
+ findings_count: number;
1176
+ evidence_count: number;
1177
+ missing_count: number;
1178
+ parse_errors: string[];
1179
+ }
1180
+ /**
1181
+ * Examined node entry - what was checked during analysis
1182
+ */
1183
+ export interface ExaminedNodeEntry {
1184
+ sql_id: number;
1185
+ node_id: number;
1186
+ what_checked: string;
1187
+ }
1188
+ /**
1189
+ * No-issue explanation - why a node was NOT flagged
1190
+ */
1191
+ export interface NoIssueExplanationEntry {
1192
+ sql_id: number;
1193
+ node_id: number;
1194
+ observation: string;
1195
+ why_ok: string;
1196
+ }
1197
+ /**
1198
+ * Cross-finding pattern - relationships between findings
1199
+ */
1200
+ export interface CrossFindingPatternEntry {
1201
+ finding_indices: number[];
1202
+ pattern: string;
1203
+ }
1204
+ /**
1205
+ * Request body for POST /api/copilot/platform/analysis-report
1206
+ *
1207
+ * IMPORTANT: Reports reference findings by ID, NOT by copying data.
1208
+ * Findings must be POSTed first to /findings, then IDs are included here.
1209
+ *
1210
+ * Report contains session-level analysis only:
1211
+ * - finding_ids (references to persisted findings)
1212
+ * - examined_nodes (what was checked)
1213
+ * - no_issue_explanations (why nodes were NOT flagged)
1214
+ * - overall_assessment (job-level summary)
1215
+ * - analysis_approach (what strategy was used)
1216
+ */
1217
+ export interface AnalysisReportPayload {
1218
+ job_id: number;
1219
+ trigger_type: AnalysisReportTriggerType;
1220
+ trigger_context?: AnalysisReportTriggerContext | null;
1221
+ finding_ids?: number[];
1222
+ examined_nodes?: ExaminedNodeEntry[];
1223
+ no_issue_explanations?: NoIssueExplanationEntry[];
1224
+ overall_assessment?: string;
1225
+ analysis_approach?: string;
1226
+ cross_finding_patterns?: CrossFindingPatternEntry[];
1227
+ /** LLM model used during session (also sent via X-DF-LLM-MODEL header) */
1228
+ llm_model?: string;
1229
+ report?: AnalysisReportSummary;
1230
+ parse_errors?: string[];
1231
+ timestamp?: string | null;
1232
+ /** Extension-side discovery audit trail (zero LLM involvement) */
1233
+ discovery_context?: DiscoveryContext;
1234
+ }
1235
+ /**
1236
+ * Extension-side discovery context tracking.
1237
+ *
1238
+ * Captures what the server cannot see:
1239
+ * - Whether a workspace context hint was injected
1240
+ * - Which fast path the session took
1241
+ * - The full sequence of discovery API calls with timing
1242
+ *
1243
+ * All collected with zero LLM involvement.
1244
+ */
1245
+ /**
1246
+ * Workspace hint from the scanner, included in discovery context.
1247
+ */
1248
+ export interface DiscoveryWorkspaceHint {
1249
+ app_hint: string | null;
1250
+ matched_app_id: number | null;
1251
+ matched_job_id: number | null;
1252
+ confidence: "PRE_MATCHED" | "HIGH" | "MEDIUM" | "LOW" | "NONE";
1253
+ source: string;
1254
+ }
1255
+ export interface DiscoveryContext {
1256
+ /** Workspace context from scanner (see WORKSPACE_CONTEXT_DETECTION.md) */
1257
+ workspace_hint?: DiscoveryWorkspaceHint;
1258
+ /** Which discovery fast path was used */
1259
+ fast_path_used: "workspace_context" | "latest_job_id" | "intent_job_id" | "standard";
1260
+ /** Chronological record of discovery API calls */
1261
+ discovery_calls: DiscoveryCall[];
1262
+ }
1263
+ /**
1264
+ * A single discovery API call record.
1265
+ */
1266
+ export interface DiscoveryCall {
1267
+ tool: "get_applications" | "get_application_jobs";
1268
+ params: Record<string, unknown>;
1269
+ result_count: number;
1270
+ timestamp: string;
1271
+ }
1272
+ /**
1273
+ * Response from POST /api/copilot/platform/analysis-report
1274
+ *
1275
+ * Server uses smart upsert - repeated submissions for same session+job
1276
+ * are merged intelligently with audit trail.
1277
+ */
1278
+ export interface AnalysisReportResponse {
1279
+ id: number;
1280
+ report_id?: number;
1281
+ status: string;
1282
+ was_merged?: boolean;
1283
+ submission_count?: number;
1284
+ findings_count?: number;
1285
+ examined_count?: number;
1286
+ no_issues_count?: number;
1287
+ evidence_count?: number;
1288
+ missing_count?: number;
1289
+ }
1290
+ /**
1291
+ * A single copilot activity event.
1292
+ *
1293
+ * Tracks user interactions with the extension to understand
1294
+ * adoption, feature usage, and onboarding progression.
1295
+ */
1296
+ export interface CopilotActivityEvent {
1297
+ /** Event category: milestone reached, nudge shown/dismissed, feature used */
1298
+ event_type: "session_start" | "milestone_reached" | "interaction" | "nudge_shown" | "nudge_dismissed" | "walkthrough_opened" | "consent";
1299
+ /** Specific event identifier (e.g. milestone key, nudge ID) */
1300
+ event_name: string;
1301
+ /** ISO 8601 timestamp */
1302
+ timestamp: string;
1303
+ /** Additional event-specific metadata */
1304
+ metadata?: Record<string, unknown>;
1305
+ }
1306
+ /**
1307
+ * Request body for POST /api/copilot/extension/activity
1308
+ */
1309
+ export interface CopilotActivityPayload {
1310
+ /** Batch of activity events */
1311
+ events: CopilotActivityEvent[];
1312
+ /** Current session number (how many times the extension has activated) */
1313
+ session_count: number;
1314
+ /** Snapshot of reached milestones at time of submission */
1315
+ milestones: Record<string, boolean>;
1316
+ /** Extension version */
1317
+ extension_version?: string;
1318
+ /** IDE type (vscode, cursor) */
1319
+ ide_type?: string;
1320
+ }
1321
+ /**
1322
+ * Response from POST /api/copilot/extension/activity
1323
+ */
1324
+ export interface CopilotActivityResponse {
1325
+ status: string;
1326
+ events_received: number;
1327
+ }
1328
+ /**
1329
+ * Versioning metadata optionally returned by any server-managed config/prompt
1330
+ * endpoint. All fields are optional so older servers that predate this
1331
+ * protocol still produce a valid response.
1332
+ */
1333
+ export interface VersioningMeta {
1334
+ /** Server-side contract version for this payload (integer, monotonically increasing). */
1335
+ contract_version?: number;
1336
+ /** Minimum extension version required to consume this payload correctly (semver). */
1337
+ min_extension_version?: string;
1338
+ /** Human-readable deprecation notice for the current extension version. */
1339
+ deprecation_notice?: string;
1340
+ }
1341
+ /**
1342
+ * Server-managed tuning parameters for client behaviour.
1343
+ *
1344
+ * The server returns these inside `GET /api/copilot/extension/config` so that
1345
+ * retry budgets, polling intervals, and compression can be adjusted
1346
+ * without shipping a new extension version.
1347
+ *
1348
+ * Every field is optional — the extension falls back to built-in defaults
1349
+ * when a field is absent.
1350
+ */
1351
+ export interface ClientTuningConfig {
1352
+ /** Retry settings for transient-failure endpoints (job/plan, job/code). */
1353
+ retry?: {
1354
+ /** Max retry attempts (default: 25). */
1355
+ retries?: number;
1356
+ /** Exponential backoff multiplier (default: 2). */
1357
+ factor?: number;
1358
+ /** Initial retry delay in ms (default: 200). */
1359
+ min_timeout_ms?: number;
1360
+ /** Max retry delay cap in ms (default: 5000). */
1361
+ max_timeout_ms?: number;
1362
+ /** Add jitter to prevent thundering herd (default: true). */
1363
+ randomize?: boolean;
1364
+ };
1365
+ /** Request-level timeout in ms (default: 30 000). */
1366
+ request_timeout_ms?: number;
1367
+ /** Activity reporter flush interval in ms (default: 60 000). */
1368
+ activity_flush_interval_ms?: number;
1369
+ /** Background workspace sync interval in ms (default: 300 000). */
1370
+ background_sync_interval_ms?: number;
1371
+ /** Mapping panel background refresh interval in ms (default: 300 000). */
1372
+ mapping_refresh_interval_ms?: number;
1373
+ /** Mapping panel staleness threshold in ms (default: 120 000). */
1374
+ mapping_stale_threshold_ms?: number;
1375
+ }
1376
+ /**
1377
+ * Response from GET /api/copilot/extension/prompt-templates
1378
+ * Contains server-managed LLM instructional text (roles, tools, quick start)
1379
+ * that the extension injects into AI sessions via placeholder substitution.
1380
+ */
1381
+ export interface PromptTemplatesResponse {
1382
+ version: string;
1383
+ expert_sessions: {
1384
+ roles: Record<string, string>;
1385
+ analysis_levels: Record<string, string>;
1386
+ critical_first_step: string;
1387
+ tools_available: Record<string, string>;
1388
+ quick_start: Record<string, {
1389
+ job_level: string;
1390
+ app_level: string;
1391
+ }>;
1392
+ };
1393
+ _meta?: VersioningMeta;
1394
+ }
1395
+ /**
1396
+ * Response from GET /api/copilot/extension/config
1397
+ * Contains server-managed URL templates for all extension CTAs.
1398
+ */
1399
+ export interface CopilotConfigResponse {
1400
+ version: string;
1401
+ urls: Record<string, string>;
1402
+ /** Server-managed tuning for client behaviour (retry, intervals, compression). */
1403
+ client_tuning?: ClientTuningConfig;
1404
+ /** Versioning metadata — present when server supports the versioning protocol. */
1405
+ _meta?: VersioningMeta;
1406
+ }
685
1407
  //# sourceMappingURL=dataflint-server-models.d.ts.map