Sessions: expose context-management tools to master and worker Sessions when the profile has one
This commit is contained in:
+10
-5
@@ -54,13 +54,17 @@ declare module '@deepseek-ai/cordis' {
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* The DSH tools an Executor Session works with: files, search, the shell and its jobs, the web, skills, its todo list and
|
* The DSH tools an Executor Session works with: files, search, the shell and its jobs, the web, skills, its todo list and
|
||||||
* subagents. It gets no other tool the profile has, whenever it was registered: none that asks or shows a person something,
|
* subagents, and the context-management tools of an attached context-management plugin when the profile has one, so a
|
||||||
* changes the profile, schedules work or starts goals outside the worker slots, the pause and a person's hold, starts or
|
* long worker can compress consumed history. It gets no other tool the profile has, whenever it was registered: none that
|
||||||
* messages other Sessions, or edits documents.
|
* asks or shows a person something, changes the profile, schedules work or starts goals outside the worker slots, the pause
|
||||||
|
* and a person's hold, starts or messages other Sessions, or edits documents.
|
||||||
*/
|
*/
|
||||||
export const SHELL_TOOL = process.platform === 'win32' ? 'pwsh' : 'bash'
|
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',
|
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']
|
'web_fetch', '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. */
|
/** 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; '
|
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.'
|
+ 'end the turn instead of waiting for them.'
|
||||||
@@ -272,7 +276,8 @@ export class Sessions {
|
|||||||
const register = this.registerTool(agent, binding)
|
const register = this.registerTool(agent, binding)
|
||||||
for (const tool of host.tools(agent, ticket)) register(tool.name, tool.description, tool.schema, tool.execute)
|
for (const tool of host.tools(agent, ticket)) register(tool.name, tool.description, tool.schema, tool.execute)
|
||||||
if (master) {
|
if (master) {
|
||||||
binding.disposers.push(agent.ctx.tools.restrict({ allow: ['skill', SHELL_TOOL, 'read', 'read_image', 'job_output', 'job_list', 'job_kill'] }),
|
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))) }),
|
||||||
agent.ctx.tools.guard(execution => noWait(execution, () => this.routed(agent))))
|
agent.ctx.tools.guard(execution => noWait(execution, () => this.routed(agent))))
|
||||||
} else {
|
} else {
|
||||||
// An Executor Session keeps the profile's work tools it has, which DSH requires to be known; its own tools are not masked.
|
// An Executor Session keeps the profile's work tools it has, which DSH requires to be known; its own tools are not masked.
|
||||||
|
|||||||
Reference in New Issue
Block a user