@deepseek-ai/dsh-agent-loop-testkit 0.2.1-rc.5 → 0.2.2-alpha.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/README.i18n.yaml +3 -3
- package/README.md +4 -3
- package/README.zh.md +3 -2
- package/lib/index.js +22 -3
- package/lib/types/index.d.ts +6 -3
- package/lib/types/model.d.ts +8 -0
- package/package.json +26 -22
package/README.i18n.yaml
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
# After editing either side, bring the other along and re-record with:
|
|
4
4
|
# pnpm run verify-translation-pairing --write packages/test-support/agent-loop-testkit/README.md
|
|
5
5
|
/:
|
|
6
|
-
en:
|
|
6
|
+
en: 4ec754be137aecb6
|
|
7
7
|
zh: 4e26deb963e89c68
|
|
8
8
|
/deepseek-ai-dsh-agent-loop-testkit:
|
|
9
9
|
en: 52b308fffde03f7e
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
en: 55af6e8dcc16bf46
|
|
22
22
|
zh: 9e1a6a7f70fde817
|
|
23
23
|
/deepseek-ai-dsh-agent-loop-testkit/use-this-package/build-a-structural-agent-stub:
|
|
24
|
-
en:
|
|
25
|
-
zh:
|
|
24
|
+
en: 84a12ebbcfe2ea7d
|
|
25
|
+
zh: 9ef2bc1e2389cde1
|
|
26
26
|
/deepseek-ai-dsh-agent-loop-testkit/use-this-package/when-to-use-it:
|
|
27
27
|
en: 7afa2a3c8ff17664
|
|
28
28
|
zh: 6c8cad1daf3a5df3
|
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: "Prerequisite mounting, production AgentLoop drivers, and explicit
|
|
2
|
+
description: "Prerequisite mounting, production AgentLoop drivers, and explicit Agent stubs for agent-loop tests."
|
|
3
3
|
kind: "package-library"
|
|
4
4
|
---
|
|
5
5
|
|
|
@@ -57,14 +57,15 @@ The dependency helper forwards system-prompt and tool-registry configuration thr
|
|
|
57
57
|
|
|
58
58
|
### Build a structural Agent stub
|
|
59
59
|
|
|
60
|
-
Use `createInboxStub()` when the test subject needs mutable pending lists but does not exercise durability, projection validation, live Inbox notifications, or the driver's claim policy. The stub implements the public queue operations with two process-local arrays and never writes to a Session. Use `unsupportedInbox()` when the test subject must not touch pending input; every mutation throws at the first unexpected dependency.
|
|
60
|
+
Use `createInboxStub()` when the test subject needs mutable pending lists but does not exercise durability, projection validation, live Inbox notifications, or the driver's claim policy. The stub implements the public queue operations with two process-local arrays and never writes to a Session. Use `unsupportedInbox()` when the test subject must not touch pending input; every mutation throws at the first unexpected dependency. Use `unsupportedModel()` when the test does not read or change model selection; all its operations throw.
|
|
61
61
|
|
|
62
62
|
```ts
|
|
63
|
-
import { createInboxStub } from '@deepseek-ai/dsh-agent-loop-testkit'
|
|
63
|
+
import { createInboxStub, unsupportedModel } from '@deepseek-ai/dsh-agent-loop-testkit'
|
|
64
64
|
|
|
65
65
|
const agent = {
|
|
66
66
|
// ...
|
|
67
67
|
inbox: createInboxStub(),
|
|
68
|
+
model: unsupportedModel(),
|
|
68
69
|
}
|
|
69
70
|
```
|
|
70
71
|
|
package/README.zh.md
CHANGED
|
@@ -57,14 +57,15 @@ const admitted = harness.claim(agent, 'next-turn', 1)
|
|
|
57
57
|
|
|
58
58
|
### 构造结构化 Agent 桩
|
|
59
59
|
|
|
60
|
-
当测试对象需要可变的待处理列表,但不测试持久性、投影校验、实时 Inbox 通知或驱动的认领策略时,使用 `createInboxStub()`。该桩通过两个进程内数组实现公开队列操作,且绝不会写入 Session。当测试对象不应访问待处理输入时,使用 `unsupportedInbox()
|
|
60
|
+
当测试对象需要可变的待处理列表,但不测试持久性、投影校验、实时 Inbox 通知或驱动的认领策略时,使用 `createInboxStub()`。该桩通过两个进程内数组实现公开队列操作,且绝不会写入 Session。当测试对象不应访问待处理输入时,使用 `unsupportedInbox()`;每次变更都会在首个意外依赖处抛错。当测试不读取或更改模型选择时,使用 `unsupportedModel()`;它的所有操作都会抛错。
|
|
61
61
|
|
|
62
62
|
```ts
|
|
63
|
-
import { createInboxStub } from '@deepseek-ai/dsh-agent-loop-testkit'
|
|
63
|
+
import { createInboxStub, unsupportedModel } from '@deepseek-ai/dsh-agent-loop-testkit'
|
|
64
64
|
|
|
65
65
|
const agent = {
|
|
66
66
|
// ...
|
|
67
67
|
inbox: createInboxStub(),
|
|
68
|
+
model: unsupportedModel(),
|
|
68
69
|
}
|
|
69
70
|
```
|
|
70
71
|
|
package/lib/index.js
CHANGED
|
@@ -5,6 +5,8 @@ import SessionStore from "@deepseek-ai/dsh-session";
|
|
|
5
5
|
import SessionProjectionRegistry from "@deepseek-ai/dsh-session-projection";
|
|
6
6
|
import SystemPrompt from "@deepseek-ai/dsh-system-prompt";
|
|
7
7
|
import ToolRuntime from "@deepseek-ai/dsh-tools";
|
|
8
|
+
import * as NativeToolExecutor from "@deepseek-ai/dsh-tool-executor-native";
|
|
9
|
+
import * as PtcToolExecutor from "@deepseek-ai/dsh-tool-executor-ptc";
|
|
8
10
|
import FsLocal from "@deepseek-ai/dsh-fs-local";
|
|
9
11
|
import WorkingDirectory from "@deepseek-ai/dsh-working-directory";
|
|
10
12
|
//#region lib/types/inbox.js
|
|
@@ -82,6 +84,21 @@ function unsupportedInbox() {
|
|
|
82
84
|
};
|
|
83
85
|
}
|
|
84
86
|
//#endregion
|
|
87
|
+
//#region lib/types/model.js
|
|
88
|
+
/**
|
|
89
|
+
* Create an unsupported Model placeholder for structural Agent stubs.
|
|
90
|
+
* @returns a Model whose operations throw at the first unexpected dependency.
|
|
91
|
+
*/
|
|
92
|
+
function unsupportedModel() {
|
|
93
|
+
const reject = () => {
|
|
94
|
+
throw new Error("this test Agent does not support model selection");
|
|
95
|
+
};
|
|
96
|
+
return {
|
|
97
|
+
current: reject,
|
|
98
|
+
select: reject
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
//#endregion
|
|
85
102
|
//#region lib/types/working-directory-fixture.js
|
|
86
103
|
/**
|
|
87
104
|
* Supply fixed directory values without filesystem checks or durable changes.
|
|
@@ -99,7 +116,7 @@ function provideWorkingDirectoryFixture(ctx, defaultDirectory = process.cwd()) {
|
|
|
99
116
|
//#endregion
|
|
100
117
|
//#region lib/types/index.js
|
|
101
118
|
/**
|
|
102
|
-
* Shared service mounting, real AgentLoop drivers, and structural
|
|
119
|
+
* Shared service mounting, real AgentLoop drivers, and structural Agent stubs
|
|
103
120
|
* for agent-loop tests. Callers retain ownership of their contexts, adapters,
|
|
104
121
|
* optional plugins, agents, and teardown.
|
|
105
122
|
* @module @deepseek-ai/dsh-agent-loop-testkit
|
|
@@ -125,7 +142,9 @@ async function mountAgentLoopTestDependencies(ctx, options = {}) {
|
|
|
125
142
|
if (ctx.get("fs") === void 0) await ctx.plugin(FsLocal);
|
|
126
143
|
await ctx.plugin(WorkingDirectory);
|
|
127
144
|
}
|
|
128
|
-
await ctx.plugin(ToolRuntime
|
|
145
|
+
await ctx.plugin(ToolRuntime);
|
|
146
|
+
if (options.tools?.mode === "ptc") await ctx.plugin(PtcToolExecutor, { ...options.tools.maxParallelSubCalls !== void 0 ? { maxParallelSubCalls: options.tools.maxParallelSubCalls } : {} });
|
|
147
|
+
else await ctx.plugin(NativeToolExecutor);
|
|
129
148
|
await ctx.plugin(AgentRegistry);
|
|
130
149
|
}
|
|
131
150
|
/**
|
|
@@ -144,4 +163,4 @@ async function mountAgentLoopTestHarness(ctx) {
|
|
|
144
163
|
};
|
|
145
164
|
}
|
|
146
165
|
//#endregion
|
|
147
|
-
export { createInboxStub, mountAgentLoopTestDependencies, mountAgentLoopTestHarness, provideWorkingDirectoryFixture, unsupportedInbox };
|
|
166
|
+
export { createInboxStub, mountAgentLoopTestDependencies, mountAgentLoopTestHarness, provideWorkingDirectoryFixture, unsupportedInbox, unsupportedModel };
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Shared service mounting, real AgentLoop drivers, and structural
|
|
2
|
+
* Shared service mounting, real AgentLoop drivers, and structural Agent stubs
|
|
3
3
|
* for agent-loop tests. Callers retain ownership of their contexts, adapters,
|
|
4
4
|
* optional plugins, agents, and teardown.
|
|
5
5
|
* @module @deepseek-ai/dsh-agent-loop-testkit
|
|
@@ -8,8 +8,8 @@ import type { Context } from '@deepseek-ai/cordis';
|
|
|
8
8
|
import type { Agent, AgentOptions, InboxTarget } from '@deepseek-ai/dsh-agent';
|
|
9
9
|
import type { SessionHeader, SessionId, UserMessage } from '@deepseek-ai/dsh-session';
|
|
10
10
|
import type { Config as SystemPromptConfig } from '@deepseek-ai/dsh-system-prompt';
|
|
11
|
-
import type { Config as ToolRuntimeConfig } from '@deepseek-ai/dsh-tools';
|
|
12
11
|
export { createInboxStub, unsupportedInbox } from './inbox.ts';
|
|
12
|
+
export { unsupportedModel } from './model.ts';
|
|
13
13
|
export { provideWorkingDirectoryFixture } from './working-directory-fixture.ts';
|
|
14
14
|
/** Test driver for production Agents created by a mounted AgentLoop. */
|
|
15
15
|
export interface AgentLoopTestHarness {
|
|
@@ -37,7 +37,10 @@ export interface AgentLoopTestDependenciesOptions {
|
|
|
37
37
|
/** Configuration for the system-prompt registry. */
|
|
38
38
|
readonly systemPrompt?: SystemPromptConfig;
|
|
39
39
|
/** Configuration for the tool registry. */
|
|
40
|
-
readonly tools?:
|
|
40
|
+
readonly tools?: {
|
|
41
|
+
mode?: 'native' | 'ptc';
|
|
42
|
+
maxParallelSubCalls?: number;
|
|
43
|
+
};
|
|
41
44
|
}
|
|
42
45
|
/**
|
|
43
46
|
* Mount the standard prerequisite services for an AgentLoop test.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Model placeholder for consumer tests that do not read or change model selection. */
|
|
2
|
+
import type { Model } from '@deepseek-ai/dsh-agent';
|
|
3
|
+
/**
|
|
4
|
+
* Create an unsupported Model placeholder for structural Agent stubs.
|
|
5
|
+
* @returns a Model whose operations throw at the first unexpected dependency.
|
|
6
|
+
*/
|
|
7
|
+
export declare function unsupportedModel(): Model;
|
|
8
|
+
//# sourceMappingURL=model.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-agent-loop-testkit",
|
|
3
3
|
"description": "Prerequisite mounting, production AgentLoop drivers, and Inbox stubs for tests",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.2-alpha.3",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -27,28 +27,32 @@
|
|
|
27
27
|
],
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"@deepseek-ai/dsh-agent": "0.2.
|
|
31
|
-
"@deepseek-ai/dsh-agent-loop": "0.2.
|
|
32
|
-
"@deepseek-ai/dsh-llm": "0.2.
|
|
33
|
-
"@deepseek-ai/dsh-session": "0.2.
|
|
34
|
-
"@deepseek-ai/dsh-session-projection": "0.2.
|
|
35
|
-
"@deepseek-ai/dsh-system-prompt": "0.2.
|
|
36
|
-
"@deepseek-ai/dsh-tools": "0.2.
|
|
37
|
-
"@deepseek-ai/cordis": "~4.0.
|
|
38
|
-
"@deepseek-ai/dsh-working-directory": "0.2.
|
|
39
|
-
"@deepseek-ai/dsh-fs-local": "0.2.
|
|
30
|
+
"@deepseek-ai/dsh-agent": "0.2.2-alpha.3",
|
|
31
|
+
"@deepseek-ai/dsh-agent-loop": "0.2.2-alpha.3",
|
|
32
|
+
"@deepseek-ai/dsh-llm": "0.2.2-alpha.3",
|
|
33
|
+
"@deepseek-ai/dsh-session": "0.2.2-alpha.3",
|
|
34
|
+
"@deepseek-ai/dsh-session-projection": "0.2.2-alpha.3",
|
|
35
|
+
"@deepseek-ai/dsh-system-prompt": "0.2.2-alpha.3",
|
|
36
|
+
"@deepseek-ai/dsh-tools": "0.2.2-alpha.3",
|
|
37
|
+
"@deepseek-ai/cordis": "~4.0.6-alpha.2",
|
|
38
|
+
"@deepseek-ai/dsh-working-directory": "0.2.2-alpha.3",
|
|
39
|
+
"@deepseek-ai/dsh-fs-local": "0.2.2-alpha.3"
|
|
40
|
+
},
|
|
41
|
+
"dependencies": {
|
|
42
|
+
"@deepseek-ai/dsh-tool-executor-native": "0.2.2-alpha.3",
|
|
43
|
+
"@deepseek-ai/dsh-tool-executor-ptc": "0.2.2-alpha.3"
|
|
40
44
|
},
|
|
41
|
-
"dependencies": {},
|
|
42
45
|
"devDependencies": {
|
|
43
|
-
"@deepseek-ai/dsh-agent": "0.2.
|
|
44
|
-
"@deepseek-ai/dsh-agent-loop": "0.2.
|
|
45
|
-
"@deepseek-ai/dsh-llm": "0.2.
|
|
46
|
-
"@deepseek-ai/dsh-
|
|
47
|
-
"@deepseek-ai/dsh-session
|
|
48
|
-
"@deepseek-ai/dsh-
|
|
49
|
-
"@deepseek-ai/dsh-
|
|
50
|
-
"@deepseek-ai/
|
|
51
|
-
"@deepseek-ai/
|
|
52
|
-
"@deepseek-ai/dsh-
|
|
46
|
+
"@deepseek-ai/dsh-agent": "0.2.2-alpha.3",
|
|
47
|
+
"@deepseek-ai/dsh-agent-loop": "0.2.2-alpha.3",
|
|
48
|
+
"@deepseek-ai/dsh-llm": "0.2.2-alpha.3",
|
|
49
|
+
"@deepseek-ai/dsh-ptc-runtime": "0.2.2-alpha.3",
|
|
50
|
+
"@deepseek-ai/dsh-session": "0.2.2-alpha.3",
|
|
51
|
+
"@deepseek-ai/dsh-session-projection": "0.2.2-alpha.3",
|
|
52
|
+
"@deepseek-ai/dsh-system-prompt": "0.2.2-alpha.3",
|
|
53
|
+
"@deepseek-ai/dsh-tools": "0.2.2-alpha.3",
|
|
54
|
+
"@deepseek-ai/cordis": "~4.0.6-alpha.2",
|
|
55
|
+
"@deepseek-ai/dsh-working-directory": "0.2.2-alpha.3",
|
|
56
|
+
"@deepseek-ai/dsh-fs-local": "0.2.2-alpha.3"
|
|
53
57
|
}
|
|
54
58
|
}
|