diff --git a/packages/connector/wecom/README.i18n.yaml b/packages/connector/wecom/README.i18n.yaml index c8e2d25618..f1fde0298e 100644 --- a/packages/connector/wecom/README.i18n.yaml +++ b/packages/connector/wecom/README.i18n.yaml @@ -21,8 +21,8 @@ en: 6227d6e43ec8c108 zh: 48e0f252de253d14 /deepseek-ai-dsh-wecom/use-this-package/what-you-get: - en: f8935d344d90672a - zh: 50cf55ec6b629ffe + en: 7581623b2b257fe0 + zh: cdd670dfd6d0183d /deepseek-ai-dsh-wecom/use-this-package/authorization-operations: en: a5d3467ec57a5657 zh: ea5a0e1c3c539046 @@ -54,8 +54,8 @@ en: 8955ac196848e69f zh: 54aa7db097eafd3c /deepseek-ai-dsh-wecom/model-experience/loaded-skill-body/what-the-model-sees: - en: aa56f9a16fab3328 - zh: 478afb312b62a06f + en: ff5d75fb84ce8130 + zh: 0f236bf0534755a9 /deepseek-ai-dsh-wecom/model-experience/loaded-skill-body/token-effect: en: 1ed287a86abbc585 zh: 5d55a6fd61786866 @@ -81,8 +81,8 @@ en: 67398dd4e4b02db9 zh: a873eacd006fa656 /deepseek-ai-dsh-wecom/known-limitations-and-deferred-work: - en: 4456e4fc34f2ad51 - zh: 59d54241937f61b6 + en: 7a9e3ee8135294ee + zh: a016e5b728757c1f /deepseek-ai-dsh-wecom/known-limitations-and-deferred-work/dev-note: en: 71cc23fc507e649e zh: 3dbd0498845467cc diff --git a/packages/connector/wecom/README.md b/packages/connector/wecom/README.md index a67691dcee..96d05dca09 100644 --- a/packages/connector/wecom/README.md +++ b/packages/connector/wecom/README.md @@ -38,7 +38,7 @@ dsh plugin --profile web remove @deepseek-ai/dsh-wecom ### 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. +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, and requests `sandbox_permissions` with a `justification` on the first attempt because the command writes outside the workspace. When a command returns `errcode` 853004 (`cli token expired`), the agent does not ask for a new authorization or pass on the server's upgrade advice: it reruns the command with `sandbox_permissions` and a `justification`, because in the file sandbox the CLI cannot save the token it just refreshed. 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. @@ -118,7 +118,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 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-`, so the agent opens `skills//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,300 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, to request `sandbox_permissions` for that command from its first attempt, and to rerun a command that returned `errcode` 853004 with `sandbox_permissions` instead of asking for a new authorization or passing on the server's upgrade advice, asking for a new authorization only when the rerun returns 853004 again; it takes precedence over `wecomcli-shared` where they disagree. Its resource base is the downloaded directory, `skillsDir` or `$DSH_HOME/cache/wecom/skills-`, so the agent opens `skills//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 @@ -167,6 +167,7 @@ The system prompt does not change; loading or unloading the row, or a changed pa - 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. +- In the file sandbox, `wecom-cli` reads the saved authorization without writing, so commands run there until the saved token expires. It then cannot save the refreshed token in its configuration directory outside the workspace, and the command returns `errcode` 853004 with the server's upgrade advice. Rerunning that command needs one single-command approval, after which commands run in the sandbox again until the next expiry. The page's check reads only local state and does not refresh the token. ### Dev Note diff --git a/packages/connector/wecom/README.zh.md b/packages/connector/wecom/README.zh.md index 7b81683824..e53ddb63ef 100644 --- a/packages/connector/wecom/README.zh.md +++ b/packages/connector/wecom/README.zh.md @@ -38,7 +38,7 @@ dsh plugin --profile web remove @deepseek-ai/dsh-wecom ### 获得的能力 -插件加载后,一个 `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`,并且因为该命令会写入工作区之外,第一次尝试就带 `justification` 申请 `sandbox_permissions`。命令返回 `errcode` 853004(`cli token expired`)时,agent 不会请用户重新授权,也不会转述服务端的升级建议,而是带 `sandbox_permissions` 和 `justification` 重跑同一条命令,因为在文件沙箱下 CLI 保存不了刚换到的 token。 子指南来自 `WecomTeam/wecom-cli` 在提交 `4c74ff2` 时的 `skills/`。该行加载时下载这个提交的归档,并把校验后的文件保存在 `$DSH_HOME/cache/wecom/`;文件就位之前,skill 目录中没有 `wecom` skill,插件页会报告下载状态。下载失败时,由插件页的检查重试。 @@ -118,7 +118,7 @@ skill 目录只列出一个 `wecom` 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//SKILL.md`,把子指南按名字提到的技能当作对应子指南,并按子指南自己的目录解析其中的相对路径。 +`wecom` 的 `skill` 工具结果约 2,300 个字符:DSH 指引、为 15 个子指南各写一句话并保留上游分流规则的索引,以及打开子指南的方式。DSH 指引要求 agent 按当前运行时上下文给出的绝对路径运行插件提供的 `wecom-cli`,先请用户到插件页连接,再考虑自行运行 `auth init --noninteractive`,第一次运行该命令就申请 `sandbox_permissions`,命令返回 `errcode` 853004 时带 `sandbox_permissions` 重跑同一条命令,而不是请用户重新授权或转述服务端的升级建议,重跑后仍返回 853004 才请用户重新授权;与 `wecomcli-shared` 不一致时以它为准。其资源根目录是下载目录,即 `skillsDir` 或 `$DSH_HOME/cache/wecom/skills-<摘要>`,因此 agent 用文件工具而不是 `skill` 工具打开 `skills//SKILL.md`,把子指南按名字提到的技能当作对应子指南,并按子指南自己的目录解析其中的相对路径。 #### Token 影响 @@ -167,6 +167,7 @@ Scripts in the WeCom skill call `wecom-cli` by name; start only the commands tha - 子指南跟随上游提交 `4c74ff2`;更新时要用 `scripts/upstream-skills-digest.ts` 生成新的固定信息,之后按新的子指南核对总入口的索引和 DSH 指引。 - 换用新的固定提交后,首次加载需要能访问 GitHub 或配置的镜像;下载成功之前,agent 没有 `wecom` skill。 - 插件卸载或改为固定其他提交后,已下载的子指南仍留在 `$DSH_HOME/cache/wecom/`。 +- 在文件沙箱下,`wecom-cli` 读取已保存的授权时不需要写入,所以在已保存的 token 过期之前命令可以直接运行。token 过期后,CLI 无法把刚换到的 token 保存到工作区之外的配置目录,命令会返回 `errcode` 853004 和服务端的升级建议。重跑这条命令需要一次单条命令审批,之后命令又可以在沙箱中运行,直到下一次过期。页面的检查只读取本地状态,不会刷新 token。 ### 开发备注 diff --git a/packages/connector/wecom/skills/wecom/SKILL.md b/packages/connector/wecom/skills/wecom/SKILL.md index bb13e546f1..81a14f5a6f 100644 --- a/packages/connector/wecom/skills/wecom/SKILL.md +++ b/packages/connector/wecom/skills/wecom/SKILL.md @@ -10,8 +10,9 @@ description: 企业微信插件:通过 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 工具的单条命令审批运行。 -- 其他 `wecom-cli` 命令在现有沙箱中运行;只有凭据、缓存或日志写入被拒绝时,才申请单条命令审批。 +- 未授权时,先请用户在「插件」中打开企业微信插件页面,点击“连接企业微信”并用企业微信扫码授权;用户完成后重新检查授权。只有用户要求在本次对话中完成授权时,才执行 `wecom-cli auth init --noninteractive`:它会输出扫码链接和二维码,并最多等待 5 分钟扫码,把扫码链接告诉用户。它会把凭据写到工作区之外,保存被拒绝时这次扫码也会作废:第一次运行就把 Shell 工具的 `sandbox_permissions` 设为能写工作区之外的最窄模式,并填写 `justification`。 +- 其他 `wecom-cli` 命令在现有沙箱中运行;只有凭据、缓存或日志写入被拒绝时,才设置 `sandbox_permissions`。 +- 命令返回 `errcode` 853004,也就是 `cli token expired` 时,通常是 `wecom-cli` 换到了新 token,却写不进工作区之外的配置目录,于是返回了原错误:授权没有失效,也不需要升级。不要向用户转述返回里的 `help_message`,也不要请用户重新授权,设置 `sandbox_permissions` 和 `justification` 重跑同一条命令。重跑后仍返回 853004,才请用户在企业微信插件页面重新授权。 - 不要索取或输出 Bot Secret、token 等凭据。 ## 子指南索引