@xpert-ai/plugin-live-dashboard 0.4.0 → 0.5.0

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 (55) hide show
  1. package/.xpertai-plugin/plugin.json +1 -1
  2. package/README.md +4 -0
  3. package/dist/lib/agent.schema.d.ts +179 -25
  4. package/dist/lib/agent.schema.js +10 -9
  5. package/dist/lib/archive.service.d.ts +145 -0
  6. package/dist/lib/archive.service.js +133 -0
  7. package/dist/lib/content.provider.d.ts +1 -1
  8. package/dist/lib/dashboard-archive.d.ts +70 -0
  9. package/dist/lib/dashboard-archive.js +118 -0
  10. package/dist/lib/dashboard-sources.d.ts +69 -0
  11. package/dist/lib/dashboard-sources.js +37 -0
  12. package/dist/lib/dashboard-view.schema.d.ts +503 -88
  13. package/dist/lib/dashboard-view.schema.js +2 -1
  14. package/dist/lib/dashboard.schema.d.ts +379 -58
  15. package/dist/lib/dashboard.schema.js +18 -1
  16. package/dist/lib/dashboard.service.d.ts +72 -17
  17. package/dist/lib/dashboard.service.js +21 -3
  18. package/dist/lib/document-package.d.ts +19 -4
  19. package/dist/lib/editing-patch.d.ts +3 -0
  20. package/dist/lib/editing-patch.js +2 -1
  21. package/dist/lib/editing-session.d.ts +4 -4
  22. package/dist/lib/editing.d.ts +202 -19
  23. package/dist/lib/editing.js +5 -2
  24. package/dist/lib/html-validation-feedback.d.ts +7 -0
  25. package/dist/lib/html-validation-feedback.js +19 -0
  26. package/dist/lib/html-validation.js +2 -1
  27. package/dist/lib/inspection-host.d.ts +7 -0
  28. package/dist/lib/inspection-host.js +48 -0
  29. package/dist/lib/inspection-runtime.d.ts +2 -0
  30. package/dist/lib/inspection-runtime.js +77 -0
  31. package/dist/lib/json-input.d.ts +4 -0
  32. package/dist/lib/json-input.js +21 -0
  33. package/dist/lib/middleware.js +3 -2
  34. package/dist/lib/plugin.js +2 -1
  35. package/dist/lib/presentation.provider.d.ts +24 -9
  36. package/dist/lib/presentation.provider.js +2 -1
  37. package/dist/lib/projects.schema.d.ts +14 -0
  38. package/dist/lib/projects.schema.js +2 -1
  39. package/dist/lib/projects.service.d.ts +2 -0
  40. package/dist/lib/projects.service.js +10 -0
  41. package/dist/lib/source-executions.d.ts +196 -0
  42. package/dist/lib/source-executions.js +25 -0
  43. package/dist/lib/source-validation.d.ts +2 -0
  44. package/dist/lib/source-validation.js +21 -0
  45. package/dist/lib/view.provider.d.ts +211 -12
  46. package/dist/lib/view.provider.js +43 -9
  47. package/dist/remote/app.css +1 -1
  48. package/dist/remote/app.js +99 -26
  49. package/dist/remote/build-manifest.json +42 -27
  50. package/docs/docs.json +3 -1
  51. package/docs/sources-inspect-portability-acceptance.mdx +67 -0
  52. package/docs/sources-inspect-portability.mdx +115 -0
  53. package/package.json +6 -5
  54. package/skills/live-dashboard/SKILL.md +5 -4
  55. package/skills/live-dashboard/references/source-inspection.md +17 -0
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xpert-ai/plugin-live-dashboard",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "level": "system",
5
5
  "artifactNamespace": "live_dashboard",
6
6
  "sandboxActions": "./dist/sandbox-actions/action.json",
package/README.md CHANGED
@@ -4,6 +4,10 @@ System plugin `@xpert-ai/plugin-live-dashboard`: versioned live dashboards using
4
4
 
5
5
  See [implementation and installed-runtime acceptance](docs/acceptance.md) and [one-sentence Agent acceptance](docs/agent-acceptance.md). `examples/` contains equivalent PostgreSQL and data-xpert bindings for the same chart.
6
6
 
7
+ Sources, component Inspect and portable dashboard archives are tracked in the
8
+ [feature guide](docs/sources-inspect-portability.mdx) and
9
+ [current acceptance record](docs/sources-inspect-portability-acceptance.mdx).
10
+
7
11
  ## Ownership and flow
8
12
 
9
13
  ```text
@@ -15,6 +15,7 @@ export declare const discoverToolSchema: z.ZodObject<{
15
15
  }>;
16
16
  export declare const agentBindingSchema: z.ZodObject<{
17
17
  source: z.ZodType<import("@xpert-ai/contracts").AnalyticsSourceRef, z.ZodTypeDef, import("@xpert-ai/contracts").AnalyticsSourceRef>;
18
+ providerId: z.ZodString;
18
19
  output: z.ZodObject<{
19
20
  datasetId: z.ZodString;
20
21
  fields: z.ZodArray<z.ZodObject<{
@@ -73,7 +74,6 @@ export declare const agentBindingSchema: z.ZodObject<{
73
74
  }[];
74
75
  grain?: string[];
75
76
  }>;
76
- providerId: z.ZodString;
77
77
  } & {
78
78
  parameters: z.ZodArray<z.ZodObject<Omit<{
79
79
  name: z.ZodString;
@@ -98,6 +98,7 @@ export declare const agentBindingSchema: z.ZodObject<{
98
98
  payloadJson: z.ZodString;
99
99
  }, "strict", z.ZodTypeAny, {
100
100
  source: import("@xpert-ai/contracts").AnalyticsSourceRef;
101
+ providerId: string;
101
102
  output: {
102
103
  datasetId?: string;
103
104
  fields?: {
@@ -119,10 +120,10 @@ export declare const agentBindingSchema: z.ZodObject<{
119
120
  defaultValue?: string | number | boolean | null | undefined;
120
121
  allowedValues?: (string | number | boolean | null)[] | undefined;
121
122
  }[];
122
- providerId: string;
123
123
  payloadJson: string;
124
124
  }, {
125
125
  source: import("@xpert-ai/contracts").AnalyticsSourceRef;
126
+ providerId: string;
126
127
  output: {
127
128
  datasetId?: string;
128
129
  fields?: {
@@ -144,12 +145,12 @@ export declare const agentBindingSchema: z.ZodObject<{
144
145
  defaultValue?: string | number | boolean | null | undefined;
145
146
  allowedValues?: (string | number | boolean | null)[] | undefined;
146
147
  }[];
147
- providerId: string;
148
148
  payloadJson: string;
149
149
  }>;
150
150
  export declare const previewToolSchema: z.ZodObject<{
151
151
  binding: z.ZodObject<{
152
152
  source: z.ZodType<import("@xpert-ai/contracts").AnalyticsSourceRef, z.ZodTypeDef, import("@xpert-ai/contracts").AnalyticsSourceRef>;
153
+ providerId: z.ZodString;
153
154
  output: z.ZodObject<{
154
155
  datasetId: z.ZodString;
155
156
  fields: z.ZodArray<z.ZodObject<{
@@ -208,7 +209,6 @@ export declare const previewToolSchema: z.ZodObject<{
208
209
  }[];
209
210
  grain?: string[];
210
211
  }>;
211
- providerId: z.ZodString;
212
212
  } & {
213
213
  parameters: z.ZodArray<z.ZodObject<Omit<{
214
214
  name: z.ZodString;
@@ -233,6 +233,7 @@ export declare const previewToolSchema: z.ZodObject<{
233
233
  payloadJson: z.ZodString;
234
234
  }, "strict", z.ZodTypeAny, {
235
235
  source: import("@xpert-ai/contracts").AnalyticsSourceRef;
236
+ providerId: string;
236
237
  output: {
237
238
  datasetId?: string;
238
239
  fields?: {
@@ -254,10 +255,10 @@ export declare const previewToolSchema: z.ZodObject<{
254
255
  defaultValue?: string | number | boolean | null | undefined;
255
256
  allowedValues?: (string | number | boolean | null)[] | undefined;
256
257
  }[];
257
- providerId: string;
258
258
  payloadJson: string;
259
259
  }, {
260
260
  source: import("@xpert-ai/contracts").AnalyticsSourceRef;
261
+ providerId: string;
261
262
  output: {
262
263
  datasetId?: string;
263
264
  fields?: {
@@ -279,12 +280,12 @@ export declare const previewToolSchema: z.ZodObject<{
279
280
  defaultValue?: string | number | boolean | null | undefined;
280
281
  allowedValues?: (string | number | boolean | null)[] | undefined;
281
282
  }[];
282
- providerId: string;
283
283
  payloadJson: string;
284
284
  }>;
285
285
  }, "strict", z.ZodTypeAny, {
286
286
  binding: {
287
287
  source: import("@xpert-ai/contracts").AnalyticsSourceRef;
288
+ providerId: string;
288
289
  output: {
289
290
  datasetId?: string;
290
291
  fields?: {
@@ -306,12 +307,12 @@ export declare const previewToolSchema: z.ZodObject<{
306
307
  defaultValue?: string | number | boolean | null | undefined;
307
308
  allowedValues?: (string | number | boolean | null)[] | undefined;
308
309
  }[];
309
- providerId: string;
310
310
  payloadJson: string;
311
311
  };
312
312
  }, {
313
313
  binding: {
314
314
  source: import("@xpert-ai/contracts").AnalyticsSourceRef;
315
+ providerId: string;
315
316
  output: {
316
317
  datasetId?: string;
317
318
  fields?: {
@@ -333,7 +334,6 @@ export declare const previewToolSchema: z.ZodObject<{
333
334
  defaultValue?: string | number | boolean | null | undefined;
334
335
  allowedValues?: (string | number | boolean | null)[] | undefined;
335
336
  }[];
336
- providerId: string;
337
337
  payloadJson: string;
338
338
  };
339
339
  }>;
@@ -376,25 +376,25 @@ export declare const createToolSchema: z.ZodObject<{} & {
376
376
  y: z.ZodString;
377
377
  color: z.ZodOptional<z.ZodString>;
378
378
  }, "strict", z.ZodTypeAny, {
379
+ title: string;
379
380
  type: "bar" | "line" | "area" | "pie" | "scatter";
380
381
  id: string;
381
- title: string;
382
382
  datasetId: string;
383
383
  x: string;
384
384
  y: string;
385
385
  color?: string | undefined;
386
386
  }, {
387
+ title: string;
387
388
  type: "bar" | "line" | "area" | "pie" | "scatter";
388
389
  id: string;
389
- title: string;
390
390
  datasetId: string;
391
391
  x: string;
392
392
  y: string;
393
393
  color?: string | undefined;
394
394
  }>, "many">, {
395
+ title: string;
395
396
  type: "bar" | "line" | "area" | "pie" | "scatter";
396
397
  id: string;
397
- title: string;
398
398
  datasetId: string;
399
399
  x: string;
400
400
  y: string;
@@ -406,21 +406,81 @@ export declare const createToolSchema: z.ZodObject<{} & {
406
406
  datasetId: z.ZodString;
407
407
  fields: z.ZodArray<z.ZodString, "many">;
408
408
  }, "strict", z.ZodTypeAny, {
409
- id: string;
410
409
  title: string;
410
+ id: string;
411
411
  datasetId: string;
412
412
  fields: string[];
413
413
  }, {
414
- id: string;
415
414
  title: string;
415
+ id: string;
416
416
  datasetId: string;
417
417
  fields: string[];
418
418
  }>, "many">, {
419
- id: string;
420
419
  title: string;
420
+ id: string;
421
421
  datasetId: string;
422
422
  fields: string[];
423
423
  }[], unknown>;
424
+ sourceMetadata: z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodObject<{
425
+ bindingId: z.ZodString;
426
+ title: z.ZodString;
427
+ description: z.ZodOptional<z.ZodString>;
428
+ }, "strict", z.ZodTypeAny, {
429
+ bindingId: string;
430
+ title: string;
431
+ description?: string | undefined;
432
+ }, {
433
+ bindingId: string;
434
+ title: string;
435
+ description?: string | undefined;
436
+ }>, "many">, {
437
+ bindingId: string;
438
+ title: string;
439
+ description?: string | undefined;
440
+ }[], unknown>>;
441
+ components: z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodObject<{
442
+ id: z.ZodString;
443
+ elementId: z.ZodString;
444
+ title: z.ZodString;
445
+ kind: z.ZodEnum<["metric", "chart", "table", "filter", "text"]>;
446
+ sources: z.ZodArray<z.ZodObject<{
447
+ bindingId: z.ZodString;
448
+ fieldIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
449
+ }, "strict", z.ZodTypeAny, {
450
+ bindingId: string;
451
+ fieldIds?: string[] | undefined;
452
+ }, {
453
+ bindingId: string;
454
+ fieldIds?: string[] | undefined;
455
+ }>, "many">;
456
+ }, "strict", z.ZodTypeAny, {
457
+ title: string;
458
+ id: string;
459
+ elementId: string;
460
+ kind: "filter" | "metric" | "chart" | "table" | "text";
461
+ sources: {
462
+ bindingId: string;
463
+ fieldIds?: string[] | undefined;
464
+ }[];
465
+ }, {
466
+ title: string;
467
+ id: string;
468
+ elementId: string;
469
+ kind: "filter" | "metric" | "chart" | "table" | "text";
470
+ sources: {
471
+ bindingId: string;
472
+ fieldIds?: string[] | undefined;
473
+ }[];
474
+ }>, "many">, {
475
+ title: string;
476
+ id: string;
477
+ elementId: string;
478
+ kind: "filter" | "metric" | "chart" | "table" | "text";
479
+ sources: {
480
+ bindingId: string;
481
+ fieldIds?: string[] | undefined;
482
+ }[];
483
+ }[], unknown>>;
424
484
  previewIds: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], unknown>;
425
485
  }, "strict", z.ZodTypeAny, {
426
486
  title: string;
@@ -432,25 +492,42 @@ export declare const createToolSchema: z.ZodObject<{} & {
432
492
  allowedValues?: (string | number | boolean | null)[] | undefined;
433
493
  }[];
434
494
  charts: {
495
+ title: string;
435
496
  type: "bar" | "line" | "area" | "pie" | "scatter";
436
497
  id: string;
437
- title: string;
438
498
  datasetId: string;
439
499
  x: string;
440
500
  y: string;
441
501
  color?: string | undefined;
442
502
  }[];
443
503
  tables: {
444
- id: string;
445
504
  title: string;
505
+ id: string;
446
506
  datasetId: string;
447
507
  fields: string[];
448
508
  }[];
449
509
  previewIds: string[];
510
+ sourceMetadata?: {
511
+ bindingId: string;
512
+ title: string;
513
+ description?: string | undefined;
514
+ }[] | undefined;
515
+ components?: {
516
+ title: string;
517
+ id: string;
518
+ elementId: string;
519
+ kind: "filter" | "metric" | "chart" | "table" | "text";
520
+ sources: {
521
+ bindingId: string;
522
+ fieldIds?: string[] | undefined;
523
+ }[];
524
+ }[] | undefined;
450
525
  creationIntent?: "new" | "copy" | undefined;
451
526
  supersedesPaths?: string[] | undefined;
452
527
  }, {
453
528
  title: string;
529
+ sourceMetadata?: unknown;
530
+ components?: unknown;
454
531
  controls?: unknown;
455
532
  charts?: unknown;
456
533
  tables?: unknown;
@@ -498,25 +575,25 @@ export declare const createHtmlToolSchema: z.ZodObject<Omit<{} & {
498
575
  y: z.ZodString;
499
576
  color: z.ZodOptional<z.ZodString>;
500
577
  }, "strict", z.ZodTypeAny, {
578
+ title: string;
501
579
  type: "bar" | "line" | "area" | "pie" | "scatter";
502
580
  id: string;
503
- title: string;
504
581
  datasetId: string;
505
582
  x: string;
506
583
  y: string;
507
584
  color?: string | undefined;
508
585
  }, {
586
+ title: string;
509
587
  type: "bar" | "line" | "area" | "pie" | "scatter";
510
588
  id: string;
511
- title: string;
512
589
  datasetId: string;
513
590
  x: string;
514
591
  y: string;
515
592
  color?: string | undefined;
516
593
  }>, "many">, {
594
+ title: string;
517
595
  type: "bar" | "line" | "area" | "pie" | "scatter";
518
596
  id: string;
519
- title: string;
520
597
  datasetId: string;
521
598
  x: string;
522
599
  y: string;
@@ -528,28 +605,88 @@ export declare const createHtmlToolSchema: z.ZodObject<Omit<{} & {
528
605
  datasetId: z.ZodString;
529
606
  fields: z.ZodArray<z.ZodString, "many">;
530
607
  }, "strict", z.ZodTypeAny, {
531
- id: string;
532
608
  title: string;
609
+ id: string;
533
610
  datasetId: string;
534
611
  fields: string[];
535
612
  }, {
536
- id: string;
537
613
  title: string;
614
+ id: string;
538
615
  datasetId: string;
539
616
  fields: string[];
540
617
  }>, "many">, {
541
- id: string;
542
618
  title: string;
619
+ id: string;
543
620
  datasetId: string;
544
621
  fields: string[];
545
622
  }[], unknown>;
623
+ sourceMetadata: z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodObject<{
624
+ bindingId: z.ZodString;
625
+ title: z.ZodString;
626
+ description: z.ZodOptional<z.ZodString>;
627
+ }, "strict", z.ZodTypeAny, {
628
+ bindingId: string;
629
+ title: string;
630
+ description?: string | undefined;
631
+ }, {
632
+ bindingId: string;
633
+ title: string;
634
+ description?: string | undefined;
635
+ }>, "many">, {
636
+ bindingId: string;
637
+ title: string;
638
+ description?: string | undefined;
639
+ }[], unknown>>;
640
+ components: z.ZodOptional<z.ZodEffects<z.ZodArray<z.ZodObject<{
641
+ id: z.ZodString;
642
+ elementId: z.ZodString;
643
+ title: z.ZodString;
644
+ kind: z.ZodEnum<["metric", "chart", "table", "filter", "text"]>;
645
+ sources: z.ZodArray<z.ZodObject<{
646
+ bindingId: z.ZodString;
647
+ fieldIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
648
+ }, "strict", z.ZodTypeAny, {
649
+ bindingId: string;
650
+ fieldIds?: string[] | undefined;
651
+ }, {
652
+ bindingId: string;
653
+ fieldIds?: string[] | undefined;
654
+ }>, "many">;
655
+ }, "strict", z.ZodTypeAny, {
656
+ title: string;
657
+ id: string;
658
+ elementId: string;
659
+ kind: "filter" | "metric" | "chart" | "table" | "text";
660
+ sources: {
661
+ bindingId: string;
662
+ fieldIds?: string[] | undefined;
663
+ }[];
664
+ }, {
665
+ title: string;
666
+ id: string;
667
+ elementId: string;
668
+ kind: "filter" | "metric" | "chart" | "table" | "text";
669
+ sources: {
670
+ bindingId: string;
671
+ fieldIds?: string[] | undefined;
672
+ }[];
673
+ }>, "many">, {
674
+ title: string;
675
+ id: string;
676
+ elementId: string;
677
+ kind: "filter" | "metric" | "chart" | "table" | "text";
678
+ sources: {
679
+ bindingId: string;
680
+ fieldIds?: string[] | undefined;
681
+ }[];
682
+ }[], unknown>>;
546
683
  previewIds: z.ZodEffects<z.ZodArray<z.ZodString, "many">, string[], unknown>;
547
684
  }, "charts" | "tables"> & {
548
685
  path: z.ZodEffects<z.ZodEffects<z.ZodString, string, string>, string, string>;
549
686
  libraries: z.ZodOptional<z.ZodEffects<z.ZodEffects<z.ZodArray<z.ZodEnum<["echarts", "three", "trend-workspace", "profit-atlas", "customer-brief"]>, "many">, ("echarts" | "three" | "trend-workspace" | "profit-atlas" | "customer-brief")[], ("echarts" | "three" | "trend-workspace" | "profit-atlas" | "customer-brief")[]>, ("echarts" | "three" | "trend-workspace" | "profit-atlas" | "customer-brief")[], ("echarts" | "three" | "trend-workspace" | "profit-atlas" | "customer-brief")[]>>;
550
687
  }, "strict", z.ZodTypeAny, {
551
- path: string;
552
688
  title: string;
689
+ path: string;
553
690
  controls: {
554
691
  type: "string" | "number" | "boolean" | "date";
555
692
  controlId: string;
@@ -558,17 +695,34 @@ export declare const createHtmlToolSchema: z.ZodObject<Omit<{} & {
558
695
  allowedValues?: (string | number | boolean | null)[] | undefined;
559
696
  }[];
560
697
  previewIds: string[];
698
+ sourceMetadata?: {
699
+ bindingId: string;
700
+ title: string;
701
+ description?: string | undefined;
702
+ }[] | undefined;
703
+ components?: {
704
+ title: string;
705
+ id: string;
706
+ elementId: string;
707
+ kind: "filter" | "metric" | "chart" | "table" | "text";
708
+ sources: {
709
+ bindingId: string;
710
+ fieldIds?: string[] | undefined;
711
+ }[];
712
+ }[] | undefined;
561
713
  creationIntent?: "new" | "copy" | undefined;
562
714
  supersedesPaths?: string[] | undefined;
563
715
  libraries?: ("echarts" | "three" | "trend-workspace" | "profit-atlas" | "customer-brief")[] | undefined;
564
716
  }, {
565
- path: string;
566
717
  title: string;
718
+ path: string;
719
+ sourceMetadata?: unknown;
720
+ components?: unknown;
567
721
  controls?: unknown;
568
722
  creationIntent?: "new" | "copy" | undefined;
569
723
  supersedesPaths?: string[] | undefined;
570
724
  previewIds?: unknown;
571
725
  libraries?: ("echarts" | "three" | "trend-workspace" | "profit-atlas" | "customer-brief")[] | undefined;
572
726
  }>;
573
- export declare function parseObjectJson(text: string): Record<string, import("@xpert-ai/contracts").JSONValue>;
727
+ export declare function parseObjectJson(text: string, field?: 'requestJson' | 'binding.payloadJson'): Record<string, import("@xpert-ai/contracts").JSONValue>;
574
728
  export declare function fromAgentBinding(input: z.infer<typeof agentBindingSchema>, contract: AnalyticsDiscoveryResult['queryContract']): import("@xpert-ai/contracts").AnalyticsBinding;
@@ -8,6 +8,7 @@ const analytics_1 = require("@xpert-ai/plugin-sdk/analytics");
8
8
  const dashboard_schema_1 = require("./dashboard.schema");
9
9
  const plugin_sdk_1 = require("@xpert-ai/plugin-sdk");
10
10
  const document_libraries_1 = require("./document-libraries");
11
+ const json_input_1 = require("./json-input");
11
12
  // LLM tool schemas cannot reliably express recursive JSON unions. Only this model boundary uses JSON text.
12
13
  const objectJson = v3_1.z.string().min(2).max(64000).describe('A JSON object encoded as text. Use the exact provider-owned contract from discovery. No Markdown fences.');
13
14
  const agentControlsSchema = v3_1.z.array(dashboard_schema_1.dashboardSchema.innerType().shape.controls.element.extend({
@@ -28,7 +29,9 @@ exports.createToolSchema = dashboard_schema_1.dashboardSchema.innerType().omit({
28
29
  controls: (0, plugin_sdk_1.jsonEncodedSchema)(agentControlsSchema),
29
30
  charts: (0, plugin_sdk_1.jsonEncodedSchema)(dashboard_schema_1.dashboardSchema.innerType().shape.charts),
30
31
  tables: (0, plugin_sdk_1.jsonEncodedSchema)(dashboard_schema_1.dashboardSchema.innerType().shape.tables),
31
- previewIds: (0, plugin_sdk_1.jsonEncodedSchema)(v3_1.z.array(v3_1.z.string().min(1)).min(1).max(8).describe('Exact previewId receipts from successful dashboard_preview calls. Do not repeat bindings.'))
32
+ sourceMetadata: (0, plugin_sdk_1.jsonEncodedSchema)(dashboard_schema_1.dashboardSchema.innerType().shape.sourceMetadata.unwrap()).optional(),
33
+ components: (0, plugin_sdk_1.jsonEncodedSchema)(dashboard_schema_1.dashboardSchema.innerType().shape.components.unwrap()).optional(),
34
+ previewIds: (0, plugin_sdk_1.jsonEncodedSchema)(v3_1.z.array(v3_1.z.string().min(1)).min(1).max(8).describe('Exact current-run previewId receipts from successful dashboard_preview or dashboard_preview_binding calls. For updates, changed bindings upsert by stable binding.id; omitted bindings remain. Keep every intended changed/new binding receipt when retrying a failed save. Do not repeat bindings.'))
32
35
  }).strict();
33
36
  exports.htmlPathSchema = plugin_sdk_1.workspaceRelativeFilePathSchema.refine(path => {
34
37
  const name = path.split('/').at(-1) ?? '';
@@ -37,17 +40,15 @@ exports.htmlPathSchema = plugin_sdk_1.workspaceRelativeFilePathSchema.refine(pat
37
40
  .describe('Workspace-relative HTML file created or edited with SandboxFile, for example dashboards/sales.html. Copy the complete htmlPath from dashboard_open when editing.');
38
41
  exports.createHtmlToolSchema = exports.createToolSchema.omit({ charts: true, tables: true }).extend({ path: exports.htmlPathSchema,
39
42
  libraries: document_libraries_1.libraryRequestsSchema.optional().describe('Bundled IDs from dashboard_libraries. Omit for native SVG/Canvas/DOM; use echarts or three for charts. Optional: add exactly one visual theme (trend-workspace, profit-atlas, customer-brief) with echarts. Preserve the saved theme unless a change is requested.') }).strict();
40
- function parseObjectJson(text) {
41
- try {
42
- return analytics_1.analyticsOptionsSchema.parse(JSON.parse(text));
43
- }
44
- catch {
45
- throw new Error('DASHBOARD_INVALID_JSON: supply a JSON object encoded as text, matching the returned provider contract');
46
- }
43
+ function parseObjectJson(text, field = 'requestJson') {
44
+ const parsed = analytics_1.analyticsOptionsSchema.safeParse((0, json_input_1.parseJsonInput)(text, field));
45
+ if (!parsed.success)
46
+ throw new Error(`DASHBOARD_INVALID_JSON: ${field} is valid JSON but must be an object matching the returned provider contract; arrays, null and scalar values are not accepted.`);
47
+ return parsed.data;
47
48
  }
48
49
  function fromAgentBinding(input, contract) {
49
50
  const { payloadJson, ...binding } = input;
50
51
  return analytics_1.analyticsBindingSchema.parse({ ...binding, id: input.output.datasetId,
51
52
  operation: contract.operation, contractVersion: contract.contractVersion,
52
- parameters: input.parameters.map(parameter => ({ ...parameter, controlId: parameter.name })), payload: parseObjectJson(payloadJson) });
53
+ parameters: input.parameters.map(parameter => ({ ...parameter, controlId: parameter.name })), payload: parseObjectJson(payloadJson, 'binding.payloadJson') });
53
54
  }
@@ -0,0 +1,145 @@
1
+ import { z } from 'zod/v3';
2
+ import type { XpertResolvedViewHostContext } from '@xpert-ai/contracts';
3
+ import { type RuntimeCapabilityRegistry, type WorkspacePortableFileReference } from '@xpert-ai/plugin-sdk';
4
+ import { DashboardService } from './dashboard.service';
5
+ export declare const importInputSchema: z.ZodObject<{
6
+ importId: z.ZodString;
7
+ bindings: z.ZodArray<z.ZodObject<{
8
+ bindingId: z.ZodString;
9
+ source: z.ZodType<import("@xpert-ai/contracts").AnalyticsSourceRef, z.ZodTypeDef, import("@xpert-ai/contracts").AnalyticsSourceRef>;
10
+ payload: z.ZodType<import("@xpert-ai/contracts").JSONValue, z.ZodTypeDef, import("@xpert-ai/contracts").JSONValue>;
11
+ }, "strict", z.ZodTypeAny, {
12
+ bindingId: string;
13
+ source: import("@xpert-ai/contracts").AnalyticsSourceRef;
14
+ payload: import("@xpert-ai/contracts").JSONValue;
15
+ }, {
16
+ bindingId: string;
17
+ source: import("@xpert-ai/contracts").AnalyticsSourceRef;
18
+ payload: import("@xpert-ai/contracts").JSONValue;
19
+ }>, "many">;
20
+ }, "strict", z.ZodTypeAny, {
21
+ bindings: {
22
+ bindingId: string;
23
+ source: import("@xpert-ai/contracts").AnalyticsSourceRef;
24
+ payload: import("@xpert-ai/contracts").JSONValue;
25
+ }[];
26
+ importId: string;
27
+ }, {
28
+ bindings: {
29
+ bindingId: string;
30
+ source: import("@xpert-ai/contracts").AnalyticsSourceRef;
31
+ payload: import("@xpert-ai/contracts").JSONValue;
32
+ }[];
33
+ importId: string;
34
+ }>;
35
+ declare const importBrowseSchema: z.ZodObject<{
36
+ importId: z.ZodString;
37
+ bindingId: z.ZodString;
38
+ source: z.ZodType<import("@xpert-ai/contracts").AnalyticsSourceRef, z.ZodTypeDef, import("@xpert-ai/contracts").AnalyticsSourceRef>;
39
+ request: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodType<import("@xpert-ai/contracts").JSONValue, z.ZodTypeDef, import("@xpert-ai/contracts").JSONValue>>>;
40
+ }, "strict", z.ZodTypeAny, {
41
+ bindingId: string;
42
+ source: import("@xpert-ai/contracts").AnalyticsSourceRef;
43
+ importId: string;
44
+ request: Record<string, import("@xpert-ai/contracts").JSONValue>;
45
+ }, {
46
+ bindingId: string;
47
+ source: import("@xpert-ai/contracts").AnalyticsSourceRef;
48
+ importId: string;
49
+ request?: Record<string, import("@xpert-ai/contracts").JSONValue> | undefined;
50
+ }>;
51
+ type ImportInput = z.infer<typeof importInputSchema>;
52
+ export declare class DashboardArchiveService {
53
+ private readonly dashboards;
54
+ private readonly runtime;
55
+ private readonly imports;
56
+ constructor(dashboards: DashboardService, runtime: RuntimeCapabilityRegistry);
57
+ private authorize;
58
+ private session;
59
+ prepare(context: XpertResolvedViewHostContext, bytes: Buffer): Promise<{
60
+ importId: `${string}-${string}-${string}-${string}-${string}`;
61
+ manifest: {
62
+ title: string;
63
+ id: string;
64
+ schema: "xpert.live-dashboard";
65
+ bindings: import("@xpert-ai/contracts").AnalyticsBinding[];
66
+ controls: {
67
+ type: "string" | "number" | "boolean" | "date";
68
+ controlId: string;
69
+ label: string;
70
+ defaultValue?: string | number | boolean | null | undefined;
71
+ allowedValues?: (string | number | boolean | null)[] | undefined;
72
+ }[];
73
+ charts: {
74
+ title: string;
75
+ type: "bar" | "line" | "area" | "pie" | "scatter";
76
+ id: string;
77
+ datasetId: string;
78
+ x: string;
79
+ y: string;
80
+ color?: string | undefined;
81
+ }[];
82
+ tables: {
83
+ title: string;
84
+ id: string;
85
+ datasetId: string;
86
+ fields: string[];
87
+ }[];
88
+ sourceMetadata?: {
89
+ bindingId: string;
90
+ title: string;
91
+ description?: string | undefined;
92
+ }[] | undefined;
93
+ components?: {
94
+ title: string;
95
+ id: string;
96
+ elementId: string;
97
+ kind: "filter" | "metric" | "chart" | "table" | "text";
98
+ sources: {
99
+ bindingId: string;
100
+ fieldIds?: string[] | undefined;
101
+ }[];
102
+ }[] | undefined;
103
+ presentation?: {
104
+ type: "html";
105
+ html: string;
106
+ dependencies?: import("@xpert-ai/plugin-sdk/artifact-document").ArtifactDocumentDependencyLock[] | undefined;
107
+ } | undefined;
108
+ };
109
+ requirements: {
110
+ schema: string;
111
+ version: number;
112
+ bindings: {
113
+ id: string;
114
+ providerId: string;
115
+ operation: string;
116
+ contractVersion: number;
117
+ source: import("@xpert-ai/contracts").AnalyticsSourceRef;
118
+ }[];
119
+ externalResources: string[];
120
+ dynamicResourcesMayExist: boolean;
121
+ includesQueryResults: boolean;
122
+ requiresAuthorizedHost: boolean;
123
+ };
124
+ sources: import("@xpert-ai/contracts").AnalyticsSourceSummary[];
125
+ }>;
126
+ browse(context: XpertResolvedViewHostContext, input: z.infer<typeof importBrowseSchema>): Promise<import("@xpert-ai/contracts").AnalyticsDiscoveryResult>;
127
+ commit(context: XpertResolvedViewHostContext, input: ImportInput): Promise<{
128
+ artifactId: string;
129
+ draftId: string;
130
+ draftRevision: number;
131
+ baseVersionId: string | null;
132
+ status: "draft";
133
+ title: string;
134
+ }>;
135
+ discard(context: XpertResolvedViewHostContext, id: string): Promise<{
136
+ discarded: boolean;
137
+ }>;
138
+ exportFile(context: XpertResolvedViewHostContext, fileKey: string): Promise<{
139
+ reference: WorkspacePortableFileReference;
140
+ fileName: string;
141
+ mimeType: string;
142
+ size: number;
143
+ }>;
144
+ }
145
+ export { importBrowseSchema };