dsh-lark-bot 0.19.12 → 0.19.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/README_EN.md +3 -1
- package/dist/cli.js +687 -188
- package/dist/cli.js.map +1 -1
- package/dist/plugin.d.ts +120 -1
- package/dist/plugin.js +706 -207
- package/dist/plugin.js.map +1 -1
- package/dist/skill.js +2 -1
- package/dist/skill.js.map +1 -1
- package/package.json +1 -1
package/dist/skill.js
CHANGED
|
@@ -18,7 +18,8 @@ var COMMAND_CATALOG = [
|
|
|
18
18
|
{ names: ["/isolation"], area: "policy", zh: "`[group|topic|member]` \u2014 \u7FA4\u4F1A\u8BDD\u9694\u79BB\uFF08\u8BBE\u7F6E\u9700\u7BA1\u7406\u5458\uFF09", en: "`[group|topic|member]` \u2014 group isolation (admin to set)" },
|
|
19
19
|
{ names: ["/role"], area: "configuration", zh: "`list|show|set|clear|save|remove \u2026` \u2014 \u7BA1\u7406\u89D2\u8272", en: "`list|show|set|clear|save|remove \u2026` \u2014 manage roles" },
|
|
20
20
|
{ names: ["/notify"], area: "communication", zh: "`<scope|chatId> <text>` / `list` \u2014 \u8DE8\u4F1A\u8BDD\u901A\u77E5\uFF08\u53D1\u9001\u9700\u7BA1\u7406\u5458\uFF09", en: "`<scope|chatId> <text>` / `list` \u2014 cross-session notification (admin to send)" },
|
|
21
|
-
{ names: ["/notifications"], area: "communication", zh: "`[show|off|on \u2026]` \u2014 scope \u63D0\u9192\u7B56\u7565", en: "`[show|off|on \u2026]` \u2014 scope notification policy" },
|
|
21
|
+
{ names: ["/notifications"], area: "communication", zh: "`[show|off|on \u2026]` \u2014 scope \u63D0\u9192\u7B56\u7565\uFF08\u652F\u6301 `sinks=`\uFF09", en: "`[show|off|on \u2026]` \u2014 scope notification policy (supports `sinks=`)" },
|
|
22
|
+
{ names: ["/channels"], area: "configuration", zh: "`list|show|add|remove|enable|disable \u2026` \u2014 \u7BA1\u7406\u51FA\u7AD9\u901A\u77E5\u6E20\u9053\uFF08\u7BA1\u7406\u5458\uFF09", en: "`list|show|add|remove|enable|disable \u2026` \u2014 manage outbound notification channels (admin)" },
|
|
22
23
|
{ names: ["/replies"], area: "communication", zh: "`[show|default|set \u2026]` \u2014 \u56DE\u590D\u5408\u5E76\u3001\u9891\u7387\u4E0E\u53BB\u91CD", en: "`[show|default|set \u2026]` \u2014 reply batching, rate, and deduplication" },
|
|
23
24
|
{ names: ["/retention"], area: "session", zh: "`[N|default]` \u2014 \u4F1A\u8BDD\u4FDD\u7559\u6761\u6570", en: "`[N|default]` \u2014 retained live-message count" },
|
|
24
25
|
{ names: ["/archive"], area: "session", zh: "`[note]|send|list|clean \u2026` \u2014 \u7BA1\u7406\u5F52\u6863", en: "`[note]|send|list|clean \u2026` \u2014 manage archives" },
|
package/dist/skill.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/catalog.ts","../src/skill/dsh-lark-bot.ts","../src/skill/index.ts"],"sourcesContent":["export interface CommandDefinition {\n names: readonly [`/${string}`, ...Array<`/${string}`>];\n zh: string;\n en: string;\n area: 'session' | 'workspace' | 'operations' | 'policy' | 'configuration' | 'communication';\n}\n\nexport const COMMAND_CATALOG: readonly CommandDefinition[] = [\n { names: ['/new', '/reset'], area: 'session', zh: '开始新会话', en: 'start a new session' },\n { names: ['/newg'], area: 'session', zh: '`<群名>` — 新建群聊并开始独立会话', en: '`<name>` — create a group and start an independent session' },\n { names: ['/cd'], area: 'workspace', zh: '`<path>` — 切换到该目录的独立会话', en: '`<path>` — switch to that directory’s independent session' },\n { names: ['/ws'], area: 'workspace', zh: '`list|save <name>|use <name>|remove <name>` — 管理工作空间', en: '`list|save <name>|use <name>|remove <name>` — manage workspaces' },\n { names: ['/status'], area: 'operations', zh: '查看状态、上下文/token 与待处理卡', en: 'show status, context/token usage, and pending cards' },\n { names: ['/jobs'], area: 'operations', zh: '`[show <消息ID>|retry <消息ID>]` — 对账并重试任务', en: '`[show <message-id>|retry <message-id>]` — reconcile and retry jobs' },\n { names: ['/version'], area: 'operations', zh: '查看当前与最新版本', en: 'show installed and latest versions' },\n { names: ['/upgrade'], area: 'operations', zh: '检查并确认机器人自更新(管理员)', en: 'check and confirm a bot self-update (admin)' },\n { names: ['/doctor'], area: 'operations', zh: '生成脱敏诊断包(管理员)', en: 'generate a redacted diagnostic bundle (admin)' },\n { names: ['/resume'], area: 'session', zh: '查看当前会话最近上下文', en: 'show recent context for this session' },\n { names: ['/session'], area: 'session', zh: '`[current|bind <sessionId>]` — 显式绑定 DSH session', en: '`[current|bind <sessionId>]` — explicitly bind a DSH session' },\n { names: ['/stop'], area: 'operations', zh: '终止当前 scope 的任务', en: 'stop tasks in the current scope' },\n { names: ['/timeout'], area: 'operations', zh: '`[N|off|default]` — 查看或设置空闲超时', en: '`[N|off|default]` — view or set idle timeout' },\n { names: ['/concurrency'], area: 'operations', zh: '`[N|default]` — 查看或设置 scope 并行数', en: '`[N|default]` — view or set scope concurrency' },\n { names: ['/permission'], area: 'policy', zh: '`[ask|allow|deny] [scope]` — 工具权限策略', en: '`[ask|allow|deny] [scope]` — tool permission policy' },\n { names: ['/isolation'], area: 'policy', zh: '`[group|topic|member]` — 群会话隔离(设置需管理员)', en: '`[group|topic|member]` — group isolation (admin to set)' },\n { names: ['/role'], area: 'configuration', zh: '`list|show|set|clear|save|remove …` — 管理角色', en: '`list|show|set|clear|save|remove …` — manage roles' },\n { names: ['/notify'], area: 'communication', zh: '`<scope|chatId> <text>` / `list` — 跨会话通知(发送需管理员)', en: '`<scope|chatId> <text>` / `list` — cross-session notification (admin to send)' },\n { names: ['/notifications'], area: 'communication', zh: '`[show|off|on …]` — scope 提醒策略', en: '`[show|off|on …]` — scope notification policy' },\n { names: ['/replies'], area: 'communication', zh: '`[show|default|set …]` — 回复合并、频率与去重', en: '`[show|default|set …]` — reply batching, rate, and deduplication' },\n { names: ['/retention'], area: 'session', zh: '`[N|default]` — 会话保留条数', en: '`[N|default]` — retained live-message count' },\n { names: ['/archive'], area: 'session', zh: '`[note]|send|list|clean …` — 管理归档', en: '`[note]|send|list|clean …` — manage archives' },\n { names: ['/density'], area: 'configuration', zh: '`[compact|standard|detailed]` — 卡片密度', en: '`[compact|standard|detailed]` — card density' },\n { names: ['/mode', '/effort'], area: 'configuration', zh: '`[quick|balanced|deep]` — 下一轮任务强度', en: '`[quick|balanced|deep]` — next-turn execution strength' },\n { names: ['/config'], area: 'configuration', zh: '模型 / Provider / 凭据管理卡片(`/model`、`/provider(s)`、`/key` 为同一张卡片的别名)', en: 'model / provider / credential management card (`/model`, `/provider(s)`, `/key` are aliases of the same card)' },\n { names: ['/model'], area: 'configuration', zh: '`[use|default|reset|add|remove …]` — 查询与管理模型', en: '`[use|default|reset|add|remove …]` — query and manage models' },\n { names: ['/providers', '/provider'], area: 'configuration', zh: '`[add|update|remove …]` — 查询与管理 provider', en: '`[add|update|remove …]` — query and manage providers' },\n { names: ['/key'], area: 'configuration', zh: '`list|set <引用名>|remove <引用名>` — 凭据引用;值用安全表单', en: '`list|set <reference>|remove <reference>` — credential references; values use a secure form' },\n { names: ['/secret'], area: 'configuration', zh: '`status|set|remove <目标> <引用>` — 安全采集或删除密钥(管理员)', en: '`status|set|remove <target> <reference>` — securely collect or remove secrets (admin)' },\n { names: ['/language'], area: 'configuration', zh: '`show|set plain|agent <值>|reset [plain|agent|all]` — 默认语言策略(写需管理员)', en: '`show|set plain|agent <value>|reset [plain|agent|all]` — default language policy (admin writes)' },\n { names: ['/ask'], area: 'communication', zh: '`<问题>` — 发送结构化问答卡', en: '`<question>` — send a structured question card' },\n { names: ['/invite'], area: 'policy', zh: '`user|admin|group <id>` — 管理访问白名单', en: '`user|admin|group <id>` — manage access allowlists' },\n { names: ['/help'], area: 'operations', zh: '显示本帮助', en: 'show this help' },\n] as const;\n\nexport function renderCommandHelp(locale: 'zh' | 'en'): string {\n const title = locale === 'zh' ? '**dsh-lark-bot 命令**' : '**dsh-lark-bot commands**';\n return [title, '', ...COMMAND_CATALOG.map((entry) =>\n `- ${entry.names.map((name) => `\\`${name}\\``).join(' ')} — ${locale === 'zh' ? entry.zh : entry.en}`,\n )].join('\\n');\n}\n\nexport function renderSkillCommandIndex(): string {\n return COMMAND_CATALOG.map((entry) =>\n `- ${entry.names.map((name) => `\\`${name}\\``).join(' ')}: ${entry.en}`,\n ).join('\\n');\n}\n\nexport function assertCommandCatalogMatches(handlerNames: readonly string[]): void {\n const catalog = new Set(COMMAND_CATALOG.flatMap((entry) => entry.names));\n const handlers = new Set(handlerNames);\n const missingHandlers = [...catalog].filter((name) => !handlers.has(name));\n const missingCatalog = [...handlers].filter((name) => !catalog.has(name as `/${string}`));\n if (missingHandlers.length || missingCatalog.length) {\n throw new Error(\n `command catalog drift: no handler=${missingHandlers.join(',') || '(none)'}; no catalog=${missingCatalog.join(',') || '(none)'}`,\n );\n }\n}\n","import { renderSkillCommandIndex } from '../commands/catalog.js';\n\ninterface SkillRegistration {\n name: string;\n description: string;\n whenToUse?: string;\n content: string;\n source: 'runtime';\n invocation: { modelInvocable: boolean; userInvocable: boolean };\n}\n\nconst content = `# dsh-lark-bot channel operations\n\nUse this skill when the current channel context says \\`channel: dsh-lark-bot\\`, or when the user asks you to install, deploy, upgrade, diagnose, or configure this Feishu/Lark channel.\n\nBefore any change, read the current effective configuration and installed versions. Never copy example values into settings. Prefer existing dsh-lark-bot commands, dsh's official settings/credentials protocol, and registered channel tools. Re-read status after a change and explain whether it applies on the next request, new session, reconnect, or service restart.\n\nFor provider/model/settings work: inspect with \\`/config\\` (the model/provider/credential card; \\`/model\\`, \\`/provider(s)\\`, \\`/key\\` are aliases of the same card), \\`/status\\`, or dsh settings first. Support query, add, update, remove, reset-to-default, and verification. Administrator-only writes, plan approval, per-tool approval, permission policy, workspace containment, and file policy remain mandatory.\n\nFor any API key, provider credential, token, or App Secret value, never ask the user to paste it into ordinary chat and never invent a file path or configuration key. Call \\`lark_request_secret\\` with only a supported target type, a validated reference name, and a short purpose. The tool result intentionally contains only configured state—not the value. The value crosses Feishu/Lark's form transport to the local bridge but must never enter the model prompt, transcript, jobs, archive, logs, diagnostic bundle, or response.\n\nLanguage policy has three distinct layers: Card UI is per-viewer; plain fallback is bilingual/Chinese/English; agent final answers are auto/Chinese/English. Use \\`/language\\` to inspect it and require an administrator for global changes.\n\nGuardian/safe mode is a degraded recovery surface and cannot claim full channel configuration or secure-secret tooling unless the live context explicitly advertises it.\n\n## Command index (generated from the same registry as /help)\n\n${renderSkillCommandIndex()}\n\n## Operational surfaces\n\n- Installation and lifecycle: \\`setup\\`, \\`upgrade\\`, \\`doctor\\`, \\`service install|start|status|logs|restart|stop|uninstall\\`, and \\`guardian install|status|logs|restart|stop|uninstall\\`.\n- Configuration: dsh Web settings for common bridge fields; official \\`settings.yaml\\` for providers/models/default route; owner-only \\`.credentials.yaml\\` through the secure secret seam for values.\n- Sessions/workspaces: /new, /cd, /ws, /session, /resume, /retention, /archive, /timeout, /concurrency, /stop.\n- Policy/collaboration: /permission, /isolation, /role, /invite, /notify, /notifications, /replies.\n`;\n\nexport const DSH_LARK_BOT_SKILL: SkillRegistration = {\n name: 'dsh-lark-bot',\n description: 'Operate and safely self-configure the active dsh-lark-bot Feishu/Lark channel.',\n whenToUse: 'Use for channel identity, setup, upgrade, deployment, diagnostics, provider/model/credential/language configuration, or command discovery.',\n content,\n source: 'runtime',\n invocation: { modelInvocable: true, userInvocable: true },\n};\n\nexport function registerDshLarkBotSkill(registry: { register(skill: SkillRegistration): () => void }): () => void {\n return registry.register(DSH_LARK_BOT_SKILL);\n}\n","import type { Context } from '@deepseek-ai/cordis';\nimport { registerDshLarkBotSkill } from './dsh-lark-bot.js';\n\n/** Cordis plugin name; referenced by the runtime patch row. */\nexport const name = 'lark-skill';\n\n/** Requires the dsh skill registry before registering. */\nexport const inject = ['skills'];\n\nexport interface Config {\n /** Reserved for future per-session skill configuration. */\n enabled?: boolean;\n}\n\n/**\n * dsh skill that exposes the dsh-lark-bot channel operations guide to the\n * agent session's model-invocable skill catalog — the one the `skill` tool\n * reads (`ctx.skills.list({ scope: agent })`).\n *\n * The bridge engine registers the same skill on its own cordis context (see\n * `plugin.ts`), but that context is never what the model reads. This plugin\n * registers it on the agent runtime's context, so `skill(\"dsh-lark-bot\")`\n * resolves in a live SDK session.\n *\n * This entry is intentionally dependency-free (only the `skills` service) so\n * it can also load in the guardian's core-only safe profile.\n */\nexport function apply(ctx: Context) {\n const registry = (\n ctx as unknown as {\n skills?: Parameters<typeof registerDshLarkBotSkill>[0];\n }\n ).skills;\n if (!registry) return;\n const disposeSkill = registerDshLarkBotSkill(registry);\n ctx.effect(() => disposeSkill);\n}\n"],"mappings":";AAOO,IAAM,kBAAgD;AAAA,EAC3D,EAAE,OAAO,CAAC,QAAQ,QAAQ,GAAG,MAAM,WAAW,IAAI,kCAAS,IAAI,sBAAsB;AAAA,EACrF,EAAE,OAAO,CAAC,OAAO,GAAG,MAAM,WAAW,IAAI,8FAAwB,IAAI,kEAA6D;AAAA,EAClI,EAAE,OAAO,CAAC,KAAK,GAAG,MAAM,aAAa,IAAI,sFAA0B,IAAI,sEAA4D;AAAA,EACnI,EAAE,OAAO,CAAC,KAAK,GAAG,MAAM,aAAa,IAAI,2FAAwD,IAAI,uEAAkE;AAAA,EACvK,EAAE,OAAO,CAAC,SAAS,GAAG,MAAM,cAAc,IAAI,yFAAwB,IAAI,sDAAsD;AAAA,EAChI,EAAE,OAAO,CAAC,OAAO,GAAG,MAAM,cAAc,IAAI,sGAA0C,IAAI,2EAAsE;AAAA,EAChK,EAAE,OAAO,CAAC,UAAU,GAAG,MAAM,cAAc,IAAI,0DAAa,IAAI,qCAAqC;AAAA,EACrG,EAAE,OAAO,CAAC,UAAU,GAAG,MAAM,cAAc,IAAI,oGAAoB,IAAI,8CAA8C;AAAA,EACrH,EAAE,OAAO,CAAC,SAAS,GAAG,MAAM,cAAc,IAAI,4EAAgB,IAAI,gDAAgD;AAAA,EAClH,EAAE,OA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AA,EACN,aAAa;AAAA,EACb,WAAW;AAAA,EACX;AAAA,EACA,QAAQ;AAAA,EACR,YAAY,EAAE,gBAAgB,MAAM,eAAe,KAAK;AAC1D;AAEO,SAAS,wBAAwB,UAA0E;AAChH,SAAO,SAAS,SAAS,kBAAkB;AAC7C;;;AC5CO,IAAM,OAAO;AAGb,IAAM,SAAS,CAAC,QAAQ;AAoBxB,SAAS,MAAM,KAAc;AAClC,QAAM,WACJ,IAGA;AACF,MAAI,CAAC,SAAU;AACf,QAAM,eAAe,wBAAwB,QAAQ;AACrD,MAAI,OAAO,MAAM,YAAY;AAC/B;","names":["name"]}
|
|
1
|
+
{"version":3,"sources":["../src/commands/catalog.ts","../src/skill/dsh-lark-bot.ts","../src/skill/index.ts"],"sourcesContent":["export interface CommandDefinition {\n names: readonly [`/${string}`, ...Array<`/${string}`>];\n zh: string;\n en: string;\n area: 'session' | 'workspace' | 'operations' | 'policy' | 'configuration' | 'communication';\n}\n\nexport const COMMAND_CATALOG: readonly CommandDefinition[] = [\n { names: ['/new', '/reset'], area: 'session', zh: '开始新会话', en: 'start a new session' },\n { names: ['/newg'], area: 'session', zh: '`<群名>` — 新建群聊并开始独立会话', en: '`<name>` — create a group and start an independent session' },\n { names: ['/cd'], area: 'workspace', zh: '`<path>` — 切换到该目录的独立会话', en: '`<path>` — switch to that directory’s independent session' },\n { names: ['/ws'], area: 'workspace', zh: '`list|save <name>|use <name>|remove <name>` — 管理工作空间', en: '`list|save <name>|use <name>|remove <name>` — manage workspaces' },\n { names: ['/status'], area: 'operations', zh: '查看状态、上下文/token 与待处理卡', en: 'show status, context/token usage, and pending cards' },\n { names: ['/jobs'], area: 'operations', zh: '`[show <消息ID>|retry <消息ID>]` — 对账并重试任务', en: '`[show <message-id>|retry <message-id>]` — reconcile and retry jobs' },\n { names: ['/version'], area: 'operations', zh: '查看当前与最新版本', en: 'show installed and latest versions' },\n { names: ['/upgrade'], area: 'operations', zh: '检查并确认机器人自更新(管理员)', en: 'check and confirm a bot self-update (admin)' },\n { names: ['/doctor'], area: 'operations', zh: '生成脱敏诊断包(管理员)', en: 'generate a redacted diagnostic bundle (admin)' },\n { names: ['/resume'], area: 'session', zh: '查看当前会话最近上下文', en: 'show recent context for this session' },\n { names: ['/session'], area: 'session', zh: '`[current|bind <sessionId>]` — 显式绑定 DSH session', en: '`[current|bind <sessionId>]` — explicitly bind a DSH session' },\n { names: ['/stop'], area: 'operations', zh: '终止当前 scope 的任务', en: 'stop tasks in the current scope' },\n { names: ['/timeout'], area: 'operations', zh: '`[N|off|default]` — 查看或设置空闲超时', en: '`[N|off|default]` — view or set idle timeout' },\n { names: ['/concurrency'], area: 'operations', zh: '`[N|default]` — 查看或设置 scope 并行数', en: '`[N|default]` — view or set scope concurrency' },\n { names: ['/permission'], area: 'policy', zh: '`[ask|allow|deny] [scope]` — 工具权限策略', en: '`[ask|allow|deny] [scope]` — tool permission policy' },\n { names: ['/isolation'], area: 'policy', zh: '`[group|topic|member]` — 群会话隔离(设置需管理员)', en: '`[group|topic|member]` — group isolation (admin to set)' },\n { names: ['/role'], area: 'configuration', zh: '`list|show|set|clear|save|remove …` — 管理角色', en: '`list|show|set|clear|save|remove …` — manage roles' },\n { names: ['/notify'], area: 'communication', zh: '`<scope|chatId> <text>` / `list` — 跨会话通知(发送需管理员)', en: '`<scope|chatId> <text>` / `list` — cross-session notification (admin to send)' },\n { names: ['/notifications'], area: 'communication', zh: '`[show|off|on …]` — scope 提醒策略(支持 `sinks=`)', en: '`[show|off|on …]` — scope notification policy (supports `sinks=`)' },\n { names: ['/channels'], area: 'configuration', zh: '`list|show|add|remove|enable|disable …` — 管理出站通知渠道(管理员)', en: '`list|show|add|remove|enable|disable …` — manage outbound notification channels (admin)' },\n { names: ['/replies'], area: 'communication', zh: '`[show|default|set …]` — 回复合并、频率与去重', en: '`[show|default|set …]` — reply batching, rate, and deduplication' },\n { names: ['/retention'], area: 'session', zh: '`[N|default]` — 会话保留条数', en: '`[N|default]` — retained live-message count' },\n { names: ['/archive'], area: 'session', zh: '`[note]|send|list|clean …` — 管理归档', en: '`[note]|send|list|clean …` — manage archives' },\n { names: ['/density'], area: 'configuration', zh: '`[compact|standard|detailed]` — 卡片密度', en: '`[compact|standard|detailed]` — card density' },\n { names: ['/mode', '/effort'], area: 'configuration', zh: '`[quick|balanced|deep]` — 下一轮任务强度', en: '`[quick|balanced|deep]` — next-turn execution strength' },\n { names: ['/config'], area: 'configuration', zh: '模型 / Provider / 凭据管理卡片(`/model`、`/provider(s)`、`/key` 为同一张卡片的别名)', en: 'model / provider / credential management card (`/model`, `/provider(s)`, `/key` are aliases of the same card)' },\n { names: ['/model'], area: 'configuration', zh: '`[use|default|reset|add|remove …]` — 查询与管理模型', en: '`[use|default|reset|add|remove …]` — query and manage models' },\n { names: ['/providers', '/provider'], area: 'configuration', zh: '`[add|update|remove …]` — 查询与管理 provider', en: '`[add|update|remove …]` — query and manage providers' },\n { names: ['/key'], area: 'configuration', zh: '`list|set <引用名>|remove <引用名>` — 凭据引用;值用安全表单', en: '`list|set <reference>|remove <reference>` — credential references; values use a secure form' },\n { names: ['/secret'], area: 'configuration', zh: '`status|set|remove <目标> <引用>` — 安全采集或删除密钥(管理员)', en: '`status|set|remove <target> <reference>` — securely collect or remove secrets (admin)' },\n { names: ['/language'], area: 'configuration', zh: '`show|set plain|agent <值>|reset [plain|agent|all]` — 默认语言策略(写需管理员)', en: '`show|set plain|agent <value>|reset [plain|agent|all]` — default language policy (admin writes)' },\n { names: ['/ask'], area: 'communication', zh: '`<问题>` — 发送结构化问答卡', en: '`<question>` — send a structured question card' },\n { names: ['/invite'], area: 'policy', zh: '`user|admin|group <id>` — 管理访问白名单', en: '`user|admin|group <id>` — manage access allowlists' },\n { names: ['/help'], area: 'operations', zh: '显示本帮助', en: 'show this help' },\n] as const;\n\nexport function renderCommandHelp(locale: 'zh' | 'en'): string {\n const title = locale === 'zh' ? '**dsh-lark-bot 命令**' : '**dsh-lark-bot commands**';\n return [title, '', ...COMMAND_CATALOG.map((entry) =>\n `- ${entry.names.map((name) => `\\`${name}\\``).join(' ')} — ${locale === 'zh' ? entry.zh : entry.en}`,\n )].join('\\n');\n}\n\nexport function renderSkillCommandIndex(): string {\n return COMMAND_CATALOG.map((entry) =>\n `- ${entry.names.map((name) => `\\`${name}\\``).join(' ')}: ${entry.en}`,\n ).join('\\n');\n}\n\nexport function assertCommandCatalogMatches(handlerNames: readonly string[]): void {\n const catalog = new Set(COMMAND_CATALOG.flatMap((entry) => entry.names));\n const handlers = new Set(handlerNames);\n const missingHandlers = [...catalog].filter((name) => !handlers.has(name));\n const missingCatalog = [...handlers].filter((name) => !catalog.has(name as `/${string}`));\n if (missingHandlers.length || missingCatalog.length) {\n throw new Error(\n `command catalog drift: no handler=${missingHandlers.join(',') || '(none)'}; no catalog=${missingCatalog.join(',') || '(none)'}`,\n );\n }\n}\n","import { renderSkillCommandIndex } from '../commands/catalog.js';\n\ninterface SkillRegistration {\n name: string;\n description: string;\n whenToUse?: string;\n content: string;\n source: 'runtime';\n invocation: { modelInvocable: boolean; userInvocable: boolean };\n}\n\nconst content = `# dsh-lark-bot channel operations\n\nUse this skill when the current channel context says \\`channel: dsh-lark-bot\\`, or when the user asks you to install, deploy, upgrade, diagnose, or configure this Feishu/Lark channel.\n\nBefore any change, read the current effective configuration and installed versions. Never copy example values into settings. Prefer existing dsh-lark-bot commands, dsh's official settings/credentials protocol, and registered channel tools. Re-read status after a change and explain whether it applies on the next request, new session, reconnect, or service restart.\n\nFor provider/model/settings work: inspect with \\`/config\\` (the model/provider/credential card; \\`/model\\`, \\`/provider(s)\\`, \\`/key\\` are aliases of the same card), \\`/status\\`, or dsh settings first. Support query, add, update, remove, reset-to-default, and verification. Administrator-only writes, plan approval, per-tool approval, permission policy, workspace containment, and file policy remain mandatory.\n\nFor any API key, provider credential, token, or App Secret value, never ask the user to paste it into ordinary chat and never invent a file path or configuration key. Call \\`lark_request_secret\\` with only a supported target type, a validated reference name, and a short purpose. The tool result intentionally contains only configured state—not the value. The value crosses Feishu/Lark's form transport to the local bridge but must never enter the model prompt, transcript, jobs, archive, logs, diagnostic bundle, or response.\n\nLanguage policy has three distinct layers: Card UI is per-viewer; plain fallback is bilingual/Chinese/English; agent final answers are auto/Chinese/English. Use \\`/language\\` to inspect it and require an administrator for global changes.\n\nGuardian/safe mode is a degraded recovery surface and cannot claim full channel configuration or secure-secret tooling unless the live context explicitly advertises it.\n\n## Command index (generated from the same registry as /help)\n\n${renderSkillCommandIndex()}\n\n## Operational surfaces\n\n- Installation and lifecycle: \\`setup\\`, \\`upgrade\\`, \\`doctor\\`, \\`service install|start|status|logs|restart|stop|uninstall\\`, and \\`guardian install|status|logs|restart|stop|uninstall\\`.\n- Configuration: dsh Web settings for common bridge fields; official \\`settings.yaml\\` for providers/models/default route; owner-only \\`.credentials.yaml\\` through the secure secret seam for values.\n- Sessions/workspaces: /new, /cd, /ws, /session, /resume, /retention, /archive, /timeout, /concurrency, /stop.\n- Policy/collaboration: /permission, /isolation, /role, /invite, /notify, /notifications, /replies.\n`;\n\nexport const DSH_LARK_BOT_SKILL: SkillRegistration = {\n name: 'dsh-lark-bot',\n description: 'Operate and safely self-configure the active dsh-lark-bot Feishu/Lark channel.',\n whenToUse: 'Use for channel identity, setup, upgrade, deployment, diagnostics, provider/model/credential/language configuration, or command discovery.',\n content,\n source: 'runtime',\n invocation: { modelInvocable: true, userInvocable: true },\n};\n\nexport function registerDshLarkBotSkill(registry: { register(skill: SkillRegistration): () => void }): () => void {\n return registry.register(DSH_LARK_BOT_SKILL);\n}\n","import type { Context } from '@deepseek-ai/cordis';\nimport { registerDshLarkBotSkill } from './dsh-lark-bot.js';\n\n/** Cordis plugin name; referenced by the runtime patch row. */\nexport const name = 'lark-skill';\n\n/** Requires the dsh skill registry before registering. */\nexport const inject = ['skills'];\n\nexport interface Config {\n /** Reserved for future per-session skill configuration. */\n enabled?: boolean;\n}\n\n/**\n * dsh skill that exposes the dsh-lark-bot channel operations guide to the\n * agent session's model-invocable skill catalog — the one the `skill` tool\n * reads (`ctx.skills.list({ scope: agent })`).\n *\n * The bridge engine registers the same skill on its own cordis context (see\n * `plugin.ts`), but that context is never what the model reads. This plugin\n * registers it on the agent runtime's context, so `skill(\"dsh-lark-bot\")`\n * resolves in a live SDK session.\n *\n * This entry is intentionally dependency-free (only the `skills` service) so\n * it can also load in the guardian's core-only safe profile.\n */\nexport function apply(ctx: Context) {\n const registry = (\n ctx as unknown as {\n skills?: Parameters<typeof registerDshLarkBotSkill>[0];\n }\n ).skills;\n if (!registry) return;\n const disposeSkill = registerDshLarkBotSkill(registry);\n ctx.effect(() => disposeSkill);\n}\n"],"mappings":";AAOO,IAAM,kBAAgD;AAAA,EAC3D,EAAE,OAAO,CAAC,QAAQ,QAAQ,GAAG,MAAM,WAAW,IAAI,kCAAS,IAAI,sBAAsB;AAAA,EACrF,EAAE,OAAO,CAAC,OAAO,GAAG,MAAM,WAAW,IAAI,8FAAwB,IAAI,kEAA6D;AAAA,EAClI,EAAE,OAAO,CAAC,KAAK,GAAG,MAAM,aAAa,IAAI,sFAA0B,IAAI,sEAA4D;AAAA,EACnI,EAAE,OAAO,CAAC,KAAK,GAAG,MAAM,aAAa,IAAI,2FAAwD,IAAI,uEAAkE;AAAA,EACvK,EAAE,OAAO,CAAC,SAAS,GAAG,MAAM,cAAc,IAAI,yFAAwB,IAAI,sDAAsD;AAAA,EAChI,EAAE,OAAO,CAAC,OAAO,GAAG,MAAM,cAAc,IAAI,sGAA0C,IAAI,2EAAsE;AAAA,EAChK,EAAE,OAAO,CAAC,UAAU,GAAG,MAAM,cAAc,IAAI,0DAAa,IAAI,qCAAqC;AAAA,EACrG,EAAE,OAAO,CAAC,UAAU,GAAG,MAAM,cAAc,IAAI,oGAAoB,IAAI,8CAA8C;AAAA,EACrH,EAAE,OAAO,CAAC,SAAS,GAAG,MAAM,cAAc,IAAI,4EAAgB,IAAI,gDAAgD;AAAA,EAClH,EAAE,OAAO,CAAC,SAAS,GAAG,MAAM,WAA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;AAAA;AAAA;AAUpB,IAAM,qBAAwC;AAAA,EACnD,MAAM;AAAA,EACN,aAAa;AAAA,EACb,WAAW;AAAA,EACX;AAAA,EACA,QAAQ;AAAA,EACR,YAAY,EAAE,gBAAgB,MAAM,eAAe,KAAK;AAC1D;AAEO,SAAS,wBAAwB,UAA0E;AAChH,SAAO,SAAS,SAAS,kBAAkB;AAC7C;;;AC5CO,IAAM,OAAO;AAGb,IAAM,SAAS,CAAC,QAAQ;AAoBxB,SAAS,MAAM,KAAc;AAClC,QAAM,WACJ,IAGA;AACF,MAAI,CAAC,SAAU;AACf,QAAM,eAAe,wBAAwB,QAAQ;AACrD,MAAI,OAAO,MAAM,YAAY;AAC/B;","names":["name"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-lark-bot",
|
|
3
|
-
"version": "0.19.
|
|
3
|
+
"version": "0.19.13",
|
|
4
4
|
"description": "把 DeepSeek Harness (dsh) 装进飞书/Lark 的 bot,扫码即用:dsh Web 可视化设置、流式卡片、项目工作区、并行任务、多角色 Agent、安全网守护。| Bridge DeepSeek Harness into Feishu/Lark with visual dsh Web settings, streaming cards, workspaces, parallel tasks, roles and a safety-net guardian.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"packageManager": "pnpm@10.33.0",
|