@deepseek-ai/dsh-agent-loop-testkit 0.1.1-rc.2 → 0.1.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 +2 -2
- package/README.md +83 -5
- package/README.zh.md +86 -8
- package/package.json +16 -16
package/README.i18n.yaml
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
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
|
-
README.md:
|
|
6
|
-
README.zh.md:
|
|
5
|
+
README.md: 26fca33c24c19ac25a00162943e085c2d753efc7
|
|
6
|
+
README.zh.md: 679a586bce4923283f9eee6a05f511a7733e88f2
|
package/README.md
CHANGED
|
@@ -1,10 +1,33 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
description: "Shared service mounting for tests that exercise the concrete AgentLoop, for test authors wiring real loop prerequisites."
|
|
3
|
+
kind: "package-library"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# @deepseek-ai/dsh-agent-loop-testkit
|
|
2
7
|
|
|
3
8
|
English | [中文](README.zh.md)
|
|
4
9
|
|
|
5
|
-
|
|
10
|
+
## Summary
|
|
11
|
+
|
|
12
|
+
`dsh-agent-loop-testkit` mounts the standard prerequisite services a test needs before loading the concrete `AgentLoop` — the LLM runtime, session store, system-prompt registry, tool registry, and agent registry — in dependency order, with one call. The loop itself, adapters, optional plugins, agents, and teardown stay in the test's hands, so each scenario keeps its own load order and topology. Use it when a test's subject is loop behavior rather than service wiring; tests that probe injection failures or partial topologies mount their dependencies directly. It registers no model-facing behavior of its own.
|
|
13
|
+
|
|
14
|
+
## Table of Contents
|
|
15
|
+
|
|
16
|
+
- [Use this package](#use-this-package)
|
|
17
|
+
- [Understand the implementation](#understand-the-implementation)
|
|
18
|
+
- [Further Exploration](#further-exploration)
|
|
19
|
+
- [Model Experience](#model-experience)
|
|
20
|
+
- [Known Limitations and Deferred Work](#known-limitations-and-deferred-work)
|
|
21
|
+
- [Dev Note](#dev-note)
|
|
6
22
|
|
|
7
|
-
|
|
23
|
+
-----
|
|
24
|
+
|
|
25
|
+
<a id="use-this-package"></a>
|
|
26
|
+
## Use this package
|
|
27
|
+
|
|
28
|
+
This package gives an AgentLoop test a working service topology before the loop is mounted: call the helper on your test context, then mount `AgentLoop` with the configuration under test and register your adapter and optional plugins.
|
|
29
|
+
|
|
30
|
+
### Minimal example
|
|
8
31
|
|
|
9
32
|
```ts
|
|
10
33
|
import { Context } from '@deepseek-ai/cordis'
|
|
@@ -18,8 +41,48 @@ await mountAgentLoopTestDependencies(ctx)
|
|
|
18
41
|
await ctx.plugin(AgentLoop, { agents: [] })
|
|
19
42
|
```
|
|
20
43
|
|
|
21
|
-
|
|
44
|
+
The helper activates the LLM, session, system-prompt, tool, and agent services in dependency order and returns before the loop is mounted. System-prompt and tool-registry configuration can be forwarded through `options`; the helper provides no test defaults beyond those the services own.
|
|
45
|
+
|
|
46
|
+
### When to use it
|
|
47
|
+
|
|
48
|
+
Use the helper for tests whose subject is the loop: load order, retries, tool execution, or session behavior on a real prerequisite stack. Mount dependencies directly when a test probes service load order, injection failures, partial topologies, or teardown — the helper hides exactly the wiring such tests must control.
|
|
49
|
+
|
|
50
|
+
### What can go wrong
|
|
51
|
+
|
|
52
|
+
A plugin-load failure rejects the helper call; services activated earlier in the sequence remain owned by your context and unwind with it. The context owns every mounted service, so dispose it after the test.
|
|
53
|
+
|
|
54
|
+
-----
|
|
55
|
+
|
|
56
|
+
<a id="understand-the-implementation"></a>
|
|
57
|
+
## Understand the implementation
|
|
58
|
+
|
|
59
|
+
<details>
|
|
60
|
+
<summary>Implementation internals — click to expand</summary>
|
|
61
|
+
|
|
62
|
+
This section explains the design of the helper; the observable behavior is fully covered in [Use this package](#use-this-package).
|
|
22
63
|
|
|
64
|
+
### Design
|
|
65
|
+
|
|
66
|
+
The helper is one function, `mountAgentLoopTestDependencies`, that mounts five service plugins in a fixed dependency order — LLM, session, system-prompt, tool registry, then agent registry — and deliberately stops before `AgentLoop` itself, so the caller controls loop load order and the topology under test. Ownership stays with the caller's context: every mounted service is context-owned, a plugin-load failure rejects the promise, and earlier services unwind with the context. The implementation lives in [`src/index.ts`](src/index.ts); the [`src/invariant.ts`](src/invariant.ts) companion declares no runtime invariant because the package owns no production event stream or mutable data — consuming test suites exercise its behavior.
|
|
67
|
+
|
|
68
|
+
</details>
|
|
69
|
+
|
|
70
|
+
-----
|
|
71
|
+
|
|
72
|
+
<a id="further-exploration"></a>
|
|
73
|
+
## Further Exploration
|
|
74
|
+
|
|
75
|
+
Read these pages when the package-level contract is not enough. They move from the loop to the services the helper mounts and the tests that use it.
|
|
76
|
+
|
|
77
|
+
- [Agent loop package](../../core/agent-loop/README.md) — the concrete loop this helper prepares tests for.
|
|
78
|
+
- [Session package](../../core/session/README.md) — the session store the helper mounts.
|
|
79
|
+
- [LLM package](../../llm/llm/README.md) — the LLM runtime and adapter contract the helper mounts.
|
|
80
|
+
- [Testing policy](../../../docs/testing.md) — the coverage tiers these tests serve.
|
|
81
|
+
- [Test-support group map](../README.md) — sibling harnesses and support packages.
|
|
82
|
+
|
|
83
|
+
-----
|
|
84
|
+
|
|
85
|
+
<a id="model-experience"></a>
|
|
23
86
|
## Model Experience
|
|
24
87
|
|
|
25
88
|
None, as this test-only composition helper neither drives nor modifies model requests.
|
|
@@ -30,4 +93,19 @@ None; this package neither assembles nor sends a provider request.
|
|
|
30
93
|
|
|
31
94
|
## Known Limitations and Deferred Work
|
|
32
95
|
|
|
33
|
-
-
|
|
96
|
+
<a id="known-limitations-and-deferred-work"></a>
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
These limits define what the helper does not share. They are current package constraints, not a task backlog.
|
|
100
|
+
|
|
101
|
+
- **Only the mandatory prerequisite spine is shared** — adapters, optional plugins, `AgentLoop`, agents, and context teardown remain caller-owned so scenario-specific ordering stays visible.
|
|
102
|
+
|
|
103
|
+
<a id="dev-note"></a>
|
|
104
|
+
### Dev Note
|
|
105
|
+
|
|
106
|
+
<details>
|
|
107
|
+
<summary>Working context for maintainers — click to expand</summary>
|
|
108
|
+
|
|
109
|
+
None.
|
|
110
|
+
|
|
111
|
+
</details>
|
package/README.zh.md
CHANGED
|
@@ -1,10 +1,33 @@
|
|
|
1
|
-
|
|
1
|
+
---
|
|
2
|
+
description: "为运行具体 AgentLoop 的测试挂载共享服务先决依赖,面向接线真实循环前置依赖的测试作者。"
|
|
3
|
+
kind: "package-library"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# @deepseek-ai/dsh-agent-loop-testkit
|
|
2
7
|
|
|
3
8
|
[English](README.md) | 中文
|
|
4
9
|
|
|
5
|
-
|
|
10
|
+
## 概述
|
|
11
|
+
|
|
12
|
+
`dsh-agent-loop-testkit` 为测试在加载具体 `AgentLoop` 之前所需的全部标准先决服务——LLM(大语言模型)运行时、会话存储、系统提示词注册表、工具注册表与 agent(智能体)注册表——按依赖顺序一键挂载。loop 本身、适配器、可选插件、agent 与清理仍由测试掌控,因此每个场景都保持自己的加载顺序与拓扑。当测试对象是 loop 行为而非服务接线时使用它;针对注入失败或部分拓扑的测试会直接挂载其依赖。它自身不注册任何模型可见行为。
|
|
13
|
+
|
|
14
|
+
## 目录
|
|
15
|
+
|
|
16
|
+
- [使用本包](#use-this-package)
|
|
17
|
+
- [理解实现](#understand-the-implementation)
|
|
18
|
+
- [进一步探索](#further-exploration)
|
|
19
|
+
- [模型体验](#model-experience)
|
|
20
|
+
- [已知限制与延期工作](#known-limitations-and-deferred-work)
|
|
21
|
+
- [开发备注](#dev-note)
|
|
6
22
|
|
|
7
|
-
|
|
23
|
+
-----
|
|
24
|
+
|
|
25
|
+
<a id="use-this-package"></a>
|
|
26
|
+
## 使用本包
|
|
27
|
+
|
|
28
|
+
本包在 loop 挂载前为 AgentLoop 测试提供可用的服务拓扑:在测试上下文上调用此辅助函数,然后用待测配置挂载 `AgentLoop`,并注册你的适配器与可选插件。
|
|
29
|
+
|
|
30
|
+
### 最小示例
|
|
8
31
|
|
|
9
32
|
```ts
|
|
10
33
|
import { Context } from '@deepseek-ai/cordis'
|
|
@@ -18,16 +41,71 @@ await mountAgentLoopTestDependencies(ctx)
|
|
|
18
41
|
await ctx.plugin(AgentLoop, { agents: [] })
|
|
19
42
|
```
|
|
20
43
|
|
|
21
|
-
|
|
44
|
+
该辅助函数按依赖顺序激活 LLM、会话、系统提示词、工具与 agent 服务,并在 loop 挂载前返回。系统提示词与工具注册表配置可通过 `options` 转发;除服务自有的默认值外,本辅助函数不提供测试默认值。
|
|
45
|
+
|
|
46
|
+
### 何时使用
|
|
47
|
+
|
|
48
|
+
当测试对象是 loop 本身——在真实先决依赖栈上的加载顺序、重试、工具执行或会话行为——时使用此辅助函数。当测试要探测服务加载顺序、注入失败、部分拓扑或清理时,请直接挂载依赖——辅助函数隐藏的正是这类测试必须控制的接线。
|
|
49
|
+
|
|
50
|
+
### 可能出什么问题
|
|
51
|
+
|
|
52
|
+
插件加载失败会使辅助函数调用被拒绝;顺序中较早激活的服务仍归你的上下文所有,并随上下文一起解除。上下文拥有所有已挂载服务,因此测试结束后请 dispose(资源释放)它。
|
|
53
|
+
|
|
54
|
+
-----
|
|
55
|
+
|
|
56
|
+
<a id="understand-the-implementation"></a>
|
|
57
|
+
## 理解实现
|
|
58
|
+
|
|
59
|
+
<details>
|
|
60
|
+
<summary>实现细节——点击展开</summary>
|
|
61
|
+
|
|
62
|
+
本节解释辅助函数的设计;可观察行为已在[使用本包](#use-this-package)中完整说明。
|
|
22
63
|
|
|
64
|
+
### 设计
|
|
65
|
+
|
|
66
|
+
该辅助函数是单个函数 `mountAgentLoopTestDependencies`,按固定依赖顺序——LLM、会话、系统提示词、工具注册表、agent 注册表——挂载五个服务插件,并刻意在 `AgentLoop` 之前停下,使调用方控制 loop 加载顺序与待测拓扑。所有权留在调用方的上下文:每个已挂载服务都归上下文所有,插件加载失败会拒绝 promise,较早的服务随上下文一起解除。实现位于 [`src/index.ts`](src/index.ts);[`src/invariant.ts`](src/invariant.ts) 配套入口声明无运行时不变式,因为本包不拥有任何生产事件流或可变数据——消费它的测试套件会检验其行为。
|
|
67
|
+
|
|
68
|
+
</details>
|
|
69
|
+
|
|
70
|
+
-----
|
|
71
|
+
|
|
72
|
+
<a id="further-exploration"></a>
|
|
73
|
+
## 进一步探索
|
|
74
|
+
|
|
75
|
+
当包级约定不够用时阅读以下页面。它们从 loop 逐步进入辅助函数挂载的服务以及使用它的测试。
|
|
76
|
+
|
|
77
|
+
- [Agent loop 包](../../core/agent-loop/README.zh.md)——本辅助函数为之准备测试的具体 loop。
|
|
78
|
+
- [会话包](../../core/session/README.zh.md)——辅助函数挂载的会话存储。
|
|
79
|
+
- [LLM 包](../../llm/llm/README.zh.md)——辅助函数挂载的 LLM 运行时与适配器约定。
|
|
80
|
+
- [测试策略](../../../docs/testing.zh.md)——这些测试所服务的覆盖层级。
|
|
81
|
+
- [test-support 组地图](../README.zh.md)——兄弟 harness 与支持包。
|
|
82
|
+
|
|
83
|
+
-----
|
|
84
|
+
|
|
85
|
+
<a id="model-experience"></a>
|
|
23
86
|
## 模型体验
|
|
24
87
|
|
|
25
|
-
|
|
88
|
+
无。该测试专用组合辅助函数既不驱动也不修改模型请求。
|
|
26
89
|
|
|
27
90
|
#### KV Cache 影响
|
|
28
91
|
|
|
29
|
-
|
|
92
|
+
无;本包既不组装也不发送提供方请求。
|
|
93
|
+
|
|
94
|
+
## 已知限制与延期工作
|
|
95
|
+
|
|
96
|
+
<a id="known-limitations-and-deferred-work"></a>
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
这些限制说明辅助函数不共享什么。它们是当前包约束,不是任务积压。
|
|
100
|
+
|
|
101
|
+
- **只共享必需的先决主干**——适配器、可选插件、`AgentLoop`、agent 与上下文清理仍由调用方负责,以使特定场景的挂载顺序清晰可见。
|
|
102
|
+
|
|
103
|
+
<a id="dev-note"></a>
|
|
104
|
+
### 开发备注
|
|
105
|
+
|
|
106
|
+
<details>
|
|
107
|
+
<summary>维护者的工作上下文——点击展开</summary>
|
|
30
108
|
|
|
31
|
-
|
|
109
|
+
无。
|
|
32
110
|
|
|
33
|
-
|
|
111
|
+
</details>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/dsh-agent-loop-testkit",
|
|
3
3
|
"description": "Shared prerequisite mounting for tests that exercise the concrete agent loop",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.2-alpha.3",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -32,22 +32,22 @@
|
|
|
32
32
|
],
|
|
33
33
|
"license": "MIT",
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@deepseek-ai/dsh-agent": "^0.1.
|
|
36
|
-
"@deepseek-ai/dsh-invariants": "^0.1.
|
|
37
|
-
"@deepseek-ai/dsh-llm": "^0.1.
|
|
38
|
-
"@deepseek-ai/dsh-
|
|
39
|
-
"@deepseek-ai/dsh-tools": "^0.1.
|
|
40
|
-
"@deepseek-ai/
|
|
41
|
-
"@deepseek-ai/
|
|
35
|
+
"@deepseek-ai/dsh-agent": "^0.1.2-alpha.3",
|
|
36
|
+
"@deepseek-ai/dsh-invariants": "^0.1.2-alpha.3",
|
|
37
|
+
"@deepseek-ai/dsh-llm": "^0.1.2-alpha.3",
|
|
38
|
+
"@deepseek-ai/dsh-session": "^0.1.2-alpha.3",
|
|
39
|
+
"@deepseek-ai/dsh-tools": "^0.1.2-alpha.3",
|
|
40
|
+
"@deepseek-ai/dsh-system-prompt": "^0.1.2-alpha.3",
|
|
41
|
+
"@deepseek-ai/cordis": "^4.0.2"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@deepseek-ai/dsh-
|
|
45
|
-
"@deepseek-ai/dsh-agent-loop": "^0.1.
|
|
46
|
-
"@deepseek-ai/dsh-
|
|
47
|
-
"@deepseek-ai/dsh-
|
|
48
|
-
"@deepseek-ai/dsh-
|
|
49
|
-
"@deepseek-ai/dsh-
|
|
50
|
-
"@deepseek-ai/
|
|
51
|
-
"@deepseek-ai/
|
|
44
|
+
"@deepseek-ai/dsh-invariants": "^0.1.2-alpha.3",
|
|
45
|
+
"@deepseek-ai/dsh-agent-loop": "^0.1.2-alpha.3",
|
|
46
|
+
"@deepseek-ai/dsh-llm": "^0.1.2-alpha.3",
|
|
47
|
+
"@deepseek-ai/dsh-session": "^0.1.2-alpha.3",
|
|
48
|
+
"@deepseek-ai/dsh-system-prompt": "^0.1.2-alpha.3",
|
|
49
|
+
"@deepseek-ai/dsh-agent": "^0.1.2-alpha.3",
|
|
50
|
+
"@deepseek-ai/cordis": "^4.0.2",
|
|
51
|
+
"@deepseek-ai/dsh-tools": "^0.1.2-alpha.3"
|
|
52
52
|
}
|
|
53
53
|
}
|