@dmsfe/data-agent-sdk 0.1.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/CHANGES.md +33 -0
- package/LICENSE +201 -0
- package/README.md +212 -0
- package/lib/index.cjs +30 -0
- package/lib/index.d.cts +60 -0
- package/lib/index.d.ts +60 -0
- package/lib/index.js +30 -0
- package/lib/render/index.cjs +24 -0
- package/lib/render/index.d.cts +31 -0
- package/lib/render/index.d.ts +31 -0
- package/lib/render/index.js +24 -0
- package/lib/task-finish-CMXO70b5.d.cts +52 -0
- package/lib/task-finish-CMXO70b5.d.ts +52 -0
- package/package.json +65 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* COPIED FROM apps/data-agent/src/browser/model/agent-messages/schemas/task-finish-tool-schema.ts
|
|
3
|
+
* on 2026-05-16.
|
|
4
|
+
*
|
|
5
|
+
* Phase 1 of @dmsfe/data-agent-sdk maintains a snapshot of the app's protocol
|
|
6
|
+
* schemas while customer testing proceeds. Phase 2 will invert the dependency
|
|
7
|
+
* (app consumes SDK) and delete the app-side copy.
|
|
8
|
+
*
|
|
9
|
+
* If you modify this file, run `pnpm run check:schema-drift` and update the
|
|
10
|
+
* corresponding file in apps/data-agent (or vice versa) in the same PR.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
type ChartType = string | null;
|
|
14
|
+
interface ChartData {
|
|
15
|
+
columns: string[];
|
|
16
|
+
data: Array<Array<string | number | null>>;
|
|
17
|
+
}
|
|
18
|
+
type ContentType = 'str' | 'json' | undefined;
|
|
19
|
+
interface TaskFinishChart {
|
|
20
|
+
title?: string;
|
|
21
|
+
summary?: string;
|
|
22
|
+
chart_type: ChartType;
|
|
23
|
+
/** JSON string; parse via parseChartData to get ChartData. */
|
|
24
|
+
data: string;
|
|
25
|
+
/** Comma-separated field names (wire format). */
|
|
26
|
+
x?: string;
|
|
27
|
+
/** Comma-separated field names (wire format). */
|
|
28
|
+
y?: string;
|
|
29
|
+
}
|
|
30
|
+
type TaskFinishCharts = TaskFinishChart[];
|
|
31
|
+
interface TaskFinishToolArgs {
|
|
32
|
+
content: string;
|
|
33
|
+
content_type?: 'str' | 'json';
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Structured (already-decoded) variant of TaskFinishChart.
|
|
37
|
+
* Customers hand-construct this for tests / replay; the wire wrapper
|
|
38
|
+
* (renderTaskFinishChart) decodes a TaskFinishChart into one of these
|
|
39
|
+
* before delegating to the structured renderer.
|
|
40
|
+
*/
|
|
41
|
+
interface TaskFinishChartData {
|
|
42
|
+
title?: string;
|
|
43
|
+
summary?: string;
|
|
44
|
+
chart_type: ChartType;
|
|
45
|
+
data: ChartData;
|
|
46
|
+
/** Either comma-separated string or array of field names. */
|
|
47
|
+
x?: string | string[];
|
|
48
|
+
/** Either comma-separated string or array of field names. */
|
|
49
|
+
y?: string | string[];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export type { ContentType as C, TaskFinishToolArgs as T, TaskFinishChart as a, ChartData as b, ChartType as c, TaskFinishCharts as d, TaskFinishChartData as e };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* COPIED FROM apps/data-agent/src/browser/model/agent-messages/schemas/task-finish-tool-schema.ts
|
|
3
|
+
* on 2026-05-16.
|
|
4
|
+
*
|
|
5
|
+
* Phase 1 of @dmsfe/data-agent-sdk maintains a snapshot of the app's protocol
|
|
6
|
+
* schemas while customer testing proceeds. Phase 2 will invert the dependency
|
|
7
|
+
* (app consumes SDK) and delete the app-side copy.
|
|
8
|
+
*
|
|
9
|
+
* If you modify this file, run `pnpm run check:schema-drift` and update the
|
|
10
|
+
* corresponding file in apps/data-agent (or vice versa) in the same PR.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
type ChartType = string | null;
|
|
14
|
+
interface ChartData {
|
|
15
|
+
columns: string[];
|
|
16
|
+
data: Array<Array<string | number | null>>;
|
|
17
|
+
}
|
|
18
|
+
type ContentType = 'str' | 'json' | undefined;
|
|
19
|
+
interface TaskFinishChart {
|
|
20
|
+
title?: string;
|
|
21
|
+
summary?: string;
|
|
22
|
+
chart_type: ChartType;
|
|
23
|
+
/** JSON string; parse via parseChartData to get ChartData. */
|
|
24
|
+
data: string;
|
|
25
|
+
/** Comma-separated field names (wire format). */
|
|
26
|
+
x?: string;
|
|
27
|
+
/** Comma-separated field names (wire format). */
|
|
28
|
+
y?: string;
|
|
29
|
+
}
|
|
30
|
+
type TaskFinishCharts = TaskFinishChart[];
|
|
31
|
+
interface TaskFinishToolArgs {
|
|
32
|
+
content: string;
|
|
33
|
+
content_type?: 'str' | 'json';
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Structured (already-decoded) variant of TaskFinishChart.
|
|
37
|
+
* Customers hand-construct this for tests / replay; the wire wrapper
|
|
38
|
+
* (renderTaskFinishChart) decodes a TaskFinishChart into one of these
|
|
39
|
+
* before delegating to the structured renderer.
|
|
40
|
+
*/
|
|
41
|
+
interface TaskFinishChartData {
|
|
42
|
+
title?: string;
|
|
43
|
+
summary?: string;
|
|
44
|
+
chart_type: ChartType;
|
|
45
|
+
data: ChartData;
|
|
46
|
+
/** Either comma-separated string or array of field names. */
|
|
47
|
+
x?: string | string[];
|
|
48
|
+
/** Either comma-separated string or array of field names. */
|
|
49
|
+
y?: string | string[];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export type { ContentType as C, TaskFinishToolArgs as T, TaskFinishChart as a, ChartData as b, ChartType as c, TaskFinishCharts as d, TaskFinishChartData as e };
|
package/package.json
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dmsfe/data-agent-sdk",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"description": "Framework-agnostic SDK for Data Agent: parse SSE streams and render task_finish charts.",
|
|
7
|
+
"main": "./lib/index.cjs",
|
|
8
|
+
"module": "./lib/index.js",
|
|
9
|
+
"types": "./lib/index.d.ts",
|
|
10
|
+
"sideEffects": false,
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./lib/index.d.ts",
|
|
14
|
+
"import": "./lib/index.js",
|
|
15
|
+
"require": "./lib/index.cjs"
|
|
16
|
+
},
|
|
17
|
+
"./render": {
|
|
18
|
+
"types": "./lib/render/index.d.ts",
|
|
19
|
+
"import": "./lib/render/index.js",
|
|
20
|
+
"require": "./lib/render/index.cjs"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"scripts": {
|
|
24
|
+
"prebuild": "rimraf lib",
|
|
25
|
+
"build": "tsup",
|
|
26
|
+
"compile": "tsc --noEmit",
|
|
27
|
+
"test": "vitest run --config vitest.config.unit.mts",
|
|
28
|
+
"test:watch": "vitest --config vitest.config.unit.mts",
|
|
29
|
+
"lint": "eslint src/",
|
|
30
|
+
"check:schema-drift": "tsx ../../scripts/check-sdk-schema-drift.ts",
|
|
31
|
+
"check:no-zod-in-dts": "tsx ../../scripts/check-no-zod-in-declarations.ts",
|
|
32
|
+
"check:entry-parity": "tsx ../../scripts/check-public-entry-list-parity.ts",
|
|
33
|
+
"check:side-effects": "tsx ../../scripts/check-side-effect-discipline.ts",
|
|
34
|
+
"check:bundle-externalization": "tsx ../../scripts/check-bundle-externalization.ts",
|
|
35
|
+
"check:tarball-consumer": "tsx ../../scripts/check-tarball-consumer.ts",
|
|
36
|
+
"ai:check": "run-s compile lint test check:schema-drift check:no-zod-in-dts check:entry-parity check:side-effects check:bundle-externalization check:tarball-consumer",
|
|
37
|
+
"prepublishOnly": "pnpm run build && pnpm run ai:check",
|
|
38
|
+
"release": "npm publish --access public --registry https://registry.npmjs.org && node ../../scripts/tag-sdk-release.cjs",
|
|
39
|
+
"release:dry-run": "npm publish --access public --registry https://registry.npmjs.org --dry-run"
|
|
40
|
+
},
|
|
41
|
+
"peerDependencies": {
|
|
42
|
+
"echarts": "^5"
|
|
43
|
+
},
|
|
44
|
+
"peerDependenciesMeta": {
|
|
45
|
+
"echarts": { "optional": true }
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@ai-sdk/provider-utils": "^3",
|
|
49
|
+
"@types/node": "^20",
|
|
50
|
+
"echarts": "^5",
|
|
51
|
+
"happy-dom": "^15",
|
|
52
|
+
"npm-run-all": "^4.1.5",
|
|
53
|
+
"rimraf": "^5",
|
|
54
|
+
"tsup": "^8.5.1",
|
|
55
|
+
"tsx": "^4",
|
|
56
|
+
"typescript": "^5.8.3",
|
|
57
|
+
"vitest": "^3",
|
|
58
|
+
"zod": "^4"
|
|
59
|
+
},
|
|
60
|
+
"files": ["lib", "README.md", "CHANGES.md", "LICENSE"],
|
|
61
|
+
"publishConfig": {
|
|
62
|
+
"registry": "https://registry.npmjs.org",
|
|
63
|
+
"access": "public"
|
|
64
|
+
}
|
|
65
|
+
}
|