test(feishu): replay embedded lark-cli skills in a session snapshot

Load lark-doc and read one embedded reference through a stand-in
lark-cli on the private Shell PATH, pinning the prepended DSH guidance
in the recorded skill result.
This commit is contained in:
gengruilin committed 2026-10-06 00:30:24 +08:00
1 parent 4ffef092ca
commit 8d3377c226
7 files changed
+116

No files matched your search

+1
View File
@@ -240,6 +240,7 @@
"@deepseek-ai/dsh-experimental-computer-use-cua-driver-native": "workspace:*",
"@deepseek-ai/dsh-cua": "workspace:*",
"@deepseek-ai/dsh-experimental-claude-code-mods": "workspace:*",
"@deepseek-ai/dsh-feishu": "workspace:*",
"@deepseek-ai/dsh-llm-replay": "workspace:*",
"@deepseek-ai/dsh-subagent-dsh-sdk": "workspace:*",
"@deepseek-ai/dsh-llm": "workspace:*",
+3
View File
@@ -90,6 +90,9 @@ importers:
'@deepseek-ai/dsh-experimental-worktree':
specifier: workspace:*
version: link:packages/experimental/worktree
'@deepseek-ai/dsh-feishu':
specifier: workspace:*
version: link:packages/connector/feishu
'@deepseek-ai/dsh-hooks-claude-code':
specifier: workspace:*
version: link:packages/experimental/hooks-claude-code
@@ -0,0 +1,51 @@
# Replay patch shared by the ordinary headless snapshot composition. The model
# script comes from the scenario's committed session JSONL.
- id: llm-deepseek
name: '@deepseek-ai/dsh-llm-deepseek-api-key'
disabled: true
- id: plugin-package-inventory-deepseek
disabled: true
- id: session-title-llm
disabled: true
- id: session-persistence-jsonl
name: '@deepseek-ai/dsh-session-persistence-jsonl'
config:
root: !!js dshHomePath('sessions')
compression: none
- id: sandbox
name: '@deepseek-ai/dsh-sandbox-local'
config:
runnerCommand:
- bash
- -c
- while [ "$1" != "--" ]; do shift; done; shift; exec "$@"
- passthrough-runner
runnerFailureSignatures:
- 'passthrough-runner: profile rejected'
- insert:
- id: llm-replay
name: '@deepseek-ai/dsh-llm-replay'
config:
providers:
- id: deepseek-official
name: DeepSeek
models:
- id: deepseek-v4-flash
- id: deepseek-v4-pro
- id: deepseek-messages
name: DeepSeek Messages
models:
- id: deepseek-v4-flash
- id: deepseek-v4-pro
- insert:
- id: feishu
name: '@deepseek-ai/dsh-feishu'
config:
binDir: !!js process.cwd() + '/feishu-bin'
@@ -0,0 +1,5 @@
- insert:
- id: feishu
name: '@deepseek-ai/dsh-feishu'
config:
binDir: !!js process.cwd() + '/feishu-bin'
@@ -0,0 +1,28 @@
{"type":"session","version":4,"id":"{{session:1}}","createdAt":1783654655599,"cwd":"{{cwd}}","isSeeded":false,"delegationDepth":0}
{"type":"permission/preset","data":{"preset":"danger-full-access"}}
{"type":"sandbox/mode","data":{"mode":"danger-full-access"}}
{"type":"approval/policy","data":{"policy":"never"}}
{"type":"agent/inbox/spliced","data":{"target":"next-turn","start":0,"inserted":[{"content":[{"type":"text","text":"Load the lark-doc skill, read its references/lark-doc-fetch.md through lark-cli, then reply DONE."}],"source":{"kind":"user"},"role":"user","id":"{{message:1}}"}]}}
{"type":"turn/start","data":{"turn":1}}
{"type":"agent/inbox/spliced","data":{"target":"next-turn","start":0,"removedCount":1,"inserted":[]}}
{"type":"step/start","data":{"turn":1,"step":1}}
{"type":"system/message","data":{"turn":1,"step":1,"message":{"role":"system","content":[{"type":"text","text":"{{system}}"}],"source":{"kind":"system-prompt"},"id":"{{message:2}}"}},"surfaceOp":"append"}
{"type":"user/message","data":{"content":[{"type":"text","text":"Load the lark-doc skill, read its references/lark-doc-fetch.md through lark-cli, then reply DONE."}],"source":{"kind":"user"},"role":"user","id":"{{message:1}}"},"surfaceOp":"append"}
{"type":"user/message","data":{"content":[{"type":"text","text":"Current runtime context. This snapshot supersedes earlier runtime-context snapshots.\n\nCurrent DSH file policy: danger-full-access. The DSH file sandbox does not restrict file modifications by available operations.\n\nApproval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`)."}],"source":{"kind":"runtime-context","form":"snapshot","sections":[{"name":"sandbox:policy","text":"Current DSH file policy: danger-full-access. The DSH file sandbox does not restrict file modifications by available operations."},{"name":"approval:policy","text":"Approval prompts are disabled in this session: actions that require approval are rejected automatically — do not request sandbox escalation (do not set `sandbox_permissions`)."}]},"role":"user","id":"{{message:3}}"},"surfaceOp":"append"}
{"type":"user/message","data":{"content":[{"type":"text","text":"<system-reminder>\nA skill is a reusable set of task-specific instructions. The following skills are available in this session:\n\n<available_skills>\n- `lark-doc`: Read and edit Feishu documents.\n</available_skills>\n\nIf the user names a skill, or the task clearly matches a skill's description, call the `skill` tool with the exact skill name before taking task actions. Load all applicable skills, then follow their full instructions. This catalog contains summaries only; do not infer or follow a skill's instructions until it has been loaded.\nA user may also invoke a skill directly; its <skill_content> block then appears in this conversation. Follow it, and do not call the `skill` tool again for that skill.\n</system-reminder>"}],"source":{"kind":"skill-catalog","form":"catalog","entries":[{"name":"lark-doc","description":"Read and edit Feishu documents."}]},"role":"user","id":"{{message:4}}"},"surfaceOp":"append"}
{"type":"request/header","data":{"header":{"config":{"provider":"deepseek-official","model":"deepseek-v4-flash"},"tools":"{{tools}}"},"reason":"initial"}}
{"type":"request/context","data":{"provider":"deepseek-official","model":"deepseek-v4-flash"}}
{"type":"session/title","data":{"title":"Load the lark-doc skill, read","messageSeqs":[8],"source":{"kind":"fallback"}}}
{"type":"assistant/message","data":{"turn":1,"step":1,"message":{"role":"assistant","content":[{"type":"reasoning","text":"Load the requested Feishu skill."},{"type":"tool-call","id":"call_feishu_skill","name":"skill","arguments":"{\"name\":\"lark-doc\"}"}],"source":{"kind":"model","provider":"deepseek-official","model":"deepseek-v4-flash"},"id":"{{message:5}}"},"usage":{"inputTokens":100,"outputTokens":20,"cacheReadTokens":0,"reasoningTokens":5},"stream":[{"type":"chunk","time":1788699430688,"chunk":{"type":"block-start","index":0,"blockType":"reasoning"}},{"type":"reasoning-chunks","time0":1788699430688,"index":0,"dt":[],"texts":["Load the requested Feishu skill."]},{"type":"chunk","time":1788699430688,"chunk":{"type":"block-start","index":1,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":1788699430688,"index":1,"dt":[],"id":"call_feishu_skill","name":"skill","args":["{\"name\":\"lark-doc\"}"]},{"type":"chunk","time":1788699430688,"chunk":{"type":"block-end","index":0,"block":{"type":"reasoning","text":"Load the requested Feishu skill."}}},{"type":"chunk","time":1788699430688,"chunk":{"type":"block-end","index":1,"block":{"type":"tool-call","id":"call_feishu_skill","name":"skill","arguments":"{\"name\":\"lark-doc\"}"}}},{"type":"chunk","time":1788699430688,"chunk":{"type":"usage","usage":{"inputTokens":100,"outputTokens":20,"cacheReadTokens":0,"reasoningTokens":5}}},{"type":"chunk","time":1788699430688,"chunk":{"type":"finish","reason":{"kind":"tool-calls"}}}]},"surfaceOp":"append"}
{"type":"tool/call","data":{"turn":1,"step":1,"callId":"call_feishu_skill","name":"skill","arguments":"{\"name\":\"lark-doc\"}"}}
{"type":"tool/result","data":{"turn":1,"step":1,"message":{"role":"tool","source":{"kind":"tool","callId":"call_feishu_skill"},"toolCallId":"call_feishu_skill","content":[{"type":"text","text":"<skill_content name=\"lark-doc\">\n<skill_resources>\nResources for this skill: Embedded lark-cli references; use the skills read command given in the loaded skill.\nLoad referenced resources only as needed.\n</skill_resources>\n\n<skill_instructions>\n# Feishu in DSH\n\nCall this integration the Feishu plugin (飞书插件 in Chinese) in user-facing replies. Run `lark-cli` by name in the Host Shell; DSH installs and updates it. It uses the default lark-cli configuration and sign-in shared with the user's own terminal, so do not remove, switch, or sign out of apps or profiles unless the user asks.\n\nWhen a command reports a missing app configuration or sign-in, load the lark-shared skill and follow its setup and auth flow. Never ask for or print app secrets or tokens.\n\nCommands that save sign-in state, such as `auth login --device-code` and `config init`, write outside the workspace and use up their one-time authorization even when the save is denied: run them with the Shell tool's single-command approval from the start. Run other commands in the existing sandbox and request that approval only when a credential, lock, log, or cache write is denied.\n\nDo not install another lark-cli or run `lark-cli update`.\n\n# docs\n\nRead references/lark-doc-fetch.md before fetching a document.\n\n> Tip: read this skill's own files (e.g. `references/...`) with `lark-cli skills read lark-doc <relative-path>` to keep them in sync with this CLI version.\n</skill_instructions>\n</skill_content>"}],"isError":false,"id":"{{message:6}}"}},"sourceEventSeqs":[15],"surfaceOp":"append"}
{"type":"step/end","data":{"turn":1,"step":1}}
{"type":"step/start","data":{"turn":1,"step":2}}
{"type":"assistant/message","data":{"turn":1,"step":2,"message":{"role":"assistant","content":[{"type":"reasoning","text":"Read the referenced file through lark-cli."},{"type":"tool-call","id":"call_feishu_reference","name":"bash","arguments":"{\"command\":\"lark-cli skills read lark-doc references/lark-doc-fetch.md\",\"description\":\"Read the lark-doc fetch reference\"}"}],"source":{"kind":"model","provider":"deepseek-official","model":"deepseek-v4-flash"},"id":"{{message:7}}"},"usage":{"inputTokens":200,"outputTokens":20,"cacheReadTokens":0,"reasoningTokens":5},"stream":[{"type":"chunk","time":1788699430688,"chunk":{"type":"block-start","index":0,"blockType":"reasoning"}},{"type":"reasoning-chunks","time0":1788699430688,"index":0,"dt":[],"texts":["Read the referenced file through lark-cli."]},{"type":"chunk","time":1788699430688,"chunk":{"type":"block-start","index":1,"blockType":"tool-call"}},{"type":"tool-call-chunks","time0":1788699430688,"index":1,"dt":[],"id":"call_feishu_reference","name":"bash","args":["{\"command\":\"lark-cli skills read lark-doc references/lark-doc-fetch.md\",\"description\":\"Read the lark-doc fetch reference\"}"]},{"type":"chunk","time":1788699430688,"chunk":{"type":"block-end","index":0,"block":{"type":"reasoning","text":"Read the referenced file through lark-cli."}}},{"type":"chunk","time":1788699430688,"chunk":{"type":"block-end","index":1,"block":{"type":"tool-call","id":"call_feishu_reference","name":"bash","arguments":"{\"command\":\"lark-cli skills read lark-doc references/lark-doc-fetch.md\",\"description\":\"Read the lark-doc fetch reference\"}"}}},{"type":"chunk","time":1788699430688,"chunk":{"type":"usage","usage":{"inputTokens":200,"outputTokens":20,"cacheReadTokens":0,"reasoningTokens":5}}},{"type":"chunk","time":1788699430688,"chunk":{"type":"finish","reason":{"kind":"tool-calls"}}}]},"surfaceOp":"append"}
{"type":"tool/call","data":{"turn":1,"step":2,"callId":"call_feishu_reference","name":"bash","arguments":"{\"command\":\"lark-cli skills read lark-doc references/lark-doc-fetch.md\",\"description\":\"Read the lark-doc fetch reference\"}"}}
{"type":"tool/result","data":{"turn":1,"step":2,"message":{"role":"tool","source":{"kind":"tool","callId":"call_feishu_reference"},"toolCallId":"call_feishu_reference","content":[{"type":"text","text":"# docs +fetch\n\nlark-cli docs +fetch --doc <url>\n"}],"isError":false,"id":"{{message:8}}"}},"sourceEventSeqs":[20],"surfaceOp":"append"}
{"type":"step/end","data":{"turn":1,"step":2}}
{"type":"step/start","data":{"turn":1,"step":3}}
{"type":"assistant/message","data":{"turn":1,"step":3,"message":{"role":"assistant","content":[{"type":"reasoning","text":"The reference is read."},{"type":"text","text":"DONE"}],"source":{"kind":"model","provider":"deepseek-official","model":"deepseek-v4-flash"},"id":"{{message:9}}"},"usage":{"inputTokens":300,"outputTokens":10,"cacheReadTokens":0,"reasoningTokens":4},"stream":[{"type":"chunk","time":1788699430688,"chunk":{"type":"block-start","index":0,"blockType":"reasoning"}},{"type":"reasoning-chunks","time0":1788699430688,"index":0,"dt":[],"texts":["The reference is read."]},{"type":"chunk","time":1788699430688,"chunk":{"type":"block-start","index":1,"blockType":"text"}},{"type":"text-chunks","time0":1788699430688,"index":1,"dt":[],"texts":["DONE"]},{"type":"chunk","time":1788699430688,"chunk":{"type":"block-end","index":0,"block":{"type":"reasoning","text":"The reference is read."}}},{"type":"chunk","time":1788699430688,"chunk":{"type":"block-end","index":1,"block":{"type":"text","text":"DONE"}}},{"type":"chunk","time":1788699430688,"chunk":{"type":"usage","usage":{"inputTokens":300,"outputTokens":10,"cacheReadTokens":0,"reasoningTokens":4}}},{"type":"chunk","time":1788699430688,"chunk":{"type":"finish","reason":{"kind":"stop"}}}]},"surfaceOp":"append"}
{"type":"step/end","data":{"turn":1,"step":3}}
{"type":"turn/end","data":{"turn":1,"reason":{"kind":"completed"}}}
@@ -0,0 +1,10 @@
version: 1
scenario: feishu-skills
profile: headless
composition: feishu-skills
recording: authored
platform: posix
header:
class: skill
pin: true
toolSchemasSource: text-turn
@@ -0,0 +1,18 @@
#!/usr/bin/env node
// Offline lark-cli stand-in serving one embedded skill, its JSON envelope, and one reference.
const replies = {
'skills list --json': { ok: true, skills: [{ name: 'lark-doc', description: 'Read and edit Feishu documents.', version: '1.0.0' }] },
'skills read lark-doc --json': {
skill: 'lark-doc',
path: 'SKILL.md',
content: '---\nname: lark-doc\ndescription: Read and edit Feishu documents.\n---\n\n# docs\n\nRead references/lark-doc-fetch.md before fetching a document.\n',
guidance: "> Tip: read this skill's own files (e.g. `references/...`) with `lark-cli skills read lark-doc <relative-path>` to keep them in sync with this CLI version.",
},
'skills read lark-doc references/lark-doc-fetch.md': '# docs +fetch\n\nlark-cli docs +fetch --doc <url>',
}
const reply = replies[process.argv.slice(2).join(' ')]
if (reply === undefined) {
process.stderr.write(`unexpected lark-cli arguments: ${process.argv.slice(2).join(' ')}\n`)
process.exit(1)
}
process.stdout.write(`${typeof reply === 'string' ? reply : JSON.stringify(reply)}\n`)