Skip to content

A team of long-lived bots for DeepSeek Harness, with main bots, bot-to-bot messages and group chats.

Add an approval request to the mock model's group turns

Fei241192ee542d59cf
diff --git a/ds-bot/dev/mock-llm.mjs b/ds-bot/dev/mock-llm.mjs
index 87c10a7a..ccf34834 100644
--- a/ds-bot/dev/mock-llm.mjs
+++ b/ds-bot/dev/mock-llm.mjs
@@ -28,6 +28,7 @@
// Commands in a group:
// 把X拉进群 · 把X踢出群 · 群名改成X · 讨论 (admin @all) · 私聊聊了啥 (repeats the briefing)
// 查私聊 关键词 (read_own_chat) · 长文 N · 上下文里有 词 · 撑爆 · 报错 [名] (that member's call, or every member's, fails with 401)
+// 提权 (members other than the admin run a shell command that asks for full access)
// A handoff turn answers "第 N 段接着做完了". Handoff notes and backend compaction each
// return a full eight-section note marked "handoff 提示词" or "backend 提示词" (a Bot's
// Session should only see the former; retries add "重试", merges add "合并了上一份笔记").
@@ -75,6 +76,7 @@ const tool = (name, input) => ({
: input,
})
const think = value => ({ type: 'thinking', thinking: value })
+const ESCALATION = '提权测试:用户在群里要求'
// Deterministic filler that grows a conversation by about `chars` characters.
const filler = (chars, tag) => Array.from({ length: Math.ceil(chars / 20) }, (_, index) => `${tag}第${index + 1}段:这是一段用来撑长上下文的测试文字。`).join('').slice(0, chars)
const isResults = message => Array.isArray(message?.content) && message.content.some(block => block.type === 'tool_result')
@@ -191,6 +193,7 @@ function decide(body) {
if ((used?.name === 'bash' || used?.name === 'pwsh') && /DSH_SECRET_/.test(used.input?.command ?? '')) {
return [text(`终端输出里我看到的是:${resultText.replace(/\s+/g, ' ').trim().slice(0, 200)}`)]
}
+ if (used?.input?.justification === ESCALATION) return [text(result.is_error ? `没跑成:${resultText.slice(0, 80)}` : '命令跑完了,文件已经写好。')]
switch (used?.name) {
case 'group_relay': return [text('')]
case 'create_bot': {
@@ -323,6 +326,10 @@ function decide(body) {
const brief = /Your own chat with the user so far[^\n]*\n([\s\S]*?)\nThis brief does not change/.exec(all)?.[1] ?? ''
return [text(brief ? `简报最后一句:${brief.split('\n').at(-1)}` : '没有简报。')]
}
+ const shell = ['pwsh', 'bash'].find(name => tools.has(name))
+ if (/提权/.test(userLine) && !leads && shell) {
+ return [text('这一步要写工作区外的文件,我申请一次提权。'), tool(shell, { command: 'echo ok', description: '在工作区外写一个测试文件', justification: ESCALATION, sandbox_permissions: 'danger-full-access' })]
+ }
// Ping-pong: whoever is mentioned mentions back, to exercise the per-member cap.
if (/来回/.test(userLine)) return [text(mentioner ? `@${mentioner} 回你` : leads && peer ? `@${peer} 来回` : '[PASS]')]
if (mentioner) return [text('进度正常,今天能交。')]