@monotykamary/dsh-agent-loop-testkit 0.1.0-rc.10
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 +21 -0
- package/README.i18n.yaml +6 -0
- package/README.md +33 -0
- package/README.zh.md +33 -0
- package/lib/index.js +33 -0
- package/lib/invariant.js +23 -0
- package/lib/types/index.d.ts +30 -0
- package/lib/types/invariant.d.ts +16 -0
- package/package.json +53 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 DeepSeek
|
|
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.i18n.yaml
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each
|
|
2
|
+
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
|
+
# after editing either side, bring the other along and re-record with:
|
|
4
|
+
# pnpm run verify-translation-pairing --write packages/test-support/agent-loop-testkit/README.md
|
|
5
|
+
README.md: 3cc29ddefb169b6c3bbd209cc0470d45be384835
|
|
6
|
+
README.zh.md: cccc41e546cb8d9c695ad22f8541f58793eee6c2
|
package/README.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# `@monotykamary/dsh-agent-loop-testkit`
|
|
2
|
+
|
|
3
|
+
English | [中文](README.zh.md)
|
|
4
|
+
|
|
5
|
+
Shared prerequisite mounting for tests that exercise the concrete `AgentLoop`. `mountAgentLoopTestDependencies(ctx, options?)` installs the LLM, session, system-prompt, tool, and agent services in dependency order, then returns before the loop is mounted.
|
|
6
|
+
|
|
7
|
+
The caller registers adapters and optional plugins, mounts `AgentLoop` with the configuration under test, and disposes its own Context. System-prompt and tool-registry configuration can be forwarded through `options`; the helper does not provide test defaults beyond those owned by the services. A plugin-load failure rejects the helper call, while services activated earlier in the sequence remain owned by the caller's Context.
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { Context } from '@monotykamary/cordis'
|
|
11
|
+
import AgentLoop from '@monotykamary/dsh-agent-loop'
|
|
12
|
+
import { mountAgentLoopTestDependencies } from '@monotykamary/dsh-agent-loop-testkit'
|
|
13
|
+
|
|
14
|
+
const ctx = new Context()
|
|
15
|
+
|
|
16
|
+
await mountAgentLoopTestDependencies(ctx)
|
|
17
|
+
// Register the test adapter and any optional plugins here.
|
|
18
|
+
await ctx.plugin(AgentLoop, { agents: [] })
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Tests of injection failures, partial topology, service load order, or service teardown mount their dependencies directly instead of using this helper.
|
|
22
|
+
|
|
23
|
+
## Model Experience
|
|
24
|
+
|
|
25
|
+
None, as this test-only composition helper neither drives nor modifies model requests.
|
|
26
|
+
|
|
27
|
+
#### KV Cache effect
|
|
28
|
+
|
|
29
|
+
None; this package neither assembles nor sends a provider request.
|
|
30
|
+
|
|
31
|
+
## Known Limitations and Deferred Work
|
|
32
|
+
|
|
33
|
+
- **Only the mandatory prerequisite spine is shared** — adapters, optional plugins, `AgentLoop`, agents, and Context teardown remain caller-owned so scenario-specific ordering stays visible.
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# `@monotykamary/dsh-agent-loop-testkit`
|
|
2
|
+
|
|
3
|
+
[English](README.md) | 中文
|
|
4
|
+
|
|
5
|
+
为运行具体 `AgentLoop` 的测试共享挂载先决依赖。`mountAgentLoopTestDependencies(ctx, options?)` 按依赖顺序安装 LLM(大语言模型)、会话、系统提示词、工具和 agent(智能体)服务,然后在 agent loop 挂载前返回。
|
|
6
|
+
|
|
7
|
+
调用方注册适配器和可选插件,使用待测配置挂载 `AgentLoop`,并 dispose(资源释放)自己的 Context。系统提示词和工具注册表配置可通过 `options` 转发;该辅助函数不提供超出服务自有默认值的测试默认值。插件加载失败会使辅助函数调用被拒绝,而顺序中较早激活的服务仍归调用方的 Context 所有。
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { Context } from '@monotykamary/cordis'
|
|
11
|
+
import AgentLoop from '@monotykamary/dsh-agent-loop'
|
|
12
|
+
import { mountAgentLoopTestDependencies } from '@monotykamary/dsh-agent-loop-testkit'
|
|
13
|
+
|
|
14
|
+
const ctx = new Context()
|
|
15
|
+
|
|
16
|
+
await mountAgentLoopTestDependencies(ctx)
|
|
17
|
+
// Register the test adapter and any optional plugins here.
|
|
18
|
+
await ctx.plugin(AgentLoop, { agents: [] })
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
针对注入失败、部分拓扑、服务加载顺序或服务清理的测试会直接挂载其依赖,而不使用此辅助函数。
|
|
22
|
+
|
|
23
|
+
## 模型体验
|
|
24
|
+
|
|
25
|
+
无。该测试专用组合辅助工具既不驱动也不修改模型请求。
|
|
26
|
+
|
|
27
|
+
#### KV Cache 影响
|
|
28
|
+
|
|
29
|
+
无;该包既不组装也不发送提供方请求。
|
|
30
|
+
|
|
31
|
+
## 已知限制与暂缓事项
|
|
32
|
+
|
|
33
|
+
- **只共享必需的先决主干**:适配器、可选插件、`AgentLoop`、agent 和 Context 清理仍由调用方负责,以使特定场景的挂载顺序清晰可见。
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import AgentRegistry from "@monotykamary/dsh-agent";
|
|
2
|
+
import LlmRuntime from "@monotykamary/dsh-llm";
|
|
3
|
+
import SessionStore from "@monotykamary/dsh-session";
|
|
4
|
+
import SystemPrompt from "@monotykamary/dsh-system-prompt";
|
|
5
|
+
import ToolRuntime from "@monotykamary/dsh-tools";
|
|
6
|
+
//#region lib/types/index.js
|
|
7
|
+
/**
|
|
8
|
+
* Shared mounting for the services required before tests load the concrete
|
|
9
|
+
* agent loop. The caller retains ownership of the context, loop, adapters,
|
|
10
|
+
* optional plugins, and teardown.
|
|
11
|
+
* @module @monotykamary/dsh-agent-loop-testkit
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Mount the standard prerequisite services for an AgentLoop test.
|
|
15
|
+
*
|
|
16
|
+
* The function deliberately does not mount AgentLoop or register an adapter,
|
|
17
|
+
* so tests retain control of load order and the topology under test. The
|
|
18
|
+
* context owns every mounted service and remains responsible for disposal. A
|
|
19
|
+
* plugin-load failure rejects the promise; services activated earlier in the
|
|
20
|
+
* sequence remain context-owned and unwind with that context.
|
|
21
|
+
* @param ctx - test context that owns the mounted services.
|
|
22
|
+
* @param options - optional service configuration forwarded without mutation.
|
|
23
|
+
* @returns after every prerequisite service has activated.
|
|
24
|
+
*/
|
|
25
|
+
async function mountAgentLoopTestDependencies(ctx, options = {}) {
|
|
26
|
+
await ctx.plugin(LlmRuntime);
|
|
27
|
+
await ctx.plugin(SessionStore);
|
|
28
|
+
await ctx.plugin(SystemPrompt, options.systemPrompt ?? {});
|
|
29
|
+
await ctx.plugin(ToolRuntime, options.tools ?? {});
|
|
30
|
+
await ctx.plugin(AgentRegistry);
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { mountAgentLoopTestDependencies };
|
package/lib/invariant.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//#region lib/types/invariant.js
|
|
2
|
+
/**
|
|
3
|
+
* Package-owned invariant companion for `@monotykamary/dsh-agent-loop-testkit`.
|
|
4
|
+
* @module @monotykamary/dsh-agent-loop-testkit/invariant
|
|
5
|
+
*/
|
|
6
|
+
const PACKAGE_NAME = "@monotykamary/dsh-agent-loop-testkit";
|
|
7
|
+
/** Cordis companion plugin name. */
|
|
8
|
+
const name = "agent-loop-testkit-invariant";
|
|
9
|
+
/** Service required before the companion can reserve package ownership. */
|
|
10
|
+
const inject = ["invariants"];
|
|
11
|
+
/**
|
|
12
|
+
* No runtime invariant: this test-support package owns no production event stream or mutable data;
|
|
13
|
+
* consuming test suites exercise its behavior.
|
|
14
|
+
*/
|
|
15
|
+
const install = () => {};
|
|
16
|
+
/**
|
|
17
|
+
* Register this package's invariant companion.
|
|
18
|
+
* @param ctx - Cordis context carrying the invariant service.
|
|
19
|
+
* @returns the installed registration's disposer after setup succeeds.
|
|
20
|
+
*/
|
|
21
|
+
const apply = (ctx) => Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));
|
|
22
|
+
//#endregion
|
|
23
|
+
export { apply, inject, name };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared mounting for the services required before tests load the concrete
|
|
3
|
+
* agent loop. The caller retains ownership of the context, loop, adapters,
|
|
4
|
+
* optional plugins, and teardown.
|
|
5
|
+
* @module @monotykamary/dsh-agent-loop-testkit
|
|
6
|
+
*/
|
|
7
|
+
import type { Context } from '@monotykamary/cordis';
|
|
8
|
+
import type { Config as SystemPromptConfig } from '@monotykamary/dsh-system-prompt';
|
|
9
|
+
import type { Config as ToolRuntimeConfig } from '@monotykamary/dsh-tools';
|
|
10
|
+
/** Configuration forwarded to the prerequisite service plugins. */
|
|
11
|
+
export interface AgentLoopTestDependenciesOptions {
|
|
12
|
+
/** Configuration for the system-prompt registry. */
|
|
13
|
+
readonly systemPrompt?: SystemPromptConfig;
|
|
14
|
+
/** Configuration for the tool registry. */
|
|
15
|
+
readonly tools?: ToolRuntimeConfig;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Mount the standard prerequisite services for an AgentLoop test.
|
|
19
|
+
*
|
|
20
|
+
* The function deliberately does not mount AgentLoop or register an adapter,
|
|
21
|
+
* so tests retain control of load order and the topology under test. The
|
|
22
|
+
* context owns every mounted service and remains responsible for disposal. A
|
|
23
|
+
* plugin-load failure rejects the promise; services activated earlier in the
|
|
24
|
+
* sequence remain context-owned and unwind with that context.
|
|
25
|
+
* @param ctx - test context that owns the mounted services.
|
|
26
|
+
* @param options - optional service configuration forwarded without mutation.
|
|
27
|
+
* @returns after every prerequisite service has activated.
|
|
28
|
+
*/
|
|
29
|
+
export declare function mountAgentLoopTestDependencies(ctx: Context, options?: AgentLoopTestDependenciesOptions): Promise<void>;
|
|
30
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Package-owned invariant companion for `@monotykamary/dsh-agent-loop-testkit`.
|
|
3
|
+
* @module @monotykamary/dsh-agent-loop-testkit/invariant
|
|
4
|
+
*/
|
|
5
|
+
import type { Context } from '@monotykamary/cordis';
|
|
6
|
+
/** Cordis companion plugin name. */
|
|
7
|
+
export declare const name = "agent-loop-testkit-invariant";
|
|
8
|
+
/** Service required before the companion can reserve package ownership. */
|
|
9
|
+
export declare const inject: string[];
|
|
10
|
+
/**
|
|
11
|
+
* Register this package's invariant companion.
|
|
12
|
+
* @param ctx - Cordis context carrying the invariant service.
|
|
13
|
+
* @returns the installed registration's disposer after setup succeeds.
|
|
14
|
+
*/
|
|
15
|
+
export declare const apply: (ctx: Context) => Promise<() => void>;
|
|
16
|
+
//# sourceMappingURL=invariant.d.ts.map
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@monotykamary/dsh-agent-loop-testkit",
|
|
3
|
+
"description": "Shared prerequisite mounting for tests that exercise the concrete agent loop",
|
|
4
|
+
"version": "0.1.0-rc.10",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/deepseek-ai/deepseek-harness.git",
|
|
11
|
+
"directory": "packages/test-support/agent-loop-testkit"
|
|
12
|
+
},
|
|
13
|
+
"type": "module",
|
|
14
|
+
"main": "lib/index.js",
|
|
15
|
+
"types": "lib/types/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./lib/types/index.d.ts",
|
|
19
|
+
"default": "./lib/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./invariant": {
|
|
22
|
+
"types": "./lib/types/invariant.d.ts",
|
|
23
|
+
"default": "./lib/invariant.js"
|
|
24
|
+
},
|
|
25
|
+
"./src/*": "./src/*",
|
|
26
|
+
"./package.json": "./package.json"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"lib/index.js",
|
|
30
|
+
"lib/invariant.js",
|
|
31
|
+
"lib/types/**/*.d.ts"
|
|
32
|
+
],
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"peerDependencies": {
|
|
35
|
+
"@monotykamary/dsh-llm": "^0.1.0-rc.10",
|
|
36
|
+
"@monotykamary/dsh-invariants": "^0.1.0-rc.10",
|
|
37
|
+
"@monotykamary/dsh-system-prompt": "^0.1.0-rc.10",
|
|
38
|
+
"@monotykamary/dsh-agent": "^0.1.0-rc.10",
|
|
39
|
+
"@monotykamary/dsh-session": "^0.1.0-rc.10",
|
|
40
|
+
"@monotykamary/dsh-tools": "^0.1.0-rc.10",
|
|
41
|
+
"@monotykamary/cordis": "^4.0.1"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@monotykamary/dsh-agent": "^0.1.0-rc.10",
|
|
45
|
+
"@monotykamary/dsh-agent-loop": "^0.1.0-rc.10",
|
|
46
|
+
"@monotykamary/dsh-invariants": "^0.1.0-rc.10",
|
|
47
|
+
"@monotykamary/dsh-llm": "^0.1.0-rc.10",
|
|
48
|
+
"@monotykamary/dsh-system-prompt": "^0.1.0-rc.10",
|
|
49
|
+
"@monotykamary/dsh-session": "^0.1.0-rc.10",
|
|
50
|
+
"@monotykamary/dsh-tools": "^0.1.0-rc.10",
|
|
51
|
+
"@monotykamary/cordis": "^4.0.1"
|
|
52
|
+
}
|
|
53
|
+
}
|