@namzu/sdk 59.0.0 → 60.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +102 -0
- package/dist/compaction/context-window.d.ts +53 -0
- package/dist/compaction/context-window.d.ts.map +1 -1
- package/dist/compaction/context-window.js +141 -2
- package/dist/compaction/context-window.js.map +1 -1
- package/dist/execution/workflow/index.d.ts +3 -1
- package/dist/execution/workflow/index.d.ts.map +1 -1
- package/dist/execution/workflow/index.js +2 -1
- package/dist/execution/workflow/index.js.map +1 -1
- package/dist/execution/workflow/journal.d.ts +24 -4
- package/dist/execution/workflow/journal.d.ts.map +1 -1
- package/dist/execution/workflow/journal.js +131 -9
- package/dist/execution/workflow/journal.js.map +1 -1
- package/dist/execution/workflow/prelude.d.ts +2 -0
- package/dist/execution/workflow/prelude.d.ts.map +1 -1
- package/dist/execution/workflow/prelude.js +49 -8
- package/dist/execution/workflow/prelude.js.map +1 -1
- package/dist/execution/workflow/resume.d.ts +59 -0
- package/dist/execution/workflow/resume.d.ts.map +1 -0
- package/dist/execution/workflow/resume.js +273 -0
- package/dist/execution/workflow/resume.js.map +1 -0
- package/dist/execution/workflow/runtime.d.ts.map +1 -1
- package/dist/execution/workflow/runtime.js +112 -8
- package/dist/execution/workflow/runtime.js.map +1 -1
- package/dist/execution/workflow/types.d.ts +105 -1
- package/dist/execution/workflow/types.d.ts.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/plugin/compat.d.ts +24 -0
- package/dist/plugin/compat.d.ts.map +1 -0
- package/dist/plugin/compat.js +149 -0
- package/dist/plugin/compat.js.map +1 -0
- package/dist/plugin/loader.d.ts +2 -1
- package/dist/plugin/loader.d.ts.map +1 -1
- package/dist/plugin/loader.js +6 -0
- package/dist/plugin/loader.js.map +1 -1
- package/dist/pricing/index.d.ts.map +1 -1
- package/dist/pricing/index.js +2 -1
- package/dist/pricing/index.js.map +1 -1
- package/dist/process/kill-tree.d.ts +44 -0
- package/dist/process/kill-tree.d.ts.map +1 -1
- package/dist/process/kill-tree.js +102 -4
- package/dist/process/kill-tree.js.map +1 -1
- package/dist/prompt/coding-agent-doctrine.d.ts +1 -1
- package/dist/prompt/coding-agent-doctrine.d.ts.map +1 -1
- package/dist/prompt/coding-agent-doctrine.js +9 -1
- package/dist/prompt/coding-agent-doctrine.js.map +1 -1
- package/dist/provider/model-window-suffix.d.ts +18 -0
- package/dist/provider/model-window-suffix.d.ts.map +1 -0
- package/dist/provider/model-window-suffix.js +77 -0
- package/dist/provider/model-window-suffix.js.map +1 -0
- package/dist/public-runtime.d.ts +5 -3
- package/dist/public-runtime.d.ts.map +1 -1
- package/dist/public-runtime.js +5 -4
- package/dist/public-runtime.js.map +1 -1
- package/dist/public-types.d.ts +1 -0
- package/dist/public-types.d.ts.map +1 -1
- package/dist/registry/command/kernel-commands.d.ts +1 -4
- package/dist/registry/command/kernel-commands.d.ts.map +1 -1
- package/dist/registry/command/kernel-commands.js +0 -28
- package/dist/registry/command/kernel-commands.js.map +1 -1
- package/dist/runtime/jobs/awaited-jobs.d.ts +6 -0
- package/dist/runtime/jobs/awaited-jobs.d.ts.map +1 -1
- package/dist/runtime/jobs/awaited-jobs.js +11 -0
- package/dist/runtime/jobs/awaited-jobs.js.map +1 -1
- package/dist/runtime/jobs/host-exit-finalizer.d.ts +20 -0
- package/dist/runtime/jobs/host-exit-finalizer.d.ts.map +1 -0
- package/dist/runtime/jobs/host-exit-finalizer.js +57 -0
- package/dist/runtime/jobs/host-exit-finalizer.js.map +1 -0
- package/dist/runtime/jobs/liveness.d.ts +67 -0
- package/dist/runtime/jobs/liveness.d.ts.map +1 -0
- package/dist/runtime/jobs/liveness.js +94 -0
- package/dist/runtime/jobs/liveness.js.map +1 -0
- package/dist/runtime/jobs/registry.d.ts +21 -0
- package/dist/runtime/jobs/registry.d.ts.map +1 -1
- package/dist/runtime/jobs/registry.js +104 -2
- package/dist/runtime/jobs/registry.js.map +1 -1
- package/dist/runtime/jobs/wake-budget.d.ts +35 -0
- package/dist/runtime/jobs/wake-budget.d.ts.map +1 -0
- package/dist/runtime/jobs/wake-budget.js +48 -0
- package/dist/runtime/jobs/wake-budget.js.map +1 -0
- package/dist/runtime/query/detached-calls.d.ts +65 -0
- package/dist/runtime/query/detached-calls.d.ts.map +1 -0
- package/dist/runtime/query/detached-calls.js +116 -0
- package/dist/runtime/query/detached-calls.js.map +1 -0
- package/dist/runtime/query/executor.d.ts +4 -1
- package/dist/runtime/query/executor.d.ts.map +1 -1
- package/dist/runtime/query/executor.js +90 -6
- package/dist/runtime/query/executor.js.map +1 -1
- package/dist/runtime/query/index.d.ts +20 -0
- package/dist/runtime/query/index.d.ts.map +1 -1
- package/dist/runtime/query/index.js +31 -5
- package/dist/runtime/query/index.js.map +1 -1
- package/dist/runtime/query/iteration/outstanding-work.d.ts.map +1 -1
- package/dist/runtime/query/iteration/outstanding-work.js +11 -3
- package/dist/runtime/query/iteration/outstanding-work.js.map +1 -1
- package/dist/runtime/query/iteration/phases/context.d.ts +7 -0
- package/dist/runtime/query/iteration/phases/context.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/context.js.map +1 -1
- package/dist/runtime/query/iteration/phases/tool-review.d.ts.map +1 -1
- package/dist/runtime/query/iteration/phases/tool-review.js +63 -1
- package/dist/runtime/query/iteration/phases/tool-review.js.map +1 -1
- package/dist/runtime/query/session-storage.d.ts.map +1 -1
- package/dist/runtime/query/session-storage.js +8 -3
- package/dist/runtime/query/session-storage.js.map +1 -1
- package/dist/runtime/query/steering.d.ts +29 -3
- package/dist/runtime/query/steering.d.ts.map +1 -1
- package/dist/runtime/query/steering.js +58 -3
- package/dist/runtime/query/steering.js.map +1 -1
- package/dist/runtime/query/tooling.d.ts +1 -0
- package/dist/runtime/query/tooling.d.ts.map +1 -1
- package/dist/runtime/query/tooling.js +1 -0
- package/dist/runtime/query/tooling.js.map +1 -1
- package/dist/runtime/system-events.d.ts +5 -0
- package/dist/runtime/system-events.d.ts.map +1 -1
- package/dist/runtime/system-events.js +7 -1
- package/dist/runtime/system-events.js.map +1 -1
- package/dist/sandbox/denial.d.ts +11 -0
- package/dist/sandbox/denial.d.ts.map +1 -0
- package/dist/sandbox/denial.js +61 -0
- package/dist/sandbox/denial.js.map +1 -0
- package/dist/sandbox/file-walk-program.d.ts.map +1 -1
- package/dist/sandbox/file-walk-program.js +31 -13
- package/dist/sandbox/file-walk-program.js.map +1 -1
- package/dist/sandbox/file-walk.d.ts +2 -0
- package/dist/sandbox/file-walk.d.ts.map +1 -1
- package/dist/sandbox/file-walk.js +64 -13
- package/dist/sandbox/file-walk.js.map +1 -1
- package/dist/sandbox/ignore-matcher.d.ts +30 -0
- package/dist/sandbox/ignore-matcher.d.ts.map +1 -0
- package/dist/sandbox/ignore-matcher.js +11 -0
- package/dist/sandbox/ignore-matcher.js.map +1 -0
- package/dist/sandbox/ignore-source.d.ts +26 -0
- package/dist/sandbox/ignore-source.d.ts.map +1 -0
- package/dist/sandbox/ignore-source.js +221 -0
- package/dist/sandbox/ignore-source.js.map +1 -0
- package/dist/sandbox/provider/local.d.ts.map +1 -1
- package/dist/sandbox/provider/local.js +11 -1
- package/dist/sandbox/provider/local.js.map +1 -1
- package/dist/scheduler/completion-inbox.d.ts.map +1 -1
- package/dist/scheduler/completion-inbox.js +1 -0
- package/dist/scheduler/completion-inbox.js.map +1 -1
- package/dist/session/log-hash.d.ts.map +1 -1
- package/dist/session/log-hash.js +18 -1
- package/dist/session/log-hash.js.map +1 -1
- package/dist/store/session-index/sqlite.d.ts.map +1 -1
- package/dist/store/session-index/sqlite.js +169 -16
- package/dist/store/session-index/sqlite.js.map +1 -1
- package/dist/tools/builtins/bash.d.ts.map +1 -1
- package/dist/tools/builtins/bash.js +10 -4
- package/dist/tools/builtins/bash.js.map +1 -1
- package/dist/tools/builtins/computer-use.d.ts +35 -0
- package/dist/tools/builtins/computer-use.d.ts.map +1 -1
- package/dist/tools/builtins/computer-use.js +512 -67
- package/dist/tools/builtins/computer-use.js.map +1 -1
- package/dist/tools/builtins/glob.d.ts +1 -0
- package/dist/tools/builtins/glob.d.ts.map +1 -1
- package/dist/tools/builtins/glob.js +65 -28
- package/dist/tools/builtins/glob.js.map +1 -1
- package/dist/tools/builtins/grep.d.ts +2 -0
- package/dist/tools/builtins/grep.d.ts.map +1 -1
- package/dist/tools/builtins/grep.js +94 -40
- package/dist/tools/builtins/grep.js.map +1 -1
- package/dist/tools/builtins/job.d.ts +1 -1
- package/dist/tools/builtins/job.d.ts.map +1 -1
- package/dist/tools/builtins/job.js +34 -7
- package/dist/tools/builtins/job.js.map +1 -1
- package/dist/tools/builtins/search-support.d.ts +44 -0
- package/dist/tools/builtins/search-support.d.ts.map +1 -0
- package/dist/tools/builtins/search-support.js +89 -0
- package/dist/tools/builtins/search-support.js.map +1 -0
- package/dist/tools/builtins/wait-for-job-bounds.d.ts +2 -0
- package/dist/tools/builtins/wait-for-job-bounds.d.ts.map +1 -1
- package/dist/tools/builtins/wait-for-job-bounds.js +3 -1
- package/dist/tools/builtins/wait-for-job-bounds.js.map +1 -1
- package/dist/tools/builtins/wait-for-job.d.ts +1 -1
- package/dist/tools/builtins/wait-for-job.d.ts.map +1 -1
- package/dist/tools/builtins/wait-for-job.js +13 -2
- package/dist/tools/builtins/wait-for-job.js.map +1 -1
- package/dist/tools/command-shell.d.ts.map +1 -1
- package/dist/tools/command-shell.js +14 -5
- package/dist/tools/command-shell.js.map +1 -1
- package/dist/types/computer-use/index.d.ts +129 -13
- package/dist/types/computer-use/index.d.ts.map +1 -1
- package/dist/types/computer-use/index.js.map +1 -1
- package/dist/types/plugin/index.d.ts +24 -0
- package/dist/types/plugin/index.d.ts.map +1 -1
- package/dist/types/plugin/index.js +4 -0
- package/dist/types/plugin/index.js.map +1 -1
- package/dist/types/sandbox/index.d.ts +38 -1
- package/dist/types/sandbox/index.d.ts.map +1 -1
- package/dist/types/sandbox/index.js.map +1 -1
- package/dist/types/session/records.d.ts +264 -0
- package/dist/types/session/records.d.ts.map +1 -1
- package/dist/types/session/records.js +32 -1
- package/dist/types/session/records.js.map +1 -1
- package/dist/types/tool/index.d.ts +30 -0
- package/dist/types/tool/index.d.ts.map +1 -1
- package/dist/types/tool/index.js.map +1 -1
- package/dist/types/tool/presentation.d.ts +8 -0
- package/dist/types/tool/presentation.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/compaction/context-window.ts +163 -2
- package/src/execution/workflow/index.ts +14 -1
- package/src/execution/workflow/journal.ts +161 -11
- package/src/execution/workflow/prelude.ts +51 -8
- package/src/execution/workflow/resume.ts +313 -0
- package/src/execution/workflow/runtime.ts +127 -9
- package/src/execution/workflow/types.ts +109 -1
- package/src/index.ts +17 -0
- package/src/plugin/compat.ts +173 -0
- package/src/plugin/loader.ts +7 -1
- package/src/pricing/index.ts +2 -1
- package/src/process/kill-tree.ts +106 -4
- package/src/prompt/coding-agent-doctrine.ts +9 -1
- package/src/provider/model-window-suffix.ts +84 -0
- package/src/public-runtime.ts +21 -2
- package/src/public-types.ts +1 -0
- package/src/registry/command/kernel-commands.ts +1 -32
- package/src/runtime/jobs/awaited-jobs.ts +11 -0
- package/src/runtime/jobs/host-exit-finalizer.ts +67 -0
- package/src/runtime/jobs/liveness.ts +144 -0
- package/src/runtime/jobs/registry.ts +114 -2
- package/src/runtime/jobs/wake-budget.ts +55 -0
- package/src/runtime/query/detached-calls.ts +135 -0
- package/src/runtime/query/executor.ts +92 -10
- package/src/runtime/query/index.ts +50 -7
- package/src/runtime/query/iteration/outstanding-work.ts +12 -3
- package/src/runtime/query/iteration/phases/context.ts +7 -0
- package/src/runtime/query/iteration/phases/tool-review.ts +73 -8
- package/src/runtime/query/session-storage.ts +8 -3
- package/src/runtime/query/steering.ts +77 -6
- package/src/runtime/query/tooling.ts +2 -0
- package/src/runtime/system-events.ts +12 -1
- package/src/sandbox/denial.ts +79 -0
- package/src/sandbox/file-walk-program.ts +32 -13
- package/src/sandbox/file-walk.ts +75 -12
- package/src/sandbox/ignore-matcher.ts +46 -0
- package/src/sandbox/ignore-source.ts +220 -0
- package/src/sandbox/provider/local.ts +11 -1
- package/src/scheduler/completion-inbox.ts +1 -0
- package/src/session/log-hash.ts +21 -0
- package/src/store/session-index/sqlite.ts +171 -16
- package/src/tools/builtins/bash.ts +11 -4
- package/src/tools/builtins/computer-use.ts +593 -68
- package/src/tools/builtins/glob.ts +79 -32
- package/src/tools/builtins/grep.ts +107 -43
- package/src/tools/builtins/job.ts +42 -12
- package/src/tools/builtins/search-support.ts +107 -0
- package/src/tools/builtins/wait-for-job-bounds.ts +5 -1
- package/src/tools/builtins/wait-for-job.ts +14 -2
- package/src/tools/command-shell.ts +13 -5
- package/src/types/computer-use/index.ts +157 -15
- package/src/types/plugin/index.ts +8 -0
- package/src/types/sandbox/index.ts +40 -1
- package/src/types/session/records.ts +36 -2
- package/src/types/tool/index.ts +30 -0
- package/src/types/tool/presentation.ts +8 -0
|
@@ -60,6 +60,8 @@ export type JobWaitOutcome =
|
|
|
60
60
|
/** Which clock ran out. */
|
|
61
61
|
readonly cause: 'idle' | 'wall'
|
|
62
62
|
readonly elapsedMs: number
|
|
63
|
+
/** How long the job had been silent when the wait gave up. */
|
|
64
|
+
readonly quietForMs: number
|
|
63
65
|
} & JobWaitProgress)
|
|
64
66
|
|
|
65
67
|
/**
|
|
@@ -167,6 +169,7 @@ export async function waitForJobWithBounds(
|
|
|
167
169
|
kind: 'timeout',
|
|
168
170
|
cause: 'wall',
|
|
169
171
|
elapsedMs: elapsed,
|
|
172
|
+
quietForMs: now() - lastProgressAt,
|
|
170
173
|
output,
|
|
171
174
|
nextOffset: cursor,
|
|
172
175
|
droppedBytes,
|
|
@@ -182,6 +185,7 @@ export async function waitForJobWithBounds(
|
|
|
182
185
|
kind: 'timeout',
|
|
183
186
|
cause: 'idle',
|
|
184
187
|
elapsedMs: elapsed,
|
|
188
|
+
quietForMs: quietFor,
|
|
185
189
|
output,
|
|
186
190
|
nextOffset: cursor,
|
|
187
191
|
droppedBytes,
|
|
@@ -214,7 +218,7 @@ export function describeJobWaitTimeout(
|
|
|
214
218
|
const seconds = Math.round(outcome.elapsedMs / 1000)
|
|
215
219
|
const resume = `call wait_for_job or job read with from_offset ${outcome.nextOffset} to see only what comes next`
|
|
216
220
|
if (outcome.cause === 'idle') {
|
|
217
|
-
return `Job ${id} went quiet: no new output for
|
|
221
|
+
return `Job ${id} went quiet: no new output for ${Math.round(outcome.quietForMs / 1000)}s (waited ${seconds}s). It has not been stopped and may still be working — ${resume}.`
|
|
218
222
|
}
|
|
219
223
|
return `Job ${id} has been running for ${seconds}s without finishing. It has not been stopped — ${resume}.`
|
|
220
224
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod'
|
|
2
2
|
|
|
3
3
|
import { invalidBackgroundJobIdInput } from '../../runtime/jobs/job-id.js'
|
|
4
|
+
import { LIVENESS_STALLED_MS } from '../../runtime/jobs/liveness.js'
|
|
4
5
|
import { readPositiveIntEnv } from '../../utils/env.js'
|
|
5
6
|
import { defineTool } from '../defineTool.js'
|
|
6
7
|
import { describeJobWaitTimeout, waitForJobWithBounds } from './wait-for-job-bounds.js'
|
|
@@ -20,7 +21,7 @@ import { describeJobWaitTimeout, waitForJobWithBounds } from './wait-for-job-bou
|
|
|
20
21
|
*/
|
|
21
22
|
|
|
22
23
|
const DEFAULT_TIMEOUT_MS = readPositiveIntEnv('NAMZU_JOB_WAIT_TIMEOUT_MS', 5 * 60 * 1000)
|
|
23
|
-
const DEFAULT_IDLE_TIMEOUT_MS = readPositiveIntEnv('NAMZU_JOB_WAIT_IDLE_MS',
|
|
24
|
+
const DEFAULT_IDLE_TIMEOUT_MS = readPositiveIntEnv('NAMZU_JOB_WAIT_IDLE_MS', LIVENESS_STALLED_MS)
|
|
24
25
|
|
|
25
26
|
/**
|
|
26
27
|
* The longest either bound will accept from the model.
|
|
@@ -146,7 +147,11 @@ export const WaitForJobTool = defineTool({
|
|
|
146
147
|
}
|
|
147
148
|
|
|
148
149
|
if (input.output_stream !== undefined && input.output_contains === undefined) {
|
|
149
|
-
return {
|
|
150
|
+
return {
|
|
151
|
+
success: false,
|
|
152
|
+
output: '',
|
|
153
|
+
error: 'output_stream requires output_contains.',
|
|
154
|
+
}
|
|
150
155
|
}
|
|
151
156
|
if (input.output_contains !== undefined) {
|
|
152
157
|
if (!jobs.waitForOutput) {
|
|
@@ -261,6 +266,13 @@ export const WaitForJobTool = defineTool({
|
|
|
261
266
|
}
|
|
262
267
|
}
|
|
263
268
|
|
|
269
|
+
// The exit and its output are in this result, so the notice that would
|
|
270
|
+
// announce the same exit is withdrawn rather than repeated. Only when
|
|
271
|
+
// the model was given all of it: output the retention cap dropped, or
|
|
272
|
+
// that this bounded result omitted, leaves the notice in place.
|
|
273
|
+
if (outcome.kind === 'exited' && outcome.droppedBytes === 0 && outcome.omittedOutputBytes === 0)
|
|
274
|
+
jobs.markCollected?.(input.id)
|
|
275
|
+
|
|
264
276
|
const notices = [
|
|
265
277
|
...(outcome.droppedBytes > 0
|
|
266
278
|
? [`[${outcome.droppedBytes} bytes were dropped by the job's output retention cap]`]
|
|
@@ -55,7 +55,7 @@ import { randomUUID } from 'node:crypto'
|
|
|
55
55
|
import { constants, accessSync, existsSync } from 'node:fs'
|
|
56
56
|
import { delimiter, isAbsolute, join, win32 } from 'node:path'
|
|
57
57
|
|
|
58
|
-
import { MSYS_TAG_VARIABLE, registerMsysShell } from '../process/kill-tree.js'
|
|
58
|
+
import { MSYS_TAG_VARIABLE, registerMsysShell, registerProcessTag } from '../process/kill-tree.js'
|
|
59
59
|
import type { ShellDialect } from '../types/tool/index.js'
|
|
60
60
|
|
|
61
61
|
/** The shell a host-side command runs in. */
|
|
@@ -452,8 +452,14 @@ export function spawnHostShell(
|
|
|
452
452
|
const spawnFn = options.spawnImpl ?? nodeSpawn
|
|
453
453
|
const shell = options.shell ?? hostCommandShell()
|
|
454
454
|
const spawned = hostShellSpawn(command, options.env, shell)
|
|
455
|
-
//
|
|
456
|
-
|
|
455
|
+
// Tag the shell so a kill can find what a forked command left: under Git
|
|
456
|
+
// Bash, the processes its runtime forked out of the Windows tree's reach; on
|
|
457
|
+
// Linux, the ones that started their own session and so left the process
|
|
458
|
+
// group. Other platforms have neither a bash runtime nor `/proc` to look in.
|
|
459
|
+
const platform = options.platform ?? process.platform
|
|
460
|
+
const windowsBash = shell.windows === true && shell.path !== undefined
|
|
461
|
+
const tag =
|
|
462
|
+
windowsBash || (shell.windows !== true && platform === 'linux') ? randomUUID() : undefined
|
|
457
463
|
const resolved =
|
|
458
464
|
tag === undefined ? spawned : { ...spawned, env: { ...spawned.env, [MSYS_TAG_VARIABLE]: tag } }
|
|
459
465
|
const common: SpawnOptions = {
|
|
@@ -471,8 +477,10 @@ export function spawnHostShell(
|
|
|
471
477
|
}
|
|
472
478
|
if (resolved.file !== undefined) {
|
|
473
479
|
const child = spawnFn(resolved.file, [...resolved.args], common)
|
|
474
|
-
if (tag !== undefined && child !== null && typeof child === 'object')
|
|
475
|
-
registerMsysShell(child, { bash: resolved.file, tag })
|
|
480
|
+
if (tag !== undefined && child !== null && typeof child === 'object') {
|
|
481
|
+
if (windowsBash) registerMsysShell(child, { bash: resolved.file, tag })
|
|
482
|
+
else registerProcessTag(child, tag)
|
|
483
|
+
}
|
|
476
484
|
return child
|
|
477
485
|
}
|
|
478
486
|
const windows = windowsCmdSpawn(command, resolved.env)
|
|
@@ -207,6 +207,15 @@ export interface FocusWindowResult {
|
|
|
207
207
|
readonly ok: boolean
|
|
208
208
|
/** The window in front after the attempt, or null when none could be read. */
|
|
209
209
|
readonly focusedId: string | null
|
|
210
|
+
/**
|
|
211
|
+
* Set with `detail` when the host did not try at all (the screen was in
|
|
212
|
+
* use, a prompt had it, the user said no). `not_delivered` / `safe` means
|
|
213
|
+
* nothing was done and asking again later is fine.
|
|
214
|
+
*/
|
|
215
|
+
readonly delivery?: ActionDelivery
|
|
216
|
+
readonly retrySafety?: ActionRetrySafety
|
|
217
|
+
/** Why, in words the model can act on. */
|
|
218
|
+
readonly detail?: string
|
|
210
219
|
}
|
|
211
220
|
|
|
212
221
|
/**
|
|
@@ -231,9 +240,13 @@ export type UiElementAction =
|
|
|
231
240
|
*/
|
|
232
241
|
export interface UiElement {
|
|
233
242
|
/**
|
|
234
|
-
* Opaque reference for {@link ComputerUseHost.uiAct}
|
|
235
|
-
*
|
|
236
|
-
*
|
|
243
|
+
* Opaque reference for {@link ComputerUseHost.uiAct}. It names the control,
|
|
244
|
+
* not one reading of it: a host that can find the control again keeps the
|
|
245
|
+
* ref usable across snapshots, and fails with a {@link UiActFailureCode}
|
|
246
|
+
* when it cannot. Empty for an element the host cannot act on (a label, a
|
|
247
|
+
* group), which is in the tree for what it says. A host may also give a
|
|
248
|
+
* ref to a region it left unexpanded (see {@link UiElement.hiddenChildren});
|
|
249
|
+
* that ref is the `root` of a drill-down snapshot, not a target for `uiAct`.
|
|
237
250
|
*/
|
|
238
251
|
readonly ref: string
|
|
239
252
|
/** Platform role, e.g. `Button`, `Edit`, `ListItem` (UIA ControlType) or `AXButton`. */
|
|
@@ -248,6 +261,12 @@ export interface UiElement {
|
|
|
248
261
|
readonly states?: readonly string[]
|
|
249
262
|
readonly actions?: readonly UiElementAction[]
|
|
250
263
|
readonly children?: readonly UiElement[]
|
|
264
|
+
/**
|
|
265
|
+
* How many children of this element the host left out of the snapshot to
|
|
266
|
+
* keep it short. Read them with a snapshot whose {@link UiSnapshotOptions.root}
|
|
267
|
+
* is this element's ref.
|
|
268
|
+
*/
|
|
269
|
+
readonly hiddenChildren?: number
|
|
251
270
|
}
|
|
252
271
|
|
|
253
272
|
/**
|
|
@@ -264,8 +283,41 @@ export interface UiSnapshot {
|
|
|
264
283
|
readonly root: UiElement
|
|
265
284
|
/** True when the host stopped walking the tree before it ended (a size or time bound). */
|
|
266
285
|
readonly truncated?: boolean
|
|
286
|
+
/**
|
|
287
|
+
* True when the tree is an outline of a larger one: regions carry
|
|
288
|
+
* {@link UiElement.hiddenChildren} and can be opened with
|
|
289
|
+
* {@link UiSnapshotOptions.root}.
|
|
290
|
+
*/
|
|
291
|
+
readonly outline?: boolean
|
|
292
|
+
/** How many controls the whole window holds, when the host knows. */
|
|
293
|
+
readonly total?: number
|
|
294
|
+
/** True when this snapshot is one region of the window (it was asked for with `root`). */
|
|
295
|
+
readonly region?: boolean
|
|
296
|
+
/** For a region listed in pages: the `offset` that reads the page after this one. */
|
|
297
|
+
readonly next?: number
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* What a snapshot is asked to read.
|
|
302
|
+
*
|
|
303
|
+
* @experimental See {@link ComputerUseCapabilities.uiTree}.
|
|
304
|
+
*/
|
|
305
|
+
export interface UiSnapshotOptions {
|
|
306
|
+
/** A ref from an earlier snapshot: read only that element's subtree. Refs outside it stay valid. */
|
|
307
|
+
readonly root?: string
|
|
308
|
+
/** With `root`: skip this many of the region's children (the page a snapshot reported as `next`). */
|
|
309
|
+
readonly offset?: number
|
|
310
|
+
/** Only controls whose text contains this (case-insensitive), with the elements above them. */
|
|
311
|
+
readonly query?: string
|
|
267
312
|
}
|
|
268
313
|
|
|
314
|
+
/** Why a ref could not be acted on, as a typed failure. */
|
|
315
|
+
export type UiActFailureCode =
|
|
316
|
+
/** The control the ref named is gone, or no longer something that can be acted on. */
|
|
317
|
+
| 'STALE_REF'
|
|
318
|
+
/** Several controls fit what the ref named; the host did not guess. */
|
|
319
|
+
| 'AMBIGUOUS_TARGET'
|
|
320
|
+
|
|
269
321
|
/**
|
|
270
322
|
* What {@link ComputerUseHost.uiAct} did.
|
|
271
323
|
*
|
|
@@ -275,6 +327,51 @@ export interface UiActResult {
|
|
|
275
327
|
readonly ok: boolean
|
|
276
328
|
/** Why it did not, in words the model can act on (a stale ref, a disabled element). */
|
|
277
329
|
readonly detail?: string
|
|
330
|
+
/** Set when the ref could not be resolved to one control; nothing was sent. */
|
|
331
|
+
readonly code?: UiActFailureCode
|
|
332
|
+
/** What is known about the effect. Absent from a host that does not classify. */
|
|
333
|
+
readonly delivery?: ActionDelivery
|
|
334
|
+
/** Whether repeating the action blindly is safe. Set together with `delivery`. */
|
|
335
|
+
readonly retrySafety?: ActionRetrySafety
|
|
336
|
+
/** The state read back after a stateful action, when the host could read it. */
|
|
337
|
+
readonly readBack?: {
|
|
338
|
+
readonly expected?: string
|
|
339
|
+
readonly observed?: string
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* How far an action is known to have taken effect.
|
|
345
|
+
*
|
|
346
|
+
* - `delivered_verified`: the host read the state back and it matches.
|
|
347
|
+
* - `delivered_unverified`: the input was sent (or may have been) and no
|
|
348
|
+
* read-back confirmed it. A failed or impossible read-back lands here, never
|
|
349
|
+
* in `not_delivered`.
|
|
350
|
+
* - `not_delivered`: the action was refused before any input, or a read-back
|
|
351
|
+
* proved the state did not change.
|
|
352
|
+
*/
|
|
353
|
+
export type ActionDelivery = 'delivered_verified' | 'delivered_unverified' | 'not_delivered'
|
|
354
|
+
|
|
355
|
+
/**
|
|
356
|
+
* `safe`: nothing reached the target, so the same action may be repeated.
|
|
357
|
+
* `unsafe`: the action may have taken effect; inspect before repeating it.
|
|
358
|
+
*/
|
|
359
|
+
export type ActionRetrySafety = 'safe' | 'unsafe'
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* What a window-scoped input action learned about its own delivery.
|
|
363
|
+
*
|
|
364
|
+
* @experimental See {@link ComputerUseHost.executeWindow}.
|
|
365
|
+
*/
|
|
366
|
+
export interface WindowInputResult {
|
|
367
|
+
readonly delivery: ActionDelivery
|
|
368
|
+
readonly retrySafety: ActionRetrySafety
|
|
369
|
+
readonly detail?: string
|
|
370
|
+
/** What the window read afterwards, when the host verified the input by reading it. */
|
|
371
|
+
readonly readBack?: {
|
|
372
|
+
readonly expected?: string
|
|
373
|
+
readonly observed?: string
|
|
374
|
+
}
|
|
278
375
|
}
|
|
279
376
|
|
|
280
377
|
export interface Point {
|
|
@@ -294,7 +391,11 @@ export type ComputerUseAction =
|
|
|
294
391
|
| { readonly type: 'screenshot' }
|
|
295
392
|
| { readonly type: 'cursor_position' }
|
|
296
393
|
| { readonly type: 'mouse_move'; readonly to: Point }
|
|
297
|
-
| {
|
|
394
|
+
| {
|
|
395
|
+
readonly type: 'mouse_click'
|
|
396
|
+
readonly at: Point
|
|
397
|
+
readonly button: MouseButton
|
|
398
|
+
}
|
|
298
399
|
| {
|
|
299
400
|
readonly type: 'mouse_drag'
|
|
300
401
|
readonly from: Point
|
|
@@ -335,7 +436,13 @@ export function assertComputerUseActionType(type: ComputerUseAction['type']): vo
|
|
|
335
436
|
export type ComputerUseResult =
|
|
336
437
|
| { readonly type: 'screenshot'; readonly result: ScreenshotResult }
|
|
337
438
|
| { readonly type: 'cursor_position'; readonly point: Point }
|
|
338
|
-
| {
|
|
439
|
+
| {
|
|
440
|
+
readonly type: 'ok'
|
|
441
|
+
/** Set by a host that can tell more than "the call returned". */
|
|
442
|
+
readonly delivery?: ActionDelivery
|
|
443
|
+
readonly retrySafety?: ActionRetrySafety
|
|
444
|
+
readonly detail?: string
|
|
445
|
+
}
|
|
339
446
|
|
|
340
447
|
/**
|
|
341
448
|
* A state-changing desktop action started, but its subprocess did not report
|
|
@@ -370,49 +477,84 @@ export interface ComputerUseHost {
|
|
|
370
477
|
* Points in `action` are physical pixels relative to the display of the
|
|
371
478
|
* most recent capture; a `screenshot` result carries that display in
|
|
372
479
|
* {@link ScreenshotResult.display}.
|
|
480
|
+
*
|
|
481
|
+
* Every method that reaches the desktop takes a trailing `signal`: the
|
|
482
|
+
* tool call's cancellation (the user interrupted the turn). On abort a host
|
|
483
|
+
* stops waiting for the desktop and answers at once. An action that may
|
|
484
|
+
* already have been sent answers `delivered_unverified` with `retrySafety:
|
|
485
|
+
* 'unsafe'`; one that provably was not answers `not_delivered` with
|
|
486
|
+
* `'safe'`. A read throws.
|
|
373
487
|
*/
|
|
374
|
-
execute(action: ComputerUseAction): Promise<ComputerUseResult>
|
|
488
|
+
execute(action: ComputerUseAction, signal?: AbortSignal): Promise<ComputerUseResult>
|
|
375
489
|
|
|
376
490
|
/**
|
|
377
491
|
* The visible, titled top-level windows, front to back where the platform
|
|
378
492
|
* knows the order. Offered to the model only with
|
|
379
493
|
* {@link ComputerUseCapabilities.windows}.
|
|
380
494
|
*/
|
|
381
|
-
listWindows?(): Promise<readonly WindowInfo[]>
|
|
495
|
+
listWindows?(signal?: AbortSignal): Promise<readonly WindowInfo[]>
|
|
382
496
|
/**
|
|
383
497
|
* Bring a window to the front, restoring it when minimized. Offered only
|
|
384
498
|
* with {@link ComputerUseCapabilities.windows}.
|
|
385
499
|
*/
|
|
386
|
-
focusWindow?(id: string): Promise<FocusWindowResult>
|
|
500
|
+
focusWindow?(id: string, signal?: AbortSignal): Promise<FocusWindowResult>
|
|
501
|
+
/**
|
|
502
|
+
* The model's turn `turnId` is making a tool call. A host that keeps state
|
|
503
|
+
* per turn (an Escape stop, refused permissions) starts a new one when the
|
|
504
|
+
* id changes.
|
|
505
|
+
*/
|
|
506
|
+
beginTurn?(turnId: string): void
|
|
507
|
+
/**
|
|
508
|
+
* The model's turn ended or was interrupted. A host releases anything it
|
|
509
|
+
* holds for the turn: a lease on the screen, an input monitor, a window it
|
|
510
|
+
* moved forward.
|
|
511
|
+
*/
|
|
512
|
+
endTurn?(): void | Promise<void>
|
|
387
513
|
/** Capture a named window. Never silently replace a failed capture with the desktop. */
|
|
388
|
-
captureWindow?(id: string): Promise<WindowScreenshotResult>
|
|
514
|
+
captureWindow?(id: string, signal?: AbortSignal): Promise<WindowScreenshotResult>
|
|
389
515
|
/**
|
|
390
516
|
* Act in the PNG pixel space of `captureId`. The host must verify the
|
|
391
517
|
* capture is current and still belongs to the same process/window before
|
|
392
518
|
* dispatching input. No implicit fallback to display input is permitted.
|
|
393
519
|
*/
|
|
394
|
-
|
|
520
|
+
// `void` stays in the union: a host that returns nothing (`Promise<void>`) must keep compiling.
|
|
521
|
+
executeWindow?(
|
|
522
|
+
captureId: string,
|
|
523
|
+
action: WindowInputAction,
|
|
524
|
+
signal?: AbortSignal,
|
|
525
|
+
// biome-ignore lint/suspicious/noConfusingVoidType: widening an existing `Promise<void>` return
|
|
526
|
+
): Promise<void | WindowInputResult>
|
|
395
527
|
/**
|
|
396
528
|
* Capture one region of the current display at full physical resolution.
|
|
397
529
|
* `rect` is display-relative physical pixels; the result's `width` and
|
|
398
530
|
* `height` are the region's. Used by `zoom` when
|
|
399
531
|
* {@link ComputerUseCapabilities.regionCapture} is set.
|
|
400
532
|
*/
|
|
401
|
-
captureRegion?(rect: Rect): Promise<ScreenshotResult>
|
|
533
|
+
captureRegion?(rect: Rect, signal?: AbortSignal): Promise<ScreenshotResult>
|
|
402
534
|
/**
|
|
403
535
|
* The accessibility tree of one window, or of the focused window when
|
|
404
|
-
* `windowId` is omitted.
|
|
536
|
+
* `windowId` is omitted. With `options.root` only that element's subtree is
|
|
537
|
+
* read. Offered only with {@link ComputerUseCapabilities.uiTree}.
|
|
405
538
|
*
|
|
406
539
|
* @experimental
|
|
407
540
|
*/
|
|
408
|
-
uiSnapshot?(
|
|
541
|
+
uiSnapshot?(
|
|
542
|
+
windowId?: string,
|
|
543
|
+
options?: UiSnapshotOptions,
|
|
544
|
+
signal?: AbortSignal,
|
|
545
|
+
): Promise<UiSnapshot>
|
|
409
546
|
/**
|
|
410
|
-
* Act on an element from
|
|
547
|
+
* Act on an element from an earlier {@link uiSnapshot}. `value` is the text
|
|
411
548
|
* for `set_value`. Offered only with {@link ComputerUseCapabilities.uiTree}.
|
|
412
549
|
*
|
|
413
550
|
* @experimental
|
|
414
551
|
*/
|
|
415
|
-
uiAct?(
|
|
552
|
+
uiAct?(
|
|
553
|
+
ref: string,
|
|
554
|
+
action: UiElementAction,
|
|
555
|
+
value?: string,
|
|
556
|
+
signal?: AbortSignal,
|
|
557
|
+
): Promise<UiActResult>
|
|
416
558
|
|
|
417
559
|
initialize?(): Promise<void>
|
|
418
560
|
dispose?(): Promise<void>
|
|
@@ -549,6 +549,10 @@ export interface PluginManifest {
|
|
|
549
549
|
* owns delegation, not by the runtime.
|
|
550
550
|
*/
|
|
551
551
|
readonly agents?: readonly string[]
|
|
552
|
+
/** Operating systems the plugin supports, as `process.platform` names them. Absent means all. */
|
|
553
|
+
readonly platforms?: readonly string[]
|
|
554
|
+
/** Runtime versions the plugin supports. Absent means any. */
|
|
555
|
+
readonly engines?: { readonly namzu?: string }
|
|
552
556
|
}
|
|
553
557
|
|
|
554
558
|
export const PluginMCPServerConfigSchema = z
|
|
@@ -589,6 +593,10 @@ export const PluginManifestSchema = z.object({
|
|
|
589
593
|
personas: z.array(z.string()).max(MAX_PERSONAS_PER_PLUGIN).optional(),
|
|
590
594
|
commands: z.array(PluginRelativeDirSchema).max(MAX_COMMAND_DIRS_PER_PLUGIN).optional(),
|
|
591
595
|
agents: z.array(PluginRelativeDirSchema).max(MAX_AGENT_DIRS_PER_PLUGIN).optional(),
|
|
596
|
+
/** Operating systems the plugin supports, as `process.platform` names them. Absent means all. */
|
|
597
|
+
platforms: z.array(z.string().min(1)).max(16).optional(),
|
|
598
|
+
/** Runtime versions the plugin supports. Absent means any. */
|
|
599
|
+
engines: z.object({ namzu: z.string().min(1).max(200).optional() }).optional(),
|
|
592
600
|
})
|
|
593
601
|
|
|
594
602
|
// ---------------------------------------------------------------------------
|
|
@@ -89,6 +89,18 @@ export function assertSandboxEnvironment(env: SandboxEnvironment): void {
|
|
|
89
89
|
// Exec result
|
|
90
90
|
// ---------------------------------------------------------------------------
|
|
91
91
|
|
|
92
|
+
/**
|
|
93
|
+
* A backend's reading of why a non-zero result is not simply "the command
|
|
94
|
+
* failed". Inference from the error text, never proof.
|
|
95
|
+
*
|
|
96
|
+
* - `denial`: the sandbox appears to have refused a file access.
|
|
97
|
+
* - `runner-failure`: the launcher failed before the command ran.
|
|
98
|
+
*/
|
|
99
|
+
export interface SandboxExecAttribution {
|
|
100
|
+
readonly kind: 'denial' | 'runner-failure'
|
|
101
|
+
readonly message: string
|
|
102
|
+
}
|
|
103
|
+
|
|
92
104
|
export interface SandboxExecResult {
|
|
93
105
|
readonly exitCode: number
|
|
94
106
|
readonly stdout: string
|
|
@@ -107,6 +119,8 @@ export interface SandboxExecResult {
|
|
|
107
119
|
*/
|
|
108
120
|
readonly stdoutTruncated?: boolean
|
|
109
121
|
readonly stderrTruncated?: boolean
|
|
122
|
+
/** Set when a non-zero exit looks like a sandbox denial or a launcher failure. */
|
|
123
|
+
readonly attribution?: SandboxExecAttribution
|
|
110
124
|
}
|
|
111
125
|
|
|
112
126
|
// ---------------------------------------------------------------------------
|
|
@@ -189,10 +203,35 @@ export interface SandboxWalkFilesOptions {
|
|
|
189
203
|
readonly maxDepth?: number
|
|
190
204
|
/** Positive safe integer bounding emitted matching files. */
|
|
191
205
|
readonly maxEntries: number
|
|
192
|
-
/**
|
|
206
|
+
/**
|
|
207
|
+
* Positive safe integer bounding examined directory entries; defaults to
|
|
208
|
+
* 500,000. Reaching it ends the walk with the entries found so far (see
|
|
209
|
+
* {@link SandboxWalkSummary.stopped}) unless `failOnLimit` is set.
|
|
210
|
+
*/
|
|
193
211
|
readonly maxVisitedEntries?: number
|
|
194
212
|
/** Match hidden names through wildcards; explicit dotfile patterns always work. Defaults to false. */
|
|
195
213
|
readonly includeHidden?: boolean
|
|
214
|
+
/**
|
|
215
|
+
* Skip files and directories matched by `.gitignore`, `.ignore` and
|
|
216
|
+
* `.git/info/exclude` (the first only inside a git repository), and never
|
|
217
|
+
* descend into version-control directories. The root itself is never
|
|
218
|
+
* skipped. Defaults to true; pass false to walk ignored trees too.
|
|
219
|
+
*/
|
|
220
|
+
readonly respectIgnore?: boolean
|
|
221
|
+
/** Throw an error with code `ERR_FILE_WALK_LIMIT` at `maxVisitedEntries` instead of ending. Defaults to false. */
|
|
222
|
+
readonly failOnLimit?: boolean
|
|
223
|
+
/** Called once when the walk ends, with how it ended. A walker that cannot report omits the call. */
|
|
224
|
+
readonly onSummary?: (summary: SandboxWalkSummary) => void
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/** How a bounded walk ended. */
|
|
228
|
+
export interface SandboxWalkSummary {
|
|
229
|
+
/** Directory entries examined. */
|
|
230
|
+
readonly visited: number
|
|
231
|
+
/** Directories skipped because an ignore rule matched them. */
|
|
232
|
+
readonly ignoredDirectories: number
|
|
233
|
+
/** Present when the walk ended at its entry bound, so the entries are not the whole tree. */
|
|
234
|
+
readonly stopped?: 'entry-limit'
|
|
196
235
|
}
|
|
197
236
|
|
|
198
237
|
// ---------------------------------------------------------------------------
|
|
@@ -278,7 +278,9 @@ export const TurnSettlementSchema = z
|
|
|
278
278
|
const completedSettlement = TurnSettlementSchema.extend({
|
|
279
279
|
status: z.enum(['completed', 'cancelled']),
|
|
280
280
|
})
|
|
281
|
-
const failedSettlement = TurnSettlementSchema.extend({
|
|
281
|
+
const failedSettlement = TurnSettlementSchema.extend({
|
|
282
|
+
status: z.literal('failed'),
|
|
283
|
+
})
|
|
282
284
|
|
|
283
285
|
/** A body too large for one record, written (and fsynced) to `tool-results/` before the record. */
|
|
284
286
|
const spill = z
|
|
@@ -798,6 +800,36 @@ const RECORD_OPTIONS = [
|
|
|
798
800
|
...z.ZodDiscriminatedUnionOption<'type'>[],
|
|
799
801
|
]
|
|
800
802
|
|
|
803
|
+
/**
|
|
804
|
+
* A record of a type this reader does not know, written by a newer writer
|
|
805
|
+
* that flagged it `ignorable: true`: a promise that no reader needs it to
|
|
806
|
+
* rebuild the conversation. It is kept in the hash chain and verified like any
|
|
807
|
+
* other record, but never moves the fold. A known type never qualifies (its
|
|
808
|
+
* own schema decides), and an unknown type without the flag is still refused,
|
|
809
|
+
* so a record that does move the fold fails loudly on an older reader.
|
|
810
|
+
*/
|
|
811
|
+
export const IgnorableRecordSchema = z
|
|
812
|
+
.object({
|
|
813
|
+
...envelopeShape,
|
|
814
|
+
type: z
|
|
815
|
+
.string()
|
|
816
|
+
.min(1)
|
|
817
|
+
.refine((type) => !(SESSION_RECORD_TYPES as readonly string[]).includes(type), {
|
|
818
|
+
message: 'a type this reader knows is validated by its own schema',
|
|
819
|
+
}),
|
|
820
|
+
ignorable: z.literal(true),
|
|
821
|
+
})
|
|
822
|
+
.passthrough()
|
|
823
|
+
.superRefine((record, context) => {
|
|
824
|
+
if (record.seq === 1 || record.prev === null) {
|
|
825
|
+
context.addIssue({
|
|
826
|
+
code: z.ZodIssueCode.custom,
|
|
827
|
+
path: ['type'],
|
|
828
|
+
message: 'session_started is the first record of a session log, and only the first',
|
|
829
|
+
})
|
|
830
|
+
}
|
|
831
|
+
})
|
|
832
|
+
|
|
801
833
|
/** Validates one session record: envelope, discriminant, and every specified payload. */
|
|
802
834
|
export const SessionRecordSchema = z
|
|
803
835
|
.discriminatedUnion('type', RECORD_OPTIONS)
|
|
@@ -973,7 +1005,9 @@ export type SessionEventRecord<T extends PersistedSessionEventType = PersistedSe
|
|
|
973
1005
|
? Omit<EventOf<T>, 'sessionId' | 'turnId' | 'lineage' | 'v' | 'seq' | 'generation'> &
|
|
974
1006
|
RecordEnvelope &
|
|
975
1007
|
(T extends 'tool_completed'
|
|
976
|
-
? {
|
|
1008
|
+
? {
|
|
1009
|
+
readonly structuredResultSpill?: z.infer<typeof structuredResultSpill>
|
|
1010
|
+
}
|
|
977
1011
|
: T extends 'turn_completed'
|
|
978
1012
|
? {
|
|
979
1013
|
readonly resultSpill?: z.infer<typeof spill>
|
package/src/types/tool/index.ts
CHANGED
|
@@ -173,6 +173,8 @@ export interface BackgroundJobRegistryRef {
|
|
|
173
173
|
status: string
|
|
174
174
|
exitCode?: number
|
|
175
175
|
error?: string
|
|
176
|
+
/** When it last wrote output (epoch ms); absent until it has. */
|
|
177
|
+
lastOutputAt?: number
|
|
176
178
|
}
|
|
177
179
|
/**
|
|
178
180
|
* Take over a process the caller already started and is waiting on, so a
|
|
@@ -224,7 +226,19 @@ export interface BackgroundJobRegistryRef {
|
|
|
224
226
|
kind?: 'monitor'
|
|
225
227
|
/** What a monitor watches. */
|
|
226
228
|
description?: string
|
|
229
|
+
/** When the job started (epoch ms). Optional for hosts that do not keep it. */
|
|
230
|
+
startedAt?: number
|
|
231
|
+
/** When it last wrote output (epoch ms); absent until it has. */
|
|
232
|
+
lastOutputAt?: number
|
|
233
|
+
/** Its last non-empty output line, flattened and clipped. */
|
|
234
|
+
lastOutputLine?: string
|
|
227
235
|
}[]
|
|
236
|
+
/**
|
|
237
|
+
* Whether the job's process is still there, asked of the system rather than
|
|
238
|
+
* taken from the record. Optional: a host that cannot probe omits it, and a
|
|
239
|
+
* running job is then reported as alive on the registry's word.
|
|
240
|
+
*/
|
|
241
|
+
isAlive?(id: string): boolean
|
|
228
242
|
/**
|
|
229
243
|
* Await this job's exit instead of reading it in a loop; resolves at
|
|
230
244
|
* once for a job that has already stopped. Optional, and added after
|
|
@@ -259,6 +273,13 @@ export interface BackgroundJobRegistryRef {
|
|
|
259
273
|
* intent, and then there is simply no hold.
|
|
260
274
|
*/
|
|
261
275
|
markAwaited?(id: string): void
|
|
276
|
+
/**
|
|
277
|
+
* Say that this job's exit and output have just been handed to the model by
|
|
278
|
+
* a tool result (`wait_for_job` returning the exit, `job` read of a stopped
|
|
279
|
+
* job), so the exit notice that would announce the same exit is withdrawn
|
|
280
|
+
* instead of repeating it. Optional for the reason `markAwaited` is.
|
|
281
|
+
*/
|
|
282
|
+
markCollected?(id: string): void
|
|
262
283
|
}
|
|
263
284
|
|
|
264
285
|
/**
|
|
@@ -514,6 +535,15 @@ export interface ToolContext {
|
|
|
514
535
|
* directory; an absolute path inside any of these is accepted.
|
|
515
536
|
*/
|
|
516
537
|
additionalDirectories?: readonly string[]
|
|
538
|
+
/**
|
|
539
|
+
* Whether the session's read rules deny an absolute path. The search tools
|
|
540
|
+
* (`grep`, `glob`) call it for every file they would list or open and skip
|
|
541
|
+
* a denied one, so a search over a folder holding a denied file succeeds
|
|
542
|
+
* without showing or reading it. The executor supplies it from the turn's
|
|
543
|
+
* authorization gate (what the `read` tool would be told for that path);
|
|
544
|
+
* absent, no rules apply.
|
|
545
|
+
*/
|
|
546
|
+
readDenied?: (absolutePath: string) => boolean
|
|
517
547
|
/**
|
|
518
548
|
* Absolute path of the directory holding THIS session's retained tool
|
|
519
549
|
* output (the files an oversized result was saved to). The `read` tool may
|
|
@@ -175,6 +175,10 @@ export type ToolFacts =
|
|
|
175
175
|
readonly filesMatched?: number
|
|
176
176
|
readonly filesSearched?: number
|
|
177
177
|
readonly truncated?: boolean
|
|
178
|
+
/** A page or result cap cut the list; more results exist. */
|
|
179
|
+
readonly limited?: boolean
|
|
180
|
+
/** The search stopped before every file was examined. */
|
|
181
|
+
readonly incomplete?: boolean
|
|
178
182
|
}
|
|
179
183
|
| {
|
|
180
184
|
readonly kind: 'list'
|
|
@@ -182,6 +186,10 @@ export type ToolFacts =
|
|
|
182
186
|
readonly path?: string
|
|
183
187
|
readonly count?: number
|
|
184
188
|
readonly truncated?: boolean
|
|
189
|
+
/** A result cap cut the list; more files match. */
|
|
190
|
+
readonly limited?: boolean
|
|
191
|
+
/** The search stopped before every file was examined. */
|
|
192
|
+
readonly incomplete?: boolean
|
|
185
193
|
}
|
|
186
194
|
| {
|
|
187
195
|
readonly kind: 'edit'
|