@xpert-ai/plugin-live-dashboard 0.1.3 → 0.1.4
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 +1 -1
- package/README.md +2 -2
- package/dist/lib/agent.schema.d.ts +11 -11
- package/dist/lib/agent.schema.js +3 -3
- package/dist/lib/analytics-source.d.ts +3 -0
- package/dist/lib/analytics-source.js +11 -0
- package/dist/lib/dashboard-icon.d.ts +2 -1
- package/dist/lib/dashboard-icon.js +10 -2
- package/dist/lib/dashboard-sharing.js +2 -1
- package/dist/lib/dashboard-view.schema.d.ts +1249 -0
- package/dist/lib/dashboard-view.schema.js +19 -0
- package/dist/lib/dashboard.schema.d.ts +12 -12
- package/dist/lib/dashboard.schema.js +1 -1
- package/dist/lib/dashboard.service.d.ts +3 -3
- package/dist/lib/dashboard.service.js +3 -6
- package/dist/lib/definition-tools.d.ts +56 -0
- package/dist/lib/definition-tools.js +42 -0
- package/dist/lib/document-package.d.ts +1 -1
- package/dist/lib/document-package.js +2 -2
- package/dist/lib/middleware.js +12 -8
- package/dist/lib/presentation.provider.d.ts +1 -1
- package/dist/lib/resource-card.js +1 -1
- package/dist/lib/view.provider.d.ts +2 -2
- package/dist/lib/view.provider.js +3 -2
- package/dist/remote/app.js +11 -11
- package/dist/remote/build-manifest.json +17 -14
- package/docs/frontend-libraries.mdx +1 -1
- package/docs/html-mode.md +2 -2
- package/docs/index.mdx +14 -0
- package/docs/verification.mdx +1 -1
- package/examples/data-xpert-sales.json +6 -3
- package/examples/postgres-sales.json +5 -3
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -49,7 +49,7 @@ The creation tool returns `{ dashboard: { artifactId, versionId, versionNumber,
|
|
|
49
49
|
|
|
50
50
|
## Save, filter, refresh
|
|
51
51
|
|
|
52
|
-
`xpert.live-dashboard
|
|
52
|
+
`xpert.live-dashboard` contains id/title/bindings/controls/charts/tables and optional `presentation: { type: "html", html }`. Charts reference stable Dataset field IDs. Controls map to typed binding parameters. Filter and refresh execute the saved server-side definition for the current viewer.
|
|
53
53
|
|
|
54
54
|
Save validates and queries all bindings before writing immutable JSON. `expectedVersionId` (null for new) and platform Artifact row-lock compare-and-set prevent lost updates. Content hashes support retries. Saved files contain definitions, not result rows.
|
|
55
55
|
|
|
@@ -75,7 +75,7 @@ The renderer runs in a script-only sandbox with no-network CSP. A small in-memor
|
|
|
75
75
|
|
|
76
76
|
## Build and validation
|
|
77
77
|
|
|
78
|
-
Use the xpertai workspace's declared Corepack/pnpm. Development dependencies pin published SDK/contracts 3.
|
|
78
|
+
Use the xpertai workspace's declared Corepack/pnpm. Development dependencies pin published SDK/contracts 3.26.1 and the Data Analytics renderer 0.1.35; no local platform or community links are required.
|
|
79
79
|
|
|
80
80
|
```sh
|
|
81
81
|
corepack pnpm install --frozen-lockfile
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { z } from 'zod/v3';
|
|
2
2
|
import type { AnalyticsDiscoveryResult } from '@xpert-ai/contracts';
|
|
3
3
|
export declare const discoverToolSchema: z.ZodObject<{
|
|
4
|
-
|
|
4
|
+
source: z.ZodType<import("@xpert-ai/contracts").AnalyticsSourceRef, z.ZodTypeDef, import("@xpert-ai/contracts").AnalyticsSourceRef>;
|
|
5
5
|
providerId: z.ZodString;
|
|
6
6
|
requestJson: z.ZodDefault<z.ZodString>;
|
|
7
7
|
}, "strict", z.ZodTypeAny, {
|
|
8
|
-
|
|
8
|
+
source: import("@xpert-ai/contracts").AnalyticsSourceRef;
|
|
9
9
|
providerId: string;
|
|
10
10
|
requestJson: string;
|
|
11
11
|
}, {
|
|
12
|
-
|
|
12
|
+
source: import("@xpert-ai/contracts").AnalyticsSourceRef;
|
|
13
13
|
providerId: string;
|
|
14
14
|
requestJson?: string | undefined;
|
|
15
15
|
}>;
|
|
16
16
|
export declare const agentBindingSchema: z.ZodObject<{
|
|
17
|
-
|
|
17
|
+
source: z.ZodType<import("@xpert-ai/contracts").AnalyticsSourceRef, z.ZodTypeDef, import("@xpert-ai/contracts").AnalyticsSourceRef>;
|
|
18
18
|
providerId: z.ZodString;
|
|
19
19
|
output: z.ZodObject<{
|
|
20
20
|
datasetId: z.ZodString;
|
|
@@ -97,6 +97,7 @@ export declare const agentBindingSchema: z.ZodObject<{
|
|
|
97
97
|
}>, "many">;
|
|
98
98
|
payloadJson: z.ZodString;
|
|
99
99
|
}, "strict", z.ZodTypeAny, {
|
|
100
|
+
source: import("@xpert-ai/contracts").AnalyticsSourceRef;
|
|
100
101
|
parameters: {
|
|
101
102
|
type: "string" | "number" | "boolean" | "date";
|
|
102
103
|
name: string;
|
|
@@ -104,7 +105,6 @@ export declare const agentBindingSchema: z.ZodObject<{
|
|
|
104
105
|
defaultValue?: string | number | boolean | null | undefined;
|
|
105
106
|
allowedValues?: (string | number | boolean | null)[] | undefined;
|
|
106
107
|
}[];
|
|
107
|
-
dataSourceId: string;
|
|
108
108
|
providerId: string;
|
|
109
109
|
output: {
|
|
110
110
|
datasetId?: string;
|
|
@@ -122,6 +122,7 @@ export declare const agentBindingSchema: z.ZodObject<{
|
|
|
122
122
|
};
|
|
123
123
|
payloadJson: string;
|
|
124
124
|
}, {
|
|
125
|
+
source: import("@xpert-ai/contracts").AnalyticsSourceRef;
|
|
125
126
|
parameters: {
|
|
126
127
|
type: "string" | "number" | "boolean" | "date";
|
|
127
128
|
name: string;
|
|
@@ -129,7 +130,6 @@ export declare const agentBindingSchema: z.ZodObject<{
|
|
|
129
130
|
defaultValue?: string | number | boolean | null | undefined;
|
|
130
131
|
allowedValues?: (string | number | boolean | null)[] | undefined;
|
|
131
132
|
}[];
|
|
132
|
-
dataSourceId: string;
|
|
133
133
|
providerId: string;
|
|
134
134
|
output: {
|
|
135
135
|
datasetId?: string;
|
|
@@ -149,7 +149,7 @@ export declare const agentBindingSchema: z.ZodObject<{
|
|
|
149
149
|
}>;
|
|
150
150
|
export declare const previewToolSchema: z.ZodObject<{
|
|
151
151
|
binding: z.ZodObject<{
|
|
152
|
-
|
|
152
|
+
source: z.ZodType<import("@xpert-ai/contracts").AnalyticsSourceRef, z.ZodTypeDef, import("@xpert-ai/contracts").AnalyticsSourceRef>;
|
|
153
153
|
providerId: z.ZodString;
|
|
154
154
|
output: z.ZodObject<{
|
|
155
155
|
datasetId: z.ZodString;
|
|
@@ -232,6 +232,7 @@ export declare const previewToolSchema: z.ZodObject<{
|
|
|
232
232
|
}>, "many">;
|
|
233
233
|
payloadJson: z.ZodString;
|
|
234
234
|
}, "strict", z.ZodTypeAny, {
|
|
235
|
+
source: import("@xpert-ai/contracts").AnalyticsSourceRef;
|
|
235
236
|
parameters: {
|
|
236
237
|
type: "string" | "number" | "boolean" | "date";
|
|
237
238
|
name: string;
|
|
@@ -239,7 +240,6 @@ export declare const previewToolSchema: z.ZodObject<{
|
|
|
239
240
|
defaultValue?: string | number | boolean | null | undefined;
|
|
240
241
|
allowedValues?: (string | number | boolean | null)[] | undefined;
|
|
241
242
|
}[];
|
|
242
|
-
dataSourceId: string;
|
|
243
243
|
providerId: string;
|
|
244
244
|
output: {
|
|
245
245
|
datasetId?: string;
|
|
@@ -257,6 +257,7 @@ export declare const previewToolSchema: z.ZodObject<{
|
|
|
257
257
|
};
|
|
258
258
|
payloadJson: string;
|
|
259
259
|
}, {
|
|
260
|
+
source: import("@xpert-ai/contracts").AnalyticsSourceRef;
|
|
260
261
|
parameters: {
|
|
261
262
|
type: "string" | "number" | "boolean" | "date";
|
|
262
263
|
name: string;
|
|
@@ -264,7 +265,6 @@ export declare const previewToolSchema: z.ZodObject<{
|
|
|
264
265
|
defaultValue?: string | number | boolean | null | undefined;
|
|
265
266
|
allowedValues?: (string | number | boolean | null)[] | undefined;
|
|
266
267
|
}[];
|
|
267
|
-
dataSourceId: string;
|
|
268
268
|
providerId: string;
|
|
269
269
|
output: {
|
|
270
270
|
datasetId?: string;
|
|
@@ -284,6 +284,7 @@ export declare const previewToolSchema: z.ZodObject<{
|
|
|
284
284
|
}>;
|
|
285
285
|
}, "strict", z.ZodTypeAny, {
|
|
286
286
|
binding: {
|
|
287
|
+
source: import("@xpert-ai/contracts").AnalyticsSourceRef;
|
|
287
288
|
parameters: {
|
|
288
289
|
type: "string" | "number" | "boolean" | "date";
|
|
289
290
|
name: string;
|
|
@@ -291,7 +292,6 @@ export declare const previewToolSchema: z.ZodObject<{
|
|
|
291
292
|
defaultValue?: string | number | boolean | null | undefined;
|
|
292
293
|
allowedValues?: (string | number | boolean | null)[] | undefined;
|
|
293
294
|
}[];
|
|
294
|
-
dataSourceId: string;
|
|
295
295
|
providerId: string;
|
|
296
296
|
output: {
|
|
297
297
|
datasetId?: string;
|
|
@@ -311,6 +311,7 @@ export declare const previewToolSchema: z.ZodObject<{
|
|
|
311
311
|
};
|
|
312
312
|
}, {
|
|
313
313
|
binding: {
|
|
314
|
+
source: import("@xpert-ai/contracts").AnalyticsSourceRef;
|
|
314
315
|
parameters: {
|
|
315
316
|
type: "string" | "number" | "boolean" | "date";
|
|
316
317
|
name: string;
|
|
@@ -318,7 +319,6 @@ export declare const previewToolSchema: z.ZodObject<{
|
|
|
318
319
|
defaultValue?: string | number | boolean | null | undefined;
|
|
319
320
|
allowedValues?: (string | number | boolean | null)[] | undefined;
|
|
320
321
|
}[];
|
|
321
|
-
dataSourceId: string;
|
|
322
322
|
providerId: string;
|
|
323
323
|
output: {
|
|
324
324
|
datasetId?: string;
|
package/dist/lib/agent.schema.js
CHANGED
|
@@ -14,9 +14,9 @@ const agentControlsSchema = v3_1.z.array(dashboard_schema_1.dashboardSchema.inne
|
|
|
14
14
|
defaultValue: dashboard_schema_1.dashboardSchema.innerType().shape.controls.element.shape.defaultValue.unwrap()
|
|
15
15
|
.describe('Required: copy the verified Binding parameter defaultValue, including explicit null for an all-values filter.')
|
|
16
16
|
})).max(24);
|
|
17
|
-
exports.discoverToolSchema = v3_1.z.object({
|
|
17
|
+
exports.discoverToolSchema = v3_1.z.object({ source: analytics_1.analyticsSourceRefSchema, providerId: v3_1.z.string().min(1).max(160),
|
|
18
18
|
requestJson: objectJson.default('{}').describe('JSON text. Start with "{}"; then JSON.stringify the returned inspectRequest/nextRequest directly. Do not wrap it in inspectRequest.') }).strict();
|
|
19
|
-
exports.agentBindingSchema = analytics_1.analyticsBindingObjectSchema.omit({ payload: true,
|
|
19
|
+
exports.agentBindingSchema = analytics_1.analyticsBindingObjectSchema.omit({ payload: true, id: true, operation: true, contractVersion: true }).extend({
|
|
20
20
|
parameters: v3_1.z.array(analytics_1.analyticsBindingObjectSchema.shape.parameters.element.omit({ controlId: true })).max(24),
|
|
21
21
|
payloadJson: objectJson
|
|
22
22
|
}).strict();
|
|
@@ -46,7 +46,7 @@ function parseObjectJson(text) {
|
|
|
46
46
|
}
|
|
47
47
|
function fromAgentBinding(input, contract) {
|
|
48
48
|
const { payloadJson, ...binding } = input;
|
|
49
|
-
return analytics_1.analyticsBindingSchema.parse({ ...binding,
|
|
49
|
+
return analytics_1.analyticsBindingSchema.parse({ ...binding, id: input.output.datasetId,
|
|
50
50
|
operation: contract.operation, contractVersion: contract.contractVersion,
|
|
51
51
|
parameters: input.parameters.map(parameter => ({ ...parameter, controlId: parameter.name })), payload: parseObjectJson(payloadJson) });
|
|
52
52
|
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { AnalyticsSourceRef } from '@xpert-ai/contracts';
|
|
2
|
+
/** Catalogs show the latest version; historical pinned queries still resolve through the host ACL. */
|
|
3
|
+
export declare function sameAnalyticsResource(left: AnalyticsSourceRef, right: AnalyticsSourceRef): boolean;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sameAnalyticsResource = sameAnalyticsResource;
|
|
4
|
+
/** Catalogs show the latest version; historical pinned queries still resolve through the host ACL. */
|
|
5
|
+
function sameAnalyticsResource(left, right) {
|
|
6
|
+
if (left.kind === 'data-source')
|
|
7
|
+
return right.kind === 'data-source' && left.dataSourceId === right.dataSourceId;
|
|
8
|
+
if (left.kind === 'definition')
|
|
9
|
+
return right.kind === 'definition' && left.definitionId === right.definitionId;
|
|
10
|
+
return right.kind === 'artifact' && left.artifactId === right.artifactId;
|
|
11
|
+
}
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.dashboardIcon = void 0;
|
|
4
|
-
|
|
4
|
+
const palette = { tile: '#EAF0FA', chart: '#3659A2', live: '#178577' };
|
|
5
|
+
/** Rising data columns with a detached live signal, legible without host fonts or CSS. */
|
|
5
6
|
exports.dashboardIcon = {
|
|
6
7
|
type: 'svg',
|
|
7
|
-
|
|
8
|
+
alt: 'Live dashboards',
|
|
9
|
+
value: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="none">
|
|
10
|
+
<rect x="24" y="24" width="208" height="208" rx="40" fill="${palette.tile}"/>
|
|
11
|
+
<rect x="66" y="144" width="26" height="44" rx="7" fill="${palette.chart}"/>
|
|
12
|
+
<rect x="114" y="112" width="26" height="76" rx="7" fill="${palette.chart}"/>
|
|
13
|
+
<rect x="162" y="96" width="26" height="92" rx="7" fill="${palette.live}"/>
|
|
14
|
+
<circle cx="175" cy="72" r="13" fill="${palette.live}"/>
|
|
15
|
+
</svg>`
|
|
8
16
|
};
|
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DASHBOARD_SHARE_KEY = void 0;
|
|
4
4
|
exports.dashboardSharingIssues = dashboardSharingIssues;
|
|
5
|
+
const analytics_source_1 = require("./analytics-source");
|
|
5
6
|
exports.DASHBOARD_SHARE_KEY = 'team-readonly';
|
|
6
7
|
/** Apply the same provider policy when enabling a share and advancing a latest share. */
|
|
7
8
|
function dashboardSharingIssues(manifest, sources) {
|
|
8
9
|
const issues = [];
|
|
9
10
|
for (const binding of manifest.bindings) {
|
|
10
|
-
const provider = sources.find(source => source.
|
|
11
|
+
const provider = sources.find(source => (0, analytics_source_1.sameAnalyticsResource)(source.source, binding.source))?.providers.find(provider => provider.id === binding.providerId);
|
|
11
12
|
if (!provider)
|
|
12
13
|
issues.push({ code: 'DASHBOARD_SOURCE_UNAVAILABLE', bindingId: binding.id });
|
|
13
14
|
else if (provider.sharing?.mode === 'owner_only')
|