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