@deepseek-ai/dsh-agent-loop-testkit 0.2.1-alpha.1 → 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 +2 -2
- package/README.md +2 -0
- package/README.zh.md +2 -0
- 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 +19 -15
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
|
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
|
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
|
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.1-alpha.
|
|
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": "0.2.1-alpha.
|
|
31
|
-
"@deepseek-ai/dsh-agent-loop": "0.2.1-alpha.
|
|
32
|
-
"@deepseek-ai/dsh-llm": "0.2.1-alpha.
|
|
33
|
-
"@deepseek-ai/dsh-
|
|
34
|
-
"@deepseek-ai/dsh-
|
|
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",
|
|
35
37
|
"@deepseek-ai/cordis": "~4.0.5-alpha.1",
|
|
36
|
-
"@deepseek-ai/dsh-
|
|
37
|
-
"@deepseek-ai/dsh-
|
|
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
|
|
42
|
-
"@deepseek-ai/dsh-agent": "0.2.1-alpha.
|
|
43
|
-
"@deepseek-ai/dsh-llm": "0.2.1-alpha.
|
|
44
|
-
"@deepseek-ai/dsh-session": "0.2.1-alpha.
|
|
45
|
-
"@deepseek-ai/dsh-session-projection": "0.2.1-alpha.
|
|
46
|
-
"@deepseek-ai/dsh-
|
|
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",
|
|
47
50
|
"@deepseek-ai/cordis": "~4.0.5-alpha.1",
|
|
48
|
-
"@deepseek-ai/dsh-
|
|
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
|
}
|