diff --git a/src/app/execution-environment.ts b/src/app/execution-environment.ts index 155ca6f..4f7c073 100644 --- a/src/app/execution-environment.ts +++ b/src/app/execution-environment.ts @@ -12,6 +12,7 @@ export const EXECUTOR_VARIABLES: readonly (VariableSpec & { ticket?: true })[] = { key: 'DSH_SUPERAGENT_NAME', ticket: true, description: { zh: '工单的短名,也是执行目录的名字', en: 'The ticket\'s short name, also its directory\'s name' } }, { key: 'DSH_SUPERAGENT_TICKET', ticket: true, description: { zh: '工单 id', en: 'The ticket id' } }, { key: 'DSH_SUPERAGENT_BLOCKED_COMMANDS', description: { zh: '这个执行环境禁止调用的命令,以空格分隔;不要运行它们', en: 'Commands blocked in this execution environment, separated by spaces; never run them' } }, + { key: 'DSH_SUPERAGENT_WEB_SEARCH', description: { zh: '调研类任务优先用 workbuddy_web_search(WorkBuddy 原生搜索,走本机 WorkBuddy 额度,不依赖 DeepSeek key),它不可用或失败时再退回 web_search', en: 'For research tasks prefer workbuddy_web_search (WorkBuddy native search; it uses the local WorkBuddy quota and needs no DeepSeek key), and only fall back to web_search when it is unavailable or fails' } }, ] export interface Variable { key: string; value: string; description: Localized; owner: string } diff --git a/src/app/sessions.ts b/src/app/sessions.ts index 67e334f..42c1dfa 100644 --- a/src/app/sessions.ts +++ b/src/app/sessions.ts @@ -63,8 +63,8 @@ export const SHELL_TOOL = process.platform === 'win32' ? 'pwsh' : 'bash' /** Context-management tools of an attached context-management plugin, present only when the profile has one. */ const CONTEXT_TOOLS = ['compress', 'decompress', 'search_context', 'acp_status', 'acp_cache'] const WORK_TOOLS = ['read', 'write', 'edit', 'read_image', 'glob', 'grep', SHELL_TOOL, 'job_output', 'job_list', 'job_kill', 'web_search', - 'web_fetch', 'skill', 'todo_write', 'subagent', 'list_subagent_models', 'send_message', 'list_agents', 'interrupt_agent', - ...CONTEXT_TOOLS] + 'web_fetch', 'workbuddy_web_search', 'skill', 'todo_write', 'subagent', 'list_subagent_models', 'send_message', 'list_agents', + 'interrupt_agent', ...CONTEXT_TOOLS] /** What the main Session is told when it would wait: what it waits for comes to it, and a waiting step holds back the next. */ const NO_WAIT = 'Reports, follow_up notices, new candidates and a background job\'s end with its output arrive by themselves as messages; ' + 'end the turn instead of waiting for them.' @@ -277,7 +277,7 @@ export class Sessions { for (const tool of host.tools(agent, ticket)) register(tool.name, tool.description, tool.schema, tool.execute) if (master) { binding.disposers.push(agent.ctx.tools.restrict({ allow: ['skill', SHELL_TOOL, 'read', 'read_image', 'job_output', 'job_list', 'job_kill', - ...CONTEXT_TOOLS].filter(name => agent.ctx.tools.get(name, scopeParentOf(agent))) }), + 'workbuddy_web_search', ...CONTEXT_TOOLS].filter(name => agent.ctx.tools.get(name, scopeParentOf(agent))) }), agent.ctx.tools.guard(execution => noWait(execution, () => this.routed(agent)))) } else { // An Executor Session keeps the profile's work tools it has, which DSH requires to be known; its own tools are not masked.