@yejiming/dsh-data-agent 0.0.12 → 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.
Files changed (60) hide show
  1. package/README.en.md +97 -16
  2. package/README.md +97 -16
  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 +100 -0
  11. package/conformance/dsh-ecosystem/restrictions.json +20 -0
  12. package/cordis.patch.yml +6 -3
  13. package/dsh-plugin.json +72 -0
  14. package/lib/catalog-DEJqOXRo.js +1944 -0
  15. package/lib/catalog-identity-CVftmvQL.js +96 -0
  16. package/lib/client.js +3465 -138
  17. package/lib/client.js.map +1 -1
  18. package/lib/command-CzzSPmag.js +1719 -0
  19. package/lib/command.js +2 -2
  20. package/lib/{connections-5sfdEDsG.js → connections-CFXOZTHZ.js} +964 -68
  21. package/lib/ecosystem.js +19 -0
  22. package/lib/index.js +392 -34
  23. package/lib/routes.js +260 -8
  24. package/lib/{tool-DgL0fBfj.js → tool-DNkywSph.js} +367 -168
  25. package/lib/tool.js +1 -1
  26. package/lib/types/catalog-adapters.d.ts +52 -0
  27. package/lib/types/catalog-ai.d.ts +49 -0
  28. package/lib/types/catalog-command.d.ts +28 -0
  29. package/lib/types/catalog-identity.d.ts +23 -0
  30. package/lib/types/catalog-storage.d.ts +265 -0
  31. package/lib/types/catalog-tools.d.ts +5 -0
  32. package/lib/types/catalog-tui.d.ts +18 -0
  33. package/lib/types/catalog-types.d.ts +1376 -0
  34. package/lib/types/catalog.d.ts +59 -0
  35. package/lib/types/client/CatalogPanel.d.ts +15 -0
  36. package/lib/types/client/DataAgentWorkbench.d.ts +1 -2
  37. package/lib/types/client/QueryResultTable.d.ts +13 -0
  38. package/lib/types/client/catalog-client.d.ts +57 -0
  39. package/lib/types/client/locales.d.ts +290 -0
  40. package/lib/types/client/persistence.d.ts +3 -1
  41. package/lib/types/client/query-export.d.ts +11 -0
  42. package/lib/types/client-discovery.d.ts +3 -4
  43. package/lib/types/clients.d.ts +14 -8
  44. package/lib/types/command.d.ts +16 -5
  45. package/lib/types/connections.d.ts +42 -4
  46. package/lib/types/database-types.d.ts +23 -0
  47. package/lib/types/defaults.d.ts +26 -0
  48. package/lib/types/ecosystem.d.ts +13 -0
  49. package/lib/types/index.d.ts +58 -15
  50. package/lib/types/query.d.ts +13 -11
  51. package/lib/types/sql.d.ts +9 -1
  52. package/lib/types/storage.d.ts +11 -1
  53. package/lib/types/structured-read.d.ts +2 -2
  54. package/lib/types/structured.d.ts +1 -1
  55. package/lib/types/tool.d.ts +5 -5
  56. package/lib/types/tui-connection-form.d.ts +21 -12
  57. package/package.json +30 -4
  58. package/preset/data-agent/agent.cordis.yml +13 -2
  59. package/lib/command-DuCpwVbl.js +0 -875
  60. package/lib/defaults-DP4RyRh1.js +0 -21
@@ -0,0 +1,59 @@
1
+ /** Shared Catalog service: scan lifecycle, version projections, search, and review. */
2
+ import { type DataAgentConnections } from './connections.ts';
3
+ import { type CatalogAssetDetail, type CatalogDiffPage, type CatalogRun, type CatalogSearchPage, type CatalogSearchRequest, type CatalogSemanticRevision, type CatalogSource, type CatalogStatusSummary, type MetricDefinition, type SemanticDefinition, type StartCatalogScanInput } from './catalog-types.ts';
4
+ import type { CatalogMeaningGenerator } from './catalog-ai.ts';
5
+ import type { CatalogAdapter } from './catalog-adapters.ts';
6
+ import type { CatalogPersistence } from './catalog-storage.ts';
7
+ export interface CatalogServiceOptions {
8
+ maxAssetsPerRun: number;
9
+ maxTextChars: number;
10
+ pageSize: number;
11
+ maxPageSize: number;
12
+ schemaConcurrency: number;
13
+ assetConcurrency: number;
14
+ now?: () => Date;
15
+ randomId?: () => string;
16
+ adapters?: Readonly<Record<string, CatalogAdapter>>;
17
+ meaningGenerator?: CatalogMeaningGenerator;
18
+ logger?: {
19
+ warn(message: string, ...args: unknown[]): void;
20
+ };
21
+ }
22
+ export type { CatalogStatusSummary, StartCatalogScanInput } from './catalog-types.ts';
23
+ /** Read-only face injected into model tools and all surface adapters. */
24
+ export interface DataAgentCatalog {
25
+ listSources(): CatalogSource[];
26
+ listRuns(sourceId: string, limit?: number): CatalogRun[];
27
+ resolveSource(sessionId: string, requestedSourceId?: string): Promise<CatalogSource>;
28
+ status(sourceId: string): CatalogStatusSummary | undefined;
29
+ search(request: CatalogSearchRequest): Promise<CatalogSearchPage>;
30
+ getAsset(sourceId: string, assetId: string, cursor?: string, pageSize?: number): CatalogAssetDetail;
31
+ getSemantic(sourceId: string, semanticId: string, version?: number): CatalogSemanticRevision;
32
+ getMetric(sourceId: string, metricId: string, version?: number): CatalogSemanticRevision & {
33
+ definition: MetricDefinition;
34
+ };
35
+ diff(sourceId: string, fromRunId?: string, toRunId?: string, cursor?: string, pageSize?: number): CatalogDiffPage;
36
+ }
37
+ /** Mutation face used only by the dsh-tui `/catalog` command and Web routes. */
38
+ export interface DataAgentCatalogScanner {
39
+ start(input: StartCatalogScanInput): Promise<CatalogRun>;
40
+ cancel(sourceId: string, runId?: string): Promise<CatalogRun>;
41
+ interruptActiveRuns(): Promise<void>;
42
+ }
43
+ /** Human review face; never injected into the model-tool plugin. */
44
+ export interface DataAgentCatalogReview {
45
+ saveCandidate(sourceId: string, definition: SemanticDefinition, semanticId?: string, expectedVersion?: number): Promise<CatalogSemanticRevision>;
46
+ verify(sourceId: string, semanticId: string, expectedVersion: number, definition: SemanticDefinition): Promise<CatalogSemanticRevision>;
47
+ retire(sourceId: string, semanticId: string, expectedVersion: number, revisionNote: string): Promise<CatalogSemanticRevision>;
48
+ dismissMeaning(sourceId: string, semanticId: string, expectedVersion: number): Promise<CatalogSemanticRevision>;
49
+ }
50
+ export interface CatalogServiceBundle {
51
+ read: DataAgentCatalog;
52
+ scanner: DataAgentCatalogScanner;
53
+ review: DataAgentCatalogReview;
54
+ }
55
+ export declare class CatalogVersionConflictError extends Error {
56
+ readonly current: CatalogSemanticRevision;
57
+ constructor(current: CatalogSemanticRevision);
58
+ }
59
+ export declare function createCatalogService(connections: DataAgentConnections, persistence: CatalogPersistence, options: CatalogServiceOptions): Promise<CatalogServiceBundle>;
@@ -0,0 +1,15 @@
1
+ import type { DataAgentKey } from './locales.ts';
2
+ type T = (key: DataAgentKey, values?: Record<string, string | number>) => string;
3
+ interface CatalogPanelProps {
4
+ id: string;
5
+ labelledBy: string;
6
+ active: boolean;
7
+ sessionId: string;
8
+ connected: boolean;
9
+ connectionProfileId?: string;
10
+ stateKey: object;
11
+ t: T;
12
+ onAvailabilityChange(available: boolean): void;
13
+ }
14
+ export declare function CatalogPanel(props: CatalogPanelProps): import("react").JSX.Element;
15
+ export {};
@@ -1,6 +1,5 @@
1
1
  import type { InjectFace, PropsLocale, PropsRuntime } from '@deepseek-ai/dsh-client-ui-slots';
2
- /** Database kinds offered by the connection form. */
3
- export type DatabaseType = 'mysql' | 'postgres' | 'sqlite' | 'oracle' | 'hive' | 'impala';
2
+ export type { DatabaseType } from '../database-types.ts';
4
3
  /** The sessions-list slice the workbench needs (structural; avoids a runtime import). */
5
4
  export interface SessionListLike {
6
5
  byId: Record<string, {
@@ -0,0 +1,13 @@
1
+ import type { TranslateNS } from '@deepseek-ai/dsh-client-ui-slots';
2
+ export interface StructuredWorkbenchResult {
3
+ kind: 'table';
4
+ columns: string[];
5
+ rows: Record<string, string | null>[];
6
+ elapsedMs: number;
7
+ truncated: boolean;
8
+ maxRows: number;
9
+ }
10
+ export declare function QueryResultTable({ result, t, }: {
11
+ result: StructuredWorkbenchResult;
12
+ t: TranslateNS<'data-agent'>;
13
+ }): import("react").JSX.Element;
@@ -0,0 +1,57 @@
1
+ /** Browser-only Catalog route client and wire contracts. */
2
+ import type { CatalogAssetDetail, CatalogDiffPage, CatalogRun, CatalogScope, CatalogSearchItem, CatalogSearchPage, CatalogSemanticRevision, CatalogSource, SemanticDefinition } from '../catalog-types.ts';
3
+ export interface CatalogStatusWire {
4
+ source: CatalogSource;
5
+ activeRun?: CatalogRun;
6
+ latestRun?: CatalogRun;
7
+ latestSuccessfulRun?: CatalogRun;
8
+ counts: {
9
+ assets: number;
10
+ fields: number;
11
+ needsReview: number;
12
+ };
13
+ }
14
+ export type { CatalogAssetDetail, CatalogDiffPage, CatalogRun, CatalogScope, CatalogSearchItem, CatalogSearchPage, CatalogSemanticRevision, CatalogSource, SemanticDefinition, };
15
+ export declare function listCatalogSources(signal?: AbortSignal): Promise<CatalogSource[]>;
16
+ export declare function getCatalogStatus(sourceId: string, signal?: AbortSignal): Promise<CatalogStatusWire | null>;
17
+ export declare function listCatalogRuns(sourceId: string, signal?: AbortSignal): Promise<CatalogRun[]>;
18
+ export declare function searchCatalog(input: {
19
+ sourceId: string;
20
+ query: string;
21
+ schema?: string;
22
+ assetKinds?: string[];
23
+ semanticKinds?: string[];
24
+ assetStatuses?: string[];
25
+ semanticStatuses?: string[];
26
+ includeInferred?: boolean;
27
+ cursor?: string;
28
+ pageSize?: number;
29
+ }, signal?: AbortSignal): Promise<CatalogSearchPage>;
30
+ export declare function getCatalogAsset(sourceId: string, assetId: string, cursor?: string, signal?: AbortSignal): Promise<CatalogAssetDetail>;
31
+ export declare function getCatalogSemantic(sourceId: string, semanticId: string, version?: number, signal?: AbortSignal): Promise<CatalogSemanticRevision>;
32
+ export declare function startCatalogScan(sessionId: string, scope: CatalogScope): Promise<CatalogRun>;
33
+ export declare function cancelCatalogScan(sourceId: string, runId?: string): Promise<CatalogRun>;
34
+ export declare function getCatalogDiff(sourceId: string, from?: string, to?: string, cursor?: string): Promise<CatalogDiffPage>;
35
+ export declare function saveCatalogCandidate(input: {
36
+ sourceId: string;
37
+ semanticId?: string;
38
+ expectedVersion?: number;
39
+ definition: SemanticDefinition;
40
+ }): Promise<CatalogSemanticRevision>;
41
+ export declare function verifyCatalogSemantic(input: {
42
+ sourceId: string;
43
+ semanticId: string;
44
+ expectedVersion: number;
45
+ definition: SemanticDefinition;
46
+ }): Promise<CatalogSemanticRevision>;
47
+ export declare function retireCatalogSemantic(input: {
48
+ sourceId: string;
49
+ semanticId: string;
50
+ expectedVersion: number;
51
+ revisionNote: string;
52
+ }): Promise<CatalogSemanticRevision>;
53
+ export declare function dismissCatalogMeaning(input: {
54
+ sourceId: string;
55
+ semanticId: string;
56
+ expectedVersion: number;
57
+ }): Promise<CatalogSemanticRevision>;
@@ -13,6 +13,9 @@ export declare const zh: {
13
13
  'type.oracle': string;
14
14
  'type.hive': string;
15
15
  'type.impala': string;
16
+ 'type.clickhouse': string;
17
+ 'type.doris': string;
18
+ 'type.sqlserver': string;
16
19
  'form.host': string;
17
20
  'form.port': string;
18
21
  'form.user': string;
@@ -28,6 +31,8 @@ export declare const zh: {
28
31
  'form.rememberPassword.hint': string;
29
32
  'form.readonly': string;
30
33
  'form.readonly.hint': string;
34
+ 'form.secure': string;
35
+ 'form.secure.hint': string;
31
36
  'form.database': string;
32
37
  'form.database.oracle': string;
33
38
  'form.database.hive': string;
@@ -57,16 +62,156 @@ export declare const zh: {
57
62
  'wb.columns': string;
58
63
  'wb.sql': string;
59
64
  'wb.sql.placeholder': string;
65
+ 'wb.sql.placeholder.sqlserver': string;
60
66
  'wb.sql.run': string;
61
67
  'wb.sql.running': string;
62
68
  'wb.sql.shortcut': string;
63
69
  'wb.sql.empty': string;
70
+ 'wb.sql.result.summary': string;
71
+ 'wb.sql.result.capped': string;
72
+ 'wb.sql.result.outputTruncated': string;
73
+ 'wb.sql.result.table': string;
74
+ 'wb.sql.result.noRows': string;
75
+ 'wb.sql.command.done': string;
76
+ 'wb.sql.export.actions': string;
77
+ 'wb.sql.export.excel': string;
78
+ 'wb.sql.export.csv': string;
79
+ 'wb.sql.export.clipboard': string;
80
+ 'wb.sql.exporting': string;
81
+ 'wb.sql.copying': string;
82
+ 'wb.sql.export.done': string;
83
+ 'wb.sql.copy.done': string;
84
+ 'wb.sql.export.failed': string;
85
+ 'wb.sql.page.summary': string;
86
+ 'wb.sql.page.previous': string;
87
+ 'wb.sql.page.next': string;
64
88
  'wb.loading': string;
65
89
  'wb.empty': string;
66
90
  'wb.modal.title': string;
67
91
  'wb.hint.click': string;
68
92
  'action.config': string;
69
93
  'action.browse': string;
94
+ 'action.catalog': string;
95
+ 'catalog.source': string;
96
+ 'catalog.source.current': string;
97
+ 'catalog.empty': string;
98
+ 'catalog.search': string;
99
+ 'catalog.schema': string;
100
+ 'catalog.schema.filter': string;
101
+ 'catalog.table': string;
102
+ 'catalog.validation.schema': string;
103
+ 'catalog.validation.table': string;
104
+ 'catalog.filter.all': string;
105
+ 'catalog.filter.tables': string;
106
+ 'catalog.filter.review': string;
107
+ 'catalog.filter.assetStatus': string;
108
+ 'catalog.filter.semanticStatus': string;
109
+ 'catalog.scan': string;
110
+ 'catalog.scan.all': string;
111
+ 'catalog.scan.schema': string;
112
+ 'catalog.scan.table': string;
113
+ 'catalog.scan.confirm': string;
114
+ 'catalog.section.scan': string;
115
+ 'catalog.section.diff': string;
116
+ 'catalog.cancel': string;
117
+ 'catalog.diff': string;
118
+ 'catalog.diff.from': string;
119
+ 'catalog.diff.to': string;
120
+ 'catalog.refresh': string;
121
+ 'catalog.loadMore': string;
122
+ 'catalog.status.never': string;
123
+ 'catalog.status.latest': string;
124
+ 'catalog.status.full': string;
125
+ 'catalog.status.partial': string;
126
+ 'catalog.status.failureReason': string;
127
+ 'catalog.count.assets': string;
128
+ 'catalog.count.fields': string;
129
+ 'catalog.count.review': string;
130
+ 'catalog.progress': string;
131
+ 'catalog.enrichment.label': string;
132
+ 'catalog.enrichment.progress': string;
133
+ 'catalog.enrichment.queued': string;
134
+ 'catalog.enrichment.running': string;
135
+ 'catalog.enrichment.succeeded': string;
136
+ 'catalog.enrichment.partial': string;
137
+ 'catalog.enrichment.failed': string;
138
+ 'catalog.enrichment.cancelled': string;
139
+ 'catalog.detail.technical': string;
140
+ 'catalog.detail.business': string;
141
+ 'catalog.detail.history': string;
142
+ 'catalog.detail.relations': string;
143
+ 'catalog.detail.provenance': string;
144
+ 'catalog.detail.run': string;
145
+ 'catalog.detail.name': string;
146
+ 'catalog.detail.type': string;
147
+ 'catalog.detail.nullable': string;
148
+ 'catalog.detail.parentTable': string;
149
+ 'catalog.detail.select': string;
150
+ 'catalog.detail.summary': string;
151
+ 'catalog.detail.fields': string;
152
+ 'catalog.detail.relationCount': string;
153
+ 'catalog.detail.definitionCount': string;
154
+ 'catalog.detail.scanFacts': string;
155
+ 'catalog.detail.yes': string;
156
+ 'catalog.detail.no': string;
157
+ 'catalog.detail.business.empty.title': string;
158
+ 'catalog.detail.business.empty.body': string;
159
+ 'catalog.meaning.table': string;
160
+ 'catalog.meaning.fields': string;
161
+ 'catalog.meaning.ai': string;
162
+ 'catalog.meaning.missing': string;
163
+ 'catalog.meaning.confirm': string;
164
+ 'catalog.meaning.delete': string;
165
+ 'catalog.metric.new': string;
166
+ 'catalog.term.new': string;
167
+ 'catalog.term.name': string;
168
+ 'catalog.metric.name': string;
169
+ 'catalog.semantic.aliases': string;
170
+ 'catalog.semantic.sources': string;
171
+ 'catalog.semantic.validFrom': string;
172
+ 'catalog.semantic.validTo': string;
173
+ 'catalog.metric.description': string;
174
+ 'catalog.metric.formula': string;
175
+ 'catalog.metric.grain': string;
176
+ 'catalog.metric.timeField': string;
177
+ 'catalog.metric.filters': string;
178
+ 'catalog.metric.exclusions': string;
179
+ 'catalog.metric.owner': string;
180
+ 'catalog.metric.note': string;
181
+ 'catalog.metric.save': string;
182
+ 'catalog.metric.verify': string;
183
+ 'catalog.metric.retire': string;
184
+ 'catalog.kind.schema': string;
185
+ 'catalog.kind.table': string;
186
+ 'catalog.kind.view': string;
187
+ 'catalog.kind.column': string;
188
+ 'catalog.kind.primary_key': string;
189
+ 'catalog.kind.foreign_key': string;
190
+ 'catalog.kind.index': string;
191
+ 'catalog.kind.meaning': string;
192
+ 'catalog.kind.term': string;
193
+ 'catalog.kind.metric': string;
194
+ 'catalog.warning.untrusted': string;
195
+ 'catalog.scan.reconnect': string;
196
+ 'catalog.state.observed': string;
197
+ 'catalog.state.inferred': string;
198
+ 'catalog.state.verified': string;
199
+ 'catalog.state.needs_review': string;
200
+ 'catalog.state.retired': string;
201
+ 'catalog.state.missing': string;
202
+ 'catalog.state.unavailable': string;
203
+ 'catalog.state.added': string;
204
+ 'catalog.state.changed': string;
205
+ 'catalog.state.restored': string;
206
+ 'catalog.state.queued': string;
207
+ 'catalog.state.running': string;
208
+ 'catalog.state.applying': string;
209
+ 'catalog.state.succeeded': string;
210
+ 'catalog.state.failed': string;
211
+ 'catalog.state.cancelled': string;
212
+ 'catalog.state.interrupted': string;
213
+ 'catalog.state.supported': string;
214
+ 'catalog.state.unsupported': string;
70
215
  'action.close': string;
71
216
  'error.title': string;
72
217
  'analysis.running': string;
@@ -101,6 +246,9 @@ export declare const en: {
101
246
  'type.oracle': string;
102
247
  'type.hive': string;
103
248
  'type.impala': string;
249
+ 'type.clickhouse': string;
250
+ 'type.doris': string;
251
+ 'type.sqlserver': string;
104
252
  'form.host': string;
105
253
  'form.port': string;
106
254
  'form.user': string;
@@ -116,6 +264,8 @@ export declare const en: {
116
264
  'form.rememberPassword.hint': string;
117
265
  'form.readonly': string;
118
266
  'form.readonly.hint': string;
267
+ 'form.secure': string;
268
+ 'form.secure.hint': string;
119
269
  'form.database': string;
120
270
  'form.database.oracle': string;
121
271
  'form.database.hive': string;
@@ -145,16 +295,156 @@ export declare const en: {
145
295
  'wb.columns': string;
146
296
  'wb.sql': string;
147
297
  'wb.sql.placeholder': string;
298
+ 'wb.sql.placeholder.sqlserver': string;
148
299
  'wb.sql.run': string;
149
300
  'wb.sql.running': string;
150
301
  'wb.sql.shortcut': string;
151
302
  'wb.sql.empty': string;
303
+ 'wb.sql.result.summary': string;
304
+ 'wb.sql.result.capped': string;
305
+ 'wb.sql.result.outputTruncated': string;
306
+ 'wb.sql.result.table': string;
307
+ 'wb.sql.result.noRows': string;
308
+ 'wb.sql.command.done': string;
309
+ 'wb.sql.export.actions': string;
310
+ 'wb.sql.export.excel': string;
311
+ 'wb.sql.export.csv': string;
312
+ 'wb.sql.export.clipboard': string;
313
+ 'wb.sql.exporting': string;
314
+ 'wb.sql.copying': string;
315
+ 'wb.sql.export.done': string;
316
+ 'wb.sql.copy.done': string;
317
+ 'wb.sql.export.failed': string;
318
+ 'wb.sql.page.summary': string;
319
+ 'wb.sql.page.previous': string;
320
+ 'wb.sql.page.next': string;
152
321
  'wb.loading': string;
153
322
  'wb.empty': string;
154
323
  'wb.modal.title': string;
155
324
  'wb.hint.click': string;
156
325
  'action.config': string;
157
326
  'action.browse': string;
327
+ 'action.catalog': string;
328
+ 'catalog.source': string;
329
+ 'catalog.source.current': string;
330
+ 'catalog.empty': string;
331
+ 'catalog.search': string;
332
+ 'catalog.schema': string;
333
+ 'catalog.schema.filter': string;
334
+ 'catalog.table': string;
335
+ 'catalog.validation.schema': string;
336
+ 'catalog.validation.table': string;
337
+ 'catalog.filter.all': string;
338
+ 'catalog.filter.tables': string;
339
+ 'catalog.filter.review': string;
340
+ 'catalog.filter.assetStatus': string;
341
+ 'catalog.filter.semanticStatus': string;
342
+ 'catalog.scan': string;
343
+ 'catalog.scan.all': string;
344
+ 'catalog.scan.schema': string;
345
+ 'catalog.scan.table': string;
346
+ 'catalog.scan.confirm': string;
347
+ 'catalog.section.scan': string;
348
+ 'catalog.section.diff': string;
349
+ 'catalog.cancel': string;
350
+ 'catalog.diff': string;
351
+ 'catalog.diff.from': string;
352
+ 'catalog.diff.to': string;
353
+ 'catalog.refresh': string;
354
+ 'catalog.loadMore': string;
355
+ 'catalog.status.never': string;
356
+ 'catalog.status.latest': string;
357
+ 'catalog.status.full': string;
358
+ 'catalog.status.partial': string;
359
+ 'catalog.status.failureReason': string;
360
+ 'catalog.count.assets': string;
361
+ 'catalog.count.fields': string;
362
+ 'catalog.count.review': string;
363
+ 'catalog.progress': string;
364
+ 'catalog.enrichment.label': string;
365
+ 'catalog.enrichment.progress': string;
366
+ 'catalog.enrichment.queued': string;
367
+ 'catalog.enrichment.running': string;
368
+ 'catalog.enrichment.succeeded': string;
369
+ 'catalog.enrichment.partial': string;
370
+ 'catalog.enrichment.failed': string;
371
+ 'catalog.enrichment.cancelled': string;
372
+ 'catalog.detail.technical': string;
373
+ 'catalog.detail.business': string;
374
+ 'catalog.detail.history': string;
375
+ 'catalog.detail.relations': string;
376
+ 'catalog.detail.provenance': string;
377
+ 'catalog.detail.run': string;
378
+ 'catalog.detail.name': string;
379
+ 'catalog.detail.type': string;
380
+ 'catalog.detail.nullable': string;
381
+ 'catalog.detail.parentTable': string;
382
+ 'catalog.detail.select': string;
383
+ 'catalog.detail.summary': string;
384
+ 'catalog.detail.fields': string;
385
+ 'catalog.detail.relationCount': string;
386
+ 'catalog.detail.definitionCount': string;
387
+ 'catalog.detail.scanFacts': string;
388
+ 'catalog.detail.yes': string;
389
+ 'catalog.detail.no': string;
390
+ 'catalog.detail.business.empty.title': string;
391
+ 'catalog.detail.business.empty.body': string;
392
+ 'catalog.meaning.table': string;
393
+ 'catalog.meaning.fields': string;
394
+ 'catalog.meaning.ai': string;
395
+ 'catalog.meaning.missing': string;
396
+ 'catalog.meaning.confirm': string;
397
+ 'catalog.meaning.delete': string;
398
+ 'catalog.metric.new': string;
399
+ 'catalog.term.new': string;
400
+ 'catalog.term.name': string;
401
+ 'catalog.metric.name': string;
402
+ 'catalog.semantic.aliases': string;
403
+ 'catalog.semantic.sources': string;
404
+ 'catalog.semantic.validFrom': string;
405
+ 'catalog.semantic.validTo': string;
406
+ 'catalog.metric.description': string;
407
+ 'catalog.metric.formula': string;
408
+ 'catalog.metric.grain': string;
409
+ 'catalog.metric.timeField': string;
410
+ 'catalog.metric.filters': string;
411
+ 'catalog.metric.exclusions': string;
412
+ 'catalog.metric.owner': string;
413
+ 'catalog.metric.note': string;
414
+ 'catalog.metric.save': string;
415
+ 'catalog.metric.verify': string;
416
+ 'catalog.metric.retire': string;
417
+ 'catalog.kind.schema': string;
418
+ 'catalog.kind.table': string;
419
+ 'catalog.kind.view': string;
420
+ 'catalog.kind.column': string;
421
+ 'catalog.kind.primary_key': string;
422
+ 'catalog.kind.foreign_key': string;
423
+ 'catalog.kind.index': string;
424
+ 'catalog.kind.meaning': string;
425
+ 'catalog.kind.term': string;
426
+ 'catalog.kind.metric': string;
427
+ 'catalog.warning.untrusted': string;
428
+ 'catalog.scan.reconnect': string;
429
+ 'catalog.state.observed': string;
430
+ 'catalog.state.inferred': string;
431
+ 'catalog.state.verified': string;
432
+ 'catalog.state.needs_review': string;
433
+ 'catalog.state.retired': string;
434
+ 'catalog.state.missing': string;
435
+ 'catalog.state.unavailable': string;
436
+ 'catalog.state.added': string;
437
+ 'catalog.state.changed': string;
438
+ 'catalog.state.restored': string;
439
+ 'catalog.state.queued': string;
440
+ 'catalog.state.running': string;
441
+ 'catalog.state.applying': string;
442
+ 'catalog.state.succeeded': string;
443
+ 'catalog.state.failed': string;
444
+ 'catalog.state.cancelled': string;
445
+ 'catalog.state.interrupted': string;
446
+ 'catalog.state.supported': string;
447
+ 'catalog.state.unsupported': string;
158
448
  'action.close': string;
159
449
  'error.title': string;
160
450
  'analysis.running': string;
@@ -9,7 +9,7 @@
9
9
  * key is versioned so a future shape change can migrate or ignore old data.
10
10
  * @module @yejiming/dsh-data-agent/persistence
11
11
  */
12
- import type { DatabaseType } from './DataAgentWorkbench.tsx';
12
+ import { type DatabaseType } from '../database-types.ts';
13
13
  /** localStorage key holding the most recent connection configuration. */
14
14
  export declare const CONNECTION_STORAGE_KEY = "dsh-data-agent.connection.v1";
15
15
  /** The persisted connection configuration. */
@@ -28,6 +28,8 @@ export interface SavedConnection {
28
28
  /** Opt-in flag; when true, {@link saveConnection} may write `password`. */
29
29
  persistPassword?: boolean;
30
30
  readonly?: boolean;
31
+ /** ClickHouse only: HTTPS with normal certificate verification. */
32
+ secure?: boolean;
31
33
  /** Diagnostic timestamp of the save. */
32
34
  savedAt: string;
33
35
  }
@@ -0,0 +1,11 @@
1
+ /** One structured result shape accepted by every workbench export. */
2
+ export interface QueryExportData {
3
+ columns: readonly string[];
4
+ rows: readonly Readonly<Record<string, string | null>>[];
5
+ }
6
+ /** UTF-8 CSV with BOM so desktop Excel opens Chinese text correctly. */
7
+ export declare function queryResultToCsv(data: QueryExportData): string;
8
+ /** Tabular plain text suitable for spreadsheet clipboard paste. */
9
+ export declare function queryResultToTsv(data: QueryExportData): string;
10
+ /** Build a real XLSX workbook using inline strings, frozen headers, and filters. */
11
+ export declare function queryResultToXlsx(data: QueryExportData): Uint8Array;
@@ -8,8 +8,7 @@
8
8
  * involved, and the exact discovery environment is returned for spawn.
9
9
  * @module @yejiming/dsh-data-agent/client-discovery
10
10
  */
11
- import type { ClientConfig } from './clients.ts';
12
- import type { DatabaseType } from './connections.ts';
11
+ import type { CliDatabaseType, ClientConfig } from './clients.ts';
13
12
  /** Host facts are injectable so all supported platforms can be tested on one CI host. */
14
13
  export interface ClientDiscoverySystem {
15
14
  platform: NodeJS.Platform;
@@ -28,7 +27,7 @@ export interface ClientExecutableResolution {
28
27
  }
29
28
  /** Input for one database client resolution attempt. */
30
29
  export interface ResolveClientExecutableOptions {
31
- type: DatabaseType;
30
+ type: CliDatabaseType;
32
31
  command: string;
33
32
  config?: ClientConfig;
34
33
  env: Readonly<Record<string, string>>;
@@ -37,7 +36,7 @@ export interface ResolveClientExecutableOptions {
37
36
  system?: ClientDiscoverySystem;
38
37
  }
39
38
  /** Build ordered fallback directories without recursively scanning the host. */
40
- export declare function buildClientSearchDirectories(type: DatabaseType, config: ClientConfig | undefined, signal: AbortSignal, system?: ClientDiscoverySystem): Promise<string[]>;
39
+ export declare function buildClientSearchDirectories(type: CliDatabaseType, config: ClientConfig | undefined, signal: AbortSignal, system?: ClientDiscoverySystem): Promise<string[]>;
41
40
  /**
42
41
  * Resolve one configured/default client. Current PATH (or an explicit path)
43
42
  * always wins. Only a missing bare command activates bounded PATH discovery.
@@ -1,11 +1,12 @@
1
1
  /**
2
2
  * Pure CLI-client template construction for the supported database types.
3
3
  * Everything here is a function of (type, connection, optional overrides) —
4
- * no process, no I/O — so the injection-safety surface is unit-testable:
4
+ * no process, no I/O — so the CLI injection-safety surface is unit-testable:
5
5
  * argv stays an array (never shell-interpreted), the SQL itself always
6
6
  * travels on stdin, and passwords only ever appear in the environment
7
- * entries (`MYSQL_PWD` / `PGPASSWORD`) or in a stdin connect prefix
8
- * (Oracle `connect`, Hive `!connect`) — never in argv, logs, or returns.
7
+ * entries (`MYSQL_PWD` / `PGPASSWORD` / `SQLCMDPASSWORD`) or in a stdin
8
+ * connect prefix (Oracle `connect`, Hive `!connect`) — never in argv, logs,
9
+ * or returns. ClickHouse HTTP authentication lives in the shared runner.
9
10
  *
10
11
  * Metadata (schemas / tables / describe) queries and their per-type output
11
12
  * parsers live here too, so the /schemas /tables /describe routes stay thin.
@@ -13,8 +14,8 @@
13
14
  */
14
15
  import type { DatabaseConnection, DatabaseType } from './connections.ts';
15
16
  import z from 'schemastery';
16
- import { assertSingleStatement, hasTopLevelKeyword, stripTrailingTerminator } from './sql.ts';
17
- export { assertSingleStatement, hasTopLevelKeyword, stripTrailingTerminator };
17
+ import { assertSingleStatement, assertSqlServerSafeInput, hasTopLevelKeyword, stripTrailingTerminator } from './sql.ts';
18
+ export { assertSingleStatement, assertSqlServerSafeInput, hasTopLevelKeyword, stripTrailingTerminator };
18
19
  /**
19
20
  * Classify a SQL text as a read or write statement by its FIRST effective
20
21
  * token (a conservative read whitelist, not a parser). `with` is read only
@@ -33,6 +34,8 @@ export declare function classifyStatement(sql: string, type: DatabaseType): 'rea
33
34
  * unparseable LIMIT is left for the client (structured tools still truncate).
34
35
  */
35
36
  export declare function enforceReadRowLimit(sql: string, type: DatabaseType, maxRows: number): string;
37
+ /** Rare control separator keeps ordinary tabs/pipes inside sqlcmd values intact. */
38
+ export declare const SQLSERVER_COLUMN_SEPARATOR = "\u001F";
36
39
  /**
37
40
  * Validate and quote one schema/table identifier for a safe metadata query.
38
41
  * Identifiers are restricted to `[A-Za-z0-9_$]+` and then wrapped per type:
@@ -51,6 +54,8 @@ export interface ClientConfig {
51
54
  /** Absolute directories searched after the current subprocess PATH. */
52
55
  searchPaths?: readonly string[];
53
56
  }
57
+ /** Database types backed by a locally resolved CLI executable. */
58
+ export type CliDatabaseType = Exclude<DatabaseType, 'clickhouse'>;
54
59
  /** Loader schema for one client override (all fields optional at input). */
55
60
  export declare const clientConfigSchema: z<Schemastery.ObjectS<{
56
61
  command: z<string, string>;
@@ -61,16 +66,15 @@ export declare const clientConfigSchema: z<Schemastery.ObjectS<{
61
66
  args: z<string[], string[]>;
62
67
  searchPaths: z<string[], string[]>;
63
68
  }>>;
64
- /** Loader schema for the whole `clients` config object (any type key). */
65
69
  export declare const clientsSchema: z<import("cosmokit").Dict<{
66
70
  command?: string | null | undefined;
67
71
  args?: string[] | null | undefined;
68
72
  searchPaths?: string[] | null | undefined;
69
- } & import("@deepseek-ai/cosmokit").Dict, string>, import("cosmokit").Dict<Schemastery.ObjectT<{
73
+ } & import("@deepseek-ai/cosmokit").Dict, "mysql" | "postgres" | "sqlite" | "oracle" | "hive" | "impala" | "doris" | "sqlserver">, import("cosmokit").Dict<Schemastery.ObjectT<{
70
74
  command: z<string, string>;
71
75
  args: z<string[], string[]>;
72
76
  searchPaths: z<string[], string[]>;
73
- }>, string>>;
77
+ }>, "mysql" | "postgres" | "sqlite" | "oracle" | "hive" | "impala" | "doris" | "sqlserver">>;
74
78
  /**
75
79
  * A fully constructed client invocation: argv (command + flags, no SQL),
76
80
  * the credential env entries, and the stdin prefix (Oracle/Hive connect
@@ -127,6 +131,8 @@ export interface ColumnInfo {
127
131
  type: string;
128
132
  nullable?: boolean;
129
133
  }
134
+ /** Remove only terminal sqlcmd row-count footer lines, never matching data in the middle. */
135
+ export declare function stripSqlServerRowCountFooter(stdout: string): string;
130
136
  /**
131
137
  * Parse one type's describe output into columns. Formats:
132
138
  * - mysql `--batch`: `Field\tType\tNull\tKey\t...` (skip header);