@xpert-ai/plugin-live-dashboard 0.3.0 → 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.
- package/.xpertai-plugin/plugin.json +10 -2
- package/README.md +70 -0
- package/assets/branding/cover-v1.prompt.txt +27 -0
- package/assets/branding/cover-v1.webp +0 -0
- package/assets/previews/customer-brief.png +0 -0
- package/assets/previews/profit-atlas.png +0 -0
- package/assets/previews/trend-workspace.png +0 -0
- package/dist/index.js +14 -1
- package/dist/lib/agent.schema.d.ts +43 -37
- package/dist/lib/agent.schema.js +2 -1
- package/dist/lib/app-config.d.ts +62 -0
- package/dist/lib/app-config.js +38 -0
- package/dist/lib/artifact-type.provider.d.ts +15 -0
- package/dist/lib/artifact-type.provider.js +78 -0
- package/dist/lib/assistant-template.d.ts +2 -0
- package/dist/lib/assistant-template.js +7 -0
- package/dist/lib/content.provider.js +13 -5
- package/dist/lib/dashboard-navigation.d.ts +58 -14
- package/dist/lib/dashboard-navigation.js +11 -10
- package/dist/lib/dashboard-view.schema.d.ts +197 -46
- package/dist/lib/dashboard-view.schema.js +8 -1
- package/dist/lib/dashboard.service.d.ts +39 -2
- package/dist/lib/dashboard.service.js +52 -28
- package/dist/lib/document-libraries.d.ts +1 -1
- package/dist/lib/document-libraries.js +3 -2
- package/dist/lib/document-network.d.ts +1 -1
- package/dist/lib/document-network.js +2 -6
- package/dist/lib/editing-feedback.d.ts +5 -0
- package/dist/lib/editing-feedback.js +19 -0
- package/dist/lib/editing-patch.d.ts +22 -0
- package/dist/lib/editing-patch.js +46 -0
- package/dist/lib/editing-session.d.ts +167 -0
- package/dist/lib/editing-session.js +53 -0
- package/dist/lib/editing.d.ts +92 -60
- package/dist/lib/editing.js +36 -24
- package/dist/lib/html-guidance.d.ts +1 -1
- package/dist/lib/html-guidance.js +1 -1
- package/dist/lib/middleware.js +48 -20
- package/dist/lib/monitor.d.ts +70 -0
- package/dist/lib/monitor.js +101 -0
- package/dist/lib/plugin.js +5 -1
- package/dist/lib/project.d.ts +106 -0
- package/dist/lib/project.js +17 -0
- package/dist/lib/projects.schema.d.ts +49 -0
- package/dist/lib/projects.schema.js +7 -0
- package/dist/lib/projects.service.d.ts +23 -0
- package/dist/lib/projects.service.js +65 -0
- package/dist/lib/prompt-workflows.d.ts +3 -2
- package/dist/lib/prompt-workflows.js +17 -3
- package/dist/lib/provider-options.controller.d.ts +10 -0
- package/dist/lib/provider-options.controller.js +49 -0
- package/dist/lib/resource-card.js +1 -1
- package/dist/lib/runtime-context.d.ts +3 -0
- package/dist/lib/runtime-context.js +13 -0
- package/dist/lib/save-evidence.d.ts +1 -1
- package/dist/lib/templates.d.ts +2 -0
- package/dist/lib/templates.js +55 -0
- package/dist/lib/view.provider.d.ts +97 -7
- package/dist/lib/view.provider.js +39 -10
- package/dist/libraries/TREND-WORKSPACE-ICONS-LICENSE.txt +43 -0
- package/dist/libraries/catalog.json +1 -1
- package/dist/remote/app.css +1 -1
- package/dist/remote/app.js +33 -33
- package/dist/remote/build-manifest.json +118 -32
- package/dist/sandbox-actions/action.json +1 -1
- package/dist/sandbox-actions/bundle/host.js +2 -2
- package/dist/sandbox-actions/bundle/resource-cache.mjs +2 -1
- package/dist/sandbox-actions/bundle/validate.mjs +1 -1
- package/docs/docs.json +7 -0
- package/docs/frontend-libraries.mdx +12 -4
- package/docs/html-mode.md +3 -3
- package/docs/quick-start-acceptance.mdx +50 -0
- package/docs/quick-start.mdx +64 -0
- package/docs/superstore.mdx +38 -0
- package/docs/team-sharing.mdx +6 -2
- package/docs/trend-workspace-acceptance.mdx +43 -0
- package/docs/trend-workspace.mdx +30 -0
- package/docs/verification.mdx +4 -2
- package/docs/visual-styles-acceptance.mdx +40 -0
- package/docs/visual-styles.mdx +46 -0
- package/package.json +25 -18
- package/scripts/import-prompts.mjs +108 -0
- package/skills/live-dashboard/SKILL.md +27 -3
- package/skills/live-dashboard/examples/README.md +25 -0
- package/skills/live-dashboard/examples/catalog.json +79 -0
- package/skills/live-dashboard/examples/production-quality/README.md +25 -0
- package/skills/live-dashboard/examples/production-quality/dashboard.html +129 -0
- package/skills/live-dashboard/examples/production-quality/definition.json +67 -0
- package/skills/live-dashboard/examples/production-quality/demo.csv +7 -0
- package/skills/live-dashboard/examples/production-quality/demo.json +44 -0
- package/skills/live-dashboard/examples/production-quality/expected.json +26 -0
- package/skills/live-dashboard/examples/production-quality/preview.png +0 -0
- package/skills/live-dashboard/examples/production-quality/query.json +53 -0
- package/skills/live-dashboard/examples/regional-sales/README.md +25 -0
- package/skills/live-dashboard/examples/regional-sales/dashboard-create.json +35 -0
- package/skills/live-dashboard/examples/regional-sales/definition.json +35 -0
- package/skills/live-dashboard/examples/regional-sales/demo.csv +5 -0
- package/skills/live-dashboard/examples/regional-sales/demo.json +18 -0
- package/skills/live-dashboard/examples/regional-sales/expected.json +19 -0
- package/skills/live-dashboard/examples/regional-sales/preview.png +0 -0
- package/skills/live-dashboard/examples/regional-sales/query.json +45 -0
- package/skills/live-dashboard/examples/sales-overview/README.md +25 -0
- package/skills/live-dashboard/examples/sales-overview/dashboard.html +129 -0
- package/skills/live-dashboard/examples/sales-overview/definition.json +57 -0
- package/skills/live-dashboard/examples/sales-overview/demo.csv +7 -0
- package/skills/live-dashboard/examples/sales-overview/demo.json +38 -0
- package/skills/live-dashboard/examples/sales-overview/expected.json +22 -0
- package/skills/live-dashboard/examples/sales-overview/preview.png +0 -0
- package/skills/live-dashboard/examples/sales-overview/query.json +52 -0
- package/skills/live-dashboard/examples/superstore/README.md +64 -0
- package/skills/live-dashboard/examples/superstore/THIRD_PARTY_LICENSE.txt +207 -0
- package/skills/live-dashboard/examples/superstore/build_data.py +155 -0
- package/skills/live-dashboard/examples/superstore/build_pages.py +129 -0
- package/skills/live-dashboard/examples/superstore/checks.json +104 -0
- package/skills/live-dashboard/examples/superstore/customers-mobile-dark.png +0 -0
- package/skills/live-dashboard/examples/superstore/customers-select.png +0 -0
- package/skills/live-dashboard/examples/superstore/customers.html +316 -0
- package/skills/live-dashboard/examples/superstore/customers.png +0 -0
- package/skills/live-dashboard/examples/superstore/customers.queries.json +512 -0
- package/skills/live-dashboard/examples/superstore/expected.json +4069 -0
- package/skills/live-dashboard/examples/superstore/import.json +200 -0
- package/skills/live-dashboard/examples/superstore/orders.csv +10195 -0
- package/skills/live-dashboard/examples/superstore/overview-mobile-dark.png +0 -0
- package/skills/live-dashboard/examples/superstore/overview-select.png +0 -0
- package/skills/live-dashboard/examples/superstore/overview.html +310 -0
- package/skills/live-dashboard/examples/superstore/overview.png +0 -0
- package/skills/live-dashboard/examples/superstore/overview.queries.json +636 -0
- package/skills/live-dashboard/examples/superstore/page.js +109 -0
- package/skills/live-dashboard/examples/superstore/profitability-mobile-dark.png +0 -0
- package/skills/live-dashboard/examples/superstore/profitability-select.png +0 -0
- package/skills/live-dashboard/examples/superstore/profitability.html +307 -0
- package/skills/live-dashboard/examples/superstore/profitability.png +0 -0
- package/skills/live-dashboard/examples/superstore/profitability.queries.json +334 -0
- package/skills/live-dashboard/examples/superstore/provenance.json +24 -0
- package/skills/live-dashboard/examples/superstore/semantic-model.json +220 -0
- package/skills/live-dashboard/examples/superstore/test_data.py +62 -0
- package/skills/live-dashboard/references/html-runtime.md +1 -1
- package/skills/live-dashboard/themes/README.md +50 -0
- package/skills/live-dashboard/themes/customer-brief/README.md +47 -0
- package/skills/live-dashboard/themes/customer-brief/charts.js +17 -0
- package/skills/live-dashboard/themes/customer-brief/layout.html +22 -0
- package/skills/live-dashboard/themes/customer-brief/theme.css +108 -0
- package/skills/live-dashboard/themes/profit-atlas/README.md +43 -0
- package/skills/live-dashboard/themes/profit-atlas/charts.js +30 -0
- package/skills/live-dashboard/themes/profit-atlas/layout.html +19 -0
- package/skills/live-dashboard/themes/profit-atlas/theme.css +75 -0
- package/skills/live-dashboard/themes/trend-workspace/ICON_LICENSE.txt +43 -0
- package/skills/live-dashboard/themes/trend-workspace/README.md +144 -0
- package/skills/live-dashboard/themes/trend-workspace/charts.js +60 -0
- package/skills/live-dashboard/themes/trend-workspace/icons.js +11 -0
- package/skills/live-dashboard/themes/trend-workspace/layout.html +45 -0
- package/skills/live-dashboard/themes/trend-workspace/select.js +127 -0
- package/skills/live-dashboard/themes/trend-workspace/theme.css +137 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dashboardTemplates = void 0;
|
|
4
|
+
const contracts_1 = require("@xpert-ai/contracts");
|
|
5
|
+
const project_1 = require("./project");
|
|
6
|
+
const dashboard_icon_1 = require("./dashboard-icon");
|
|
7
|
+
const prompt_workflows_1 = require("./prompt-workflows");
|
|
8
|
+
const startPrompts = [
|
|
9
|
+
"请读取 live-dashboard 技能中 regional-sales 的完整配方,使用该配方随附的演示文件和标准图表定义,在当前项目新建区域销售看板。核对区域筛选、销售额和明细;不要使用其他样例或项目中已有的不同数据替代。完成实际查询与两个筛选验证后保存草稿,保留演示标识,不发布。",
|
|
10
|
+
"请读取 live-dashboard 技能中 sales-overview 的完整配方,使用该配方随附的演示文件和完整页面,在当前项目新建销售总览看板。包含销售额、订单数、日趋势、区域筛选和明细;不要使用其他样例或项目中已有的不同数据替代。完成实际查询与两个筛选验证后保存草稿,保留演示标识,不发布。",
|
|
11
|
+
"请读取 live-dashboard 技能中 production-quality 的完整配方,使用该配方随附的演示文件和完整页面,在当前项目新建生产质量看板。必须包含产量、良品数、加权良品率、不良品数和产线筛选;不要将销售数据或其他看板改名替代。完成实际查询与两个产线筛选验证后保存草稿,保留演示标识,不发布。",
|
|
12
|
+
"请读取 live-dashboard 技能中的 themes/README.md 和 superstore 完整配方(总览使用 Trend Workspace、盈利使用 Profit Atlas、客户退货使用 Customer Brief),在当前项目使用已授权的 Data Xpert SuperstoreOrders 发布模型,分别制作经营总览、商品盈利、客户与退货三个看板。必须保留演示标识;先核对全量及区域、年份、品类筛选,再按完整 HTML 和全部 Binding 保存三个草稿,不发布。若模型不可用,请说明数据准备步骤,不得用其他样例或自造数据替代。",
|
|
13
|
+
"使用我的业务数据制作看板,先检查当前项目可用的数据及指标口径。"
|
|
14
|
+
];
|
|
15
|
+
const startLabels = ['区域销售 · 入门', '销售总览 · 入门', '生产质量 · 入门', 'Superstore 企业分析 · 进阶', '使用我的数据'];
|
|
16
|
+
const dsl = (monitor) => JSON.stringify({
|
|
17
|
+
team: { name: monitor ? 'live-dashboard-monitor' : 'live-dashboard-assistant', type: 'agent',
|
|
18
|
+
title: monitor ? '看板巡检' : '实时看板助理', version: '1', agent: { key: 'Agent_Dashboard' },
|
|
19
|
+
options: { workspaceScope: { mode: 'project-required', projectType: project_1.DASHBOARD_PROJECT_TYPE } },
|
|
20
|
+
features: monitor ? {} : { sandbox: { enabled: true }, opener: { enabled: true,
|
|
21
|
+
message: '选择或创建项目,从样例开始,或连接你的业务数据制作实时看板。', questions: startPrompts.map((prompt, index) => ({ label: startLabels[index], prompt })) } },
|
|
22
|
+
// Reading a recipe, registering its file and validating filters spans multiple graph steps per tool call.
|
|
23
|
+
agentConfig: { recursionLimit: monitor ? 100 : 300 }, workspaceDataScope: 'shared', knowledgebases: [], toolsets: [], tags: [] },
|
|
24
|
+
nodes: [
|
|
25
|
+
{ type: 'agent', key: 'Agent_Dashboard', position: { x: 200, y: 100 }, entity: { key: 'Agent_Dashboard',
|
|
26
|
+
name: monitor ? 'dashboard-monitor' : 'dashboard-author', title: monitor ? '看板巡检' : '看板制作',
|
|
27
|
+
prompt: monitor
|
|
28
|
+
? 'Inspect explicitly selected published dashboards in the current Project. Use dashboard_inspect to check live bindings as the scheduled run actor. Report failed bindings, incomplete results and the observed freshness; never claim business-data freshness from query time alone. Do not change definitions, publish, or expand access. Only schedule work when the human requests it. Use the user language.'
|
|
29
|
+
: 'Create and maintain dashboards in the current Project. Read the live-dashboard skill before authoring. For example requests use read_skill_file to read examples/catalog.json and the selected recipe directly relative to the catalog SKILL.md path; do not list sandbox directories to locate bundled files. After a successful draft receipt, report the receipt and let the user open its emitted card; do not reopen/update an unchanged dashboard merely to verify the save. Ask whether to use labeled synthetic demo data or authorized real data when unspecified. Small onboarding demo files belong to the current Project and use file.table after registration. The Superstore enterprise recipe instead requires the authorized published Data Xpert ontology; follow its own setup and query plans, never replace it with file.table or other sample rows. Never substitute demo values for missing real data. For enterprise BI pages, read themes/README.md, choose one visual style appropriate to the requested analysis and read its guide and complete recipe. The Superstore suite uses Trend Workspace for overview, Profit Atlas for profitability and Customer Brief for customers and returns. Use echarts plus exactly one matching theme library, adapt chart fields to discovered data, and preserve the selected theme on edits unless a redesign is requested. Discover registered data sources and validate exact bindings. Preserve the selected Artifact, component IDs and current draft revision on edits. Saving is not publication. Publication requires a manager in the Workbench. Never infer another dashboard from titles or recency. Use the user language.',
|
|
30
|
+
collaboratorNames: [], toolsetIds: [], knowledgebaseIds: [] } },
|
|
31
|
+
...(monitor ? ['LiveDashboardMonitor', 'scheduler'] : ['LiveDashboard', 'SandboxFile', 'skillsMiddleware']).map((provider, index) => ({
|
|
32
|
+
type: 'workflow', key: `Middleware_${provider}`, position: { x: 550, y: 100 + index * 120 },
|
|
33
|
+
entity: { type: 'middleware', key: `Middleware_${provider}`, title: provider, provider, required: true,
|
|
34
|
+
...(provider === 'LiveDashboard' ? { options: { maxModelCalls: 64 } } : {}) }
|
|
35
|
+
}))
|
|
36
|
+
],
|
|
37
|
+
connections: (monitor ? ['LiveDashboardMonitor', 'scheduler'] : ['LiveDashboard', 'SandboxFile', 'skillsMiddleware']).map(provider => ({
|
|
38
|
+
type: 'workflow', key: `Agent_Dashboard/Middleware_${provider}`, from: 'Agent_Dashboard', to: `Middleware_${provider}`, required: true
|
|
39
|
+
}))
|
|
40
|
+
});
|
|
41
|
+
exports.dashboardTemplates = [false, true].map(monitor => ({
|
|
42
|
+
key: monitor ? 'live-dashboard-monitor' : 'live-dashboard-assistant',
|
|
43
|
+
name: monitor ? 'Live Dashboard Monitor' : 'Live Dashboard Assistant',
|
|
44
|
+
title: monitor ? '看板巡检' : '实时看板助理', type: contracts_1.XpertTypeEnum.Agent, icon: dashboard_icon_1.dashboardIcon,
|
|
45
|
+
description: monitor ? '在项目内以授权身份检查正式看板,不修改或发布。' : '在项目内制作和维护看板,草稿与正式发布分离。',
|
|
46
|
+
targetApps: ['xpert', 'data-xpert'], targetAppMeta: { xpert: { types: ['business-assistant'],
|
|
47
|
+
capabilities: [monitor ? 'live_dashboard.monitor' : 'live_dashboard'], requiredPlugins: monitor ? ['@xpert-ai/plugin-live-dashboard'] : ['@xpert-ai/plugin-live-dashboard', '@xpert-ai/plugin-analytics-files'] } },
|
|
48
|
+
dependencies: { plugins: monitor ? ['@xpert-ai/plugin-live-dashboard'] : ['@xpert-ai/plugin-live-dashboard', '@xpert-ai/plugin-analytics-files'],
|
|
49
|
+
skills: monitor ? [] : [{ componentKey: 'live-dashboard', targetAgentKey: 'Agent_Dashboard' }] },
|
|
50
|
+
category: 'Analytics',
|
|
51
|
+
promptWorkflows: monitor ? undefined : prompt_workflows_1.dashboardWorkspacePrompts,
|
|
52
|
+
startPrompts: monitor ? [] : startPrompts,
|
|
53
|
+
releaseNotes: monitor ? undefined : 'Adds project-scoped onboarding, three small examples and the Data Xpert Superstore enterprise suite with three optional reusable visual styles (Trend Workspace, Profit Atlas and Customer Brief) and accessible select controls; existing dashboards are never overwritten by template updates.',
|
|
54
|
+
dslContent: dsl(monitor), default: false, order: monitor ? 36 : 35
|
|
55
|
+
}));
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DashboardProjectsService } from './projects.service';
|
|
1
2
|
import type { XpertExtensionViewManifest, XpertResolvedViewHostContext, XpertViewActionRequest, XpertViewQuery } from '@xpert-ai/contracts';
|
|
2
3
|
import { type IXpertViewExtensionProvider } from '@xpert-ai/plugin-sdk';
|
|
3
4
|
import { DashboardService } from './dashboard.service';
|
|
@@ -8,7 +9,8 @@ export declare const FEATURE = "live_dashboard";
|
|
|
8
9
|
export declare class DashboardViewProvider implements IXpertViewExtensionProvider {
|
|
9
10
|
private readonly service;
|
|
10
11
|
private readonly sharing;
|
|
11
|
-
|
|
12
|
+
private readonly projects;
|
|
13
|
+
constructor(service: DashboardService, sharing: DashboardSharingService, projects: DashboardProjectsService);
|
|
12
14
|
supports(context: XpertResolvedViewHostContext): boolean;
|
|
13
15
|
getViewManifests(context: XpertResolvedViewHostContext, slot: string): XpertExtensionViewManifest[];
|
|
14
16
|
getRemoteComponentEntry(): Promise<{
|
|
@@ -17,7 +19,34 @@ export declare class DashboardViewProvider implements IXpertViewExtensionProvide
|
|
|
17
19
|
}>;
|
|
18
20
|
getViewData(context: XpertResolvedViewHostContext, viewKey: string, query: XpertViewQuery): Promise<{
|
|
19
21
|
meta: {
|
|
20
|
-
|
|
22
|
+
notice: "not_published";
|
|
23
|
+
navigationTarget: {
|
|
24
|
+
target: "workbench.view";
|
|
25
|
+
viewKey: "live-dashboard__live-dashboard";
|
|
26
|
+
};
|
|
27
|
+
access: import("./project").DashboardAccess;
|
|
28
|
+
mode: "draft" | "published";
|
|
29
|
+
currentProject: {
|
|
30
|
+
id: string;
|
|
31
|
+
name: string;
|
|
32
|
+
} | null;
|
|
33
|
+
dashboards: {
|
|
34
|
+
title: string | null | undefined;
|
|
35
|
+
draftRevision?: number | undefined;
|
|
36
|
+
canDelete: boolean;
|
|
37
|
+
artifactId: string;
|
|
38
|
+
versionId: string | null | undefined;
|
|
39
|
+
versionNumber: number | undefined;
|
|
40
|
+
updatedAt: string | Date | undefined;
|
|
41
|
+
}[];
|
|
42
|
+
pagination: {
|
|
43
|
+
page: number;
|
|
44
|
+
pageSize: number;
|
|
45
|
+
hasMore: boolean;
|
|
46
|
+
};
|
|
47
|
+
sources: import("@xpert-ai/contracts").AnalyticsSourceSummary[];
|
|
48
|
+
} | {
|
|
49
|
+
saved: {
|
|
21
50
|
manifest: {
|
|
22
51
|
schema: "xpert.live-dashboard";
|
|
23
52
|
id: string;
|
|
@@ -52,6 +81,7 @@ export declare class DashboardViewProvider implements IXpertViewExtensionProvide
|
|
|
52
81
|
} | undefined;
|
|
53
82
|
};
|
|
54
83
|
dependencies: import("@xpert-ai/plugin-sdk/artifact-document").ArtifactDocumentDependencyAsset[];
|
|
84
|
+
contentHash: string;
|
|
55
85
|
draftId?: string | undefined;
|
|
56
86
|
draftRevision?: number | undefined;
|
|
57
87
|
baseVersionId?: string | null | undefined;
|
|
@@ -61,8 +91,8 @@ export declare class DashboardViewProvider implements IXpertViewExtensionProvide
|
|
|
61
91
|
artifactId: string;
|
|
62
92
|
versionId: string | null | undefined;
|
|
63
93
|
versionNumber: number | undefined;
|
|
64
|
-
}
|
|
65
|
-
versions
|
|
94
|
+
};
|
|
95
|
+
versions: {
|
|
66
96
|
current: boolean;
|
|
67
97
|
artifactId: string;
|
|
68
98
|
versionId: string | null | undefined;
|
|
@@ -73,11 +103,39 @@ export declare class DashboardViewProvider implements IXpertViewExtensionProvide
|
|
|
73
103
|
navigationTarget: {
|
|
74
104
|
target: "workbench.view";
|
|
75
105
|
viewKey: "live-dashboard__live-dashboard";
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
|
|
106
|
+
};
|
|
107
|
+
access: import("./project").DashboardAccess;
|
|
108
|
+
mode: "draft" | "published";
|
|
109
|
+
currentProject: {
|
|
110
|
+
id: string;
|
|
111
|
+
name: string;
|
|
112
|
+
} | null;
|
|
113
|
+
dashboards: {
|
|
114
|
+
title: string | null | undefined;
|
|
115
|
+
draftRevision?: number | undefined;
|
|
116
|
+
canDelete: boolean;
|
|
117
|
+
artifactId: string;
|
|
118
|
+
versionId: string | null | undefined;
|
|
119
|
+
versionNumber: number | undefined;
|
|
120
|
+
updatedAt: string | Date | undefined;
|
|
121
|
+
}[];
|
|
122
|
+
pagination: {
|
|
123
|
+
page: number;
|
|
124
|
+
pageSize: number;
|
|
125
|
+
hasMore: boolean;
|
|
126
|
+
};
|
|
127
|
+
sources: import("@xpert-ai/contracts").AnalyticsSourceSummary[];
|
|
128
|
+
} | {
|
|
129
|
+
navigationTarget: {
|
|
130
|
+
target: "workbench.view";
|
|
79
131
|
viewKey: "live-dashboard__live-dashboard";
|
|
80
132
|
};
|
|
133
|
+
access: import("./project").DashboardAccess;
|
|
134
|
+
mode: "draft" | "published";
|
|
135
|
+
currentProject: {
|
|
136
|
+
id: string;
|
|
137
|
+
name: string;
|
|
138
|
+
} | null;
|
|
81
139
|
dashboards: {
|
|
82
140
|
title: string | null | undefined;
|
|
83
141
|
draftRevision?: number | undefined;
|
|
@@ -87,10 +145,42 @@ export declare class DashboardViewProvider implements IXpertViewExtensionProvide
|
|
|
87
145
|
versionNumber: number | undefined;
|
|
88
146
|
updatedAt: string | Date | undefined;
|
|
89
147
|
}[];
|
|
148
|
+
pagination: {
|
|
149
|
+
page: number;
|
|
150
|
+
pageSize: number;
|
|
151
|
+
hasMore: boolean;
|
|
152
|
+
};
|
|
90
153
|
sources: import("@xpert-ai/contracts").AnalyticsSourceSummary[];
|
|
91
154
|
};
|
|
92
155
|
}>;
|
|
93
156
|
executeViewAction(context: XpertResolvedViewHostContext, viewKey: string, action: string, request: XpertViewActionRequest): Promise<{
|
|
157
|
+
success: boolean;
|
|
158
|
+
data: {
|
|
159
|
+
items: {
|
|
160
|
+
title: string | null | undefined;
|
|
161
|
+
draftRevision?: number | undefined;
|
|
162
|
+
canDelete: boolean;
|
|
163
|
+
artifactId: string;
|
|
164
|
+
versionId: string | null | undefined;
|
|
165
|
+
versionNumber: number | undefined;
|
|
166
|
+
updatedAt: string | Date | undefined;
|
|
167
|
+
}[];
|
|
168
|
+
page: number;
|
|
169
|
+
hasMore: boolean;
|
|
170
|
+
};
|
|
171
|
+
refresh: boolean;
|
|
172
|
+
} | {
|
|
173
|
+
success: boolean;
|
|
174
|
+
data: {
|
|
175
|
+
items: {
|
|
176
|
+
id: string;
|
|
177
|
+
name: string;
|
|
178
|
+
}[];
|
|
179
|
+
page: number;
|
|
180
|
+
hasMore: boolean;
|
|
181
|
+
};
|
|
182
|
+
refresh: boolean;
|
|
183
|
+
} | {
|
|
94
184
|
success: boolean;
|
|
95
185
|
data: {
|
|
96
186
|
published: {
|
|
@@ -10,6 +10,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.DashboardViewProvider = exports.FEATURE = exports.VIEW_PROVIDER = exports.VIEW_KEY = void 0;
|
|
13
|
+
const projects_service_1 = require("./projects.service");
|
|
13
14
|
const common_1 = require("@nestjs/common");
|
|
14
15
|
const v3_1 = require("zod/v3");
|
|
15
16
|
const contracts_1 = require("@xpert-ai/contracts");
|
|
@@ -20,33 +21,42 @@ const sharing_service_1 = require("./sharing.service");
|
|
|
20
21
|
const dashboard_schema_1 = require("./dashboard.schema");
|
|
21
22
|
const dashboard_receipt_1 = require("./dashboard-receipt");
|
|
22
23
|
const dashboard_navigation_1 = require("./dashboard-navigation");
|
|
24
|
+
const project_1 = require("./project");
|
|
23
25
|
const dashboard_icon_1 = require("./dashboard-icon");
|
|
24
26
|
exports.VIEW_KEY = 'live-dashboard';
|
|
25
27
|
exports.VIEW_PROVIDER = 'live-dashboard';
|
|
26
28
|
exports.FEATURE = 'live_dashboard';
|
|
27
29
|
const text = (en_US, zh_Hans) => ({ en_US, zh_Hans });
|
|
28
30
|
let DashboardViewProvider = class DashboardViewProvider {
|
|
29
|
-
constructor(service, sharing) {
|
|
31
|
+
constructor(service, sharing, projects) {
|
|
30
32
|
this.service = service;
|
|
31
33
|
this.sharing = sharing;
|
|
34
|
+
this.projects = projects;
|
|
32
35
|
}
|
|
33
|
-
supports(context) { return context.hostType === 'agent'
|
|
36
|
+
supports(context) { return context.hostType === 'agent'; }
|
|
34
37
|
getViewManifests(context, slot) {
|
|
35
|
-
if (!(context
|
|
38
|
+
if (!this.supports(context) || !['agent.workbench', 'agent.workbench.fixed', 'agent.workbench.main'].includes(slot))
|
|
36
39
|
return [];
|
|
37
40
|
return [{ key: exports.VIEW_KEY, title: text('Live dashboards', '实时看板'), hostType: context.hostType, slot, order: 35,
|
|
38
41
|
icon: dashboard_icon_1.dashboardIcon, refreshable: true, activation: { projectResource: true, requiredFeatures: [exports.FEATURE] },
|
|
39
42
|
source: { provider: exports.VIEW_PROVIDER, plugin: dashboard_service_1.PLUGIN_NAME },
|
|
40
|
-
workbench: { fixed: true, openMode: 'on-demand', menu: { enabled: true, label: text('Live dashboards', '实时看板'), icon: dashboard_icon_1.dashboardIcon, order: 35 } },
|
|
43
|
+
workbench: { projectType: project_1.DASHBOARD_PROJECT_TYPE, fixed: true, openMode: 'on-demand', menu: { enabled: true, label: text('Live dashboards', '实时看板'), icon: dashboard_icon_1.dashboardIcon, order: 35 } },
|
|
41
44
|
view: { type: 'remote_component', runtime: 'react', protocolVersion: 1, component: { isolation: 'iframe', entry: exports.VIEW_KEY }, dataSource: { mode: 'platform' } },
|
|
42
|
-
dataSource: { mode: 'platform', querySchema: { supportsSelection: true, supportsParameters: true }, cache: { enabled: false } },
|
|
45
|
+
dataSource: { mode: 'platform', querySchema: { supportsSelection: true, supportsParameters: true, supportsPagination: true, defaultPageSize: 50 }, cache: { enabled: false } },
|
|
43
46
|
clientCommands: [{ key: 'workbench.content.status' }, { key: 'workbench.content.resolve' }, { key: contracts_1.ASSISTANT_CONTEXT_SET_COMMAND, label: text('Select dashboard for Assistant', '设置助理当前看板') },
|
|
47
|
+
{ key: contracts_1.ASSISTANT_CHAT_SEND_MESSAGE_COMMAND, label: text('Create with Assistant', '交给助理制作') },
|
|
44
48
|
{ key: contracts_1.ARTIFACT_PRESENTATION_OPEN_COMMAND, label: text('Open shared page', '打开独立页面') },
|
|
45
49
|
{ key: contracts_1.WORKBENCH_NAVIGATION_OPEN_COMMAND, label: text('Open dashboard', '打开看板') }],
|
|
46
50
|
hostEvents: { subscriptions: [{ key: 'dashboard-created', event: 'assistant.tool.completed',
|
|
47
51
|
filter: { toolNames: dashboard_receipt_1.DASHBOARD_MUTATION_TOOLS }, action: { type: 'forward', debounceMs: 0 } }] },
|
|
48
52
|
actions: [
|
|
49
|
-
...[
|
|
53
|
+
...[
|
|
54
|
+
{ key: 'dashboards', label: text('Select dashboard', '选择看板') },
|
|
55
|
+
{ key: 'projects', label: text('Select project', '选择项目') },
|
|
56
|
+
{ key: 'share-status', label: text('Sharing status', '分享状态') },
|
|
57
|
+
{ key: 'share', label: text('Team sharing', '团队分享') },
|
|
58
|
+
{ key: 'revoke-share', label: text('Revoke sharing', '撤销分享') }
|
|
59
|
+
].map(({ key, label }) => ({ key, label, actionType: 'invoke', placement: 'toolbar', inputSchema: { type: 'object', properties: {}, additionalProperties: true } })),
|
|
50
60
|
{ key: 'delete', label: text('Delete dashboard', '删除看板'), actionType: 'invoke', placement: 'toolbar', inputSchema: { type: 'object', properties: {}, additionalProperties: true } },
|
|
51
61
|
{ key: 'publish', label: text('Publish draft', '发布草稿'), actionType: 'invoke', placement: 'toolbar', inputSchema: { type: 'object', properties: {}, additionalProperties: true } },
|
|
52
62
|
{ key: 'save', label: text('Save', '保存'), actionType: 'invoke', placement: 'toolbar', inputSchema: { type: 'object', properties: {}, additionalProperties: true } },
|
|
@@ -58,12 +68,31 @@ let DashboardViewProvider = class DashboardViewProvider {
|
|
|
58
68
|
async getViewData(context, viewKey, query) {
|
|
59
69
|
assertView(viewKey);
|
|
60
70
|
const params = dashboard_navigation_1.dashboardNavigationSchema.parse(query);
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
71
|
+
const access = await this.service.access(context);
|
|
72
|
+
const currentProject = await this.projects.current(context);
|
|
73
|
+
const mode = params.newDashboard ? 'draft' : params.mode ?? (access.canReadDraft ? 'draft' : 'published');
|
|
74
|
+
if (mode === 'draft' && !access.canReadDraft)
|
|
75
|
+
throw new common_1.ForbiddenException('DASHBOARD_DRAFT_ACCESS_DENIED');
|
|
76
|
+
const page = await this.service.listPage(context, params.page, params.pageSize);
|
|
77
|
+
const versions = params.artifactId ? await this.service.history(context, params.artifactId) : undefined;
|
|
78
|
+
const unavailable = params.artifactId && mode === 'published' && !params.versionId && !versions?.some(version => version.current);
|
|
79
|
+
return { meta: { navigationTarget: (0, dashboard_navigation_1.dashboardNavigationTarget)(context), access, mode, currentProject,
|
|
80
|
+
dashboards: page.items, pagination: { page: page.page, pageSize: page.pageSize, hasMore: page.hasMore },
|
|
81
|
+
sources: access.canEdit ? await this.service.sources(context) : [],
|
|
82
|
+
...(unavailable ? { notice: 'not_published' } : params.artifactId ? {
|
|
83
|
+
saved: await this.service.openDocument(context, params.artifactId, params.versionId, params.draftRevision, mode), versions
|
|
84
|
+
} : {}) } };
|
|
64
85
|
}
|
|
65
86
|
async executeViewAction(context, viewKey, action, request) {
|
|
66
87
|
assertView(viewKey);
|
|
88
|
+
if (action === 'dashboards') {
|
|
89
|
+
const parsed = projects_service_1.projectSearchSchema.safeParse(request.input);
|
|
90
|
+
if (!parsed.success)
|
|
91
|
+
throw new common_1.BadRequestException('DASHBOARD_INVALID_PICKER_QUERY');
|
|
92
|
+
return { success: true, data: await this.service.searchPage(context, parsed.data), refresh: false };
|
|
93
|
+
}
|
|
94
|
+
if (action === 'projects')
|
|
95
|
+
return { success: true, data: await this.projects.list(context, projects_service_1.projectSearchSchema.parse(request.input)), refresh: false };
|
|
67
96
|
if (action === 'share')
|
|
68
97
|
return { success: true, data: await this.sharing.share(context, sharing_service_1.shareInput.parse(request.input)), refresh: false };
|
|
69
98
|
if (action === 'share-status' || action === 'revoke-share') {
|
|
@@ -106,7 +135,7 @@ let DashboardViewProvider = class DashboardViewProvider {
|
|
|
106
135
|
exports.DashboardViewProvider = DashboardViewProvider;
|
|
107
136
|
exports.DashboardViewProvider = DashboardViewProvider = __decorate([
|
|
108
137
|
(0, plugin_sdk_1.ViewExtensionProvider)(exports.VIEW_PROVIDER),
|
|
109
|
-
__metadata("design:paramtypes", [dashboard_service_1.DashboardService, sharing_service_1.DashboardSharingService])
|
|
138
|
+
__metadata("design:paramtypes", [dashboard_service_1.DashboardService, sharing_service_1.DashboardSharingService, projects_service_1.DashboardProjectsService])
|
|
110
139
|
], DashboardViewProvider);
|
|
111
140
|
function assertView(key) { if (key !== exports.VIEW_KEY)
|
|
112
141
|
throw new common_1.BadRequestException('DASHBOARD_VIEW_UNSUPPORTED'); }
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
ISC License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Lucide Icons and Contributors
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
7
|
+
copyright notice and this permission notice appear in all copies.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
10
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
11
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
12
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
13
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
14
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
15
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
The following Lucide icons are derived from the Feather project:
|
|
20
|
+
|
|
21
|
+
airplay, alert-circle, alert-octagon, alert-triangle, aperture, arrow-down-circle, arrow-down-left, arrow-down-right, arrow-down, arrow-left-circle, arrow-left, arrow-right-circle, arrow-right, arrow-up-circle, arrow-up-left, arrow-up-right, arrow-up, at-sign, calendar, cast, check, chevron-down, chevron-left, chevron-right, chevron-up, chevrons-down, chevrons-left, chevrons-right, chevrons-up, circle, clipboard, clock, code, columns, command, compass, corner-down-left, corner-down-right, corner-left-down, corner-left-up, corner-right-down, corner-right-up, corner-up-left, corner-up-right, crosshair, database, divide-circle, divide-square, dollar-sign, download, external-link, feather, frown, hash, headphones, help-circle, info, italic, key, layout, life-buoy, link-2, link, loader, lock, log-in, log-out, maximize, meh, minimize, minimize-2, minus-circle, minus-square, minus, monitor, moon, more-horizontal, more-vertical, move, music, navigation-2, navigation, octagon, pause-circle, percent, plus-circle, plus-square, plus, power, radio, rss, search, server, share, shopping-bag, sidebar, smartphone, smile, square, table-2, tablet, target, terminal, trash-2, trash, triangle, tv, type, upload, x-circle, x-octagon, x-square, x, zoom-in, zoom-out
|
|
22
|
+
|
|
23
|
+
The MIT License (MIT) (for the icons listed above)
|
|
24
|
+
|
|
25
|
+
Copyright (c) 2013-present Cole Bemis
|
|
26
|
+
|
|
27
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
28
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
29
|
+
in the Software without restriction, including without limitation the rights
|
|
30
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
31
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
32
|
+
furnished to do so, subject to the following conditions:
|
|
33
|
+
|
|
34
|
+
The above copyright notice and this permission notice shall be included in all
|
|
35
|
+
copies or substantial portions of the Software.
|
|
36
|
+
|
|
37
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
38
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
39
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
40
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
41
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
42
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
43
|
+
SOFTWARE.
|