@dsh-enhanced/assistant-health 0.1.3

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 dsh-enhanced contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,25 @@
1
+ # @dsh-enhanced/assistant-health
2
+
3
+ 聚合个人助理各 provider 的公开 `health()` seam,输出低基数、无正文/路径/secret 的 liveness、readiness 和 Policy-gated 详细报告。它不读取其他插件的 SQLite/Vault,不执行修复,也不是第五个业务真源。
4
+
5
+ ## 安装与使用
6
+
7
+ ```sh
8
+ dsh plugin --profile web add @dsh-enhanced/assistant-health
9
+ dsh --profile web --dump-config
10
+ ```
11
+
12
+ 默认把 Policy、Memory、Wiki、Automations 设为 required;Delivery、Credentials、Event、Heartbeat、Lark 未安装不会让 core readiness 失败。`ctx.assistantHealth.liveness()` 只表示进程内 service 活着;`readiness()` 只调用本地 content-free health seam,不调用模型、工具或外网。详细 `assistant_health` tool 还需目标 Agent 对 `tool:assistant-health` 的 `inspect` Policy 规则。
13
+
14
+ 输出字段是逐 provider 白名单:未知 key、error message、content、prompt、cwd、vault/database path、消息、secret 和 tenant 标识不会透出。Provider 抛错只标记 `error`,不会包含异常正文。
15
+
16
+ ## 权限与限制
17
+
18
+ - 文件系统、网络、子进程、凭据、浏览器、安装脚本:无。
19
+ - 只读 Cordis service;health 故障不能阻塞其他业务。
20
+ - 本包不提供公网 `/healthz`/`readyz`。如需 route,由宿主用强认证的本地 adapter 映射这两个 service 方法,不能把 detailed report 暴露为匿名端点。
21
+ - detect 与 fix 永远分离;无 UI、无进程 supervisor、无篡改证明 ledger。
22
+
23
+ ## 兼容性
24
+
25
+ 以 DSH rc.8 `141eb6fef83422698aef7a981029e843e8161534` 验证;参考官方 session telemetry/OTel 的观测边界,不把 best-effort telemetry 当审计。
@@ -0,0 +1,11 @@
1
+ - insert:
2
+ - id: dsh-enhanced-assistant-health
3
+ name: '@dsh-enhanced/assistant-health'
4
+ inject:
5
+ - assistantPolicy
6
+ config:
7
+ requiredProviders:
8
+ - assistantPolicy
9
+ - personalMemory
10
+ - personalWiki
11
+ - assistantAutomations
package/lib/index.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ import type { Context } from '@deepseek-ai/cordis';
2
+ import { AssistantHealthService, Config } from './service.js';
3
+ import { version } from './version.js';
4
+ export declare const name = "dsh-enhanced-assistant-health";
5
+ export { AssistantHealthService, Config, version };
6
+ export * from './service.js';
7
+ export declare function apply(ctx: Context, config: import('./service.js').Config): void;
8
+ export default AssistantHealthService;
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,eAAO,MAAM,IAAI,kCAAkC,CAAA;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,EAAE,OAAO,EAAE,CAAA;AAClD,cAAc,cAAc,CAAA;AAE5B,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,cAAc,EAAE,MAAM,GAAG,IAAI,CAE/E;AAED,eAAe,sBAAsB,CAAA"}
package/lib/index.js ADDED
@@ -0,0 +1,10 @@
1
+ import { AssistantHealthService, Config } from './service.js';
2
+ import { version } from './version.js';
3
+ export const name = 'dsh-enhanced-assistant-health';
4
+ export { AssistantHealthService, Config, version };
5
+ export * from './service.js';
6
+ export function apply(ctx, config) {
7
+ new AssistantHealthService(ctx, config);
8
+ }
9
+ export default AssistantHealthService;
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,MAAM,CAAC,MAAM,IAAI,GAAG,+BAA+B,CAAA;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,EAAE,OAAO,EAAE,CAAA;AAClD,cAAc,cAAc,CAAA;AAE5B,MAAM,UAAU,KAAK,CAAC,GAAY,EAAE,MAAqC;IACvE,IAAI,sBAAsB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;AACzC,CAAC;AAED,eAAe,sBAAsB,CAAA"}
@@ -0,0 +1,53 @@
1
+ import { Context, Service } from '@deepseek-ai/cordis';
2
+ import type { Agent } from '@deepseek-ai/dsh-agent';
3
+ import Schema from '@deepseek-ai/schemastery';
4
+ export declare const providerIds: readonly ["assistantPolicy", "personalMemory", "personalWiki", "assistantAutomations", "assistantDelivery", "credentialsKeychain", "eventTriggers", "assistantHeartbeat", "larkChannel"];
5
+ export type HealthProviderId = typeof providerIds[number];
6
+ export type HealthMetric = boolean | number | string;
7
+ export interface Config {
8
+ requiredProviders?: HealthProviderId[];
9
+ }
10
+ export interface ProviderHealth {
11
+ id: HealthProviderId;
12
+ status: 'error' | 'missing' | 'ready';
13
+ metrics: Readonly<Record<string, HealthMetric>>;
14
+ }
15
+ export interface AssistantHealthReport {
16
+ ready: boolean;
17
+ generatedAt: number;
18
+ providers: readonly ProviderHealth[];
19
+ warnings: readonly string[];
20
+ }
21
+ export type AssistantHealthErrorCode = 'disposed' | 'policy-denied';
22
+ export declare class AssistantHealthError extends Error {
23
+ readonly code: AssistantHealthErrorCode;
24
+ constructor(code: AssistantHealthErrorCode, message: string);
25
+ }
26
+ declare module '@deepseek-ai/cordis' {
27
+ interface Context {
28
+ assistantHealth: AssistantHealthService;
29
+ }
30
+ }
31
+ export declare class AssistantHealthService extends Service {
32
+ static Config: Schema<Config>;
33
+ private readonly context;
34
+ private readonly policy;
35
+ private readonly required;
36
+ private readonly now;
37
+ private active;
38
+ constructor(ctx: Context, input?: Config, options?: {
39
+ now?: () => number;
40
+ });
41
+ liveness(): {
42
+ alive: true;
43
+ };
44
+ readiness(): {
45
+ ready: boolean;
46
+ warnings: string[];
47
+ };
48
+ report(agent: Agent | undefined): AssistantHealthReport;
49
+ private collect;
50
+ private assertActive;
51
+ }
52
+ export declare const Config: Schema<Config>;
53
+ //# sourceMappingURL=service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AACnD,OAAO,MAAM,MAAM,0BAA0B,CA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AE,MAAW,EAAE,OAAO,GAAE;QAAE,GAAG,CAAC,EAAE,MAAM,MAAM,CAAA;KAAO;IAmBlF,QAAQ,IAAI;QAAE,KAAK,EAAE,IAAI,CAAA;KAAE;IAK3B,SAAS,IAAI;QAAE,KAAK,EAAE,OAAO,CAAC;QAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;KAAE;IASnD,MAAM,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,GAAG,qBAAqB;IAkBvD,OAAO,CAAC,OAAO;IAcf,OAAO,CAAC,YAAY;CAGrB;AAED,eAAO,MAAM,MAAM,gBAAe,CAAA"}
package/lib/service.js ADDED
@@ -0,0 +1,147 @@
1
+ import { Context, Service } from '@deepseek-ai/cordis';
2
+ import Schema from '@deepseek-ai/schemastery';
3
+ import { registerAssistantHealthTool } from './tools.js';
4
+ export const providerIds = [
5
+ 'assistantPolicy',
6
+ 'personalMemory',
7
+ 'personalWiki',
8
+ 'assistantAutomations',
9
+ 'assistantDelivery',
10
+ 'credentialsKeychain',
11
+ 'eventTriggers',
12
+ 'assistantHeartbeat',
13
+ 'larkChannel',
14
+ ];
15
+ export class AssistantHealthError extends Error {
16
+ code;
17
+ constructor(code, message) {
18
+ super(message);
19
+ this.code = code;
20
+ this.name = 'AssistantHealthError';
21
+ }
22
+ }
23
+ const configSchema = Schema.object({
24
+ requiredProviders: Schema.array(Schema.union(providerIds)).default([
25
+ 'assistantPolicy', 'personalMemory', 'personalWiki', 'assistantAutomations',
26
+ ]),
27
+ });
28
+ const keys = {
29
+ assistantPolicy: { emergencyStop: 'boolean', lastAuditSequence: 'number' },
30
+ personalMemory: { activeRecords: 'number', removedRecords: 'number', expiredRecords: 'number', pendingProposals: 'number' },
31
+ personalWiki: { pages: 'number', lintErrors: 'number', lintWarnings: 'number', pendingProposals: 'number' },
32
+ assistantAutomations: { activeAutomations: 'number', pausedAutomations: 'number', pendingTasks: 'number',
33
+ runningTasks: 'number', failedRuns: 'number', unknownRuns: 'number' },
34
+ assistantDelivery: { pendingInbox: 'number', deadLetterInbox: 'number', pendingOutbox: 'number',
35
+ deadLetterOutbox: 'number', unknownOutbox: 'number', adapters: 'number' },
36
+ credentialsKeychain: { handles: 'number', activeLeases: 'number', failedLeases: 'number' },
37
+ eventTriggers: { pendingEvents: 'number', deliveredEvents: 'number', triggersObserved: 'number' },
38
+ assistantHeartbeat: { active: 'number', paused: 'number', empty: 'number' },
39
+ larkChannel: { state: ['connected', 'connected-with-gap', 'connecting', 'disabled', 'disconnected', 'reconnecting'],
40
+ gapGeneration: 'number' },
41
+ };
42
+ function metrics(id, value) {
43
+ if (typeof value !== 'object' || value === null || Array.isArray(value))
44
+ throw new Error('invalid health payload');
45
+ const input = value;
46
+ const output = {};
47
+ for (const [key, specification] of Object.entries(keys[id])) {
48
+ const current = input[key];
49
+ if (specification === 'number') {
50
+ if (!Number.isSafeInteger(current) || current < 0)
51
+ throw new Error('invalid numeric health metric');
52
+ output[key] = current;
53
+ }
54
+ else if (specification === 'boolean') {
55
+ if (typeof current !== 'boolean')
56
+ throw new Error('invalid boolean health metric');
57
+ output[key] = current;
58
+ }
59
+ else {
60
+ if (typeof current !== 'string' || !specification.includes(current))
61
+ throw new Error('invalid status health metric');
62
+ output[key] = current;
63
+ }
64
+ }
65
+ return Object.freeze(output);
66
+ }
67
+ export class AssistantHealthService extends Service {
68
+ static Config = configSchema;
69
+ context;
70
+ policy;
71
+ required;
72
+ now;
73
+ active = true;
74
+ constructor(ctx, input = {}, options = {}) {
75
+ super(ctx, 'assistantHealth');
76
+ let config;
77
+ try {
78
+ config = configSchema(input);
79
+ }
80
+ catch (error) {
81
+ throw new Error(`assistant-health: invalid configuration: ${String(error)}`, { cause: error });
82
+ }
83
+ if (new Set(config.requiredProviders).size !== config.requiredProviders.length) {
84
+ throw new Error('assistant-health: requiredProviders contains a duplicate');
85
+ }
86
+ const policy = ctx.get('assistantPolicy');
87
+ if (policy === undefined)
88
+ throw new Error('assistant-health: assistantPolicy service is required');
89
+ this.context = ctx;
90
+ this.policy = policy;
91
+ this.required = new Set(config.requiredProviders);
92
+ this.now = options.now ?? Date.now;
93
+ ctx.inject(['tools'], toolsCtx => registerAssistantHealthTool(toolsCtx, this));
94
+ ctx.effect(() => () => { this.active = false; }, 'assistant-health.runtime');
95
+ }
96
+ liveness() {
97
+ this.assertActive();
98
+ return { alive: true };
99
+ }
100
+ readiness() {
101
+ this.assertActive();
102
+ const providers = this.collect();
103
+ const warnings = providers
104
+ .filter(item => this.required.has(item.id) && item.status !== 'ready')
105
+ .map(item => `provider-${item.status}:${item.id}`);
106
+ return { ready: warnings.length === 0, warnings };
107
+ }
108
+ report(agent) {
109
+ this.assertActive();
110
+ const decision = this.policy.authorizeAgent(agent, 'inspect', { kind: 'tool', id: 'assistant-health' });
111
+ if (decision.effect !== 'allow') {
112
+ throw new AssistantHealthError('policy-denied', `assistant-health policy denied report: ${decision.reasonCode}`);
113
+ }
114
+ const providers = this.collect();
115
+ const warnings = providers
116
+ .filter(item => this.required.has(item.id) && item.status !== 'ready')
117
+ .map(item => `provider-${item.status}:${item.id}`);
118
+ return Object.freeze({
119
+ ready: warnings.length === 0,
120
+ generatedAt: this.now(),
121
+ providers: Object.freeze(providers),
122
+ warnings: Object.freeze(warnings),
123
+ });
124
+ }
125
+ collect() {
126
+ const get = this.context.get.bind(this.context);
127
+ return providerIds.map(id => {
128
+ const provider = get(id);
129
+ if (provider === undefined)
130
+ return Object.freeze({ id, status: 'missing', metrics: Object.freeze({}) });
131
+ if (typeof provider.health !== 'function')
132
+ return Object.freeze({ id, status: 'error', metrics: Object.freeze({}) });
133
+ try {
134
+ return Object.freeze({ id, status: 'ready', metrics: metrics(id, provider.health()) });
135
+ }
136
+ catch {
137
+ return Object.freeze({ id, status: 'error', metrics: Object.freeze({}) });
138
+ }
139
+ });
140
+ }
141
+ assertActive() {
142
+ if (!this.active)
143
+ throw new AssistantHealthError('disposed', 'assistant-health service is disposed');
144
+ }
145
+ }
146
+ export const Config = configSchema;
147
+ //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GAAG,YAAY,CAAA"}
package/lib/tools.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import type { Context } from '@deepseek-ai/cordis';
2
+ import type { AssistantHealthService } from './service.js';
3
+ export declare function registerAssistantHealthTool(ctx: Context, service: AssistantHealthService): void;
4
+ //# sourceMappingURL=tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAElD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAA;AAE1D,wBAAgB,2BAA2B,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,sBAAsB,GAAG,IAAI,CA8B/F"}
package/lib/tools.js ADDED
@@ -0,0 +1,33 @@
1
+ import { defineTool } from '@deepseek-ai/dsh-tools';
2
+ export function registerAssistantHealthTool(ctx, service) {
3
+ ctx.tools.register(defineTool({
4
+ name: 'assistant_health',
5
+ description: 'Read a policy-gated, content-free health report. This detects issues and never repairs state.',
6
+ parameters: {},
7
+ output: {
8
+ schema: { type: 'object', additionalProperties: false, properties: {
9
+ ready: { type: 'boolean', required: true }, generatedAt: { type: 'integer', required: true },
10
+ warnings: { type: 'array', required: true, items: { type: 'string' } },
11
+ providers: { type: 'array', required: true, items: { type: 'object', additionalProperties: false, properties: {
12
+ id: { type: 'string', required: true }, status: { type: 'string', required: true },
13
+ metrics: { type: 'object', required: true, additionalProperties: true, properties: {} },
14
+ } } },
15
+ } },
16
+ render: (_args, value) => [{ type: 'text', text: JSON.stringify(value) }],
17
+ },
18
+ async execute(_args, exec) {
19
+ const report = service.report(exec.agent);
20
+ return {
21
+ ready: report.ready,
22
+ generatedAt: report.generatedAt,
23
+ warnings: [...report.warnings],
24
+ providers: report.providers.map(provider => ({
25
+ id: provider.id,
26
+ status: provider.status,
27
+ metrics: { ...provider.metrics },
28
+ })),
29
+ };
30
+ },
31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AAE,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;SAC1E;QACD,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI;YACvB,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;YACzC,OAAO;gBACL,KAAK,EAAE,MAAM,CAAC,KAAK;gBACnB,WAAW,EAAE,MAAM,CAAC,WAAW;gBAC/B,QAAQ,EAAE,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC;gBAC9B,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;oBAC3C,EAAE,EAAE,QAAQ,CAAC,EAAE;oBACf,MAAM,EAAE,QAAQ,CAAC,MAAM;oBACvB,OAAO,EAAE,EAAE,GAAG,QAAQ,CAAC,OAAO,EAAE;iBACjC,CAAC,CAAC;aACJ,CAAA;QACH,CAAC;KACF,CAAC,CAAC,CAAA;AACL,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const version = "0.1.3";
2
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,UAAU,CAAA"}
package/lib/version.js ADDED
@@ -0,0 +1,2 @@
1
+ export const version = '0.1.3';
2
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAA"}
package/package.json ADDED
@@ -0,0 +1,81 @@
1
+ {
2
+ "name": "@dsh-enhanced/assistant-health",
3
+ "version": "0.1.3",
4
+ "description": "Policy-gated, content-free health and readiness aggregation for DSH assistant services.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "main": "./lib/index.js",
8
+ "types": "./lib/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./lib/index.d.ts",
12
+ "default": "./lib/index.js"
13
+ },
14
+ "./cordis.patch.yml": "./cordis.patch.yml",
15
+ "./package.json": "./package.json"
16
+ },
17
+ "files": [
18
+ "lib",
19
+ "cordis.patch.yml",
20
+ "README.md",
21
+ "LICENSE"
22
+ ],
23
+ "engines": {
24
+ "node": "^22.19.0 || >=24.0.0"
25
+ },
26
+ "publishConfig": {
27
+ "access": "public"
28
+ },
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "git+https://github.com/22-ai-00/dsh-enhanced.git",
32
+ "directory": "plugins/assistant-health"
33
+ },
34
+ "keywords": [
35
+ "deepseek",
36
+ "deepseek-harness",
37
+ "dsh-plugin"
38
+ ],
39
+ "dsh": {
40
+ "bundle": {
41
+ "patch": "./cordis.patch.yml"
42
+ }
43
+ },
44
+ "dependencies": {
45
+ "@deepseek-ai/schemastery": "3.18.1"
46
+ },
47
+ "peerDependencies": {
48
+ "@deepseek-ai/cordis": "^4.0.1",
49
+ "@deepseek-ai/dsh-agent": ">=0.1.0-rc.8 <0.2.0",
50
+ "@deepseek-ai/dsh-tools": ">=0.1.0-rc.8 <0.2.0",
51
+ "@dsh-enhanced/assistant-policy": ">=0.1.0 <0.2.0"
52
+ },
53
+ "peerDependenciesMeta": {
54
+ "@deepseek-ai/cordis": {
55
+ "optional": true
56
+ },
57
+ "@deepseek-ai/dsh-agent": {
58
+ "optional": true
59
+ },
60
+ "@deepseek-ai/dsh-tools": {
61
+ "optional": true
62
+ },
63
+ "@dsh-enhanced/assistant-policy": {
64
+ "optional": true
65
+ }
66
+ },
67
+ "devDependencies": {
68
+ "@deepseek-ai/cordis": "4.0.1",
69
+ "@deepseek-ai/dsh-agent": "0.1.0-rc.8",
70
+ "@deepseek-ai/dsh-tools": "0.1.0-rc.8",
71
+ "@types/node": "22.20.0",
72
+ "typescript": "6.0.3",
73
+ "vitest": "4.1.8",
74
+ "@dsh-enhanced/assistant-policy": "0.1.3"
75
+ },
76
+ "scripts": {
77
+ "build": "tsc -p tsconfig.build.json",
78
+ "test": "vitest run",
79
+ "typecheck": "tsc -p tsconfig.json --noEmit"
80
+ }
81
+ }