@xpert-ai/plugin-live-dashboard 0.6.2 → 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.
- package/.xpertai-plugin/plugin.json +1 -1
- package/README.md +14 -2
- package/assets/explore/PROVENANCE.md +9 -0
- package/assets/explore/category-contribution.webp +0 -0
- package/assets/explore/ecommerce-operations.webp +0 -0
- package/assets/explore/extensions.svg +1 -0
- package/assets/explore/generation-prompts.json +107 -0
- package/assets/explore/global-assets.webp +0 -0
- package/assets/explore/hotel-cancellation.webp +0 -0
- package/assets/explore/hotel-operations.webp +0 -0
- package/assets/explore/insights.svg +1 -0
- package/assets/explore/knowledge.svg +1 -0
- package/assets/explore/legal-defense.webp +0 -0
- package/assets/explore/order-promotion.webp +0 -0
- package/assets/explore/outbound-travel.webp +0 -0
- package/assets/explore/schedule.svg +1 -0
- package/assets/explore/steam-market.webp +0 -0
- package/assets/explore/weather-alerts.webp +0 -0
- package/assets/library/catalog/README.md +11 -0
- package/assets/library/catalog/analysis-template-conversion-diagnosis.svg +1 -0
- package/assets/library/catalog/analysis-template-customer-lifecycle.svg +1 -0
- package/assets/library/catalog/analysis-template-growth-attribution.svg +1 -0
- package/assets/library/catalog/analysis-template-multi-criteria.svg +1 -0
- package/assets/library/catalog/analysis-template-regional-flow.svg +1 -0
- package/assets/library/catalog/analysis-template-risk-monitoring.svg +1 -0
- package/assets/library/catalog/component-analysis-note.svg +1 -0
- package/assets/library/catalog/component-box-plot.svg +1 -0
- package/assets/library/catalog/component-bullet.svg +1 -0
- package/assets/library/catalog/component-calendar-heatmap.svg +1 -0
- package/assets/library/catalog/component-collapsible-panel.svg +1 -0
- package/assets/library/catalog/component-combo-chart.svg +1 -0
- package/assets/library/catalog/component-content-panel.svg +1 -0
- package/assets/library/catalog/component-date-range.svg +1 -0
- package/assets/library/catalog/component-detail-table.svg +1 -0
- package/assets/library/catalog/component-donut.svg +1 -0
- package/assets/library/catalog/component-dumbbell.svg +1 -0
- package/assets/library/catalog/component-event-timeline.svg +1 -0
- package/assets/library/catalog/component-funnel.svg +1 -0
- package/assets/library/catalog/component-histogram.svg +1 -0
- package/assets/library/catalog/component-keyword-filter.svg +1 -0
- package/assets/library/catalog/component-matrix-heatmap.svg +1 -0
- package/assets/library/catalog/component-metric-card.svg +1 -0
- package/assets/library/catalog/component-metric-group.svg +1 -0
- package/assets/library/catalog/component-multi-series.svg +1 -0
- package/assets/library/catalog/component-number-range.svg +1 -0
- package/assets/library/catalog/component-option-filter.svg +1 -0
- package/assets/library/catalog/component-pareto.svg +1 -0
- package/assets/library/catalog/component-percent-stacked.svg +1 -0
- package/assets/library/catalog/component-pivot-table.svg +1 -0
- package/assets/library/catalog/component-radar.svg +1 -0
- package/assets/library/catalog/component-ranking.svg +1 -0
- package/assets/library/catalog/component-sankey.svg +1 -0
- package/assets/library/catalog/component-scatter-bubble.svg +1 -0
- package/assets/library/catalog/component-segmented-filter.svg +1 -0
- package/assets/library/catalog/component-small-multiples.svg +1 -0
- package/assets/library/catalog/component-sunburst.svg +1 -0
- package/assets/library/catalog/component-tabbed-panel.svg +1 -0
- package/assets/library/catalog/component-target-progress.svg +1 -0
- package/assets/library/catalog/component-toggle-filter.svg +1 -0
- package/assets/library/catalog/component-treemap.svg +1 -0
- package/assets/library/catalog/component-trend-comparison.svg +1 -0
- package/assets/library/catalog/component-waterfall.svg +1 -0
- package/assets/library/catalog/provenance.json +524 -0
- package/assets/library/catalog/visual-theme-amber-sunset.svg +1 -0
- package/assets/library/catalog/visual-theme-art-deco.svg +1 -0
- package/assets/library/catalog/visual-theme-bauhaus.svg +1 -0
- package/assets/library/catalog/visual-theme-burgundy-night.svg +1 -0
- package/assets/library/catalog/visual-theme-cinematic.svg +1 -0
- package/assets/library/catalog/visual-theme-clarity-blue.svg +1 -0
- package/assets/library/catalog/visual-theme-clay.svg +1 -0
- package/assets/library/catalog/visual-theme-cobalt-diagonal.svg +1 -0
- package/assets/library/catalog/visual-theme-coral-cream.svg +1 -0
- package/assets/library/catalog/visual-theme-crimson-black.svg +1 -0
- package/assets/library/catalog/visual-theme-cyberpunk.svg +1 -0
- package/assets/library/catalog/visual-theme-dark-olive.svg +1 -0
- package/assets/library/catalog/visual-theme-dark-tech.svg +1 -0
- package/assets/library/catalog/visual-theme-deep-sea-blue.svg +1 -0
- package/assets/library/catalog/visual-theme-deep-sea-mist.svg +1 -0
- package/assets/library/catalog/visual-theme-financial-trading.svg +1 -0
- package/assets/library/catalog/visual-theme-flat.svg +1 -0
- package/assets/library/catalog/visual-theme-frosted-tech.svg +1 -0
- package/assets/library/catalog/visual-theme-golden-eye.svg +1 -0
- package/assets/library/catalog/visual-theme-hand-drawn.svg +1 -0
- package/assets/library/catalog/visual-theme-industrial.svg +1 -0
- package/assets/library/catalog/visual-theme-layered-paper.svg +1 -0
- package/assets/library/catalog/visual-theme-material.svg +1 -0
- package/assets/library/catalog/visual-theme-maximalism.svg +1 -0
- package/assets/library/catalog/visual-theme-midnight-emerald.svg +1 -0
- package/assets/library/catalog/visual-theme-minimal-modern.svg +1 -0
- package/assets/library/catalog/visual-theme-misty-green.svg +1 -0
- package/assets/library/catalog/visual-theme-misty-rose.svg +1 -0
- package/assets/library/catalog/visual-theme-natural-terrain.svg +1 -0
- package/assets/library/catalog/visual-theme-neo-brutalism.svg +1 -0
- package/assets/library/catalog/visual-theme-newsprint.svg +1 -0
- package/assets/library/catalog/visual-theme-olive-terracotta.svg +1 -0
- package/assets/library/catalog/visual-theme-paper-journal.svg +1 -0
- package/assets/library/catalog/visual-theme-pastel-matrix.svg +1 -0
- package/assets/library/catalog/visual-theme-pixel-dashboard.svg +1 -0
- package/assets/library/catalog/visual-theme-premium-business.svg +1 -0
- package/assets/library/catalog/visual-theme-redline-brief.svg +1 -0
- package/assets/library/catalog/visual-theme-sage.svg +1 -0
- package/assets/library/catalog/visual-theme-soft-porcelain.svg +1 -0
- package/assets/library/catalog/visual-theme-swiss-grid.svg +1 -0
- package/assets/library/catalog/visual-theme-tdesign-enterprise.svg +1 -0
- package/assets/library/catalog/visual-theme-terminal-green.svg +1 -0
- package/assets/library/catalog/visual-theme-warm-sand.svg +1 -0
- package/dist/lib/agent.schema.d.ts +514 -32
- package/dist/lib/analysis-scene-chart.d.ts +8 -0
- package/dist/lib/analysis-scene-chart.js +61 -0
- package/dist/lib/analysis-scene-tool.d.ts +87 -0
- package/dist/lib/analysis-scene-tool.js +33 -0
- package/dist/lib/analysis-scene-widget.d.ts +6 -0
- package/dist/lib/analysis-scene-widget.js +107 -0
- package/dist/lib/analysis-scene.schema.d.ts +66 -0
- package/dist/lib/analysis-scene.schema.js +20 -0
- package/dist/lib/archive.service.d.ts +35 -0
- package/dist/lib/artifact-type.provider.d.ts +1 -0
- package/dist/lib/artifact-type.provider.js +18 -0
- package/dist/lib/bundled-example-source.d.ts +11 -0
- package/dist/lib/bundled-example-source.js +60 -0
- package/dist/lib/certification.schema.d.ts +4 -0
- package/dist/lib/certification.schema.js +14 -0
- package/dist/lib/content-capability.js +1 -0
- package/dist/lib/content-type.d.ts +2 -0
- package/dist/lib/content-type.js +5 -0
- package/dist/lib/content.provider.js +5 -3
- package/dist/lib/dashboard-archive.d.ts +35 -0
- package/dist/lib/dashboard-artifact.d.ts +93 -0
- package/dist/lib/dashboard-artifact.js +24 -0
- package/dist/lib/dashboard-delivery.d.ts +11 -0
- package/dist/lib/dashboard-delivery.js +55 -0
- package/dist/lib/dashboard-discovery.schema.d.ts +446 -0
- package/dist/lib/dashboard-discovery.schema.js +35 -0
- package/dist/lib/dashboard-navigation.d.ts +22 -21
- package/dist/lib/dashboard-navigation.js +5 -4
- package/dist/lib/dashboard-queries.d.ts +2 -2
- package/dist/lib/dashboard-queries.js +2 -2
- package/dist/lib/dashboard-receipt.js +1 -1
- package/dist/lib/dashboard-view.schema.d.ts +964 -64
- package/dist/lib/dashboard.schema.d.ts +738 -23
- package/dist/lib/dashboard.schema.js +8 -2
- package/dist/lib/dashboard.service.d.ts +155 -2
- package/dist/lib/dashboard.service.js +38 -4
- package/dist/lib/dataset-artifact.provider.d.ts +13 -0
- package/dist/lib/dataset-artifact.provider.js +57 -0
- package/dist/lib/dataset.schema.d.ts +195 -0
- package/dist/lib/dataset.schema.js +23 -0
- package/dist/lib/dataset.service.d.ts +54 -0
- package/dist/lib/dataset.service.js +119 -0
- package/dist/lib/definition-tools.d.ts +14 -54
- package/dist/lib/definition-tools.js +29 -9
- package/dist/lib/document-package.d.ts +35 -0
- package/dist/lib/editing.d.ts +552 -2
- package/dist/lib/evidence/evidence-diff.d.ts +17 -0
- package/dist/lib/evidence/evidence-diff.js +30 -0
- package/dist/lib/evidence/evidence-transfers.d.ts +14 -0
- package/dist/lib/evidence/evidence-transfers.js +41 -0
- package/dist/lib/evidence/evidence-view.provider.d.ts +91 -0
- package/dist/lib/evidence/evidence-view.provider.js +92 -0
- package/dist/lib/evidence/evidence.entity.d.ts +14 -0
- package/dist/lib/evidence/evidence.entity.js +62 -0
- package/dist/lib/evidence/evidence.provider.d.ts +43 -0
- package/dist/lib/evidence/evidence.provider.js +91 -0
- package/dist/lib/evidence/evidence.service.d.ts +67 -0
- package/dist/lib/evidence/evidence.service.js +218 -0
- package/dist/lib/explore-catalog.d.ts +15 -0
- package/dist/lib/explore-catalog.js +51 -0
- package/dist/lib/explore-catalog.json +131 -0
- package/dist/lib/explore.schema.d.ts +69 -0
- package/dist/lib/explore.schema.js +9 -0
- package/dist/lib/group-sharing.d.ts +17 -0
- package/dist/lib/group-sharing.js +39 -0
- package/dist/lib/hotel-document.d.ts +3 -0
- package/dist/lib/hotel-document.js +26 -0
- package/dist/lib/hotel-template.d.ts +246 -0
- package/dist/lib/hotel-template.js +77 -0
- package/dist/lib/library/access.d.ts +9 -0
- package/dist/lib/library/access.js +14 -0
- package/dist/lib/library/actions.d.ts +7 -0
- package/dist/lib/library/actions.js +55 -0
- package/dist/lib/library/archive.d.ts +13 -0
- package/dist/lib/library/archive.js +123 -0
- package/dist/lib/library/asset-validation.d.ts +4 -0
- package/dist/lib/library/asset-validation.js +77 -0
- package/dist/lib/library/catalog-blueprints.json +3225 -0
- package/dist/lib/library/catalog.service.d.ts +2427 -0
- package/dist/lib/library/catalog.service.js +270 -0
- package/dist/lib/library/dataset-binding.service.d.ts +65 -0
- package/dist/lib/library/dataset-binding.service.js +152 -0
- package/dist/lib/library/directory-contract.d.ts +161 -0
- package/dist/lib/library/directory-contract.js +19 -0
- package/dist/lib/library/directory.service.d.ts +33 -0
- package/dist/lib/library/directory.service.js +69 -0
- package/dist/lib/library/entities.d.ts +80 -0
- package/dist/lib/library/entities.js +280 -0
- package/dist/lib/library/execution-contract.d.ts +200 -0
- package/dist/lib/library/execution-contract.js +19 -0
- package/dist/lib/library/execution-resolution.d.ts +2490 -0
- package/dist/lib/library/execution-resolution.js +101 -0
- package/dist/lib/library/file-artifact.provider.d.ts +7 -0
- package/dist/lib/library/file-artifact.provider.js +35 -0
- package/dist/lib/library/files.service.d.ts +20 -0
- package/dist/lib/library/files.service.js +112 -0
- package/dist/lib/library/origin.schema.d.ts +171 -0
- package/dist/lib/library/origin.schema.js +14 -0
- package/dist/lib/library/resource-contract.d.ts +2779 -0
- package/dist/lib/library/resource-contract.js +167 -0
- package/dist/lib/library/resource-json.d.ts +11 -0
- package/dist/lib/library/resource-json.js +53 -0
- package/dist/lib/library/task-preparation.service.d.ts +14 -0
- package/dist/lib/library/task-preparation.service.js +85 -0
- package/dist/lib/library/template-compiler.d.ts +19 -0
- package/dist/lib/library/template-compiler.js +73 -0
- package/dist/lib/library/template-execution.service.d.ts +79 -0
- package/dist/lib/library/template-execution.service.js +135 -0
- package/dist/lib/library/transfers.service.d.ts +94 -0
- package/dist/lib/library/transfers.service.js +193 -0
- package/dist/lib/library/zip-container.d.ts +10 -0
- package/dist/lib/library/zip-container.js +79 -0
- package/dist/lib/library-view.provider.d.ts +88 -0
- package/dist/lib/library-view.provider.js +164 -0
- package/dist/lib/library.schema.d.ts +347 -0
- package/dist/lib/library.schema.js +41 -0
- package/dist/lib/middleware.d.ts +8 -2
- package/dist/lib/middleware.js +119 -11
- package/dist/lib/monitor.js +2 -2
- package/dist/lib/plugin.js +21 -1
- package/dist/lib/presentation.provider.d.ts +35 -0
- package/dist/lib/presentation.provider.js +4 -15
- package/dist/lib/projects.schema.d.ts +4 -4
- package/dist/lib/query-session.d.ts +1 -1
- package/dist/lib/query-session.js +13 -8
- package/dist/lib/remote-entry.d.ts +1 -1
- package/dist/lib/remote-entry.js +2 -2
- package/dist/lib/resource.schema.d.ts +1067 -0
- package/dist/lib/resource.schema.js +76 -0
- package/dist/lib/runtime-context.d.ts +2 -0
- package/dist/lib/runtime-context.js +22 -0
- package/dist/lib/sharing.service.d.ts +12 -0
- package/dist/lib/sharing.service.js +4 -0
- package/dist/lib/source-executions.d.ts +69 -51
- package/dist/lib/source-executions.js +2 -1
- package/dist/lib/template.schema.d.ts +36 -0
- package/dist/lib/template.schema.js +17 -0
- package/dist/lib/template.service.d.ts +21 -0
- package/dist/lib/template.service.js +56 -0
- package/dist/lib/templates.js +5 -5
- package/dist/lib/view.provider.d.ts +129 -4
- package/dist/lib/view.provider.js +61 -35
- package/dist/remote/app.css +1 -1
- package/dist/remote/app.js +54 -53
- package/dist/remote/build-manifest.json +238 -46
- package/dist/sandbox-actions/action.json +1 -1
- package/dist/sandbox-actions/bundle/host.js +2 -2
- package/docs/content-packages.mdx +43 -0
- package/docs/dashboard-starter.mdx +22 -0
- package/docs/data-view.mdx +30 -0
- package/docs/dataset-generation.mdx +32 -0
- package/docs/dataset-storage.mdx +29 -0
- package/docs/docs.json +15 -0
- package/docs/editing.mdx +6 -0
- package/docs/html-mode.md +1 -1
- package/docs/index.mdx +8 -0
- package/docs/inline-analysis.mdx +62 -0
- package/docs/library-browser-verification.mdx +46 -0
- package/docs/library-detail-ui.mdx +21 -0
- package/docs/library-directory-ui.mdx +24 -0
- package/docs/library-execution.mdx +49 -0
- package/docs/library-import-ui.mdx +20 -0
- package/docs/library-storage.mdx +63 -0
- package/docs/proposals/resource-sharing-decoupling.mdx +83 -0
- package/docs/standard-theme.mdx +28 -0
- package/docs/template-agent-handoff.mdx +37 -0
- package/docs/verification.mdx +4 -0
- package/package.json +9 -5
- package/skills/live-dashboard/SKILL.md +41 -1
- package/skills/live-dashboard/examples/README.md +2 -2
- package/skills/live-dashboard/examples/production-quality/README.md +2 -2
- package/skills/live-dashboard/examples/regional-sales/README.md +3 -3
- package/skills/live-dashboard/examples/regional-sales/query.json +49 -1
- package/skills/live-dashboard/examples/sales-overview/README.md +2 -2
- package/skills/live-dashboard/references/attribution-analysis.md +8 -0
- package/skills/live-dashboard/references/pareto-analysis.md +8 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type RuntimeCapabilityRegistry } from '@xpert-ai/plugin-sdk';
|
|
2
|
+
import type { XpertResolvedViewHostContext } from '@xpert-ai/contracts';
|
|
3
|
+
import { AnalysisEvidenceService } from './evidence.service';
|
|
4
|
+
export declare class AnalysisEvidenceTransfers {
|
|
5
|
+
private readonly evidence;
|
|
6
|
+
private readonly runtime;
|
|
7
|
+
constructor(evidence: AnalysisEvidenceService, runtime: RuntimeCapabilityRegistry);
|
|
8
|
+
convert(context: XpertResolvedViewHostContext, input: {
|
|
9
|
+
id: string;
|
|
10
|
+
requestId: string;
|
|
11
|
+
title: string;
|
|
12
|
+
target: 'document' | 'presentation' | 'motion';
|
|
13
|
+
}): Promise<import("@xpert-ai/contracts").ContentCatalogItem>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.AnalysisEvidenceTransfers = void 0;
|
|
16
|
+
const common_1 = require("@nestjs/common");
|
|
17
|
+
const plugin_sdk_1 = require("@xpert-ai/plugin-sdk");
|
|
18
|
+
const evidence_service_1 = require("./evidence.service");
|
|
19
|
+
const dashboard_service_1 = require("../dashboard.service");
|
|
20
|
+
let AnalysisEvidenceTransfers = class AnalysisEvidenceTransfers {
|
|
21
|
+
constructor(evidence, runtime) {
|
|
22
|
+
this.evidence = evidence;
|
|
23
|
+
this.runtime = runtime;
|
|
24
|
+
}
|
|
25
|
+
async convert(context, input) {
|
|
26
|
+
const snapshot = await this.evidence.read(context, input.id);
|
|
27
|
+
const scope = { actor: { tenantId: context.tenantId, organizationId: context.organizationId, userId: context.userId }, projectId: (0, dashboard_service_1.projectId)(context) };
|
|
28
|
+
const catalog = this.runtime.require(plugin_sdk_1.ContentResourcesRuntimeCapability).catalog;
|
|
29
|
+
const source = await catalog.register({ ...scope, source: { providerKey: evidence_service_1.EVIDENCE_PROVIDER, resourceId: snapshot.id } });
|
|
30
|
+
const target = input.target !== 'motion' ? { providerKey: 'office.documents', implementationKey: input.target === 'presentation' ? 'office-presentation' : 'office-document' }
|
|
31
|
+
: { providerKey: 'motion.evidence-video', implementationKey: 'motion-evidence-video' };
|
|
32
|
+
return catalog.create({ ...scope, ...target, requestId: input.requestId, title: input.title,
|
|
33
|
+
transferFrom: { contentId: source.contentId, expectedRevision: snapshot.sha256 } });
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
exports.AnalysisEvidenceTransfers = AnalysisEvidenceTransfers;
|
|
37
|
+
exports.AnalysisEvidenceTransfers = AnalysisEvidenceTransfers = __decorate([
|
|
38
|
+
(0, common_1.Injectable)(),
|
|
39
|
+
__param(1, (0, common_1.Inject)(plugin_sdk_1.XPERT_RUNTIME_CAPABILITIES_TOKEN)),
|
|
40
|
+
__metadata("design:paramtypes", [evidence_service_1.AnalysisEvidenceService, Object])
|
|
41
|
+
], AnalysisEvidenceTransfers);
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { AnalysisEvidenceTransfers } from './evidence-transfers';
|
|
2
|
+
import { z } from 'zod/v3';
|
|
3
|
+
import { type IXpertViewExtensionProvider } from '@xpert-ai/plugin-sdk';
|
|
4
|
+
import type { ResourceContentEditorRegistration, XpertExtensionViewManifest, XpertResolvedViewHostContext, XpertViewActionRequest, XpertViewQuery } from '@xpert-ai/contracts';
|
|
5
|
+
import { AnalysisEvidenceService } from './evidence.service';
|
|
6
|
+
export declare const EVIDENCE_EDITOR = "live-dashboard.evidence-editor";
|
|
7
|
+
export declare const evidenceModel: {
|
|
8
|
+
typeId: string;
|
|
9
|
+
modelId: string;
|
|
10
|
+
schemaVersion: string;
|
|
11
|
+
editProtocol: {
|
|
12
|
+
id: string;
|
|
13
|
+
version: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export declare const evidenceConvertSchema: z.ZodObject<{
|
|
17
|
+
id: z.ZodString;
|
|
18
|
+
} & {
|
|
19
|
+
requestId: z.ZodString;
|
|
20
|
+
title: z.ZodString;
|
|
21
|
+
target: z.ZodEnum<["document", "presentation", "motion"]>;
|
|
22
|
+
}, "strict", z.ZodTypeAny, {
|
|
23
|
+
title: string;
|
|
24
|
+
id: string;
|
|
25
|
+
requestId: string;
|
|
26
|
+
target: "presentation" | "document" | "motion";
|
|
27
|
+
}, {
|
|
28
|
+
title: string;
|
|
29
|
+
id: string;
|
|
30
|
+
requestId: string;
|
|
31
|
+
target: "presentation" | "document" | "motion";
|
|
32
|
+
}>;
|
|
33
|
+
export declare class AnalysisEvidenceEditor {
|
|
34
|
+
readonly descriptor: ResourceContentEditorRegistration;
|
|
35
|
+
}
|
|
36
|
+
export declare class AnalysisEvidenceView implements IXpertViewExtensionProvider {
|
|
37
|
+
private readonly evidence;
|
|
38
|
+
private readonly transfers;
|
|
39
|
+
constructor(evidence: AnalysisEvidenceService, transfers: AnalysisEvidenceTransfers);
|
|
40
|
+
supports(context: XpertResolvedViewHostContext): boolean;
|
|
41
|
+
getViewManifests(context: XpertResolvedViewHostContext, slot: string): XpertExtensionViewManifest[];
|
|
42
|
+
getRemoteComponentEntry(_context: XpertResolvedViewHostContext, entry: string): Promise<{
|
|
43
|
+
html: string;
|
|
44
|
+
contentType: "text/html; charset=utf-8";
|
|
45
|
+
}>;
|
|
46
|
+
private assertView;
|
|
47
|
+
getViewData(context: XpertResolvedViewHostContext, key: string, query: XpertViewQuery): Promise<{
|
|
48
|
+
meta: {
|
|
49
|
+
canCapture: boolean;
|
|
50
|
+
snapshot: import("@xpert-ai/contracts").AnalysisEvidenceSnapshot;
|
|
51
|
+
refreshId?: undefined;
|
|
52
|
+
sourceChanged?: undefined;
|
|
53
|
+
};
|
|
54
|
+
} | {
|
|
55
|
+
meta: {
|
|
56
|
+
canCapture: boolean;
|
|
57
|
+
refreshId: string;
|
|
58
|
+
sourceChanged: boolean;
|
|
59
|
+
snapshot?: undefined;
|
|
60
|
+
};
|
|
61
|
+
} | {
|
|
62
|
+
meta: {
|
|
63
|
+
nextCursor?: number | undefined;
|
|
64
|
+
items: {
|
|
65
|
+
id: string;
|
|
66
|
+
title: string;
|
|
67
|
+
sha256: string;
|
|
68
|
+
capturedAt: string;
|
|
69
|
+
artifactId: string | null;
|
|
70
|
+
}[];
|
|
71
|
+
canCapture: boolean;
|
|
72
|
+
snapshot?: undefined;
|
|
73
|
+
refreshId?: undefined;
|
|
74
|
+
sourceChanged?: undefined;
|
|
75
|
+
};
|
|
76
|
+
}>;
|
|
77
|
+
executeViewAction(context: XpertResolvedViewHostContext, key: string, action: string, request: XpertViewActionRequest): Promise<{
|
|
78
|
+
success: boolean;
|
|
79
|
+
data: {
|
|
80
|
+
id: string;
|
|
81
|
+
artifactId: string;
|
|
82
|
+
sha256: string;
|
|
83
|
+
capturedAt: string;
|
|
84
|
+
};
|
|
85
|
+
refresh: boolean;
|
|
86
|
+
} | {
|
|
87
|
+
success: boolean;
|
|
88
|
+
data: import("@xpert-ai/contracts").ContentCatalogItem;
|
|
89
|
+
refresh: boolean;
|
|
90
|
+
}>;
|
|
91
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AnalysisEvidenceView = exports.AnalysisEvidenceEditor = exports.evidenceConvertSchema = exports.evidenceModel = exports.EVIDENCE_EDITOR = void 0;
|
|
13
|
+
const evidence_transfers_1 = require("./evidence-transfers");
|
|
14
|
+
const common_1 = require("@nestjs/common");
|
|
15
|
+
const v3_1 = require("zod/v3");
|
|
16
|
+
const plugin_sdk_1 = require("@xpert-ai/plugin-sdk");
|
|
17
|
+
const evidence_service_1 = require("./evidence.service");
|
|
18
|
+
const dashboard_service_1 = require("../dashboard.service");
|
|
19
|
+
const remote_entry_1 = require("../remote-entry");
|
|
20
|
+
const dashboard_icon_1 = require("../dashboard-icon");
|
|
21
|
+
const view_provider_1 = require("../view.provider");
|
|
22
|
+
exports.EVIDENCE_EDITOR = 'live-dashboard.evidence-editor';
|
|
23
|
+
exports.evidenceModel = { typeId: 'analysis-evidence', modelId: 'xpert.analysis-evidence', schemaVersion: '1', editProtocol: { id: 'immutable.snapshot', version: '1' } };
|
|
24
|
+
const provider = 'live-dashboard-evidence', view = 'analysis-evidence';
|
|
25
|
+
const idSchema = v3_1.z.object({ id: v3_1.z.string().uuid() }).strict();
|
|
26
|
+
const refreshSchema = idSchema.extend({ requestId: v3_1.z.string().uuid(), title: v3_1.z.string().min(1).max(200) });
|
|
27
|
+
exports.evidenceConvertSchema = idSchema.extend({ requestId: v3_1.z.string().uuid(), title: v3_1.z.string().min(1).max(200), target: v3_1.z.enum(['document', 'presentation', 'motion']) });
|
|
28
|
+
let AnalysisEvidenceEditor = class AnalysisEvidenceEditor {
|
|
29
|
+
constructor() {
|
|
30
|
+
this.descriptor = { kind: 'resource', key: exports.EVIDENCE_EDITOR, protocolVersion: 2,
|
|
31
|
+
title: 'Analysis evidence', view: { providerKey: provider, viewKey: view, entry: view }, supports: [{ ...exports.evidenceModel, access: ['view'] }] };
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
exports.AnalysisEvidenceEditor = AnalysisEvidenceEditor;
|
|
35
|
+
exports.AnalysisEvidenceEditor = AnalysisEvidenceEditor = __decorate([
|
|
36
|
+
(0, plugin_sdk_1.ContentEditorProvider)(exports.EVIDENCE_EDITOR)
|
|
37
|
+
], AnalysisEvidenceEditor);
|
|
38
|
+
let AnalysisEvidenceView = class AnalysisEvidenceView {
|
|
39
|
+
constructor(evidence, transfers) {
|
|
40
|
+
this.evidence = evidence;
|
|
41
|
+
this.transfers = transfers;
|
|
42
|
+
}
|
|
43
|
+
supports(context) { return context.hostType === 'agent'; }
|
|
44
|
+
getViewManifests(context, slot) {
|
|
45
|
+
if (!this.supports(context) || !['agent.workbench', 'agent.workbench.fixed', 'agent.workbench.main'].includes(slot))
|
|
46
|
+
return [];
|
|
47
|
+
return [{ key: view, title: { en_US: 'Analysis evidence', zh_Hans: '分析证据', zh_Hant: '分析證據' }, hostType: 'agent', slot,
|
|
48
|
+
icon: dashboard_icon_1.dashboardIcon, activation: { projectResource: true, requiredFeatures: [view_provider_1.FEATURE] }, source: { provider, plugin: dashboard_service_1.PLUGIN_NAME }, refreshable: true,
|
|
49
|
+
workbench: { fixed: true, openMode: 'on-demand', menu: { enabled: true, order: 39 } },
|
|
50
|
+
view: { type: 'remote_component', runtime: 'react', protocolVersion: 1, component: { isolation: 'iframe', entry: view }, dataSource: { mode: 'platform' } },
|
|
51
|
+
dataSource: { mode: 'platform', querySchema: { supportsSelection: true, supportsParameters: true }, cache: { enabled: false } },
|
|
52
|
+
clientCommands: [{ key: 'workbench.content.resolve' }, { key: 'workbench.navigation.open' }],
|
|
53
|
+
actions: ['capture', 'refresh', 'convert'].map(key => ({ key, label: { en_US: key, zh_Hans: key }, actionType: 'invoke' })) }];
|
|
54
|
+
}
|
|
55
|
+
getRemoteComponentEntry(_context, entry) { this.assertView(entry); return (0, remote_entry_1.dashboardRemoteEntry)(false, 'evidence'); }
|
|
56
|
+
assertView(key) { if (key !== view)
|
|
57
|
+
throw new common_1.BadRequestException('EVIDENCE_VIEW_UNSUPPORTED'); }
|
|
58
|
+
async getViewData(context, key, query) {
|
|
59
|
+
this.assertView(key);
|
|
60
|
+
const canCapture = await this.evidence.canCapture(context);
|
|
61
|
+
if (query.selectionId) {
|
|
62
|
+
const id = v3_1.z.string().uuid().parse(query.selectionId);
|
|
63
|
+
try {
|
|
64
|
+
return { meta: { canCapture, snapshot: await this.evidence.read(context, id) } };
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
if (!(error instanceof common_1.ConflictException) || error.message !== 'EVIDENCE_SOURCE_CHANGED_CAPTURE_NEW_SNAPSHOT')
|
|
68
|
+
throw error;
|
|
69
|
+
return { meta: { canCapture, refreshId: id, sourceChanged: true } };
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return { meta: { canCapture, ...await this.evidence.list(context, Math.max(0, (query.page ?? 1) - 1) * 50) } };
|
|
73
|
+
}
|
|
74
|
+
async executeViewAction(context, key, action, request) {
|
|
75
|
+
this.assertView(key);
|
|
76
|
+
if (action === 'capture')
|
|
77
|
+
return { success: true, data: await this.evidence.capture(context, evidence_service_1.captureEvidenceSchema.parse(request.input)), refresh: true };
|
|
78
|
+
if (action === 'refresh') {
|
|
79
|
+
const input = refreshSchema.parse(request.input);
|
|
80
|
+
return { success: true, data: await this.evidence.refresh(context, input.id, input.requestId, input.title), refresh: false };
|
|
81
|
+
}
|
|
82
|
+
if (action === 'convert')
|
|
83
|
+
return { success: true, data: await this.transfers.convert(context, exports.evidenceConvertSchema.parse(request.input)), refresh: false };
|
|
84
|
+
throw new common_1.BadRequestException('EVIDENCE_ACTION_UNSUPPORTED');
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
exports.AnalysisEvidenceView = AnalysisEvidenceView;
|
|
88
|
+
exports.AnalysisEvidenceView = AnalysisEvidenceView = __decorate([
|
|
89
|
+
(0, plugin_sdk_1.ViewExtensionProvider)(provider),
|
|
90
|
+
__metadata("design:paramtypes", [evidence_service_1.AnalysisEvidenceService,
|
|
91
|
+
evidence_transfers_1.AnalysisEvidenceTransfers])
|
|
92
|
+
], AnalysisEvidenceView);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { AnalysisEvidenceSnapshot } from '@xpert-ai/contracts';
|
|
2
|
+
/** Immutable snapshot; only the derived Artifact pointer may be completed after a retry. */
|
|
3
|
+
export declare class AnalysisEvidenceRecord {
|
|
4
|
+
id: string;
|
|
5
|
+
tenantId: string;
|
|
6
|
+
organizationId: string;
|
|
7
|
+
projectId: string;
|
|
8
|
+
createdById: string;
|
|
9
|
+
requestId: string;
|
|
10
|
+
requestHash: string;
|
|
11
|
+
snapshot: AnalysisEvidenceSnapshot;
|
|
12
|
+
artifactId: string | null;
|
|
13
|
+
createdAt: Date;
|
|
14
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AnalysisEvidenceRecord = void 0;
|
|
13
|
+
const typeorm_1 = require("typeorm");
|
|
14
|
+
const resource_contract_1 = require("../library/resource-contract");
|
|
15
|
+
/** Immutable snapshot; only the derived Artifact pointer may be completed after a retry. */
|
|
16
|
+
let AnalysisEvidenceRecord = class AnalysisEvidenceRecord {
|
|
17
|
+
};
|
|
18
|
+
exports.AnalysisEvidenceRecord = AnalysisEvidenceRecord;
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
21
|
+
__metadata("design:type", String)
|
|
22
|
+
], AnalysisEvidenceRecord.prototype, "id", void 0);
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, typeorm_1.Column)({ type: 'varchar' }),
|
|
25
|
+
__metadata("design:type", String)
|
|
26
|
+
], AnalysisEvidenceRecord.prototype, "tenantId", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, typeorm_1.Column)({ type: 'varchar' }),
|
|
29
|
+
__metadata("design:type", String)
|
|
30
|
+
], AnalysisEvidenceRecord.prototype, "organizationId", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, typeorm_1.Column)({ type: 'uuid' }),
|
|
33
|
+
__metadata("design:type", String)
|
|
34
|
+
], AnalysisEvidenceRecord.prototype, "projectId", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, typeorm_1.Column)({ type: 'uuid' }),
|
|
37
|
+
__metadata("design:type", String)
|
|
38
|
+
], AnalysisEvidenceRecord.prototype, "createdById", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, typeorm_1.Column)({ type: 'uuid' }),
|
|
41
|
+
__metadata("design:type", String)
|
|
42
|
+
], AnalysisEvidenceRecord.prototype, "requestId", void 0);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, typeorm_1.Column)({ type: 'varchar', length: 64 }),
|
|
45
|
+
__metadata("design:type", String)
|
|
46
|
+
], AnalysisEvidenceRecord.prototype, "requestHash", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, typeorm_1.Column)({ type: 'jsonb' }),
|
|
49
|
+
__metadata("design:type", Object)
|
|
50
|
+
], AnalysisEvidenceRecord.prototype, "snapshot", void 0);
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, typeorm_1.Column)({ type: 'uuid', nullable: true }),
|
|
53
|
+
__metadata("design:type", Object)
|
|
54
|
+
], AnalysisEvidenceRecord.prototype, "artifactId", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, typeorm_1.CreateDateColumn)({ type: 'timestamptz' }),
|
|
57
|
+
__metadata("design:type", Date)
|
|
58
|
+
], AnalysisEvidenceRecord.prototype, "createdAt", void 0);
|
|
59
|
+
exports.AnalysisEvidenceRecord = AnalysisEvidenceRecord = __decorate([
|
|
60
|
+
(0, typeorm_1.Entity)((0, resource_contract_1.libraryTable)('analysis_evidence_v1')),
|
|
61
|
+
(0, typeorm_1.Index)(['tenantId', 'organizationId', 'projectId', 'requestId'], { unique: true })
|
|
62
|
+
], AnalysisEvidenceRecord);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type ArtifactTypeSource, type ArtifactTypeActor, type ContentOperation, type IArtifactTypeProvider, type ContentCatalogProvider, type IContentResourceProvider, type ContentResourceRequest } from '@xpert-ai/plugin-sdk';
|
|
2
|
+
import { AnalysisEvidenceService } from './evidence.service';
|
|
3
|
+
export declare class AnalysisEvidenceArtifactType implements IArtifactTypeProvider {
|
|
4
|
+
private readonly evidence;
|
|
5
|
+
constructor(evidence: AnalysisEvidenceService);
|
|
6
|
+
readonly definition: {
|
|
7
|
+
versioning: {
|
|
8
|
+
mode: "draft-only";
|
|
9
|
+
};
|
|
10
|
+
title: {
|
|
11
|
+
en_US: string;
|
|
12
|
+
zh_Hans: string;
|
|
13
|
+
};
|
|
14
|
+
kinds: "file"[];
|
|
15
|
+
content: {
|
|
16
|
+
mimeTypes: string[];
|
|
17
|
+
maxBytes: number;
|
|
18
|
+
};
|
|
19
|
+
collection: {
|
|
20
|
+
allowCopy: boolean;
|
|
21
|
+
};
|
|
22
|
+
presentation: {
|
|
23
|
+
mode: "file";
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
authorize(source: ArtifactTypeSource, actor: ArtifactTypeActor, operation: ContentOperation): Promise<void>;
|
|
27
|
+
authorizeDraft(source: ArtifactTypeSource, actor: ArtifactTypeActor, operation: ContentOperation): Promise<void>;
|
|
28
|
+
validateContent(buffer: Buffer, mimeType: string): Promise<void>;
|
|
29
|
+
}
|
|
30
|
+
export declare class AnalysisEvidenceContent implements IContentResourceProvider {
|
|
31
|
+
private readonly evidence;
|
|
32
|
+
readonly title = "Immutable analysis evidence";
|
|
33
|
+
constructor(evidence: AnalysisEvidenceService);
|
|
34
|
+
readonly catalog: ContentCatalogProvider;
|
|
35
|
+
authorize(input: ContentResourceRequest): Promise<{
|
|
36
|
+
providerKey: string;
|
|
37
|
+
resourceId: string;
|
|
38
|
+
title: string;
|
|
39
|
+
role: "editor" | "viewer";
|
|
40
|
+
canWrite: boolean;
|
|
41
|
+
canManage: boolean;
|
|
42
|
+
}>;
|
|
43
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AnalysisEvidenceContent = exports.AnalysisEvidenceArtifactType = void 0;
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const plugin_sdk_1 = require("@xpert-ai/plugin-sdk");
|
|
15
|
+
const evidence_service_1 = require("./evidence.service");
|
|
16
|
+
const evidence_view_provider_1 = require("./evidence-view.provider");
|
|
17
|
+
const dashboard_service_1 = require("../dashboard.service");
|
|
18
|
+
const model = { typeId: 'analysis-evidence', modelId: 'xpert.analysis-evidence', schemaVersion: '1', editProtocol: { id: 'immutable.snapshot', version: '1' } };
|
|
19
|
+
let AnalysisEvidenceArtifactType = class AnalysisEvidenceArtifactType {
|
|
20
|
+
constructor(evidence) {
|
|
21
|
+
this.evidence = evidence;
|
|
22
|
+
this.definition = { versioning: { mode: 'draft-only' }, title: { en_US: 'Analysis evidence', zh_Hans: '分析证据快照' },
|
|
23
|
+
kinds: ['file'], content: { mimeTypes: ['application/json'], maxBytes: 2_000_000 }, collection: { allowCopy: false }, presentation: { mode: 'file' } };
|
|
24
|
+
}
|
|
25
|
+
async authorize(source, actor, operation) {
|
|
26
|
+
if (!actor.tenantId || !actor.userId || actor.tenantId !== source.tenantId || !source.organizationId || !source.projectId ||
|
|
27
|
+
source.pluginName !== dashboard_service_1.PLUGIN_NAME || source.resourceType !== evidence_service_1.EVIDENCE_TYPE)
|
|
28
|
+
throw new common_1.ForbiddenException('EVIDENCE_SCOPE_DENIED');
|
|
29
|
+
await this.evidence.authorize((0, evidence_service_1.evidenceContext)({ actor: { tenantId: actor.tenantId, userId: actor.userId, organizationId: source.organizationId }, projectId: source.projectId }), source.resourceId, operation !== 'read');
|
|
30
|
+
}
|
|
31
|
+
authorizeDraft(source, actor, operation) { return this.authorize(source, actor, operation); }
|
|
32
|
+
async validateContent(buffer, mimeType) {
|
|
33
|
+
if (mimeType !== 'application/json')
|
|
34
|
+
throw new common_1.BadRequestException('EVIDENCE_FORMAT_INVALID');
|
|
35
|
+
await this.evidence.validateBytes(buffer);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
exports.AnalysisEvidenceArtifactType = AnalysisEvidenceArtifactType;
|
|
39
|
+
exports.AnalysisEvidenceArtifactType = AnalysisEvidenceArtifactType = __decorate([
|
|
40
|
+
(0, common_1.Injectable)(),
|
|
41
|
+
(0, plugin_sdk_1.ArtifactTypeProvider)(evidence_service_1.EVIDENCE_TYPE),
|
|
42
|
+
__metadata("design:paramtypes", [evidence_service_1.AnalysisEvidenceService])
|
|
43
|
+
], AnalysisEvidenceArtifactType);
|
|
44
|
+
let AnalysisEvidenceContent = class AnalysisEvidenceContent {
|
|
45
|
+
constructor(evidence) {
|
|
46
|
+
this.evidence = evidence;
|
|
47
|
+
this.title = 'Immutable analysis evidence';
|
|
48
|
+
this.catalog = {
|
|
49
|
+
types: [{ ...model, title: { en_US: 'Analysis evidence', zh_Hans: '分析证据快照' }, implementationKey: evidence_service_1.EVIDENCE_TYPE,
|
|
50
|
+
defaultEditorKey: evidence_view_provider_1.EVIDENCE_EDITOR, implementationTitle: { en_US: 'Captured query results', zh_Hans: '已保存查询结果' }, creatable: false }],
|
|
51
|
+
discover: async (scope) => {
|
|
52
|
+
const page = await this.evidence.list((0, evidence_service_1.evidenceContext)(scope), Number(scope.cursor ?? 0));
|
|
53
|
+
return { resourceIds: page.items.map(item => item.id), ...(page.nextCursor === undefined ? {} : { nextCursor: String(page.nextCursor) }) };
|
|
54
|
+
},
|
|
55
|
+
describe: async (scope) => {
|
|
56
|
+
const record = await this.evidence.authorize((0, evidence_service_1.evidenceContext)(scope), scope.sourceResourceId);
|
|
57
|
+
const snapshot = record.snapshot;
|
|
58
|
+
return { ...model, projectId: scope.projectId, title: snapshot.title, revision: snapshot.sha256, updatedAt: snapshot.capturedAt,
|
|
59
|
+
deleted: false, defaultEditorKey: evidence_view_provider_1.EVIDENCE_EDITOR, source: { kind: 'managed' }, allowedActions: [],
|
|
60
|
+
preview: { kind: 'outline', revision: snapshot.sha256, lines: [snapshot.title, snapshot.capturedAt, ...snapshot.statements.slice(0, 3).map(item => item.text.slice(0, 160))] } };
|
|
61
|
+
},
|
|
62
|
+
extract: async (scope) => {
|
|
63
|
+
const snapshot = await this.evidence.read((0, evidence_service_1.evidenceContext)(scope), scope.sourceResourceId);
|
|
64
|
+
if (snapshot.sha256 !== scope.expectedRevision)
|
|
65
|
+
throw new common_1.BadRequestException('EVIDENCE_REVISION_CONFLICT');
|
|
66
|
+
return { revision: snapshot.sha256, sections: snapshot.statements.map((statement, index) => ({ anchor: { kind: statement.kind, id: String(index) }, text: statement.text })) };
|
|
67
|
+
},
|
|
68
|
+
transfer: async (scope) => {
|
|
69
|
+
if (!scope.acceptedSchemas.includes('xpert.content-analysis-transfer@1'))
|
|
70
|
+
throw new common_1.BadRequestException('EVIDENCE_TARGET_UNSUPPORTED');
|
|
71
|
+
const snapshot = await this.evidence.read((0, evidence_service_1.evidenceContext)(scope), scope.sourceResourceId);
|
|
72
|
+
if (snapshot.sha256 !== scope.expectedRevision)
|
|
73
|
+
throw new common_1.BadRequestException('EVIDENCE_REVISION_CONFLICT');
|
|
74
|
+
return { schema: 'xpert.content-analysis-transfer@1', source: { providerKey: evidence_service_1.EVIDENCE_PROVIDER, resourceId: snapshot.id, revision: snapshot.sha256, title: snapshot.title }, evidence: snapshot };
|
|
75
|
+
},
|
|
76
|
+
create: async () => { throw new common_1.BadRequestException('EVIDENCE_CAPTURE_REQUIRED'); }
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
async authorize(input) {
|
|
80
|
+
const context = await this.evidence.contextFor(input.actor, input.resourceId);
|
|
81
|
+
const record = await this.evidence.authorize(context, input.resourceId, input.operation !== 'read');
|
|
82
|
+
return { providerKey: evidence_service_1.EVIDENCE_PROVIDER, resourceId: input.resourceId, title: record.snapshot.title, role: input.operation === 'read' ? 'viewer' : 'editor',
|
|
83
|
+
canWrite: input.operation !== 'read', canManage: false };
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
exports.AnalysisEvidenceContent = AnalysisEvidenceContent;
|
|
87
|
+
exports.AnalysisEvidenceContent = AnalysisEvidenceContent = __decorate([
|
|
88
|
+
(0, common_1.Injectable)(),
|
|
89
|
+
(0, plugin_sdk_1.ContentResourceProvider)(evidence_service_1.EVIDENCE_PROVIDER),
|
|
90
|
+
__metadata("design:paramtypes", [evidence_service_1.AnalysisEvidenceService])
|
|
91
|
+
], AnalysisEvidenceContent);
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Repository } from 'typeorm';
|
|
2
|
+
import type { AnalysisEvidenceSnapshot, AnalyticalDataset, XpertResolvedViewHostContext } from '@xpert-ai/contracts';
|
|
3
|
+
import { type ContentActor, type ContentDocumentScope, type RuntimeCapabilityRegistry } from '@xpert-ai/plugin-sdk';
|
|
4
|
+
import { z } from 'zod/v3';
|
|
5
|
+
import { DashboardService } from '../dashboard.service';
|
|
6
|
+
import { AnalysisEvidenceRecord } from './evidence.entity';
|
|
7
|
+
export declare const EVIDENCE_TYPE = "analysis-evidence";
|
|
8
|
+
export declare const EVIDENCE_PROVIDER = "live-dashboard.analysis-evidence";
|
|
9
|
+
export declare const captureEvidenceSchema: z.ZodObject<{
|
|
10
|
+
requestId: z.ZodString;
|
|
11
|
+
artifactId: z.ZodString;
|
|
12
|
+
versionId: z.ZodString;
|
|
13
|
+
title: z.ZodString;
|
|
14
|
+
controls: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>>, Record<string, string | number | boolean | null>, Record<string, string | number | boolean | null>>;
|
|
15
|
+
}, "strict", z.ZodTypeAny, {
|
|
16
|
+
title: string;
|
|
17
|
+
artifactId: string;
|
|
18
|
+
controls: Record<string, string | number | boolean | null>;
|
|
19
|
+
versionId: string;
|
|
20
|
+
requestId: string;
|
|
21
|
+
}, {
|
|
22
|
+
title: string;
|
|
23
|
+
artifactId: string;
|
|
24
|
+
controls: Record<string, string | number | boolean | null>;
|
|
25
|
+
versionId: string;
|
|
26
|
+
requestId: string;
|
|
27
|
+
}>;
|
|
28
|
+
export declare const evidenceContext: (scope: ContentDocumentScope) => XpertResolvedViewHostContext;
|
|
29
|
+
/** Exclude execution clocks while retaining source versions, certification and exact row scope.
|
|
30
|
+
* If current results differ, old cells cannot be newly disclosed under potentially changed row-level permissions. */
|
|
31
|
+
export declare function evidenceDataDigest(datasets: AnalyticalDataset[]): string;
|
|
32
|
+
export declare class AnalysisEvidenceService {
|
|
33
|
+
private readonly records;
|
|
34
|
+
private readonly dashboards;
|
|
35
|
+
private readonly runtime;
|
|
36
|
+
constructor(records: Repository<AnalysisEvidenceRecord>, dashboards: DashboardService, runtime: RuntimeCapabilityRegistry);
|
|
37
|
+
private scope;
|
|
38
|
+
private query;
|
|
39
|
+
authorize(context: XpertResolvedViewHostContext, id: string, write?: boolean): Promise<AnalysisEvidenceRecord>;
|
|
40
|
+
contextFor(actor: ContentActor, id: string): Promise<XpertResolvedViewHostContext>;
|
|
41
|
+
validateBytes(buffer: Buffer): Promise<void>;
|
|
42
|
+
canCapture(context: XpertResolvedViewHostContext): Promise<boolean>;
|
|
43
|
+
read(context: XpertResolvedViewHostContext, id: string): Promise<AnalysisEvidenceSnapshot>;
|
|
44
|
+
refresh(context: XpertResolvedViewHostContext, id: string, requestId: string, title: string): Promise<{
|
|
45
|
+
previousId: string;
|
|
46
|
+
id: string;
|
|
47
|
+
artifactId: string;
|
|
48
|
+
sha256: string;
|
|
49
|
+
capturedAt: string;
|
|
50
|
+
}>;
|
|
51
|
+
list(context: XpertResolvedViewHostContext, cursor?: number): Promise<{
|
|
52
|
+
nextCursor?: number | undefined;
|
|
53
|
+
items: {
|
|
54
|
+
id: string;
|
|
55
|
+
title: string;
|
|
56
|
+
sha256: string;
|
|
57
|
+
capturedAt: string;
|
|
58
|
+
artifactId: string | null;
|
|
59
|
+
}[];
|
|
60
|
+
}>;
|
|
61
|
+
capture(context: XpertResolvedViewHostContext, raw: z.infer<typeof captureEvidenceSchema>): Promise<{
|
|
62
|
+
id: string;
|
|
63
|
+
artifactId: string;
|
|
64
|
+
sha256: string;
|
|
65
|
+
capturedAt: string;
|
|
66
|
+
}>;
|
|
67
|
+
}
|