@xpert-ai/plugin-live-dashboard 0.7.0 → 0.7.1

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 (61) hide show
  1. package/.xpertai-plugin/plugin.json +1 -1
  2. package/README.md +2 -2
  3. package/dist/lib/analysis-scene-tool.d.ts +8 -8
  4. package/dist/lib/analysis-scene.schema.d.ts +6 -6
  5. package/dist/lib/bundled-example-source.d.ts +11 -0
  6. package/dist/lib/bundled-example-source.js +60 -0
  7. package/dist/lib/certification.schema.d.ts +4 -0
  8. package/dist/lib/certification.schema.js +14 -0
  9. package/dist/lib/content-capability.js +1 -0
  10. package/dist/lib/dashboard-delivery.d.ts +11 -0
  11. package/dist/lib/dashboard-delivery.js +55 -0
  12. package/dist/lib/dashboard-navigation.d.ts +5 -5
  13. package/dist/lib/dashboard-queries.d.ts +2 -2
  14. package/dist/lib/dashboard-queries.js +2 -2
  15. package/dist/lib/dashboard-view.schema.d.ts +10 -10
  16. package/dist/lib/dashboard.schema.d.ts +18 -0
  17. package/dist/lib/dashboard.schema.js +2 -1
  18. package/dist/lib/dashboard.service.d.ts +11 -2
  19. package/dist/lib/dashboard.service.js +17 -4
  20. package/dist/lib/definition-tools.d.ts +14 -54
  21. package/dist/lib/definition-tools.js +29 -9
  22. package/dist/lib/editing-session.d.ts +4 -4
  23. package/dist/lib/evidence/evidence-diff.d.ts +17 -0
  24. package/dist/lib/evidence/evidence-diff.js +30 -0
  25. package/dist/lib/evidence/evidence-transfers.d.ts +14 -0
  26. package/dist/lib/evidence/evidence-transfers.js +41 -0
  27. package/dist/lib/evidence/evidence-view.provider.d.ts +91 -0
  28. package/dist/lib/evidence/evidence-view.provider.js +92 -0
  29. package/dist/lib/evidence/evidence.entity.d.ts +14 -0
  30. package/dist/lib/evidence/evidence.entity.js +62 -0
  31. package/dist/lib/evidence/evidence.provider.d.ts +43 -0
  32. package/dist/lib/evidence/evidence.provider.js +91 -0
  33. package/dist/lib/evidence/evidence.service.d.ts +67 -0
  34. package/dist/lib/evidence/evidence.service.js +218 -0
  35. package/dist/lib/middleware.d.ts +6 -2
  36. package/dist/lib/middleware.js +95 -11
  37. package/dist/lib/monitor.js +2 -2
  38. package/dist/lib/plugin.js +6 -1
  39. package/dist/lib/query-session.d.ts +1 -1
  40. package/dist/lib/query-session.js +13 -8
  41. package/dist/lib/remote-entry.d.ts +1 -1
  42. package/dist/lib/runtime-context.d.ts +2 -0
  43. package/dist/lib/runtime-context.js +21 -0
  44. package/dist/lib/source-executions.d.ts +36 -18
  45. package/dist/lib/source-executions.js +2 -1
  46. package/dist/lib/templates.js +5 -5
  47. package/dist/lib/view.provider.js +7 -1
  48. package/dist/remote/app.css +1 -1
  49. package/dist/remote/app.js +23 -23
  50. package/dist/remote/build-manifest.json +45 -35
  51. package/dist/sandbox-actions/action.json +1 -1
  52. package/dist/sandbox-actions/bundle/host.js +2 -2
  53. package/docs/editing.mdx +6 -0
  54. package/docs/html-mode.md +1 -1
  55. package/package.json +5 -5
  56. package/skills/live-dashboard/SKILL.md +1 -1
  57. package/skills/live-dashboard/examples/README.md +2 -2
  58. package/skills/live-dashboard/examples/production-quality/README.md +2 -2
  59. package/skills/live-dashboard/examples/regional-sales/README.md +3 -3
  60. package/skills/live-dashboard/examples/regional-sales/query.json +49 -1
  61. package/skills/live-dashboard/examples/sales-overview/README.md +2 -2
@@ -13,6 +13,10 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.DashboardMiddleware = exports.DASHBOARD_GUIDANCE = void 0;
16
+ const bundled_example_source_1 = require("./bundled-example-source");
17
+ const evidence_service_1 = require("./evidence/evidence.service");
18
+ const evidence_transfers_1 = require("./evidence/evidence-transfers");
19
+ const evidence_view_provider_1 = require("./evidence/evidence-view.provider");
16
20
  const analysis_scene_tool_1 = require("./analysis-scene-tool");
17
21
  const template_execution_service_1 = require("./library/template-execution.service");
18
22
  const execution_contract_1 = require("./library/execution-contract");
@@ -42,6 +46,7 @@ const editing_session_1 = require("./editing-session");
42
46
  const dashboard_receipt_1 = require("./dashboard-receipt");
43
47
  const filter_evidence_1 = require("./filter-evidence");
44
48
  const save_evidence_1 = require("./save-evidence");
49
+ const dashboard_delivery_1 = require("./dashboard-delivery");
45
50
  const resource_card_1 = require("./resource-card");
46
51
  const dashboard_icon_1 = require("./dashboard-icon");
47
52
  const preview_retry_1 = require("./preview-retry");
@@ -53,12 +58,14 @@ const providerOptionSchema = {
53
58
  type: 'string',
54
59
  'x-ui': { component: 'remoteSelect', selectUrl: '/api/live-dashboard/provider-options' }
55
60
  };
56
- exports.DASHBOARD_GUIDANCE = `When asked which dashboards are available, use platform resource_search with typeId "xpert.live-dashboard" and omit query to enumerate this conversation's Project content and accepted group shares. Follow nextCursor until null; dashboard_list only lists dashboards authored in the current Project and an empty result does not mean there are no shared dashboards. ResourceAssistant must be enabled for discovery and navigation; if absent, explain that capability is unavailable rather than declaring the shared directory empty. When the user asks to open, show or display an existing dashboard, prefer the platform resource_open tool with the requested title. It opens the authorized Workbench resource or asks the user to select a match. In groups it uses accepted shared references; never switch to the source Project or use dashboard_open merely to show a shared dashboard. dashboard_open reads source content for editing and may prepare an editing file; it is not the UI navigation tool. For an explicitly selected library template or task, read its recipe and use dashboard_instantiate_template with the declared arguments. Follow the returned save request until succeeded before reporting a saved dashboard; do not regenerate the layout unless requested. For a new independent dashboard, use a new unused HTML file path. An existing filename or matching title is not authorization to edit another Artifact; do not switch from creation to dashboard_open/update because a file already exists. For a new dashboard, call dashboard_list_sources before searching raw files, reading old scripts or creating transformations. Named governed sources may already provide the required query; inspect their provider contracts first. File-backed sources do not imply that a script must be written. For creating or editing live dashboards, first read the installed live-dashboard skill using read_skill_file and follow only the references relevant to the task. Use SandboxFile tools for all source-file authoring; HTML alone is not a saved dashboard. Follow preview.validation.checks immediately before authoring HTML; each suggestedCall must actually succeed. Business definitions, real data previews and nullable-filter tests are required before saving new or changed Bindings. Do not invent business data or substitute a different metric without agreement. Report completion only from a successful dashboard_create/dashboard_create_html/dashboard_update draft receipt or a succeeded template save request with a dashboard receipt. Human publication is separate. Successful create, update and open tools emit a chat resource card automatically; resourceCard.status reports emission. Its Open button selects the exact dashboard in Workbench. Never fabricate a link, call present_files for dashboard HTML, or output card JSON as text. If card delivery is unavailable, report the saved receipt and use the Workbench picker.`;
61
+ exports.DASHBOARD_GUIDANCE = `When asked which dashboards are available, use platform resource_search with typeId "xpert.live-dashboard" and omit query to enumerate this conversation's Project content and accepted group shares. Follow nextCursor until null; dashboard_list only lists dashboards authored in the current Project and an empty result does not mean there are no shared dashboards. ResourceAssistant must be enabled for discovery and navigation; if absent, explain that capability is unavailable rather than declaring the shared directory empty. When the user asks to open, show or display an existing dashboard, prefer the platform resource_open tool with the requested title. It opens the authorized Workbench resource or asks the user to select a match. In groups it uses accepted shared references; never switch to the source Project or use dashboard_open merely to show a shared dashboard. dashboard_open reads source content for editing and may prepare an editing file; it is not the UI navigation tool. For an explicitly selected library template or task, read its recipe and use dashboard_instantiate_template with the declared arguments. Follow the returned save request until succeeded before reporting a saved dashboard; do not regenerate the layout unless requested. For a new independent dashboard, use a new unused HTML file path. An existing filename or matching title is not authorization to edit another Artifact; do not switch from creation to dashboard_open/update because a file already exists. For a new dashboard using an existing governed source, call dashboard_list_sources before searching raw files, reading old scripts or creating transformations. Named governed sources may already provide the required query; inspect their provider contracts first. File-backed sources do not imply that a script must be written. For creating or editing live dashboards, read live-dashboard using the exact SKILL.md path in the Available Skills list. Read relevant references relative to that entry. If the skill is absent, report it as unavailable; never construct a path from the skill name. Use SandboxFile tools for all source-file authoring; HTML alone is not a saved dashboard. Follow preview.validation.checks immediately before authoring HTML; each suggestedCall must actually succeed. Business definitions, real data previews and nullable-filter tests are required before saving new or changed Bindings. Do not invent business data or substitute a different metric without agreement. Report completion only from a successful dashboard_create/dashboard_create_html/dashboard_update draft receipt or a succeeded template save request with a dashboard receipt. Human publication is separate. Successful create, update and open tools emit a chat resource card automatically; resourceCard.status reports emission. Its Open button selects the exact dashboard in Workbench. Never fabricate a link, call present_files for dashboard HTML, or output card JSON as text. If card delivery is unavailable, report the saved receipt and use the Workbench picker.`;
57
62
  let DashboardMiddleware = class DashboardMiddleware {
58
- constructor(service, saveRequests, libraryExecution) {
63
+ constructor(service, saveRequests, libraryExecution, evidenceSnapshots, evidenceTransfers) {
59
64
  this.service = service;
60
65
  this.saveRequests = saveRequests;
61
66
  this.libraryExecution = libraryExecution;
67
+ this.evidenceSnapshots = evidenceSnapshots;
68
+ this.evidenceTransfers = evidenceTransfers;
62
69
  this.meta = {
63
70
  name: 'LiveDashboard', label: { en_US: 'Live dashboards', zh_Hans: '实时看板' },
64
71
  description: { en_US: 'Discover, preview, create and update governed live dashboards.', zh_Hans: '发现业务数据、验证查询并持续修改实时看板。' },
@@ -83,6 +90,8 @@ let DashboardMiddleware = class DashboardMiddleware {
83
90
  // Evidence belongs to this run and actor, never a process-wide cache of business data.
84
91
  const discovered = new Map(), previews = new Map();
85
92
  const discovering = new Map();
93
+ const exampleSources = new Map();
94
+ const exampleQueries = new Map();
86
95
  let listedSources;
87
96
  const assertSourceSelection = (input) => {
88
97
  if (listedSources && !listedSources.some(source => (0, analytics_source_1.sameAnalyticsResource)(source.source, input.source) && source.providers.some(provider => provider.id === input.providerId)))
@@ -133,6 +142,13 @@ let DashboardMiddleware = class DashboardMiddleware {
133
142
  return binding;
134
143
  });
135
144
  const validateFinal = (manifest, requirePreviews, changedBindingIds) => {
145
+ if (exampleSources.size) {
146
+ const used = new Set(manifest.bindings.map(binding => (0, analytics_1.analyticsSourceKey)(binding.source)));
147
+ for (const source of exampleSources.values()) {
148
+ if (!source || !used.has(source))
149
+ throw new Error('DASHBOARD_EXAMPLE_SOURCE_REQUIRED: use the exact source and version returned by analytics_definition_register for the selected example.');
150
+ }
151
+ }
136
152
  const allowedProviders = options.allowedFinalProviders;
137
153
  if (allowedProviders && manifest.bindings.some(binding => !allowedProviders.includes(binding.providerId)))
138
154
  throw new Error(`DASHBOARD_PROVIDER_REQUIRED: final bindings must use ${allowedProviders.join(', ')}`);
@@ -199,6 +215,8 @@ let DashboardMiddleware = class DashboardMiddleware {
199
215
  // Platform execution scope and request context occupy different runtime fields.
200
216
  beforeAgent: (state, runtime) => editing.restore(state, { live_dashboard: (0, editing_session_1.selectionFromConfig)(runtime) }),
201
217
  wrapToolCall: async (request, handler) => {
218
+ if (!context.projectId)
219
+ return handler(request);
202
220
  const name = request.toolCall.name;
203
221
  const args = request.toolCall.args;
204
222
  observing = name === 'dashboard_wait_request';
@@ -237,6 +255,12 @@ let DashboardMiddleware = class DashboardMiddleware {
237
255
  }
238
256
  return result;
239
257
  }, wrapModelCall: async (request, handler) => {
258
+ if (!context.projectId) {
259
+ const content = request.systemMessage?.content ?? '';
260
+ const guidance = 'Dashboard operations require a Project. For a request to discuss or explain metrics, answer directly and stop after the discussion; do not prepare samples, run previews or request a Project for a future dashboard. Naming a dashboard or mentioning an example is context, not a request to create it now. When the user asks to start making or editing the dashboard, select a Project before starting that work.';
261
+ return handler({ ...request, systemMessage: new messages_1.SystemMessage({ content: typeof content === 'string'
262
+ ? content + '\n\n' + guidance : [...content, { type: 'text', text: guidance }] }) });
263
+ }
240
264
  if (previewRetries.exhausted) {
241
265
  const summary = previewRetries.summary + (evidence.pending ? ` Unsaved Workspace files: ${JSON.stringify(evidence.pendingPaths)}.` : '');
242
266
  const result = await handler({ ...request, tools: [], toolChoice: 'none', systemMessage: new messages_1.SystemMessage({ content: [
@@ -249,14 +273,34 @@ let DashboardMiddleware = class DashboardMiddleware {
249
273
  const exhausted = (observing ? modelCalls : ++modelCalls) > options.maxModelCalls;
250
274
  if (exhausted && evidence.pending)
251
275
  throw new Error('DASHBOARD_SAVE_NOT_CONFIRMED: no successful draft save receipt; Workspace changes have not been saved to the dashboard.');
276
+ const delivery = (0, dashboard_delivery_1.dashboardDelivery)(request.messages);
252
277
  const result = await handler({ ...request, ...(evidence.pending || activeRequests.size ? { toolChoice: 'required' } : {}), ...(exhausted ? { tools: [] } : {}), systemMessage: new messages_1.SystemMessage({ content: [
253
278
  ...(typeof request.systemMessage?.content === 'string' ? [{ type: 'text', text: request.systemMessage.content }] : request.systemMessage?.content ?? []),
254
- { type: 'text', text: `Current dashboard authoring limit: ${this.service.maxBindings} Bindings (storage maximum 64). Shared charts may reuse one Binding; independent filter-option queries count too. Preview in batches, preserving each receipt and filter check.\n` + exports.DASHBOARD_GUIDANCE + '\n' + analysis_scene_tool_1.ANALYSIS_SCENE_GUIDANCE + (editing.current() ? `\nCurrent editing target: ${JSON.stringify(editing.current())}. Continue this Artifact with dashboard_open/update unless the user explicitly requests a new independent dashboard.` : '') + '\n' + definition_tools_1.DEFINITION_GUIDANCE + '\n' + html_guidance_1.HTML_DASHBOARD_GUIDANCE + '\n' + html_guidance_1.HTML_QUERY_ROUNDS + '\n' + editing_1.EDITING_GUIDANCE + (activeRequests.size ? `\nDurable save requests pending: ${JSON.stringify([...activeRequests])}. Keep calling dashboard_wait_request with the returned requestId and cursor until terminal. Do not resubmit or claim saved before a dashboard receipt. On a later conversation use dashboard_get_request to recover.` : '') + (evidence.pending ? `\nDashboard changes are pending without a matching draft save receipt. Unsaved files: ${JSON.stringify(evidence.pendingPaths)}. Continue reading/repairing and call dashboard_create_html or dashboard_update with the exact file path; do not finish or claim it was saved. When abandoning earlier unsaved HTML creation candidates, explicitly pass their exact paths as supersedesPaths to dashboard_create or dashboard_create_html, matching the requested presentation mode. If a standard dashboard is already saved, repeat dashboard_create with the same definition/previewIds and supersedesPaths; do not create an unwanted HTML dashboard. This only abandons those candidates after a successful save; it never discards another Artifact editing copy.` : '') + (options.allowedFinalProviders ? `\nThis Assistant requires every saved dashboard binding to use one of these providers: ${options.allowedFinalProviders.join(', ')}. Other providers may be previewed only as upstream inputs. Do not save a direct-source substitute.` : '') + (exhausted ? '\nThe dashboard tool budget is exhausted. Stop calls; report only saved receipts or explain the concrete blocker truthfully.' : '') }
279
+ { type: 'text', text: `Current dashboard authoring limit: ${this.service.maxBindings} Bindings (storage maximum 64). Shared charts may reuse one Binding; independent filter-option queries count too. Preview in batches, preserving each receipt and filter check.\n` + bundled_example_source_1.EXAMPLE_SOURCE_GUIDANCE + '\n' + exports.DASHBOARD_GUIDANCE + '\n' + analysis_scene_tool_1.ANALYSIS_SCENE_GUIDANCE + (editing.current() ? `\nCurrent editing target: ${JSON.stringify(editing.current())}. Use this identity for requested edits. A selected dashboard alone requires no tool call.` : '') + (delivery ? '\n' + delivery.guidance : '') + '\n' + definition_tools_1.DEFINITION_GUIDANCE + '\n' + html_guidance_1.HTML_DASHBOARD_GUIDANCE + '\n' + html_guidance_1.HTML_QUERY_ROUNDS + '\n' + editing_1.EDITING_GUIDANCE + (activeRequests.size ? `\nDurable save requests pending: ${JSON.stringify([...activeRequests])}. Keep calling dashboard_wait_request with the returned requestId and cursor until terminal. Do not resubmit or claim saved before a dashboard receipt. On a later conversation use dashboard_get_request to recover.` : '') + (evidence.pending ? `\nDashboard changes are pending without a matching draft save receipt. Unsaved files: ${JSON.stringify(evidence.pendingPaths)}. Continue reading/repairing and call dashboard_create_html or dashboard_update with the exact file path; do not finish or claim it was saved. When abandoning earlier unsaved HTML creation candidates, explicitly pass their exact paths as supersedesPaths to dashboard_create or dashboard_create_html, matching the requested presentation mode. If a standard dashboard is already saved, repeat dashboard_create with the same definition/previewIds and supersedesPaths; do not create an unwanted HTML dashboard. This only abandons those candidates after a successful save; it never discards another Artifact editing copy.` : '') + (options.allowedFinalProviders ? `\nThis Assistant requires every saved dashboard binding to use one of these providers: ${options.allowedFinalProviders.join(', ')}. Other providers may be previewed only as upstream inputs. Do not save a direct-source substitute.` : '') + (exhausted ? '\nThe dashboard tool budget is exhausted. Stop calls; report only saved receipts or explain the concrete blocker truthfully.' : '') }
255
280
  ] }) });
256
281
  if ((evidence.pending || activeRequests.size) && result && !result.tool_calls?.length)
257
282
  throw new Error('DASHBOARD_SAVE_NOT_CONFIRMED: the model stopped without a successful draft save receipt.');
283
+ const verified = delivery?.verifiedDraft;
284
+ if (verified && !evidence.pending && !activeRequests.size && result?.tool_calls?.length &&
285
+ result.tool_calls.every(({ name, args }) => name === 'dashboard_open' && !args.versionId &&
286
+ (args.artifactId ?? editing.current()?.artifactId) === verified.artifactId &&
287
+ (args.artifactId || !editing.current()?.versionId))) {
288
+ // Some models request the same read even after seeing its result. The card and revision are already verified.
289
+ const content = typeof result.content === 'string' ? result.content :
290
+ result.content.map(part => part.type === 'text' && typeof part.text === 'string' ? part.text : '').join('');
291
+ return new messages_1.AIMessage({ content: content.trim() || [verified.title, `Draft r${verified.draftRevision}`].filter(Boolean).join(' · '),
292
+ id: result.id, usage_metadata: result.usage_metadata, response_metadata: result.response_metadata });
293
+ }
258
294
  return result;
259
- }, tools: [
295
+ }, tools: (0, runtime_context_1.dashboardProjectTools)(context.projectId, [
296
+ ...(this.evidenceSnapshots ? [(0, tools_1.tool)(async (input) => JSON.stringify(await this.evidenceSnapshots.capture(scope, input)), {
297
+ name: 'dashboard_capture_evidence', schema: evidence_service_1.captureEvidenceSchema,
298
+ description: 'Capture immutable evidence from an explicitly selected published dashboard version and exact controls. Preserves data types, units, completeness, certification and cell citations. Use a UUID requestId; retry unknown outcomes with the same request. Changed sources require a new snapshot; never overwrite existing reports.'
299
+ })] : []),
300
+ ...(this.evidenceTransfers ? [(0, tools_1.tool)(async (input) => JSON.stringify(await this.evidenceTransfers.convert(scope, input)), {
301
+ name: 'dashboard_convert_evidence', schema: evidence_view_provider_1.evidenceConvertSchema,
302
+ description: 'Create an independent native document or Motion video draft from saved evidence, only when the user requests it. Rechecks current source access. Reuse requestId on retry; existing manual edits are preserved. Motion includes fixed timed captions but no generated voiceover. Return the native resource receipt, never claim publication or video rendering.'
303
+ })] : []),
260
304
  ...(this.libraryExecution ? [(0, tools_1.tool)(async (input, config) => {
261
305
  const result = await this.libraryExecution.instantiate(scope, input, options.allowedFinalProviders);
262
306
  if ('dashboard' in result && result.dashboard) {
@@ -312,7 +356,34 @@ let DashboardMiddleware = class DashboardMiddleware {
312
356
  const controls = Object.fromEntries(binding.parameters.map(parameter => [parameter.controlId, parameter.defaultValue ?? null]));
313
357
  return this.service.preview(scope, { binding, controls });
314
358
  }, runId, () => plugin_sdk_1.RequestContext.getLanguageCode() ?? 'en'),
315
- ...(0, definition_tools_1.createDefinitionTools)(context, () => { listedSources = undefined; }),
359
+ ...(0, definition_tools_1.createDefinitionTools)(context, () => { listedSources = undefined; }, async (id, receipt) => {
360
+ exampleSources.set(id, receipt && (0, analytics_1.analyticsSourceKey)(receipt.source));
361
+ if (!receipt) {
362
+ for (const key of exampleQueries.keys())
363
+ if (key.startsWith(id + '/'))
364
+ exampleQueries.delete(key);
365
+ return;
366
+ }
367
+ const input = { source: receipt.source, providerId: receipt.providerId };
368
+ const listing = await discover({ ...input, request: {} });
369
+ const [dataset] = listing.items;
370
+ if (listing.items.length !== 1)
371
+ throw new Error('DASHBOARD_EXAMPLE_DATASET_UNAVAILABLE');
372
+ const metadataSchema = v3_1.z.object({ binding: plugin_sdk_1.analyticsBindingSchema });
373
+ let parsed = metadataSchema.safeParse(dataset.metadata);
374
+ if (!parsed.success && dataset.inspectRequest) {
375
+ const inspected = await discover({ ...input, request: dataset.inspectRequest });
376
+ parsed = metadataSchema.safeParse(inspected.items.find(item => item.id === dataset.id)?.metadata);
377
+ }
378
+ if (!parsed.success || !(0, analytics_source_1.sameAnalyticsResource)(parsed.data.binding.source, receipt.source) || parsed.data.binding.providerId !== receipt.providerId)
379
+ throw new Error('DASHBOARD_EXAMPLE_BINDING_UNAVAILABLE');
380
+ const binding = parsed.data.binding;
381
+ const query = await (0, bundled_example_source_1.exampleSummaryQuery)(id, binding);
382
+ if (!query)
383
+ return { binding };
384
+ exampleQueries.set(query.key, query.binding);
385
+ return { binding, preparedQuery: { description: query.description, previewRequest: { exampleQuery: query.key } } };
386
+ }),
316
387
  (0, tools_1.tool)(async () => JSON.stringify({ libraries: (await (0, document_libraries_1.bundledLibraries)()).map(({ source, ...lock }) => lock),
317
388
  online: { enabled: true, ...document_network_1.DASHBOARD_NETWORK_POLICY,
318
389
  usage: 'Network access is temporarily unrestricted for functional acceptance: CDN scripts/styles/fonts, external images, CSS imports and fetch/XHR are available, subject to browser CORS and mixed-content rules. Tailwind CDN is supported. Use exact versions when possible. Business data from platform sources must still use window.xpertLiveArtifact and saved Bindings; never embed credentials.' },
@@ -337,7 +408,7 @@ let DashboardMiddleware = class DashboardMiddleware {
337
408
  listedSources = await this.service.sources(scope);
338
409
  return JSON.stringify(listedSources);
339
410
  }, {
340
- name: 'dashboard_list_sources', description: 'List authorized analytics sources and versioned providers. Start here; IDs must come from this list.',
411
+ name: 'dashboard_list_sources', description: 'List registered analytics sources and versioned providers. For an explicitly named bundled demo, call analytics_definition_register with exampleId first; these names do not identify skill recipes.',
341
412
  schema: v3_1.z.object({}).strict(), verboseParsingErrors: true, metadata: { toolName: { en_US: 'List analytics sources', zh_Hans: '发现分析数据源' } }
342
413
  }),
343
414
  (0, tools_1.tool)(async (input) => {
@@ -351,9 +422,19 @@ let DashboardMiddleware = class DashboardMiddleware {
351
422
  return preview(binding);
352
423
  }, { name: 'dashboard_preview', description: 'Run one read-only binding using parameters[].defaultValue. Automatically discovers the source/provider query contract when absent in this run; use dashboard_discover to inspect business metadata or repair invalid queries. Returns validated Dataset fields, first 20 rows, full query completeness and audit. Required before create; changes to binding/defaults require another preview.',
353
424
  schema: agent_schema_1.previewToolSchema, verboseParsingErrors: true, metadata: { toolName: { en_US: 'Verify dashboard data', zh_Hans: '预览并验证看板数据' } } }),
354
- (0, tools_1.tool)(async ({ bindingJson }) => preview(plugin_sdk_1.analyticsBindingSchema.parse((0, json_input_1.parseJsonInput)(bindingJson, 'bindingJson'))), {
355
- name: 'dashboard_preview_binding', description: 'Preview a complete canonical AnalyticsBinding returned by another tool. When editing an existing dashboard, copy dashboard_open.bindings[], preserve binding.id and existing parameters[].controlId, and change only the requested query/parameters. Binding ID is independent of output.datasetId. Serialize the complete Binding (also supported: discovery items[].metadata.binding), including parameters[].controlId. bindingPayload is only the payload, not a Binding. If adding a parameter, include name, controlId, type, required and defaultValue. Do not convert it to the simplified dashboard_preview input, which derives binding.id from output.datasetId. Automatically discovers the source/provider query contract when absent in this run. Returns a current-run previewId for dashboard_create or dashboard_update; include every intended changed/new Binding receipt and matching controls in the same save.',
356
- schema: v3_1.z.object({ bindingJson: v3_1.z.string().min(2).max(200000) }).strict(), verboseParsingErrors: true,
425
+ (0, tools_1.tool)(async ({ bindingJson, exampleQuery }) => {
426
+ if (bindingJson !== undefined && exampleQuery === undefined)
427
+ return preview(plugin_sdk_1.analyticsBindingSchema.parse((0, json_input_1.parseJsonInput)(bindingJson, 'bindingJson')));
428
+ if (exampleQuery !== undefined && bindingJson === undefined) {
429
+ const binding = exampleQueries.get(exampleQuery);
430
+ if (binding)
431
+ return preview(binding);
432
+ throw new Error('DASHBOARD_EXAMPLE_QUERY_UNAVAILABLE: register the named example in this run and use its returned previewRequest.');
433
+ }
434
+ throw new Error('Supply exactly one of bindingJson or exampleQuery.');
435
+ }, {
436
+ name: 'dashboard_preview_binding', description: 'For a matching registered bundled sample query, use its exact previewRequest (exampleQuery only). Otherwise preview a complete canonical AnalyticsBinding returned by another tool. When editing an existing dashboard, copy dashboard_open.bindings[], preserve binding.id and existing parameters[].controlId, and change only the requested query/parameters. Binding ID is independent of output.datasetId. Serialize the complete Binding (also supported: discovery items[].metadata.binding), including parameters[].controlId. bindingPayload is only the payload, not a Binding. If adding a parameter, include name, controlId, type, required and defaultValue. Do not convert it to the simplified dashboard_preview input, which derives binding.id from output.datasetId. Automatically discovers the source/provider query contract when absent in this run. Returns a current-run previewId for dashboard_create or dashboard_update; include every intended changed/new Binding receipt and matching controls in the same save.',
437
+ schema: v3_1.z.object({ bindingJson: v3_1.z.string().min(2).max(200000).optional(), exampleQuery: v3_1.z.string().min(1).max(128).optional() }).strict(), verboseParsingErrors: true,
357
438
  metadata: { toolName: { en_US: 'Verify registered dataset', zh_Hans: '验证已注册数据集' } }
358
439
  }),
359
440
  (0, tools_1.tool)(async (input, config) => save(input, config), { name: 'dashboard_create', description: 'Save a standard chart/table dashboard from previewId receipts. For custom HTML use dashboard_create_html. Fields and defaults must match previewed parameters. Returns a saved Artifact receipt after current access/data revalidation.',
@@ -375,7 +456,7 @@ let DashboardMiddleware = class DashboardMiddleware {
375
456
  }, { name: 'dashboard_create_html', description: 'Save custom HTML from a Workspace path together with run-local preview receipts and controls in one persistent draft (human publication is separate). Requires real data preview; does not accept query payloads or cached rows.',
376
457
  schema: agent_schema_1.createHtmlToolSchema, verboseParsingErrors: true,
377
458
  metadata: { toolName: { en_US: 'Save HTML dashboard', zh_Hans: '保存自由样式看板' } } })
378
- ] };
459
+ ]) };
379
460
  }
380
461
  };
381
462
  exports.DashboardMiddleware = DashboardMiddleware;
@@ -383,8 +464,11 @@ exports.DashboardMiddleware = DashboardMiddleware = __decorate([
383
464
  (0, plugin_sdk_1.AgentMiddlewareStrategy)('LiveDashboard'),
384
465
  __param(1, (0, common_1.Optional)()),
385
466
  __param(2, (0, common_1.Optional)()),
467
+ __param(3, (0, common_1.Optional)()),
468
+ __param(4, (0, common_1.Optional)()),
386
469
  __metadata("design:paramtypes", [dashboard_service_1.DashboardService, save_requests_1.DashboardSaveRequests,
387
- template_execution_service_1.LibraryTemplateExecutionService])
470
+ template_execution_service_1.LibraryTemplateExecutionService,
471
+ evidence_service_1.AnalysisEvidenceService, evidence_transfers_1.AnalysisEvidenceTransfers])
388
472
  ], DashboardMiddleware);
389
473
  function previewKey(binding, controls) {
390
474
  return hash({ binding, controls: Object.fromEntries(binding.parameters.map((parameter) => [parameter.controlId, Object.hasOwn(controls, parameter.controlId) ? controls[parameter.controlId] : parameter.defaultValue ?? null])) });
@@ -63,7 +63,7 @@ let DashboardMonitorMiddleware = class DashboardMonitorMiddleware {
63
63
  createMiddleware(options, context) {
64
64
  v3_1.z.object({}).strict().parse(options ?? {});
65
65
  const scope = (0, runtime_context_1.dashboardRuntimeContext)(context);
66
- return { name: 'LiveDashboardMonitor', tools: [
66
+ return { name: 'LiveDashboardMonitor', tools: (0, runtime_context_1.dashboardProjectTools)(context.projectId, [
67
67
  (0, tools_1.tool)(async ({ artifactId, freshness }) => JSON.stringify(await this.monitor.inspect(scope, artifactId, freshness)), {
68
68
  name: 'dashboard_inspect', description: 'Check one explicitly selected published Project dashboard as the current run actor. Returns compact binding availability and query timestamps, never data rows. Does not modify or publish. Query time is not proof of business-data freshness. Only an explicitly configured freshness rule checks the latest returned declared timestamp, and incomplete results remain unknown. Scheduled runs retain this receipt in platform execution history.',
69
69
  schema: v3_1.z.object({ artifactId: v3_1.z.string().uuid(), freshness: freshnessRuleSchema.optional() }).strict(), verboseParsingErrors: true,
@@ -78,7 +78,7 @@ let DashboardMonitorMiddleware = class DashboardMonitorMiddleware {
78
78
  }, { name: 'dashboard_list_published', description: 'List published dashboards in the current Project. Follow hasMore/page; never infer the target from recency.',
79
79
  schema: v3_1.z.object({ page: v3_1.z.number().int().positive().default(1) }).strict(), verboseParsingErrors: true,
80
80
  metadata: { toolName: { en_US: 'List published dashboards', zh_Hans: '列出正式看板' } } })
81
- ] };
81
+ ]) };
82
82
  }
83
83
  };
84
84
  exports.DashboardMonitorMiddleware = DashboardMonitorMiddleware;
@@ -7,6 +7,11 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  };
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.LiveDashboardPlugin = void 0;
10
+ const evidence_transfers_1 = require("./evidence/evidence-transfers");
11
+ const evidence_view_provider_1 = require("./evidence/evidence-view.provider");
12
+ const evidence_entity_1 = require("./evidence/evidence.entity");
13
+ const evidence_service_1 = require("./evidence/evidence.service");
14
+ const evidence_provider_1 = require("./evidence/evidence.provider");
10
15
  const library_view_provider_1 = require("./library-view.provider");
11
16
  const dataset_service_1 = require("./dataset.service");
12
17
  const template_service_1 = require("./template.service");
@@ -41,5 +46,5 @@ let LiveDashboardPlugin = class LiveDashboardPlugin {
41
46
  };
42
47
  exports.LiveDashboardPlugin = LiveDashboardPlugin;
43
48
  exports.LiveDashboardPlugin = LiveDashboardPlugin = __decorate([
44
- (0, plugin_sdk_1.XpertServerPlugin)({ imports: [typeorm_1.TypeOrmModule.forFeature(entities_1.LIBRARY_V2_ENTITIES)], entities: entities_1.LIBRARY_V2_ENTITIES, controllers: [provider_options_controller_1.DashboardProviderOptionsController], providers: [directory_service_1.LibraryDirectoryService, execution_resolution_1.LibraryExecutionResolution, dataset_binding_service_1.LibraryDatasetBindingService, template_execution_service_1.LibraryTemplateExecutionService, task_preparation_service_1.LibraryTaskPreparationService, catalog_service_1.LibraryCatalogService, files_service_1.LibraryFilesService, transfers_service_1.LibraryTransfersService, file_artifact_provider_1.LibraryFileArtifactType, library_view_provider_1.DashboardLibraryViewProvider, dataset_service_1.DashboardDatasetService, template_service_1.DashboardTemplateService, dataset_artifact_provider_1.DashboardDatasetArtifactType, save_requests_1.DashboardSaveRequests, archive_service_1.DashboardArchiveService, projects_service_1.DashboardProjectsService, monitor_1.DashboardMonitor, monitor_1.DashboardMonitorMiddleware, artifact_type_provider_1.DashboardArtifactType, content_capability_1.DashboardCapability, content_provider_1.DashboardContentProvider, content_provider_1.DashboardContentEditor, dashboard_service_1.DashboardService, view_provider_1.DashboardViewProvider, middleware_1.DashboardMiddleware, html_validation_1.HtmlDashboardValidation, presentation_provider_1.DashboardPresentationProvider, sharing_service_1.DashboardSharingService] })
49
+ (0, plugin_sdk_1.XpertServerPlugin)({ imports: [typeorm_1.TypeOrmModule.forFeature([...entities_1.LIBRARY_V2_ENTITIES, evidence_entity_1.AnalysisEvidenceRecord])], entities: [...entities_1.LIBRARY_V2_ENTITIES, evidence_entity_1.AnalysisEvidenceRecord], controllers: [provider_options_controller_1.DashboardProviderOptionsController], providers: [evidence_transfers_1.AnalysisEvidenceTransfers, evidence_view_provider_1.AnalysisEvidenceView, evidence_view_provider_1.AnalysisEvidenceEditor, evidence_service_1.AnalysisEvidenceService, evidence_provider_1.AnalysisEvidenceArtifactType, evidence_provider_1.AnalysisEvidenceContent, directory_service_1.LibraryDirectoryService, execution_resolution_1.LibraryExecutionResolution, dataset_binding_service_1.LibraryDatasetBindingService, template_execution_service_1.LibraryTemplateExecutionService, task_preparation_service_1.LibraryTaskPreparationService, catalog_service_1.LibraryCatalogService, files_service_1.LibraryFilesService, transfers_service_1.LibraryTransfersService, file_artifact_provider_1.LibraryFileArtifactType, library_view_provider_1.DashboardLibraryViewProvider, dataset_service_1.DashboardDatasetService, template_service_1.DashboardTemplateService, dataset_artifact_provider_1.DashboardDatasetArtifactType, save_requests_1.DashboardSaveRequests, archive_service_1.DashboardArchiveService, projects_service_1.DashboardProjectsService, monitor_1.DashboardMonitor, monitor_1.DashboardMonitorMiddleware, artifact_type_provider_1.DashboardArtifactType, content_capability_1.DashboardCapability, content_provider_1.DashboardContentProvider, content_provider_1.DashboardContentEditor, dashboard_service_1.DashboardService, view_provider_1.DashboardViewProvider, middleware_1.DashboardMiddleware, html_validation_1.HtmlDashboardValidation, presentation_provider_1.DashboardPresentationProvider, sharing_service_1.DashboardSharingService] })
45
50
  ], LiveDashboardPlugin);
@@ -3,7 +3,7 @@ import { type ArtifactQueryInput, type ArtifactQueryPriority } from '@xpert-ai/p
3
3
  import type { DashboardManifest } from './dashboard.schema';
4
4
  import { type SourceEvent } from './source-executions';
5
5
  /** One saved definition and actor. No cache survives a navigation or a version change. */
6
- export declare function createDashboardQuerySession(manifest: DashboardManifest, execute: (input: ArtifactQueryInput) => Promise<AnalyticalDataset>, changed: (datasets: AnalyticalDataset[], failures: string[]) => void, event: (event: SourceEvent) => void, busy: (value: boolean) => void): {
6
+ export declare function createDashboardQuerySession(manifest: DashboardManifest, execute: (input: ArtifactQueryInput) => Promise<AnalyticalDataset>, changed: (datasets: AnalyticalDataset[], failures: string[]) => void, event: (event: SourceEvent) => void, busy: (value: boolean) => void, cachePolicy?: () => number): {
7
7
  query(values: ArtifactQueryInput["controls"], priority?: ArtifactQueryPriority, only?: string[]): Promise<void>;
8
8
  dispose(): void;
9
9
  };
@@ -4,9 +4,9 @@ exports.createDashboardQuerySession = createDashboardQuerySession;
4
4
  const artifact_document_1 = require("@xpert-ai/plugin-sdk/artifact-document");
5
5
  const source_executions_1 = require("./source-executions");
6
6
  /** One saved definition and actor. No cache survives a navigation or a version change. */
7
- function createDashboardQuerySession(manifest, execute, changed, event, busy) {
7
+ function createDashboardQuerySession(manifest, execute, changed, event, busy, cachePolicy = () => 0) {
8
8
  const results = new Map(), failures = new Set();
9
- const keys = new Map(), requests = new Map(), pending = new Set();
9
+ const keys = new Map(), requests = new Map(), pending = new Set(), completed = new Map();
10
10
  let sequence = 0, disposed = false;
11
11
  const publish = () => { if (!disposed)
12
12
  changed([...results.values()], [...failures]); };
@@ -23,8 +23,11 @@ function createDashboardQuerySession(manifest, execute, changed, event, busy) {
23
23
  return [];
24
24
  const controls = Object.fromEntries(binding.parameters.map(parameter => [parameter.controlId,
25
25
  Object.hasOwn(values, parameter.controlId) ? values[parameter.controlId] : parameter.defaultValue ?? null]));
26
- const key = JSON.stringify(controls);
27
- if (priority === 'interactive' && keys.get(binding.id) === key && !failures.has(binding.output.datasetId))
26
+ const maxAgeMs = cachePolicy();
27
+ const cache = maxAgeMs ? { maxAgeMs, forceRefresh: priority === 'refresh' } : undefined;
28
+ const key = JSON.stringify([controls, cache]);
29
+ if (priority === 'interactive' && keys.get(binding.id) === key && !failures.has(binding.output.datasetId) &&
30
+ (!maxAgeMs || Date.now() - (completed.get(binding.id) ?? 0) < maxAgeMs))
28
31
  return [];
29
32
  // A repeated refresh shares both the physical query and its Sources lifecycle.
30
33
  const requestId = keys.get(binding.id) === key && pending.has(binding.id) ? requests.get(binding.id) : String(++sequence);
@@ -33,16 +36,18 @@ function createDashboardQuerySession(manifest, execute, changed, event, busy) {
33
36
  requests.set(binding.id, requestId);
34
37
  results.delete(binding.output.datasetId);
35
38
  failures.delete(binding.output.datasetId);
36
- return [{ binding, controls, requestId }];
39
+ return [{ binding, controls, cache, requestId }];
37
40
  });
38
41
  // Remove every affected old-parameter dataset before publishing any new result.
39
42
  publish();
40
- await Promise.all(affected.map(async ({ binding, controls, requestId }) => {
43
+ await Promise.all(affected.map(async ({ binding, controls, cache, requestId }) => {
41
44
  try {
42
- const result = await scheduler.query({ bindingId: binding.id, controls }, priority);
45
+ const result = await scheduler.query({ bindingId: binding.id, controls,
46
+ ...(cache ? { cache } : {}) }, priority);
43
47
  if (disposed || requests.get(binding.id) !== requestId)
44
48
  return;
45
49
  results.set(binding.output.datasetId, result);
50
+ completed.set(binding.id, Date.parse(result.freshness.executedAt));
46
51
  if (new TextEncoder().encode(JSON.stringify([...results.values()])).byteLength > 3_000_000) {
47
52
  results.delete(binding.output.datasetId);
48
53
  throw new Error('DASHBOARD_RESULT_TOO_LARGE');
@@ -59,6 +64,6 @@ function createDashboardQuerySession(manifest, execute, changed, event, busy) {
59
64
  publish();
60
65
  }));
61
66
  },
62
- dispose() { disposed = true; scheduler.dispose(); results.clear(); requests.clear(); keys.clear(); pending.clear(); }
67
+ dispose() { disposed = true; scheduler.dispose(); results.clear(); requests.clear(); keys.clear(); pending.clear(); completed.clear(); }
63
68
  };
64
69
  }
@@ -1,4 +1,4 @@
1
- export declare function dashboardRemoteEntry(readOnly?: boolean, page?: 'explore' | 'templates' | 'data', singleDashboard?: boolean): Promise<{
1
+ export declare function dashboardRemoteEntry(readOnly?: boolean, page?: 'explore' | 'templates' | 'data' | 'evidence', singleDashboard?: boolean): Promise<{
2
2
  html: string;
3
3
  contentType: "text/html; charset=utf-8";
4
4
  }>;
@@ -1,3 +1,5 @@
1
+ import type { DynamicStructuredTool } from '@langchain/core/tools';
1
2
  import type { XpertResolvedViewHostContext } from '@xpert-ai/contracts';
2
3
  import { type IAgentMiddlewareContext } from '@xpert-ai/plugin-sdk';
3
4
  export declare function dashboardRuntimeContext(context: IAgentMiddlewareContext): XpertResolvedViewHostContext;
5
+ export declare function dashboardProjectTools(projectId: string | undefined, operations: DynamicStructuredTool[]): DynamicStructuredTool[];
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.dashboardRuntimeContext = dashboardRuntimeContext;
4
+ exports.dashboardProjectTools = dashboardProjectTools;
5
+ const messages_1 = require("@langchain/core/messages");
4
6
  const plugin_sdk_1 = require("@xpert-ai/plugin-sdk");
5
7
  function dashboardRuntimeContext(context) {
6
8
  if (!context.xpertId)
@@ -12,3 +14,22 @@ function dashboardRuntimeContext(context) {
12
14
  ...(context.projectId ? { runtimeScope: { projectId: context.projectId, conversationId: context.conversationId ?? null,
13
15
  dataScopeKey: `project:${context.projectId}`, workspaceFiles: { catalog: 'projects', scopeId: context.projectId, projectId: context.projectId } } } : {}) };
14
16
  }
17
+ const missingProject = JSON.stringify({
18
+ code: 'PROJECT_REQUIRED',
19
+ message: 'Dashboard operations need a Project. Ask the user to select or create one, then retry this operation.'
20
+ });
21
+ function dashboardProjectTools(projectId, operations) {
22
+ for (const operation of operations) {
23
+ const execute = operation.func;
24
+ // A refused call is visible to the model. It performs no workspace operation to attach to chat history.
25
+ if (!projectId)
26
+ operation.metadata = { ...operation.metadata, internal: true };
27
+ operation.func = async (input, callbacks, config) => {
28
+ if (projectId)
29
+ return execute(input, callbacks, config);
30
+ const id = config?.toolCall?.id;
31
+ return id ? new messages_1.ToolMessage({ name: operation.name, tool_call_id: id, status: 'error', content: missingProject }) : missingProject;
32
+ };
33
+ }
34
+ return operations;
35
+ }
@@ -46,14 +46,17 @@ export declare const sourceDatasetSchema: z.ZodObject<{
46
46
  executionId: z.ZodString;
47
47
  bindingId: z.ZodString;
48
48
  providerId: z.ZodString;
49
+ certification: z.ZodOptional<z.ZodType<import("@xpert-ai/contracts").AnalyticsCertification, z.ZodTypeDef, import("@xpert-ai/contracts").AnalyticsCertification>>;
49
50
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
50
51
  executionId: z.ZodString;
51
52
  bindingId: z.ZodString;
52
53
  providerId: z.ZodString;
54
+ certification: z.ZodOptional<z.ZodType<import("@xpert-ai/contracts").AnalyticsCertification, z.ZodTypeDef, import("@xpert-ai/contracts").AnalyticsCertification>>;
53
55
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
54
56
  executionId: z.ZodString;
55
57
  bindingId: z.ZodString;
56
58
  providerId: z.ZodString;
59
+ certification: z.ZodOptional<z.ZodType<import("@xpert-ai/contracts").AnalyticsCertification, z.ZodTypeDef, import("@xpert-ai/contracts").AnalyticsCertification>>;
57
60
  }, z.ZodTypeAny, "passthrough">>;
58
61
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
59
62
  schema: z.ZodLiteral<"xpert.analytics.dataset">;
@@ -102,14 +105,17 @@ export declare const sourceDatasetSchema: z.ZodObject<{
102
105
  executionId: z.ZodString;
103
106
  bindingId: z.ZodString;
104
107
  providerId: z.ZodString;
108
+ certification: z.ZodOptional<z.ZodType<import("@xpert-ai/contracts").AnalyticsCertification, z.ZodTypeDef, import("@xpert-ai/contracts").AnalyticsCertification>>;
105
109
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
106
110
  executionId: z.ZodString;
107
111
  bindingId: z.ZodString;
108
112
  providerId: z.ZodString;
113
+ certification: z.ZodOptional<z.ZodType<import("@xpert-ai/contracts").AnalyticsCertification, z.ZodTypeDef, import("@xpert-ai/contracts").AnalyticsCertification>>;
109
114
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
110
115
  executionId: z.ZodString;
111
116
  bindingId: z.ZodString;
112
117
  providerId: z.ZodString;
118
+ certification: z.ZodOptional<z.ZodType<import("@xpert-ai/contracts").AnalyticsCertification, z.ZodTypeDef, import("@xpert-ai/contracts").AnalyticsCertification>>;
113
119
  }, z.ZodTypeAny, "passthrough">>;
114
120
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
115
121
  schema: z.ZodLiteral<"xpert.analytics.dataset">;
@@ -158,14 +164,17 @@ export declare const sourceDatasetSchema: z.ZodObject<{
158
164
  executionId: z.ZodString;
159
165
  bindingId: z.ZodString;
160
166
  providerId: z.ZodString;
167
+ certification: z.ZodOptional<z.ZodType<import("@xpert-ai/contracts").AnalyticsCertification, z.ZodTypeDef, import("@xpert-ai/contracts").AnalyticsCertification>>;
161
168
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
162
169
  executionId: z.ZodString;
163
170
  bindingId: z.ZodString;
164
171
  providerId: z.ZodString;
172
+ certification: z.ZodOptional<z.ZodType<import("@xpert-ai/contracts").AnalyticsCertification, z.ZodTypeDef, import("@xpert-ai/contracts").AnalyticsCertification>>;
165
173
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
166
174
  executionId: z.ZodString;
167
175
  bindingId: z.ZodString;
168
176
  providerId: z.ZodString;
177
+ certification: z.ZodOptional<z.ZodType<import("@xpert-ai/contracts").AnalyticsCertification, z.ZodTypeDef, import("@xpert-ai/contracts").AnalyticsCertification>>;
169
178
  }, z.ZodTypeAny, "passthrough">>;
170
179
  }, z.ZodTypeAny, "passthrough">>;
171
180
  export type SourceDataset = z.infer<typeof sourceDatasetSchema>;
@@ -178,14 +187,17 @@ export declare const renderDatasetSchema: z.ZodObject<{
178
187
  executionId: z.ZodString;
179
188
  bindingId: z.ZodString;
180
189
  providerId: z.ZodString;
190
+ certification: z.ZodOptional<z.ZodType<import("@xpert-ai/contracts").AnalyticsCertification, z.ZodTypeDef, import("@xpert-ai/contracts").AnalyticsCertification>>;
181
191
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
182
192
  executionId: z.ZodString;
183
193
  bindingId: z.ZodString;
184
194
  providerId: z.ZodString;
195
+ certification: z.ZodOptional<z.ZodType<import("@xpert-ai/contracts").AnalyticsCertification, z.ZodTypeDef, import("@xpert-ai/contracts").AnalyticsCertification>>;
185
196
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
186
197
  executionId: z.ZodString;
187
198
  bindingId: z.ZodString;
188
199
  providerId: z.ZodString;
200
+ certification: z.ZodOptional<z.ZodType<import("@xpert-ai/contracts").AnalyticsCertification, z.ZodTypeDef, import("@xpert-ai/contracts").AnalyticsCertification>>;
189
201
  }, z.ZodTypeAny, "passthrough">>;
190
202
  } & {
191
203
  fields: z.ZodArray<z.ZodObject<{
@@ -224,16 +236,16 @@ export declare const renderDatasetSchema: z.ZodObject<{
224
236
  scope: z.ZodEnum<["full_query_result", "page", "sample", "top_n"]>;
225
237
  truncated: z.ZodBoolean;
226
238
  }, "strip", z.ZodTypeAny, {
227
- scope: "page" | "full_query_result" | "sample" | "top_n";
228
- truncated: boolean;
229
239
  returnedRows: number;
230
240
  totalAccuracy: "exact" | "unknown" | "estimated";
231
- totalRows?: number | undefined;
232
- }, {
233
241
  scope: "page" | "full_query_result" | "sample" | "top_n";
234
242
  truncated: boolean;
243
+ totalRows?: number | undefined;
244
+ }, {
235
245
  returnedRows: number;
236
246
  totalAccuracy: "exact" | "unknown" | "estimated";
247
+ scope: "page" | "full_query_result" | "sample" | "top_n";
248
+ truncated: boolean;
237
249
  totalRows?: number | undefined;
238
250
  }>;
239
251
  freshness: z.ZodObject<{
@@ -241,12 +253,12 @@ export declare const renderDatasetSchema: z.ZodObject<{
241
253
  sourceFetchedAt: z.ZodString;
242
254
  dataAsOf: z.ZodOptional<z.ZodString>;
243
255
  }, "strip", z.ZodTypeAny, {
244
- sourceFetchedAt: string;
245
256
  executedAt: string;
257
+ sourceFetchedAt: string;
246
258
  dataAsOf?: string | undefined;
247
259
  }, {
248
- sourceFetchedAt: string;
249
260
  executedAt: string;
261
+ sourceFetchedAt: string;
250
262
  dataAsOf?: string | undefined;
251
263
  }>;
252
264
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
@@ -257,14 +269,17 @@ export declare const renderDatasetSchema: z.ZodObject<{
257
269
  executionId: z.ZodString;
258
270
  bindingId: z.ZodString;
259
271
  providerId: z.ZodString;
272
+ certification: z.ZodOptional<z.ZodType<import("@xpert-ai/contracts").AnalyticsCertification, z.ZodTypeDef, import("@xpert-ai/contracts").AnalyticsCertification>>;
260
273
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
261
274
  executionId: z.ZodString;
262
275
  bindingId: z.ZodString;
263
276
  providerId: z.ZodString;
277
+ certification: z.ZodOptional<z.ZodType<import("@xpert-ai/contracts").AnalyticsCertification, z.ZodTypeDef, import("@xpert-ai/contracts").AnalyticsCertification>>;
264
278
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
265
279
  executionId: z.ZodString;
266
280
  bindingId: z.ZodString;
267
281
  providerId: z.ZodString;
282
+ certification: z.ZodOptional<z.ZodType<import("@xpert-ai/contracts").AnalyticsCertification, z.ZodTypeDef, import("@xpert-ai/contracts").AnalyticsCertification>>;
268
283
  }, z.ZodTypeAny, "passthrough">>;
269
284
  } & {
270
285
  fields: z.ZodArray<z.ZodObject<{
@@ -303,16 +318,16 @@ export declare const renderDatasetSchema: z.ZodObject<{
303
318
  scope: z.ZodEnum<["full_query_result", "page", "sample", "top_n"]>;
304
319
  truncated: z.ZodBoolean;
305
320
  }, "strip", z.ZodTypeAny, {
306
- scope: "page" | "full_query_result" | "sample" | "top_n";
307
- truncated: boolean;
308
321
  returnedRows: number;
309
322
  totalAccuracy: "exact" | "unknown" | "estimated";
310
- totalRows?: number | undefined;
311
- }, {
312
323
  scope: "page" | "full_query_result" | "sample" | "top_n";
313
324
  truncated: boolean;
325
+ totalRows?: number | undefined;
326
+ }, {
314
327
  returnedRows: number;
315
328
  totalAccuracy: "exact" | "unknown" | "estimated";
329
+ scope: "page" | "full_query_result" | "sample" | "top_n";
330
+ truncated: boolean;
316
331
  totalRows?: number | undefined;
317
332
  }>;
318
333
  freshness: z.ZodObject<{
@@ -320,12 +335,12 @@ export declare const renderDatasetSchema: z.ZodObject<{
320
335
  sourceFetchedAt: z.ZodString;
321
336
  dataAsOf: z.ZodOptional<z.ZodString>;
322
337
  }, "strip", z.ZodTypeAny, {
323
- sourceFetchedAt: string;
324
338
  executedAt: string;
339
+ sourceFetchedAt: string;
325
340
  dataAsOf?: string | undefined;
326
341
  }, {
327
- sourceFetchedAt: string;
328
342
  executedAt: string;
343
+ sourceFetchedAt: string;
329
344
  dataAsOf?: string | undefined;
330
345
  }>;
331
346
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
@@ -336,14 +351,17 @@ export declare const renderDatasetSchema: z.ZodObject<{
336
351
  executionId: z.ZodString;
337
352
  bindingId: z.ZodString;
338
353
  providerId: z.ZodString;
354
+ certification: z.ZodOptional<z.ZodType<import("@xpert-ai/contracts").AnalyticsCertification, z.ZodTypeDef, import("@xpert-ai/contracts").AnalyticsCertification>>;
339
355
  }, "passthrough", z.ZodTypeAny, z.objectOutputType<{
340
356
  executionId: z.ZodString;
341
357
  bindingId: z.ZodString;
342
358
  providerId: z.ZodString;
359
+ certification: z.ZodOptional<z.ZodType<import("@xpert-ai/contracts").AnalyticsCertification, z.ZodTypeDef, import("@xpert-ai/contracts").AnalyticsCertification>>;
343
360
  }, z.ZodTypeAny, "passthrough">, z.objectInputType<{
344
361
  executionId: z.ZodString;
345
362
  bindingId: z.ZodString;
346
363
  providerId: z.ZodString;
364
+ certification: z.ZodOptional<z.ZodType<import("@xpert-ai/contracts").AnalyticsCertification, z.ZodTypeDef, import("@xpert-ai/contracts").AnalyticsCertification>>;
347
365
  }, z.ZodTypeAny, "passthrough">>;
348
366
  } & {
349
367
  fields: z.ZodArray<z.ZodObject<{
@@ -382,16 +400,16 @@ export declare const renderDatasetSchema: z.ZodObject<{
382
400
  scope: z.ZodEnum<["full_query_result", "page", "sample", "top_n"]>;
383
401
  truncated: z.ZodBoolean;
384
402
  }, "strip", z.ZodTypeAny, {
385
- scope: "page" | "full_query_result" | "sample" | "top_n";
386
- truncated: boolean;
387
403
  returnedRows: number;
388
404
  totalAccuracy: "exact" | "unknown" | "estimated";
389
- totalRows?: number | undefined;
390
- }, {
391
405
  scope: "page" | "full_query_result" | "sample" | "top_n";
392
406
  truncated: boolean;
407
+ totalRows?: number | undefined;
408
+ }, {
393
409
  returnedRows: number;
394
410
  totalAccuracy: "exact" | "unknown" | "estimated";
411
+ scope: "page" | "full_query_result" | "sample" | "top_n";
412
+ truncated: boolean;
395
413
  totalRows?: number | undefined;
396
414
  }>;
397
415
  freshness: z.ZodObject<{
@@ -399,12 +417,12 @@ export declare const renderDatasetSchema: z.ZodObject<{
399
417
  sourceFetchedAt: z.ZodString;
400
418
  dataAsOf: z.ZodOptional<z.ZodString>;
401
419
  }, "strip", z.ZodTypeAny, {
402
- sourceFetchedAt: string;
403
420
  executedAt: string;
421
+ sourceFetchedAt: string;
404
422
  dataAsOf?: string | undefined;
405
423
  }, {
406
- sourceFetchedAt: string;
407
424
  executedAt: string;
425
+ sourceFetchedAt: string;
408
426
  dataAsOf?: string | undefined;
409
427
  }>;
410
428
  }, z.ZodTypeAny, "passthrough">>;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.renderDatasetSchema = exports.sourceDatasetSchema = void 0;
4
4
  exports.reduceSourceExecutions = reduceSourceExecutions;
5
+ const certification_schema_1 = require("./certification.schema");
5
6
  const v3_1 = require("zod/v3");
6
7
  const analytics_1 = require("@xpert-ai/plugin-sdk/analytics");
7
8
  const scalar = v3_1.z.union([v3_1.z.string(), v3_1.z.number(), v3_1.z.boolean(), v3_1.z.null()]);
@@ -10,7 +11,7 @@ exports.sourceDatasetSchema = v3_1.z.object({
10
11
  fields: v3_1.z.array(v3_1.z.object({ id: v3_1.z.string(), label: v3_1.z.string().optional() }).passthrough()), rows: v3_1.z.array(v3_1.z.record(scalar)),
11
12
  completeness: v3_1.z.object({ truncated: v3_1.z.boolean(), returnedRows: v3_1.z.number(), scope: v3_1.z.string(), totalAccuracy: v3_1.z.string() }).passthrough(),
12
13
  freshness: v3_1.z.object({ sourceFetchedAt: v3_1.z.string(), executedAt: v3_1.z.string().optional(), dataAsOf: v3_1.z.string().optional() }),
13
- provenance: v3_1.z.object({ executionId: v3_1.z.string(), bindingId: v3_1.z.string(), providerId: v3_1.z.string() }).passthrough()
14
+ provenance: v3_1.z.object({ executionId: v3_1.z.string(), bindingId: v3_1.z.string(), providerId: v3_1.z.string(), certification: certification_schema_1.certificationSchema.optional() }).passthrough()
14
15
  }).passthrough();
15
16
  /** Rendering needs the complete typed contract; inspection deliberately accepts a smaller projection. */
16
17
  exports.renderDatasetSchema = exports.sourceDatasetSchema.extend({