@yejiming/dsh-data-agent 0.0.11 → 0.0.13

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.
Files changed (49) hide show
  1. package/README.en.md +70 -15
  2. package/README.md +70 -15
  3. package/conformance/dsh-ecosystem/baseline.json +59 -0
  4. package/conformance/dsh-ecosystem/dependencies.json +41 -0
  5. package/conformance/dsh-ecosystem/fixtures/host-degraded.fixture.json +12 -0
  6. package/conformance/dsh-ecosystem/fixtures/host-eligible.fixture.json +13 -0
  7. package/conformance/dsh-ecosystem/fixtures/host-rejected.fixture.json +12 -0
  8. package/conformance/dsh-ecosystem/fixtures/profiles/native-only/package.json +8 -0
  9. package/conformance/dsh-ecosystem/fixtures/profiles/native-plus-adapter/package.json +9 -0
  10. package/conformance/dsh-ecosystem/inventory.json +77 -0
  11. package/conformance/dsh-ecosystem/restrictions.json +20 -0
  12. package/dsh-plugin.json +67 -0
  13. package/lib/client.js +1352 -130
  14. package/lib/client.js.map +1 -1
  15. package/lib/{command-DuCpwVbl.js → command-utC5MHd9.js} +101 -60
  16. package/lib/command.js +1 -1
  17. package/lib/{connections-5sfdEDsG.js → connections-CHY4uB6z.js} +747 -65
  18. package/lib/defaults-Cngd8Tf8.js +131 -0
  19. package/lib/ecosystem.js +19 -0
  20. package/lib/index.js +40 -33
  21. package/lib/routes.js +5 -6
  22. package/lib/{tool-DVh61An-.js → tool-ZTOS4B33.js} +161 -177
  23. package/lib/tool.js +1 -1
  24. package/lib/types/analysis-html.d.ts +27 -0
  25. package/lib/types/analysis.d.ts +13 -1
  26. package/lib/types/client/DataAgentWorkbench.d.ts +1 -2
  27. package/lib/types/client/QueryResultTable.d.ts +13 -0
  28. package/lib/types/client/locales.d.ts +48 -0
  29. package/lib/types/client/persistence.d.ts +3 -1
  30. package/lib/types/client/query-export.d.ts +11 -0
  31. package/lib/types/client-discovery.d.ts +3 -4
  32. package/lib/types/clients.d.ts +14 -8
  33. package/lib/types/command.d.ts +2 -2
  34. package/lib/types/connections.d.ts +33 -4
  35. package/lib/types/database-types.d.ts +23 -0
  36. package/lib/types/defaults.d.ts +4 -0
  37. package/lib/types/ecosystem.d.ts +13 -0
  38. package/lib/types/index.d.ts +21 -16
  39. package/lib/types/presentation-text.d.ts +3 -0
  40. package/lib/types/query.d.ts +13 -11
  41. package/lib/types/sql.d.ts +9 -1
  42. package/lib/types/storage.d.ts +11 -1
  43. package/lib/types/structured-read.d.ts +2 -2
  44. package/lib/types/structured.d.ts +1 -1
  45. package/lib/types/tool.d.ts +5 -5
  46. package/lib/types/tui-connection-form.d.ts +10 -7
  47. package/package.json +66 -42
  48. package/preset/data-agent/agent.cordis.yml +9 -4
  49. package/lib/defaults-DP4RyRh1.js +0 -21
@@ -10,7 +10,7 @@
10
10
  */
11
11
  import { type Domain } from '@deepseek-ai/dsh-storage-domain';
12
12
  import { z } from 'zod';
13
- import type { ConnectionPersistence, PersistedConnectionFormDraft, PersistedConnectionProfile, SessionConnectionBinding } from './connections.ts';
13
+ import type { ConnectionPersistence, PersistedConnectionFormDraft, PersistedConnectionProfile, PersistedConnectionProfileEntry, SessionConnectionBinding } from './connections.ts';
14
14
  /** Storage-domain identity. Bump the version only with an explicit migration. */
15
15
  export declare const CONNECTION_STORAGE_DOMAIN = "data_agent_connections";
16
16
  export declare const CONNECTION_STORAGE_VERSION = 1;
@@ -24,12 +24,16 @@ export declare const persistedConnectionProfileSchema: z.ZodObject<{
24
24
  oracle: "oracle";
25
25
  hive: "hive";
26
26
  impala: "impala";
27
+ clickhouse: "clickhouse";
28
+ doris: "doris";
29
+ sqlserver: "sqlserver";
27
30
  }>;
28
31
  host: z.ZodOptional<z.ZodString>;
29
32
  port: z.ZodOptional<z.ZodNumber>;
30
33
  user: z.ZodOptional<z.ZodString>;
31
34
  database: z.ZodString;
32
35
  readonly: z.ZodOptional<z.ZodBoolean>;
36
+ secure: z.ZodOptional<z.ZodBoolean>;
33
37
  passwordRef: z.ZodOptional<z.ZodString>;
34
38
  credentialMode: z.ZodOptional<z.ZodEnum<{
35
39
  none: "none";
@@ -52,12 +56,16 @@ export declare const persistedConnectionFormDraftSchema: z.ZodObject<{
52
56
  oracle: "oracle";
53
57
  hive: "hive";
54
58
  impala: "impala";
59
+ clickhouse: "clickhouse";
60
+ doris: "doris";
61
+ sqlserver: "sqlserver";
55
62
  }>;
56
63
  host: z.ZodString;
57
64
  port: z.ZodString;
58
65
  user: z.ZodString;
59
66
  database: z.ZodString;
60
67
  readonly: z.ZodBoolean;
68
+ secure: z.ZodOptional<z.ZodBoolean>;
61
69
  updatedAt: z.ZodString;
62
70
  }, z.core.$strict>;
63
71
  /** Single source of truth for the storage layout and durable validation. */
@@ -71,5 +79,7 @@ export declare const connectionStorageSpec: {
71
79
  };
72
80
  };
73
81
  export type ConnectionStorageDomain = Domain<typeof connectionStorageSpec>;
82
+ /** Select the newest successful profile with a deterministic id tie-break. */
83
+ export declare function latestConnectionProfile(entries: Iterable<readonly [string, PersistedConnectionProfile]>): PersistedConnectionProfileEntry | undefined;
74
84
  /** Project a typed DSH domain handle onto the service's persistence seam. */
75
85
  export declare function createDomainConnectionPersistence(domain: ConnectionStorageDomain): ConnectionPersistence;
@@ -2,7 +2,7 @@
2
2
  * Shared structured read-query execution extracted from the sql-query tool
3
3
  * (task 2.1). Both sql-query and render-analysis run every read dataset
4
4
  * through this helper, so connection resolution, single-statement assertion,
5
- * read classification, LIMIT/maxRows enforcement, client execution, secret
5
+ * read classification, dialect-aware maxRows enforcement, client execution, secret
6
6
  * redaction, timeout/cancellation, non-zero-exit surfacing and structured
7
7
  * parsing share one code path. Existing sql-query behavior and messages stay
8
8
  * unchanged.
@@ -45,6 +45,6 @@ export declare function runnerOptions(resolved: Pick<ResolvedRunnerConfig, 'quer
45
45
  /**
46
46
  * Execute one read-only SQL through the structured client template and parse
47
47
  * it into the canonical { columns, rows } shape, with maxRows enforced at both
48
- * the SQL level (LIMIT injection) and the parse level.
48
+ * the SQL level (dialect rewrite) and the parse level.
49
49
  */
50
50
  export declare function runStructuredReadQuery(ctx: Context, connection: DatabaseConnection, sql: string, resolved: ResolvedRunnerConfig, toolName: string, signal: AbortSignal): Promise<StructuredReadResult>;
@@ -4,7 +4,7 @@
4
4
  * {@link buildStructuredQueryTemplate} in `src/clients.ts`); this module turns
5
5
  * that captured stdout into the canonical `{ columns, rows }` shape and
6
6
  * enforces the row cap a second time (first line of defense is the SQL-level
7
- * LIMIT injection, second is truncation while parsing).
7
+ * dialect-aware SQL rewriting, second is truncation while parsing).
8
8
  *
9
9
  * The parsers are deliberately output-shape based, not grammar based. Values
10
10
  * stay as strings because every client renders SQL values as text (NULL
@@ -30,7 +30,7 @@ export interface Config {
30
30
  queryTimeoutMs: number;
31
31
  /** In-memory cap on captured output. */
32
32
  maxResultChars: number;
33
- /** Enforced read-query row cap (LIMIT injection + structured truncation). */
33
+ /** Enforced read-query row cap (dialect rewrite + structured truncation). */
34
34
  maxRows: number;
35
35
  /** Maximum SQL text length accepted per dataset statement. */
36
36
  maxQueryChars: number;
@@ -50,11 +50,11 @@ export declare const Config: z<Schemastery.ObjectS<{
50
50
  command?: string | null | undefined;
51
51
  args?: string[] | null | undefined;
52
52
  searchPaths?: string[] | null | undefined;
53
- } & import("@deepseek-ai/cosmokit").Dict, string>, import("cosmokit").Dict<Schemastery.ObjectT<{
53
+ } & import("@deepseek-ai/cosmokit").Dict, "mysql" | "postgres" | "sqlite" | "oracle" | "hive" | "impala" | "doris" | "sqlserver">, import("cosmokit").Dict<Schemastery.ObjectT<{
54
54
  command: z<string, string>;
55
55
  args: z<string[], string[]>;
56
56
  searchPaths: z<string[], string[]>;
57
- }>, string>>;
57
+ }>, "mysql" | "postgres" | "sqlite" | "oracle" | "hive" | "impala" | "doris" | "sqlserver">>;
58
58
  }>, Schemastery.ObjectT<{
59
59
  queryTimeoutMs: z<number, number>;
60
60
  maxResultChars: z<number, number>;
@@ -65,11 +65,11 @@ export declare const Config: z<Schemastery.ObjectS<{
65
65
  command?: string | null | undefined;
66
66
  args?: string[] | null | undefined;
67
67
  searchPaths?: string[] | null | undefined;
68
- } & import("@deepseek-ai/cosmokit").Dict, string>, import("cosmokit").Dict<Schemastery.ObjectT<{
68
+ } & import("@deepseek-ai/cosmokit").Dict, "mysql" | "postgres" | "sqlite" | "oracle" | "hive" | "impala" | "doris" | "sqlserver">, import("cosmokit").Dict<Schemastery.ObjectT<{
69
69
  command: z<string, string>;
70
70
  args: z<string[], string[]>;
71
71
  searchPaths: z<string[], string[]>;
72
- }>, string>>;
72
+ }>, "mysql" | "postgres" | "sqlite" | "oracle" | "hive" | "impala" | "doris" | "sqlserver">>;
73
73
  }>>;
74
74
  /**
75
75
  * Mount the data-agent database tools: `sql-query` (structured read-only),
@@ -8,9 +8,10 @@
8
8
  * listeners exactly. It never imports dsh-tui, React, or Ink.
9
9
  * @module @yejiming/dsh-data-agent/tui-connection-form
10
10
  */
11
- import type { ConnectionFormDraft, DatabaseConnectionInput, DatabaseType } from './connections.ts';
12
- export declare const TUI_DATABASE_TYPES: readonly ["mysql", "postgres", "sqlite", "oracle", "hive", "impala"];
13
- export type TuiConnectionField = 'type' | 'host' | 'port' | 'user' | 'database' | 'password' | 'readonly' | 'confirm' | 'cancel';
11
+ import { type ConnectionFormDraft, type ConnectionFormInitial, type DatabaseConnectionInput } from './connections.ts';
12
+ import { type DatabaseType } from './database-types.ts';
13
+ export declare const TUI_DATABASE_TYPES: readonly ["mysql", "postgres", "sqlite", "oracle", "hive", "impala", "clickhouse", "doris", "sqlserver"];
14
+ export type TuiConnectionField = 'type' | 'host' | 'port' | 'user' | 'database' | 'password' | 'passwordRef' | 'secure' | 'readonly' | 'confirm' | 'cancel';
14
15
  export interface TuiConnectionFormState {
15
16
  type: DatabaseType;
16
17
  host: string;
@@ -18,11 +19,13 @@ export interface TuiConnectionFormState {
18
19
  user: string;
19
20
  database: string;
20
21
  password: string;
22
+ passwordRef: string;
23
+ secure: boolean;
21
24
  readonly: boolean;
22
25
  focus: TuiConnectionField;
23
26
  cursor: number;
24
27
  selector?: {
25
- field: 'type' | 'readonly';
28
+ field: 'type' | 'readonly' | 'secure';
26
29
  index: number;
27
30
  };
28
31
  error?: string;
@@ -71,17 +74,17 @@ export interface RunTuiConnectionFormOptions {
71
74
  input?: TuiFormInput;
72
75
  output?: TuiFormOutput;
73
76
  signal?: AbortSignal;
74
- initialDraft?: ConnectionFormDraft;
77
+ initialDraft?: ConnectionFormInitial;
75
78
  persistDraft?: (draft: ConnectionFormDraft) => void | Promise<void>;
76
79
  }
77
80
  /** Initial form intentionally leaves host/port empty so placeholders are real defaults. */
78
- export declare function createTuiConnectionFormState(initialDraft?: ConnectionFormDraft): TuiConnectionFormState;
81
+ export declare function createTuiConnectionFormState(initialDraft?: ConnectionFormInitial): TuiConnectionFormState;
79
82
  /** Project form state onto the only values allowed to cross the durable seam. */
80
83
  export declare function connectionFormDraft(state: TuiConnectionFormState): ConnectionFormDraft;
81
84
  /** Relevant focus order for the selected database kind. */
82
85
  export declare function tuiConnectionFields(type: DatabaseType): readonly TuiConnectionField[];
83
86
  /** Default network port shown as a placeholder and applied only at submit time. */
84
- export declare function defaultDatabasePort(type: Exclude<DatabaseType, 'sqlite'>): number;
87
+ export declare function defaultDatabasePort(type: Exclude<DatabaseType, 'sqlite'>, secure?: boolean): number;
85
88
  /** Detect the supported host without coupling to dsh-tui modules. */
86
89
  export declare function isDshTuiTerminal(argv?: readonly string[], input?: Pick<TuiFormInput, 'isTTY'>, output?: Pick<TuiFormOutput, 'isTTY'>): boolean;
87
90
  /** Pure keyboard reducer, kept separate from terminal ownership for regression tests. */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@yejiming/dsh-data-agent",
3
3
  "description": "Data Agent for DSH Web and TUI: shared database connections, a masked TUI form, secure credential references, SQL tools, and the data-agent preset",
4
- "version": "0.0.11",
4
+ "version": "0.0.13",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -36,6 +36,10 @@
36
36
  "types": "./lib/types/invariant.d.ts",
37
37
  "default": "./lib/invariant.js"
38
38
  },
39
+ "./ecosystem": {
40
+ "types": "./lib/types/ecosystem.d.ts",
41
+ "default": "./lib/ecosystem.js"
42
+ },
39
43
  "./client": {
40
44
  "types": "./lib/types/client/index.d.ts",
41
45
  "default": "./lib/client.js"
@@ -63,40 +67,47 @@
63
67
  "watch": "tsdown --watch",
64
68
  "build": "rm -rf lib && tsdown && tsc -p tsconfig.build.json && tsc -p tsconfig.client.json",
65
69
  "typecheck": "tsc --noEmit",
66
- "test": "vitest run"
70
+ "test": "vitest run",
71
+ "conformance": "node scripts/dsh-ecosystem-conformance.mjs",
72
+ "conformance:artifact": "node scripts/dsh-ecosystem-pack-evidence.mjs"
67
73
  },
68
74
  "files": [
69
75
  "lib/**",
70
76
  "cordis.patch.yml",
71
- "preset/**"
77
+ "preset/**",
78
+ "dsh-plugin.json",
79
+ "conformance/dsh-ecosystem/**"
72
80
  ],
73
81
  "license": "MIT",
74
82
  "dependencies": {
83
+ "@clickhouse/client": "~1.23.1",
84
+ "@dsh-std/sdk": "0.1.0-rc1",
75
85
  "echarts": "^6.1.0",
86
+ "fflate": "0.8.3",
76
87
  "schemastery": "^3.18.0",
77
88
  "zod": "^4.4.3"
78
89
  },
79
90
  "peerDependencies": {
80
91
  "@deepseek-ai/cordis": "^4.0.1",
81
- "@deepseek-ai/dsh-agent": "^0.1.0-rc.6",
82
- "@deepseek-ai/dsh-agent-presets": "^0.1.0-rc.6",
83
- "@deepseek-ai/dsh-client-locale": "^0.1.0-rc.6",
84
- "@deepseek-ai/dsh-client-runtime": "^0.1.0-rc.6",
85
- "@deepseek-ai/dsh-client-ui-conversation": "^0.1.0-rc.6",
86
- "@deepseek-ai/dsh-client-ui-primitives": "^0.1.0-rc.6",
87
- "@deepseek-ai/dsh-client-ui-slots": "^0.1.0-rc.6",
88
- "@deepseek-ai/dsh-client-ui-tool": "^0.1.0-rc.6",
89
- "@deepseek-ai/dsh-commands": "^0.1.0-rc.6",
90
- "@deepseek-ai/dsh-credentials": "^0.1.0-rc.6",
91
- "@deepseek-ai/dsh-host-webserver": "^0.1.0-rc.6",
92
- "@deepseek-ai/dsh-invariants": "^0.1.0-rc.6",
93
- "@deepseek-ai/dsh-scope": "^0.1.0-rc.6",
94
- "@deepseek-ai/dsh-storage": "^0.1.0-rc.6",
95
- "@deepseek-ai/dsh-storage-domain": "^0.1.0-rc.6",
96
- "@deepseek-ai/dsh-storage-json": "^0.1.0-rc.6",
97
- "@deepseek-ai/dsh-subprocess": "^0.1.0-rc.6",
98
- "@deepseek-ai/dsh-tools": "^0.1.0-rc.6",
99
- "@deepseek-ai/dsh-user-questions": "^0.1.0-rc.6",
92
+ "@deepseek-ai/dsh-agent": "^0.1.0-rc.7",
93
+ "@deepseek-ai/dsh-agent-presets": "^0.1.0-rc.7",
94
+ "@deepseek-ai/dsh-client-locale": "^0.1.0-rc.7",
95
+ "@deepseek-ai/dsh-client-runtime": "^0.1.0-rc.7",
96
+ "@deepseek-ai/dsh-client-ui-conversation": "^0.1.0-rc.7",
97
+ "@deepseek-ai/dsh-client-ui-primitives": "^0.1.0-rc.7",
98
+ "@deepseek-ai/dsh-client-ui-slots": "^0.1.0-rc.7",
99
+ "@deepseek-ai/dsh-client-ui-tool": "^0.1.0-rc.7",
100
+ "@deepseek-ai/dsh-commands": "^0.1.0-rc.7",
101
+ "@deepseek-ai/dsh-credentials": "^0.1.0-rc.7",
102
+ "@deepseek-ai/dsh-host-webserver": "^0.1.0-rc.7",
103
+ "@deepseek-ai/dsh-invariants": "^0.1.0-rc.7",
104
+ "@deepseek-ai/dsh-scope": "^0.1.0-rc.7",
105
+ "@deepseek-ai/dsh-storage": "^0.1.0-rc.7",
106
+ "@deepseek-ai/dsh-storage-domain": "^0.1.0-rc.7",
107
+ "@deepseek-ai/dsh-storage-json": "^0.1.0-rc.7",
108
+ "@deepseek-ai/dsh-subprocess": "^0.1.0-rc.7",
109
+ "@deepseek-ai/dsh-tools": "^0.1.0-rc.7",
110
+ "@deepseek-ai/dsh-user-questions": "^0.1.0-rc.7",
100
111
  "react": "^18.2.0 || ^19.0.0"
101
112
  },
102
113
  "peerDependenciesMeta": {
@@ -130,26 +141,39 @@
130
141
  },
131
142
  "devDependencies": {
132
143
  "@deepseek-ai/cordis": "^4.0.1",
133
- "@deepseek-ai/dsh-agent": "^0.1.0-rc.6",
134
- "@deepseek-ai/dsh-agent-presets": "^0.1.0-rc.6",
135
- "@deepseek-ai/dsh-client-locale": "^0.1.0-rc.6",
136
- "@deepseek-ai/dsh-client-runtime": "^0.1.0-rc.6",
137
- "@deepseek-ai/dsh-client-ui-conversation": "^0.1.0-rc.6",
138
- "@deepseek-ai/dsh-client-ui-primitives": "^0.1.0-rc.6",
139
- "@deepseek-ai/dsh-client-ui-slots": "^0.1.0-rc.6",
140
- "@deepseek-ai/dsh-client-ui-tool": "0.1.0-rc.6",
141
- "@deepseek-ai/dsh-commands": "^0.1.0-rc.6",
142
- "@deepseek-ai/dsh-credentials": "^0.1.0-rc.6",
143
- "@deepseek-ai/dsh-host-webserver": "^0.1.0-rc.6",
144
- "@deepseek-ai/dsh-invariants": "^0.1.0-rc.6",
145
- "@deepseek-ai/dsh-scope": "^0.1.0-rc.6",
146
- "@deepseek-ai/dsh-storage": "^0.1.0-rc.6",
147
- "@deepseek-ai/dsh-storage-domain": "^0.1.0-rc.6",
148
- "@deepseek-ai/dsh-storage-json": "^0.1.0-rc.6",
149
- "@deepseek-ai/dsh-subprocess": "^0.1.0-rc.6",
150
- "@deepseek-ai/dsh-subprocess-local": "0.1.0-rc.6",
151
- "@deepseek-ai/dsh-tools": "^0.1.0-rc.6",
152
- "@deepseek-ai/dsh-user-questions": "^0.1.0-rc.6",
144
+ "@deepseek-ai/dsh-agent": "^0.1.0-rc.7",
145
+ "@deepseek-ai/dsh-agent-presets": "^0.1.0-rc.7",
146
+ "@deepseek-ai/dsh-attachment": "0.1.0-rc.7",
147
+ "@deepseek-ai/dsh-client-locale": "^0.1.0-rc.7",
148
+ "@deepseek-ai/dsh-client-runtime": "^0.1.0-rc.7",
149
+ "@deepseek-ai/dsh-client-ui-conversation": "^0.1.0-rc.7",
150
+ "@deepseek-ai/dsh-client-ui-primitives": "^0.1.0-rc.7",
151
+ "@deepseek-ai/dsh-client-ui-settings": "0.1.0-rc.7",
152
+ "@deepseek-ai/dsh-client-ui-slots": "^0.1.0-rc.7",
153
+ "@deepseek-ai/dsh-client-ui-tool": "0.1.0-rc.7",
154
+ "@deepseek-ai/dsh-commands": "^0.1.0-rc.7",
155
+ "@deepseek-ai/dsh-credentials": "^0.1.0-rc.7",
156
+ "@deepseek-ai/dsh-host-webserver": "^0.1.0-rc.7",
157
+ "@deepseek-ai/dsh-invariants": "^0.1.0-rc.7",
158
+ "@deepseek-ai/dsh-llm": "0.1.0-rc.7",
159
+ "@deepseek-ai/dsh-scope": "^0.1.0-rc.7",
160
+ "@deepseek-ai/dsh-session": "0.1.0-rc.7",
161
+ "@deepseek-ai/dsh-storage": "^0.1.0-rc.7",
162
+ "@deepseek-ai/dsh-storage-domain": "^0.1.0-rc.7",
163
+ "@deepseek-ai/dsh-storage-json": "^0.1.0-rc.7",
164
+ "@deepseek-ai/dsh-subprocess": "^0.1.0-rc.7",
165
+ "@deepseek-ai/dsh-subprocess-local": "0.1.0-rc.7",
166
+ "@deepseek-ai/dsh-tools": "^0.1.0-rc.7",
167
+ "@deepseek-ai/dsh-typert-protocol": "0.1.0-rc.7",
168
+ "@deepseek-ai/dsh-user-questions": "^0.1.0-rc.7",
169
+ "@deepseek-ai/schemastery": "3.18.1",
170
+ "@dsh-std/adapter-dsh": "0.1.0-rc3",
171
+ "@dsh-std/command": "0.1.0-rc2",
172
+ "@dsh-std/core": "0.1.0-rc1",
173
+ "@dsh-std/lifecycle": "0.1.0-rc1",
174
+ "@dsh-std/manifest": "0.1.0-rc1",
175
+ "@dsh-std/presentation": "0.1.0-rc1",
176
+ "@dsh-std/storage": "0.1.0-rc1",
153
177
  "@testing-library/dom": "^10.4.1",
154
178
  "@testing-library/react": "^16.3.2",
155
179
  "@types/node": "^25.0.0",
@@ -27,15 +27,20 @@
27
27
  你是数据工程师 Agent。工作目录 {{cwd}}。可用工具:sql-query(只读 SQL,返回结构化
28
28
  JSON 结果)、sql-write(写/管理 SQL,单条自动提交)、sql-cmd(原始客户端输出,兼容
29
29
  SHOW TABLES、DESCRIBE users 等命令)、str_replace_editor(查看、创建和修改本地文件)。
30
- Web 界面可用时另有 render-analysis:把一次调用渲染成一份版本化分析报告(1-6 个只读
31
- 数据集、1-8 个 metric/line/bar/pie/scatter/table 视图,同一数据集可被多个视图通过
32
- datasetId 复用)。是否生成分析由你自主判断:先用 sql-query 探查表结构与样例数据并
30
+ 另有 render-analysis:把一次调用渲染成一份版本化分析
31
+ 报告(1-6 个只读数据集、1-8 个 metric/line/bar/pie/scatter/table 视图,同一数据集可被
32
+ 多个视图通过 datasetId 复用),并在当前工作目录的 analysis-reports/ 中保存离线 HTML
33
+ Dashboard。Web 可同时打开分析面板;TUI 只返回 HTML 路径,不输出字符图。是否生成分析
34
+ 由你自主判断:先用 sql-query 探查表结构与样例数据并
33
35
  核对事实(禁止臆造表名与列名);schema 探查、单标量或原始明细等无视觉增益的查询
34
36
  直接回答、不强制画图;简单关系可生成一个主图,涉及多指标、时间或分群的复杂问题可
35
37
  生成 3-6 个互补视图。聚合、Top N、排序必须写在 SQL 中,line/time 数据需 ORDER BY。
36
38
  工作流:先用 str_replace_editor 把 SQL 写入 .sql 文件,再用 sql-query 执行只读查询或
37
39
  sql-write 执行写入并核对结果;结果可疑时缩小查询范围重试。每次数据库工具调用
38
- 只允许一条 SQL 语句。
40
+ 只允许一条 SQL 语句。根据当前连接使用正确方言:SQL Server使用TOP或OFFSET/FETCH,
41
+ 不使用LIMIT,也不输出GO、冒号命令、!!或sqlcmd变量;ClickHouse、Doris等支持LIMIT的
42
+ 数据库才使用LIMIT。Doris首版只按当前/internal catalog浏览,不臆造外部catalog层级;
43
+ 未经真实部署验证,不宣称任意ClickHouse Cloud或TLS组合都可用。
39
44
 
40
45
  # ── filesystem ──────────────────────────────────────────────────────────────
41
46
 
@@ -1,21 +0,0 @@
1
- //#region src/defaults.ts
2
- /**
3
- * Package-wide defaults shared by the server half (`src/index.ts`) and the
4
- * database tool half (`src/tool.ts`). Loader schemas carry these as their
5
- * defaults so a deployment may override every one of them in cordis.yml.
6
- * @module @yejiming/dsh-data-agent/defaults
7
- */
8
- /** Preset directory name installed into `$DSH_HOME/.agent-presets/`. */
9
- const DEFAULT_PRESET_ID = "data-agent";
10
- /** End-to-end deadline for one `/connect` connectivity check, milliseconds. */
11
- const DEFAULT_CONNECT_TIMEOUT_MS = 1e4;
12
- /** End-to-end deadline for one database-tool query, milliseconds. */
13
- const DEFAULT_QUERY_TIMEOUT_MS = 3e4;
14
- /** In-memory cap on database-tool captured output (stdout and stderr each). */
15
- const DEFAULT_MAX_RESULT_CHARS = 2e4;
16
- /** Cap on one /query SQL text length (abuse guard; the wire body stays small). */
17
- const DEFAULT_MAX_QUERY_CHARS = 65536;
18
- /** Grace period for the subprocess terminate escalation. */
19
- const DEFAULT_GRACE_MS = 5e3;
20
- //#endregion
21
- export { DEFAULT_PRESET_ID as a, DEFAULT_MAX_RESULT_CHARS as i, DEFAULT_GRACE_MS as n, DEFAULT_QUERY_TIMEOUT_MS as o, DEFAULT_MAX_QUERY_CHARS as r, DEFAULT_CONNECT_TIMEOUT_MS as t };