Sources: add Gitea; fix Windows shims for shell tool, repo paths and stateDir
This commit is contained in:
+4
-3
@@ -58,7 +58,8 @@ declare module '@deepseek-ai/cordis' {
|
||||
* 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.
|
||||
*/
|
||||
const WORK_TOOLS = ['read', 'write', 'edit', 'read_image', 'glob', 'grep', 'bash', 'pwsh', 'job_output', 'job_list', 'job_kill', 'web_search',
|
||||
export const SHELL_TOOL = process.platform === 'win32' ? 'pwsh' : 'bash'
|
||||
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']
|
||||
/** 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; '
|
||||
@@ -76,7 +77,7 @@ const SLEEP = /(?:^|[;&|({!`\n]|\b(?:do|then|else|elif|if|while|until|time|exec|
|
||||
*/
|
||||
function noWait({ name, arguments: input }: { name: string; arguments: unknown }, routed: () => boolean): string | undefined {
|
||||
const args = (input ?? {}) as { command?: unknown; timeoutMs?: unknown; run_in_background?: unknown; wait?: unknown; timeout_ms?: unknown }
|
||||
if (name === 'bash') {
|
||||
if (name === 'bash' || name === 'pwsh') {
|
||||
const sleeps = typeof args.command === 'string' && SLEEP.test(args.command)
|
||||
if (sleeps || typeof args.timeoutMs === 'number' && args.timeoutMs > 30_000) return NO_WAIT
|
||||
if (args.timeoutMs === undefined && args.run_in_background !== true && !routed()) return DEFAULT_WAIT
|
||||
@@ -260,7 +261,7 @@ export class Sessions {
|
||||
const register = this.registerTool(agent, binding)
|
||||
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', 'bash', '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'] }),
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user