@deepseek-ai/dsh-agent-loop-testkit 0.2.0-rc.2 → 0.2.1-alpha.2
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 +4 -4
- package/README.md +3 -1
- package/README.zh.md +3 -1
- package/lib/index.js +22 -1
- package/lib/types/index.d.ts +3 -0
- package/lib/types/working-directory-fixture.d.ts +9 -0
- package/package.json +21 -17
package/README.i18n.yaml
CHANGED
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
en: d152484eb41ac6b4
|
|
16
16
|
zh: 09388d293f9be9cb
|
|
17
17
|
/deepseek-ai-dsh-agent-loop-testkit/use-this-package:
|
|
18
|
-
en:
|
|
19
|
-
zh:
|
|
18
|
+
en: 6286160c69aaf1d2
|
|
19
|
+
zh: 79571cbf96335b02
|
|
20
20
|
/deepseek-ai-dsh-agent-loop-testkit/use-this-package/drive-a-production-agent:
|
|
21
21
|
en: 55af6e8dcc16bf46
|
|
22
22
|
zh: 9e1a6a7f70fde817
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
en: b2297e57abf5258a
|
|
34
34
|
zh: 4595256c059896ce
|
|
35
35
|
/deepseek-ai-dsh-agent-loop-testkit/understand-the-implementation/design:
|
|
36
|
-
en:
|
|
37
|
-
zh:
|
|
36
|
+
en: 88506ae955e07c17
|
|
37
|
+
zh: 9d09a35a9286105d
|
|
38
38
|
/deepseek-ai-dsh-agent-loop-testkit/further-exploration:
|
|
39
39
|
en: 60f39b14b0ccbcf6
|
|
40
40
|
zh: f193710189d3cc10
|
package/README.md
CHANGED
|
@@ -25,6 +25,8 @@ Use `dsh-agent-loop-testkit` to give AgentLoop tests the standard prerequisites
|
|
|
25
25
|
<a id="use-this-package"></a>
|
|
26
26
|
## Use this package
|
|
27
27
|
|
|
28
|
+
Consumer-only tests with structural Agent stubs can use `provideWorkingDirectoryFixture(ctx, defaultDirectory?)`. It supplies directory values without validating paths, changing directories, or recording events. Tests of directory behavior use `mountAgentLoopTestDependencies(ctx, { workingDirectory: true })` and real temporary directories.
|
|
29
|
+
|
|
28
30
|
This package gives an AgentLoop test a working service topology and keeps the choice between production Inbox behavior and a structural stub explicit.
|
|
29
31
|
|
|
30
32
|
### Drive a production Agent
|
|
@@ -86,7 +88,7 @@ This section explains the design of the test utilities; the observable behavior
|
|
|
86
88
|
|
|
87
89
|
### Design
|
|
88
90
|
|
|
89
|
-
`mountAgentLoopTestDependencies` mounts six service plugins in a fixed dependency order — LLM, session, session-projection registry, system-prompt registry, tool registry, then agent registry — and stops before `AgentLoop`, so the caller controls loop load order. `mountAgentLoopTestHarness` mounts the public production plugin, creates Agents through its service, and exposes the production driver's claim operation without exporting the loop's concrete Inbox class or projection definition. [`src/inbox.ts`](src/inbox.ts) contains only the process-local mutable stub and the fail-fast unsupported placeholder; it owns no projection or durable event implementation. The mounting and driver implementation lives in [`src/index.ts`](src/index.ts).
|
|
91
|
+
`mountAgentLoopTestDependencies` mounts six service plugins in a fixed dependency order — LLM, session, session-projection registry, system-prompt registry, tool registry, then agent registry — and stops before `AgentLoop`, so the caller controls loop load order. `mountAgentLoopTestHarness` mounts the public production plugin, creates Agents through its service, and exposes the production driver's claim operation without exporting the loop's concrete Inbox class or projection definition. [`src/inbox.ts`](src/inbox.ts) contains only the process-local mutable stub and the fail-fast unsupported placeholder; it owns no projection or durable event implementation. The mounting and driver implementation lives in [`src/index.ts`](src/index.ts).
|
|
90
92
|
|
|
91
93
|
</details>
|
|
92
94
|
|
package/README.zh.md
CHANGED
|
@@ -25,6 +25,8 @@ kind: "package-library"
|
|
|
25
25
|
<a id="use-this-package"></a>
|
|
26
26
|
## 使用本包
|
|
27
27
|
|
|
28
|
+
仅测试消费方且使用结构化 Agent 桩的测试可调用 `provideWorkingDirectoryFixture(ctx, defaultDirectory?)`。它只提供目录值,不校验路径、不切换目录,也不记录事件。目录行为测试使用 `mountAgentLoopTestDependencies(ctx, { workingDirectory: true })` 与真实临时目录。
|
|
29
|
+
|
|
28
30
|
本包为 AgentLoop 测试提供可用的服务拓扑,并要求测试明确选择生产 Inbox 行为或结构化桩。
|
|
29
31
|
|
|
30
32
|
### 驱动生产 Agent
|
|
@@ -86,7 +88,7 @@ harness 不会挂载任何 LLM(大语言模型)适配器。若测试发送
|
|
|
86
88
|
|
|
87
89
|
### 设计
|
|
88
90
|
|
|
89
|
-
`mountAgentLoopTestDependencies` 按固定依赖顺序——LLM、会话、会话投影注册表、系统提示词注册表、工具注册表、agent 注册表——挂载六个服务插件,并在 `AgentLoop` 之前停下,使调用方控制 loop 加载顺序。`mountAgentLoopTestHarness` 挂载公开的生产插件,通过其服务创建 Agent,并公开生产驱动的认领操作,而不导出 loop 的具体 Inbox 类或投影定义。[`src/inbox.ts`](src/inbox.ts) 仅包含进程内可变桩和快速失败且不支持操作的占位值;它不持有投影或持久事件实现。挂载与驱动实现位于 [`src/index.ts`](src/index.ts)
|
|
91
|
+
`mountAgentLoopTestDependencies` 按固定依赖顺序——LLM、会话、会话投影注册表、系统提示词注册表、工具注册表、agent 注册表——挂载六个服务插件,并在 `AgentLoop` 之前停下,使调用方控制 loop 加载顺序。`mountAgentLoopTestHarness` 挂载公开的生产插件,通过其服务创建 Agent,并公开生产驱动的认领操作,而不导出 loop 的具体 Inbox 类或投影定义。[`src/inbox.ts`](src/inbox.ts) 仅包含进程内可变桩和快速失败且不支持操作的占位值;它不持有投影或持久事件实现。挂载与驱动实现位于 [`src/index.ts`](src/index.ts)。
|
|
90
92
|
|
|
91
93
|
</details>
|
|
92
94
|
|
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 FsLocal from "@deepseek-ai/dsh-fs-local";
|
|
9
|
+
import WorkingDirectory from "@deepseek-ai/dsh-working-directory";
|
|
8
10
|
//#region lib/types/inbox.js
|
|
9
11
|
/**
|
|
10
12
|
* Create a mutable in-memory Inbox stub for tests that exercise only the public
|
|
@@ -80,6 +82,21 @@ function unsupportedInbox() {
|
|
|
80
82
|
};
|
|
81
83
|
}
|
|
82
84
|
//#endregion
|
|
85
|
+
//#region lib/types/working-directory-fixture.js
|
|
86
|
+
/**
|
|
87
|
+
* Supply fixed directory values without filesystem checks or durable changes.
|
|
88
|
+
* @param ctx - context owning this test collaborator.
|
|
89
|
+
* @param defaultDirectory - fallback for fixtures without a Session directory.
|
|
90
|
+
*/
|
|
91
|
+
function provideWorkingDirectoryFixture(ctx, defaultDirectory = process.cwd()) {
|
|
92
|
+
const get = (session) => session.header.cwd ?? defaultDirectory;
|
|
93
|
+
ctx.provide("workingDirectory", {
|
|
94
|
+
defaultDirectory,
|
|
95
|
+
get,
|
|
96
|
+
ensure: (agent) => Promise.resolve(get(agent.session))
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
//#endregion
|
|
83
100
|
//#region lib/types/index.js
|
|
84
101
|
/**
|
|
85
102
|
* Shared service mounting, real AgentLoop drivers, and structural Inbox stubs
|
|
@@ -104,6 +121,10 @@ async function mountAgentLoopTestDependencies(ctx, options = {}) {
|
|
|
104
121
|
await ctx.plugin(SessionStore);
|
|
105
122
|
await ctx.plugin(SessionProjectionRegistry);
|
|
106
123
|
await ctx.plugin(SystemPrompt, options.systemPrompt ?? {});
|
|
124
|
+
if (options.workingDirectory) {
|
|
125
|
+
if (ctx.get("fs") === void 0) await ctx.plugin(FsLocal);
|
|
126
|
+
await ctx.plugin(WorkingDirectory);
|
|
127
|
+
}
|
|
107
128
|
await ctx.plugin(ToolRuntime, options.tools ?? {});
|
|
108
129
|
await ctx.plugin(AgentRegistry);
|
|
109
130
|
}
|
|
@@ -123,4 +144,4 @@ async function mountAgentLoopTestHarness(ctx) {
|
|
|
123
144
|
};
|
|
124
145
|
}
|
|
125
146
|
//#endregion
|
|
126
|
-
export { createInboxStub, mountAgentLoopTestDependencies, mountAgentLoopTestHarness, unsupportedInbox };
|
|
147
|
+
export { createInboxStub, mountAgentLoopTestDependencies, mountAgentLoopTestHarness, provideWorkingDirectoryFixture, unsupportedInbox };
|
package/lib/types/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import type { SessionHeader, SessionId, UserMessage } from '@deepseek-ai/dsh-ses
|
|
|
10
10
|
import type { Config as SystemPromptConfig } from '@deepseek-ai/dsh-system-prompt';
|
|
11
11
|
import type { Config as ToolRuntimeConfig } from '@deepseek-ai/dsh-tools';
|
|
12
12
|
export { createInboxStub, unsupportedInbox } from './inbox.ts';
|
|
13
|
+
export { provideWorkingDirectoryFixture } from './working-directory-fixture.ts';
|
|
13
14
|
/** Test driver for production Agents created by a mounted AgentLoop. */
|
|
14
15
|
export interface AgentLoopTestHarness {
|
|
15
16
|
/**
|
|
@@ -31,6 +32,8 @@ export interface AgentLoopTestHarness {
|
|
|
31
32
|
}
|
|
32
33
|
/** Configuration forwarded to the prerequisite service plugins. */
|
|
33
34
|
export interface AgentLoopTestDependenciesOptions {
|
|
35
|
+
/** Mount the real directory owner and a local filesystem for directory-aware tests. */
|
|
36
|
+
readonly workingDirectory?: boolean;
|
|
34
37
|
/** Configuration for the system-prompt registry. */
|
|
35
38
|
readonly systemPrompt?: SystemPromptConfig;
|
|
36
39
|
/** Configuration for the tool registry. */
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Directory collaborator for consumer-only tests with structural Agent stubs. */
|
|
2
|
+
import type { Context } from '@deepseek-ai/cordis';
|
|
3
|
+
/**
|
|
4
|
+
* Supply fixed directory values without filesystem checks or durable changes.
|
|
5
|
+
* @param ctx - context owning this test collaborator.
|
|
6
|
+
* @param defaultDirectory - fallback for fixtures without a Session directory.
|
|
7
|
+
*/
|
|
8
|
+
export declare function provideWorkingDirectoryFixture(ctx: Context, defaultDirectory?: string): void;
|
|
9
|
+
//# sourceMappingURL=working-directory-fixture.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.1-alpha.2",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -27,24 +27,28 @@
|
|
|
27
27
|
],
|
|
28
28
|
"license": "MIT",
|
|
29
29
|
"peerDependencies": {
|
|
30
|
-
"@deepseek-ai/dsh-agent
|
|
31
|
-
"@deepseek-ai/dsh-
|
|
32
|
-
"@deepseek-ai/dsh-
|
|
33
|
-
"@deepseek-ai/dsh-session
|
|
34
|
-
"@deepseek-ai/dsh-
|
|
35
|
-
"@deepseek-ai/dsh-
|
|
36
|
-
"@deepseek-ai/dsh-
|
|
37
|
-
"@deepseek-ai/cordis": "~4.0.
|
|
30
|
+
"@deepseek-ai/dsh-agent": "0.2.1-alpha.2",
|
|
31
|
+
"@deepseek-ai/dsh-agent-loop": "0.2.1-alpha.2",
|
|
32
|
+
"@deepseek-ai/dsh-llm": "0.2.1-alpha.2",
|
|
33
|
+
"@deepseek-ai/dsh-session": "0.2.1-alpha.2",
|
|
34
|
+
"@deepseek-ai/dsh-session-projection": "0.2.1-alpha.2",
|
|
35
|
+
"@deepseek-ai/dsh-system-prompt": "0.2.1-alpha.2",
|
|
36
|
+
"@deepseek-ai/dsh-tools": "0.2.1-alpha.2",
|
|
37
|
+
"@deepseek-ai/cordis": "~4.0.5-alpha.1",
|
|
38
|
+
"@deepseek-ai/dsh-working-directory": "0.2.1-alpha.2",
|
|
39
|
+
"@deepseek-ai/dsh-fs-local": "0.2.1-alpha.2"
|
|
38
40
|
},
|
|
39
41
|
"dependencies": {},
|
|
40
42
|
"devDependencies": {
|
|
41
|
-
"@deepseek-ai/dsh-agent": "0.2.
|
|
42
|
-
"@deepseek-ai/dsh-agent-loop": "0.2.
|
|
43
|
-
"@deepseek-ai/dsh-llm": "0.2.
|
|
44
|
-
"@deepseek-ai/dsh-session": "0.2.
|
|
45
|
-
"@deepseek-ai/dsh-session-projection": "0.2.
|
|
46
|
-
"@deepseek-ai/dsh-system-prompt": "0.2.
|
|
47
|
-
"@deepseek-ai/dsh-tools": "0.2.
|
|
48
|
-
"@deepseek-ai/cordis": "~4.0.
|
|
43
|
+
"@deepseek-ai/dsh-agent": "0.2.1-alpha.2",
|
|
44
|
+
"@deepseek-ai/dsh-agent-loop": "0.2.1-alpha.2",
|
|
45
|
+
"@deepseek-ai/dsh-llm": "0.2.1-alpha.2",
|
|
46
|
+
"@deepseek-ai/dsh-session": "0.2.1-alpha.2",
|
|
47
|
+
"@deepseek-ai/dsh-session-projection": "0.2.1-alpha.2",
|
|
48
|
+
"@deepseek-ai/dsh-system-prompt": "0.2.1-alpha.2",
|
|
49
|
+
"@deepseek-ai/dsh-tools": "0.2.1-alpha.2",
|
|
50
|
+
"@deepseek-ai/cordis": "~4.0.5-alpha.1",
|
|
51
|
+
"@deepseek-ai/dsh-working-directory": "0.2.1-alpha.2",
|
|
52
|
+
"@deepseek-ai/dsh-fs-local": "0.2.1-alpha.2"
|
|
49
53
|
}
|
|
50
54
|
}
|