@hhuangpanda/dsh-automation 0.3.36 → 0.3.37
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/docs/reference.md +2 -0
- package/docs/reference.zh.md +2 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +18 -4
- package/package.json +1 -1
package/docs/reference.md
CHANGED
|
@@ -43,6 +43,8 @@ State is written to a temporary file in the same directory, flushed, and atomica
|
|
|
43
43
|
| `automation_resume` | Resume, optionally with one immediate run. |
|
|
44
44
|
| `automation_delete` | Delete the task and future scheduling, preserving existing sessions. |
|
|
45
45
|
|
|
46
|
+
To keep these tools out of some Agent presets entirely, list the preset ids in the plugin's `excludePresets` setting. Sessions on those presets, including subagents, never receive the tools or their schema tokens.
|
|
47
|
+
|
|
46
48
|
Create and update support `agent_preset`, `provider` / `model`, `reasoning_effort`, and ordered `skills`; updates can clear execution overrides or replace the skill list. Creation also accepts `execution_mode: pinned-session`, `target_session_id`, and `session_target_confirmed: true` after user confirmation. Changing the target after creation and configuring message delivery require the UI.
|
|
47
49
|
|
|
48
50
|
| Type | Parameter | Format / example |
|
package/docs/reference.zh.md
CHANGED
|
@@ -43,6 +43,8 @@
|
|
|
43
43
|
| `automation_resume` | 恢复任务,可同时立即运行一次。 |
|
|
44
44
|
| `automation_delete` | 删除任务及未来调度,保留已有会话。 |
|
|
45
45
|
|
|
46
|
+
如需让某些智能体预设完全不加载这些工具,请在插件的 `excludePresets` 设置中列出这些预设 id。使用这些预设的会话(包括子智能体)不会获得这些工具,也不占用其 schema token。
|
|
47
|
+
|
|
46
48
|
创建与更新支持 `agent_preset`、`provider` / `model`、`reasoning_effort` 和有序 `skills`;更新可清除执行覆盖或替换技能列表。创建时还可传入 `execution_mode: pinned-session`、`target_session_id` 和经用户确认的 `session_target_confirmed: true`。创建后更换目标会话,以及配置消息投递,需在界面中操作。
|
|
47
49
|
|
|
48
50
|
| 类型 | 参数 | 格式 / 示例 |
|
package/lib/index.d.ts
CHANGED
|
@@ -20,6 +20,8 @@ export interface Config {
|
|
|
20
20
|
/** Run history is unlimited unless an explicit limit is configured. */
|
|
21
21
|
readonly maxRunHistory?: number;
|
|
22
22
|
readonly maxRunDurationMs?: number;
|
|
23
|
+
/** Agent preset ids whose sessions get no automation tools. */
|
|
24
|
+
readonly excludePresets?: readonly string[];
|
|
23
25
|
}
|
|
24
26
|
export declare function apply(ctx: Context, config?: Config): Promise<void>;
|
|
25
27
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.js
CHANGED
|
@@ -59,10 +59,20 @@ export async function apply(ctx, config = {}) {
|
|
|
59
59
|
validate: (destination) => validateDelivery(ctx, destination),
|
|
60
60
|
});
|
|
61
61
|
const toolCleanups = new Map();
|
|
62
|
+
const excludePresets = new Set(config.excludePresets ?? []);
|
|
63
|
+
const uninstallTools = (agent) => {
|
|
64
|
+
toolCleanups.get(agent)?.();
|
|
65
|
+
toolCleanups.delete(agent);
|
|
66
|
+
};
|
|
62
67
|
const installTools = (agent) => {
|
|
63
68
|
// Normal resumed sessions remain usable by their human owner. Tool execution
|
|
64
69
|
// is guarded per automation turn rather than permanently omitting the tools.
|
|
65
|
-
if (agent.id.startsWith('automation-')
|
|
70
|
+
if (agent.id.startsWith('automation-'))
|
|
71
|
+
return;
|
|
72
|
+
const excluded = excludePresets.has(ctx.agentPresets.composedPreset(agent.ctx) ?? '');
|
|
73
|
+
if (excluded)
|
|
74
|
+
return uninstallTools(agent);
|
|
75
|
+
if (toolCleanups.has(agent))
|
|
66
76
|
return;
|
|
67
77
|
const dispose = registerAutomationTools(ctx, agent.ctx, agent, controller);
|
|
68
78
|
toolCleanups.set(agent, dispose);
|
|
@@ -73,15 +83,19 @@ export async function apply(ctx, config = {}) {
|
|
|
73
83
|
installTools(agent);
|
|
74
84
|
return undefined;
|
|
75
85
|
});
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
86
|
+
// A session can change preset after agent/created fired.
|
|
87
|
+
const stopSelected = ctx.on('agent-preset/selected', (sessionId) => {
|
|
88
|
+
const agent = ctx.agents.get(sessionId);
|
|
89
|
+
if (agent)
|
|
90
|
+
installTools(agent);
|
|
79
91
|
});
|
|
92
|
+
const stopDisposed = ctx.on('agent/disposed', ({ agent }) => uninstallTools(agent));
|
|
80
93
|
const stopApi = registerAutomationApi(ctx, controller);
|
|
81
94
|
scheduler.start();
|
|
82
95
|
ctx.effect(() => async () => {
|
|
83
96
|
stopApi();
|
|
84
97
|
stopCreated();
|
|
98
|
+
stopSelected();
|
|
85
99
|
stopDisposed();
|
|
86
100
|
for (const dispose of toolCleanups.values())
|
|
87
101
|
dispose();
|