|
|
@@ -13,7 +13,7 @@ import type { Agent } from '@deepseek-ai/dsh-agent'
|
|
|
import { turnBoundaryProjectionDefinition } from '@deepseek-ai/dsh-agent-loop'
|
|
|
import { SessionId } from '@deepseek-ai/dsh-session'
|
|
|
import LocalJobRegistry from '@deepseek-ai/dsh-jobs-local'
|
|
|
-import * as ToolTasks from '@deepseek-ai/dsh-tool-jobs'
|
|
|
+import * as ToolJobs from '@deepseek-ai/dsh-tool-jobs'
|
|
|
import ApprovalService from '@deepseek-ai/dsh-user-approval'
|
|
|
import type { ApprovalOutcome } from '@deepseek-ai/dsh-user-approval'
|
|
|
import { LocalBashExecutor } from '@deepseek-ai/dsh-bash-local'
|
|
|
@@ -48,13 +48,13 @@ async function setup() {
|
|
|
}
|
|
|
|
|
|
/** Full harness: the generic job runtime + its controller, then the bash tool. */
|
|
|
-async function setupWithTasks() {
|
|
|
+async function setupWithJobs() {
|
|
|
const ctx = new Context()
|
|
|
await ctx.plugin(SystemPrompt)
|
|
|
await ctx.plugin(ToolRuntime)
|
|
|
await ctx.plugin(AgentRegistry)
|
|
|
await ctx.plugin(LocalJobRegistry)
|
|
|
- await ctx.plugin(ToolTasks)
|
|
|
+ await ctx.plugin(ToolJobs)
|
|
|
await ctx.plugin(LocalSubprocessRuntime)
|
|
|
;(ctx.subprocess as LocalSubprocessRuntime).internals = { spillDir }
|
|
|
await ctx.plugin(BashEnvPlugin)
|
|
|
@@ -192,7 +192,7 @@ async function setupSandboxed(withApproval = false) {
|
|
|
await ctx.plugin(ToolRuntime)
|
|
|
await ctx.plugin(AgentRegistry)
|
|
|
await ctx.plugin(LocalJobRegistry)
|
|
|
- await ctx.plugin(ToolTasks)
|
|
|
+ await ctx.plugin(ToolJobs)
|
|
|
await ctx.plugin(SessionProjectionRegistry)
|
|
|
ctx.sessionProjections.register(turnBoundaryProjectionDefinition)
|
|
|
await ctx.plugin(SandboxPolicyService, {})
|
|
|
@@ -456,7 +456,7 @@ describe('bash tool', () => {
|
|
|
|
|
|
describe('background execution through the job runtime', () => {
|
|
|
it('run_in_background acks with the job id, readable through the REAL job_output tool', async () => {
|
|
|
- const ctx = await setupWithTasks()
|
|
|
+ const ctx = await setupWithJobs()
|
|
|
const started = await call(ctx, 'bash', { command: 'echo bg-ok', description: 'test command', run_in_background: true })
|
|
|
expect(started.isError).toBe(false)
|
|
|
if (started.isError) throw new Error('expected background bash success')
|
|
|
@@ -471,7 +471,7 @@ describe('background execution through the job runtime', () => {
|
|
|
})
|
|
|
|
|
|
it('a running background job is killable through the REAL job_kill tool', async () => {
|
|
|
- const ctx = await setupWithTasks()
|
|
|
+ const ctx = await setupWithJobs()
|
|
|
await call(ctx, 'bash', { command: 'sleep 60', description: 'test command', run_in_background: true })
|
|
|
|
|
|
const killed = await call(ctx, 'job_kill', { job_id: 'bash-1' })
|
|
|
@@ -483,7 +483,7 @@ describe('background execution through the job runtime', () => {
|
|
|
})
|
|
|
|
|
|
it('a self-signal background exit is reported as killed through the REAL job_output tool', async () => {
|
|
|
- const ctx = await setupWithTasks()
|
|
|
+ const ctx = await setupWithJobs()
|
|
|
await call(ctx, 'bash', { command: 'kill -TERM $$', description: 'test command', run_in_background: true })
|
|
|
|
|
|
const final = await call(ctx, 'job_output', { job_id: 'bash-1', wait: true })
|
|
|
@@ -492,7 +492,7 @@ describe('background execution through the job runtime', () => {
|
|
|
|
|
|
it('a background job started by an agent is registered with that agent as owner', async () => {
|
|
|
// The producer must forward exec.agent as the job owner.
|
|
|
- const ctx = await setupWithTasks()
|
|
|
+ const ctx = await setupWithJobs()
|
|
|
const agent = registerFakeAgent(ctx, 'sess-owner')
|
|
|
const started = await call(ctx, 'bash', { command: 'sleep 60', description: 'test command', run_in_background: true }, agent)
|
|
|
expect(text(started)).toBe('started background job bash-1')
|
|
|
@@ -507,7 +507,7 @@ describe('background execution through the job runtime', () => {
|
|
|
})
|
|
|
|
|
|
it('fails loud when the job runtime is not loaded', async () => {
|
|
|
- const ctx = await setup() // no LocalJobRegistry / ToolTasks
|
|
|
+ const ctx = await setup() // no LocalJobRegistry / ToolJobs
|
|
|
const result = await call(ctx, 'bash', { command: 'sleep 60', description: 'test command', run_in_background: true })
|
|
|
expect(result.isError).toBe(true)
|
|
|
expect(text(result)).toContain('background jobs unavailable: load @deepseek-ai/dsh-jobs and @deepseek-ai/dsh-tool-jobs')
|
|
|
@@ -519,7 +519,7 @@ describe('background execution through the job runtime', () => {
|
|
|
await ctx.plugin(ToolRuntime)
|
|
|
await ctx.plugin(AgentRegistry)
|
|
|
await ctx.plugin(LocalJobRegistry)
|
|
|
- await ctx.plugin(ToolTasks)
|
|
|
+ await ctx.plugin(ToolJobs)
|
|
|
await ctx.plugin(CountingStartExecutor)
|
|
|
await ctx.plugin(BashEnvPlugin)
|
|
|
await ctx.plugin(ToolBash)
|
|
|
@@ -1125,7 +1125,7 @@ describe('the model-facing bash tool builds its request from named args only (no
|
|
|
await ctx.plugin(ToolRuntime)
|
|
|
await ctx.plugin(AgentRegistry)
|
|
|
await ctx.plugin(LocalJobRegistry)
|
|
|
- await ctx.plugin(ToolTasks)
|
|
|
+ await ctx.plugin(ToolJobs)
|
|
|
await ctx.plugin(BashEnvPlugin, { dshHome: recordingDshHome })
|
|
|
await ctx.plugin(RecordingBashExecutor)
|
|
|
await ctx.plugin(ToolBash)
|