@xpert-ai/plugin-live-dashboard 0.3.1 → 0.4.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 (148) hide show
  1. package/.xpertai-plugin/plugin.json +10 -2
  2. package/README.md +6 -0
  3. package/assets/branding/cover-v1.prompt.txt +27 -0
  4. package/assets/branding/cover-v1.webp +0 -0
  5. package/assets/previews/customer-brief.png +0 -0
  6. package/assets/previews/profit-atlas.png +0 -0
  7. package/assets/previews/trend-workspace.png +0 -0
  8. package/dist/index.js +6 -3
  9. package/dist/lib/agent.schema.d.ts +43 -37
  10. package/dist/lib/agent.schema.js +2 -1
  11. package/dist/lib/app-config.d.ts +62 -0
  12. package/dist/lib/app-config.js +38 -0
  13. package/dist/lib/artifact-type.provider.d.ts +15 -0
  14. package/dist/lib/artifact-type.provider.js +78 -0
  15. package/dist/lib/assistant-template.d.ts +1 -2
  16. package/dist/lib/assistant-template.js +3 -52
  17. package/dist/lib/content.provider.js +13 -5
  18. package/dist/lib/dashboard-navigation.d.ts +58 -14
  19. package/dist/lib/dashboard-navigation.js +11 -10
  20. package/dist/lib/dashboard-view.schema.d.ts +197 -46
  21. package/dist/lib/dashboard-view.schema.js +8 -1
  22. package/dist/lib/dashboard.service.d.ts +39 -2
  23. package/dist/lib/dashboard.service.js +52 -28
  24. package/dist/lib/document-libraries.d.ts +1 -1
  25. package/dist/lib/document-libraries.js +3 -2
  26. package/dist/lib/document-network.d.ts +1 -1
  27. package/dist/lib/document-network.js +2 -6
  28. package/dist/lib/editing-feedback.d.ts +5 -0
  29. package/dist/lib/editing-feedback.js +19 -0
  30. package/dist/lib/editing-patch.d.ts +22 -0
  31. package/dist/lib/editing-patch.js +46 -0
  32. package/dist/lib/editing-session.d.ts +167 -0
  33. package/dist/lib/editing-session.js +53 -0
  34. package/dist/lib/editing.d.ts +92 -60
  35. package/dist/lib/editing.js +36 -24
  36. package/dist/lib/html-guidance.d.ts +1 -1
  37. package/dist/lib/html-guidance.js +1 -1
  38. package/dist/lib/middleware.js +42 -18
  39. package/dist/lib/monitor.d.ts +70 -0
  40. package/dist/lib/monitor.js +101 -0
  41. package/dist/lib/plugin.js +4 -1
  42. package/dist/lib/project.d.ts +106 -0
  43. package/dist/lib/project.js +17 -0
  44. package/dist/lib/projects.schema.d.ts +49 -0
  45. package/dist/lib/projects.schema.js +7 -0
  46. package/dist/lib/projects.service.d.ts +23 -0
  47. package/dist/lib/projects.service.js +65 -0
  48. package/dist/lib/resource-card.js +1 -1
  49. package/dist/lib/runtime-context.d.ts +3 -0
  50. package/dist/lib/runtime-context.js +13 -0
  51. package/dist/lib/save-evidence.d.ts +1 -1
  52. package/dist/lib/templates.d.ts +2 -0
  53. package/dist/lib/templates.js +55 -0
  54. package/dist/lib/view.provider.d.ts +97 -7
  55. package/dist/lib/view.provider.js +39 -10
  56. package/dist/libraries/TREND-WORKSPACE-ICONS-LICENSE.txt +43 -0
  57. package/dist/libraries/catalog.json +1 -1
  58. package/dist/remote/app.css +1 -1
  59. package/dist/remote/app.js +33 -33
  60. package/dist/remote/build-manifest.json +115 -32
  61. package/dist/sandbox-actions/action.json +1 -1
  62. package/dist/sandbox-actions/bundle/host.js +2 -2
  63. package/dist/sandbox-actions/bundle/resource-cache.mjs +2 -1
  64. package/dist/sandbox-actions/bundle/validate.mjs +1 -1
  65. package/docs/docs.json +7 -0
  66. package/docs/frontend-libraries.mdx +12 -4
  67. package/docs/html-mode.md +3 -3
  68. package/docs/quick-start-acceptance.mdx +50 -0
  69. package/docs/quick-start.mdx +64 -0
  70. package/docs/superstore.mdx +38 -0
  71. package/docs/team-sharing.mdx +6 -2
  72. package/docs/trend-workspace-acceptance.mdx +43 -0
  73. package/docs/trend-workspace.mdx +30 -0
  74. package/docs/verification.mdx +4 -2
  75. package/docs/visual-styles-acceptance.mdx +40 -0
  76. package/docs/visual-styles.mdx +46 -0
  77. package/package.json +23 -17
  78. package/skills/live-dashboard/SKILL.md +27 -3
  79. package/skills/live-dashboard/examples/README.md +25 -0
  80. package/skills/live-dashboard/examples/catalog.json +79 -0
  81. package/skills/live-dashboard/examples/production-quality/README.md +25 -0
  82. package/skills/live-dashboard/examples/production-quality/dashboard.html +129 -0
  83. package/skills/live-dashboard/examples/production-quality/definition.json +67 -0
  84. package/skills/live-dashboard/examples/production-quality/demo.csv +7 -0
  85. package/skills/live-dashboard/examples/production-quality/demo.json +44 -0
  86. package/skills/live-dashboard/examples/production-quality/expected.json +26 -0
  87. package/skills/live-dashboard/examples/production-quality/preview.png +0 -0
  88. package/skills/live-dashboard/examples/production-quality/query.json +53 -0
  89. package/skills/live-dashboard/examples/regional-sales/README.md +25 -0
  90. package/skills/live-dashboard/examples/regional-sales/dashboard-create.json +35 -0
  91. package/skills/live-dashboard/examples/regional-sales/definition.json +35 -0
  92. package/skills/live-dashboard/examples/regional-sales/demo.csv +5 -0
  93. package/skills/live-dashboard/examples/regional-sales/demo.json +18 -0
  94. package/skills/live-dashboard/examples/regional-sales/expected.json +19 -0
  95. package/skills/live-dashboard/examples/regional-sales/preview.png +0 -0
  96. package/skills/live-dashboard/examples/regional-sales/query.json +45 -0
  97. package/skills/live-dashboard/examples/sales-overview/README.md +25 -0
  98. package/skills/live-dashboard/examples/sales-overview/dashboard.html +129 -0
  99. package/skills/live-dashboard/examples/sales-overview/definition.json +57 -0
  100. package/skills/live-dashboard/examples/sales-overview/demo.csv +7 -0
  101. package/skills/live-dashboard/examples/sales-overview/demo.json +38 -0
  102. package/skills/live-dashboard/examples/sales-overview/expected.json +22 -0
  103. package/skills/live-dashboard/examples/sales-overview/preview.png +0 -0
  104. package/skills/live-dashboard/examples/sales-overview/query.json +52 -0
  105. package/skills/live-dashboard/examples/superstore/README.md +64 -0
  106. package/skills/live-dashboard/examples/superstore/THIRD_PARTY_LICENSE.txt +207 -0
  107. package/skills/live-dashboard/examples/superstore/build_data.py +155 -0
  108. package/skills/live-dashboard/examples/superstore/build_pages.py +129 -0
  109. package/skills/live-dashboard/examples/superstore/checks.json +104 -0
  110. package/skills/live-dashboard/examples/superstore/customers-mobile-dark.png +0 -0
  111. package/skills/live-dashboard/examples/superstore/customers-select.png +0 -0
  112. package/skills/live-dashboard/examples/superstore/customers.html +316 -0
  113. package/skills/live-dashboard/examples/superstore/customers.png +0 -0
  114. package/skills/live-dashboard/examples/superstore/customers.queries.json +512 -0
  115. package/skills/live-dashboard/examples/superstore/expected.json +4069 -0
  116. package/skills/live-dashboard/examples/superstore/import.json +200 -0
  117. package/skills/live-dashboard/examples/superstore/orders.csv +10195 -0
  118. package/skills/live-dashboard/examples/superstore/overview-mobile-dark.png +0 -0
  119. package/skills/live-dashboard/examples/superstore/overview-select.png +0 -0
  120. package/skills/live-dashboard/examples/superstore/overview.html +310 -0
  121. package/skills/live-dashboard/examples/superstore/overview.png +0 -0
  122. package/skills/live-dashboard/examples/superstore/overview.queries.json +636 -0
  123. package/skills/live-dashboard/examples/superstore/page.js +109 -0
  124. package/skills/live-dashboard/examples/superstore/profitability-mobile-dark.png +0 -0
  125. package/skills/live-dashboard/examples/superstore/profitability-select.png +0 -0
  126. package/skills/live-dashboard/examples/superstore/profitability.html +307 -0
  127. package/skills/live-dashboard/examples/superstore/profitability.png +0 -0
  128. package/skills/live-dashboard/examples/superstore/profitability.queries.json +334 -0
  129. package/skills/live-dashboard/examples/superstore/provenance.json +24 -0
  130. package/skills/live-dashboard/examples/superstore/semantic-model.json +220 -0
  131. package/skills/live-dashboard/examples/superstore/test_data.py +62 -0
  132. package/skills/live-dashboard/references/html-runtime.md +1 -1
  133. package/skills/live-dashboard/themes/README.md +50 -0
  134. package/skills/live-dashboard/themes/customer-brief/README.md +47 -0
  135. package/skills/live-dashboard/themes/customer-brief/charts.js +17 -0
  136. package/skills/live-dashboard/themes/customer-brief/layout.html +22 -0
  137. package/skills/live-dashboard/themes/customer-brief/theme.css +108 -0
  138. package/skills/live-dashboard/themes/profit-atlas/README.md +43 -0
  139. package/skills/live-dashboard/themes/profit-atlas/charts.js +30 -0
  140. package/skills/live-dashboard/themes/profit-atlas/layout.html +19 -0
  141. package/skills/live-dashboard/themes/profit-atlas/theme.css +75 -0
  142. package/skills/live-dashboard/themes/trend-workspace/ICON_LICENSE.txt +43 -0
  143. package/skills/live-dashboard/themes/trend-workspace/README.md +144 -0
  144. package/skills/live-dashboard/themes/trend-workspace/charts.js +60 -0
  145. package/skills/live-dashboard/themes/trend-workspace/icons.js +11 -0
  146. package/skills/live-dashboard/themes/trend-workspace/layout.html +45 -0
  147. package/skills/live-dashboard/themes/trend-workspace/select.js +127 -0
  148. package/skills/live-dashboard/themes/trend-workspace/theme.css +137 -0
@@ -52,8 +52,8 @@ let DashboardContentProvider = class DashboardContentProvider {
52
52
  },
53
53
  describe: input => this.describe(input),
54
54
  extract: async (input) => {
55
- const saved = await this.service.open(context(input), input.sourceResourceId);
56
- return (0, dashboard_search_1.dashboardSearchProjection)(saved.manifest, String(saved.draftRevision ?? 0));
55
+ const saved = await this.service.open(context(input), input.sourceResourceId, undefined, undefined, 'published');
56
+ return (0, dashboard_search_1.dashboardSearchProjection)(saved.manifest, saved.versionId ?? 'unpublished');
57
57
  },
58
58
  create: async (input) => {
59
59
  if (input.templateId)
@@ -130,6 +130,8 @@ let DashboardContentProvider = class DashboardContentProvider {
130
130
  const access = (await this.runtime.require(plugin_sdk_1.ProjectAccessRuntimeCapability).listReadable({ actor: input.actor, projectIds: [artifact.projectId] }))[0];
131
131
  if (!access)
132
132
  throw new common_1.ForbiddenException('DASHBOARD_ACCESS_DENIED');
133
+ if (access.role === 'member' && !artifact.currentVersionId)
134
+ throw new common_1.ForbiddenException('DASHBOARD_NOT_PUBLISHED');
133
135
  return { providerKey: exports.DASHBOARD_CONTENT_PROVIDER, resourceId: input.resourceId, title: artifact.title ?? '', role: access.role,
134
136
  canWrite: !access.archived && ['owner', 'manager', 'editor'].includes(access.role), canManage: access.canManage };
135
137
  }
@@ -141,14 +143,20 @@ let DashboardContentProvider = class DashboardContentProvider {
141
143
  const artifact = await this.runtime.require(plugin_sdk_1.ArtifactsRuntimeCapability).getArtifact(input.sourceResourceId);
142
144
  if (artifact.projectId !== input.projectId || artifact.status === 'deleted')
143
145
  throw new common_1.ForbiddenException('DASHBOARD_ACCESS_DENIED');
144
- const draft = await this.runtime.require(plugin_sdk_1.ArtifactDraftsRuntimeCapability).get(input.sourceResourceId, { includeArchived: true });
146
+ const draft = access.role !== 'member' ? await this.runtime.require(plugin_sdk_1.ArtifactDraftsRuntimeCapability).get(input.sourceResourceId, { includeArchived: true }) : null;
147
+ if (access.role === 'member') {
148
+ const saved = await this.service.open(context(input), input.sourceResourceId, undefined, undefined, 'published');
149
+ return { ...MODEL, projectId: input.projectId, title: saved.manifest.title, revision: String(saved.versionNumber),
150
+ updatedAt: new Date(saved.updatedAt ?? 0).toISOString(), deleted: false, defaultEditorKey: EDITOR, allowedActions: [],
151
+ sourceSync: { status: 'synced', revision: String(saved.versionNumber) }, source: { kind: 'managed' } };
152
+ }
145
153
  if (!draft)
146
154
  throw new common_1.BadRequestException('DASHBOARD_VERSION_UNAVAILABLE');
147
155
  const deleted = artifact.status === 'archived';
148
156
  const saved = !deleted ? await this.service.open(context(input), input.sourceResourceId) : null;
149
- return { ...MODEL, offlineAccess: 'project', projectId: input.projectId, title: draft.title ?? artifact.title ?? '', revision: String(draft.revision),
157
+ return { ...MODEL, projectId: input.projectId, title: draft.title ?? artifact.title ?? '', revision: String(draft.revision),
150
158
  updatedAt: new Date(draft.updatedAt ?? artifact.updatedAt ?? 0).toISOString(), deleted, defaultEditorKey: EDITOR,
151
- allowedActions: [...(!deleted ? ['rename', 'duplicate'] : []), ...(access.canManage ? [deleted ? 'restore' : 'trash'] : [])],
159
+ allowedActions: [...(!deleted && !access.archived ? ['rename', 'duplicate'] : []), ...(access.canManage ? [deleted ? 'restore' : 'trash'] : [])],
152
160
  ...(saved ? { preview: { kind: 'outline', revision: String(draft.revision), lines: [saved.manifest.title, ...saved.manifest.charts.map(chart => chart.title), ...saved.manifest.tables.map(table => table.title)].slice(0, 6).map(line => line.slice(0, 160)) } } : {}),
153
161
  sourceSync: { status: 'synced', revision: String(draft.revision) },
154
162
  source: draft.workspaceFileRef?.workspacePath ? { kind: 'file', path: draft.workspaceFileRef.workspacePath } : { kind: 'managed' } };
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod/v3';
2
2
  import type { XpertResolvedViewHostContext } from '@xpert-ai/contracts';
3
3
  export declare const DASHBOARD_VIEW_KEY = "live-dashboard__live-dashboard";
4
- export declare const dashboardNavigationTargetSchema: z.ZodDiscriminatedUnion<"target", [z.ZodObject<{
4
+ export declare const dashboardNavigationTargetSchema: z.ZodObject<{
5
5
  target: z.ZodLiteral<"workbench.view">;
6
6
  viewKey: z.ZodLiteral<"live-dashboard__live-dashboard">;
7
7
  }, "strict", z.ZodTypeAny, {
@@ -10,78 +10,122 @@ export declare const dashboardNavigationTargetSchema: z.ZodDiscriminatedUnion<"t
10
10
  }, {
11
11
  target: "workbench.view";
12
12
  viewKey: "live-dashboard__live-dashboard";
13
- }>, z.ZodObject<{
14
- target: z.ZodLiteral<"assistant.project">;
15
- projectId: z.ZodString;
16
- viewKey: z.ZodLiteral<"live-dashboard__live-dashboard">;
17
- }, "strict", z.ZodTypeAny, {
18
- projectId: string;
19
- target: "assistant.project";
20
- viewKey: "live-dashboard__live-dashboard";
21
- }, {
22
- projectId: string;
23
- target: "assistant.project";
24
- viewKey: "live-dashboard__live-dashboard";
25
- }>]>;
13
+ }>;
26
14
  export type DashboardNavigationTarget = z.infer<typeof dashboardNavigationTargetSchema>;
27
15
  /** Resolve from the authorized host context, never from the dashboard's business identity. */
28
16
  export declare function dashboardNavigationTarget(context: XpertResolvedViewHostContext): DashboardNavigationTarget;
29
17
  export declare const dashboardNavigationSchema: z.ZodEffects<z.ZodObject<{
30
18
  selectionId: z.ZodOptional<z.ZodString>;
19
+ page: z.ZodOptional<z.ZodNumber>;
20
+ pageSize: z.ZodOptional<z.ZodNumber>;
31
21
  parameters: z.ZodOptional<z.ZodObject<{
22
+ pipelineInstanceId: z.ZodOptional<z.ZodString>;
23
+ pipelineRoundId: z.ZodOptional<z.ZodString>;
24
+ pipelineNodeId: z.ZodOptional<z.ZodString>;
32
25
  contentProvider: z.ZodOptional<z.ZodString>;
33
26
  contentId: z.ZodOptional<z.ZodString>;
34
27
  contentTitle: z.ZodOptional<z.ZodString>;
35
28
  contentEditor: z.ZodOptional<z.ZodString>;
36
29
  artifactId: z.ZodOptional<z.ZodString>;
37
30
  versionId: z.ZodOptional<z.ZodString>;
31
+ newDashboard: z.ZodOptional<z.ZodBoolean>;
32
+ picker: z.ZodOptional<z.ZodLiteral<"dashboards">>;
33
+ draftRevision: z.ZodOptional<z.ZodNumber>;
34
+ mode: z.ZodOptional<z.ZodEnum<["published", "draft"]>>;
38
35
  }, "strict", z.ZodTypeAny, {
39
36
  artifactId?: string | undefined;
40
37
  versionId?: string | undefined;
38
+ draftRevision?: number | undefined;
39
+ mode?: "draft" | "published" | undefined;
40
+ pipelineInstanceId?: string | undefined;
41
+ pipelineRoundId?: string | undefined;
42
+ pipelineNodeId?: string | undefined;
41
43
  contentProvider?: string | undefined;
42
44
  contentId?: string | undefined;
43
45
  contentTitle?: string | undefined;
44
46
  contentEditor?: string | undefined;
47
+ newDashboard?: boolean | undefined;
48
+ picker?: "dashboards" | undefined;
45
49
  }, {
46
50
  artifactId?: string | undefined;
47
51
  versionId?: string | undefined;
52
+ draftRevision?: number | undefined;
53
+ mode?: "draft" | "published" | undefined;
54
+ pipelineInstanceId?: string | undefined;
55
+ pipelineRoundId?: string | undefined;
56
+ pipelineNodeId?: string | undefined;
48
57
  contentProvider?: string | undefined;
49
58
  contentId?: string | undefined;
50
59
  contentTitle?: string | undefined;
51
60
  contentEditor?: string | undefined;
61
+ newDashboard?: boolean | undefined;
62
+ picker?: "dashboards" | undefined;
52
63
  }>>;
53
64
  }, "strip", z.ZodTypeAny, {
65
+ page?: number | undefined;
66
+ pageSize?: number | undefined;
54
67
  selectionId?: string | undefined;
55
68
  parameters?: {
56
69
  artifactId?: string | undefined;
57
70
  versionId?: string | undefined;
71
+ draftRevision?: number | undefined;
72
+ mode?: "draft" | "published" | undefined;
73
+ pipelineInstanceId?: string | undefined;
74
+ pipelineRoundId?: string | undefined;
75
+ pipelineNodeId?: string | undefined;
58
76
  contentProvider?: string | undefined;
59
77
  contentId?: string | undefined;
60
78
  contentTitle?: string | undefined;
61
79
  contentEditor?: string | undefined;
80
+ newDashboard?: boolean | undefined;
81
+ picker?: "dashboards" | undefined;
62
82
  } | undefined;
63
83
  }, {
84
+ page?: number | undefined;
85
+ pageSize?: number | undefined;
64
86
  selectionId?: string | undefined;
65
87
  parameters?: {
66
88
  artifactId?: string | undefined;
67
89
  versionId?: string | undefined;
90
+ draftRevision?: number | undefined;
91
+ mode?: "draft" | "published" | undefined;
92
+ pipelineInstanceId?: string | undefined;
93
+ pipelineRoundId?: string | undefined;
94
+ pipelineNodeId?: string | undefined;
68
95
  contentProvider?: string | undefined;
69
96
  contentId?: string | undefined;
70
97
  contentTitle?: string | undefined;
71
98
  contentEditor?: string | undefined;
99
+ newDashboard?: boolean | undefined;
100
+ picker?: "dashboards" | undefined;
72
101
  } | undefined;
73
102
  }>, {
103
+ newDashboard?: boolean | undefined;
104
+ picker?: "dashboards" | undefined;
105
+ mode?: "draft" | "published" | undefined;
106
+ pageSize?: number | undefined;
107
+ page?: number | undefined;
108
+ draftRevision?: number | undefined;
74
109
  artifactId: string | undefined;
75
110
  versionId: string | undefined;
76
111
  }, {
112
+ page?: number | undefined;
113
+ pageSize?: number | undefined;
77
114
  selectionId?: string | undefined;
78
115
  parameters?: {
79
116
  artifactId?: string | undefined;
80
117
  versionId?: string | undefined;
118
+ draftRevision?: number | undefined;
119
+ mode?: "draft" | "published" | undefined;
120
+ pipelineInstanceId?: string | undefined;
121
+ pipelineRoundId?: string | undefined;
122
+ pipelineNodeId?: string | undefined;
81
123
  contentProvider?: string | undefined;
82
124
  contentId?: string | undefined;
83
125
  contentTitle?: string | undefined;
84
126
  contentEditor?: string | undefined;
127
+ newDashboard?: boolean | undefined;
128
+ picker?: "dashboards" | undefined;
85
129
  } | undefined;
86
130
  }>;
87
131
  export type DashboardNavigation = z.infer<typeof dashboardNavigationSchema>;
@@ -5,28 +5,29 @@ exports.dashboardNavigationTarget = dashboardNavigationTarget;
5
5
  const v3_1 = require("zod/v3");
6
6
  // The host namespaces provider + local view key; cards use the resolved public key.
7
7
  exports.DASHBOARD_VIEW_KEY = 'live-dashboard__live-dashboard';
8
- exports.dashboardNavigationTargetSchema = v3_1.z.discriminatedUnion('target', [
9
- v3_1.z.object({ target: v3_1.z.literal('workbench.view'), viewKey: v3_1.z.literal(exports.DASHBOARD_VIEW_KEY) }).strict(),
10
- v3_1.z.object({ target: v3_1.z.literal('assistant.project'), projectId: v3_1.z.string().uuid(), viewKey: v3_1.z.literal(exports.DASHBOARD_VIEW_KEY) }).strict()
11
- ]);
8
+ exports.dashboardNavigationTargetSchema = v3_1.z.object({
9
+ target: v3_1.z.literal('workbench.view'), viewKey: v3_1.z.literal(exports.DASHBOARD_VIEW_KEY)
10
+ }).strict();
12
11
  /** Resolve from the authorized host context, never from the dashboard's business identity. */
13
12
  function dashboardNavigationTarget(context) {
14
- if (context.hostType !== 'agent' && context.hostType !== 'project')
13
+ if (context.hostType !== 'agent')
15
14
  throw new Error('DASHBOARD_HOST_UNSUPPORTED');
16
15
  return {
17
- ...(context.hostType === 'project' ? { target: 'assistant.project', projectId: context.hostId } : { target: 'workbench.view' }),
16
+ target: 'workbench.view',
18
17
  viewKey: exports.DASHBOARD_VIEW_KEY
19
18
  };
20
19
  }
21
20
  exports.dashboardNavigationSchema = v3_1.z.object({
22
21
  selectionId: v3_1.z.string().uuid().optional(),
23
- parameters: v3_1.z.object({ contentProvider: v3_1.z.string().optional(), contentId: v3_1.z.string().uuid().optional(), contentTitle: v3_1.z.string().optional(), contentEditor: v3_1.z.string().optional(), artifactId: v3_1.z.string().uuid().optional(), versionId: v3_1.z.string().uuid().optional() }).strict().optional()
22
+ page: v3_1.z.number().int().positive().optional(), pageSize: v3_1.z.number().int().min(1).max(100).optional(),
23
+ parameters: v3_1.z.object({ pipelineInstanceId: v3_1.z.string().uuid().optional(), pipelineRoundId: v3_1.z.string().uuid().optional(), pipelineNodeId: v3_1.z.string().uuid().optional(), contentProvider: v3_1.z.string().optional(), contentId: v3_1.z.string().uuid().optional(), contentTitle: v3_1.z.string().optional(), contentEditor: v3_1.z.string().optional(), artifactId: v3_1.z.string().uuid().optional(), versionId: v3_1.z.string().uuid().optional(), newDashboard: v3_1.z.boolean().optional(), picker: v3_1.z.literal('dashboards').optional(), draftRevision: v3_1.z.number().int().positive().optional(), mode: v3_1.z.enum(['published', 'draft']).optional() }).strict().optional()
24
24
  }).transform((query, ctx) => {
25
25
  const artifactId = query.selectionId ?? query.parameters?.artifactId;
26
26
  const versionId = query.parameters?.versionId;
27
- if (query.selectionId && query.parameters?.artifactId && query.selectionId !== query.parameters.artifactId || versionId && !artifactId)
27
+ if (query.parameters?.newDashboard && artifactId || query.selectionId && query.parameters?.artifactId && query.selectionId !== query.parameters.artifactId || versionId && !artifactId)
28
28
  ctx.addIssue({ code: v3_1.z.ZodIssueCode.custom, message: 'DASHBOARD_NAVIGATION_INVALID: provide one Artifact identity and an optional version' });
29
- return { artifactId, versionId };
29
+ return { artifactId, versionId, ...(query.parameters?.draftRevision ? { draftRevision: query.parameters.draftRevision } : {}), ...(query.page ? { page: query.page } : {}), ...(query.pageSize ? { pageSize: query.pageSize } : {}),
30
+ ...(query.parameters?.mode ? { mode: query.parameters.mode } : {}), ...(query.parameters?.picker ? { picker: query.parameters.picker } : {}), ...(query.parameters?.newDashboard ? { newDashboard: true } : {}) };
30
31
  });
31
- const dashboardNavigationKey = (target) => JSON.stringify([target.artifactId ?? null, target.versionId ?? null]);
32
+ const dashboardNavigationKey = (target) => JSON.stringify([target.artifactId ?? null, target.versionId ?? null, target.newDashboard ?? false, target.mode ?? null, target.draftRevision ?? null, target.picker ?? null]);
32
33
  exports.dashboardNavigationKey = dashboardNavigationKey;
@@ -30,6 +30,69 @@ export declare const dashboardSummarySchema: z.ZodObject<{
30
30
  updatedAt?: string | undefined;
31
31
  canDelete?: boolean | undefined;
32
32
  }>;
33
+ export declare const dashboardPickerPageSchema: z.ZodObject<{
34
+ items: z.ZodArray<z.ZodObject<{
35
+ artifactId: z.ZodString;
36
+ versionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
37
+ versionNumber: z.ZodOptional<z.ZodNumber>;
38
+ title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
39
+ updatedAt: z.ZodOptional<z.ZodString>;
40
+ draftRevision: z.ZodOptional<z.ZodNumber>;
41
+ canDelete: z.ZodOptional<z.ZodBoolean>;
42
+ isDraft: z.ZodOptional<z.ZodBoolean>;
43
+ baseVersionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
44
+ }, "strip", z.ZodTypeAny, {
45
+ artifactId: string;
46
+ title?: string | null | undefined;
47
+ versionId?: string | null | undefined;
48
+ draftRevision?: number | undefined;
49
+ versionNumber?: number | undefined;
50
+ baseVersionId?: string | null | undefined;
51
+ isDraft?: boolean | undefined;
52
+ updatedAt?: string | undefined;
53
+ canDelete?: boolean | undefined;
54
+ }, {
55
+ artifactId: string;
56
+ title?: string | null | undefined;
57
+ versionId?: string | null | undefined;
58
+ draftRevision?: number | undefined;
59
+ versionNumber?: number | undefined;
60
+ baseVersionId?: string | null | undefined;
61
+ isDraft?: boolean | undefined;
62
+ updatedAt?: string | undefined;
63
+ canDelete?: boolean | undefined;
64
+ }>, "many">;
65
+ page: z.ZodNumber;
66
+ hasMore: z.ZodBoolean;
67
+ }, "strip", z.ZodTypeAny, {
68
+ page: number;
69
+ items: {
70
+ artifactId: string;
71
+ title?: string | null | undefined;
72
+ versionId?: string | null | undefined;
73
+ draftRevision?: number | undefined;
74
+ versionNumber?: number | undefined;
75
+ baseVersionId?: string | null | undefined;
76
+ isDraft?: boolean | undefined;
77
+ updatedAt?: string | undefined;
78
+ canDelete?: boolean | undefined;
79
+ }[];
80
+ hasMore: boolean;
81
+ }, {
82
+ page: number;
83
+ items: {
84
+ artifactId: string;
85
+ title?: string | null | undefined;
86
+ versionId?: string | null | undefined;
87
+ draftRevision?: number | undefined;
88
+ versionNumber?: number | undefined;
89
+ baseVersionId?: string | null | undefined;
90
+ isDraft?: boolean | undefined;
91
+ updatedAt?: string | undefined;
92
+ canDelete?: boolean | undefined;
93
+ }[];
94
+ hasMore: boolean;
95
+ }>;
33
96
  export declare const dashboardSavedSchema: z.ZodObject<{
34
97
  artifactId: z.ZodString;
35
98
  versionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -430,7 +493,51 @@ export declare const dashboardSavedSchema: z.ZodObject<{
430
493
  }>;
431
494
  export declare const dashboardViewDataSchema: z.ZodObject<{
432
495
  meta: z.ZodObject<{
433
- navigationTarget: z.ZodOptional<z.ZodDiscriminatedUnion<"target", [z.ZodObject<{
496
+ currentProject: z.ZodOptional<z.ZodNullable<z.ZodObject<{
497
+ id: z.ZodString;
498
+ name: z.ZodString;
499
+ }, "strip", z.ZodTypeAny, {
500
+ id: string;
501
+ name: string;
502
+ }, {
503
+ id: string;
504
+ name: string;
505
+ }>>>;
506
+ access: z.ZodOptional<z.ZodObject<{
507
+ project: z.ZodBoolean;
508
+ archived: z.ZodBoolean;
509
+ canReadDraft: z.ZodBoolean;
510
+ canEdit: z.ZodBoolean;
511
+ canManage: z.ZodBoolean;
512
+ }, "strip", z.ZodTypeAny, {
513
+ project: boolean;
514
+ archived: boolean;
515
+ canReadDraft: boolean;
516
+ canEdit: boolean;
517
+ canManage: boolean;
518
+ }, {
519
+ project: boolean;
520
+ archived: boolean;
521
+ canReadDraft: boolean;
522
+ canEdit: boolean;
523
+ canManage: boolean;
524
+ }>>;
525
+ mode: z.ZodOptional<z.ZodEnum<["published", "draft"]>>;
526
+ notice: z.ZodOptional<z.ZodLiteral<"not_published">>;
527
+ pagination: z.ZodOptional<z.ZodObject<{
528
+ page: z.ZodNumber;
529
+ pageSize: z.ZodNumber;
530
+ hasMore: z.ZodBoolean;
531
+ }, "strip", z.ZodTypeAny, {
532
+ page: number;
533
+ pageSize: number;
534
+ hasMore: boolean;
535
+ }, {
536
+ page: number;
537
+ pageSize: number;
538
+ hasMore: boolean;
539
+ }>>;
540
+ navigationTarget: z.ZodOptional<z.ZodObject<{
434
541
  target: z.ZodLiteral<"workbench.view">;
435
542
  viewKey: z.ZodLiteral<"live-dashboard__live-dashboard">;
436
543
  }, "strict", z.ZodTypeAny, {
@@ -439,19 +546,7 @@ export declare const dashboardViewDataSchema: z.ZodObject<{
439
546
  }, {
440
547
  target: "workbench.view";
441
548
  viewKey: "live-dashboard__live-dashboard";
442
- }>, z.ZodObject<{
443
- target: z.ZodLiteral<"assistant.project">;
444
- projectId: z.ZodString;
445
- viewKey: z.ZodLiteral<"live-dashboard__live-dashboard">;
446
- }, "strict", z.ZodTypeAny, {
447
- projectId: string;
448
- target: "assistant.project";
449
- viewKey: "live-dashboard__live-dashboard";
450
- }, {
451
- projectId: string;
452
- target: "assistant.project";
453
- viewKey: "live-dashboard__live-dashboard";
454
- }>]>>;
549
+ }>>;
455
550
  dashboards: z.ZodArray<z.ZodObject<{
456
551
  artifactId: z.ZodString;
457
552
  versionId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -923,10 +1018,6 @@ export declare const dashboardViewDataSchema: z.ZodObject<{
923
1018
  canDelete?: boolean | undefined;
924
1019
  }>, "many">>;
925
1020
  }, "strip", z.ZodTypeAny, {
926
- sources: {
927
- name: string;
928
- source: import("@xpert-ai/contracts").AnalyticsSourceRef;
929
- }[];
930
1021
  dashboards: {
931
1022
  artifactId: string;
932
1023
  title?: string | null | undefined;
@@ -938,6 +1029,11 @@ export declare const dashboardViewDataSchema: z.ZodObject<{
938
1029
  updatedAt?: string | undefined;
939
1030
  canDelete?: boolean | undefined;
940
1031
  }[];
1032
+ sources: {
1033
+ name: string;
1034
+ source: import("@xpert-ai/contracts").AnalyticsSourceRef;
1035
+ }[];
1036
+ mode?: "draft" | "published" | undefined;
941
1037
  saved?: {
942
1038
  manifest: {
943
1039
  schema: "xpert.live-dashboard";
@@ -983,13 +1079,26 @@ export declare const dashboardViewDataSchema: z.ZodObject<{
983
1079
  updatedAt?: string | undefined;
984
1080
  canDelete?: boolean | undefined;
985
1081
  } | undefined;
1082
+ access?: {
1083
+ project: boolean;
1084
+ archived: boolean;
1085
+ canReadDraft: boolean;
1086
+ canEdit: boolean;
1087
+ canManage: boolean;
1088
+ } | undefined;
1089
+ notice?: "not_published" | undefined;
1090
+ currentProject?: {
1091
+ id: string;
1092
+ name: string;
1093
+ } | null | undefined;
1094
+ pagination?: {
1095
+ page: number;
1096
+ pageSize: number;
1097
+ hasMore: boolean;
1098
+ } | undefined;
986
1099
  navigationTarget?: {
987
1100
  target: "workbench.view";
988
1101
  viewKey: "live-dashboard__live-dashboard";
989
- } | {
990
- projectId: string;
991
- target: "assistant.project";
992
- viewKey: "live-dashboard__live-dashboard";
993
1102
  } | undefined;
994
1103
  versions?: {
995
1104
  artifactId: string;
@@ -1003,10 +1112,6 @@ export declare const dashboardViewDataSchema: z.ZodObject<{
1003
1112
  canDelete?: boolean | undefined;
1004
1113
  }[] | undefined;
1005
1114
  }, {
1006
- sources: {
1007
- name: string;
1008
- source: import("@xpert-ai/contracts").AnalyticsSourceRef;
1009
- }[];
1010
1115
  dashboards: {
1011
1116
  artifactId: string;
1012
1117
  title?: string | null | undefined;
@@ -1018,6 +1123,11 @@ export declare const dashboardViewDataSchema: z.ZodObject<{
1018
1123
  updatedAt?: string | undefined;
1019
1124
  canDelete?: boolean | undefined;
1020
1125
  }[];
1126
+ sources: {
1127
+ name: string;
1128
+ source: import("@xpert-ai/contracts").AnalyticsSourceRef;
1129
+ }[];
1130
+ mode?: "draft" | "published" | undefined;
1021
1131
  saved?: {
1022
1132
  manifest: {
1023
1133
  schema: "xpert.live-dashboard";
@@ -1076,13 +1186,26 @@ export declare const dashboardViewDataSchema: z.ZodObject<{
1076
1186
  updatedAt?: string | undefined;
1077
1187
  canDelete?: boolean | undefined;
1078
1188
  } | undefined;
1189
+ access?: {
1190
+ project: boolean;
1191
+ archived: boolean;
1192
+ canReadDraft: boolean;
1193
+ canEdit: boolean;
1194
+ canManage: boolean;
1195
+ } | undefined;
1196
+ notice?: "not_published" | undefined;
1197
+ currentProject?: {
1198
+ id: string;
1199
+ name: string;
1200
+ } | null | undefined;
1201
+ pagination?: {
1202
+ page: number;
1203
+ pageSize: number;
1204
+ hasMore: boolean;
1205
+ } | undefined;
1079
1206
  navigationTarget?: {
1080
1207
  target: "workbench.view";
1081
1208
  viewKey: "live-dashboard__live-dashboard";
1082
- } | {
1083
- projectId: string;
1084
- target: "assistant.project";
1085
- viewKey: "live-dashboard__live-dashboard";
1086
1209
  } | undefined;
1087
1210
  versions?: {
1088
1211
  artifactId: string;
@@ -1098,10 +1221,6 @@ export declare const dashboardViewDataSchema: z.ZodObject<{
1098
1221
  }>;
1099
1222
  }, "strip", z.ZodTypeAny, {
1100
1223
  meta: {
1101
- sources: {
1102
- name: string;
1103
- source: import("@xpert-ai/contracts").AnalyticsSourceRef;
1104
- }[];
1105
1224
  dashboards: {
1106
1225
  artifactId: string;
1107
1226
  title?: string | null | undefined;
@@ -1113,6 +1232,11 @@ export declare const dashboardViewDataSchema: z.ZodObject<{
1113
1232
  updatedAt?: string | undefined;
1114
1233
  canDelete?: boolean | undefined;
1115
1234
  }[];
1235
+ sources: {
1236
+ name: string;
1237
+ source: import("@xpert-ai/contracts").AnalyticsSourceRef;
1238
+ }[];
1239
+ mode?: "draft" | "published" | undefined;
1116
1240
  saved?: {
1117
1241
  manifest: {
1118
1242
  schema: "xpert.live-dashboard";
@@ -1158,13 +1282,26 @@ export declare const dashboardViewDataSchema: z.ZodObject<{
1158
1282
  updatedAt?: string | undefined;
1159
1283
  canDelete?: boolean | undefined;
1160
1284
  } | undefined;
1285
+ access?: {
1286
+ project: boolean;
1287
+ archived: boolean;
1288
+ canReadDraft: boolean;
1289
+ canEdit: boolean;
1290
+ canManage: boolean;
1291
+ } | undefined;
1292
+ notice?: "not_published" | undefined;
1293
+ currentProject?: {
1294
+ id: string;
1295
+ name: string;
1296
+ } | null | undefined;
1297
+ pagination?: {
1298
+ page: number;
1299
+ pageSize: number;
1300
+ hasMore: boolean;
1301
+ } | undefined;
1161
1302
  navigationTarget?: {
1162
1303
  target: "workbench.view";
1163
1304
  viewKey: "live-dashboard__live-dashboard";
1164
- } | {
1165
- projectId: string;
1166
- target: "assistant.project";
1167
- viewKey: "live-dashboard__live-dashboard";
1168
1305
  } | undefined;
1169
1306
  versions?: {
1170
1307
  artifactId: string;
@@ -1180,10 +1317,6 @@ export declare const dashboardViewDataSchema: z.ZodObject<{
1180
1317
  };
1181
1318
  }, {
1182
1319
  meta: {
1183
- sources: {
1184
- name: string;
1185
- source: import("@xpert-ai/contracts").AnalyticsSourceRef;
1186
- }[];
1187
1320
  dashboards: {
1188
1321
  artifactId: string;
1189
1322
  title?: string | null | undefined;
@@ -1195,6 +1328,11 @@ export declare const dashboardViewDataSchema: z.ZodObject<{
1195
1328
  updatedAt?: string | undefined;
1196
1329
  canDelete?: boolean | undefined;
1197
1330
  }[];
1331
+ sources: {
1332
+ name: string;
1333
+ source: import("@xpert-ai/contracts").AnalyticsSourceRef;
1334
+ }[];
1335
+ mode?: "draft" | "published" | undefined;
1198
1336
  saved?: {
1199
1337
  manifest: {
1200
1338
  schema: "xpert.live-dashboard";
@@ -1253,13 +1391,26 @@ export declare const dashboardViewDataSchema: z.ZodObject<{
1253
1391
  updatedAt?: string | undefined;
1254
1392
  canDelete?: boolean | undefined;
1255
1393
  } | undefined;
1394
+ access?: {
1395
+ project: boolean;
1396
+ archived: boolean;
1397
+ canReadDraft: boolean;
1398
+ canEdit: boolean;
1399
+ canManage: boolean;
1400
+ } | undefined;
1401
+ notice?: "not_published" | undefined;
1402
+ currentProject?: {
1403
+ id: string;
1404
+ name: string;
1405
+ } | null | undefined;
1406
+ pagination?: {
1407
+ page: number;
1408
+ pageSize: number;
1409
+ hasMore: boolean;
1410
+ } | undefined;
1256
1411
  navigationTarget?: {
1257
1412
  target: "workbench.view";
1258
1413
  viewKey: "live-dashboard__live-dashboard";
1259
- } | {
1260
- projectId: string;
1261
- target: "assistant.project";
1262
- viewKey: "live-dashboard__live-dashboard";
1263
1414
  } | undefined;
1264
1415
  versions?: {
1265
1416
  artifactId: string;
@@ -1,16 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.dashboardViewDataSchema = exports.dashboardSavedSchema = exports.dashboardSummarySchema = void 0;
3
+ exports.dashboardViewDataSchema = exports.dashboardSavedSchema = exports.dashboardPickerPageSchema = exports.dashboardSummarySchema = void 0;
4
4
  const v3_1 = require("zod/v3");
5
5
  const analytics_1 = require("@xpert-ai/plugin-sdk/analytics");
6
6
  const artifact_document_1 = require("@xpert-ai/plugin-sdk/artifact-document");
7
+ const projects_schema_1 = require("./projects.schema");
7
8
  const dashboard_schema_1 = require("./dashboard.schema");
8
9
  const dashboard_navigation_1 = require("./dashboard-navigation");
9
10
  exports.dashboardSummarySchema = v3_1.z.object({ artifactId: v3_1.z.string(), versionId: v3_1.z.string().nullish(), versionNumber: v3_1.z.number().optional(), title: v3_1.z.string().nullish(), updatedAt: v3_1.z.string().optional(), draftRevision: v3_1.z.number().optional(), canDelete: v3_1.z.boolean().optional(), isDraft: v3_1.z.boolean().optional(), baseVersionId: v3_1.z.string().nullish() });
11
+ exports.dashboardPickerPageSchema = v3_1.z.object({ items: v3_1.z.array(exports.dashboardSummarySchema), page: v3_1.z.number().int().positive(), hasMore: v3_1.z.boolean() });
10
12
  exports.dashboardSavedSchema = exports.dashboardSummarySchema.extend({ manifest: dashboard_schema_1.dashboardSchema, dependencies: artifact_document_1.artifactDocumentDependencyAssets.optional() });
11
13
  // Source identities belong to Analytics, including immutable Definitions and Artifacts.
12
14
  // The viewer consumes only the reference and label; DataSource fields are not universal.
13
15
  exports.dashboardViewDataSchema = v3_1.z.object({ meta: v3_1.z.object({
16
+ currentProject: projects_schema_1.dashboardProjectSchema.nullable().optional(),
17
+ access: v3_1.z.object({ project: v3_1.z.boolean(), archived: v3_1.z.boolean(), canReadDraft: v3_1.z.boolean(), canEdit: v3_1.z.boolean(), canManage: v3_1.z.boolean() }).optional(),
18
+ mode: v3_1.z.enum(['published', 'draft']).optional(),
19
+ notice: v3_1.z.literal('not_published').optional(),
20
+ pagination: v3_1.z.object({ page: v3_1.z.number(), pageSize: v3_1.z.number(), hasMore: v3_1.z.boolean() }).optional(),
14
21
  navigationTarget: dashboard_navigation_1.dashboardNavigationTargetSchema.optional(),
15
22
  dashboards: v3_1.z.array(exports.dashboardSummarySchema),
16
23
  sources: v3_1.z.array(v3_1.z.object({ source: analytics_1.analyticsSourceRefSchema, name: v3_1.z.string() })),