dsh-tool-activator 0.3.0 → 0.3.1

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 CHANGED
@@ -70,12 +70,15 @@
70
70
 
71
71
  进入官方插件管理页,打开 `dsh-tool-activator` 卡片,配置表单直接显示在该插件的页面上(公开 **`plugins.bundle.config`** 槽,key 为包名 `dsh-tool-activator`),不需要再点进某一行的"配置"。
72
72
 
73
+ <img height="800" alt="image" src="https://github.com/user-attachments/assets/55d7b574-5a05-4892-9567-fd9d3310c566" />
74
+
75
+
73
76
  表单只有一份工具列表:
74
77
 
75
78
  | 分区 | 含义 |
76
79
  | --- | --- |
77
80
  | **默认激活工具(N 个)** | 每次请求都带完整 schema 的工具;插件自带的八个基础工具固定在此区并排在最前,标题右侧带"基础工具"标记,开关为禁用,不允许关闭 |
78
- | **已安装但需先激活(M 个)** | 其余工具,模型用 `activate_tools` 按需获取 |
81
+ | **按需激活(M 个)** | 其余工具,模型用 `activate_tools` 按需获取 |
79
82
 
80
83
  打开某一项的开关即把它写进 `basicTools`(默认加载),关闭则移回按需区;工具清单与描述由宿主 Remote `toolActivator/catalog` 提供,覆盖当前所有 live agent 作用域。
81
84
 
package/dist/index.js CHANGED
@@ -4587,16 +4587,22 @@ var ToolActivatorRemote = class {
4587
4587
  }
4588
4588
  catalog() {
4589
4589
  const policy = this.policy();
4590
+ const activator = this.schemas().find((schema) => schema.name === ACTIVATOR_TOOL_NAME);
4590
4591
  return {
4591
4592
  enabled: policy.enabled,
4592
4593
  basicTools: [...policy.basicTools],
4593
- baseTools: [...DEFAULT_POLICY.basicTools],
4594
- entries: buildToolCatalog(this.schemas(), policy).map((entry) => ({
4594
+ baseTools: [ACTIVATOR_TOOL_NAME, ...DEFAULT_POLICY.basicTools],
4595
+ entries: [{
4596
+ identifier: ACTIVATOR_TOOL_NAME,
4597
+ name: ACTIVATOR_TOOL_NAME,
4598
+ description: activator?.description ?? "",
4599
+ tools: activator === void 0 ? [] : [ACTIVATOR_TOOL_NAME]
4600
+ }, ...buildToolCatalog(this.schemas(), policy).map((entry) => ({
4595
4601
  identifier: entry.identifier,
4596
4602
  name: entry.name,
4597
4603
  description: entry.tools.length === 1 ? entry.tools[0].description : entry.description,
4598
4604
  tools: entry.tools.map((tool) => tool.name)
4599
- }))
4605
+ }))]
4600
4606
  };
4601
4607
  }
4602
4608
  };
@@ -4889,7 +4895,10 @@ function installToolActivator(ctx, config) {
4889
4895
  const catalog = catalogOf(agent, policy);
4890
4896
  const history = historyOf(agent);
4891
4897
  const enabled = enabledToolNames(catalog, policy, history.activatedToolIds);
4892
- if (ctx.tools.get("activate_tools", agent) !== tool) enabled.delete(ACTIVATOR_TOOL_NAME);
4898
+ if (ctx.tools.get("activate_tools", agent) === void 0) {
4899
+ if (policy.mode === "automatic") return assembly;
4900
+ enabled.delete(ACTIVATOR_TOOL_NAME);
4901
+ }
4893
4902
  const instructions = enabled.has("skill") && ctx.tools.get("skill", agent) ? history.activatedSkills.flatMap((skill) => skill.instructions === void 0 ? [] : [skill.instructions]) : [];
4894
4903
  return filterPromptAssembly(assembly, catalog, policy, enabled, assembly.sections.some((section) => section.name === "tools:sdk" && section.text.length > 0) ? renderSdk(agent, ctx.tools.schemas(agent).filter((schema) => schema.name !== "run_code" && enabled.has(schema.name))) : void 0, instructions);
4895
4904
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-tool-activator",
3
3
  "type": "module",
4
- "version": "0.3.0",
4
+ "version": "0.3.1",
5
5
  "description": "Load only basic DeepSeek Harness tools by default and activate other tools on demand.",
6
6
  "author": "Hairy <wwu710632@gmail.com>",
7
7
  "license": "MIT",