refactor(wecom): fold the WeCom bundle into its plugin package

The bundle package inserted one row once #8080 composed the connector account surfaces in the Web app, so `@deepseek-ai/dsh-wecom-cli` becomes `@deepseek-ai/dsh-wecom` and inserts itself through its own `cordis.patch.yml`, as the MCP connectors and the self-inserting bundles on master do. The merged README, the connector group row, the package policies, the `skills` files exception, the Host solution, the generated catalogs, and the `wecom-skills` snapshot composition name the one package; the Web E2E installs the same directory.
This commit is contained in:
audit committed 2026-11-10 16:51:07 +08:00
1 parent 22718ecc58
commit ca8dbe2074
52 files changed
+394 -750

No files matched your search

+5 -6
View File
@@ -4927,20 +4927,20 @@ export interface Config {
```
<!-- END GENERATED config-catalog:@deepseek-ai/dsh-webhook-github -->
<!-- BEGIN GENERATED config-catalog:@deepseek-ai/dsh-wecom-cli -->
<a id="deepseek-aidsh-wecom-cli"></a>
<!-- BEGIN GENERATED config-catalog:@deepseek-ai/dsh-wecom -->
<a id="deepseek-aidsh-wecom"></a>
## `@deepseek-ai/dsh-wecom-cli`
## `@deepseek-ai/dsh-wecom`
- `inject`: `skills` · `subprocess` · `systemPrompt`
- `refs`: [`CliAccountConfig`](../packages/connector/cli-account/src/index.ts) · [`UpstreamSkillsConfig`](../packages/connector/upstream-skills/src/index.ts)
- `source`: [`packages/connector/wecom-cli/src/index.ts:32`](../packages/connector/wecom-cli/src/index.ts)
- `source`: [`packages/connector/wecom/src/index.ts:32`](../packages/connector/wecom/src/index.ts)
```ts config-catalog
/** Where wecom-cli and the upstream guides come from, a command's deadline, and a download's time limit. */
export type Config = CliAccountConfig & UpstreamSkillsConfig
```
<!-- END GENERATED config-catalog:@deepseek-ai/dsh-wecom-cli -->
<!-- END GENERATED config-catalog:@deepseek-ai/dsh-wecom -->
<!-- BEGIN GENERATED config-catalog:@deepseek-ai/dsh-workflow-ptc -->
<a id="deepseek-aidsh-workflow-ptc"></a>
@@ -5248,6 +5248,5 @@ Imported as libraries by other packages; a `cordis.yml` cannot load them.
| `@deepseek-ai/dsh-util-time` | — | [`packages/util/time/src/index.ts`](../packages/util/time/src/index.ts) |
| `@deepseek-ai/dsh-util-values` | — | [`packages/util/values/src/index.ts`](../packages/util/values/src/index.ts) |
| `@deepseek-ai/dsh-util-workspace-path` | — | [`packages/util/workspace-path/src/index.ts`](../packages/util/workspace-path/src/index.ts) |
| `@deepseek-ai/dsh-wecom` | — | [`packages/connector/wecom/src/index.ts`](../packages/connector/wecom/src/index.ts) |
| `@deepseek-ai/dsh-win32-process` | — | [`packages/subprocess/win32-process/src/index.ts`](../packages/subprocess/win32-process/src/index.ts) |
<!-- END GENERATED config-catalog:library -->
+5 -6
View File
@@ -4929,20 +4929,20 @@ export interface Config {
```
<!-- END GENERATED config-catalog:@deepseek-ai/dsh-webhook-github -->
<!-- BEGIN GENERATED config-catalog:@deepseek-ai/dsh-wecom-cli -->
<a id="deepseek-aidsh-wecom-cli"></a>
<!-- BEGIN GENERATED config-catalog:@deepseek-ai/dsh-wecom -->
<a id="deepseek-aidsh-wecom"></a>
## `@deepseek-ai/dsh-wecom-cli`
## `@deepseek-ai/dsh-wecom`
- `inject`: `skills` · `subprocess` · `systemPrompt`
- `refs`: [`CliAccountConfig`](../packages/connector/cli-account/src/index.ts) · [`UpstreamSkillsConfig`](../packages/connector/upstream-skills/src/index.ts)
- `source`: [`packages/connector/wecom-cli/src/index.ts:32`](../packages/connector/wecom-cli/src/index.ts)
- `source`: [`packages/connector/wecom/src/index.ts:32`](../packages/connector/wecom/src/index.ts)
```ts config-catalog
/** Where wecom-cli and the upstream guides come from, a command's deadline, and a download's time limit. */
export type Config = CliAccountConfig & UpstreamSkillsConfig
```
<!-- END GENERATED config-catalog:@deepseek-ai/dsh-wecom-cli -->
<!-- END GENERATED config-catalog:@deepseek-ai/dsh-wecom -->
<!-- BEGIN GENERATED config-catalog:@deepseek-ai/dsh-workflow-ptc -->
<a id="deepseek-aidsh-workflow-ptc"></a>
@@ -5250,6 +5250,5 @@ export interface Config {
| `@deepseek-ai/dsh-util-time` | — | [`packages/util/time/src/index.ts`](../packages/util/time/src/index.ts) |
| `@deepseek-ai/dsh-util-values` | — | [`packages/util/values/src/index.ts`](../packages/util/values/src/index.ts) |
| `@deepseek-ai/dsh-util-workspace-path` | — | [`packages/util/workspace-path/src/index.ts`](../packages/util/workspace-path/src/index.ts) |
| `@deepseek-ai/dsh-wecom` | — | [`packages/connector/wecom/src/index.ts`](../packages/connector/wecom/src/index.ts) |
| `@deepseek-ai/dsh-win32-process` | — | [`packages/subprocess/win32-process/src/index.ts`](../packages/subprocess/win32-process/src/index.ts) |
<!-- END GENERATED config-catalog:library -->
+4 -6
View File
@@ -236,7 +236,6 @@ flowchart TD
pkg_cli_account["cli-account"]
pkg_upstream_skills["upstream-skills"]
pkg_wecom["wecom"]
pkg_wecom_cli["wecom-cli"]
end
subgraph group_context["packages/context"]
pkg_agent_instructions["agent-instructions"]
@@ -575,9 +574,9 @@ flowchart TD
pkg_cli_account --> pkg_subprocess
pkg_cli_account --> pkg_system_prompt
pkg_upstream_skills --> pkg_skill
pkg_wecom_cli --> pkg_skill
pkg_wecom_cli --> pkg_subprocess
pkg_wecom_cli --> pkg_system_prompt
pkg_wecom --> pkg_skill
pkg_wecom --> pkg_subprocess
pkg_wecom --> pkg_system_prompt
pkg_deliverable_file_references --> pkg_system_prompt
pkg_experimental_speech_to_text --> pkg_settings
pkg_experimental_translator --> pkg_credentials
@@ -1654,7 +1653,6 @@ flowchart TD
| [`client-ui-workflow-run`](../packages/client/ui-workflow-run) | `client` | — |
| [`client-ui-workspace`](../packages/client/ui-workspace) | `client` | — |
| [`client-web`](../packages/client/web) | `client` | — |
| [`wecom`](../packages/connector/wecom) | `connector` | — |
| [`credentials`](../packages/credentials/credentials) | `credentials` | — |
| [`office-kit`](../packages/document/office-kit) | `document` | — |
| [`client-ui-action-cards`](../packages/experimental/client-ui-action-cards) | `experimental` | — |
@@ -1748,7 +1746,7 @@ flowchart TD
| [`config-editor`](../packages/boot/config-editor) | `boot` | [`app-boot`](../packages/boot/app-boot), [`hmr`](../packages/boot/hmr) |
| [`cli-account`](../packages/connector/cli-account) | `connector` | [`subprocess`](../packages/subprocess/subprocess), [`system-prompt`](../packages/core/system-prompt) |
| [`upstream-skills`](../packages/connector/upstream-skills) | `connector` | [`skill`](../packages/skill/skill) |
| [`wecom-cli`](../packages/connector/wecom-cli) | `connector` | [`skill`](../packages/skill/skill), [`subprocess`](../packages/subprocess/subprocess), [`system-prompt`](../packages/core/system-prompt) |
| [`wecom`](../packages/connector/wecom) | `connector` | [`skill`](../packages/skill/skill), [`subprocess`](../packages/subprocess/subprocess), [`system-prompt`](../packages/core/system-prompt) |
| [`deliverable-file-references`](../packages/deliverables/deliverable-file-references) | `deliverables` | [`system-prompt`](../packages/core/system-prompt) |
| [`experimental-speech-to-text`](../packages/experimental/speech-to-text) | `experimental` | [`settings`](../packages/settings/settings) |
| [`experimental-translator`](../packages/experimental/translator) | `experimental` | [`credentials`](../packages/credentials/credentials), [`launch-environment`](../packages/util/launch-environment), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`session-persistence`](../packages/session/session-persistence), [`timeout`](../packages/util/timeout), [`util-values`](../packages/util/values) |
+4 -6
View File
@@ -238,7 +238,6 @@ flowchart TD
pkg_cli_account["cli-account"]
pkg_upstream_skills["upstream-skills"]
pkg_wecom["wecom"]
pkg_wecom_cli["wecom-cli"]
end
subgraph group_context["packages/context"]
pkg_agent_instructions["agent-instructions"]
@@ -577,9 +576,9 @@ flowchart TD
pkg_cli_account --> pkg_subprocess
pkg_cli_account --> pkg_system_prompt
pkg_upstream_skills --> pkg_skill
pkg_wecom_cli --> pkg_skill
pkg_wecom_cli --> pkg_subprocess
pkg_wecom_cli --> pkg_system_prompt
pkg_wecom --> pkg_skill
pkg_wecom --> pkg_subprocess
pkg_wecom --> pkg_system_prompt
pkg_deliverable_file_references --> pkg_system_prompt
pkg_experimental_speech_to_text --> pkg_settings
pkg_experimental_translator --> pkg_credentials
@@ -1656,7 +1655,6 @@ flowchart TD
| [`client-ui-workflow-run`](../packages/client/ui-workflow-run) | `client` | — |
| [`client-ui-workspace`](../packages/client/ui-workspace) | `client` | — |
| [`client-web`](../packages/client/web) | `client` | — |
| [`wecom`](../packages/connector/wecom) | `connector` | — |
| [`credentials`](../packages/credentials/credentials) | `credentials` | — |
| [`office-kit`](../packages/document/office-kit) | `document` | — |
| [`client-ui-action-cards`](../packages/experimental/client-ui-action-cards) | `experimental` | — |
@@ -1750,7 +1748,7 @@ flowchart TD
| [`config-editor`](../packages/boot/config-editor) | `boot` | [`app-boot`](../packages/boot/app-boot), [`hmr`](../packages/boot/hmr) |
| [`cli-account`](../packages/connector/cli-account) | `connector` | [`subprocess`](../packages/subprocess/subprocess), [`system-prompt`](../packages/core/system-prompt) |
| [`upstream-skills`](../packages/connector/upstream-skills) | `connector` | [`skill`](../packages/skill/skill) |
| [`wecom-cli`](../packages/connector/wecom-cli) | `connector` | [`skill`](../packages/skill/skill), [`subprocess`](../packages/subprocess/subprocess), [`system-prompt`](../packages/core/system-prompt) |
| [`wecom`](../packages/connector/wecom) | `connector` | [`skill`](../packages/skill/skill), [`subprocess`](../packages/subprocess/subprocess), [`system-prompt`](../packages/core/system-prompt) |
| [`deliverable-file-references`](../packages/deliverables/deliverable-file-references) | `deliverables` | [`system-prompt`](../packages/core/system-prompt) |
| [`experimental-speech-to-text`](../packages/experimental/speech-to-text) | `experimental` | [`settings`](../packages/settings/settings) |
| [`experimental-translator`](../packages/experimental/translator) | `experimental` | [`credentials`](../packages/credentials/credentials), [`launch-environment`](../packages/util/launch-environment), [`llm`](../packages/llm/llm), [`session`](../packages/core/session), [`session-persistence`](../packages/session/session-persistence), [`timeout`](../packages/util/timeout), [`util-values`](../packages/util/values) |
-1
View File
@@ -246,7 +246,6 @@
"@deepseek-ai/dsh-subagent-dsh-sdk": "workspace:*",
"@deepseek-ai/dsh-llm": "workspace:*",
"@deepseek-ai/dsh-wecom": "workspace:*",
"@deepseek-ai/dsh-wecom-cli": "workspace:*",
"@deepseek-ai/dsh-mcp-client": "workspace:*",
"@deepseek-ai/dsh-tool-session-query": "workspace:*",
"@deepseek-ai/dsh-web-fetch-http": "workspace:*",
+2 -2
View File
@@ -15,8 +15,8 @@
en: 1eb35b015a6c423f
zh: a8a3dceee2c9e943
/connector-application-plugins/packages:
en: 9a65ef212b3e3735
zh: eca66740d95e7dd3
en: b27e62eb269ac64e
zh: 0d43d270c7b353ed
/connector-application-plugins/related-documentation:
en: 392c28cfa4bafb27
zh: c49329900f6f2fd0
+1 -2
View File
@@ -26,8 +26,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`, gives the model its absolute path, registers its skills, and runs the authorization operations the Plugins page drives | registers on `ctx.skills`, `ctx.systemPrompt`, and `ctx.cliAccounts` |
| [`wecom/`](wecom/README.md) | The WeCom plugin: installs the official `wecom-cli`, gives the model its absolute path, registers its skills, and runs the authorization operations the Plugins page drives | registers on `ctx.skills`, `ctx.systemPrompt`, and `ctx.connectorAccounts` |
-----
+1 -2
View File
@@ -26,8 +26,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`,把它的绝对路径告诉模型,注册其 skill,并执行插件页发起的授权操作 | 注册到 `ctx.skills`、`ctx.systemPrompt` 与 `ctx.cliAccounts` |
| [`wecom/`](wecom/README.zh.md) | 企业微信插件:安装官方 `wecom-cli`,把它的绝对路径告诉模型,注册其 skill,并执行插件页发起的授权操作 | 注册到 `ctx.skills`、`ctx.systemPrompt` 与 `ctx.connectorAccounts` |
-----
@@ -1,88 +0,0 @@
# Bilingual-pair consistency record for README.md (docs/i18n/README.md): per heading
# section, a hash of its English and Chinese blocks outside code blocks and generated regions.
# 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: db64758f91c93aff
zh: f71eb65e58a1f1ad
/deepseek-ai-dsh-wecom-cli:
en: 64ada5d1b3aac000
zh: b18083c73eabe29a
/deepseek-ai-dsh-wecom-cli/summary:
en: 448521b49adb6fa8
zh: 2c3ad41cffb02ac3
/deepseek-ai-dsh-wecom-cli/table-of-contents:
en: d152484eb41ac6b4
zh: 09388d293f9be9cb
/deepseek-ai-dsh-wecom-cli/use-this-package:
en: bbff250eba0f1b89
zh: 0a618f05cc88ee2b
/deepseek-ai-dsh-wecom-cli/use-this-package/add-it-to-a-profile:
en: 4034b64f387ae470
zh: 748eeb0414ceace4
/deepseek-ai-dsh-wecom-cli/use-this-package/what-you-get:
en: 6077d45144049e83
zh: 019d2529b8ea58eb
/deepseek-ai-dsh-wecom-cli/use-this-package/authorization-operations:
en: baa222a771de2352
zh: 8fd47fe7d9d6bd5a
/deepseek-ai-dsh-wecom-cli/use-this-package/configure:
en: 1cd879ed3382e9a3
zh: 7ffab4fbfe74ac73
/deepseek-ai-dsh-wecom-cli/understand-the-implementation:
en: c432c01045d5123e
zh: 94d4ec3bfffe9dda
/deepseek-ai-dsh-wecom-cli/further-exploration:
en: 9d21a22d081f8fb2
zh: 879207f0fadc45d0
/deepseek-ai-dsh-wecom-cli/model-experience:
en: 215e7ba838619b7b
zh: a311da3843709f90
/deepseek-ai-dsh-wecom-cli/model-experience/skill-catalog-entries:
en: 7265024b55daf9ef
zh: 3447e587c56a25d6
/deepseek-ai-dsh-wecom-cli/model-experience/skill-catalog-entries/what-the-model-sees:
en: 92eb47194f3c8cc3
zh: b9cfda74948e4b1a
/deepseek-ai-dsh-wecom-cli/model-experience/skill-catalog-entries/token-effect:
en: 5c0018a8ae3cd3d3
zh: 341e13c2f26125be
/deepseek-ai-dsh-wecom-cli/model-experience/skill-catalog-entries/kv-cache-effect:
en: ce9139edf3309f2b
zh: bca06594b3e557e5
/deepseek-ai-dsh-wecom-cli/model-experience/loaded-skill-body:
en: 8955ac196848e69f
zh: 54aa7db097eafd3c
/deepseek-ai-dsh-wecom-cli/model-experience/loaded-skill-body/what-the-model-sees:
en: aa56f9a16fab3328
zh: 478afb312b62a06f
/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/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/what-the-model-sees/runtime-context-entry-on-windows:
en: 54f899bbaf7ed198
zh: 31256473a192427b
/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: 0a20579ae2c3c6e8
zh: 462c6b147628f9f9
/deepseek-ai-dsh-wecom-cli/known-limitations-and-deferred-work/dev-note:
en: 71cc23fc507e649e
zh: 3dbd0498845467cc
-173
View File
@@ -1,173 +0,0 @@
---
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"
---
# @deepseek-ai/dsh-wecom-cli
English | [中文](README.zh.md)
## Summary
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, which it downloads from the WeCom CLI repository on GitHub. It registers the authorization with the [connector account registry](../../client/ui-connector-account/README.md), so the Plugins page shows it and can check it, bind a bot through the CLI's QR-code page, or cancel. The CLI keeps the bot credentials in its default configuration, which the user's own terminal shares. Only macOS is supported.
## Table of Contents
- [Use this package](#use-this-package)
- [Understand the implementation](#understand-the-implementation)
- [Further Exploration](#further-exploration)
- [Model Experience](#model-experience)
- [Known Limitations and Deferred Work](#known-limitations-and-deferred-work)
- [Dev Note](#dev-note)
-----
<a id="use-this-package"></a>
## Use this package
### Add it to a profile
Install the [WeCom plugin bundle](../wecom/README.md), which inserts this package as the `wecom` row. Until the executable exists, the plugin fails to load with an error that names the missing path or platform package.
### 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` 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.
The guides come from `skills/` of `WecomTeam/wecom-cli` at commit `4c74ff2`. The row downloads that commit's archive when it loads and keeps the verified files in `$DSH_HOME/cache/wecom/`; until they are in place, the catalog has no `wecom` skill and the plugin page reports the download. A failed download is retried by the page's check.
Turning the row off in Plugin Manager withdraws the skills and the path from runtime context. The CLI authorization and the downloaded guides stay in place.
<a id="account-operations"></a>
### Authorization operations
The Plugins page drives these operations through the connector account registry, which the Web app loads; a headless profile loads the plugin without it. The Host runs at most one operation at a time and owns it, so leaving the page does not cancel it.
| Operation | Effect |
|---|---|
| `check` | Checks the authorization again; each browser that opens the Web app starts one when no operation runs |
| `connect` | Runs `auth init --noninteractive --no-browser`, waits for the user to scan the QR code, then checks that the CLI reports the bot authorized |
| Cancel | Cancels the connection while it waits for the scan and waits for its command to exit; other steps are ignored |
A check runs `auth show --status`. The authorization reads `authorized` or `unauthorized` exactly as the CLI prints it; any other output or a nonzero exit fails the check and keeps the previous state. Each link that `auth init` prints alone on a stdout line is offered only when it is an HTTPS address on `work.weixin.qq.com`. Results report succeeded, cancelled, or failed. Failures show the command and the observed exit code on the page and in the Host log; the CLI's output, which can carry the QR-code session, is omitted. `wecom-cli` has no command that revokes the authorization, so the plugin offers no disconnect. The process running DSH needs access to the CLI configuration; `DSH_HOME` does not relocate it.
### Configure
| Field | Default | Meaning |
|---|---|---|
| `binDir` | the installed `@wecom/cli-<platform>-<arch>` package's `bin` | Absolute directory containing an executable `wecom-cli`, `wecom-cli.exe` on Windows |
| `commandTimeoutMs` | `30000` | Deadline for one authorization check, including executable lookup |
| `skillsDir` | none | Directory holding the files of `skills/` at their repository paths; when set, the guides are not downloaded |
| `skillsUrls` | `['https://codeload.github.com']` | Archive download prefixes tried in order |
| `skillsTimeoutMs` | `120000` | How long one prefix may take to deliver the whole archive |
QR-code authorization waits up to 10 minutes for the user, and each command keeps at most 1 MiB of stdout; the [CLI account library](../cli-account/README.md) fixes both limits.
The generated [config catalog](../../../docs/config-catalog.md#deepseek-aidsh-wecom-cli) is the exhaustive source of supported fields.
-----
<a id="understand-the-implementation"></a>
## Understand the implementation
<details>
<summary>Implementation internals — click to expand</summary>
[`src/index.ts`](src/index.ts) is a function plugin. It checks that `binDir/wecom-cli` (`wecom-cli.exe` on Windows) is executable, gives that path to the model in runtime context, and registers the `wecom` skill through the [upstream skills library](../upstream-skills/README.md) with the pin in [`src/skills.ts`](src/skills.ts). The account view carries the download state, and each check restarts a failed download without waiting for it. [`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`. [`src/presentation.ts`](src/presentation.ts) maps each view to the section the registry serves, in the text of [`src/locales.ts`](src/locales.ts). 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 this package carries: the DSH guidance, an index of the guides, and how to open them. Upstream publishes the guides only in its repository and not in the npm package, so the library downloads them; they are files under the skill's base directory, 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.
</details>
-----
<a id="further-exploration"></a>
## Further Exploration
- [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.
- [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.
- [Connector account surfaces](../../client/ui-connector-account/README.md) — the registry and the Plugins page section that drive the authorization operations.
-----
<a id="model-experience"></a>
## Model Experience
### Skill catalog entries
#### What the model sees
The skill catalog lists one `wecom` skill. Its Chinese description names the WeCom features it covers and tells the agent to load it, then read the matching guide, whenever the user mentions WeCom or those features or gives a `doc.weixin.qq.com` or `drive.weixin.qq.com` link.
#### Token effect
The entry stays in context while the plugin is loaded. Its name and description total about 160 characters.
#### KV Cache effect
The catalog is fixed for one plugin version. Loading or unloading the plugin changes the catalog, which is republished as a new message and leaves earlier context in place.
### Loaded skill body
#### 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 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 the downloaded directory, `skillsDir` or `$DSH_HOME/cache/wecom/skills-<digest>`, so the agent opens `skills/<name>/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
Each load adds the entry body to the retained tool history. Guides and their reference files arrive as ordinary file-read output.
#### KV Cache effect
Loading appends a tool result and does not rewrite earlier context.
### CLI path
#### What the model sees
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 "<binDir>/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="<binDir>:$PATH", and never export PATH or run `wecom-cli` by name yourself.
```
##### Runtime-context entry on Windows
```markdown
WeCom CLI: run `wecom-cli` by its absolute path with the call operator, & '<binDir>\wecom-cli.exe'; the bare name may resolve to another installation or to none.
Scripts in the WeCom skill call `wecom-cli` by name; start only the commands that run them with $env:PATH = '<binDir>;' + $env:PATH, and never run `wecom-cli` by name yourself.
```
#### Token effect
Two lines of about 280 characters plus the path and its directory in each runtime-context snapshot.
#### KV Cache effect
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
<a id="known-limitations-and-deferred-work"></a>
- Only macOS and Windows x64 are supported; other platforms are unverified. `@wecom/cli` publishes no Windows arm64 package.
- 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 means a new pin from `scripts/upstream-skills-digest.ts`, after which the entry's index and DSH guidance must be checked against the new guides.
- The first load after a new pin needs access to GitHub or a configured mirror; until a download succeeds, the agent has no `wecom` skill.
- The downloaded guides stay in `$DSH_HOME/cache/wecom/` after the plugin is removed or pins another commit.
<a id="dev-note"></a>
### Dev Note
<details>
<summary>Working context for maintainers — click to expand</summary>
The guides keep upstream whitespace, including trailing spaces that mark Markdown line breaks, and no whitespace exemption covers them: a commit that adds upstream lines with trailing whitespace fails the pre-commit `git diff --cached --check`. Specs and the `wecom-skills` session snapshot use stand-in executables through `binDir`.
</details>
-173
View File
@@ -1,173 +0,0 @@
---
description: "把官方 wecom-cli 的绝对路径告诉模型,加载其技能,并执行插件页发起的授权操作。"
kind: "package-reference"
---
# @deepseek-ai/dsh-wecom-cli
[English](README.md) | 中文
## 概述
本包是[企业微信插件](../wecom/README.zh.md)的 Host 行。它安装固定版本的 `@wecom/cli`,在运行时上下文中把其 `wecom-cli` 可执行文件的绝对路径告诉模型,并注册一个 `wecom` skill,其子指南是官方企业微信技能,从 GitHub 上的企业微信 CLI 仓库下载。它把授权注册到 [连接器账号注册表](../../client/ui-connector-account/README.zh.md),插件页因此能显示授权,并检查授权、通过 CLI 的扫码页面绑定机器人,或取消操作。CLI 把机器人凭据保存在默认配置中,与用户自己的终端共用。仅支持 macOS。
## 目录
- [使用本包](#use-this-package)
- [理解实现](#understand-the-implementation)
- [进一步探索](#further-exploration)
- [模型体验](#model-experience)
- [已知限制与延期工作](#known-limitations-and-deferred-work)
- [开发备注](#dev-note)
-----
<a id="use-this-package"></a>
## 使用本包
### 加入 profile
安装[企业微信插件 bundle](../wecom/README.zh.md),它会把本包作为 `wecom` 行插入。在可执行文件就绪之前,插件加载会失败,错误信息会给出缺失的路径或平台包。
### 获得的能力
插件加载后,一个 `wecom` skill 进入 skill 目录。agent 用 `skill` 工具加载它,用文件工具打开所需的子指南(例如 `wecomcli-doc` 或 `wecomcli-message`),并在当前沙箱与审批策略下通过普通 Shell 工具按这个路径运行 `wecom-cli`。`wecom-cli auth show --status` 报告未授权时,agent 会请用户到插件页连接企业微信;只有用户要求在对话中完成时,才运行 CLI 自带的 `auth init`,并因为它会在工作区之外写入而申请单条命令审批。
子指南来自 `WecomTeam/wecom-cli` 在提交 `4c74ff2` 时的 `skills/`。该行加载时下载这个提交的归档,并把校验后的文件保存在 `$DSH_HOME/cache/wecom/`;文件就位之前,skill 目录中没有 `wecom` skill,插件页会报告下载状态。下载失败时,由插件页的检查重试。
在 Plugin Manager 中关闭该行会撤下 skill,并从运行时上下文中移除这个路径,CLI 的授权和已下载的子指南保持不变。
<a id="account-operations"></a>
### 授权操作
插件页通过 连接器账号注册表发起这些操作,注册表由 Web 应用加载;headless profile 加载插件时没有它。Host 同一时间最多运行一个操作并持有它,因此离开页面不会取消操作。
| 操作 | 作用 |
|---|---|
| `check` | 重新检查授权;没有操作运行时,每个打开 Web 应用的浏览器会触发一次 |
| `connect` | 运行 `auth init --noninteractive --no-browser`,等待用户扫码,然后确认 CLI 报告机器人已授权 |
| 取消 | 在等待扫码期间取消连接并等待其命令退出;其他步骤会被忽略 |
检查运行 `auth show --status`。授权状态按 CLI 的输出原样读作 `authorized` 或 `unauthorized`;其他输出或非零退出码会使检查失败,并保留之前的状态。`auth init` 在 stdout 中单独一行打印的链接,只有是 `work.weixin.qq.com` 上的 HTTPS 地址时才会提供。结果分为成功、已取消和失败。失败时,页面和 Host 日志显示命令和观察到的退出码;CLI 的输出可能带有扫码会话,因此不保留。`wecom-cli` 没有撤销授权的命令,因此插件不提供断开连接。运行 DSH 的进程需要能访问 CLI 配置;`DSH_HOME` 不会迁移它。
### 配置
| 字段 | 默认值 | 含义 |
|---|---|---|
| `binDir` | 已安装 `@wecom/cli-<platform>-<arch>` 包的 `bin` | 包含可执行 `wecom-cli`(Windows 上为 `wecom-cli.exe`)的绝对目录 |
| `commandTimeoutMs` | `30000` | 单次授权检查的期限,包含可执行文件查找 |
| `skillsDir` | 无 | 按仓库路径存放 `skills/` 文件的目录;设置后不下载子指南 |
| `skillsUrls` | `['https://codeload.github.com']` | 按顺序尝试的归档下载前缀 |
| `skillsTimeoutMs` | `120000` | 一个前缀送达完整归档的时限 |
扫码授权最多等待用户 10 分钟,每条命令最多保留 1 MiB 的 stdout;这两个上限由 [CLI 账号库](../cli-account/README.zh.md)固定。
生成的[配置目录](../../../docs/config-catalog.zh.md#deepseek-aidsh-wecom-cli)是受支持字段的完整来源。
-----
<a id="understand-the-implementation"></a>
## 理解实现
<details>
<summary>实现内部机制——点击展开</summary>
[`src/index.ts`](src/index.ts) 是一个函数插件。它检查 `binDir/wecom-cli`(Windows 上为 `wecom-cli.exe`)是否可执行,在运行时上下文中把这个路径告诉模型,并通过[上游技能库](../upstream-skills/README.zh.md)按 [`src/skills.ts`](src/skills.ts) 中的固定信息注册 `wecom` skill。账号视图携带下载状态,每次检查都会在不等待的情况下重新开始失败的下载。[`src/directory.ts`](src/directory.ts) 定位 `@wecom/cli` 作为可选依赖安装的平台包。[CLI 账号库](../cli-account/README.zh.md)注册这条运行时上下文,按同一路径运行每条命令,并一次执行一个操作。[`src/account.ts`](src/account.ts) 在该运行时上实现企业微信的命令,并从 `auth init` 的输出行中读取扫码链接。[`src/presentation.ts`](src/presentation.ts) 用 [`src/locales.ts`](src/locales.ts) 中的文案,把每个视图映射为注册表提供的区块。释放时取消进行中的操作,中止正在运行的命令,并在这些进程退出后完成。
[`skills/wecom/SKILL.md`](skills/wecom/SKILL.md) 是本包携带的唯一 skill:DSH 指引、子指南索引和打开方式。上游只在其仓库发布这些子指南,没有放进 npm 包,因此由该库下载;它们是 skill 基础目录下的文件,不是独立的 skill。DSH 指引与 `wecomcli-shared` 不一致时,总入口要求 agent 以 DSH 指引为准:使用插件提供的 `wecom-cli`,不再自行安装,并把授权引导到插件页。引用文件是每个子指南目录中的普通文件。
</details>
-----
<a id="further-exploration"></a>
## 进一步探索
- [Connector 包](../README.zh.md)——这个应用插件所属的分组。
- [CLI 账号库](../cli-account/README.zh.md)——CLI 应用插件共用的命令执行与账号操作。
- [Skill](../../../docs/subsystems/skills.zh.md)——目录发布、加载与优先级。
- [企业微信插件](../wecom/README.zh.md)——插入本行与页面行的 bundle。
- [连接器账号界面](../../client/ui-connector-account/README.zh.md)——发起授权操作的注册表和插件页区块。
-----
<a id="model-experience"></a>
## 模型体验
### Skill 目录条目
#### 模型看到什么
skill 目录只列出一个 `wecom` skill。其中文描述列出它覆盖的企业微信功能,并要求 agent 在用户提到企业微信或这些功能、或给出 `doc.weixin.qq.com`、`drive.weixin.qq.com` 链接时加载它,再读取对应的子指南。
#### Token 影响
插件加载期间这一条目一直留在上下文中。其名称与描述合计约 160 个字符。
#### KV Cache 影响
同一插件版本的目录固定不变。加载或卸载插件会改变目录,目录作为新消息重新发布,不改动更早的上下文。
### 已加载的 skill 正文
#### 模型看到什么
`wecom` 的 `skill` 工具结果约 2,000 个字符:DSH 指引、为 15 个子指南各写一句话并保留上游分流规则的索引,以及打开子指南的方式。DSH 指引要求 agent 按当前运行时上下文给出的绝对路径运行插件提供的 `wecom-cli`,先请用户到插件页连接,再考虑自行运行 `auth init --noninteractive`,并以单条命令审批运行该命令;与 `wecomcli-shared` 不一致时以它为准。其资源根目录是下载目录,即 `skillsDir` 或 `$DSH_HOME/cache/wecom/skills-<摘要>`,因此 agent 用文件工具而不是 `skill` 工具打开 `skills/<name>/SKILL.md`,把子指南按名字提到的技能当作对应子指南,并按子指南自己的目录解析其中的相对路径。
#### Token 影响
每次加载把总入口正文加入保留的工具历史。子指南及其引用文件作为普通的文件读取输出返回。
#### KV Cache 影响
加载会追加一条工具结果,不改写更早的上下文。
### CLI 路径
#### 模型看到什么
该行加载期间,[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 "<binDir>/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="<binDir>:$PATH", and never export PATH or run `wecom-cli` by name yourself.
```
##### Windows 上的运行时上下文条目
```markdown
WeCom CLI: run `wecom-cli` by its absolute path with the call operator, & '<binDir>\wecom-cli.exe'; the bare name may resolve to another installation or to none.
Scripts in the WeCom skill call `wecom-cli` by name; start only the commands that run them with $env:PATH = '<binDir>;' + $env:PATH, and never run `wecom-cli` by name yourself.
```
#### Token 影响
每份运行时上下文快照中两行,约 280 个字符加上路径及其目录。
#### KV Cache 影响
系统提示词不变;加载或卸载该行、或路径变化时,追加一份运行时上下文快照。
## 已知限制与延期工作
<a id="known-limitations-and-deferred-work"></a>
- 仅支持 macOS 和 Windows x64;其他平台未经验证。`@wecom/cli` 没有发布 Windows arm64 平台包。
- 命令必须在本 Host 上运行。组合把命令放到别处运行(例如通过 SSH)时,插件仍会加载,但每条运行 `wecom-cli` 的命令都会因为那里没有这个路径而失败。
- 插件使用 CLI 的默认配置。在 DSH 中授权会影响用户自己的终端,没有 DSH 私有机器人或机器人选择器。`wecom-cli` 无法撤销授权,因此页面和关闭插件都不会移除它。
- 连接从 `auth init --noninteractive --no-browser` 的纯文本输出中读取扫码链接;CLI 版本改变该输出时,连接以可重试的结果失败。
- 子指南跟随上游提交 `4c74ff2`;更新时要用 `scripts/upstream-skills-digest.ts` 生成新的固定信息,之后按新的子指南核对总入口的索引和 DSH 指引。
- 换用新的固定提交后,首次加载需要能访问 GitHub 或配置的镜像;下载成功之前,agent 没有 `wecom` skill。
- 插件卸载或改为固定其他提交后,已下载的子指南仍留在 `$DSH_HOME/cache/wecom/`。
<a id="dev-note"></a>
### 开发备注
<details>
<summary>维护者工作上下文——点击展开</summary>
子指南保留上游的空白,包括表示 Markdown 换行的行尾空格,且没有任何空白豁免:新增带行尾空白的上游行的提交,会被 pre-commit 的 `git diff --cached --check` 拒绝。单测与 `wecom-skills` 会话快照通过 `binDir` 使用替身可执行文件。
</details>
-1
View File
@@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 36 36"><g transform="translate(5.5 7.516129) scale(0.806451613)"><g fill="none" fill-rule="evenodd"><path fill="#0082F0" d="M24.27 6.9a10.746 10.746 0 00-1.945-2.764C20.295 2.034 17.453.68 14.322.323a14.773 14.773 0 00-1.656-.096c-.511 0-1.044.03-1.585.089-3.144.342-6.002 1.69-8.047 3.792a10.757 10.757 0 00-1.955 2.757 9.634 9.634 0 00-1.003 4.277c0 1.909.58 3.79 1.678 5.442a14.96 14.96 0 002.302 2.634v.002l-.378 2.974c-.015.04-.031.08-.04.123-.01.039-.012.079-.016.119-.002.03-.01.06-.01.091 0 .033.008.065.01.098.05.489.458.872.96.872.175 0 .337-.05.478-.131l.014-.008c.02-.012.042-.023.062-.036l.903-.454 2.69-1.352a13.93 13.93 0 002.35.453 14.54 14.54 0 003.243-.009 14.092 14.092 0 003.173-.742 1.752 1.752 0 01-1.192-1.832c-.72.23-1.472.393-2.25.482a12.172 12.172 0 01-2.716.008c-.09-.01-.182-.025-.274-.037a11.976 11.976 0 01-1.78-.373 1.217 1.217 0 00-.37-.057c-.2 0-.392.053-.588.154-.026.014-.05.025-.076.04l-2.21 1.303-.096.057-.003.001c-.047.028-.075.039-.1.039a.15.15 0 01-.146-.153l.085-.345.098-.375.162-.614.179-.686a.93.93 0 00-.334-1.033 9.906 9.906 0 01-.923-.777c-.5-.475-.94-.994-1.31-1.55-.869-1.308-1.328-2.792-1.328-4.293 0-1.164.266-2.297.79-3.366a8.633 8.633 0 011.569-2.21c1.68-1.728 4.045-2.837 6.656-3.12.454-.05.901-.075 1.328-.075.449 0 .916.027 1.388.08 2.599.296 4.949 1.41 6.617 3.138a8.618 8.618 0 011.56 2.215 7.584 7.584 0 01.778 3.338c0 .12-.007.24-.013.36a1.746 1.746 0 012.149.251c.03.03.054.062.08.093a9.11 9.11 0 00.031-.739 9.634 9.634 0 00-.986-4.243" /><path fill="#FB6500" d="M24.149 22.148a1.7 1.7 0 00-.21-.035 5.377 5.377 0 01-2.996-1.67v.001a.418.418 0 10-.534.64c.041.04.082.078.121.118a5.39 5.39 0 011.478 2.761 1.715 1.715 0 00.059.356 1.749 1.749 0 002.926.777 1.754 1.754 0 00-.844-2.948" /><path fill="#0082F0" d="M29.944 17.673a1.75 1.75 0 00-2.98 1.056 5.388 5.388 0 01-1.667 2.999.419.419 0 10.641.534l.117-.121a5.376 5.376 0 012.758-1.48 1.71 1.71 0 00.355-.058 1.754 1.754 0 00.776-2.93" /><path fill="#2DBC00" d="M22.53 12.717a1.754 1.754 0 001.054 2.982 5.376 5.376 0 012.996 1.67.419.419 0 10.534-.641 5.389 5.389 0 01-1.6-2.879 1.625 1.625 0 00-.058-.355 1.75 1.75 0 00-2.926-.777" /><path fill="#FC0" d="M20.543 19.19a1.93 1.93 0 00.015-.106 5.393 5.393 0 011.668-3 .42.42 0 10-.64-.534 5.375 5.375 0 01-2.876 1.6 1.73 1.73 0 00-.355.06 1.754 1.754 0 00-.776 2.93 1.75 1.75 0 002.964-.95" /></g></g></svg>

Before

Width:  |  Height:  |  Size: 2.4 KiB

@@ -1,6 +0,0 @@
{
"meta": {
"title": "WeCom-CLI und Fertigkeiten",
"description": "Die offizielle wecom-cli, ihre Fertigkeiten und die Autorisierung, die die Seite „Plugins“ verwendet."
}
}
@@ -1,6 +0,0 @@
{
"meta": {
"title": "WeCom CLI and skills",
"description": "The official wecom-cli, its skills, and the authorization the Plugins page uses."
}
}
@@ -1,6 +0,0 @@
{
"meta": {
"title": "CLI y habilidades de WeCom",
"description": "El wecom-cli oficial, sus habilidades y la autorización que usa la página Complementos."
}
}
@@ -1,6 +0,0 @@
{
"meta": {
"title": "CLI et compétences WeCom",
"description": "Le wecom-cli officiel, ses compétences et l’autorisation qu’utilise la page Plugins."
}
}
@@ -1,6 +0,0 @@
{
"meta": {
"title": "WeCom CLI とスキル",
"description": "公式の wecom-cli、そのスキル、および「プラグイン」ページが使用する認可。"
}
}
@@ -1,6 +0,0 @@
{
"meta": {
"title": "CLI e habilidades do WeCom",
"description": "O wecom-cli oficial, suas habilidades e a autorização que a página Plug-ins usa."
}
}
@@ -1,6 +0,0 @@
{
"meta": {
"title": "CLI и навыки WeCom",
"description": "Официальный wecom-cli, его навыки и авторизация, которую использует страница «Плагины»."
}
}
@@ -1,6 +0,0 @@
{
"meta": {
"title": "企业微信 CLI 与技能",
"description": "官方 wecom-cli、它的技能,以及插件页使用的授权。"
}
}
-57
View File
@@ -1,57 +0,0 @@
{
"name": "@deepseek-ai/dsh-wecom-cli",
"description": "WeCom through the official wecom-cli: the CLI by its absolute path, its skills, and authorization over Remote",
"version": "0.2.2-rc.1",
"icon": "./icon.svg",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/deepseek-ai/deepseek-harness.git",
"directory": "packages/connector/wecom-cli"
},
"type": "module",
"main": "lib/index.js",
"types": "lib/types/index.d.ts",
"exports": {
".": {
"types": "./lib/types/index.d.ts",
"default": "./lib/index.js"
},
"./locale/*.json": "./locale/*.json",
"./src/*": "./src/*",
"./package.json": "./package.json"
},
"files": [
"icon.svg",
"locale/*.json",
"lib/index.js",
"skills",
"lib/types/**/*.d.ts",
"lib/types/**/*.d.ts.map",
"lib/**/*.js.map",
"src"
],
"license": "MIT",
"dependencies": {
"@deepseek-ai/dsh-cli-account": "workspace:*",
"@deepseek-ai/dsh-upstream-skills": "workspace:*",
"@deepseek-ai/dsh-util-values": "workspace:*",
"@deepseek-ai/schemastery": "workspace:~",
"@wecom/cli": "1.3.4"
},
"peerDependencies": {
"@deepseek-ai/cordis": "workspace:~",
"@deepseek-ai/dsh-skill": "workspace:*",
"@deepseek-ai/dsh-subprocess": "workspace:*",
"@deepseek-ai/dsh-system-prompt": "workspace:*"
},
"devDependencies": {
"@deepseek-ai/cordis": "workspace:~",
"@deepseek-ai/dsh-client-ui-connector-account": "workspace:*",
"@deepseek-ai/dsh-skill": "workspace:*",
"@deepseek-ai/dsh-subprocess": "workspace:*",
"@deepseek-ai/dsh-system-prompt": "workspace:*"
}
}
-57
View File
@@ -1,57 +0,0 @@
/**
* WeCom plugin: tells the model the managed wecom-cli's absolute path, registers
* the `wecom` skill over the upstream guides it downloads, and shows the
* authorization on the Plugins page through the connector account registry. The CLI's
* authorization is shared with the user's own terminal.
* @module @deepseek-ai/dsh-wecom-cli
*/
import type { Context } from '@deepseek-ai/cordis'
import z from '@deepseek-ai/schemastery'
import { CliAccountConfig, CliCommandExecutor, registerCliPathContext } from '@deepseek-ai/dsh-cli-account'
import { registerUpstreamSkills, UpstreamSkillsConfig } from '@deepseek-ai/dsh-upstream-skills'
import type {} from '@deepseek-ai/dsh-client-ui-connector-account'
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, resolveCliExecutable } from './directory.ts'
import { COPY, OPERATIONS, presentAccount, WECOM_PACKAGE } from './presentation.ts'
import { ENTRY, WECOM_SKILLS } from './skills.ts'
export type * from './types.ts'
/** Plugin name. */
export const name = 'wecom'
/* jscpd:ignore-start -- CLI app plugins with downloaded guides declare the same services, config, and registration. */
/** Services the CLI, its skills, and its runtime context need. */
export const inject = ['skills', 'subprocess', 'systemPrompt']
/** Where wecom-cli and the upstream guides come from, a command's deadline, and a download's time limit. */
export type Config = CliAccountConfig & UpstreamSkillsConfig
/** Validates {@link Config}. */
export const Config: z<Config> = z.intersect([CliAccountConfig, UpstreamSkillsConfig])
/**
* Register the CLI and its skills, and show the authorization on the Plugins page while the connector account registry runs.
* @param ctx - Context carrying the skill registry, subprocess runtime, and system prompt.
* @param config - CLI location, command deadline, and where the upstream guides come from.
* @throws when `wecom-cli` is not executable or `skillsDir` is not a directory.
*/
export function apply(ctx: Context, config: Config): void {
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 })
const skills = registerUpstreamSkills(ctx, { name: 'wecom', entry: ENTRY, set: WECOM_SKILLS, config })
const account = new WecomAccount(cli, ctx.logger, skills)
ctx.effect(() => () => account.dispose(), 'wecom: account')
ctx.effect(() => skills.watch((state) => { account.showSkills(state) }), 'wecom: guides')
ctx.inject(['connectorAccounts'], (scope) => {
scope.effect(() => scope.connectorAccounts.register({
key: WECOM_PACKAGE, packageName: WECOM_PACKAGE, source: account, operations: OPERATIONS, copy: COPY, present: presentAccount,
}), 'wecom: Plugins page authorization')
})
}
/* jscpd:ignore-end */
@@ -1,39 +0,0 @@
{
"extends": "../../../tsconfig.base.json",
"compilerOptions": {
"rootDir": "src",
"outDir": "lib/types"
},
"include": [
"src"
],
"references": [
{
"path": "../../../vendor/cordis"
},
{
"path": "../../../vendor/schemastery"
},
{
"path": "../upstream-skills"
},
{
"path": "../../util/values"
},
{
"path": "../../skill/skill"
},
{
"path": "../../subprocess/subprocess"
},
{
"path": "../cli-account"
},
{
"path": "../../core/system-prompt"
},
{
"path": "../../client/ui-connector-account/tsconfig.host.json"
}
]
}
+64 -19
View File
@@ -9,8 +9,8 @@
en: 97ebb140059d2cd9
zh: b9753254b9a084f3
/deepseek-ai-dsh-wecom/summary:
en: e9dcad15ae59228c
zh: d8a455329476292f
en: 06358926dfdfecee
zh: 5ae37704e7983a03
/deepseek-ai-dsh-wecom/table-of-contents:
en: d152484eb41ac6b4
zh: 09388d293f9be9cb
@@ -18,26 +18,71 @@
en: bbff250eba0f1b89
zh: 0a618f05cc88ee2b
/deepseek-ai-dsh-wecom/use-this-package/install-into-a-profile:
en: 8241a30e5141c500
zh: 97f8736d76cf596a
en: 6227d6e43ec8c108
zh: 48e0f252de253d14
/deepseek-ai-dsh-wecom/use-this-package/what-you-get:
en: 528ed99baf41922a
zh: da4c72ebf58e2883
en: f8935d344d90672a
zh: 50cf55ec6b629ffe
/deepseek-ai-dsh-wecom/use-this-package/authorization-operations:
en: baa222a771de2352
zh: 8fd47fe7d9d6bd5a
/deepseek-ai-dsh-wecom/use-this-package/configure:
en: 21030038b561f1d1
zh: 74f0089d6796d701
/deepseek-ai-dsh-wecom/understand-the-implementation:
en: edfc5fbed5409988
zh: 1d1e6c3d6b60fdc3
en: f2f15a101939fd87
zh: c388b04b6182d664
/deepseek-ai-dsh-wecom/further-exploration:
en: 382e5bb97ff1e505
zh: f9b8a200eb829ef3
en: e739bdb935d81836
zh: d5f57307be1a78b0
/deepseek-ai-dsh-wecom/model-experience:
en: 819fb75533454fd7
zh: 134befa5ade17a41
/deepseek-ai-dsh-wecom/model-experience/kv-cache-effect:
en: ad2bc53ebf95b23c
zh: c7d9f05d11592153
en: 215e7ba838619b7b
zh: a311da3843709f90
/deepseek-ai-dsh-wecom/model-experience/skill-catalog-entries:
en: 7265024b55daf9ef
zh: 3447e587c56a25d6
/deepseek-ai-dsh-wecom/model-experience/skill-catalog-entries/what-the-model-sees:
en: 92eb47194f3c8cc3
zh: b9cfda74948e4b1a
/deepseek-ai-dsh-wecom/model-experience/skill-catalog-entries/token-effect:
en: 5c0018a8ae3cd3d3
zh: 341e13c2f26125be
/deepseek-ai-dsh-wecom/model-experience/skill-catalog-entries/kv-cache-effect:
en: ce9139edf3309f2b
zh: bca06594b3e557e5
/deepseek-ai-dsh-wecom/model-experience/loaded-skill-body:
en: 8955ac196848e69f
zh: 54aa7db097eafd3c
/deepseek-ai-dsh-wecom/model-experience/loaded-skill-body/what-the-model-sees:
en: aa56f9a16fab3328
zh: 478afb312b62a06f
/deepseek-ai-dsh-wecom/model-experience/loaded-skill-body/token-effect:
en: 1ed287a86abbc585
zh: 5d55a6fd61786866
/deepseek-ai-dsh-wecom/model-experience/loaded-skill-body/kv-cache-effect:
en: 1f6b842a95e14ce4
zh: 0d57cdec5e828828
/deepseek-ai-dsh-wecom/model-experience/cli-path:
en: b5fed52af6c0d771
zh: 25b7aa5297583030
/deepseek-ai-dsh-wecom/model-experience/cli-path/what-the-model-sees:
en: dd87bf74d7e47802
zh: 287c05d2a56a0c95
/deepseek-ai-dsh-wecom/model-experience/cli-path/what-the-model-sees/runtime-context-entry:
en: c91314832f78f460
zh: aac156ea0b5b816a
/deepseek-ai-dsh-wecom/model-experience/cli-path/what-the-model-sees/runtime-context-entry-on-windows:
en: 54f899bbaf7ed198
zh: 31256473a192427b
/deepseek-ai-dsh-wecom/model-experience/cli-path/token-effect:
en: 2caf581d193f3dba
zh: 3b5e94d4cc69ca3b
/deepseek-ai-dsh-wecom/model-experience/cli-path/kv-cache-effect:
en: 67398dd4e4b02db9
zh: a873eacd006fa656
/deepseek-ai-dsh-wecom/known-limitations-and-deferred-work:
en: b1feae479657ced7
zh: d7cf575bb2745489
en: 0a20579ae2c3c6e8
zh: 462c6b147628f9f9
/deepseek-ai-dsh-wecom/known-limitations-and-deferred-work/dev-note:
en: e67f633dc6fe7773
zh: e88aeb617ffb74ea
en: 71cc23fc507e649e
zh: 3dbd0498845467cc
+100 -15
View File
@@ -9,7 +9,7 @@ English | [中文](README.zh.md)
## Summary
The WeCom plugin lets conversations use WeCom through the official `wecom-cli`. Installing this bundle adds one row: the CLI with its skills, which also shows the WeCom authorization section on the Plugins page, where the user binds a bot by scanning a QR code without starting a conversation. The CLI keeps the authorization in its default configuration, which the user's own terminal shares. Only macOS and Windows x64 are supported.
The WeCom plugin lets conversations use WeCom through the official `wecom-cli`. 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, downloaded from the CLI's GitHub repository. It registers the authorization with the [connector account registry](../../client/ui-connector-account/README.md), so the Plugins page shows it and can check it, bind a bot through the CLI's QR-code page, or cancel. The CLI keeps the bot credentials in its default configuration, which the user's own terminal shares. Only macOS and Windows x64 are supported.
## Table of Contents
@@ -27,22 +27,49 @@ The WeCom plugin lets conversations use WeCom through the official `wecom-cli`.
### Install into a profile
Install the bundle from the Web sidebar's **Plugins** page or with the CLI:
Install the plugin from the Web sidebar's **Plugins** page or with the CLI:
```sh
dsh plugin --profile web add @deepseek-ai/dsh-wecom
dsh plugin --profile web remove @deepseek-ai/dsh-wecom
```
`@wecom/cli` ships its native binary in a platform package such as `@wecom/cli-darwin-arm64`, which installs without a build script. When no platform package matches the computer, the `wecom` row fails to load with an error that names the missing package.
`@wecom/cli` ships its native binary in a platform package such as `@wecom/cli-darwin-arm64`, which installs without a build script. When no platform package matches the computer, or the executable is missing, the `wecom` row fails to load with an error that names the missing package or path.
### What you get
| Row | Package | Behavior |
|---|---|---|
| `wecom` | [`@deepseek-ai/dsh-wecom-cli`](../wecom-cli/README.md) | Gives the model the absolute path of `wecom-cli`, registers its skills, runs authorization checks and QR-code connection on the Host, and shows the authorization section, an authorization tag, guidance after the bundle is switched on, and notices on the Plugins page through the [connector account registry](../../client/ui-connector-account/README.md) |
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.
Switching the bundle off withdraws the skills, the path in runtime context, and the page. The CLI authorization stays in place.
The guides come from `skills/` of `WecomTeam/wecom-cli` at commit `4c74ff2`. The row downloads that commit's archive when it loads and keeps the verified files in `$DSH_HOME/cache/wecom/`; until they are in place, the catalog has no `wecom` skill and the plugin page reports the download. A failed download is retried by the page's check.
Turning the plugin off in Plugin Manager withdraws the skills, the path from runtime context, and the authorization section. The CLI authorization and the downloaded guides stay in place.
<a id="account-operations"></a>
### Authorization operations
The Plugins page drives these operations through the connector account registry, which the Web app loads; a headless profile loads the plugin without it. The Host runs at most one operation at a time and owns it, so leaving the page does not cancel it.
| Operation | Effect |
|---|---|
| `check` | Checks the authorization again; each browser that opens the Web app starts one when no operation runs |
| `connect` | Runs `auth init --noninteractive --no-browser`, waits for the user to scan the QR code, then checks that the CLI reports the bot authorized |
| Cancel | Cancels the connection while it waits for the scan and waits for its command to exit; other steps are ignored |
A check runs `auth show --status`. The authorization reads `authorized` or `unauthorized` exactly as the CLI prints it; any other output or a nonzero exit fails the check and keeps the previous state. Each link that `auth init` prints alone on a stdout line is offered only when it is an HTTPS address on `work.weixin.qq.com`. Results report succeeded, cancelled, or failed. Failures show the command and the observed exit code on the page and in the Host log; the CLI's output, which can carry the QR-code session, is omitted. `wecom-cli` has no command that revokes the authorization, so the plugin offers no disconnect. The process running DSH needs access to the CLI configuration; `DSH_HOME` does not relocate it.
### Configure
| Field | Default | Meaning |
|---|---|---|
| `binDir` | the installed `@wecom/cli-<platform>-<arch>` package's `bin` | Absolute directory containing an executable `wecom-cli`, `wecom-cli.exe` on Windows |
| `commandTimeoutMs` | `30000` | Deadline for one authorization check, including executable lookup |
| `skillsDir` | none | Directory holding the files of `skills/` at their repository paths; when set, the guides are not downloaded |
| `skillsUrls` | `['https://codeload.github.com']` | Archive download prefixes tried in order |
| `skillsTimeoutMs` | `120000` | How long one prefix may take to deliver the whole archive |
QR-code authorization waits up to 10 minutes for the user, and each command keeps at most 1 MiB of stdout; the [CLI account library](../cli-account/README.md) fixes both limits.
The generated [config catalog](../../../docs/config-catalog.md#deepseek-aidsh-wecom) is the exhaustive source of supported fields.
-----
@@ -52,7 +79,9 @@ Switching the bundle off withdraws the skills, the path in runtime context, and
<details>
<summary>Implementation internals — click to expand</summary>
[`cordis.patch.yml`](cordis.patch.yml) inserts the `wecom` row after the profile's other layers. The package depends on that row package so that the row resolves from this bundle, and [`src/index.ts`](src/index.ts) exports nothing. The Plugins page keys the authorization section by this package name.
[`cordis.patch.yml`](cordis.patch.yml) inserts this package as the `wecom` row after the profile's other layers, and the Plugins page keys the authorization section by this package name. [`src/index.ts`](src/index.ts) is a function plugin. It checks that `binDir/wecom-cli` (`wecom-cli.exe` on Windows) is executable, gives that path to the model in runtime context, and registers the `wecom` skill through the [upstream skills library](../upstream-skills/README.md) with the pin in [`src/skills.ts`](src/skills.ts). The account view carries the download state, and each check restarts a failed download without waiting for it. [`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`. [`src/presentation.ts`](src/presentation.ts) maps each view to the section the registry serves, in the text of [`src/locales.ts`](src/locales.ts). 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 this package carries: the DSH guidance, an index of the guides, and how to open them. Upstream publishes the guides only in its repository and not in the npm package, so the library downloads them; they are files under the skill's base directory, 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.
</details>
@@ -62,26 +91,82 @@ Switching the bundle off withdraws the skills, the path in runtime context, and
## Further Exploration
- [Connector packages](../README.md) — the group this application plugin belongs to.
- [WeCom CLI and skills](../wecom-cli/README.md) — the Host row, its authorization operations, and its model guidance.
- [Connector account surfaces](../../client/ui-connector-account/README.md) — the registry that shows the authorization on the Plugins page.
- [Plugin Manager](../../boot/plugin-manager/README.md) — installation and enablement.
- [CLI account library](../cli-account/README.md) — command execution and account operations shared by CLI app plugins.
- [Skills](../../../docs/subsystems/skills.md) — catalog publication, loading, and precedence.
- [Connector account surfaces](../../client/ui-connector-account/README.md) — the registry and the Plugins page section that drive the authorization operations.
-----
<a id="model-experience"></a>
## Model Experience
Indirectly, through the `wecom` row, whose package owns the skill catalog entries, the loaded skill bodies, and the CLI path's runtime-context entry described in its [Model Experience](../wecom-cli/README.md#model-experience).
### Skill catalog entries
#### What the model sees
The skill catalog lists one `wecom` skill. Its Chinese description names the WeCom features it covers and tells the agent to load it, then read the matching guide, whenever the user mentions WeCom or those features or gives a `doc.weixin.qq.com` or `drive.weixin.qq.com` link.
#### Token effect
The entry stays in context while the plugin is loaded. Its name and description total about 160 characters.
#### KV Cache effect
None beyond the `wecom` row's skill catalog and runtime-context entry; the bundle itself sends no provider request.
The catalog is fixed for one plugin version. Loading or unloading the plugin changes the catalog, which is republished as a new message and leaves earlier context in place.
### Loaded skill body
#### 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 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 the downloaded directory, `skillsDir` or `$DSH_HOME/cache/wecom/skills-<digest>`, so the agent opens `skills/<name>/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
Each load adds the entry body to the retained tool history. Guides and their reference files arrive as ordinary file-read output.
#### KV Cache effect
Loading appends a tool result and does not rewrite earlier context.
### CLI path
#### What the model sees
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 "<binDir>/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="<binDir>:$PATH", and never export PATH or run `wecom-cli` by name yourself.
```
##### Runtime-context entry on Windows
```markdown
WeCom CLI: run `wecom-cli` by its absolute path with the call operator, & '<binDir>\wecom-cli.exe'; the bare name may resolve to another installation or to none.
Scripts in the WeCom skill call `wecom-cli` by name; start only the commands that run them with $env:PATH = '<binDir>;' + $env:PATH, and never run `wecom-cli` by name yourself.
```
#### Token effect
Two lines of about 280 characters plus the path and its directory in each runtime-context snapshot.
#### KV Cache effect
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
<a id="known-limitations-and-deferred-work"></a>
- Only macOS and Windows x64 are supported; the row packages list their own limitations.
- Only macOS and Windows x64 are supported; other platforms are unverified. `@wecom/cli` publishes no Windows arm64 package.
- 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 means a new pin from `scripts/upstream-skills-digest.ts`, after which the entry's index and DSH guidance must be checked against the new guides.
- The first load after a new pin needs access to GitHub or a configured mirror; until a download succeeds, the agent has no `wecom` skill.
- The downloaded guides stay in `$DSH_HOME/cache/wecom/` after the plugin is removed or pins another commit.
<a id="dev-note"></a>
### Dev Note
@@ -89,6 +174,6 @@ None beyond the `wecom` row's skill catalog and runtime-context entry; the bundl
<details>
<summary>Working context for maintainers — click to expand</summary>
None.
The guides keep upstream whitespace, including trailing spaces that mark Markdown line breaks, and no whitespace exemption covers them: a commit that adds upstream lines with trailing whitespace fails the pre-commit `git diff --cached --check`. Specs and the `wecom-skills` session snapshot use stand-in executables through `binDir`.
</details>
+99 -14
View File
@@ -9,7 +9,7 @@ kind: "package-bundle"
## 概述
企业微信插件让对话通过官方 `wecom-cli` 使用企业微信。安装这个 bundle 会加入一行:带技能的 CLI,它同时在插件页显示企业微信授权区块;用户在插件页扫码绑定机器人,不需要先开始对话。CLI 把授权保存在默认配置中,与用户自己的终端共用。仅支持 macOS 和 Windows x64。
企业微信插件让对话通过官方 `wecom-cli` 使用企业微信。它安装固定版本的 `@wecom/cli`,在运行时上下文中把其 `wecom-cli` 可执行文件的绝对路径告诉模型,并注册一个 `wecom` skill,其子指南是官方企业微信技能,从该 CLI 的 GitHub 仓库下载。它把授权注册到 [连接器账号注册表](../../client/ui-connector-account/README.zh.md),插件页因此能显示授权,并检查授权、通过 CLI 的扫码页面绑定机器人,或取消操作。CLI 把机器人凭据保存在默认配置中,与用户自己的终端共用。仅支持 macOS 和 Windows x64。
## 目录
@@ -34,15 +34,42 @@ dsh plugin --profile web add @deepseek-ai/dsh-wecom
dsh plugin --profile web remove @deepseek-ai/dsh-wecom
```
`@wecom/cli` 把原生程序放在 `@wecom/cli-darwin-arm64` 等平台包中,这些包安装时不运行构建脚本。没有与本机匹配的平台包时,`wecom` 行会加载失败,并给出缺失的包名。
`@wecom/cli` 把原生程序放在 `@wecom/cli-darwin-arm64` 等平台包中,这些包安装时不运行构建脚本。没有与本机匹配的平台包或可执行文件缺失时,`wecom` 行会加载失败,并给出缺失的包名或路径。
### 获得的能力
| 行 | 包 | 行为 |
|---|---|---|
| `wecom` | [`@deepseek-ai/dsh-wecom-cli`](../wecom-cli/README.zh.md) | 把 `wecom-cli` 的绝对路径告诉模型,注册其技能,在 Host 上执行授权检查和扫码连接,并通过 [连接器账号注册表](../../client/ui-connector-account/README.zh.md)在插件页显示授权区块、授权标签、开启后的引导和提示 |
插件加载后,一个 `wecom` skill 进入 skill 目录。agent 用 `skill` 工具加载它,用文件工具打开所需的子指南(例如 `wecomcli-doc` 或 `wecomcli-message`),并在当前沙箱与审批策略下通过普通 Shell 工具按这个路径运行 `wecom-cli`。`wecom-cli auth show --status` 报告未授权时,agent 会请用户到插件页连接企业微信;只有用户要求在对话中完成时,才运行 CLI 自带的 `auth init`,并因为它会在工作区之外写入而申请单条命令审批。
关闭 bundle 会撤下技能、运行时上下文中的路径和页面。CLI 的授权保持不变。
子指南来自 `WecomTeam/wecom-cli` 在提交 `4c74ff2` 时的 `skills/`。该行加载时下载这个提交的归档,并把校验后的文件保存在 `$DSH_HOME/cache/wecom/`;文件就位之前,skill 目录中没有 `wecom` skill,插件页会报告下载状态。下载失败时,由插件页的检查重试。
在 Plugin Manager 中关闭插件会撤下 skill、运行时上下文中的路径和授权区块,CLI 的授权和已下载的子指南保持不变。
<a id="account-operations"></a>
### 授权操作
插件页通过 连接器账号注册表发起这些操作,注册表由 Web 应用加载;headless profile 加载插件时没有它。Host 同一时间最多运行一个操作并持有它,因此离开页面不会取消操作。
| 操作 | 作用 |
|---|---|
| `check` | 重新检查授权;没有操作运行时,每个打开 Web 应用的浏览器会触发一次 |
| `connect` | 运行 `auth init --noninteractive --no-browser`,等待用户扫码,然后确认 CLI 报告机器人已授权 |
| 取消 | 在等待扫码期间取消连接并等待其命令退出;其他步骤会被忽略 |
检查运行 `auth show --status`。授权状态按 CLI 的输出原样读作 `authorized` 或 `unauthorized`;其他输出或非零退出码会使检查失败,并保留之前的状态。`auth init` 在 stdout 中单独一行打印的链接,只有是 `work.weixin.qq.com` 上的 HTTPS 地址时才会提供。结果分为成功、已取消和失败。失败时,页面和 Host 日志显示命令和观察到的退出码;CLI 的输出可能带有扫码会话,因此不保留。`wecom-cli` 没有撤销授权的命令,因此插件不提供断开连接。运行 DSH 的进程需要能访问 CLI 配置;`DSH_HOME` 不会迁移它。
### 配置
| 字段 | 默认值 | 含义 |
|---|---|---|
| `binDir` | 已安装 `@wecom/cli-<platform>-<arch>` 包的 `bin` | 包含可执行 `wecom-cli`(Windows 上为 `wecom-cli.exe`)的绝对目录 |
| `commandTimeoutMs` | `30000` | 单次授权检查的期限,包含可执行文件查找 |
| `skillsDir` | 无 | 按仓库路径存放 `skills/` 文件的目录;设置后不下载子指南 |
| `skillsUrls` | `['https://codeload.github.com']` | 按顺序尝试的归档下载前缀 |
| `skillsTimeoutMs` | `120000` | 一个前缀送达完整归档的时限 |
扫码授权最多等待用户 10 分钟,每条命令最多保留 1 MiB 的 stdout;这两个上限由 [CLI 账号库](../cli-account/README.zh.md)固定。
生成的[配置目录](../../../docs/config-catalog.zh.md#deepseek-aidsh-wecom)是受支持字段的完整来源。
-----
@@ -52,7 +79,9 @@ dsh plugin --profile web remove @deepseek-ai/dsh-wecom
<details>
<summary>实现内部机制——点击展开</summary>
[`cordis.patch.yml`](cordis.patch.yml) 在 profile 其他层之后插入 `wecom` 行。本包依赖这个行包,使该行从本 bundle 解析;[`src/index.ts`](src/index.ts) 不导出任何内容。插件页以本包名作为授权区块的 key。
[`cordis.patch.yml`](cordis.patch.yml) 在 profile 其他层之后把本包作为 `wecom` 行插入,插件页以本包名作为授权区块的 key。[`src/index.ts`](src/index.ts) 是一个函数插件。它检查 `binDir/wecom-cli`(Windows 上为 `wecom-cli.exe`)是否可执行,在运行时上下文中把这个路径告诉模型,并通过[上游技能库](../upstream-skills/README.zh.md)按 [`src/skills.ts`](src/skills.ts) 中的固定信息注册 `wecom` skill。账号视图携带下载状态,每次检查都会在不等待的情况下重新开始失败的下载。[`src/directory.ts`](src/directory.ts) 定位 `@wecom/cli` 作为可选依赖安装的平台包。[CLI 账号库](../cli-account/README.zh.md)注册这条运行时上下文,按同一路径运行每条命令,并一次执行一个操作。[`src/account.ts`](src/account.ts) 在该运行时上实现企业微信的命令,并从 `auth init` 的输出行中读取扫码链接。[`src/presentation.ts`](src/presentation.ts) 用 [`src/locales.ts`](src/locales.ts) 中的文案,把每个视图映射为注册表提供的区块。释放时取消进行中的操作,中止正在运行的命令,并在这些进程退出后完成。
[`skills/wecom/SKILL.md`](skills/wecom/SKILL.md) 是本包携带的唯一 skill:DSH 指引、子指南索引和打开方式。上游只在其仓库发布这些子指南,没有放进 npm 包,因此由该库下载;它们是 skill 基础目录下的文件,不是独立的 skill。DSH 指引与 `wecomcli-shared` 不一致时,总入口要求 agent 以 DSH 指引为准:使用插件提供的 `wecom-cli`,不再自行安装,并把授权引导到插件页。引用文件是每个子指南目录中的普通文件。
</details>
@@ -62,26 +91,82 @@ dsh plugin --profile web remove @deepseek-ai/dsh-wecom
## 进一步探索
- [Connector 包](../README.zh.md)——这个应用插件所属的分组。
- [企业微信 CLI 与技能](../wecom-cli/README.zh.md)——Host 行、授权操作与模型指引。
- [连接器账号界面](../../client/ui-connector-account/README.zh.md)——在插件页显示授权的注册表。
- [Plugin Manager](../../boot/plugin-manager/README.zh.md)——安装与启用。
- [CLI 账号库](../cli-account/README.zh.md)——CLI 应用插件共用的命令执行与账号操作。
- [Skill](../../../docs/subsystems/skills.zh.md)——目录发布、加载与优先级。
- [连接器账号界面](../../client/ui-connector-account/README.zh.md)——发起授权操作的注册表和插件页区块。
-----
<a id="model-experience"></a>
## 模型体验
间接地通过 `wecom` 行产生,该行所属的包负责技能目录条目、加载后的技能正文和 CLI 路径的运行时上下文条目,见其[模型体验](../wecom-cli/README.zh.md#model-experience)。
### Skill 目录条目
#### 模型看到什么
skill 目录只列出一个 `wecom` skill。其中文描述列出它覆盖的企业微信功能,并要求 agent 在用户提到企业微信或这些功能、或给出 `doc.weixin.qq.com`、`drive.weixin.qq.com` 链接时加载它,再读取对应的子指南。
#### Token 影响
插件加载期间这一条目一直留在上下文中。其名称与描述合计约 160 个字符。
#### KV Cache 影响
除 `wecom` 行的技能目录和运行时上下文条目外没有影响;bundle 本身不发送 provider 请求。
同一插件版本的目录固定不变。加载或卸载插件会改变目录,目录作为新消息重新发布,不改动更早的上下文。
### 已加载的 skill 正文
#### 模型看到什么
`wecom` 的 `skill` 工具结果约 2,000 个字符:DSH 指引、为 15 个子指南各写一句话并保留上游分流规则的索引,以及打开子指南的方式。DSH 指引要求 agent 按当前运行时上下文给出的绝对路径运行插件提供的 `wecom-cli`,先请用户到插件页连接,再考虑自行运行 `auth init --noninteractive`,并以单条命令审批运行该命令;与 `wecomcli-shared` 不一致时以它为准。其资源根目录是下载目录,即 `skillsDir` 或 `$DSH_HOME/cache/wecom/skills-<摘要>`,因此 agent 用文件工具而不是 `skill` 工具打开 `skills/<name>/SKILL.md`,把子指南按名字提到的技能当作对应子指南,并按子指南自己的目录解析其中的相对路径。
#### Token 影响
每次加载把总入口正文加入保留的工具历史。子指南及其引用文件作为普通的文件读取输出返回。
#### KV Cache 影响
加载会追加一条工具结果,不改写更早的上下文。
### CLI 路径
#### 模型看到什么
该行加载期间,[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 "<binDir>/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="<binDir>:$PATH", and never export PATH or run `wecom-cli` by name yourself.
```
##### Windows 上的运行时上下文条目
```markdown
WeCom CLI: run `wecom-cli` by its absolute path with the call operator, & '<binDir>\wecom-cli.exe'; the bare name may resolve to another installation or to none.
Scripts in the WeCom skill call `wecom-cli` by name; start only the commands that run them with $env:PATH = '<binDir>;' + $env:PATH, and never run `wecom-cli` by name yourself.
```
#### Token 影响
每份运行时上下文快照中两行,约 280 个字符加上路径及其目录。
#### KV Cache 影响
系统提示词不变;加载或卸载该行、或路径变化时,追加一份运行时上下文快照。
## 已知限制与延期工作
<a id="known-limitations-and-deferred-work"></a>
- 仅支持 macOS 和 Windows x64;两个行包各自列出其限制。
- 仅支持 macOS 和 Windows x64;其他平台未经验证。`@wecom/cli` 没有发布 Windows arm64 平台包。
- 命令必须在本 Host 上运行。组合把命令放到别处运行(例如通过 SSH)时,插件仍会加载,但每条运行 `wecom-cli` 的命令都会因为那里没有这个路径而失败。
- 插件使用 CLI 的默认配置。在 DSH 中授权会影响用户自己的终端,没有 DSH 私有机器人或机器人选择器。`wecom-cli` 无法撤销授权,因此页面和关闭插件都不会移除它。
- 连接从 `auth init --noninteractive --no-browser` 的纯文本输出中读取扫码链接;CLI 版本改变该输出时,连接以可重试的结果失败。
- 子指南跟随上游提交 `4c74ff2`;更新时要用 `scripts/upstream-skills-digest.ts` 生成新的固定信息,之后按新的子指南核对总入口的索引和 DSH 指引。
- 换用新的固定提交后,首次加载需要能访问 GitHub 或配置的镜像;下载成功之前,agent 没有 `wecom` skill。
- 插件卸载或改为固定其他提交后,已下载的子指南仍留在 `$DSH_HOME/cache/wecom/`。
<a id="dev-note"></a>
### 开发备注
@@ -89,6 +174,6 @@ dsh plugin --profile web remove @deepseek-ai/dsh-wecom
<details>
<summary>维护者工作上下文——点击展开</summary>
无。
子指南保留上游的空白,包括表示 Markdown 换行的行尾空格,且没有任何空白豁免:新增带行尾空白的上游行的提交,会被 pre-commit 的 `git diff --cached --check` 拒绝。单测与 `wecom-skills` 会话快照通过 `binDir` 使用替身可执行文件。
</details>
+1 -1
View File
@@ -1,3 +1,3 @@
- insert:
- id: wecom
name: '@deepseek-ai/dsh-wecom-cli'
name: '@deepseek-ai/dsh-wecom'
+23 -11
View File
@@ -19,10 +19,10 @@
"types": "./lib/types/index.d.ts",
"default": "./lib/index.js"
},
"./locale/*.json": "./locale/*.json",
"./src/*": "./src/*",
"./package.json": "./package.json",
"./cordis.patch.yml": "./cordis.patch.yml",
"./locale/*.json": "./locale/*.json"
"./cordis.patch.yml": "./cordis.patch.yml"
},
"files": [
"icon.svg",
@@ -30,24 +30,36 @@
"docs",
"lib/index.js",
"cordis.patch.yml",
"skills",
"lib/types/**/*.d.ts",
"lib/types/**/*.d.ts.map",
"lib/**/*.js.map",
"src"
],
"license": "MIT",
"dependencies": {
"@deepseek-ai/dsh-wecom-cli": "workspace:*"
},
"peerDependencies": {
"@deepseek-ai/cordis": "workspace:~"
},
"devDependencies": {
"@deepseek-ai/cordis": "workspace:~"
},
"dsh": {
"bundle": {
"patch": "./cordis.patch.yml"
}
},
"dependencies": {
"@deepseek-ai/dsh-cli-account": "workspace:*",
"@deepseek-ai/dsh-upstream-skills": "workspace:*",
"@deepseek-ai/dsh-util-values": "workspace:*",
"@deepseek-ai/schemastery": "workspace:~",
"@wecom/cli": "1.3.4"
},
"peerDependencies": {
"@deepseek-ai/cordis": "workspace:~",
"@deepseek-ai/dsh-skill": "workspace:*",
"@deepseek-ai/dsh-subprocess": "workspace:*",
"@deepseek-ai/dsh-system-prompt": "workspace:*"
},
"devDependencies": {
"@deepseek-ai/cordis": "workspace:~",
"@deepseek-ai/dsh-client-ui-connector-account": "workspace:*",
"@deepseek-ai/dsh-skill": "workspace:*",
"@deepseek-ai/dsh-subprocess": "workspace:*",
"@deepseek-ai/dsh-system-prompt": "workspace:*"
}
}
+57 -2
View File
@@ -1,2 +1,57 @@
/** WeCom plugin composition; runtime rows live in cordis.patch.yml. */
export {}
/**
* WeCom plugin: tells the model the managed wecom-cli's absolute path, registers
* the `wecom` skill over the upstream guides it downloads, and shows the
* authorization on the Plugins page through the connector account registry. The CLI's
* authorization is shared with the user's own terminal.
* @module @deepseek-ai/dsh-wecom
*/
import type { Context } from '@deepseek-ai/cordis'
import z from '@deepseek-ai/schemastery'
import { CliAccountConfig, CliCommandExecutor, registerCliPathContext } from '@deepseek-ai/dsh-cli-account'
import { registerUpstreamSkills, UpstreamSkillsConfig } from '@deepseek-ai/dsh-upstream-skills'
import type {} from '@deepseek-ai/dsh-client-ui-connector-account'
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, resolveCliExecutable } from './directory.ts'
import { COPY, OPERATIONS, presentAccount, WECOM_PACKAGE } from './presentation.ts'
import { ENTRY, WECOM_SKILLS } from './skills.ts'
export type * from './types.ts'
/** Plugin name. */
export const name = 'wecom'
/* jscpd:ignore-start -- CLI app plugins with downloaded guides declare the same services, config, and registration. */
/** Services the CLI, its skills, and its runtime context need. */
export const inject = ['skills', 'subprocess', 'systemPrompt']
/** Where wecom-cli and the upstream guides come from, a command's deadline, and a download's time limit. */
export type Config = CliAccountConfig & UpstreamSkillsConfig
/** Validates {@link Config}. */
export const Config: z<Config> = z.intersect([CliAccountConfig, UpstreamSkillsConfig])
/**
* Register the CLI and its skills, and show the authorization on the Plugins page while the connector account registry runs.
* @param ctx - Context carrying the skill registry, subprocess runtime, and system prompt.
* @param config - CLI location, command deadline, and where the upstream guides come from.
* @throws when `wecom-cli` is not executable or `skillsDir` is not a directory.
*/
export function apply(ctx: Context, config: Config): void {
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 })
const skills = registerUpstreamSkills(ctx, { name: 'wecom', entry: ENTRY, set: WECOM_SKILLS, config })
const account = new WecomAccount(cli, ctx.logger, skills)
ctx.effect(() => () => account.dispose(), 'wecom: account')
ctx.effect(() => skills.watch((state) => { account.showSkills(state) }), 'wecom: guides')
ctx.inject(['connectorAccounts'], (scope) => {
scope.effect(() => scope.connectorAccounts.register({
key: WECOM_PACKAGE, packageName: WECOM_PACKAGE, source: account, operations: OPERATIONS, copy: COPY, present: presentAccount,
}), 'wecom: Plugins page authorization')
})
}
/* jscpd:ignore-end */
+24
View File
@@ -10,6 +10,30 @@
"references": [
{
"path": "../../../vendor/cordis"
},
{
"path": "../../../vendor/schemastery"
},
{
"path": "../upstream-skills"
},
{
"path": "../../util/values"
},
{
"path": "../../skill/skill"
},
{
"path": "../../subprocess/subprocess"
},
{
"path": "../cli-account"
},
{
"path": "../../core/system-prompt"
},
{
"path": "../../client/ui-connector-account/tsconfig.host.json"
}
]
}
@@ -145,7 +145,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 by its absolute path, its skills, and authorization over Remote |
| `@deepseek-ai/dsh-wecom` | yes | WeCom plugin: the official wecom-cli with its skills, and authorization from the Plugins page |
## context
-13
View File
@@ -141,9 +141,6 @@ importers:
'@deepseek-ai/dsh-wecom':
specifier: workspace:*
version: link:packages/connector/wecom
'@deepseek-ai/dsh-wecom-cli':
specifier: workspace:*
version: link:packages/connector/wecom-cli
'@deepseek-ai/dsh-working-directory':
specifier: workspace:*
version: link:packages/session/working-directory
@@ -7633,16 +7630,6 @@ importers:
version: link:../../skill/skill
packages/connector/wecom:
dependencies:
'@deepseek-ai/dsh-wecom-cli':
specifier: workspace:*
version: link:../wecom-cli
devDependencies:
'@deepseek-ai/cordis':
specifier: workspace:~
version: link:../../../vendor/cordis
packages/connector/wecom-cli:
dependencies:
'@deepseek-ai/dsh-cli-account':
specifier: workspace:*
+1 -1
View File
@@ -215,7 +215,7 @@ const packageFileExtras: Readonly<Record<string, readonly string[]>> = {
// The physical-key protocol is a public entry usable without the browser service.
'@deepseek-ai/dsh-client-shortcuts': ['lib/protocol.js'],
// The WeCom plugin ships its entry skill; the upstream guides it indexes are downloaded at load.
'@deepseek-ai/dsh-wecom-cli': ['skills'],
'@deepseek-ai/dsh-wecom': ['skills'],
// The CPython side ships as source .py files, published as-is rather than built.
'@deepseek-ai/dsh-experimental-ptc-runtime-python': ['py/**/*.py'],
'@deepseek-ai/dsh-experimental-speech-to-text-sensevoice': ['runtime/assets.json'],
-1
View File
@@ -33,7 +33,6 @@ export const PRODUCT_PACKAGE_POLICY: Readonly<Record<string, ProductPackagePolic
'packages/subagent/subagent-codex': { category: 'optional', reason: 'Separately installed native Codex agent integration.' },
'packages/subagent/subagent-dsh-sdk': { category: 'optional', reason: 'Requires an explicitly configured external DSH home.' },
'packages/connector/wecom': { category: 'optional', reason: 'Separately installed app plugin that requires wecom-cli and a user-authorized WeCom bot.' },
'packages/connector/wecom-cli': { category: 'optional', reason: 'WeCom CLI, skills, and authorization mounted by the separately installed WeCom bundle.' },
'packages/connector/cli-account': { category: 'optional', reason: 'Host library imported by separately installed CLI app plugins.' },
'packages/connector/upstream-skills': { category: 'optional', reason: 'Host library imported by separately installed CLI app plugins.' },
'packages/context/tmux-context': { category: 'optional', reason: 'Context contribution requiring a tmux pane.' },
@@ -208,7 +208,6 @@ const SENTENCE_MODEL_EXPERIENCE: Readonly<Record<string, SentenceContract>> = {
'packages/experimental/badge-skill-bundle': { kind: 'indirect', reason: 'The profile layer delegates model-visible behavior to its selected capability.' },
'packages/experimental/session-titles-bundle': { kind: 'indirect', reason: 'The profile layer delegates model-visible behavior to its selected capability.' },
'packages/bundle/base': { kind: 'indirect', reason: 'The bundle is a patch-list carrier; each inserted row\'s package owns its model-facing behavior.' },
'packages/connector/wecom': { kind: 'indirect', reason: 'The bundle is a patch-list carrier; the wecom-cli row owns the skills the model sees.' },
'packages/bundle/headless': { kind: 'none', reason: 'The one-shot runner submits the task as an ordinary user message; prompts and tools belong to the composed base and headless bundles.' },
'packages/llm/llm': { kind: 'none', reason: 'The adapter registry forwards already-assembled requests unchanged.' },
'packages/llm/token-meter': { kind: 'indirect', reason: 'The measurement service leaves model-visible changes to its consumers.' },
@@ -46,7 +46,7 @@
- insert:
- id: wecom
name: '@deepseek-ai/dsh-wecom-cli'
name: '@deepseek-ai/dsh-wecom'
config:
binDir: !!js process.cwd() + '/wecom-bin'
skillsDir: !!js process.cwd() + '/wecom-skills'
+1 -1
View File
@@ -1,6 +1,6 @@
- insert:
- id: wecom
name: '@deepseek-ai/dsh-wecom-cli'
name: '@deepseek-ai/dsh-wecom'
config:
binDir: !!js process.cwd() + '/wecom-bin'
skillsDir: !!js process.cwd() + '/wecom-skills'
-1
View File
@@ -625,7 +625,6 @@
"@deepseek-ai/dsh-webhook": ["./packages/experimental/webhook/src"],
"@deepseek-ai/dsh-webhook-github": ["./packages/experimental/webhook-github/src"],
"@deepseek-ai/dsh-wecom": ["./packages/connector/wecom/src"],
"@deepseek-ai/dsh-wecom-cli": ["./packages/connector/wecom-cli/src"],
"@deepseek-ai/dsh-win32-process": ["./packages/subprocess/win32-process/src"],
"@deepseek-ai/dsh-workflow": ["./packages/workflow/workflow/src"],
"@deepseek-ai/dsh-workflow-ptc": ["./packages/workflow/workflow-ptc/src"],
-1
View File
@@ -316,7 +316,6 @@
{ "path": "./packages/skill/skill-office" },
{ "path": "./packages/skill/tool-workspace-dependencies" },
{ "path": "./packages/connector/wecom" },
{ "path": "./packages/connector/wecom-cli" },
{ "path": "./packages/browser-use/browser-use" },
{ "path": "./packages/experimental/browser-use-runtime" },
{ "path": "./packages/experimental/browser-use-playwright-mcp" },