@chengxianglibra/dsh-data-analysis 0.1.1 → 0.2.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/README.md +139 -53
- package/cordis.patch.yml +1 -1
- package/lib/bin/environment.js +9 -7
- package/lib/bin/presentation-lint.js +21 -0
- package/lib/bridges.js +2 -2
- package/lib/client/credentials/changes.js +74 -0
- package/lib/client/credentials/create-datasource.js +171 -0
- package/lib/client/credentials/credential-draft.js +42 -0
- package/lib/client/credentials/defaults.js +11 -0
- package/lib/client/credentials/descriptions.js +46 -0
- package/lib/client/credentials/install.js +319 -0
- package/lib/client/credentials/model.js +766 -0
- package/lib/client/credentials/report-publishing.js +96 -0
- package/lib/client/credentials/styles.js +21 -0
- package/lib/client/i18n/context.js +22 -0
- package/lib/client/i18n/copy.js +57 -0
- package/lib/client/i18n/credentials.js +475 -0
- package/lib/client/i18n/host.js +27 -0
- package/lib/client/i18n/navigation.js +41 -0
- package/lib/client/i18n/presentation.js +577 -0
- package/lib/client/i18n/python.js +36 -0
- package/lib/client/i18n/semantic.js +441 -0
- package/lib/client/input-context.js +21 -0
- package/lib/client/python-tool/card.js +35 -0
- package/lib/client/python-tool/execution-error.js +35 -0
- package/lib/client/python-tool/install.js +9 -0
- package/lib/client/python-tool/model.js +101 -0
- package/lib/client/right-tabs/install.js +535 -0
- package/lib/client/right-tabs/live-delivery.js +58 -0
- package/lib/client/right-tabs/navigation.js +47 -0
- package/lib/client/right-tabs/page.js +178 -0
- package/lib/client/right-tabs/styles.js +11 -0
- package/lib/client/rpc.js +5 -0
- package/lib/client/semantic-reference.js +10 -0
- package/lib/client/workspace-header-action.js +24 -0
- package/lib/client/workspace-shortcuts.js +26 -0
- package/lib/client.js +1250 -730
- package/lib/compatibility.js +2 -2
- package/lib/datasource/authoring.js +109 -0
- package/lib/datasource/bridge-programs.js +42 -27
- package/lib/datasource/bridge.js +144 -9
- package/lib/datasource/changes-contract.js +41 -0
- package/lib/datasource/changes.js +49 -0
- package/lib/datasource/configure.js +39 -0
- package/lib/datasource/defaults.js +25 -0
- package/lib/datasource/index.js +4 -2
- package/lib/datasource/python-options.js +21 -0
- package/lib/datasource/python.js +206 -0
- package/lib/datasource/resolver-program.js +112 -0
- package/lib/datasource/rpc.js +150 -0
- package/lib/datasource/service.js +962 -0
- package/lib/datasource/shell-env.js +2 -333
- package/lib/datasource/test.js +25 -51
- package/lib/disclosure/activation.js +19 -7
- package/lib/disclosure/execution-guidance.js +52 -0
- package/lib/disclosure/help.js +4 -1
- package/lib/environment/binding.js +54 -9
- package/lib/environment/runtime.js +120 -108
- package/lib/environment/subprocess.js +6 -1
- package/lib/environment/summary.js +3 -3
- package/lib/environment/workspace.js +23 -1
- package/lib/index.js +1 -1
- package/lib/lifecycle.js +33 -0
- package/lib/plugin-agents.js +154 -0
- package/lib/plugin.js +172 -133
- package/lib/presentation/asset.js +34 -0
- package/lib/presentation/assets/portable.js +606 -0
- package/lib/presentation/assets/static.js +1216 -0
- package/lib/presentation/build/index.js +72 -0
- package/lib/presentation/commit.js +163 -0
- package/lib/presentation/contracts/asset-path.js +9 -0
- package/lib/presentation/contracts/catalog.js +62 -0
- package/lib/presentation/contracts/charts.js +453 -0
- package/lib/presentation/contracts/editing.js +58 -0
- package/lib/presentation/contracts/index.js +663 -0
- package/lib/presentation/contracts/interaction.js +62 -0
- package/lib/presentation/contracts/types.js +15 -0
- package/lib/presentation/contracts/values.js +28 -0
- package/lib/presentation/delivery.js +71 -0
- package/lib/presentation/export-html.js +214 -0
- package/lib/presentation/files.js +82 -0
- package/lib/presentation/index.js +6 -0
- package/lib/presentation/lint.js +46 -0
- package/lib/presentation/projection/files.js +85 -0
- package/lib/presentation/projection/index.js +196 -0
- package/lib/presentation/projection/program.js +137 -0
- package/lib/presentation/projection/sql-code.js +79 -0
- package/lib/presentation/receipt.js +34 -0
- package/lib/presentation/reports.js +219 -0
- package/lib/presentation/rpc.js +186 -0
- package/lib/presentation/tool.js +118 -0
- package/lib/python-execution-contracts.js +1 -0
- package/lib/python-execution.js +232 -0
- package/lib/report-publishing/adapters.js +111 -0
- package/lib/report-publishing/config.js +69 -0
- package/lib/report-publishing/service.js +180 -0
- package/lib/rpc.js +49 -0
- package/lib/semantic-browser/contracts.js +97 -0
- package/lib/semantic-browser/definition.js +64 -0
- package/lib/semantic-browser/program.js +129 -0
- package/lib/semantic-browser/service.js +106 -0
- package/lib/semantic-reference/bridge.js +127 -0
- package/lib/semantic-reference/contracts.js +127 -0
- package/lib/semantic-reference/environment.js +56 -0
- package/lib/semantic-reference/index.js +3 -0
- package/lib/semantic-reference/labels.js +16 -0
- package/lib/semantic-reference/rpc.js +143 -0
- package/lib/semantic-reference/search.js +95 -0
- package/lib/semantic-reference/usage.js +152 -0
- package/lib/tool-lifecycle.js +22 -0
- package/lib/types/bridges.d.ts +2 -2
- package/lib/types/client/credentials/changes.d.ts +9 -0
- package/lib/types/client/credentials/create-datasource.d.ts +7 -0
- package/lib/types/client/credentials/credential-draft.d.ts +14 -0
- package/lib/types/client/credentials/defaults.d.ts +2 -0
- package/lib/types/client/credentials/descriptions.d.ts +1 -0
- package/lib/types/client/credentials/install.d.ts +19 -0
- package/lib/types/client/credentials/model.d.ts +79 -0
- package/lib/types/client/credentials/report-publishing.d.ts +5 -0
- package/lib/types/client/credentials/styles.d.ts +1 -0
- package/lib/types/client/i18n/context.d.ts +17 -0
- package/lib/types/client/i18n/copy.d.ts +806 -0
- package/lib/types/client/i18n/credentials.d.ts +475 -0
- package/lib/types/client/i18n/host.d.ts +16 -0
- package/lib/types/client/i18n/navigation.d.ts +41 -0
- package/lib/types/client/i18n/presentation.d.ts +577 -0
- package/lib/types/client/i18n/python.d.ts +19 -0
- package/lib/types/client/i18n/semantic.d.ts +441 -0
- package/lib/types/client/input-context.d.ts +19 -0
- package/lib/types/client/presentation/ask-dsh.d.ts +5 -0
- package/lib/types/client/presentation/catalog-model.d.ts +24 -0
- package/lib/types/client/presentation/catalog.d.ts +20 -0
- package/lib/types/client/presentation/chart-explorer.d.ts +12 -0
- package/lib/types/client/presentation/chart-geometry.d.ts +30 -0
- package/lib/types/client/presentation/chart-renderer.d.ts +10 -0
- package/lib/types/client/presentation/chart-specials.d.ts +10 -0
- package/lib/types/client/presentation/chart-styles.d.ts +1 -0
- package/lib/types/client/presentation/chart-tooltip.d.ts +13 -0
- package/lib/types/client/presentation/chart-view.d.ts +23 -0
- package/lib/types/client/presentation/context-reference.d.ts +12 -0
- package/lib/types/client/presentation/copy-context.d.ts +5 -0
- package/lib/types/client/presentation/delivery-model.d.ts +75 -0
- package/lib/types/client/presentation/delivery.d.ts +78 -0
- package/lib/types/client/presentation/download.d.ts +2 -0
- package/lib/types/client/presentation/editor-controls.d.ts +12 -0
- package/lib/types/client/presentation/export-menu.d.ts +26 -0
- package/lib/types/client/presentation/export-view.d.ts +63 -0
- package/lib/types/client/presentation/global-filters.d.ts +6 -0
- package/lib/types/client/presentation/host-entry.d.ts +18 -0
- package/lib/types/client/presentation/icons.d.ts +4 -0
- package/lib/types/client/presentation/markdown.d.ts +5 -0
- package/lib/types/client/presentation/model.d.ts +61 -0
- package/lib/types/client/presentation/reader.d.ts +24 -0
- package/lib/types/client/presentation/reference-source.d.ts +9 -0
- package/lib/types/client/presentation/source-code-model.d.ts +17 -0
- package/lib/types/client/presentation/source-code.d.ts +6 -0
- package/lib/types/client/presentation/source-dialog.d.ts +12 -0
- package/lib/types/client/presentation/source-facts.d.ts +20 -0
- package/lib/types/client/presentation/source-format.d.ts +5 -0
- package/lib/types/client/presentation/source-highlight.d.ts +7 -0
- package/lib/types/client/presentation/sources.d.ts +13 -0
- package/lib/types/client/presentation/styles.d.ts +1 -0
- package/lib/types/client/presentation/table.d.ts +16 -0
- package/lib/types/client/presentation/use-element-width.d.ts +5 -0
- package/lib/types/client/python-tool/card.d.ts +2 -0
- package/lib/types/client/python-tool/execution-error.d.ts +3 -0
- package/lib/types/client/python-tool/install.d.ts +2 -0
- package/lib/types/client/python-tool/model.d.ts +20 -0
- package/lib/types/client/right-tabs/install.d.ts +18 -0
- package/lib/types/client/right-tabs/live-delivery.d.ts +8 -0
- package/lib/types/client/right-tabs/navigation.d.ts +17 -0
- package/lib/types/client/right-tabs/page.d.ts +36 -0
- package/lib/types/client/right-tabs/styles.d.ts +2 -0
- package/lib/types/client/rpc.d.ts +3 -0
- package/lib/types/client/semantic-reference.d.ts +4 -0
- package/lib/types/client/workspace-header-action.d.ts +7 -0
- package/lib/types/client/workspace-shortcuts.d.ts +15 -0
- package/lib/types/client.d.ts +9 -124
- package/lib/types/compatibility.d.ts +3 -3
- package/lib/types/datasource/authoring.d.ts +35 -0
- package/lib/types/datasource/bridge.d.ts +43 -4
- package/lib/types/datasource/changes-contract.d.ts +18 -0
- package/lib/types/datasource/changes.d.ts +15 -0
- package/lib/types/datasource/configure.d.ts +7 -0
- package/lib/types/datasource/defaults.d.ts +7 -0
- package/lib/types/datasource/index.d.ts +8 -5
- package/lib/types/datasource/python-options.d.ts +9 -0
- package/lib/types/datasource/python.d.ts +19 -0
- package/lib/types/datasource/resolver-program.d.ts +6 -0
- package/lib/types/datasource/rpc.d.ts +5 -0
- package/lib/types/datasource/service.d.ts +155 -0
- package/lib/types/datasource/shell-env.d.ts +0 -29
- package/lib/types/datasource/test.d.ts +6 -29
- package/lib/types/disclosure/activation.d.ts +2 -1
- package/lib/types/disclosure/execution-guidance.d.ts +6 -0
- package/lib/types/disclosure/help.d.ts +1 -1
- package/lib/types/environment/binding.d.ts +5 -1
- package/lib/types/environment/errors.d.ts +1 -1
- package/lib/types/environment/runtime.d.ts +5 -5
- package/lib/types/environment/types.d.ts +15 -3
- package/lib/types/environment/workspace.d.ts +1 -0
- package/lib/types/index.d.ts +1 -1
- package/lib/types/lifecycle.d.ts +8 -0
- package/lib/types/plugin-agents.d.ts +27 -0
- package/lib/types/plugin.d.ts +14 -24
- package/lib/types/presentation/asset.d.ts +6 -0
- package/lib/types/presentation/build/index.d.ts +16 -0
- package/lib/types/presentation/commit.d.ts +4 -0
- package/lib/types/presentation/contracts/asset-path.d.ts +2 -0
- package/lib/types/presentation/contracts/catalog.d.ts +27 -0
- package/lib/types/presentation/contracts/charts.d.ts +11 -0
- package/lib/types/presentation/contracts/editing.d.ts +8 -0
- package/lib/types/presentation/contracts/index.d.ts +11 -0
- package/lib/types/presentation/contracts/interaction.d.ts +8 -0
- package/lib/types/presentation/contracts/types.d.ts +255 -0
- package/lib/types/presentation/contracts/values.d.ts +9 -0
- package/lib/types/presentation/delivery.d.ts +3 -0
- package/lib/types/presentation/export-html.d.ts +13 -0
- package/lib/types/presentation/files.d.ts +7 -0
- package/lib/types/presentation/index.d.ts +6 -0
- package/lib/types/presentation/lint.d.ts +13 -0
- package/lib/types/presentation/projection/files.d.ts +2 -0
- package/lib/types/presentation/projection/index.d.ts +20 -0
- package/lib/types/presentation/projection/program.d.ts +2 -0
- package/lib/types/presentation/projection/sql-code.d.ts +2 -0
- package/lib/types/presentation/receipt.d.ts +14 -0
- package/lib/types/presentation/reports.d.ts +10 -0
- package/lib/types/presentation/rpc.d.ts +25 -0
- package/lib/types/presentation/tool.d.ts +12 -0
- package/lib/types/python-execution-contracts.d.ts +10 -0
- package/lib/types/python-execution.d.ts +10 -0
- package/lib/types/report-publishing/adapters.d.ts +6 -0
- package/lib/types/report-publishing/config.d.ts +22 -0
- package/lib/types/report-publishing/service.d.ts +68 -0
- package/lib/types/rpc.d.ts +3 -0
- package/lib/types/semantic-browser/contracts.d.ts +47 -0
- package/lib/types/semantic-browser/definition.d.ts +20 -0
- package/lib/types/semantic-browser/program.d.ts +2 -0
- package/lib/types/semantic-browser/service.d.ts +26 -0
- package/lib/types/semantic-reference/bridge.d.ts +12 -0
- package/lib/types/semantic-reference/contracts.d.ts +54 -0
- package/lib/types/semantic-reference/environment.d.ts +22 -0
- package/lib/types/semantic-reference/index.d.ts +3 -0
- package/lib/types/semantic-reference/labels.d.ts +16 -0
- package/lib/types/semantic-reference/rpc.d.ts +15 -0
- package/lib/types/semantic-reference/search.d.ts +10 -0
- package/lib/types/semantic-reference/usage.d.ts +43 -0
- package/lib/types/tool-lifecycle.d.ts +4 -0
- package/lib/types/workspace-identity.d.ts +6 -0
- package/lib/workspace-identity.js +9 -0
- package/package.json +99 -53
- package/python/presentation-kit/dist/dsh_data_analysis_presentation_kit-1.1.0-py3-none-any.whl +0 -0
- package/skills/dsh-data-analysis-files/SKILL.md +32 -0
- package/skills/dsh-data-analysis-files/references/examples.md +93 -0
- package/skills/dsh-data-analysis-presentation/SKILL.md +28 -0
- package/skills/dsh-data-analysis-presentation/references/chart-examples.md +18 -0
- package/skills/dsh-data-analysis-presentation/references/charts.md +55 -0
- package/skills/dsh-data-analysis-presentation/references/examples/artifact.draft.json +36 -0
- package/skills/dsh-data-analysis-presentation/references/examples/charts-bins.dataset.json +33 -0
- package/skills/dsh-data-analysis-presentation/references/examples/charts-boxes.dataset.json +45 -0
- package/skills/dsh-data-analysis-presentation/references/examples/charts-composition.dataset.json +33 -0
- package/skills/dsh-data-analysis-presentation/references/examples/charts-funnel.dataset.json +27 -0
- package/skills/dsh-data-analysis-presentation/references/examples/charts-precision.dataset.json +21 -0
- package/skills/dsh-data-analysis-presentation/references/examples/charts-series.dataset.json +58 -0
- package/skills/dsh-data-analysis-presentation/references/examples/charts-shares.dataset.json +33 -0
- package/skills/dsh-data-analysis-presentation/references/examples/charts-waterfall.dataset.json +44 -0
- package/skills/dsh-data-analysis-presentation/references/examples/charts.draft.json +393 -0
- package/skills/dsh-data-analysis-presentation/references/examples/comparison-selected.dataset.json +24 -0
- package/skills/dsh-data-analysis-presentation/references/examples/comparison-summary.dataset.json +22 -0
- package/skills/dsh-data-analysis-presentation/references/examples/comparison.dataset.json +18 -0
- package/skills/dsh-data-analysis-presentation/references/examples/comparison.draft.json +80 -0
- package/skills/dsh-data-analysis-presentation/references/examples/computed-sources.draft.json +42 -0
- package/skills/dsh-data-analysis-presentation/references/examples/computed.dataset.json +12 -0
- package/skills/dsh-data-analysis-presentation/references/examples/computed.draft.json +58 -0
- package/skills/dsh-data-analysis-presentation/references/examples/interaction-detail.dataset.json +30 -0
- package/skills/dsh-data-analysis-presentation/references/examples/interaction-summary.dataset.json +22 -0
- package/skills/dsh-data-analysis-presentation/references/examples/interaction.draft.json +279 -0
- package/skills/dsh-data-analysis-presentation/references/examples/source-only.draft.json +27 -0
- package/skills/dsh-data-analysis-presentation/references/examples/write-charts.py +73 -0
- package/skills/dsh-data-analysis-presentation/references/examples/write-comparison.py +42 -0
- package/skills/dsh-data-analysis-presentation/references/examples/write-computed.py +21 -0
- package/skills/dsh-data-analysis-presentation/references/examples/write-interaction.py +33 -0
- package/skills/dsh-data-analysis-presentation/references/examples.md +44 -0
- package/skills/dsh-data-analysis-presentation/references/export-html.md +7 -0
- package/skills/dsh-data-analysis-presentation/references/interaction.md +56 -0
- package/skills/dsh-data-analysis-presentation/references/narrative.md +37 -0
- package/skills/dsh-data-analysis-presentation/references/publishing.md +3 -0
- package/skills/dsh-data-analysis-presentation/references/schema.md +162 -0
- package/lib/datasource/access.js +0 -60
- package/lib/datasource/credentials.js +0 -24
- package/lib/evidence/bridge-program.js +0 -153
- package/lib/evidence/bridge.js +0 -166
- package/lib/evidence/index.js +0 -2
- package/lib/evidence/sources.js +0 -263
- package/lib/types/datasource/access.d.ts +0 -27
- package/lib/types/evidence/bridge.d.ts +0 -40
- package/lib/types/evidence/index.d.ts +0 -4
- package/lib/types/evidence/sources.d.ts +0 -57
- package/python/report-kit/dist/dsh_data_analysis_report_kit-3.0.0-py3-none-any.whl +0 -0
- package/skills/dsh-data-analysis-report/SKILL.md +0 -57
- package/skills/dsh-data-analysis-report/assets/marivo-artifact.js +0 -113
- package/skills/dsh-data-analysis-report/assets/marivo-session-dag.js +0 -1201
- package/skills/dsh-data-analysis-report/assets/report-data.js +0 -449
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/** Browser-safe wire contracts. These bounds do not reimplement Marivo's domain grammar. */
|
|
2
|
+
export declare const CHANNEL = "/dsh-data-analysis";
|
|
3
|
+
export declare const SOURCE = "marivo-semantic";
|
|
4
|
+
export declare const MAX_WIRE_BYTES: number;
|
|
5
|
+
export interface SemanticRef {
|
|
6
|
+
readonly schema: 'marivo.semantic_ref/v1';
|
|
7
|
+
readonly kind: string;
|
|
8
|
+
readonly path: string;
|
|
9
|
+
}
|
|
10
|
+
export interface Envelope {
|
|
11
|
+
readonly schema: 'dsh-data-analysis-semantic-reference/v1';
|
|
12
|
+
readonly sessionId: string;
|
|
13
|
+
readonly environmentFingerprint: string;
|
|
14
|
+
readonly ref: SemanticRef;
|
|
15
|
+
}
|
|
16
|
+
export interface Candidate {
|
|
17
|
+
readonly ref: SemanticRef;
|
|
18
|
+
readonly refKey: string;
|
|
19
|
+
readonly name: string;
|
|
20
|
+
readonly businessDefinition: string | null;
|
|
21
|
+
}
|
|
22
|
+
export interface Projection {
|
|
23
|
+
readonly kinds: readonly string[];
|
|
24
|
+
readonly items: readonly Candidate[];
|
|
25
|
+
}
|
|
26
|
+
export interface RankedCandidate extends Candidate {
|
|
27
|
+
readonly section: 'recent' | 'kind' | 'strict' | 'fuzzy';
|
|
28
|
+
}
|
|
29
|
+
export interface CandidatesResponse {
|
|
30
|
+
readonly environmentFingerprint: string;
|
|
31
|
+
readonly items: readonly RankedCandidate[];
|
|
32
|
+
}
|
|
33
|
+
export declare function closed(value: unknown, keys: readonly string[]): Record<string, unknown>;
|
|
34
|
+
export declare function boundedText(value: unknown, max: number, empty?: boolean): string;
|
|
35
|
+
export declare function parseJson(value: unknown, max?: number): unknown;
|
|
36
|
+
export declare function parseRef(value: unknown): SemanticRef;
|
|
37
|
+
export declare function refKey(ref: SemanticRef): string;
|
|
38
|
+
export declare function parseEnvelope(value: unknown): Envelope;
|
|
39
|
+
export declare function envelopeJson(envelope: Envelope): string;
|
|
40
|
+
export declare function modelMarker(envelope: Envelope): string;
|
|
41
|
+
export declare function parseCandidate(value: unknown): Candidate;
|
|
42
|
+
export declare function parseProjection(value: unknown): Projection;
|
|
43
|
+
export declare function parseCandidatesRequest(value: unknown): {
|
|
44
|
+
version: number;
|
|
45
|
+
sessionId: string;
|
|
46
|
+
query: string;
|
|
47
|
+
quoted: boolean;
|
|
48
|
+
};
|
|
49
|
+
export declare function parseCandidatesResponse(value: unknown): CandidatesResponse;
|
|
50
|
+
/** Browser selection identity only; preparation never reloads semantic content. */
|
|
51
|
+
export declare function parsePrepareRequest(value: unknown): {
|
|
52
|
+
workspaceId: string;
|
|
53
|
+
envelope: Envelope;
|
|
54
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { MarivoCheckedRunner } from '../environment/types.ts';
|
|
2
|
+
import type { EnvironmentResolver } from './rpc.ts';
|
|
3
|
+
interface Workspace {
|
|
4
|
+
id: string;
|
|
5
|
+
path: string;
|
|
6
|
+
}
|
|
7
|
+
interface Binding {
|
|
8
|
+
root: string;
|
|
9
|
+
environment: Promise<MarivoCheckedRunner>;
|
|
10
|
+
}
|
|
11
|
+
export interface ReferenceEnvironmentHost<A extends object> {
|
|
12
|
+
agent(sessionId: string): A | undefined;
|
|
13
|
+
binding(agent: A): Binding | undefined;
|
|
14
|
+
projectRoot(agent: A): string;
|
|
15
|
+
resolve(agent: A): Promise<MarivoCheckedRunner>;
|
|
16
|
+
workspace(sessionId: string): Workspace;
|
|
17
|
+
}
|
|
18
|
+
/** Reference identity includes Harness ownership; the underlying Runtime stays unchanged. */
|
|
19
|
+
export declare function semanticEnvironmentFingerprint(workspaceId: string, runtimeFingerprint: string): string;
|
|
20
|
+
/** Explicit selection establishes ownership; serialization never repairs it. */
|
|
21
|
+
export declare function referenceEnvironmentResolver<A extends object>(host: ReferenceEnvironmentHost<A>): EnvironmentResolver;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Shared display labels and search aliases; object kinds still come from the live Catalog. */
|
|
2
|
+
export declare const semanticKindLabels: {
|
|
3
|
+
readonly domain: "业务域";
|
|
4
|
+
readonly datasource: "数据源";
|
|
5
|
+
readonly entity: "实体";
|
|
6
|
+
readonly dimension: "维度";
|
|
7
|
+
readonly measure: "度量";
|
|
8
|
+
readonly time_dimension: "时间维度";
|
|
9
|
+
readonly metric: "指标";
|
|
10
|
+
readonly relationship: "关系";
|
|
11
|
+
readonly event: "事件";
|
|
12
|
+
readonly state_model: "状态模型";
|
|
13
|
+
readonly period_calendar: "周期日历";
|
|
14
|
+
readonly temporal_set: "时间集合";
|
|
15
|
+
readonly work_schedule: "工作日程";
|
|
16
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ConnectionRpcHandler, HostConnectionHandle } from '@deepseek-ai/dsh-client-connection';
|
|
2
|
+
import type { MarivoCheckedRunner } from '../environment/types.ts';
|
|
3
|
+
import { SemanticReferenceBridge } from './bridge.ts';
|
|
4
|
+
import { type SemanticReferenceUsage } from './usage.ts';
|
|
5
|
+
export type EnvironmentResolver = (sessionId: string, purpose: 'candidates' | 'reference' | 'prepare', workspaceId?: string) => Promise<MarivoCheckedRunner>;
|
|
6
|
+
/** Abort the caller's wait, without pretending to cancel the shared Environment resolver. */
|
|
7
|
+
export declare function abortable<T>(promise: Promise<T>, signal: AbortSignal): Promise<T>;
|
|
8
|
+
export declare class SemanticReferenceService {
|
|
9
|
+
#private;
|
|
10
|
+
constructor(resolve: EnvironmentResolver, usage: SemanticReferenceUsage, bridge?: SemanticReferenceBridge);
|
|
11
|
+
handle(endpoint: string, payload: unknown, caller: AbortSignal): Promise<unknown>;
|
|
12
|
+
stop(): void;
|
|
13
|
+
close(): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
export declare function registerSemanticReferenceRpc(connection: HostConnectionHandle, service: SemanticReferenceService, browser?: ConnectionRpcHandler): () => Promise<void>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Projection, RankedCandidate } from './contracts.ts';
|
|
2
|
+
export interface UsageScore {
|
|
3
|
+
readonly count: number;
|
|
4
|
+
readonly last: number;
|
|
5
|
+
}
|
|
6
|
+
export type UsageScores = ReadonlyMap<string, UsageScore>;
|
|
7
|
+
export declare function normalize(text: string): string;
|
|
8
|
+
export declare function compareText(a: string, b: string): number;
|
|
9
|
+
export declare function dice(a: string, b: string): number;
|
|
10
|
+
export declare function search(projection: Projection, rawQuery: string, usage?: UsageScores): readonly RankedCandidate[];
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type DomainFacility } from '@deepseek-ai/dsh-storage-domain';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { type SemanticRef } from './contracts.ts';
|
|
4
|
+
import type { UsageScores } from './search.ts';
|
|
5
|
+
export declare const usageSchema: z.ZodObject<{
|
|
6
|
+
entries: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
7
|
+
ref: z.ZodPipe<z.ZodUnknown, z.ZodTransform<SemanticRef, unknown>>;
|
|
8
|
+
days: z.ZodArray<z.ZodObject<{
|
|
9
|
+
day: z.ZodISODate;
|
|
10
|
+
count: z.ZodNumber;
|
|
11
|
+
}, z.core.$strict>>;
|
|
12
|
+
lastSelectedAt: z.ZodNumber;
|
|
13
|
+
}, z.core.$strict>>;
|
|
14
|
+
}, z.core.$strict>;
|
|
15
|
+
export type UsageWorkspace = z.infer<typeof usageSchema>;
|
|
16
|
+
export declare const usageSpec: {
|
|
17
|
+
name: string;
|
|
18
|
+
version: number;
|
|
19
|
+
tables: {
|
|
20
|
+
workspaces: import("@deepseek-ai/dsh-storage-domain").DomainTableSpec<string, {
|
|
21
|
+
entries: Record<string, {
|
|
22
|
+
ref: SemanticRef;
|
|
23
|
+
days: {
|
|
24
|
+
day: string;
|
|
25
|
+
count: number;
|
|
26
|
+
}[];
|
|
27
|
+
lastSelectedAt: number;
|
|
28
|
+
}>;
|
|
29
|
+
}>;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
export declare function workspaceKey(canonicalRoot: string): string;
|
|
33
|
+
export declare function localDay(date: Date): string;
|
|
34
|
+
export declare function windowDays(now: number): string[];
|
|
35
|
+
export declare function increment(row: UsageWorkspace, input: SemanticRef, now: number): UsageWorkspace;
|
|
36
|
+
/** Only admitted mutations join the per-Workspace queue; close drains those jobs. */
|
|
37
|
+
export declare class SemanticReferenceUsage {
|
|
38
|
+
#private;
|
|
39
|
+
constructor(facility: Pick<DomainFacility, 'open'>, clock?: () => number, diagnostic?: () => void);
|
|
40
|
+
scores(key: string): Promise<UsageScores>;
|
|
41
|
+
selected(key: string, ref: SemanticRef, signal: AbortSignal): Promise<void>;
|
|
42
|
+
close(): Promise<void>;
|
|
43
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
import type { ToolDefinition } from '@deepseek-ai/dsh-tools';
|
|
3
|
+
/** A plugin tool owns its execution promises; withdrawing its schema is not a drain. */
|
|
4
|
+
export declare function registerMarivoTool(ctx: Context, tool: ToolDefinition): () => Promise<void>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
2
|
+
/** Resolve only Harness-owned, header-validated Workspace membership; never infer it from a path. */
|
|
3
|
+
export declare function resolvePresentationWorkspace(ctx: Context, sessionId: string): {
|
|
4
|
+
id: string;
|
|
5
|
+
path: string;
|
|
6
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Resolve only Harness-owned, header-validated Workspace membership; never infer it from a path. */
|
|
2
|
+
export function resolvePresentationWorkspace(ctx, sessionId) {
|
|
3
|
+
const matches = ctx.workspaceRegistry
|
|
4
|
+
.list()
|
|
5
|
+
.filter((workspace) => workspace.sessionIds.some((id) => String(id) === sessionId));
|
|
6
|
+
if (matches.length !== 1)
|
|
7
|
+
throw new Error('Presentation requires one current Session Workspace');
|
|
8
|
+
return { id: String(matches[0].id), path: matches[0].path };
|
|
9
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chengxianglibra/dsh-data-analysis",
|
|
3
|
-
"description": "Marivo runtime, live
|
|
4
|
-
"version": "0.
|
|
3
|
+
"description": "Marivo runtime, live Help, secure datasource execution and presentation delivery for DeepSeek Harness",
|
|
4
|
+
"version": "0.2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/chengxianglibra/dsh-data-analysis.git",
|
|
@@ -14,12 +14,13 @@
|
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"type": "module",
|
|
16
16
|
"engines": {
|
|
17
|
-
"node": ">=24"
|
|
17
|
+
"node": "^22.19.0 || >=24.0.0"
|
|
18
18
|
},
|
|
19
19
|
"main": "lib/index.js",
|
|
20
20
|
"types": "lib/types/index.d.ts",
|
|
21
21
|
"bin": {
|
|
22
|
-
"dsh-data-analysis-env": "./lib/bin/environment.js"
|
|
22
|
+
"dsh-data-analysis-env": "./lib/bin/environment.js",
|
|
23
|
+
"dsh-data-analysis-presentation-lint": "./lib/bin/presentation-lint.js"
|
|
23
24
|
},
|
|
24
25
|
"exports": {
|
|
25
26
|
".": {
|
|
@@ -42,10 +43,6 @@
|
|
|
42
43
|
"types": "./lib/types/datasource/index.d.ts",
|
|
43
44
|
"default": "./lib/datasource/index.js"
|
|
44
45
|
},
|
|
45
|
-
"./evidence": {
|
|
46
|
-
"types": "./lib/types/evidence/index.d.ts",
|
|
47
|
-
"default": "./lib/evidence/index.js"
|
|
48
|
-
},
|
|
49
46
|
"./compatibility": {
|
|
50
47
|
"types": "./lib/types/compatibility.d.ts",
|
|
51
48
|
"default": "./lib/compatibility.js"
|
|
@@ -56,16 +53,17 @@
|
|
|
56
53
|
"files": [
|
|
57
54
|
"lib/**/*.js",
|
|
58
55
|
"lib/types/**/*.d.ts",
|
|
59
|
-
"
|
|
60
|
-
"skills
|
|
56
|
+
"skills/dsh-data-analysis-presentation/**",
|
|
57
|
+
"skills/dsh-data-analysis-files/**",
|
|
58
|
+
"python/presentation-kit/dist/dsh_data_analysis_presentation_kit-1.1.0-py3-none-any.whl",
|
|
61
59
|
"cordis.patch.yml",
|
|
62
60
|
"README.md"
|
|
63
61
|
],
|
|
64
62
|
"scripts": {
|
|
65
63
|
"build": "npm run clean && tsc -p tsconfig.build.json && node scripts/finalize-build.mjs",
|
|
66
|
-
"build:report-kit": "node scripts/build-report-kit.mjs",
|
|
67
64
|
"clean": "node scripts/clean.mjs",
|
|
68
|
-
"prepack": "npm run build:
|
|
65
|
+
"prepack": "npm run build:presentation-kit && npm run build",
|
|
66
|
+
"build:presentation-kit": "node scripts/build-presentation-kit.mjs"
|
|
69
67
|
},
|
|
70
68
|
"publishConfig": {
|
|
71
69
|
"access": "public",
|
|
@@ -75,14 +73,14 @@
|
|
|
75
73
|
"schema": "dsh-data-analysis-compatibility/v2",
|
|
76
74
|
"dsh": {
|
|
77
75
|
"distribution": "@deepseek-ai/dsh",
|
|
78
|
-
"peerRange": "0.1.
|
|
76
|
+
"peerRange": ">=0.1.5-rc.1"
|
|
79
77
|
},
|
|
80
78
|
"marivo": {
|
|
81
|
-
"version": "0.5.
|
|
82
|
-
"packageSpec": "marivo[duckdb,trino,clickhouse]==0.5.
|
|
79
|
+
"version": "0.5.5",
|
|
80
|
+
"packageSpec": "marivo[duckdb,trino,clickhouse]==0.5.5"
|
|
83
81
|
},
|
|
84
82
|
"contracts": {
|
|
85
|
-
"runtimeInstallation": "dsh-data-analysis-runtime/
|
|
83
|
+
"runtimeInstallation": "dsh-data-analysis-runtime/v3",
|
|
86
84
|
"subprocessPolicy": "direct-argv-inherited-env-snapshot-overlay-v2"
|
|
87
85
|
}
|
|
88
86
|
},
|
|
@@ -90,10 +88,17 @@
|
|
|
90
88
|
"client": {
|
|
91
89
|
"inject": [
|
|
92
90
|
"@deepseek-ai/dsh-client-connection",
|
|
91
|
+
"@deepseek-ai/dsh-api-gateway",
|
|
93
92
|
"@deepseek-ai/dsh-client-locale",
|
|
94
|
-
"@deepseek-ai/dsh-
|
|
93
|
+
"@deepseek-ai/dsh-api-session-controller",
|
|
94
|
+
"@deepseek-ai/dsh-api-workspace-controller",
|
|
95
|
+
"@deepseek-ai/dsh-client-ui-chat",
|
|
95
96
|
"@deepseek-ai/dsh-client-ui-conversation",
|
|
96
|
-
"@deepseek-ai/dsh-client-ui-tool"
|
|
97
|
+
"@deepseek-ai/dsh-client-ui-tool",
|
|
98
|
+
"@deepseek-ai/dsh-client-ui-input-trigger",
|
|
99
|
+
"@deepseek-ai/dsh-client-ui-sidebar",
|
|
100
|
+
"@deepseek-ai/dsh-client-ui-layout",
|
|
101
|
+
"@deepseek-ai/dsh-client-ui-sidebar-right"
|
|
97
102
|
],
|
|
98
103
|
"platform": "web"
|
|
99
104
|
},
|
|
@@ -102,48 +107,89 @@
|
|
|
102
107
|
}
|
|
103
108
|
},
|
|
104
109
|
"dependencies": {
|
|
105
|
-
"@
|
|
110
|
+
"@aws-sdk/client-s3": "^3.1129.0",
|
|
111
|
+
"@deepseek-ai/schemastery": "^3.18.1",
|
|
112
|
+
"zod": "^4.4.3"
|
|
106
113
|
},
|
|
107
114
|
"devDependencies": {
|
|
108
|
-
"@deepseek-ai/dsh-agent-loop": "
|
|
109
|
-
"@deepseek-ai/dsh-anonymous-user-id": "
|
|
110
|
-
"@deepseek-ai/dsh-bash-local": "
|
|
111
|
-
"@deepseek-ai/dsh-client-
|
|
112
|
-
"@deepseek-ai/dsh-client-ui-
|
|
113
|
-
"@deepseek-ai/dsh-
|
|
114
|
-
"@deepseek-ai/dsh-
|
|
115
|
-
"@deepseek-ai/dsh-
|
|
116
|
-
"@deepseek-ai/dsh-
|
|
117
|
-
"@deepseek-ai/dsh-
|
|
118
|
-
"@deepseek-ai/dsh-
|
|
119
|
-
"@deepseek-ai/dsh-
|
|
120
|
-
"@deepseek-ai/dsh-
|
|
121
|
-
"@deepseek-ai/dsh-
|
|
122
|
-
"@deepseek-ai/dsh-
|
|
123
|
-
"@deepseek-ai/dsh-
|
|
124
|
-
"
|
|
115
|
+
"@deepseek-ai/dsh-agent-loop": "0.1.5-rc.1",
|
|
116
|
+
"@deepseek-ai/dsh-anonymous-user-id": "0.1.5-rc.1",
|
|
117
|
+
"@deepseek-ai/dsh-bash-local": "0.1.5-rc.1",
|
|
118
|
+
"@deepseek-ai/dsh-client-store": "0.1.5-rc.1",
|
|
119
|
+
"@deepseek-ai/dsh-client-ui-primitives": "0.1.5-rc.1",
|
|
120
|
+
"@deepseek-ai/dsh-client-ui-renderer": "0.1.5-rc.1",
|
|
121
|
+
"@deepseek-ai/dsh-client-ui-sidebar-right": "0.1.5-rc.1",
|
|
122
|
+
"@deepseek-ai/dsh-client-ui-slots": "0.1.5-rc.1",
|
|
123
|
+
"@deepseek-ai/dsh-code-runtime": "0.1.5-rc.1",
|
|
124
|
+
"@deepseek-ai/dsh-code-runtime-worker-thread": "0.1.5-rc.1",
|
|
125
|
+
"@deepseek-ai/dsh-credentials-local": "0.1.5-rc.1",
|
|
126
|
+
"@deepseek-ai/dsh-fs-local": "0.1.5-rc.1",
|
|
127
|
+
"@deepseek-ai/dsh-fs-observation-policy": "0.1.5-rc.1",
|
|
128
|
+
"@deepseek-ai/dsh-launch-environment": "0.1.5-rc.1",
|
|
129
|
+
"@deepseek-ai/dsh-llm-deepseek": "0.1.5-rc.1",
|
|
130
|
+
"@deepseek-ai/dsh-scope": "0.1.5-rc.1",
|
|
131
|
+
"@deepseek-ai/dsh-session-persistence": "0.1.5-rc.1",
|
|
132
|
+
"@deepseek-ai/dsh-session-persistence-jsonl": "0.1.5-rc.1",
|
|
133
|
+
"@deepseek-ai/dsh-session-projection": "0.1.5-rc.1",
|
|
134
|
+
"@deepseek-ai/dsh-skill": "0.1.5-rc.1",
|
|
135
|
+
"@deepseek-ai/dsh-storage": "0.1.5-rc.1",
|
|
136
|
+
"@deepseek-ai/dsh-storage-json": "0.1.5-rc.1",
|
|
137
|
+
"@deepseek-ai/dsh-subprocess-local": "0.1.5-rc.1",
|
|
138
|
+
"@deepseek-ai/dsh-tool-bash": "0.1.5-rc.1",
|
|
139
|
+
"@deepseek-ai/dsh-tool-fs": "0.1.5-rc.1",
|
|
140
|
+
"@deepseek-ai/dsh-tool-present": "0.1.5-rc.1",
|
|
141
|
+
"@deepseek-ai/dsh-tool-skill": "0.1.5-rc.1",
|
|
142
|
+
"@deepseek-ai/dsh-util-workspace-path": "0.1.5-rc.1",
|
|
143
|
+
"@shikijs/core": "4.4.3",
|
|
144
|
+
"@shikijs/engine-javascript": "4.4.3",
|
|
145
|
+
"@shikijs/langs": "4.4.3",
|
|
125
146
|
"@types/react": "^18.3.31",
|
|
147
|
+
"@types/react-dom": "18.3.7",
|
|
148
|
+
"@wasm-fmt/ruff_fmt": "0.15.20",
|
|
149
|
+
"esbuild": "^0.28.2",
|
|
150
|
+
"immer": "10.1.1",
|
|
151
|
+
"playwright": "1.63.0",
|
|
126
152
|
"react": "^18.3.1",
|
|
127
|
-
"
|
|
153
|
+
"react-dom": "18.3.1",
|
|
154
|
+
"react-is": "18.3.1",
|
|
155
|
+
"recharts": "3.8.1",
|
|
156
|
+
"sql-formatter": "15.8.2",
|
|
157
|
+
"typescript": "^6.0.3",
|
|
158
|
+
"zustand": "4.4.7"
|
|
128
159
|
},
|
|
129
160
|
"peerDependencies": {
|
|
130
|
-
"@deepseek-ai/dsh-agent": "0.1.1-rc.2",
|
|
131
|
-
"@deepseek-ai/dsh-client-connection": "0.1.1-rc.2",
|
|
132
|
-
"@deepseek-ai/dsh-client-locale": "0.1.1-rc.2",
|
|
133
|
-
"@deepseek-ai/dsh-client-runtime": "0.1.1-rc.2",
|
|
134
|
-
"@deepseek-ai/dsh-client-ui-conversation": "0.1.1-rc.2",
|
|
135
|
-
"@deepseek-ai/dsh-client-ui-primitives": "0.1.1-rc.2",
|
|
136
|
-
"@deepseek-ai/dsh-client-ui-tool": "0.1.1-rc.2",
|
|
137
|
-
"@deepseek-ai/dsh-credentials": "0.1.1-rc.2",
|
|
138
|
-
"@deepseek-ai/dsh-home-paths": "0.1.1-rc.2",
|
|
139
|
-
"@deepseek-ai/dsh-llm": "0.1.1-rc.2",
|
|
140
|
-
"@deepseek-ai/dsh-session": "0.1.1-rc.2",
|
|
141
|
-
"@deepseek-ai/dsh-shell-env": "0.1.1-rc.2",
|
|
142
|
-
"@deepseek-ai/dsh-skill-filesystem": "0.1.1-rc.2",
|
|
143
|
-
"@deepseek-ai/dsh-scope": "0.1.1-rc.2",
|
|
144
|
-
"@deepseek-ai/dsh-system-prompt": "0.1.1-rc.2",
|
|
145
161
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
146
|
-
"@deepseek-ai/dsh-
|
|
162
|
+
"@deepseek-ai/dsh-agent": ">=0.1.5-rc.1",
|
|
163
|
+
"@deepseek-ai/dsh-api-gateway": ">=0.1.5-rc.1",
|
|
164
|
+
"@deepseek-ai/dsh-api-session-controller": ">=0.1.5-rc.1",
|
|
165
|
+
"@deepseek-ai/dsh-api-workspace-controller": ">=0.1.5-rc.1",
|
|
166
|
+
"@deepseek-ai/dsh-atomic-write": ">=0.1.5-rc.1",
|
|
167
|
+
"@deepseek-ai/dsh-client-connection": ">=0.1.5-rc.1",
|
|
168
|
+
"@deepseek-ai/dsh-client-locale": ">=0.1.5-rc.1",
|
|
169
|
+
"@deepseek-ai/dsh-client-ui-chat": ">=0.1.5-rc.1",
|
|
170
|
+
"@deepseek-ai/dsh-client-ui-conversation": ">=0.1.5-rc.1",
|
|
171
|
+
"@deepseek-ai/dsh-client-ui-input-trigger": ">=0.1.5-rc.1",
|
|
172
|
+
"@deepseek-ai/dsh-client-ui-layout": ">=0.1.5-rc.1",
|
|
173
|
+
"@deepseek-ai/dsh-client-ui-primitives": ">=0.1.5-rc.1",
|
|
174
|
+
"@deepseek-ai/dsh-client-ui-sidebar": ">=0.1.5-rc.1",
|
|
175
|
+
"@deepseek-ai/dsh-client-ui-sidebar-right": ">=0.1.5-rc.1",
|
|
176
|
+
"@deepseek-ai/dsh-client-ui-tool": ">=0.1.5-rc.1",
|
|
177
|
+
"@deepseek-ai/dsh-credentials": ">=0.1.5-rc.1",
|
|
178
|
+
"@deepseek-ai/dsh-home-paths": ">=0.1.5-rc.1",
|
|
179
|
+
"@deepseek-ai/dsh-llm": ">=0.1.5-rc.1",
|
|
180
|
+
"@deepseek-ai/dsh-sandbox": ">=0.1.5-rc.1",
|
|
181
|
+
"@deepseek-ai/dsh-scope": ">=0.1.5-rc.1",
|
|
182
|
+
"@deepseek-ai/dsh-session": ">=0.1.5-rc.1",
|
|
183
|
+
"@deepseek-ai/dsh-shell": ">=0.1.5-rc.1",
|
|
184
|
+
"@deepseek-ai/dsh-shell-env": ">=0.1.5-rc.1",
|
|
185
|
+
"@deepseek-ai/dsh-skill-filesystem": ">=0.1.5-rc.1",
|
|
186
|
+
"@deepseek-ai/dsh-storage-domain": ">=0.1.5-rc.1",
|
|
187
|
+
"@deepseek-ai/dsh-system-prompt": ">=0.1.5-rc.1",
|
|
188
|
+
"@deepseek-ai/dsh-tools": ">=0.1.5-rc.1",
|
|
189
|
+
"@deepseek-ai/dsh-typert-protocol": ">=0.1.5-rc.1",
|
|
190
|
+
"@deepseek-ai/dsh-typert-registry": ">=0.1.5-rc.1",
|
|
191
|
+
"@deepseek-ai/dsh-util-values": ">=0.1.5-rc.1",
|
|
192
|
+
"@deepseek-ai/dsh-workspace": ">=0.1.5-rc.1",
|
|
147
193
|
"react": "^18.3.1"
|
|
148
194
|
}
|
|
149
195
|
}
|
package/python/presentation-kit/dist/dsh_data_analysis_presentation_kit-1.1.0-py3-none-any.whl
ADDED
|
Binary file
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dsh-data-analysis-files
|
|
3
|
+
description: 分析已上传或 Workspace 中的 CSV、JSON、Parquet、Excel 文件,使用 pandas 或 DuckDB 计算,按需导出 CSV、JSON、PNG 等普通文件或接入报告。无需先建立 Marivo datasource 或语义模型。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# 文件分析
|
|
7
|
+
|
|
8
|
+
使用 Harness 提供的当前附件可读路径,或用户指定的 Workspace 文件;同名附件按消息和完整路径区分。路径不可读时报告实际问题,不猜测 Host 缓存位置。
|
|
9
|
+
|
|
10
|
+
文件读取、计算和最终文件生成(包括 CSV、JSON、PNG)均通过 `marivo_python` 在绑定 Runtime 中执行,不改走 Bash 的 `python`/`python3` 或其他解释器。纯本地文件分析可直接使用 pandas 或原生 `duckdb`,传 `datasources: []`;按任务选择或组合使用,无需 `md.raw_sql`、Marivo 分析 Skill、live Help 或语义建模。只有实际访问 Marivo datasource 时才声明其精确名称并查询相关契约。
|
|
11
|
+
|
|
12
|
+
使用现有 reader,保留回答所需的 sheet、字段和解析范围;区分样本与全量。Excel `.xlsx` 可用 DuckDB `read_xlsx`,首次使用可能联网获取官方扩展;不承诺旧 `.xls` 或冷缓存离线读取,不临时安装 Python 依赖。
|
|
13
|
+
|
|
14
|
+
每次 `marivo_python` 都是独立进程。原生 DuckDB 连接可在本次调用内复用、创建临时表,并及时关闭;后续追问重新读取原文件或已有结果,不依赖上次内存状态。按问题控制读取和输出规模,SQL `LIMIT` 不代表仅扫描这些行。
|
|
15
|
+
|
|
16
|
+
## 按用户目标交付
|
|
17
|
+
|
|
18
|
+
普通答案直接用文字,不为结论额外创建文件。用户要求 CSV、JSON、PNG 等实际文件时,先通过 `marivo_python` 生成最终文件,优先写入当前绑定 Workspace;确认执行成功、文件存在后,调用当前实际可用的 Harness 原生 `present`,再回复用户。回复前分别核对文件生成与原生声明状态:生成文件、回复路径或展示代码块均不能替代原生交付。缺少 `present` 时,最终回复必须说明“文件已生成,原生交付能力不可用”,并提供准确路径;不能只说文件已生成。不猜测附件缓存或 Shell 私有临时目录。
|
|
19
|
+
|
|
20
|
+
需要交互图表、表格、报告或看板时加载 `dsh-data-analysis-presentation`,将 DataFrame 交给现有 writer,并关联实际返回的 `codeRef`,使用 `marivo_present` 保存固定 Build。在正文说明文件名与分析范围,不将文件结果冒充 Marivo Artifact 或 Evidence。普通 `present` 不赋予文件 Report/Build 或 Evidence 身份。
|
|
21
|
+
|
|
22
|
+
报告内部的 `presentation.json`、computed 数据和 receipt 不作为默认附件;只有用户另行要求实际文件且文件已经存在于 Session 文件系统可访问位置时,才调用 `present`。阅读器下载/发布 HTML 沿用现有流程,浏览器内生成的下载不伪装成 Session 文件。
|
|
23
|
+
|
|
24
|
+
## 能力与失败
|
|
25
|
+
|
|
26
|
+
遵循 Harness [present 契约](https://github.com/deepseek-ai/deepseek-harness/blob/dsh-v0.1.5-rc.1/packages/fs/tool-present/README.md),由工具验证路径和文件类型。当前工具集中缺少 `present` 时,明确说明“文件已生成,原生交付能力不可用”,提供实际准确路径供手动使用,不虚构卡片,不安装工具或改写 profile。
|
|
27
|
+
|
|
28
|
+
生成失败不声明成功;声明失败区分“文件已生成”和“交付未完成”,修复路径或可见性后只重试交付,不为补卡片重跑分析。响应不确定时先核对已有调用结果和事件,不盲目重复声明。原生打开失败时使用 Host 的预览或错误反馈,不绕过权限。
|
|
29
|
+
|
|
30
|
+
卡片打开当前源文件,不保存内容版本;修改、移动或删除会影响后续读取。成功声明的持久事件属于 Harness,即使 PTC 外层程序随后失败,也不撤销已成功的声明。子代理产物属于其调用 Session;父 Agent 如需交付,先确认自己能访问文件,再在父 Session 显式调用 `present`,不自动跨 Session 转投递。
|
|
31
|
+
|
|
32
|
+
需要起步代码时读[简短示例](references/examples.md);其中提供无需额外依赖的 PNG 写入代码,也通过 `marivo_python` 执行。
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# 文件分析示例
|
|
2
|
+
|
|
3
|
+
以下代码通过 `marivo_python` 执行,两例都使用 `datasources: []`。将 `path` 替换为 Harness 提供的附件可读路径或用户指定的 Workspace 文件,列名按实际结构调整。
|
|
4
|
+
|
|
5
|
+
## pandas
|
|
6
|
+
|
|
7
|
+
```python
|
|
8
|
+
import pandas as pd
|
|
9
|
+
|
|
10
|
+
path = "/actual/readable/file.csv"
|
|
11
|
+
frame = pd.read_csv(path)
|
|
12
|
+
result = frame.groupby("category", dropna=False)["amount"].sum().reset_index()
|
|
13
|
+
print(result.to_string(index=False))
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
JSON、JSON Lines 和 Parquet 可分别使用 `pd.read_json`、`pd.read_json(..., lines=True)` 和 `pd.read_parquet`;读取选项由实际文件决定。默认 Runtime 未提供 `openpyxl`,`.xlsx` 可用下例的 DuckDB reader 后转成 DataFrame。
|
|
17
|
+
|
|
18
|
+
## 原生 DuckDB
|
|
19
|
+
|
|
20
|
+
```python
|
|
21
|
+
import duckdb
|
|
22
|
+
|
|
23
|
+
path = "/actual/readable/file.csv"
|
|
24
|
+
with duckdb.connect(":memory:") as con:
|
|
25
|
+
result = con.execute(
|
|
26
|
+
"SELECT category, SUM(amount) AS amount "
|
|
27
|
+
"FROM read_csv_auto(?) GROUP BY category ORDER BY amount DESC LIMIT 20",
|
|
28
|
+
[path],
|
|
29
|
+
).df()
|
|
30
|
+
print(result.to_string(index=False))
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
按文件改用 `read_json_auto(?)`、`read_parquet(?)` 或 `read_xlsx(?)`。`.xlsx` 的指定工作表可用 `read_xlsx(?, sheet = ?)` 并传入路径与 sheet 名;首次加载 `excel` 扩展需要获取官方扩展。参数避免将路径或 sheet 名直接拼入 SQL;reader 支持 glob,含通配符的文件名需先确认只命中目标文件。
|
|
34
|
+
|
|
35
|
+
原生连接支持同一调用内的多条 SQL 和临时表,无需另建 Marivo datasource。需要交互表格或报告时,使用展示 Skill 的 computed 示例;写入当前 Workspace,`sourceIds` 可为空,dataset 的 `codeRefs` 使用本次成功执行返回的实际引用。
|
|
36
|
+
|
|
37
|
+
## 导出 CSV 或 JSON
|
|
38
|
+
|
|
39
|
+
仅在用户要求实际文件时执行;`result` 是本次调用内已计算的 DataFrame。使用当前绑定 Workspace 的实际路径,不把附件路径当输出目录。
|
|
40
|
+
|
|
41
|
+
```python
|
|
42
|
+
from pathlib import Path
|
|
43
|
+
|
|
44
|
+
output_dir = Path("/actual/workspace/exports")
|
|
45
|
+
output_dir.mkdir(parents=True, exist_ok=True)
|
|
46
|
+
csv_path = output_dir / "summary.csv"
|
|
47
|
+
result.to_csv(csv_path, index=False)
|
|
48
|
+
# 用户要求 JSON 时可改为:
|
|
49
|
+
# json_path = output_dir / "summary.json"
|
|
50
|
+
# result.to_json(json_path, orient="records", force_ascii=False)
|
|
51
|
+
print(str(csv_path.resolve()))
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
执行成功后,将实际输出路径交给当前 Harness 原生 `present`(参数以当前工具契约为准):
|
|
55
|
+
|
|
56
|
+
```json
|
|
57
|
+
{"files":[{"path":"/actual/workspace/exports/summary.csv","description":"按类别汇总的金额"}]}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
无需加载展示 Skill 或调用 `marivo_present`。只交付用户要求的文件;当前没有 `present` 时报告已生成文件的准确路径和原生交付能力缺失。
|
|
61
|
+
|
|
62
|
+
## 导出 PNG
|
|
63
|
+
|
|
64
|
+
不要假设 Runtime 安装了 matplotlib 或 Pillow。以下标准库示例生成无文字的简单条形缩略图,适用于用户明确要求 PNG;颜色、顺序、数值和分析范围应在回复中说明。复杂交互图表使用展示 Skill。
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
from pathlib import Path
|
|
68
|
+
import struct
|
|
69
|
+
import zlib
|
|
70
|
+
|
|
71
|
+
# 替换为本次分析得出的非负数值;依次为 A、B、C。
|
|
72
|
+
values = [11, 23, 37]
|
|
73
|
+
width, height = 240, 120
|
|
74
|
+
pixels = bytearray([255] * (width * height * 3))
|
|
75
|
+
for index, value in enumerate(values):
|
|
76
|
+
bar_height = round(value / max(values, default=1) * 100) if max(values, default=0) else 0
|
|
77
|
+
for y in range(height - 10 - bar_height, height - 10):
|
|
78
|
+
for x in range(20 + index * 70, 60 + index * 70):
|
|
79
|
+
offset = (y * width + x) * 3
|
|
80
|
+
pixels[offset:offset + 3] = bytes((45, 110, 210))
|
|
81
|
+
def chunk(kind, data):
|
|
82
|
+
return struct.pack(">I", len(data)) + kind + data + struct.pack(">I", zlib.crc32(kind + data))
|
|
83
|
+
rows = b"".join(b"\x00" + pixels[y * width * 3:(y + 1) * width * 3] for y in range(height))
|
|
84
|
+
png = (b"\x89PNG\r\n\x1a\n"
|
|
85
|
+
+ chunk(b"IHDR", struct.pack(">IIBBBBB", width, height, 8, 2, 0, 0, 0))
|
|
86
|
+
+ chunk(b"IDAT", zlib.compress(rows)) + chunk(b"IEND", b""))
|
|
87
|
+
output = Path("/actual/workspace/exports/amounts.png")
|
|
88
|
+
output.parent.mkdir(parents=True, exist_ok=True)
|
|
89
|
+
output.write_bytes(png)
|
|
90
|
+
print(str(output.resolve()))
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
成功后通过原生 `present` 交付实际 PNG 路径。文件生成失败不调用 `present`;声明失败仅修复交付,不重新计算。
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dsh-data-analysis-presentation
|
|
3
|
+
description: 将 Marivo 分析结果或已有 Workspace 数据展示为图表、表格、报告、看板或来源面板,并交付在右侧 tab 打开的 reader。适用于需要可视展示或保存分析快照的请求;普通事实问答使用文字。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Marivo 分析展示
|
|
7
|
+
|
|
8
|
+
用 JSON 草稿组织已有结果,调用 `marivo_present` 保存并打开阅读器。
|
|
9
|
+
|
|
10
|
+
## 从问题到交付
|
|
11
|
+
|
|
12
|
+
1. 先确定问题、数据范围和要表达的结论。报告语言优先遵循用户明确要求,否则根据当前问题和上下文决定;不以 DSH 系统界面语言作为默认。Draft 必须填写 `schemaVersion: 2` 与 `locale: "zh-CN"` 或 `"en-US"`,按该语言编写标题、正文、图表及字段展示名。直接分析文件时使用 `dsh-data-analysis-files`;涉及 Marivo 分析语义或建模时,按需使用 `marivo-analysis`、`marivo-semantic` 与 `marivo_help`。通过 `marivo_python` 执行:纯本地 pandas/原生 DuckDB 使用 `datasources: []`,访问 Marivo datasource 才声明其精确名称。已有结果可直接展示,无需先激活分析 Skill。此 Skill 只定义展示,不代替 Marivo 的分析、质量与 lineage 契约。
|
|
13
|
+
2. 选数据。已有可恢复 Artifact 用 owning `sessionId` + `artifactRef` 引用,分别取实际 `session.id` 和 `artifact.ref`,不要从 Session 名称或日志标题猜测;必要时加 `findingId`,不重复导出同一份数据。需要计算后的 DataFrame 时,在绑定 Runtime 的 Python 中用 `dsh_data_analysis_presentation.write_dataset(frame, path)` 写纯 JSON;通过 `labels={列名: 报告语言展示名}` 设置表头、图例和 tooltip,Draft 字段绑定仍使用原列名,未映射列沿用列名。computed 的来源只在草稿声明,可为零个或多个 Artifact;文件分析在正文说明文件与读取范围,关联实际 `codeRef`,不构造 Artifact 来源。不要求转换代码、字段映射、hash 或输入输出证明。来源 Quality/issues 仍属于原 Artifact,不证明 computed 的计算正确。
|
|
14
|
+
3. 根据报告需要决定是否启用全局筛选;默认不添加。需要按维度交互时,先读 [全局筛选与动态指标](references/interaction.md),准备每种单选组合(含全部)的 KPI、图表与表格结果,全部受影响组件放进同一区域。缺少组合数据就减少筛选或回到分析阶段准备,不交付局部响应的全局控件。写草稿前读 [schema 与文件边界](references/schema.md);报告、看板及比较型展示还必须先读 [叙事与证据检查](references/narrative.md),按需读 [图形配置](references/charts.md)与[可改写示例](references/examples.md)。逐项对应用户问题,确定各比较的两侧、方向、分母及尚缺分支;核对原值、差值、比例、合计和余项,让正文结论与证据强度一致。用普通文件能力在当前 Workspace 写草稿;草稿与 computed 路径都相对于 Workspace 根目录。来源事实与 unavailable 状态由 builder 读取,不手填。
|
|
15
|
+
4. 手写 computed JSON 时可先运行 `dsh-data-analysis-presentation-lint analysis/presentation.draft.json`,检查草稿结构和 computed 文件;int64 用精确字符串(如 `"42"`)。静态预检不验证 Artifact、codeRefs 或最终渲染,详见 [静态预检](references/schema.md#草稿静态预检)。分析和草稿就绪后调用 `marivo_present({"draft_path":"analysis/presentation.draft.json"})`。成功只保存 `presentation.json` 并打开右侧 tab;普通展示不额外生成 HTML 或挂报告 block。用户可在阅读器按配置发布或下载 HTML。失败按诊断的 `code`、`path`、原因和建议修正草稿或数据,再重试;没有成功 receipt 就不宣称交付完成。缺少 Artifact 保存数据时报告缺失,不为完成展示自动重新查询、observe 或 revalidate。修复展示错误也不自动重放分析。
|
|
16
|
+
5. 交付主要结论、未完成分支、实质限制和 报告已在右侧 tab 打开的简短说明;headless 时给出 receipt 的精确文件路径。computed 来源不可恢复时如实保留 unavailable;区分 Agent 预筛选与 writer 截断,局部展示不能冒充全量总计或排名。只声明实际做过的浏览器检查。用户可在宿主阅读器编辑呈现并保存同一报告,支持 cell 移动、删除(可删空)及撤销。报告重开时解析当前保存构建;固定 Build 链接和离线 HTML 保留原快照。筛选选择只是临时展示,不进入保存或下载;动态指标选取已准备的组合结果,reader 不重算。
|
|
17
|
+
|
|
18
|
+
## 修改已有报告
|
|
19
|
+
|
|
20
|
+
用户要求修改、合并 KPI 或刷新这份报告时,修改完整 Draft,并向 `marivo_present` 成对传入实际 `report_id` 与本次修改基于的 `expected_build_id`,保存为同一 Report 的新 Build。以已读取的保存内容为基准,保留用户需要的阅读器编辑;不按标题或草稿路径猜身份,不修改生成文件。新建独立报告时才省略这两个参数。更新前读取方式与冲突处理见 [报告更新](references/schema.md#报告更新);冲突时核对当前内容,不能仅替换 expected ID 强行重试。
|
|
21
|
+
|
|
22
|
+
## 来源追问
|
|
23
|
+
|
|
24
|
+
简短来源问题可通过 Marivo 公开 Python API 回答。需要可视来源面板时,使用 `datasets: []` 与 `source` block,无需制造图表或 dataset。需要保留生成脚本时,将成功 `marivo_python` 返回的 `codeRef` 写入相应 dataset 的 `codeRefs`,详见 [生成代码](references/schema.md#生成代码);Artifact 执行 SQL 自动读取,执行记录与数据集的关联不构成计算正确性证明。打开、下载和来源展开读取生成时保存的快照;用户要求新范围、刷新或进一步分析时回到普通分析流程。
|
|
25
|
+
|
|
26
|
+
用户要求发布对象存储链接时,按[发布报告](references/publishing.md)使用实时披露的 `marivo_publish_report`。
|
|
27
|
+
|
|
28
|
+
离线 HTML 文件按[导出与原生交付](references/export-html.md)处理:`marivo_export_html` 成功后调用 `present`。
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# 全部图形的可运行样例
|
|
2
|
+
|
|
3
|
+
全部数据为合成演示,不是真实业务结论。在当前 Workspace 运行 [write-charts.py](examples/write-charts.py),使用已有 bound Runtime 和 presentation writer,再将[完整草稿](examples/charts.draft.json)写入 Workspace 并调用 marivo_present。
|
|
4
|
+
|
|
5
|
+
示例包含 18 个类型、bar/line 变体、数据点、参考线和精确小数。line 的 preparedViews 可以切换为已准备的散点、分箱、比例、箱线和瀑布数据;不在浏览器计算统计量。
|
|
6
|
+
|
|
7
|
+
| 数据文件 | 内容 |
|
|
8
|
+
| --- | --- |
|
|
9
|
+
| [charts-series.dataset.json](examples/charts-series.dataset.json) | 12 个有序时点、两列指标、散点坐标、大小和分类 |
|
|
10
|
+
| [charts-shares.dataset.json](examples/charts-shares.dataset.json) | 两列占比及分母 |
|
|
11
|
+
| [charts-bins.dataset.json](examples/charts-bins.dataset.json) | 明确区间边界与频数 |
|
|
12
|
+
| [charts-boxes.dataset.json](examples/charts-boxes.dataset.json) | 已计算五数摘要 |
|
|
13
|
+
| [charts-composition.dataset.json](examples/charts-composition.dataset.json) | 原值、占比和排名 |
|
|
14
|
+
| [charts-funnel.dataset.json](examples/charts-funnel.dataset.json) | 有序阶段、原值和首阶段占比 |
|
|
15
|
+
| [charts-waterfall.dataset.json](examples/charts-waterfall.dataset.json) | 步骤角色、变化量与累计坐标 |
|
|
16
|
+
| [charts-precision.dataset.json](examples/charts-precision.dataset.json) | 精确 decimal 与 null,显式近似绘图 |
|
|
17
|
+
|
|
18
|
+
Python 示例演示分析阶段的数据准备。真实任务先核实粒度、范围、分母和来源,再填写可恢复 Artifact 引用。computed 路径相对于 Workspace 根目录。
|