From 45fc779a1137c19f0a3db2f4b193e2cbb8198129 Mon Sep 17 00:00:00 2001 From: gengruilin Date: Tue, 27 Oct 2026 14:04:52 +0800 Subject: [PATCH] feat(wecom): run wecom-cli by the absolute path named in runtime context The plugin registers wecom-cli's absolute path through registerCliPathContext, with the PATH prefix for the guide scripts that call it by name, and runs its own commands by the same path. The Host-runtime check, the private PATH registration, and the shell-env dependency are removed. The skill guidance, READMEs, tests, and the wecom-skills snapshot follow the runtime-context path. --- docs/capability-seams.i18n.yaml | 4 +- docs/config-catalog.md | 2 +- docs/config-catalog.zh.md | 2 +- docs/module-graph.md | 5 ++ docs/module-graph.zh.md | 5 ++ packages/client/README.i18n.yaml | 4 +- packages/connector/README.i18n.yaml | 4 +- packages/connector/README.md | 2 +- packages/connector/README.zh.md | 2 +- packages/connector/wecom-cli/README.i18n.yaml | 55 ++++++++++--------- packages/connector/wecom-cli/README.md | 30 ++++++---- packages/connector/wecom-cli/README.zh.md | 30 ++++++---- packages/connector/wecom-cli/package.json | 6 +- .../connector/wecom-cli/skills/wecom/SKILL.md | 2 +- packages/connector/wecom-cli/src/directory.ts | 13 ++--- packages/connector/wecom-cli/src/index.ts | 22 ++++---- .../connector/wecom-cli/tests/account.spec.ts | 9 +-- .../wecom-cli/tests/directory.spec.ts | 12 ++-- packages/connector/wecom-cli/tests/harness.ts | 5 -- .../connector/wecom-cli/tests/plugin.spec.ts | 26 ++++----- packages/connector/wecom-cli/tsconfig.json | 6 +- packages/connector/wecom/README.i18n.yaml | 4 +- packages/connector/wecom/README.md | 4 +- packages/connector/wecom/README.zh.md | 4 +- .../extensions/tool-cordis/src/api-catalog.ts | 8 +++ .../references/packages.md | 2 +- pnpm-lock.yaml | 6 +- .../session/wecom-skills/replay.override.json | 18 ++++++ .../session/wecom-skills/session.v4.jsonl | 10 ++-- snapshots/session/wecom-skills/snapshot.yml | 2 + .../wecom-skills/system-prompt.expected.md | 6 +- 31 files changed, 176 insertions(+), 134 deletions(-) create mode 100644 snapshots/session/wecom-skills/replay.override.json diff --git a/docs/capability-seams.i18n.yaml b/docs/capability-seams.i18n.yaml index cb8f632442..e98a4fe6e0 100644 --- a/docs/capability-seams.i18n.yaml +++ b/docs/capability-seams.i18n.yaml @@ -6,5 +6,5 @@ en: 41d772192075e133 zh: 5ef3da69b4de1d8a /capability-seams-and-core-services: - en: cbe99e1985f2deae - zh: 6e524e7a644ae2d6 + en: d00f844a3addc42d + zh: d828814662ac65bc diff --git a/docs/config-catalog.md b/docs/config-catalog.md index f6ae46310e..9c4423a9f9 100644 --- a/docs/config-catalog.md +++ b/docs/config-catalog.md @@ -4740,7 +4740,7 @@ export interface Config { ## `@deepseek-ai/dsh-wecom-cli` -- `inject`: `skills` · `subprocess` · `shellEnv` +- `inject`: `skills` · `subprocess` · `systemPrompt` - `refs`: [`CliAccountConfig`](../packages/connector/cli-account/src/index.ts) - `source`: [`packages/connector/wecom-cli/src/index.ts:31`](../packages/connector/wecom-cli/src/index.ts) diff --git a/docs/config-catalog.zh.md b/docs/config-catalog.zh.md index 5f6d64a9c2..9d5db1de48 100644 --- a/docs/config-catalog.zh.md +++ b/docs/config-catalog.zh.md @@ -4742,7 +4742,7 @@ export interface Config { ## `@deepseek-ai/dsh-wecom-cli` -- `inject`: `skills` · `subprocess` · `shellEnv` +- `inject`: `skills` · `subprocess` · `systemPrompt` - `refs`: [`CliAccountConfig`](../packages/connector/cli-account/src/index.ts) - `source`: [`packages/connector/wecom-cli/src/index.ts:31`](../packages/connector/wecom-cli/src/index.ts) diff --git a/docs/module-graph.md b/docs/module-graph.md index c2aa756842..dd11627623 100644 --- a/docs/module-graph.md +++ b/docs/module-graph.md @@ -533,6 +533,10 @@ flowchart TD pkg_hmr --> pkg_cmdline pkg_cli_account --> pkg_subprocess pkg_cli_account --> pkg_system_prompt + pkg_wecom_cli --> pkg_skill + pkg_wecom_cli --> pkg_subprocess + pkg_wecom_cli --> pkg_system_prompt + pkg_wecom_cli --> pkg_typert_protocol pkg_deliverable_file_references --> pkg_system_prompt pkg_experimental_computer_use_cua_driver_mcp --> pkg_computer_use pkg_experimental_forge_github --> pkg_experimental_forge @@ -1685,6 +1689,7 @@ flowchart TD | [`attachment-local`](../packages/attachment/attachment-local) | `attachment` | [`attachment`](../packages/attachment/attachment), [`home-paths`](../packages/util/home-paths) | | [`hmr`](../packages/boot/hmr) | `boot` | [`app-boot`](../packages/boot/app-boot), [`cmdline`](../packages/boot/cmdline) | | [`cli-account`](../packages/connector/cli-account) | `connector` | [`subprocess`](../packages/subprocess/subprocess), [`system-prompt`](../packages/core/system-prompt) | +| [`wecom-cli`](../packages/connector/wecom-cli) | `connector` | [`skill`](../packages/skill/skill), [`subprocess`](../packages/subprocess/subprocess), [`system-prompt`](../packages/core/system-prompt), [`typert-protocol`](../packages/typert/protocol) | | [`deliverable-file-references`](../packages/deliverables/deliverable-file-references) | `deliverables` | [`system-prompt`](../packages/core/system-prompt) | | [`experimental-computer-use-cua-driver-mcp`](../packages/experimental/computer-use-cua-driver-mcp) | `experimental` | [`computer-use`](../packages/computer-use/computer-use) | | [`experimental-forge-github`](../packages/experimental/forge-github) | `experimental` | [`experimental-forge`](../packages/experimental/forge), [`subprocess`](../packages/subprocess/subprocess) | diff --git a/docs/module-graph.zh.md b/docs/module-graph.zh.md index 914a1cb3a5..8062c20666 100644 --- a/docs/module-graph.zh.md +++ b/docs/module-graph.zh.md @@ -535,6 +535,10 @@ flowchart TD pkg_hmr --> pkg_cmdline pkg_cli_account --> pkg_subprocess pkg_cli_account --> pkg_system_prompt + pkg_wecom_cli --> pkg_skill + pkg_wecom_cli --> pkg_subprocess + pkg_wecom_cli --> pkg_system_prompt + pkg_wecom_cli --> pkg_typert_protocol pkg_deliverable_file_references --> pkg_system_prompt pkg_experimental_computer_use_cua_driver_mcp --> pkg_computer_use pkg_experimental_forge_github --> pkg_experimental_forge @@ -1687,6 +1691,7 @@ flowchart TD | [`attachment-local`](../packages/attachment/attachment-local) | `attachment` | [`attachment`](../packages/attachment/attachment), [`home-paths`](../packages/util/home-paths) | | [`hmr`](../packages/boot/hmr) | `boot` | [`app-boot`](../packages/boot/app-boot), [`cmdline`](../packages/boot/cmdline) | | [`cli-account`](../packages/connector/cli-account) | `connector` | [`subprocess`](../packages/subprocess/subprocess), [`system-prompt`](../packages/core/system-prompt) | +| [`wecom-cli`](../packages/connector/wecom-cli) | `connector` | [`skill`](../packages/skill/skill), [`subprocess`](../packages/subprocess/subprocess), [`system-prompt`](../packages/core/system-prompt), [`typert-protocol`](../packages/typert/protocol) | | [`deliverable-file-references`](../packages/deliverables/deliverable-file-references) | `deliverables` | [`system-prompt`](../packages/core/system-prompt) | | [`experimental-computer-use-cua-driver-mcp`](../packages/experimental/computer-use-cua-driver-mcp) | `experimental` | [`computer-use`](../packages/computer-use/computer-use) | | [`experimental-forge-github`](../packages/experimental/forge-github) | `experimental` | [`experimental-forge`](../packages/experimental/forge), [`subprocess`](../packages/subprocess/subprocess) | diff --git a/packages/client/README.i18n.yaml b/packages/client/README.i18n.yaml index 363530296b..fe9ca03ebd 100644 --- a/packages/client/README.i18n.yaml +++ b/packages/client/README.i18n.yaml @@ -15,8 +15,8 @@ en: 1eb35b015a6c423f zh: a8a3dceee2c9e943 /client-web-gui-browser-half/packages: - en: 6135cbb168c13e01 - zh: a14de44c19e28179 + en: 73780eccad4f0fcc + zh: ab97015e8cbafa58 /client-web-gui-browser-half/related-documentation: en: d1d506e68fab7333 zh: 1a90fe6f3f8f24a9 diff --git a/packages/connector/README.i18n.yaml b/packages/connector/README.i18n.yaml index 658c193817..d391574d70 100644 --- a/packages/connector/README.i18n.yaml +++ b/packages/connector/README.i18n.yaml @@ -15,8 +15,8 @@ en: 1eb35b015a6c423f zh: a8a3dceee2c9e943 /connector-application-plugins/packages: - en: 1e6a59c21461cc75 - zh: 7547fcdf1d0c9fe6 + en: e86da284cedd3a85 + zh: 197baaabb93cb573 /connector-application-plugins/related-documentation: en: 434311433c42db3c zh: 2a01ec7ac137cfe3 diff --git a/packages/connector/README.md b/packages/connector/README.md index 72c446dc65..fd23072531 100644 --- a/packages/connector/README.md +++ b/packages/connector/README.md @@ -27,7 +27,7 @@ Each application plugin in this group is installed into a profile to use one thi | [`cli-account/`](cli-account/README.md) | Runs a vendor CLI by its absolute path, gives the model that path in runtime context, and runs one Host-owned account operation at a time for CLI app plugins | — | | [`upstream-skills/`](upstream-skills/README.md) | Downloads the upstream files that a CLI app plugin's entry skill indexes from a pinned commit of the vendor's GitHub repository, verifies and caches them, and lists the entry skill over them | — | | [`wecom/`](wecom/README.md) | Bundles the WeCom plugin: the `wecom-cli` Host row and its Plugins page row | — | -| [`wecom-cli/`](wecom-cli/README.md) | Installs the official `wecom-cli` on the private Shell PATH, registers its skills, and runs the authorization operations the Plugins page drives | `ctx.wecom`; registers on `ctx.skills` and `ctx.shellEnv` | +| [`wecom-cli/`](wecom-cli/README.md) | Installs the official `wecom-cli`, gives the model its absolute path, registers its skills, and runs the authorization operations the Plugins page drives | `ctx.wecom`; registers on `ctx.skills` and `ctx.systemPrompt` | ----- diff --git a/packages/connector/README.zh.md b/packages/connector/README.zh.md index a347a189c7..f0b845247e 100644 --- a/packages/connector/README.zh.md +++ b/packages/connector/README.zh.md @@ -27,7 +27,7 @@ kind: "package-group" | [`cli-account/`](cli-account/README.zh.md) | 为 CLI 应用插件按绝对路径运行厂商 CLI,在运行时上下文中把这个路径告诉模型,并在 Host 上一次执行一个账号操作 | — | | [`upstream-skills/`](upstream-skills/README.zh.md) | 从厂商 GitHub 仓库的固定提交下载 CLI 应用插件入口技能索引的上游文件,校验并缓存,再在这些文件之上列出入口技能 | — | | [`wecom/`](wecom/README.zh.md) | 打包企业微信插件:`wecom-cli` Host 行及其插件页行 | — | -| [`wecom-cli/`](wecom-cli/README.zh.md) | 把官方 `wecom-cli` 安装到私有 Shell PATH 上,注册其 skill,并执行插件页发起的授权操作 | `ctx.wecom`;注册到 `ctx.skills` 与 `ctx.shellEnv` | +| [`wecom-cli/`](wecom-cli/README.zh.md) | 安装官方 `wecom-cli`,把它的绝对路径告诉模型,注册其 skill,并执行插件页发起的授权操作 | `ctx.wecom`;注册到 `ctx.skills` 与 `ctx.systemPrompt` | ----- diff --git a/packages/connector/wecom-cli/README.i18n.yaml b/packages/connector/wecom-cli/README.i18n.yaml index e58240d657..2bbaf8202a 100644 --- a/packages/connector/wecom-cli/README.i18n.yaml +++ b/packages/connector/wecom-cli/README.i18n.yaml @@ -3,14 +3,14 @@ # After editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write packages/connector/wecom-cli/README.md /: - en: dfe1fe6b23fa06d6 - zh: c3409f134a690b64 + en: db64758f91c93aff + zh: f71eb65e58a1f1ad /deepseek-ai-dsh-wecom-cli: en: 64ada5d1b3aac000 zh: b18083c73eabe29a /deepseek-ai-dsh-wecom-cli/summary: - en: 9489a8025deee79d - zh: 1414740e045cd9a1 + en: 2c0d069987329909 + zh: 5209d0671f3a9cf0 /deepseek-ai-dsh-wecom-cli/table-of-contents: en: d152484eb41ac6b4 zh: 09388d293f9be9cb @@ -21,8 +21,8 @@ en: 4034b64f387ae470 zh: 748eeb0414ceace4 /deepseek-ai-dsh-wecom-cli/use-this-package/what-you-get: - en: 470efb04014aec86 - zh: 3c06434a4cfb8b9c + en: f54a885e9b468520 + zh: 735da355b4c9dc35 /deepseek-ai-dsh-wecom-cli/use-this-package/authorization-operations: en: 7d0ec689a89b609e zh: 86ce0058d42f38b1 @@ -30,11 +30,11 @@ en: 9f62785a7999eef2 zh: 2b345355d9515d13 /deepseek-ai-dsh-wecom-cli/understand-the-implementation: - en: 76ea48c4d9e1a81e - zh: 6a47f50c42bbc49d + en: 346dbcb56e8bf86b + zh: d0e22533635e8d13 /deepseek-ai-dsh-wecom-cli/further-exploration: - en: ab2a30827085cf94 - zh: 92eccac3d8db8ace + en: 981114250537a07b + zh: 03dbf4b65446bd89 /deepseek-ai-dsh-wecom-cli/model-experience: en: 215e7ba838619b7b zh: a311da3843709f90 @@ -54,29 +54,32 @@ en: 8955ac196848e69f zh: 54aa7db097eafd3c /deepseek-ai-dsh-wecom-cli/model-experience/loaded-skill-body/what-the-model-sees: - en: 2afd3b7a0b666202 - zh: 7a1325e3dae2d9fa + en: bf85dc102a255c06 + zh: b3d5f8e93b4127b8 /deepseek-ai-dsh-wecom-cli/model-experience/loaded-skill-body/token-effect: en: 1ed287a86abbc585 zh: 5d55a6fd61786866 /deepseek-ai-dsh-wecom-cli/model-experience/loaded-skill-body/kv-cache-effect: en: 1f6b842a95e14ce4 zh: 0d57cdec5e828828 -/deepseek-ai-dsh-wecom-cli/model-experience/plugin-clis-entry: - en: 821d3974b859741d - zh: 127fac5248c9a7f1 -/deepseek-ai-dsh-wecom-cli/model-experience/plugin-clis-entry/what-the-model-sees: - en: e8dff31661f9e1aa - zh: cfb6b970f4da9dfb -/deepseek-ai-dsh-wecom-cli/model-experience/plugin-clis-entry/token-effect: - en: bfc2ae22042ca709 - zh: 5919b9395c51541e -/deepseek-ai-dsh-wecom-cli/model-experience/plugin-clis-entry/kv-cache-effect: - en: 6def0febc136ef06 - zh: 12ea269eb16a0b91 +/deepseek-ai-dsh-wecom-cli/model-experience/cli-path: + en: b5fed52af6c0d771 + zh: 25b7aa5297583030 +/deepseek-ai-dsh-wecom-cli/model-experience/cli-path/what-the-model-sees: + en: dd87bf74d7e47802 + zh: 287c05d2a56a0c95 +/deepseek-ai-dsh-wecom-cli/model-experience/cli-path/what-the-model-sees/runtime-context-entry: + en: c91314832f78f460 + zh: aac156ea0b5b816a +/deepseek-ai-dsh-wecom-cli/model-experience/cli-path/token-effect: + en: 2caf581d193f3dba + zh: 3b5e94d4cc69ca3b +/deepseek-ai-dsh-wecom-cli/model-experience/cli-path/kv-cache-effect: + en: 67398dd4e4b02db9 + zh: a873eacd006fa656 /deepseek-ai-dsh-wecom-cli/known-limitations-and-deferred-work: - en: c1133f8d4a0b4400 - zh: c4afa3136668fbb8 + en: 2244e58042b1aa1f + zh: b1bcbe09720122af /deepseek-ai-dsh-wecom-cli/known-limitations-and-deferred-work/dev-note: en: 71cc23fc507e649e zh: 3dbd0498845467cc diff --git a/packages/connector/wecom-cli/README.md b/packages/connector/wecom-cli/README.md index a865a5ade5..43333184df 100644 --- a/packages/connector/wecom-cli/README.md +++ b/packages/connector/wecom-cli/README.md @@ -1,5 +1,5 @@ --- -description: "Put the official wecom-cli on the private Shell PATH, load its skills, and run the authorization operations the Plugins page drives." +description: "Give the model the absolute path of the official wecom-cli, load its skills, and run the authorization operations the Plugins page drives." kind: "package-reference" --- @@ -9,7 +9,7 @@ English | [中文](README.zh.md) ## Summary -This package is the Host row of the [WeCom plugin](../wecom/README.md). It installs a pinned `@wecom/cli`, puts its `wecom-cli` executable on the private Shell PATH, and registers one `wecom` skill whose guides are the official WeCom skills. Its `wecom` Remote checks the CLI's authorization, binds a bot through the CLI's QR-code page, and cancels, for the [WeCom plugin page](../../client/ui-wecom/README.md). The CLI keeps the bot credentials in its default configuration, which the user's own terminal shares. Only macOS is supported. +This package is the Host row of the [WeCom plugin](../wecom/README.md). It installs a pinned `@wecom/cli`, gives the model the absolute path of its `wecom-cli` executable in runtime context, and registers one `wecom` skill whose guides are the official WeCom skills. Its `wecom` Remote checks the CLI's authorization, binds a bot through the CLI's QR-code page, and cancels, for the [WeCom plugin page](../../client/ui-wecom/README.md). The CLI keeps the bot credentials in its default configuration, which the user's own terminal shares. Only macOS is supported. ## Table of Contents @@ -31,9 +31,9 @@ Install the [WeCom plugin bundle](../wecom/README.md), which inserts this packag ### What you get -After the plugin loads, one `wecom` skill joins the skill catalog. The agent loads it with the `skill` tool, opens the guide it needs, such as `wecomcli-doc` or `wecomcli-message`, with the file tools, and runs `wecom-cli` commands through the ordinary Shell tools under the current sandbox and approval policy. When `wecom-cli auth show --status` reports no authorization, the agent asks the user to connect WeCom on the plugin page; it runs the CLI's own `auth init` only when the user asks to finish it in the conversation, with single-command approval because it writes outside the workspace. +After the plugin loads, one `wecom` skill joins the skill catalog. The agent loads it with the `skill` tool, opens the guide it needs, such as `wecomcli-doc` or `wecomcli-message`, with the file tools, and runs `wecom-cli` by that path through the ordinary Shell tools under the current sandbox and approval policy. When `wecom-cli auth show --status` reports no authorization, the agent asks the user to connect WeCom on the plugin page; it runs the CLI's own `auth init` only when the user asks to finish it in the conversation, with single-command approval because it writes outside the workspace. -Turning the row off in Plugin Manager withdraws the skills and the private PATH entry for later Shell calls. The CLI authorization stays in place. +Turning the row off in Plugin Manager withdraws the skills and the path from runtime context. The CLI authorization stays in place. ### Authorization operations @@ -68,7 +68,7 @@ The generated [config catalog](../../../docs/config-catalog.md#deepseek-aidsh-we
Implementation internals — click to expand -[`src/index.ts`](src/index.ts) is a Remote service registered as `ctx.wecom`. It requires a Host subprocess runtime, checks that `binDir/wecom-cli` is executable, registers `binDir` with [Shell environment](../../shell/shell-env/README.md) as the `wecom` PATH contribution that provides `wecom-cli`, and mounts a [filesystem skill provider](../../skill/skill-filesystem/README.md) named `wecom` over this package's `skills/` directory, without the default roots or watching. [`src/directory.ts`](src/directory.ts) resolves the platform package that `@wecom/cli` installs as an optional dependency. The [CLI account library](../cli-account/README.md) runs each command on the private PATH, so the backend and the Shell use the same executable, and runs one operation at a time. [`src/account.ts`](src/account.ts) extends that runtime with the WeCom commands and reads the QR-code link from the output lines of `auth init`. Disposal cancels the active operation, aborts running commands, and settles after their processes exit. +[`src/index.ts`](src/index.ts) is a Remote service registered as `ctx.wecom`. It checks that `binDir/wecom-cli` is executable, gives that path to the model in runtime context, and mounts a [filesystem skill provider](../../skill/skill-filesystem/README.md) named `wecom` over this package's `skills/` directory, without the default roots or watching. [`src/directory.ts`](src/directory.ts) resolves the platform package that `@wecom/cli` installs as an optional dependency. The [CLI account library](../cli-account/README.md) registers that runtime context, runs each command by the same path, and runs one operation at a time. [`src/account.ts`](src/account.ts) extends that runtime with the WeCom commands and reads the QR-code link from the output lines of `auth init`. Disposal cancels the active operation, aborts running commands, and settles after their processes exit. [`skills/wecom/SKILL.md`](skills/wecom/SKILL.md) is the only skill: the DSH guidance, an index of the guides, and how to open them. [`skills/wecom/guides/`](skills/wecom/guides) is an unchanged copy of `skills/` from `WecomTeam/wecom-cli` at commit `4c74ff2`, because upstream publishes the skills only in that repository and not in the npm package. The filesystem provider discovers only `//SKILL.md`, so the guides are not separate skills. Where the DSH guidance and `wecomcli-shared` disagree, the entry tells the agent to follow the DSH guidance: it uses the plugin's `wecom-cli` instead of installing one, and sends authorization to the plugin page. References are ordinary files in each guide's directory. @@ -81,7 +81,6 @@ The generated [config catalog](../../../docs/config-catalog.md#deepseek-aidsh-we - [Connector packages](../README.md) — the group this application plugin belongs to. - [CLI account library](../cli-account/README.md) — command execution and account operations shared by CLI app plugins. -- [Shell environment](../../shell/shell-env/README.md) — private PATH contributions shared by backend subprocesses and Shell tools. - [Skills](../../../docs/subsystems/skills.md) — catalog publication, loading, and precedence. - [WeCom plugin](../wecom/README.md) — the bundle that inserts this row and the page row. - [WeCom plugin page](../../client/ui-wecom/README.md) — the Plugins page that drives the authorization operations. @@ -109,7 +108,7 @@ The catalog is fixed for one plugin version. Loading or unloading the plugin cha #### What the model sees -A `skill` tool result for `wecom` contains about 2,000 characters: the DSH guidance, an index that gives each of the 15 guides one sentence with the upstream routing rules, and how to open a guide. The DSH guidance tells the agent to run the plugin's `wecom-cli` by name, to ask the user to connect on the plugin page before running `auth init --noninteractive` itself, and to run that command with single-command approval; it takes precedence over `wecomcli-shared` where they disagree. Its resource base is `skills/wecom`, so the agent opens `guides//SKILL.md` with the file tools rather than the `skill` tool, treats a skill the guides name as that guide, and resolves a guide's relative paths against the guide's own directory. +A `skill` tool result for `wecom` contains about 2,000 characters: the DSH guidance, an index that gives each of the 15 guides one sentence with the upstream routing rules, and how to open a guide. The DSH guidance tells the agent to run the plugin's `wecom-cli` by the absolute path from the current runtime context, to ask the user to connect on the plugin page before running `auth init --noninteractive` itself, and to run that command with single-command approval; it takes precedence over `wecomcli-shared` where they disagree. Its resource base is `skills/wecom`, so the agent opens `guides//SKILL.md` with the file tools rather than the `skill` tool, treats a skill the guides name as that guide, and resolves a guide's relative paths against the guide's own directory. #### Token effect @@ -119,26 +118,33 @@ Each load adds the entry body to the retained tool history. Guides and their ref Loading appends a tool result and does not rewrite earlier context. -### Plugin CLIs entry +### CLI path #### What the model sees -The row declares `wecom-cli` with its private PATH entry, so the [Shell environment](../../shell/shell-env/README.md#model-experience) Plugin CLIs section of the system prompt lists `` `wecom-cli` (wecom) `` while the row is loaded and the shell runs on this Host. +While the row is loaded, the [CLI account library](../cli-account/README.md#model-experience) adds one required runtime-context entry with the path of `wecom-cli` in `binDir`, which defaults to the `bin` directory of the platform package that `@wecom/cli` installs. The second line covers the guide scripts that call `wecom-cli` by name, such as `build_page.py`. + +##### Runtime-context entry + +```markdown +WeCom CLI: run `wecom-cli` by its absolute path "/wecom-cli"; the bare name may resolve to another installation or to none. +Scripts in the WeCom skill call `wecom-cli` by name; prefix only the commands that run them with PATH=":$PATH", and never export PATH or run `wecom-cli` by name yourself. +``` #### Token effect -The entry adds a few tokens to that section; the section's own text belongs to Shell environment. +Two lines of about 280 characters plus the path and its directory in each runtime-context snapshot. #### KV Cache effect -Loading or unloading the row changes the section text, and provider cache reuse may end at the first changed token. +The system prompt does not change; loading or unloading the row, or a changed path, appends one runtime-context snapshot. ## Known Limitations and Deferred Work - Only macOS is supported. Other platforms are unverified, and the Windows executable name `wecom-cli.exe` is not located. -- The plugin requires a subprocess runtime on this Host and fails to load when the composition's subprocess runtime runs elsewhere, such as over SSH. +- Commands must run on this Host. When a composition runs them elsewhere, such as over SSH, the plugin still loads, and each command that runs `wecom-cli` fails because the path does not exist there. - The plugin uses the CLI's default configuration. Authorizing from DSH affects the user's own terminal, and there is no DSH-private bot or bot picker. `wecom-cli` cannot revoke the authorization, so neither the page nor turning the plugin off removes it. - Connection reads the QR-code link from the plain-text output of `auth init --noninteractive --no-browser`; a CLI version that changes that output fails the connection with a retryable result. - The guides follow upstream commit `4c74ff2`; updating them is a manual copy, after which the entry's index and DSH guidance must be checked against the new guides. diff --git a/packages/connector/wecom-cli/README.zh.md b/packages/connector/wecom-cli/README.zh.md index ca8d258dcd..96e3032cf8 100644 --- a/packages/connector/wecom-cli/README.zh.md +++ b/packages/connector/wecom-cli/README.zh.md @@ -1,5 +1,5 @@ --- -description: "把官方 wecom-cli 放进私有 Shell PATH,加载其技能,并执行插件页发起的授权操作。" +description: "把官方 wecom-cli 的绝对路径告诉模型,加载其技能,并执行插件页发起的授权操作。" kind: "package-reference" --- @@ -9,7 +9,7 @@ kind: "package-reference" ## 概述 -本包是[企业微信插件](../wecom/README.zh.md)的 Host 行。它安装固定版本的 `@wecom/cli`,把其 `wecom-cli` 可执行文件放进私有 Shell PATH,并注册一个 `wecom` skill,其子指南是官方企业微信技能。它的 `wecom` Remote 为[企业微信插件页面](../../client/ui-wecom/README.zh.md)检查 CLI 的授权、通过 CLI 的扫码页面绑定机器人,以及取消操作。CLI 把机器人凭据保存在默认配置中,与用户自己的终端共用。仅支持 macOS。 +本包是[企业微信插件](../wecom/README.zh.md)的 Host 行。它安装固定版本的 `@wecom/cli`,在运行时上下文中把其 `wecom-cli` 可执行文件的绝对路径告诉模型,并注册一个 `wecom` skill,其子指南是官方企业微信技能。它的 `wecom` Remote 为[企业微信插件页面](../../client/ui-wecom/README.zh.md)检查 CLI 的授权、通过 CLI 的扫码页面绑定机器人,以及取消操作。CLI 把机器人凭据保存在默认配置中,与用户自己的终端共用。仅支持 macOS。 ## 目录 @@ -31,9 +31,9 @@ kind: "package-reference" ### 获得的能力 -插件加载后,一个 `wecom` skill 进入 skill 目录。agent 用 `skill` 工具加载它,用文件工具打开所需的子指南(例如 `wecomcli-doc` 或 `wecomcli-message`),并在当前沙箱与审批策略下通过普通 Shell 工具运行 `wecom-cli` 命令。`wecom-cli auth show --status` 报告未授权时,agent 会请用户到插件页连接企业微信;只有用户要求在对话中完成时,才运行 CLI 自带的 `auth init`,并因为它会在工作区之外写入而申请单条命令审批。 +插件加载后,一个 `wecom` skill 进入 skill 目录。agent 用 `skill` 工具加载它,用文件工具打开所需的子指南(例如 `wecomcli-doc` 或 `wecomcli-message`),并在当前沙箱与审批策略下通过普通 Shell 工具按这个路径运行 `wecom-cli`。`wecom-cli auth show --status` 报告未授权时,agent 会请用户到插件页连接企业微信;只有用户要求在对话中完成时,才运行 CLI 自带的 `auth init`,并因为它会在工作区之外写入而申请单条命令审批。 -在 Plugin Manager 中关闭该行会为后续 Shell 调用撤下 skill 与私有 PATH 条目,CLI 的授权保持不变。 +在 Plugin Manager 中关闭该行会撤下 skill,并从运行时上下文中移除这个路径,CLI 的授权保持不变。 ### 授权操作 @@ -68,7 +68,7 @@ kind: "package-reference"
实现内部机制——点击展开 -[`src/index.ts`](src/index.ts) 是注册为 `ctx.wecom` 的 Remote 服务。它要求 subprocess 运行时位于本 Host,检查 `binDir/wecom-cli` 是否可执行,把 `binDir` 作为提供 `wecom-cli` 的 `wecom` PATH 贡献注册到 [Shell 环境](../../shell/shell-env/README.zh.md),并在本包的 `skills/` 目录上挂载一个名为 `wecom` 的[文件系统 skill 提供方](../../skill/skill-filesystem/README.zh.md),不包含默认根目录,也不监听变化。[`src/directory.ts`](src/directory.ts) 定位 `@wecom/cli` 作为可选依赖安装的平台包。[CLI 账号库](../cli-account/README.zh.md)在私有 PATH 上运行每条命令,使后端与 Shell 使用同一个可执行文件,并一次执行一个操作。[`src/account.ts`](src/account.ts) 在该运行时上实现企业微信的命令,并从 `auth init` 的输出行中读取扫码链接。释放时取消进行中的操作,中止正在运行的命令,并在这些进程退出后完成。 +[`src/index.ts`](src/index.ts) 是注册为 `ctx.wecom` 的 Remote 服务。它检查 `binDir/wecom-cli` 是否可执行,在运行时上下文中把这个路径告诉模型,并在本包的 `skills/` 目录上挂载一个名为 `wecom` 的[文件系统 skill 提供方](../../skill/skill-filesystem/README.zh.md),不包含默认根目录,也不监听变化。[`src/directory.ts`](src/directory.ts) 定位 `@wecom/cli` 作为可选依赖安装的平台包。[CLI 账号库](../cli-account/README.zh.md)注册这条运行时上下文,按同一路径运行每条命令,并一次执行一个操作。[`src/account.ts`](src/account.ts) 在该运行时上实现企业微信的命令,并从 `auth init` 的输出行中读取扫码链接。释放时取消进行中的操作,中止正在运行的命令,并在这些进程退出后完成。 [`skills/wecom/SKILL.md`](skills/wecom/SKILL.md) 是唯一的 skill:DSH 指引、子指南索引和打开方式。[`skills/wecom/guides/`](skills/wecom/guides) 原样复制自 `WecomTeam/wecom-cli` 在提交 `4c74ff2` 时的 `skills/`,因为上游只在该仓库发布这些 skill,没有放进 npm 包。文件系统提供方只发现 `//SKILL.md`,因此子指南不是独立的 skill。DSH 指引与 `wecomcli-shared` 不一致时,总入口要求 agent 以 DSH 指引为准:使用插件提供的 `wecom-cli`,不再自行安装,并把授权引导到插件页。引用文件是每个子指南目录中的普通文件。 @@ -81,7 +81,6 @@ kind: "package-reference" - [Connector 包](../README.zh.md)——这个应用插件所属的分组。 - [CLI 账号库](../cli-account/README.zh.md)——CLI 应用插件共用的命令执行与账号操作。 -- [Shell 环境](../../shell/shell-env/README.zh.md)——后端 subprocess 与 Shell 工具共用的私有 PATH 贡献。 - [Skill](../../../docs/subsystems/skills.zh.md)——目录发布、加载与优先级。 - [企业微信插件](../wecom/README.zh.md)——插入本行与页面行的 bundle。 - [企业微信插件页面](../../client/ui-wecom/README.zh.md)——发起授权操作的插件页。 @@ -109,7 +108,7 @@ skill 目录只列出一个 `wecom` skill。其中文描述列出它覆盖的企 #### 模型看到什么 -`wecom` 的 `skill` 工具结果约 2,000 个字符:DSH 指引、为 15 个子指南各写一句话并保留上游分流规则的索引,以及打开子指南的方式。DSH 指引要求 agent 按名称运行插件提供的 `wecom-cli`,先请用户到插件页连接,再考虑自行运行 `auth init --noninteractive`,并以单条命令审批运行该命令;与 `wecomcli-shared` 不一致时以它为准。其资源根目录是 `skills/wecom`,因此 agent 用文件工具而不是 `skill` 工具打开 `guides//SKILL.md`,把子指南按名字提到的技能当作对应子指南,并按子指南自己的目录解析其中的相对路径。 +`wecom` 的 `skill` 工具结果约 2,000 个字符:DSH 指引、为 15 个子指南各写一句话并保留上游分流规则的索引,以及打开子指南的方式。DSH 指引要求 agent 按当前运行时上下文给出的绝对路径运行插件提供的 `wecom-cli`,先请用户到插件页连接,再考虑自行运行 `auth init --noninteractive`,并以单条命令审批运行该命令;与 `wecomcli-shared` 不一致时以它为准。其资源根目录是 `skills/wecom`,因此 agent 用文件工具而不是 `skill` 工具打开 `guides//SKILL.md`,把子指南按名字提到的技能当作对应子指南,并按子指南自己的目录解析其中的相对路径。 #### Token 影响 @@ -119,26 +118,33 @@ skill 目录只列出一个 `wecom` skill。其中文描述列出它覆盖的企 加载会追加一条工具结果,不改写更早的上下文。 -### Plugin CLIs 条目 +### CLI 路径 #### 模型看到什么 -本行在私有 PATH 条目中声明了 `wecom-cli`,因此该行加载、且 Shell 在本 Host 上运行时,系统提示词中 [Shell 环境](../../shell/shell-env/README.zh.md#model-experience)的 Plugin CLIs 一节会列出 `` `wecom-cli` (wecom) ``。 +该行加载期间,[CLI 账号库](../cli-account/README.zh.md#model-experience)添加一条必需的运行时上下文,给出 `binDir` 中 `wecom-cli` 的路径;`binDir` 默认是 `@wecom/cli` 安装的平台包的 `bin` 目录。第二行针对按名称调用 `wecom-cli` 的子指南脚本,例如 `build_page.py`。 + +##### 运行时上下文条目 + +```markdown +WeCom CLI: run `wecom-cli` by its absolute path "/wecom-cli"; the bare name may resolve to another installation or to none. +Scripts in the WeCom skill call `wecom-cli` by name; prefix only the commands that run them with PATH=":$PATH", and never export PATH or run `wecom-cli` by name yourself. +``` #### Token 影响 -该条目只给这一节增加几个 token;这一节本身的文字归 Shell 环境所有。 +每份运行时上下文快照中两行,约 280 个字符加上路径及其目录。 #### KV Cache 影响 -加载或卸载该行会改变这一节的文字,provider 的缓存复用可能在第一个变化的 token 处结束。 +系统提示词不变;加载或卸载该行、或路径变化时,追加一份运行时上下文快照。 ## 已知限制与延期工作 - 仅支持 macOS。其他平台未经验证,且不会定位 Windows 可执行文件名 `wecom-cli.exe`。 -- 插件要求 subprocess 运行时位于本 Host;组合中的 subprocess 运行时在别处运行(例如通过 SSH)时,插件加载失败。 +- 命令必须在本 Host 上运行。组合把命令放到别处运行(例如通过 SSH)时,插件仍会加载,但每条运行 `wecom-cli` 的命令都会因为那里没有这个路径而失败。 - 插件使用 CLI 的默认配置。在 DSH 中授权会影响用户自己的终端,没有 DSH 私有机器人或机器人选择器。`wecom-cli` 无法撤销授权,因此页面和关闭插件都不会移除它。 - 连接从 `auth init --noninteractive --no-browser` 的纯文本输出中读取扫码链接;CLI 版本改变该输出时,连接以可重试的结果失败。 - 子指南跟随上游提交 `4c74ff2`;更新时需手动复制,之后要按新的子指南核对总入口的索引和 DSH 指引。 diff --git a/packages/connector/wecom-cli/package.json b/packages/connector/wecom-cli/package.json index 8219087d0d..bbe3b80ba1 100644 --- a/packages/connector/wecom-cli/package.json +++ b/packages/connector/wecom-cli/package.json @@ -1,6 +1,6 @@ { "name": "@deepseek-ai/dsh-wecom-cli", - "description": "WeCom through the official wecom-cli: the CLI on the Shell PATH, its skills, and authorization over Remote", + "description": "WeCom through the official wecom-cli: the CLI by its absolute path, its skills, and authorization over Remote", "version": "0.2.1-rc.2", "publishConfig": { "access": "public" @@ -53,16 +53,16 @@ }, "peerDependencies": { "@deepseek-ai/cordis": "workspace:~", - "@deepseek-ai/dsh-shell-env": "workspace:*", "@deepseek-ai/dsh-skill": "workspace:*", "@deepseek-ai/dsh-subprocess": "workspace:*", + "@deepseek-ai/dsh-system-prompt": "workspace:*", "@deepseek-ai/dsh-typert-protocol": "workspace:*" }, "devDependencies": { "@deepseek-ai/cordis": "workspace:~", - "@deepseek-ai/dsh-shell-env": "workspace:*", "@deepseek-ai/dsh-skill": "workspace:*", "@deepseek-ai/dsh-subprocess": "workspace:*", + "@deepseek-ai/dsh-system-prompt": "workspace:*", "@deepseek-ai/dsh-typert-protocol": "workspace:*" } } diff --git a/packages/connector/wecom-cli/skills/wecom/SKILL.md b/packages/connector/wecom-cli/skills/wecom/SKILL.md index 9c69780565..f44d0e0acd 100644 --- a/packages/connector/wecom-cli/skills/wecom/SKILL.md +++ b/packages/connector/wecom-cli/skills/wecom/SKILL.md @@ -7,7 +7,7 @@ description: 企业微信插件:通过 wecom-cli 使用企业微信的通讯 ## DSH 指引 -- 在面向用户的回复中,把这项集成称为“企业微信插件”。`wecom-cli` 由企业微信插件安装并加入 Host Shell 的 PATH,直接按名称运行。不要执行 `npm install -g @wecom/cli`,也不要用其他方式另装或升级 `wecom-cli`。 +- 在面向用户的回复中,把这项集成称为“企业微信插件”。`wecom-cli` 由企业微信插件安装,按当前 runtime context 给出的绝对路径运行,不要直接按名称运行。不要执行 `npm install -g @wecom/cli`,也不要用其他方式另装或升级 `wecom-cli`。 - `wecom-cli` 的授权保存在这台电脑的默认配置目录,与用户自己终端里的 `wecom-cli` 共用。 - 首次运行业务命令前,先读 `wecomcli-shared` 子指南并按它检查授权。本节与该子指南冲突时以本节为准:它 Step 1 的版本检查不需要安装或升级;它 Step 3 的初始化改为下一条。 - 未授权时,先请用户在「插件」中打开企业微信插件页面,点击“连接企业微信”并用企业微信扫码授权;用户完成后重新检查授权。只有用户要求在本次对话中完成授权时,才执行 `wecom-cli auth init --noninteractive`:它会输出扫码链接和二维码,并最多等待 5 分钟扫码,把扫码链接告诉用户。它会把凭据写到工作区之外,保存被拒绝时这次扫码也会作废:从一开始就用 Shell 工具的单条命令审批运行。 diff --git a/packages/connector/wecom-cli/src/directory.ts b/packages/connector/wecom-cli/src/directory.ts index 625cf29435..cb7d41b186 100644 --- a/packages/connector/wecom-cli/src/directory.ts +++ b/packages/connector/wecom-cli/src/directory.ts @@ -4,7 +4,7 @@ import { accessSync, constants } from 'node:fs' import { createRequire } from 'node:module' import { dirname, join } from 'node:path' -/** The executable name the plugin resolves on its private PATH. */ +/** The name wecom-cli's guides and scripts run it by. */ export const PROGRAM = 'wecom-cli' function platformDirectory(): string { @@ -18,18 +18,17 @@ function platformDirectory(): string { } /** - * Locate the directory holding the managed executable. + * Locate the managed executable. * @param binDir - absolute override; defaults to the `bin` of the installed `@wecom/cli--` package. - * @returns the bin directory containing an executable `wecom-cli`. + * @returns the absolute path of the executable `wecom-cli`. * @throws when the platform package is missing or the executable is not executable. */ -export function resolveCliDirectory(binDir: string | undefined): string { - const directory = binDir ?? platformDirectory() - const program = join(directory, PROGRAM) +export function resolveCliExecutable(binDir: string | undefined): string { + const program = join(binDir ?? platformDirectory(), PROGRAM) try { accessSync(program, constants.X_OK) } catch (error) { throw new Error(`wecom: ${program} is not executable; reinstall the plugin or set binDir`, { cause: error }) } - return directory + return program } diff --git a/packages/connector/wecom-cli/src/index.ts b/packages/connector/wecom-cli/src/index.ts index 8f0ba30500..76370dd6ff 100644 --- a/packages/connector/wecom-cli/src/index.ts +++ b/packages/connector/wecom-cli/src/index.ts @@ -1,5 +1,5 @@ /** - * WeCom plugin: puts the managed wecom-cli on the private Shell PATH, registers + * WeCom plugin: tells the model the managed wecom-cli's absolute path, registers * its bundled skills, and serves the Plugins page's authorization over Remote. * The CLI's authorization is shared with the user's own terminal. * @module @deepseek-ai/dsh-wecom-cli @@ -8,14 +8,14 @@ import { fileURLToPath } from 'node:url' import type { Context } from '@deepseek-ai/cordis' import type z from '@deepseek-ai/schemastery' -import { CliAccountConfig, CliCommandExecutor, type CliOperationId } from '@deepseek-ai/dsh-cli-account' +import { CliAccountConfig, CliCommandExecutor, registerCliPathContext, type CliOperationId } from '@deepseek-ai/dsh-cli-account' import * as SkillFilesystem from '@deepseek-ai/dsh-skill-filesystem' import { Remote, TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol' -import type {} from '@deepseek-ai/dsh-shell-env' import type {} from '@deepseek-ai/dsh-skill' import type {} from '@deepseek-ai/dsh-subprocess' +import type {} from '@deepseek-ai/dsh-system-prompt' import { WecomAccount } from './account.ts' -import { PROGRAM, resolveCliDirectory } from './directory.ts' +import { PROGRAM, resolveCliExecutable } from './directory.ts' import type { WecomState } from './types.ts' export type * from './types.ts' @@ -32,23 +32,21 @@ export type Config = CliAccountConfig /** Registers the CLI and skills, and owns the authorization operations the Plugins page drives. */ export default class Wecom extends TypertRemoteService { - static inject = ['skills', 'subprocess', 'shellEnv'] + static inject = ['skills', 'subprocess', 'systemPrompt'] static Config: z = CliAccountConfig private readonly account: WecomAccount /** - * @param ctx - Context carrying the skill registry, subprocess runtime, and Shell environment. + * @param ctx - Context carrying the skill registry, subprocess runtime, and system prompt. * @param config - CLI location and command deadline. - * @throws when the subprocess runtime does not run on this Host or `wecom-cli` is not executable. + * @throws when `wecom-cli` is not executable. */ constructor(ctx: Context, config: Config) { super(ctx, 'wecom') - if (!ctx.subprocess.runsOnHost) { - throw new Error('wecom: wecom-cli and its authorization are local to this Host; mount a Host subprocess runtime') - } - ctx.shellEnv.registerPath({ name: 'wecom', directories: [resolveCliDirectory(config.binDir)], programs: [PROGRAM] }) - const cli = new CliCommandExecutor(ctx.subprocess, ctx.shellEnv, { program: PROGRAM, commandTimeoutMs: config.commandTimeoutMs }) + const executable = resolveCliExecutable(config.binDir) + registerCliPathContext(ctx, { name: 'wecom:cli', product: 'WeCom', program: PROGRAM, executable, scripts: true }) + const cli = new CliCommandExecutor(ctx.subprocess, { program: PROGRAM, executable, commandTimeoutMs: config.commandTimeoutMs }) this.account = new WecomAccount(cli, ctx.logger) ctx.effect(() => () => this.account.dispose()) ctx.plugin(SkillFilesystem, { diff --git a/packages/connector/wecom-cli/tests/account.spec.ts b/packages/connector/wecom-cli/tests/account.spec.ts index e1376084d1..27f8e90fba 100644 --- a/packages/connector/wecom-cli/tests/account.spec.ts +++ b/packages/connector/wecom-cli/tests/account.spec.ts @@ -1,9 +1,10 @@ /** Authorization operations over a scripted wecom-cli: checks, QR-code connection, cancellation, and the Remote wiring. */ import { rm } from 'node:fs/promises' +import { join } from 'node:path' import { Context } from '@deepseek-ai/cordis' import { CliCommandExecutor, type CliOperationId } from '@deepseek-ai/dsh-cli-account' import SkillRegistry from '@deepseek-ai/dsh-skill' -import * as ShellEnv from '@deepseek-ai/dsh-shell-env' +import SystemPrompt from '@deepseek-ai/dsh-system-prompt' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { WecomAccount } from '../src/account.ts' import { PROGRAM } from '../src/directory.ts' @@ -27,7 +28,7 @@ beforeEach(async () => { ctx = new Context() await ctx.plugin(SkillRegistry) await ctx.plugin(ScriptedSubprocess) - await ctx.plugin(ShellEnv) + await ctx.plugin(SystemPrompt) subprocess = ctx.subprocess as ScriptedSubprocess binDir = await createBinDir() script = {} @@ -51,8 +52,7 @@ describe('WecomAccount', () => { let account: WecomAccount beforeEach(() => { - ctx.shellEnv.registerPath({ name: 'wecom', directories: [binDir], programs: [PROGRAM] }) - const cli = new CliCommandExecutor(ctx.subprocess, ctx.shellEnv, { program: PROGRAM, commandTimeoutMs: 5_000 }) + const cli = new CliCommandExecutor(ctx.subprocess, { program: PROGRAM, executable: join(binDir, PROGRAM), commandTimeoutMs: 5_000 }) account = new WecomAccount(cli, ctx.logger) }) @@ -167,6 +167,7 @@ describe('WeCom Remote', () => { expect(await finished()).toMatchObject({ kind: 'check', outcome: 'succeeded' }) expect(states[0]).toMatchObject({ account: { state: 'unchecked' }, operation: { kind: 'check' } }) expect(states.at(-1)?.account).toEqual({ state: 'unauthorized' }) + expect(subprocess.lookups[0]?.command).toBe(join(binDir, 'wecom-cli')) expect(await finished(ctx.wecom.check())).toMatchObject({ kind: 'check', outcome: 'succeeded' }) script[INIT] = () => {} diff --git a/packages/connector/wecom-cli/tests/directory.spec.ts b/packages/connector/wecom-cli/tests/directory.spec.ts index b5cc61e6fb..e9063d22d6 100644 --- a/packages/connector/wecom-cli/tests/directory.spec.ts +++ b/packages/connector/wecom-cli/tests/directory.spec.ts @@ -2,7 +2,7 @@ import { constants } from 'node:fs' import { createRequire } from 'node:module' import { dirname, join } from 'node:path' import { beforeEach, expect, it, onTestFinished, vi } from 'vitest' -import { resolveCliDirectory } from '../src/directory.ts' +import { resolveCliExecutable } from '../src/directory.ts' const fs = vi.hoisted(() => ({ accessSync: vi.fn() })) vi.mock('node:fs', async importOriginal => ({ ...await importOriginal(), accessSync: fs.accessSync })) @@ -16,8 +16,8 @@ beforeEach(() => { fs.accessSync.mockReset() }) -it('defaults to the bin directory of the platform package that @wecom/cli installs', () => { - expect(resolveCliDirectory(undefined)).toBe(PACKAGE_BIN) +it('defaults to the executable in the bin directory of the platform package that @wecom/cli installs', () => { + expect(resolveCliExecutable(undefined)).toBe(join(PACKAGE_BIN, 'wecom-cli')) expect(fs.accessSync).toHaveBeenCalledWith(join(PACKAGE_BIN, 'wecom-cli'), constants.X_OK) }) @@ -25,13 +25,13 @@ it('names the platform package @wecom/cli does not provide', () => { const arch = Object.getOwnPropertyDescriptor(process, 'arch')! Object.defineProperty(process, 'arch', { ...arch, value: 'fixture-arch' }) onTestFinished(() => { Object.defineProperty(process, 'arch', arch) }) - expect(() => resolveCliDirectory(undefined)) + expect(() => resolveCliExecutable(undefined)) .toThrow(`wecom: @wecom/cli-${process.platform}-fixture-arch is not installed; @wecom/cli has no binary for this platform, or set binDir`) }) it('accepts a configured directory and names the missing executable with the remedy', () => { - expect(resolveCliDirectory('/opt/wecom/bin')).toBe('/opt/wecom/bin') + expect(resolveCliExecutable('/opt/wecom/bin')).toBe('/opt/wecom/bin/wecom-cli') fs.accessSync.mockImplementation(() => { throw new Error('EACCES') }) - expect(() => resolveCliDirectory(PACKAGE_BIN)) + expect(() => resolveCliExecutable(PACKAGE_BIN)) .toThrow(`wecom: ${join(PACKAGE_BIN, 'wecom-cli')} is not executable; reinstall the plugin or set binDir`) }) diff --git a/packages/connector/wecom-cli/tests/harness.ts b/packages/connector/wecom-cli/tests/harness.ts index 796b95f03a..f13a6fbd89 100644 --- a/packages/connector/wecom-cli/tests/harness.ts +++ b/packages/connector/wecom-cli/tests/harness.ts @@ -78,14 +78,9 @@ export class ScriptedProcess implements SubprocessHandle { export class ScriptedSubprocess extends SubprocessRuntime { readonly lookups: Array<{ command: string; env: Readonly> | undefined }> = [] readonly processes: ScriptedProcess[] = [] - host = true lookup: (signal?: AbortSignal) => Promise = () => Promise.resolve('/fixture/bin/wecom-cli') respond: (process: ScriptedProcess) => void | Promise = (process) => { process.reply({ stdout: '{}' }) } - override get runsOnHost(): boolean { - return this.host - } - override resolveExecutable(command: string, env?: Readonly>, signal?: AbortSignal): Promise { this.lookups.push({ command, env }) return this.lookup(signal) diff --git a/packages/connector/wecom-cli/tests/plugin.spec.ts b/packages/connector/wecom-cli/tests/plugin.spec.ts index ef5fbe5dd8..15d129e897 100644 --- a/packages/connector/wecom-cli/tests/plugin.spec.ts +++ b/packages/connector/wecom-cli/tests/plugin.spec.ts @@ -1,7 +1,8 @@ import { rm } from 'node:fs/promises' +import { join } from 'node:path' import { Context } from '@deepseek-ai/cordis' import SkillRegistry from '@deepseek-ai/dsh-skill' -import * as ShellEnv from '@deepseek-ai/dsh-shell-env' +import SystemPrompt, { renderContextSections } from '@deepseek-ai/dsh-system-prompt' import { afterEach, beforeEach, describe, expect, it } from 'vitest' import Wecom from '../src/index.ts' import { createBinDir, ScriptedSubprocess } from './harness.ts' @@ -17,7 +18,7 @@ describe('WeCom plugin', () => { ctx = new Context() await ctx.plugin(SkillRegistry) await ctx.plugin(ScriptedSubprocess) - await ctx.plugin(ShellEnv) + await ctx.plugin(SystemPrompt) subprocess = ctx.subprocess as ScriptedSubprocess subprocess.respond = (process) => { process.reply({ stdout: 'unauthorized\n' }) } binDir = await createBinDir() @@ -28,6 +29,8 @@ describe('WeCom plugin', () => { await rm(binDir, { recursive: true, force: true }) }) + const runtimeContext = async () => renderContextSections(await ctx.systemPrompt.assemble()) + it('publishes one wecom entry skill whose body carries the DSH guidance', async () => { await ctx.plugin(Wecom, { ...CONFIG, binDir }) @@ -35,25 +38,22 @@ describe('WeCom plugin', () => { expect(catalog.map(skill => `${skill.provider}/${skill.source}/${skill.name}`)).toEqual(['wecom/bundled/wecom']) const entry = await ctx.skills.get('wecom') - expect(entry?.content).toContain('`wecom-cli` 由企业微信插件安装并加入 Host Shell 的 PATH') + expect(entry?.content).toContain('`wecom-cli` 由企业微信插件安装,按当前 runtime context 给出的绝对路径运行,不要直接按名称运行') expect(await ctx.skills.get('wecomcli-shared')).toBeUndefined() }) - it('refuses to load without a Host subprocess runtime', () => { - subprocess.host = false - - expect(() => new Wecom(ctx, { ...CONFIG, binDir })).toThrow('wecom: wecom-cli and its authorization are local to this Host') - expect(ctx.shellEnv.getPathPrefix(ctx.subprocess)).toBeUndefined() - }) - - it('withdraws the private PATH and skills on disposal', async () => { + it('gives the executable path and the script PATH prefix in runtime context, and withdraws them and the skills on disposal', async () => { const fiber = await ctx.plugin(Wecom, { ...CONFIG, binDir }) - expect(ctx.shellEnv.getPathPrefix(ctx.subprocess)).toBe(binDir) + expect(await runtimeContext()).toEqual([{ + name: 'wecom:cli', + text: `WeCom CLI: run \`wecom-cli\` by its absolute path "${join(binDir, 'wecom-cli')}"; the bare name may resolve to another installation or to none.\n` + + `Scripts in the WeCom skill call \`wecom-cli\` by name; prefix only the commands that run them with PATH="${binDir}:$PATH", and never export PATH or run \`wecom-cli\` by name yourself.`, + }]) expect(await ctx.skills.list()).not.toEqual([]) await fiber.dispose() - expect(ctx.shellEnv.getPathPrefix(ctx.subprocess)).toBeUndefined() + expect(await runtimeContext()).toEqual([]) expect(await ctx.skills.list()).toEqual([]) }) }) diff --git a/packages/connector/wecom-cli/tsconfig.json b/packages/connector/wecom-cli/tsconfig.json index c1a5ec1e1d..59d0faa98d 100644 --- a/packages/connector/wecom-cli/tsconfig.json +++ b/packages/connector/wecom-cli/tsconfig.json @@ -23,9 +23,6 @@ { "path": "../../typert/protocol" }, - { - "path": "../../shell/shell-env" - }, { "path": "../../skill/skill" }, @@ -34,6 +31,9 @@ }, { "path": "../cli-account" + }, + { + "path": "../../core/system-prompt" } ] } diff --git a/packages/connector/wecom/README.i18n.yaml b/packages/connector/wecom/README.i18n.yaml index 9c42d9806b..db045dac48 100644 --- a/packages/connector/wecom/README.i18n.yaml +++ b/packages/connector/wecom/README.i18n.yaml @@ -21,8 +21,8 @@ en: 8241a30e5141c500 zh: 97f8736d76cf596a /deepseek-ai-dsh-wecom/use-this-package/what-you-get: - en: 8b5a392adea67172 - zh: 23685b4cdeb71e98 + en: 1792807c71dc1378 + zh: 30a4e8bbef8465f1 /deepseek-ai-dsh-wecom/understand-the-implementation: en: d4754af8f28ba943 zh: 5dd12878d10aa923 diff --git a/packages/connector/wecom/README.md b/packages/connector/wecom/README.md index 8f1e6b9e2a..bbddf351ec 100644 --- a/packages/connector/wecom/README.md +++ b/packages/connector/wecom/README.md @@ -40,10 +40,10 @@ dsh plugin --profile web remove @deepseek-ai/dsh-wecom | Row | Package | Behavior | |---|---|---| -| `wecom` | [`@deepseek-ai/dsh-wecom-cli`](../wecom-cli/README.md) | Puts `wecom-cli` on the private Shell PATH, registers its skills, and runs authorization checks and QR-code connection on the Host | +| `wecom` | [`@deepseek-ai/dsh-wecom-cli`](../wecom-cli/README.md) | Gives the model the absolute path of `wecom-cli`, registers its skills, and runs authorization checks and QR-code connection on the Host | | `ui-wecom` | [`@deepseek-ai/dsh-client-ui-wecom`](../../client/ui-wecom/README.md) | Shows the WeCom authorization section, an authorization tag, guidance after the bundle is switched on, and notices on the Plugins page | -Switching the bundle off withdraws the skills, the private PATH entry, and the page. The CLI authorization stays in place. +Switching the bundle off withdraws the skills, the path in runtime context, and the page. The CLI authorization stays in place. ----- diff --git a/packages/connector/wecom/README.zh.md b/packages/connector/wecom/README.zh.md index 047a3a4fc9..e3084ee940 100644 --- a/packages/connector/wecom/README.zh.md +++ b/packages/connector/wecom/README.zh.md @@ -40,10 +40,10 @@ dsh plugin --profile web remove @deepseek-ai/dsh-wecom | 行 | 包 | 行为 | |---|---|---| -| `wecom` | [`@deepseek-ai/dsh-wecom-cli`](../wecom-cli/README.zh.md) | 把 `wecom-cli` 放进私有 Shell PATH,注册其技能,并在 Host 上执行授权检查和扫码连接 | +| `wecom` | [`@deepseek-ai/dsh-wecom-cli`](../wecom-cli/README.zh.md) | 把 `wecom-cli` 的绝对路径告诉模型,注册其技能,并在 Host 上执行授权检查和扫码连接 | | `ui-wecom` | [`@deepseek-ai/dsh-client-ui-wecom`](../../client/ui-wecom/README.zh.md) | 在插件页显示企业微信授权区块、授权标签、开启后的引导和提示 | -关闭 bundle 会撤下技能、私有 PATH 条目和页面。CLI 的授权保持不变。 +关闭 bundle 会撤下技能、运行时上下文中的路径和页面。CLI 的授权保持不变。 ----- diff --git a/packages/extensions/tool-cordis/src/api-catalog.ts b/packages/extensions/tool-cordis/src/api-catalog.ts index 35f715a23e..3e747b47a1 100644 --- a/packages/extensions/tool-cordis/src/api-catalog.ts +++ b/packages/extensions/tool-cordis/src/api-catalog.ts @@ -5653,6 +5653,14 @@ export const TYPE_API: readonly TypeApiEntry[] = [ name: 'CheckState', declaration: 'export type CheckState = \'pending\' | \'success\' | \'failure\' | \'neutral\' | \'skipped\' | \'cancelled\';', }, + { + name: 'CliAccountView', + declaration: 'export interface CliAccountView {\n readonly account: Account;\n readonly operation?: CliOperation;\n readonly result?: CliOperationResult;\n}', + }, + { + name: 'CliCommandFailure', + declaration: 'export interface CliCommandFailure {\n readonly command: Command;\n readonly exitCode: number | null;\n}', + }, { name: 'ClientArtifactBaseline', declaration: 'export interface ClientArtifactBaseline {\n readonly path: string;\n readonly mtimeMs: number;\n readonly ctimeMs: number;\n readonly size: number;\n}', diff --git a/packages/preset/agent-preset/skills/cordis-composition-reference/references/packages.md b/packages/preset/agent-preset/skills/cordis-composition-reference/references/packages.md index 39d6bfe9f1..9542f60782 100644 --- a/packages/preset/agent-preset/skills/cordis-composition-reference/references/packages.md +++ b/packages/preset/agent-preset/skills/cordis-composition-reference/references/packages.md @@ -143,7 +143,7 @@ Every package below exports a Cordis plugin that a bundle patch can name in a Lo | Package | Config | Description | |---|---|---| -| `@deepseek-ai/dsh-wecom-cli` | yes | WeCom through the official wecom-cli: the CLI on the Shell PATH, its skills, and authorization over Remote | +| `@deepseek-ai/dsh-wecom-cli` | yes | WeCom through the official wecom-cli: the CLI by its absolute path, its skills, and authorization over Remote | ## context diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 585e16118a..c81eeeff93 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -7404,15 +7404,15 @@ importers: '@deepseek-ai/cordis': specifier: workspace:~ version: link:../../../vendor/cordis - '@deepseek-ai/dsh-shell-env': - specifier: workspace:* - version: link:../../shell/shell-env '@deepseek-ai/dsh-skill': specifier: workspace:* version: link:../../skill/skill '@deepseek-ai/dsh-subprocess': specifier: workspace:* version: link:../../subprocess/subprocess + '@deepseek-ai/dsh-system-prompt': + specifier: workspace:* + version: link:../../core/system-prompt '@deepseek-ai/dsh-typert-protocol': specifier: workspace:* version: link:../../typert/protocol diff --git a/snapshots/session/wecom-skills/replay.override.json b/snapshots/session/wecom-skills/replay.override.json new file mode 100644 index 0000000000..44b17260e5 --- /dev/null +++ b/snapshots/session/wecom-skills/replay.override.json @@ -0,0 +1,18 @@ +{ + "patches": [ + { + "at": 0, + "entry": { + "kind": "chunks", + "chunks": [ + { "type": "block-start", "index": 0, "blockType": "reasoning" }, + { "type": "block-end", "index": 0, "block": { "type": "reasoning", "text": "Check the authorization through wecom-cli." } }, + { "type": "block-start", "index": 1, "blockType": "tool-call" }, + { "type": "block-end", "index": 1, "block": { "type": "tool-call", "id": "call_wecom_status", "name": "bash", "arguments": "{\"command\":\"\\\"{{fromRequest:WeCom CLI: run .wecom-cli. by its absolute path .(/[^;]+?).; the bare name}}\\\" auth show --status\",\"description\":\"Check the WeCom authorization\"}" } }, + { "type": "usage", "usage": { "inputTokens": 200, "outputTokens": 20, "cacheReadTokens": 0, "reasoningTokens": 5 } }, + { "type": "finish", "reason": { "kind": "tool-calls" } } + ] + } + } + ] +} diff --git a/snapshots/session/wecom-skills/session.v4.jsonl b/snapshots/session/wecom-skills/session.v4.jsonl index 06d17aa6cd..dec3fc45bb 100644 --- a/snapshots/session/wecom-skills/session.v4.jsonl +++ b/snapshots/session/wecom-skills/session.v4.jsonl @@ -8,15 +8,15 @@ {"type":"step/start","data":{"turn":1,"step":1}} {"type":"system/message","data":{"turn":1,"step":1,"message":{"role":"system","content":[{"type":"text","text":"{{system}}"}],"source":{"kind":"system-prompt"},"id":"{{message:2}}"}},"surfaceOp":"append"} {"type":"user/message","data":{"content":[{"type":"text","text":"Check the WeCom authorization with wecom-cli, then reply DONE."}],"source":{"kind":"user"},"role":"user","id":"{{message:1}}"},"surfaceOp":"append"} -{"type":"user/message","data":{"content":[{"type":"text","text":"Current runtime context. This snapshot supersedes earlier runtime-context snapshots.\n\nCurrent working directory: \"{{cwd}}\".\n\nCurrent DSH file policy: danger-full-access. The DSH file sandbox does not restrict file modifications by available operations.\n\nApproval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`)."}],"source":{"kind":"runtime-context","form":"snapshot","sections":[{"name":"working-directory:current","text":"Current working directory: \"{{cwd}}\"."},{"name":"sandbox:policy","text":"Current DSH file policy: danger-full-access. The DSH file sandbox does not restrict file modifications by available operations."},{"name":"approval:policy","text":"Approval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`)."}]},"role":"user","id":"{{message:3}}"},"surfaceOp":"append"} +{"type":"user/message","data":{"content":[{"type":"text","text":"Current runtime context. This snapshot supersedes earlier runtime-context snapshots.\n\nCurrent working directory: \"{{cwd}}\".\n\nCurrent DSH file policy: danger-full-access. The DSH file sandbox does not restrict file modifications by available operations.\n\nApproval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`).\n\nWeCom CLI: run `wecom-cli` by its absolute path \"{{cwd}}/wecom-bin/wecom-cli\"; the bare name may resolve to another installation or to none.\nScripts in the WeCom skill call `wecom-cli` by name; prefix only the commands that run them with PATH=\"{{cwd}}/wecom-bin:$PATH\", and never export PATH or run `wecom-cli` by name yourself."}],"source":{"kind":"runtime-context","form":"snapshot","sections":[{"name":"working-directory:current","text":"Current working directory: \"{{cwd}}\"."},{"name":"sandbox:policy","text":"Current DSH file policy: danger-full-access. The DSH file sandbox does not restrict file modifications by available operations."},{"name":"approval:policy","text":"Approval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`)."},{"name":"wecom:cli","text":"WeCom CLI: run `wecom-cli` by its absolute path \"{{cwd}}/wecom-bin/wecom-cli\"; the bare name may resolve to another installation or to none.\nScripts in the WeCom skill call `wecom-cli` by name; prefix only the commands that run them with PATH=\"{{cwd}}/wecom-bin:$PATH\", and never export PATH or run `wecom-cli` by name yourself."}]},"role":"user","id":"{{message:3}}"},"surfaceOp":"append"} {"type":"user/message","data":{"content":[{"type":"text","text":"\nA skill is a reusable set of task-specific instructions. The following skills are available in this session:\n\n\n- `wecom`: 企业微信插件:通过 wecom-cli 使用企业微信的通讯录、消息、日程、在线会议、待办、邮件、微盘、文档、在线表格、智能表格、智能文档和 PPT。用户提到企业微信或这些功能,或给出 doc.weixin.qq.com、drive.weixin.qq.com 链接时,先加载本技能,再按索引读取对应子指南。\n\n\nIf the user names a skill, or the task clearly matches a skill's description, call the `skill` tool with the exact skill name before taking task actions. Load all applicable skills, then follow their full instructions. This catalog contains summaries only; do not infer or follow a skill's instructions until it has been loaded.\nA user may also invoke a skill directly; its block then appears in this conversation. Follow it, and do not call the `skill` tool again for that skill.\n"}],"source":{"kind":"skill-catalog","form":"catalog","entries":[{"name":"wecom","description":"企业微信插件:通过 wecom-cli 使用企业微信的通讯录、消息、日程、在线会议、待办、邮件、微盘、文档、在线表格、智能表格、智能文档和 PPT。用户提到企业微信或这些功能,或给出 doc.weixin.qq.com、drive.weixin.qq.com 链接时,先加载本技能,再按索引读取对应子指南。"}]},"role":"user","id":"{{message:4}}"},"surfaceOp":"append"} {"type":"request/header","data":{"header":{"config":{"provider":"deepseek-official","model":"deepseek-v4-flash"},"tools":"{{tools}}"},"reason":"initial"}} {"type":"request/context","data":{"provider":"deepseek-official","model":"deepseek-v4-flash"}} {"type":"session/title","data":{"title":"Check the WeCom authorization with","messageSeqs":[8],"source":{"kind":"fallback"}}} -{"type":"assistant/message","data":{"turn":1,"step":1,"message":{"role":"assistant","content":[{"type":"reasoning","text":"Check the authorization through wecom-cli."},{"type":"tool-call","id":"call_wecom_status","name":"bash","arguments":"{\"command\":\"wecom-cli auth show --status\",\"description\":\"Check the WeCom authorization\"}"}],"source":{"kind":"model","provider":"deepseek-official","model":"deepseek-v4-flash"},"id":"{{message:5}}"},"usage":{"inputTokens":200,"outputTokens":20,"cacheReadTokens":0,"reasoningTokens":5},"stream":[{"type":"chunk","time":1791983232074,"chunk":{"type":"block-start","index":0,"blockType":"reasoning"}},{"type":"reasoning-chunks","time0":1791983232074,"index":0,"dt":[],"texts":["Check the authorization through wecom-cli."]},{"type":"chunk","time":1791983232074,"chunk":{"type":"block-start","index":1,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":1791983232074,"index":1,"dt":[],"id":"call_wecom_status","name":"bash","args":["{\"command\":\"wecom-cli auth show --status\",\"description\":\"Check the WeCom authorization\"}"]},{"type":"chunk","time":1791983232074,"chunk":{"type":"block-end","index":0,"block":{"type":"reasoning","text":"Check the authorization through wecom-cli."}}},{"type":"chunk","time":1791983232074,"chunk":{"type":"block-end","index":1,"block":{"type":"tool-call","id":"call_wecom_status","name":"bash","arguments":"{\"command\":\"wecom-cli auth show --status\",\"description\":\"Check the WeCom authorization\"}"}}},{"type":"chunk","time":1791983232074,"chunk":{"type":"usage","usage":{"inputTokens":200,"outputTokens":20,"cacheReadTokens":0,"reasoningTokens":5}}},{"type":"chunk","time":1791983232074,"chunk":{"type":"finish","reason":{"kind":"tool-calls"}}}]},"surfaceOp":"append"} -{"type":"tool/call","data":{"turn":1,"step":1,"callId":"call_wecom_status","name":"bash","arguments":"{\"command\":\"wecom-cli auth show --status\",\"description\":\"Check the WeCom authorization\"}"}} -{"type":"job/registered","data":{"jobId":"{{id:1}}","owner":"{{session:1}}","kind":"bash","label":"wecom-cli auth show --status","startedAt":1791983232083,"toolCall":{"callId":"call_wecom_status","rootCallId":"call_wecom_status"}}} -{"type":"job/settled","data":{"jobId":"{{id:1}}","owner":"{{session:1}}","kind":"bash","label":"wecom-cli auth show --status","startedAt":1791983232083,"toolCall":{"callId":"call_wecom_status","rootCallId":"call_wecom_status"},"finishedAt":1791983232560,"status":"completed","cause":"producer","producerReported":true,"detail":"exit code: 0"}} +{"type":"assistant/message","data":{"turn":1,"step":1,"message":{"role":"assistant","content":[{"type":"reasoning","text":"Check the authorization through wecom-cli."},{"type":"tool-call","id":"call_wecom_status","name":"bash","arguments":"{\"command\":\"\\\"{{cwd}}/wecom-bin/wecom-cli\\\" auth show --status\",\"description\":\"Check the WeCom authorization\"}"}],"source":{"kind":"model","provider":"deepseek-official","model":"deepseek-v4-flash"},"id":"{{message:5}}"},"usage":{"inputTokens":200,"outputTokens":20,"cacheReadTokens":0,"reasoningTokens":5},"stream":[{"type":"chunk","time":1793073494925,"chunk":{"type":"block-start","index":0,"blockType":"reasoning"}},{"type":"chunk","time":1793073494925,"chunk":{"type":"block-end","index":0,"block":{"type":"reasoning","text":"Check the authorization through wecom-cli."}}},{"type":"chunk","time":1793073494925,"chunk":{"type":"block-start","index":1,"blockType":"tool-call"}},{"type":"chunk","time":1793073494925,"chunk":{"type":"block-end","index":1,"block":{"type":"tool-call","id":"call_wecom_status","name":"bash","arguments":"{\"command\":\"\\\"{{cwd}}/wecom-bin/wecom-cli\\\" auth show --status\",\"description\":\"Check the WeCom authorization\"}"}}},{"type":"chunk","time":1793073494925,"chunk":{"type":"usage","usage":{"inputTokens":200,"outputTokens":20,"cacheReadTokens":0,"reasoningTokens":5}}},{"type":"chunk","time":1793073494925,"chunk":{"type":"finish","reason":{"kind":"tool-calls"}}}]},"surfaceOp":"append"} +{"type":"tool/call","data":{"turn":1,"step":1,"callId":"call_wecom_status","name":"bash","arguments":"{\"command\":\"\\\"{{cwd}}/wecom-bin/wecom-cli\\\" auth show --status\",\"description\":\"Check the WeCom authorization\"}"}} +{"type":"job/registered","data":{"jobId":"{{id:1}}","owner":"{{session:1}}","kind":"bash","label":"\"{{cwd}}/wecom-bin/wecom-cli\" auth show --status","startedAt":1791983232083,"toolCall":{"callId":"call_wecom_status","rootCallId":"call_wecom_status"}}} +{"type":"job/settled","data":{"jobId":"{{id:1}}","owner":"{{session:1}}","kind":"bash","label":"\"{{cwd}}/wecom-bin/wecom-cli\" auth show --status","startedAt":1791983232083,"toolCall":{"callId":"call_wecom_status","rootCallId":"call_wecom_status"},"finishedAt":1791983232560,"status":"completed","cause":"producer","producerReported":true,"detail":"exit code: 0"}} {"type":"tool/result","data":{"turn":1,"step":1,"message":{"role":"tool","source":{"kind":"tool","callId":"call_wecom_status"},"toolCallId":"call_wecom_status","content":[{"type":"text","text":"authorized\n"}],"isError":false,"id":"{{message:6}}"},"meta":{"cwd":"{{cwd}}"}},"sourceEventSeqs":[15],"surfaceOp":"append"} {"type":"step/end","data":{"turn":1,"step":1}} {"type":"step/start","data":{"turn":1,"step":2}} diff --git a/snapshots/session/wecom-skills/snapshot.yml b/snapshots/session/wecom-skills/snapshot.yml index 7f6dd6067e..33bcfabee6 100644 --- a/snapshots/session/wecom-skills/snapshot.yml +++ b/snapshots/session/wecom-skills/snapshot.yml @@ -3,6 +3,8 @@ scenario: wecom-skills profile: headless composition: wecom-skills recording: authored +replay: + override: true platform: posix header: class: skill diff --git a/snapshots/session/wecom-skills/system-prompt.expected.md b/snapshots/session/wecom-skills/system-prompt.expected.md index 18535007ec..4129b103da 100644 --- a/snapshots/session/wecom-skills/system-prompt.expected.md +++ b/snapshots/session/wecom-skills/system-prompt.expected.md @@ -27,8 +27,4 @@ create_goal may infer goal intent from a direct human request in any language. A Use the workflow tool ONLY when the user explicitly asks for a workflow or for large multi-agent orchestration: you write a JavaScript script (the tool description documents the exact format) that fans work out across many subagents with phases and structured results. For one or two delegations, prefer plain subagent calls. -Start independent delegations with `subagent` or `subagent_fork` together in one assistant message and continue useful work while they run. - -## Plugin CLIs - -In shell commands, these names run CLIs provided by enabled plugins, ahead of other installations on PATH: `wecom-cli` (wecom). To run another installation, find it with `type -a ` in Bash or `Get-Command -All ` in PowerShell, then call it by its absolute path. +Start independent delegations with `subagent` or `subagent_fork` together in one assistant message and continue useful work while they run. When only waiting for their results remains, end your turn instead of sleeping or polling; the next result starts a new turn.