dsh-parallel-tools-prompt 0.2.1-rc.4 → 0.2.1-rc.6
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.md +17 -14
- package/cordis.patch.yml +5 -3
- package/lib/client.js +6 -6
- package/lib/index.d.ts +1 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +9 -15
- package/lib/index.js.map +1 -1
- package/lib/prompt.d.ts +5 -3
- package/lib/prompt.d.ts.map +1 -1
- package/lib/prompt.js +4 -2
- package/lib/prompt.js.map +1 -1
- package/package.json +1 -1
- package/skills/batch-tool-calls/SKILL.md +8 -8
package/README.md
CHANGED
|
@@ -6,18 +6,19 @@
|
|
|
6
6
|
|
|
7
7
|
## 行为
|
|
8
8
|
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
- 同一 Agent 幂等注册;插件卸载与 Agent 释放都清理 section。插件重载时为仍存活的目标根 Agent
|
|
13
|
-
-
|
|
9
|
+
- 插件启用后,默认通过 `contextReminder` 向所有 Agent(包括子智能体)提供提醒,覆盖所有 preset 以及没有 preset 的会话;`presetIds` 与根 Agent 筛选不限制此通道。插件重载前已存活的子智能体也会在下一步骤获得提醒。
|
|
10
|
+
- `systemPromptSection` 是默认关闭的可选通道;只有此通道按符合条件的根 Agent 与 `presetIds` 筛选,默认目标为 `standard` 根 Agent,跳过子智能体及不在列表中的 preset。
|
|
11
|
+
- 使用公开 Agent 生命周期、session projection 与 `systemPrompt.section()`,不替换 preset。系统提示词 section 固定名称 `parallel-tools:guidance`、order 1050、禁止插值;不注入时间戳、工具列表或每轮变化的数据。
|
|
12
|
+
- 同一 Agent 幂等注册;插件卸载与 Agent 释放都清理 section。插件重载时为仍存活的目标根 Agent 补挂已启用的 section,并覆盖仍存活 Agent 的提醒通道;源码更新建议重启宿主加载新模块。
|
|
13
|
+
- 两个独立开关选择注入通道(默认只走 CONTEXT 提醒):`contextReminder`(默认 `true`)与 `systemPromptSection`(默认 `false`,设为 `true` 输出 `systemPrompt.section()` 的指引内容)。提醒通过 `agent/pre-step` 在下一步骤追加一条带独立 `source.kind: parallel-tools-scheduling` 的 CONTEXT 消息,写入会话历史并渲染为 CONTEXT 块,与宿主 `time-context` 同一机制;已持久化的 source 用于去重,包括继承历史中的提醒,每个 Agent 最多交付一次,已有或继承的提醒不会重复注入。两者可同时开启;同时关闭则插件不注入任何内容。提醒进入历史,卸载不会删除。这不是每轮重复提醒,也不保证长期遵循。
|
|
14
14
|
- 插件详情页(Plugins → 本插件)在描述与组件列表之间提供这两个开关的设置表单,开关即时写入当前 profile 的 patch。两个字段声明为 `.volatile()`,修改不重启插件:`contextReminder` 在下一步骤生效;系统提示词开关对修改之后重新组装提示词的会话生效(已建立的会话沿用旧提示词)。浏览器端由 `src/client` 经 `scripts/build-client.mjs` 构建为 `lib/client.js`,按宿主客户端模块格式封装;表单要求 profile 里条目 id 为 `parallel-tools-prompt`。
|
|
15
|
-
-
|
|
15
|
+
- 两个注入通道共用同一条 DAG 调度规则:工具调用是节点,前置结果、执行条件、审批与共享状态顺序是边。围绕当前子目标识别已满足前置条件且参数已知的有用调用,在工具/输出限制内同轮发出互不依赖的调用;结果返回后重新判断就绪集合,不重复已完成或仍在运行的工作。独立证据可一起收集,即使后续决策需要汇总它们。
|
|
16
|
+
- DAG 仅是内部调度模型,不要求画图、逐轮列计划或添加调度专用轮次;正常的计划、todo 和审批流程仍须遵守。只有一个就绪调用时就单次执行,不凑调用;读后写、共享状态冲突以及由前序结果决定是否/如何执行的操作仍保持顺序。
|
|
16
17
|
- 同轮多个工具调用不代表真正同时执行;执行并发仍由DSH调度器决定。
|
|
17
18
|
|
|
18
19
|
## 版本、依赖与发布
|
|
19
20
|
|
|
20
|
-
插件版本 `0.2.1-rc.
|
|
21
|
+
插件版本 `0.2.1-rc.6` 跟随 DSH 的 `0.2.1` 版本线,RC 序号独立递增,不等于宿主 RC 序号。最低宿主要求 `>=0.2.1-rc.3`,Node.js `>=24.9.0`。开发锁文件以 RC.5 为基线;RC.3 的相关接口已做源码比对,完整插件测试本次运行在 RC.5 依赖上,不冒充两套运行验收。
|
|
21
22
|
|
|
22
23
|
宿主库以 peerDependencies 声明,同时列入 devDependencies 供构建测试:Cordis `4.0.5`、Schemastery `3.18.5`、DSH agent/llm/preset-registry/session-projection/system-prompt 使用 `^0.2.1-rc.3`。不将宿主服务打包为普通运行依赖,避免重复服务身份。semver caret 不跨 `0.3`,也不自动接纳不同版本号的预发布版本。
|
|
23
24
|
|
|
@@ -31,7 +32,7 @@
|
|
|
31
32
|
|
|
32
33
|
## 开发与安装
|
|
33
34
|
|
|
34
|
-
|
|
35
|
+
已在本地 Web profile 链接安装并进行人工观察。一次探索任务出现连续多调用批次,但模型同时发生切换,不能据此归因于插件或宣称 token/费用节省。
|
|
35
36
|
|
|
36
37
|
```sh
|
|
37
38
|
npm ci
|
|
@@ -41,20 +42,20 @@ npm test
|
|
|
41
42
|
npm pack --dry-run
|
|
42
43
|
```
|
|
43
44
|
|
|
44
|
-
确认愿意启用后,手动安装本目录到目标 profile,例如 `dsh plugin --profile web add .`;Desktop 选择 `--profile desktop
|
|
45
|
+
确认愿意启用后,手动安装本目录到目标 profile,例如 `dsh plugin --profile web add .`;Desktop 选择 `--profile desktop`。本插件提供客户端设置 UI,可在 Plugins → 本插件详情页调整两个注入通道。
|
|
45
46
|
|
|
46
47
|
直接调用插件默认 `enabled: false`;bundle显式配置 `enabled: true`,安装bundle即选择启用。配置:
|
|
47
48
|
|
|
48
49
|
```yaml
|
|
49
50
|
enabled: true
|
|
50
|
-
systemPromptSection:
|
|
51
|
-
contextReminder:
|
|
52
|
-
presetIds: [standard]
|
|
51
|
+
systemPromptSection: false # 默认;设为 true 选择启用系统提示词通道
|
|
52
|
+
contextReminder: true # 默认;所有 Agent(含子智能体),不限 preset
|
|
53
|
+
presetIds: [standard] # 默认;只筛选系统提示词通道的目标根 Agent
|
|
53
54
|
```
|
|
54
55
|
|
|
55
|
-
**注意:profile 的 `cordis.patch.yml` 覆盖本插件时,`config` 是整体替换、不与 bundle 默认值深合并。**
|
|
56
|
+
**注意:profile 的 `cordis.patch.yml` 覆盖本插件时,`config` 是整体替换、不与 bundle 默认值深合并。** 覆盖项必须写全需要的字段,尤其是 `enabled: true`;否则 `enabled` 回落为默认 `false`,插件静默不注入。省略的通道字段使用上述 schema 默认值;自定义系统提示词目标时也要保留所需 `presetIds`。已有 profile 中显式设置的值不会自动迁移:例如原来的 `contextReminder: false` 或 `systemPromptSection: true` 仍保留,需通过设置 UI 或手动修改 profile 才会改变。验收方式:系统提示词通道看新会话 `system/message` 中是否出现 `Tool-call scheduling:`;CONTEXT 通道看会话里是否出现 `source.kind` 为 `parallel-tools-scheduling` 的消息。
|
|
56
57
|
|
|
57
|
-
`presetIds` 是精确ID
|
|
58
|
+
`presetIds` 是精确 ID 列表,不是正则,且只控制选择启用后的系统提示词通道,不影响 CONTEXT 提醒。系统提示词的自定义目标仅适用于原生工具调用 preset;不要把 PTC 加入该列表,以免对专用执行模式施加额外系统指导。默认 CONTEXT 提醒仍覆盖 PTC、minimal、creator 等所有 preset、无 preset 会话及子智能体。根会话 fork 可以保留历史 parentSession,不会仅因此被当作子智能体;若继承了已有提醒,则不会再注入。
|
|
58
59
|
|
|
59
60
|
卸载会释放注册;已有模型历史中的旧指令不会被改写或删除。若宿主需要重新投影系统提示,生效边界由宿主管理;稳妥方式是重启后继续原会话。首次安装可能改变system前缀并影响一次缓存复用;不能保证零缓存影响。
|
|
60
61
|
|
|
@@ -62,6 +63,8 @@ presetIds: [standard]
|
|
|
62
63
|
|
|
63
64
|
主要借鉴 [bash-agent #99](https://github.com/lloydzhou/bash-agent/issues/99) 的就绪批次思路及 [#100](https://github.com/lloydzhou/bash-agent/issues/100) 对实测/离线估算的讨论;同时参考 [Anthropic并行调用指南](https://platform.claude.com/docs/en/agents-and-tools/tool-use/parallel-tool-use)、[LLMCompiler](https://github.com/SqueezeAILab/LLMCompiler) 和 [Superpowers并行委派skill](https://github.com/obra/superpowers/blob/main/skills/dispatching-parallel-agents/SKILL.md)。本插件提示词为针对DSH自行编写的简短文本,不移植其执行器或照搬专用工具调用格式。
|
|
64
65
|
|
|
66
|
+
提示词取舍:参考 [bash-agent 的系统提示词基准](https://github.com/lloydzhou/bash-agent/blob/main/tests/fixtures/system_prompt_expected.txt) 中“围绕当前子目标前瞻、独立证据一起收集、是否/如何执行由前序结果决定时等待、不凑调用”;借鉴 [LLMCompiler planner](https://github.com/SqueezeAILab/LLMCompiler/blob/main/src/llm_compiler/planner.py) 的动作输入依赖模型,但不引入其计划 DSL、`$id` 或 `join` 工具;采用 Superpowers 的共享状态隔离边界,而不是要求为普通工具调用创建子代理。Anthropic 指南也明确同轮调用的实际并发与执行顺序由宿主决定。
|
|
67
|
+
|
|
65
68
|
LLMCompiler收益来自框架与调度;bash-agent历史DAG合并收益是离线估算;这些都不是本插件的实测收益。生命周期测试只证明接入/清理正确,不证明模型更快、更省。
|
|
66
69
|
|
|
67
70
|
## 临时 LLM 提示调试
|
package/cordis.patch.yml
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
# Installing/enabling this bundle is the explicit opt-in. Direct plugin use
|
|
2
|
-
# defaults to enabled:false.
|
|
3
|
-
#
|
|
4
|
-
#
|
|
2
|
+
# defaults to enabled:false. The one-time CONTEXT reminder applies to all agents,
|
|
3
|
+
# including subagents and all presets. The optional system-prompt channel remains
|
|
4
|
+
# limited to eligible roots selected by presetIds. No scheduler changes.
|
|
5
5
|
- insert:
|
|
6
6
|
- id: parallel-tools-prompt
|
|
7
7
|
name: dsh-parallel-tools-prompt
|
|
8
8
|
config:
|
|
9
9
|
enabled: true
|
|
10
|
+
contextReminder: true
|
|
11
|
+
systemPromptSection: false
|
|
10
12
|
presetIds: [standard]
|
package/lib/client.js
CHANGED
|
@@ -38,18 +38,18 @@ window.__ModuleLoader__.load({
|
|
|
38
38
|
var LOCALE = "settings.parallelToolsPrompt";
|
|
39
39
|
var en = {
|
|
40
40
|
systemPrompt: "Inject into system prompt",
|
|
41
|
-
systemPromptHint: "Static guidance section in the system prompt (default
|
|
41
|
+
systemPromptHint: "Static guidance section for eligible root agents in the system prompt (default off). Applies to sessions that assemble their prompt after the change.",
|
|
42
42
|
context: "Inject as context message",
|
|
43
|
-
contextHint: "One-time CONTEXT message delivered at the next step
|
|
43
|
+
contextHint: "One-time CONTEXT message for all agents, including subagents (default on), delivered at the next step and kept in session history.",
|
|
44
44
|
note: "Both can be on together; with both off the plugin injects nothing.",
|
|
45
45
|
unavailable: "The plugin is not loaded or its settings are not served, so it cannot be configured right now.",
|
|
46
46
|
readOnly: "This deployment stores settings read-only."
|
|
47
47
|
};
|
|
48
48
|
var zh = {
|
|
49
49
|
systemPrompt: "\u6CE8\u5165\u5230\u7CFB\u7EDF\u63D0\u793A\u8BCD",
|
|
50
|
-
systemPromptHint: "\u5728\u7CFB\u7EDF\u63D0\u793A\u8BCD\u4E2D\u52A0\u5165\u56FA\u5B9A\u7684\u8C03\u5EA6\u6307\u5F15\uFF08\u9ED8\u8BA4\
|
|
50
|
+
systemPromptHint: "\u4E3A\u7B26\u5408\u8303\u56F4\u7684\u6839 Agent \u5728\u7CFB\u7EDF\u63D0\u793A\u8BCD\u4E2D\u52A0\u5165\u56FA\u5B9A\u7684\u8C03\u5EA6\u6307\u5F15\uFF08\u9ED8\u8BA4\u5173\u95ED\uFF09\u3002\u5BF9\u4FEE\u6539\u4E4B\u540E\u91CD\u65B0\u7EC4\u88C5\u63D0\u793A\u8BCD\u7684\u4F1A\u8BDD\u751F\u6548\u3002",
|
|
51
51
|
context: "\u4EE5 CONTEXT \u6D88\u606F\u6CE8\u5165",
|
|
52
|
-
contextHint: "\u5728\u4E0B\u4E00\u6B65\u9AA4\u9001\u8FBE\u4E00\
|
|
52
|
+
contextHint: "\u9ED8\u8BA4\u5F00\u542F\uFF0C\u5BF9\u6240\u6709 Agent\uFF08\u5305\u62EC\u5B50\u4EE3\u7406\uFF09\u751F\u6548\uFF1B\u5728\u4E0B\u4E00\u6B65\u9AA4\u9001\u8FBE\u4E00\u6B21 CONTEXT \u6D88\u606F\uFF0C\u5E76\u4FDD\u7559\u5728\u4F1A\u8BDD\u5386\u53F2\u4E2D\u3002",
|
|
53
53
|
note: "\u4E24\u8005\u53EF\u540C\u65F6\u5F00\u542F\uFF1B\u90FD\u5173\u95ED\u65F6\u63D2\u4EF6\u4E0D\u6CE8\u5165\u4EFB\u4F55\u5185\u5BB9\u3002",
|
|
54
54
|
unavailable: "\u63D2\u4EF6\u672A\u52A0\u8F7D\u6216\u5176\u8BBE\u7F6E\u672A\u63D0\u4F9B\uFF0C\u6682\u65F6\u65E0\u6CD5\u914D\u7F6E\u3002",
|
|
55
55
|
readOnly: "\u672C\u90E8\u7F72\u7684\u8BBE\u7F6E\u4E3A\u53EA\u8BFB\u3002"
|
|
@@ -77,14 +77,14 @@ window.__ModuleLoader__.load({
|
|
|
77
77
|
title: t("systemPrompt"),
|
|
78
78
|
hint: t("systemPromptHint"),
|
|
79
79
|
disabled,
|
|
80
|
-
checked: values["systemPromptSection"]
|
|
80
|
+
checked: values["systemPromptSection"] === true,
|
|
81
81
|
onChange: (checked) => props.setField("systemPromptSection", checked)
|
|
82
82
|
}),
|
|
83
83
|
Row({
|
|
84
84
|
title: t("context"),
|
|
85
85
|
hint: t("contextHint"),
|
|
86
86
|
disabled,
|
|
87
|
-
checked: values["contextReminder"]
|
|
87
|
+
checked: values["contextReminder"] !== false,
|
|
88
88
|
onChange: (checked) => props.setField("contextReminder", checked)
|
|
89
89
|
}),
|
|
90
90
|
(0, import_jsx_runtime.jsx)("div", { style: hintStyle, children: disabled ? t("readOnly") : t("note") })
|
package/lib/index.d.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import type { Context } from '@deepseek-ai/cordis';
|
|
2
2
|
import z from '@deepseek-ai/schemastery';
|
|
3
|
-
export { BATCH_RULE, PARALLEL_TOOLS_PROMPT, SECTION_NAME, SECTION_ORDER } from './prompt.js';
|
|
3
|
+
export { BATCH_RULE, CONTEXT_REMINDER, PARALLEL_TOOLS_PROMPT, SECTION_NAME, SECTION_ORDER } from './prompt.js';
|
|
4
4
|
export declare const name = "parallel-tools-prompt";
|
|
5
5
|
export declare const inject: string[];
|
|
6
|
-
/** Model-facing text of the optional context-channel reminder. */
|
|
7
|
-
export declare const CONTEXT_REMINDER = "Every response: before answering, check what else the current subgoal already has ready and issue ALL ready, independent tool calls together in this one response \u2014 same-tool calls on different targets, parallel reads, independent searches and checks. Each response is one model round trip; issuing ready work one call at a time spends one round trip per call. Hold a call only for real dependencies: its arguments need an earlier result, read-before-edit, shared-file or approval ordering. A single call is fine when nothing else is ready; never invent calls to fill a batch.";
|
|
8
6
|
/** Source kind of the reminder message; the host renders unknown context kinds as CONTEXT blocks. */
|
|
9
7
|
export declare const CONTEXT_SOURCE_KIND = "parallel-tools-scheduling";
|
|
10
8
|
declare module '@deepseek-ai/dsh-llm' {
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAMnD,OAAO,CAAC,MAAM,0BAA0B,CAAC;AAKzC,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAMnD,OAAO,CAAC,MAAM,0BAA0B,CAAC;AAKzC,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE/G,eAAO,MAAM,IAAI,0BAA0B,CAAC;AAC5C,eAAO,MAAM,MAAM,UAAmD,CAAC;AAEvE,qGAAqG;AACrG,eAAO,MAAM,mBAAmB,8BAA8B,CAAC;AAE/D,OAAO,QAAQ,sBAAsB,CAAC;IACpC,UAAU,gBAAgB;QACxB,CAAC,mBAAmB,CAAC,EAAE;YAAE,IAAI,EAAE,OAAO,mBAAmB,CAAC;YAAC,IAAI,EAAE,QAAQ,CAAC;YAAC,OAAO,EAAE,MAAM,CAAA;SAAE,CAAC;KAC9F;CACF;AASD,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;aAkBjB,CAAC;AAEH,MAAM,MAAM,MAAM,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC;AAmD/C,8EAA8E;AAC9E,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAwDxD"}
|
package/lib/index.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { createUserMessage } from '@deepseek-ai/dsh-llm';
|
|
2
2
|
import z from '@deepseek-ai/schemastery';
|
|
3
|
-
import { PARALLEL_TOOLS_PROMPT, SECTION_NAME, SECTION_ORDER } from './prompt.js';
|
|
3
|
+
import { CONTEXT_REMINDER, PARALLEL_TOOLS_PROMPT, SECTION_NAME, SECTION_ORDER } from './prompt.js';
|
|
4
4
|
import { installPromptDebug } from './debug.js';
|
|
5
|
-
export { BATCH_RULE, PARALLEL_TOOLS_PROMPT, SECTION_NAME, SECTION_ORDER } from './prompt.js';
|
|
5
|
+
export { BATCH_RULE, CONTEXT_REMINDER, PARALLEL_TOOLS_PROMPT, SECTION_NAME, SECTION_ORDER } from './prompt.js';
|
|
6
6
|
export const name = 'parallel-tools-prompt';
|
|
7
7
|
export const inject = ['agents', 'systemPrompt', 'sessionProjections'];
|
|
8
|
-
/** Model-facing text of the optional context-channel reminder. */
|
|
9
|
-
export const CONTEXT_REMINDER = 'Every response: before answering, check what else the current subgoal already has ready and issue ALL ready, independent tool calls together in this one response — same-tool calls on different targets, parallel reads, independent searches and checks. Each response is one model round trip; issuing ready work one call at a time spends one round trip per call. Hold a call only for real dependencies: its arguments need an earlier result, read-before-edit, shared-file or approval ordering. A single call is fine when nothing else is ready; never invent calls to fill a batch.';
|
|
10
8
|
/** Source kind of the reminder message; the host renders unknown context kinds as CONTEXT blocks. */
|
|
11
9
|
export const CONTEXT_SOURCE_KIND = 'parallel-tools-scheduling';
|
|
12
10
|
/** True when the session transcript already carries our sourced reminder. */
|
|
@@ -20,10 +18,10 @@ export const Config = z.object({
|
|
|
20
18
|
debugOutputDir: z.string().default(''),
|
|
21
19
|
debugMaxCalls: z.natural().min(1).max(10).default(3),
|
|
22
20
|
enabled: z.boolean().default(false).description('Enable static tool-call scheduling guidance. The bundle explicitly opts in; direct plugin use is disabled by default.'),
|
|
23
|
-
systemPromptSection: z.boolean().default(
|
|
24
|
-
contextReminder: z.boolean().default(
|
|
21
|
+
systemPromptSection: z.boolean().default(false).volatile().description('Inject static scheduling guidance as a system-prompt section for eligible roots (default false). May be combined with contextReminder; with both off the plugin injects nothing.'),
|
|
22
|
+
contextReminder: z.boolean().default(true).volatile().description('Inject a one-time scheduling reminder as a CONTEXT message for all agents, including subagents and all presets, at the next step boundary (default true). Persists in the session transcript; never duplicated across reloads. Independent of systemPromptSection and presetIds.'),
|
|
25
23
|
presetIds: z.array(z.string().pattern(/^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/))
|
|
26
|
-
.max(32).default(['standard']).description('Exact preset IDs
|
|
24
|
+
.max(32).default(['standard']).description('Exact preset IDs for the system-prompt channel only. Root agents only; use native-tool presets, not PTC. An empty list disables system-prompt targets, not context reminders.'),
|
|
27
25
|
});
|
|
28
26
|
/** Read a switch live: volatile fields are references whose value may change without a reload. */
|
|
29
27
|
function flag(value) {
|
|
@@ -35,7 +33,7 @@ function flag(value) {
|
|
|
35
33
|
* reload-time catch-up, so a plugin reload cannot silently drop guidance from
|
|
36
34
|
* agents that survive it (the old instance's disposal removed its sections).
|
|
37
35
|
*/
|
|
38
|
-
function attach(ctx, agent, config, presetIds, registrations, active
|
|
36
|
+
function attach(ctx, agent, config, presetIds, registrations, active) {
|
|
39
37
|
if (registrations.has(agent))
|
|
40
38
|
return;
|
|
41
39
|
const { header } = agent.session;
|
|
@@ -49,9 +47,6 @@ function attach(ctx, agent, config, presetIds, registrations, active, reminderAg
|
|
|
49
47
|
?? header.agentPreset;
|
|
50
48
|
if (preset === undefined || !presetIds.has(preset))
|
|
51
49
|
return;
|
|
52
|
-
// Conversation-level reminder: appended by the pre-step listener below once
|
|
53
|
-
// this agent is eligible (agent.inject only accepts user-kind messages).
|
|
54
|
-
reminderAgents.add(agent);
|
|
55
50
|
const registration = {};
|
|
56
51
|
// Returning the disposer is essential: ctx.effect does not implicitly adopt
|
|
57
52
|
// arbitrary registrations executed inside its callback on another fiber.
|
|
@@ -88,7 +83,6 @@ export function apply(ctx, config) {
|
|
|
88
83
|
const presetIds = new Set(config.presetIds);
|
|
89
84
|
const registrations = new WeakMap();
|
|
90
85
|
const active = new Set();
|
|
91
|
-
const reminderAgents = new WeakSet();
|
|
92
86
|
// Agent contexts are not children of this plugin's fiber. Explicitly give the
|
|
93
87
|
// plugin ownership of their effect disposers as well as agent-local ownership.
|
|
94
88
|
ctx.effect(() => async () => {
|
|
@@ -105,7 +99,7 @@ export function apply(ctx, config) {
|
|
|
105
99
|
const decision = await next();
|
|
106
100
|
if (decision.kind === 'reject' || signal.aborted)
|
|
107
101
|
return decision;
|
|
108
|
-
if (!flag(config.contextReminder) ||
|
|
102
|
+
if (!flag(config.contextReminder) || delivered.has(agent))
|
|
109
103
|
return decision;
|
|
110
104
|
const present = hasReminder(agent) || decision.messages.some(m => m.source.kind === CONTEXT_SOURCE_KIND);
|
|
111
105
|
delivered.add(agent);
|
|
@@ -121,7 +115,7 @@ export function apply(ctx, config) {
|
|
|
121
115
|
}, { prepend: true });
|
|
122
116
|
}
|
|
123
117
|
ctx.on('agent/created', ({ agent }) => {
|
|
124
|
-
attach(ctx, agent, config, presetIds, registrations, active
|
|
118
|
+
attach(ctx, agent, config, presetIds, registrations, active);
|
|
125
119
|
});
|
|
126
120
|
// A plugin reload disposes the previous instance's section registrations, and
|
|
127
121
|
// the host does not replay `agent/created` for agents that stay alive. Attach
|
|
@@ -132,7 +126,7 @@ export function apply(ctx, config) {
|
|
|
132
126
|
// previous instance's disposal. The no-op disposer satisfies the effect
|
|
133
127
|
// contract; per-agent cleanup is owned by each registration instead.
|
|
134
128
|
for (const agent of ctx.agents.roots())
|
|
135
|
-
attach(ctx, agent, config, presetIds, registrations, active
|
|
129
|
+
attach(ctx, agent, config, presetIds, registrations, active);
|
|
136
130
|
return () => { };
|
|
137
131
|
});
|
|
138
132
|
}
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,CAAC,MAAM,0BAA0B,CAAC;AAEzC,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,CAAC,MAAM,0BAA0B,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACnG,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEhD,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE/G,MAAM,CAAC,MAAM,IAAI,GAAG,uBAAuB,CAAC;AAC5C,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC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wCAAwC,EAAE;qBACzG,CAAC,CAAC;aACJ,CAAC;QACJ,CAAC,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IACxB,CAAC;IAED,GAAG,CAAC,EAAE,CAAC,eAAe,EAAE,CAAC,EAAE,KAAK,EAAE,EAAa,EAAE;QAC/C,MAAM,CAAC,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;IAEH,8EAA8E;IAC9E,8EAA8E;IAC9E,2EAA2E;IAC3E,6DAA6D;IAC7D,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE;QACd,wEAAwE;QACxE,wEAAwE;QACxE,qEAAqE;QACrE,KAAK,MAAM,KAAK,IAAI,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE;YAAE,MAAM,CAAC,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,CAAC,CAAC;QACrG,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/lib/prompt.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/** Stable prompt bytes: no runtime interpolation, tool inventory, or per-turn state. */
|
|
2
2
|
export declare const SECTION_NAME = "parallel-tools:guidance";
|
|
3
3
|
export declare const SECTION_ORDER = 1050;
|
|
4
|
-
/**
|
|
5
|
-
export declare const BATCH_RULE = "
|
|
4
|
+
/** Shared by both injection channels and the distributed skill description. */
|
|
5
|
+
export declare const BATCH_RULE = "Treat the current subgoal as a dependency DAG: tool calls are nodes; required results, conditions, approvals, and state ordering are edges. Before calling tools, identify useful calls whose prerequisites are satisfied and inputs are known. Issue all ready, independent tool calls together in one response, within tool/output limits, to reduce model round trips and enable parallel execution where supported. Gather independent evidence together even if a later decision needs all of it. Wait if an earlier result determines whether or how a call runs, or if calls could conflict through shared state (including read-before-edit). After results arrive, reassess what is ready; do not repeat completed or running work. A single call is correct when nothing else is ready; never invent work to fill a batch. Use available tools as intended, not shell wrappers or delegation solely to simulate batching. No extra turn or printed DAG solely for scheduling; preserve required plan, todo, and approval workflows.";
|
|
6
6
|
/** The "Tool-call scheduling:" prefix is the verification marker searched for in system/message. */
|
|
7
|
-
export declare const PARALLEL_TOOLS_PROMPT = "Tool-call scheduling:
|
|
7
|
+
export declare const PARALLEL_TOOLS_PROMPT = "Tool-call scheduling: Treat the current subgoal as a dependency DAG: tool calls are nodes; required results, conditions, approvals, and state ordering are edges. Before calling tools, identify useful calls whose prerequisites are satisfied and inputs are known. Issue all ready, independent tool calls together in one response, within tool/output limits, to reduce model round trips and enable parallel execution where supported. Gather independent evidence together even if a later decision needs all of it. Wait if an earlier result determines whether or how a call runs, or if calls could conflict through shared state (including read-before-edit). After results arrive, reassess what is ready; do not repeat completed or running work. A single call is correct when nothing else is ready; never invent work to fill a batch. Use available tools as intended, not shell wrappers or delegation solely to simulate batching. No extra turn or printed DAG solely for scheduling; preserve required plan, todo, and approval workflows.";
|
|
8
|
+
/** Same rule in the history-backed context channel, without a second policy to maintain. */
|
|
9
|
+
export declare const CONTEXT_REMINDER = "Treat the current subgoal as a dependency DAG: tool calls are nodes; required results, conditions, approvals, and state ordering are edges. Before calling tools, identify useful calls whose prerequisites are satisfied and inputs are known. Issue all ready, independent tool calls together in one response, within tool/output limits, to reduce model round trips and enable parallel execution where supported. Gather independent evidence together even if a later decision needs all of it. Wait if an earlier result determines whether or how a call runs, or if calls could conflict through shared state (including read-before-edit). After results arrive, reassess what is ready; do not repeat completed or running work. A single call is correct when nothing else is ready; never invent work to fill a batch. Use available tools as intended, not shell wrappers or delegation solely to simulate batching. No extra turn or printed DAG solely for scheduling; preserve required plan, todo, and approval workflows.";
|
|
8
10
|
//# sourceMappingURL=prompt.d.ts.map
|
package/lib/prompt.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../src/prompt.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,eAAO,MAAM,YAAY,4BAA4B,CAAC;AACtD,eAAO,MAAM,aAAa,OAAO,CAAC;AAElC
|
|
1
|
+
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../src/prompt.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,eAAO,MAAM,YAAY,4BAA4B,CAAC;AACtD,eAAO,MAAM,aAAa,OAAO,CAAC;AAElC,+EAA+E;AAC/E,eAAO,MAAM,UAAU,k/BAAk/B,CAAC;AAE1gC,oGAAoG;AACpG,eAAO,MAAM,qBAAqB,wgCAAwC,CAAC;AAE3E,4FAA4F;AAC5F,eAAO,MAAM,gBAAgB,k/BAAa,CAAC"}
|
package/lib/prompt.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/** Stable prompt bytes: no runtime interpolation, tool inventory, or per-turn state. */
|
|
2
2
|
export const SECTION_NAME = 'parallel-tools:guidance';
|
|
3
3
|
export const SECTION_ORDER = 1050;
|
|
4
|
-
/**
|
|
5
|
-
export const BATCH_RULE = `
|
|
4
|
+
/** Shared by both injection channels and the distributed skill description. */
|
|
5
|
+
export const BATCH_RULE = `Treat the current subgoal as a dependency DAG: tool calls are nodes; required results, conditions, approvals, and state ordering are edges. Before calling tools, identify useful calls whose prerequisites are satisfied and inputs are known. Issue all ready, independent tool calls together in one response, within tool/output limits, to reduce model round trips and enable parallel execution where supported. Gather independent evidence together even if a later decision needs all of it. Wait if an earlier result determines whether or how a call runs, or if calls could conflict through shared state (including read-before-edit). After results arrive, reassess what is ready; do not repeat completed or running work. A single call is correct when nothing else is ready; never invent work to fill a batch. Use available tools as intended, not shell wrappers or delegation solely to simulate batching. No extra turn or printed DAG solely for scheduling; preserve required plan, todo, and approval workflows.`;
|
|
6
6
|
/** The "Tool-call scheduling:" prefix is the verification marker searched for in system/message. */
|
|
7
7
|
export const PARALLEL_TOOLS_PROMPT = `Tool-call scheduling: ${BATCH_RULE}`;
|
|
8
|
+
/** Same rule in the history-backed context channel, without a second policy to maintain. */
|
|
9
|
+
export const CONTEXT_REMINDER = BATCH_RULE;
|
|
8
10
|
//# sourceMappingURL=prompt.js.map
|
package/lib/prompt.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../src/prompt.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,MAAM,CAAC,MAAM,YAAY,GAAG,yBAAyB,CAAC;AACtD,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,CAAC;AAElC
|
|
1
|
+
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../src/prompt.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,MAAM,CAAC,MAAM,YAAY,GAAG,yBAAyB,CAAC;AACtD,MAAM,CAAC,MAAM,aAAa,GAAG,IAAI,CAAC;AAElC,+EAA+E;AAC/E,MAAM,CAAC,MAAM,UAAU,GAAG,++BAA++B,CAAC;AAE1gC,oGAAoG;AACpG,MAAM,CAAC,MAAM,qBAAqB,GAAG,yBAAyB,UAAU,EAAE,CAAC;AAE3E,4FAA4F;AAC5F,MAAM,CAAC,MAAM,gBAAgB,GAAG,UAAU,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: batch-tool-calls
|
|
3
|
-
description: "
|
|
3
|
+
description: "Treat the current subgoal as a dependency DAG: tool calls are nodes; required results, conditions, approvals, and state ordering are edges. Before calling tools, identify useful calls whose prerequisites are satisfied and inputs are known. Issue all ready, independent tool calls together in one response, within tool/output limits, to reduce model round trips and enable parallel execution where supported. Gather independent evidence together even if a later decision needs all of it. Wait if an earlier result determines whether or how a call runs, or if calls could conflict through shared state (including read-before-edit). After results arrive, reassess what is ready; do not repeat completed or running work. A single call is correct when nothing else is ready; never invent work to fill a batch. Use available tools as intended, not shell wrappers or delegation solely to simulate batching. No extra turn or printed DAG solely for scheduling; preserve required plan, todo, and approval workflows."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Batch ready tool calls
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Think in dependencies across the current subgoal, not just the next action. The DAG is a mental model, not a graph you must print or execute with a new tool.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
1. Identify useful calls whose prerequisites are satisfied and arguments are known.
|
|
11
|
+
2. Issue ready, independent calls together, respecting tool/output limits and shared-state ordering.
|
|
12
|
+
3. Wait when a result determines whether or how another call should run. After results arrive, reassess the ready set without duplicating completed or running work.
|
|
13
|
+
4. Do not invent work or add a scheduling-only round. Required planning, todo, and approval workflows still apply.
|
|
11
14
|
|
|
12
|
-
|
|
13
|
-
2. Issue every ready, independent call together in this one response.
|
|
14
|
-
3. Hold a call only for real dependencies: its arguments need an earlier result, read-before-edit, shared-file or approval ordering.
|
|
15
|
-
4. A single call is fine when nothing else is ready. Never invent calls to fill a batch.
|
|
15
|
+
For example, read independent files A and B together, then make the decision that needs both. If a search must discover B's path, search first rather than guessing it. Keep conflicting edits ordered; independent evidence gathering need not wait for the final decision.
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
Batching reduces model round trips and allows concurrency where the host supports it; it does not override the host scheduler or guarantee a speedup.
|