@namzu/sdk 31.1.0 → 33.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 +188 -0
- package/dist/agents/ReactiveAgent.d.ts.map +1 -1
- package/dist/agents/ReactiveAgent.js +4 -0
- package/dist/agents/ReactiveAgent.js.map +1 -1
- package/dist/agents/SupervisorAgent.d.ts.map +1 -1
- package/dist/agents/SupervisorAgent.js +4 -0
- package/dist/agents/SupervisorAgent.js.map +1 -1
- package/dist/agents/runAgent.d.ts +4 -0
- package/dist/agents/runAgent.d.ts.map +1 -1
- package/dist/agents/runAgent.js +4 -0
- package/dist/agents/runAgent.js.map +1 -1
- package/dist/authorization/gate.d.ts +1 -1
- package/dist/authorization/gate.js +1 -1
- package/dist/connector/index.d.ts +1 -1
- package/dist/connector/index.d.ts.map +1 -1
- package/dist/connector/index.js +1 -1
- package/dist/connector/index.js.map +1 -1
- package/dist/connector/mcp/adapter.d.ts.map +1 -1
- package/dist/connector/mcp/adapter.js +71 -16
- package/dist/connector/mcp/adapter.js.map +1 -1
- package/dist/connector/mcp/client.d.ts.map +1 -1
- package/dist/connector/mcp/client.js +3 -2
- package/dist/connector/mcp/client.js.map +1 -1
- package/dist/connector/mcp/http-redirect.d.ts +17 -0
- package/dist/connector/mcp/http-redirect.d.ts.map +1 -0
- package/dist/connector/mcp/http-redirect.js +31 -0
- package/dist/connector/mcp/http-redirect.js.map +1 -0
- package/dist/connector/mcp/http-sse.d.ts.map +1 -1
- package/dist/connector/mcp/http-sse.js +5 -0
- package/dist/connector/mcp/http-sse.js.map +1 -1
- package/dist/connector/mcp/image-admission.d.ts +16 -0
- package/dist/connector/mcp/image-admission.d.ts.map +1 -0
- package/dist/connector/mcp/image-admission.js +288 -0
- package/dist/connector/mcp/image-admission.js.map +1 -0
- package/dist/connector/mcp/stdio.d.ts +13 -0
- package/dist/connector/mcp/stdio.d.ts.map +1 -1
- package/dist/connector/mcp/stdio.js +66 -23
- package/dist/connector/mcp/stdio.js.map +1 -1
- package/dist/connector/mcp/streamable-http.d.ts.map +1 -1
- package/dist/connector/mcp/streamable-http.js +3 -0
- package/dist/connector/mcp/streamable-http.js.map +1 -1
- package/dist/constants/tools/index.js +1 -1
- package/dist/constants/tools/index.js.map +1 -1
- package/dist/directory/derive-supervisor.d.ts.map +1 -1
- package/dist/directory/derive-supervisor.js +5 -0
- package/dist/directory/derive-supervisor.js.map +1 -1
- package/dist/directory/derive.d.ts.map +1 -1
- package/dist/directory/derive.js +5 -0
- package/dist/directory/derive.js.map +1 -1
- package/dist/directory/load.d.ts.map +1 -1
- package/dist/directory/load.js +1 -0
- package/dist/directory/load.js.map +1 -1
- package/dist/directory/types.d.ts +2 -0
- package/dist/directory/types.d.ts.map +1 -1
- package/dist/execution/base.d.ts +13 -0
- package/dist/execution/base.d.ts.map +1 -1
- package/dist/execution/base.js +103 -8
- package/dist/execution/base.js.map +1 -1
- package/dist/execution/code-runtime/types.d.ts +11 -1
- package/dist/execution/code-runtime/types.d.ts.map +1 -1
- package/dist/execution/code-runtime/types.js.map +1 -1
- package/dist/execution/code-runtime/worker.d.ts.map +1 -1
- package/dist/execution/code-runtime/worker.js +67 -9
- package/dist/execution/code-runtime/worker.js.map +1 -1
- package/dist/execution/errors.d.ts +12 -0
- package/dist/execution/errors.d.ts.map +1 -0
- package/dist/execution/errors.js +21 -0
- package/dist/execution/errors.js.map +1 -0
- package/dist/execution/factory.d.ts.map +1 -1
- package/dist/execution/factory.js +1 -0
- package/dist/execution/factory.js.map +1 -1
- package/dist/execution/hybrid.d.ts +5 -0
- package/dist/execution/hybrid.d.ts.map +1 -1
- package/dist/execution/hybrid.js +36 -16
- package/dist/execution/hybrid.js.map +1 -1
- package/dist/execution/index.d.ts +1 -0
- package/dist/execution/index.d.ts.map +1 -1
- package/dist/execution/index.js +1 -0
- package/dist/execution/index.js.map +1 -1
- package/dist/execution/local.d.ts +13 -0
- package/dist/execution/local.d.ts.map +1 -1
- package/dist/execution/local.js +145 -19
- package/dist/execution/local.js.map +1 -1
- package/dist/execution/output.d.ts +27 -0
- package/dist/execution/output.d.ts.map +1 -0
- package/dist/execution/output.js +105 -0
- package/dist/execution/output.js.map +1 -0
- package/dist/execution/remote.d.ts +26 -2
- package/dist/execution/remote.d.ts.map +1 -1
- package/dist/execution/remote.js +86 -15
- package/dist/execution/remote.js.map +1 -1
- package/dist/manager/agent/lifecycle.d.ts.map +1 -1
- package/dist/manager/agent/lifecycle.js +1 -0
- package/dist/manager/agent/lifecycle.js.map +1 -1
- package/dist/plugin/lifecycle.d.ts.map +1 -1
- package/dist/plugin/lifecycle.js +9 -3
- package/dist/plugin/lifecycle.js.map +1 -1
- package/dist/process/kill-tree.d.ts +11 -13
- package/dist/process/kill-tree.d.ts.map +1 -1
- package/dist/process/kill-tree.js +11 -13
- package/dist/process/kill-tree.js.map +1 -1
- package/dist/provider/errors.d.ts +1 -0
- package/dist/provider/errors.d.ts.map +1 -1
- package/dist/provider/errors.js +39 -1
- package/dist/provider/errors.js.map +1 -1
- package/dist/provider/fallback.d.ts.map +1 -1
- package/dist/provider/fallback.js +31 -0
- package/dist/provider/fallback.js.map +1 -1
- package/dist/provider/idle-timeout.d.ts.map +1 -1
- package/dist/provider/idle-timeout.js +5 -0
- package/dist/provider/idle-timeout.js.map +1 -1
- package/dist/provider/retry.d.ts.map +1 -1
- package/dist/provider/retry.js +5 -0
- package/dist/provider/retry.js.map +1 -1
- package/dist/public-runtime.d.ts +7 -5
- package/dist/public-runtime.d.ts.map +1 -1
- package/dist/public-runtime.js +9 -4
- package/dist/public-runtime.js.map +1 -1
- package/dist/public-types.d.ts +2 -1
- package/dist/public-types.d.ts.map +1 -1
- package/dist/registry/tool/execute.d.ts +7 -1
- package/dist/registry/tool/execute.d.ts.map +1 -1
- package/dist/registry/tool/execute.js +201 -54
- package/dist/registry/tool/execute.js.map +1 -1
- package/dist/run/command-gate.d.ts.map +1 -1
- package/dist/run/command-gate.js +11 -0
- package/dist/run/command-gate.js.map +1 -1
- package/dist/run/reporter.d.ts.map +1 -1
- package/dist/run/reporter.js +6 -1
- package/dist/run/reporter.js.map +1 -1
- package/dist/run/workspace-fingerprint.d.ts +4 -4
- package/dist/run/workspace-fingerprint.d.ts.map +1 -1
- package/dist/run/workspace-fingerprint.js +6 -4
- package/dist/run/workspace-fingerprint.js.map +1 -1
- package/dist/runtime/bidi/index.d.ts +1 -1
- package/dist/runtime/bidi/index.d.ts.map +1 -1
- package/dist/runtime/bidi/index.js +1 -1
- package/dist/runtime/bidi/index.js.map +1 -1
- package/dist/runtime/bidi/session.d.ts +19 -0
- package/dist/runtime/bidi/session.d.ts.map +1 -1
- package/dist/runtime/bidi/session.js +150 -26
- package/dist/runtime/bidi/session.js.map +1 -1
- package/dist/runtime/query/executor.d.ts +43 -1
- package/dist/runtime/query/executor.d.ts.map +1 -1
- package/dist/runtime/query/executor.js +824 -174
- package/dist/runtime/query/executor.js.map +1 -1
- package/dist/runtime/query/index.d.ts +5 -0
- package/dist/runtime/query/index.d.ts.map +1 -1
- package/dist/runtime/query/index.js +47 -4
- package/dist/runtime/query/index.js.map +1 -1
- package/dist/runtime/query/iteration/index.d.ts +1 -0
- package/dist/runtime/query/iteration/index.d.ts.map +1 -1
- package/dist/runtime/query/iteration/index.js +34 -14
- package/dist/runtime/query/iteration/index.js.map +1 -1
- package/dist/runtime/query/iteration/phases/advisory.js +2 -2
- package/dist/runtime/query/iteration/phases/advisory.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 +84 -22
- package/dist/runtime/query/iteration/phases/tool-review.js.map +1 -1
- package/dist/runtime/query/iteration/provider-rejected-image.d.ts +13 -0
- package/dist/runtime/query/iteration/provider-rejected-image.d.ts.map +1 -0
- package/dist/runtime/query/iteration/provider-rejected-image.js +91 -0
- package/dist/runtime/query/iteration/provider-rejected-image.js.map +1 -0
- package/dist/runtime/query/iteration/stream-turn.d.ts +4 -1
- package/dist/runtime/query/iteration/stream-turn.d.ts.map +1 -1
- package/dist/runtime/query/iteration/stream-turn.js +7 -3
- package/dist/runtime/query/iteration/stream-turn.js.map +1 -1
- package/dist/runtime/query/request-rich-content.d.ts +13 -0
- package/dist/runtime/query/request-rich-content.d.ts.map +1 -1
- package/dist/runtime/query/request-rich-content.js +173 -17
- package/dist/runtime/query/request-rich-content.js.map +1 -1
- package/dist/runtime/query/result.d.ts.map +1 -1
- package/dist/runtime/query/result.js +1 -0
- package/dist/runtime/query/result.js.map +1 -1
- package/dist/runtime/query/resume-pending.d.ts +5 -1
- package/dist/runtime/query/resume-pending.d.ts.map +1 -1
- package/dist/runtime/query/resume-pending.js +66 -1
- package/dist/runtime/query/resume-pending.js.map +1 -1
- package/dist/runtime/query/tool-output-budget.d.ts.map +1 -1
- package/dist/runtime/query/tool-output-budget.js +45 -16
- package/dist/runtime/query/tool-output-budget.js.map +1 -1
- package/dist/runtime/query/tooling.d.ts +6 -0
- package/dist/runtime/query/tooling.d.ts.map +1 -1
- package/dist/runtime/query/tooling.js +4 -0
- package/dist/runtime/query/tooling.js.map +1 -1
- package/dist/sandbox/provider/local.d.ts.map +1 -1
- package/dist/sandbox/provider/local.js +193 -41
- package/dist/sandbox/provider/local.js.map +1 -1
- package/dist/scheduler/delegating.d.ts +2 -1
- package/dist/scheduler/delegating.d.ts.map +1 -1
- package/dist/scheduler/delegating.js +6 -5
- package/dist/scheduler/delegating.js.map +1 -1
- package/dist/scheduler/local.d.ts +2 -1
- package/dist/scheduler/local.d.ts.map +1 -1
- package/dist/scheduler/local.js +2 -2
- package/dist/scheduler/local.js.map +1 -1
- package/dist/session/workspace/driver.d.ts +12 -4
- package/dist/session/workspace/driver.d.ts.map +1 -1
- package/dist/session/workspace/git-worktree.d.ts +17 -3
- package/dist/session/workspace/git-worktree.d.ts.map +1 -1
- package/dist/session/workspace/git-worktree.js +153 -34
- package/dist/session/workspace/git-worktree.js.map +1 -1
- package/dist/skills/registry.d.ts +15 -0
- package/dist/skills/registry.d.ts.map +1 -1
- package/dist/skills/registry.js +33 -0
- package/dist/skills/registry.js.map +1 -1
- package/dist/store/attachment/index.d.ts +24 -2
- package/dist/store/attachment/index.d.ts.map +1 -1
- package/dist/store/attachment/index.js +52 -5
- package/dist/store/attachment/index.js.map +1 -1
- package/dist/tools/builtins/computer-use.d.ts.map +1 -1
- package/dist/tools/builtins/computer-use.js +39 -2
- package/dist/tools/builtins/computer-use.js.map +1 -1
- package/dist/tools/builtins/lsp.d.ts +1 -1
- package/dist/tools/builtins/run-code.d.ts.map +1 -1
- package/dist/tools/builtins/run-code.js +24 -16
- package/dist/tools/builtins/run-code.js.map +1 -1
- package/dist/tools/builtins/skill.d.ts +2 -1
- package/dist/tools/builtins/skill.d.ts.map +1 -1
- package/dist/tools/builtins/skill.js +250 -6
- package/dist/tools/builtins/skill.js.map +1 -1
- package/dist/tools/coordinator/agent.d.ts.map +1 -1
- package/dist/tools/coordinator/agent.js +100 -30
- package/dist/tools/coordinator/agent.js.map +1 -1
- package/dist/types/agent/base.d.ts +4 -0
- package/dist/types/agent/base.d.ts.map +1 -1
- package/dist/types/agent/factory.d.ts +1 -0
- package/dist/types/agent/factory.d.ts.map +1 -1
- package/dist/types/agent/manager.d.ts +1 -1
- package/dist/types/agent/manager.d.ts.map +1 -1
- package/dist/types/agent/scheduler.d.ts +10 -1
- package/dist/types/agent/scheduler.d.ts.map +1 -1
- package/dist/types/authorization/index.d.ts +12 -12
- package/dist/types/bidi/index.d.ts +19 -2
- package/dist/types/bidi/index.d.ts.map +1 -1
- package/dist/types/computer-use/index.d.ts +18 -0
- package/dist/types/computer-use/index.d.ts.map +1 -1
- package/dist/types/connector/execution-context.d.ts +3 -1
- package/dist/types/connector/execution-context.d.ts.map +1 -1
- package/dist/types/execution/index.d.ts +43 -1
- package/dist/types/execution/index.d.ts.map +1 -1
- package/dist/types/hitl/index.d.ts +11 -0
- package/dist/types/hitl/index.d.ts.map +1 -1
- package/dist/types/hitl/index.js.map +1 -1
- package/dist/types/message/index.d.ts +31 -1
- package/dist/types/message/index.d.ts.map +1 -1
- package/dist/types/message/index.js +43 -0
- package/dist/types/message/index.js.map +1 -1
- package/dist/types/plugin/index.d.ts +14 -1
- package/dist/types/plugin/index.d.ts.map +1 -1
- package/dist/types/plugin/index.js +1 -0
- package/dist/types/plugin/index.js.map +1 -1
- package/dist/types/provider/error.d.ts +4 -1
- package/dist/types/provider/error.d.ts.map +1 -1
- package/dist/types/provider/interface.d.ts +14 -0
- package/dist/types/provider/interface.d.ts.map +1 -1
- package/dist/types/run/events.d.ts +10 -2
- package/dist/types/run/events.d.ts.map +1 -1
- package/dist/types/run/events.js.map +1 -1
- package/dist/types/sandbox/index.d.ts +15 -10
- package/dist/types/sandbox/index.d.ts.map +1 -1
- package/dist/types/sandbox/index.js.map +1 -1
- package/dist/types/tool/index.d.ts +129 -12
- package/dist/types/tool/index.d.ts.map +1 -1
- package/dist/types/tool/index.js.map +1 -1
- package/dist/types/workspace/ref.d.ts +5 -0
- package/dist/types/workspace/ref.d.ts.map +1 -1
- package/dist/utils/abort.d.ts +8 -0
- package/dist/utils/abort.d.ts.map +1 -1
- package/dist/utils/abort.js +16 -0
- package/dist/utils/abort.js.map +1 -1
- package/package.json +4 -4
- package/src/agents/ReactiveAgent.ts +4 -0
- package/src/agents/SupervisorAgent.ts +4 -0
- package/src/agents/runAgent.ts +8 -0
- package/src/authorization/gate.ts +1 -1
- package/src/connector/index.ts +2 -0
- package/src/connector/mcp/adapter.ts +82 -21
- package/src/connector/mcp/client.ts +2 -1
- package/src/connector/mcp/http-redirect.ts +32 -0
- package/src/connector/mcp/http-sse.ts +5 -0
- package/src/connector/mcp/image-admission.ts +272 -0
- package/src/connector/mcp/stdio.ts +63 -21
- package/src/connector/mcp/streamable-http.ts +3 -0
- package/src/constants/tools/index.ts +1 -1
- package/src/directory/derive-supervisor.ts +5 -0
- package/src/directory/derive.ts +5 -0
- package/src/directory/load.ts +1 -0
- package/src/directory/types.ts +2 -0
- package/src/execution/base.ts +124 -7
- package/src/execution/code-runtime/types.ts +15 -1
- package/src/execution/code-runtime/worker.ts +72 -9
- package/src/execution/errors.ts +24 -0
- package/src/execution/factory.ts +1 -0
- package/src/execution/hybrid.ts +47 -16
- package/src/execution/index.ts +1 -0
- package/src/execution/local.ts +164 -19
- package/src/execution/output.ts +104 -0
- package/src/execution/remote.ts +122 -17
- package/src/manager/agent/lifecycle.ts +1 -0
- package/src/plugin/lifecycle.ts +9 -3
- package/src/process/kill-tree.ts +11 -13
- package/src/provider/errors.ts +40 -1
- package/src/provider/fallback.ts +39 -0
- package/src/provider/idle-timeout.ts +8 -0
- package/src/provider/retry.ts +8 -0
- package/src/public-runtime.ts +23 -2
- package/src/public-types.ts +11 -0
- package/src/registry/tool/execute.ts +230 -64
- package/src/run/command-gate.ts +12 -0
- package/src/run/reporter.ts +7 -1
- package/src/run/workspace-fingerprint.ts +5 -4
- package/src/runtime/bidi/index.ts +1 -1
- package/src/runtime/bidi/session.ts +177 -28
- package/src/runtime/query/executor.ts +987 -172
- package/src/runtime/query/index.ts +59 -6
- package/src/runtime/query/iteration/index.ts +69 -29
- package/src/runtime/query/iteration/phases/advisory.ts +2 -2
- package/src/runtime/query/iteration/phases/tool-review.ts +87 -23
- package/src/runtime/query/iteration/provider-rejected-image.ts +106 -0
- package/src/runtime/query/iteration/stream-turn.ts +12 -2
- package/src/runtime/query/request-rich-content.ts +213 -15
- package/src/runtime/query/result.ts +1 -0
- package/src/runtime/query/resume-pending.ts +83 -1
- package/src/runtime/query/tool-output-budget.ts +52 -17
- package/src/runtime/query/tooling.ts +10 -0
- package/src/sandbox/provider/local.ts +213 -45
- package/src/scheduler/delegating.ts +6 -5
- package/src/scheduler/local.ts +3 -2
- package/src/session/workspace/driver.ts +12 -4
- package/src/session/workspace/git-worktree.ts +173 -34
- package/src/skills/registry.ts +47 -0
- package/src/store/attachment/index.ts +100 -15
- package/src/tools/builtins/computer-use.ts +45 -2
- package/src/tools/builtins/run-code.ts +24 -16
- package/src/tools/builtins/skill.ts +325 -7
- package/src/tools/coordinator/agent.ts +108 -33
- package/src/types/agent/base.ts +4 -0
- package/src/types/agent/factory.ts +1 -0
- package/src/types/agent/manager.ts +1 -1
- package/src/types/agent/scheduler.ts +10 -1
- package/src/types/bidi/index.ts +19 -2
- package/src/types/computer-use/index.ts +19 -0
- package/src/types/connector/execution-context.ts +3 -0
- package/src/types/execution/index.ts +46 -1
- package/src/types/hitl/index.ts +11 -0
- package/src/types/message/index.ts +78 -1
- package/src/types/plugin/index.ts +15 -0
- package/src/types/provider/error.ts +4 -1
- package/src/types/provider/interface.ts +18 -0
- package/src/types/run/events.ts +18 -4
- package/src/types/sandbox/index.ts +15 -10
- package/src/types/tool/index.ts +159 -15
- package/src/types/workspace/ref.ts +5 -0
- package/src/utils/abort.ts +18 -0
|
@@ -109,6 +109,25 @@ export type ComputerUseResult =
|
|
|
109
109
|
| { readonly type: 'cursor_position'; readonly point: Point }
|
|
110
110
|
| { readonly type: 'ok' }
|
|
111
111
|
|
|
112
|
+
/**
|
|
113
|
+
* A state-changing desktop action started, but its subprocess did not report
|
|
114
|
+
* a clean completion. The desktop may already have changed, so treating this
|
|
115
|
+
* as an ordinary failure and automatically replaying the action is unsafe.
|
|
116
|
+
*
|
|
117
|
+
* Host packages throw an error carrying this shape. The SDK recognises it
|
|
118
|
+
* structurally so separately installed host and SDK versions do not need to
|
|
119
|
+
* share an error constructor identity.
|
|
120
|
+
*/
|
|
121
|
+
export interface ComputerUseOutcomeUnknown {
|
|
122
|
+
readonly code: 'computer_use_outcome_unknown'
|
|
123
|
+
readonly action: ComputerUseAction['type']
|
|
124
|
+
readonly outcome: 'unknown'
|
|
125
|
+
readonly retrySafety: 'unsafe'
|
|
126
|
+
readonly timedOut: boolean
|
|
127
|
+
readonly exitCode: number
|
|
128
|
+
readonly message: string
|
|
129
|
+
}
|
|
130
|
+
|
|
112
131
|
// ---------------------------------------------------------------------------
|
|
113
132
|
// Host interface — the core abstraction. Mirrors Sandbox/SandboxProvider shape.
|
|
114
133
|
// Implementations live outside @namzu/sdk (e.g. @namzu/computer-use).
|
|
@@ -13,6 +13,7 @@ export type {
|
|
|
13
13
|
export type {
|
|
14
14
|
CommandOptions,
|
|
15
15
|
CommandResult,
|
|
16
|
+
CommandTermination,
|
|
16
17
|
CommandExecutor,
|
|
17
18
|
RemoteCommandHandler,
|
|
18
19
|
} from '../execution/index.js'
|
|
@@ -33,6 +34,8 @@ export interface LocalExecutionContextConfig extends ExecutionContextBase {
|
|
|
33
34
|
fsAccess: boolean
|
|
34
35
|
envVars?: Record<string, string>
|
|
35
36
|
shell?: string
|
|
37
|
+
/** Retained bytes per stdout/stderr stream. Defaults to 4 MiB; maximum 64 MiB. */
|
|
38
|
+
maxOutputBytes?: number
|
|
36
39
|
}
|
|
37
40
|
|
|
38
41
|
export interface RemoteExecutionContextConfig extends ExecutionContextBase {
|
|
@@ -5,22 +5,67 @@ export type ExecutionCapability = 'filesystem' | 'process' | 'network' | 'shell'
|
|
|
5
5
|
export interface CommandOptions {
|
|
6
6
|
cwd?: string
|
|
7
7
|
env?: Record<string, string>
|
|
8
|
+
/**
|
|
9
|
+
* Caller-owned cancellation for this command.
|
|
10
|
+
*
|
|
11
|
+
* A compliant executor may accept this only when it can prove that command
|
|
12
|
+
* admission never happened or that admitted work reached quiescence before
|
|
13
|
+
* settling. `LocalExecutionContext` owns that guarantee for its process
|
|
14
|
+
* group. `RemoteExecutionContext` refuses this option because its generic
|
|
15
|
+
* executor seam has no reservation and terminal-acknowledgement protocol;
|
|
16
|
+
* use the `Sandbox.exec()` contract for cancellable remote execution.
|
|
17
|
+
*/
|
|
18
|
+
signal?: AbortSignal
|
|
19
|
+
/**
|
|
20
|
+
* Command deadline in milliseconds; `0` disables the deadline.
|
|
21
|
+
*
|
|
22
|
+
* `LocalExecutionContext` owns its spawned process group through stdio
|
|
23
|
+
* close, first requesting termination and then forcing it after a bounded
|
|
24
|
+
* grace period. Remote handlers define how this option is enforced at their
|
|
25
|
+
* own execution boundary.
|
|
26
|
+
*/
|
|
8
27
|
timeoutMs?: number
|
|
9
28
|
shell?: string | boolean
|
|
10
29
|
}
|
|
11
30
|
|
|
31
|
+
export type CommandTermination =
|
|
32
|
+
| {
|
|
33
|
+
/** Caller cancellation was already present, so no process was admitted. */
|
|
34
|
+
origin: 'caller'
|
|
35
|
+
admitted: false
|
|
36
|
+
}
|
|
37
|
+
| {
|
|
38
|
+
/** The first Namzu-owned cause that requested termination. */
|
|
39
|
+
origin: 'caller' | 'timeout' | 'teardown'
|
|
40
|
+
admitted: true
|
|
41
|
+
/** The direct child's actual close signal, when Node reported one. */
|
|
42
|
+
signal?: string
|
|
43
|
+
}
|
|
44
|
+
|
|
12
45
|
export interface CommandResult {
|
|
13
|
-
|
|
46
|
+
/** Numeric process exit, or `null` when no numeric exit exists. */
|
|
47
|
+
exitCode: number | null
|
|
14
48
|
stdout: string
|
|
15
49
|
stderr: string
|
|
50
|
+
/** Whether the executor retained only part of stdout. Absent means unknown. */
|
|
51
|
+
stdoutTruncated?: boolean
|
|
52
|
+
/** Whether the executor retained only part of stderr. Absent means unknown. */
|
|
53
|
+
stderrTruncated?: boolean
|
|
16
54
|
durationMs: number
|
|
55
|
+
/** Present only when Namzu requested termination or refused pre-aborted admission. */
|
|
56
|
+
termination?: CommandTermination
|
|
17
57
|
}
|
|
18
58
|
|
|
19
59
|
export interface CommandExecutor {
|
|
20
60
|
executeCommand(command: string, args?: string[], options?: CommandOptions): Promise<CommandResult>
|
|
21
61
|
}
|
|
22
62
|
|
|
63
|
+
/**
|
|
64
|
+
* @deprecated Use `CommandExecutor` so command arguments retain their
|
|
65
|
+
* boundaries at the remote execution seam.
|
|
66
|
+
*/
|
|
23
67
|
export interface RemoteCommandHandler {
|
|
68
|
+
/** @deprecated Use `CommandExecutor.executeCommand()`. */
|
|
24
69
|
executeRemote(command: string, options?: CommandOptions): Promise<CommandResult>
|
|
25
70
|
}
|
|
26
71
|
|
package/src/types/hitl/index.ts
CHANGED
|
@@ -71,6 +71,17 @@ export interface ToolCallSummary {
|
|
|
71
71
|
name: string
|
|
72
72
|
input: unknown
|
|
73
73
|
isDestructive: boolean
|
|
74
|
+
/**
|
|
75
|
+
* Operator-policy verdict attached to the exact input shown for review.
|
|
76
|
+
*
|
|
77
|
+
* Persisted with a durable review so a later process cannot treat a call
|
|
78
|
+
* the gate denied as approved merely because the human approved a mixed
|
|
79
|
+
* batch. Absent only on checkpoints written before this field existed.
|
|
80
|
+
*/
|
|
81
|
+
authorization?: {
|
|
82
|
+
decision: 'allow' | 'deny' | 'review'
|
|
83
|
+
reason?: string
|
|
84
|
+
}
|
|
74
85
|
}
|
|
75
86
|
|
|
76
87
|
export interface ToolModification {
|
|
@@ -4,6 +4,22 @@ export type MessageRole = 'system' | 'user' | 'assistant' | 'tool'
|
|
|
4
4
|
|
|
5
5
|
export type CacheHint = 'cache' | 'ephemeral' | 'none'
|
|
6
6
|
|
|
7
|
+
/** Why durable rich content must not be sent to a model again. */
|
|
8
|
+
export interface ModelContentOmission {
|
|
9
|
+
readonly reason: 'provider-rejected' | 'invalid-image'
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** Runtime validation for persisted model-delivery metadata. */
|
|
13
|
+
export function isModelContentOmission(value: unknown): value is ModelContentOmission {
|
|
14
|
+
return (
|
|
15
|
+
typeof value === 'object' &&
|
|
16
|
+
value !== null &&
|
|
17
|
+
!Array.isArray(value) &&
|
|
18
|
+
((value as { readonly reason?: unknown }).reason === 'provider-rejected' ||
|
|
19
|
+
(value as { readonly reason?: unknown }).reason === 'invalid-image')
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
|
|
7
23
|
/**
|
|
8
24
|
* An image attached to a user message (vision input). Drivers that declare
|
|
9
25
|
* vision support emit it alongside the text. A shipped driver that cannot
|
|
@@ -22,6 +38,8 @@ export interface ImageAttachment {
|
|
|
22
38
|
readonly data: string
|
|
23
39
|
/** IANA media type, e.g. `image/png`, `image/jpeg`, `image/webp`. */
|
|
24
40
|
readonly mediaType: string
|
|
41
|
+
/** Durable delivery state; the original image bytes remain in history. */
|
|
42
|
+
readonly modelOmission?: ModelContentOmission
|
|
25
43
|
}
|
|
26
44
|
|
|
27
45
|
/**
|
|
@@ -212,7 +230,38 @@ export interface ProjectInstructionMessageSource {
|
|
|
212
230
|
readonly files: readonly string[]
|
|
213
231
|
}
|
|
214
232
|
|
|
215
|
-
|
|
233
|
+
/**
|
|
234
|
+
* Why the runtime, rather than the operator, inserted one user-role message.
|
|
235
|
+
*
|
|
236
|
+
* Providers require several pieces of host context to occupy the `user` role:
|
|
237
|
+
* a continuation after an output ceiling, reviewer feedback, task completion
|
|
238
|
+
* notices, and similar prompts. Role alone therefore cannot answer who wrote a
|
|
239
|
+
* durable message. Keeping that provenance on the message prevents a resumed
|
|
240
|
+
* transcript, export, or previous-prompt editor from presenting kernel context
|
|
241
|
+
* as something the operator typed.
|
|
242
|
+
*/
|
|
243
|
+
export const RUNTIME_CONTEXT_MESSAGE_KINDS = [
|
|
244
|
+
'advisory',
|
|
245
|
+
'answer-review',
|
|
246
|
+
'auto-continuation',
|
|
247
|
+
'limit-finalization',
|
|
248
|
+
'steering',
|
|
249
|
+
'structured-output',
|
|
250
|
+
'task-completion',
|
|
251
|
+
] as const
|
|
252
|
+
|
|
253
|
+
export type RuntimeContextMessageKind = (typeof RUNTIME_CONTEXT_MESSAGE_KINDS)[number]
|
|
254
|
+
|
|
255
|
+
/** Host-generated context carried in the provider's required user role. */
|
|
256
|
+
export interface RuntimeContextMessageSource {
|
|
257
|
+
readonly type: 'runtime-context'
|
|
258
|
+
readonly kind: RuntimeContextMessageKind
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
export type UserMessageSource =
|
|
262
|
+
| GoalRoundMessageSource
|
|
263
|
+
| ProjectInstructionMessageSource
|
|
264
|
+
| RuntimeContextMessageSource
|
|
216
265
|
|
|
217
266
|
/** A bounded source list keeps untrusted persisted metadata cheap to validate. */
|
|
218
267
|
export const MAX_PROJECT_INSTRUCTION_SOURCE_FILES = 256
|
|
@@ -254,6 +303,22 @@ export function isProjectInstructionMessageSource(
|
|
|
254
303
|
return true
|
|
255
304
|
}
|
|
256
305
|
|
|
306
|
+
/** Runtime validation for durable host-generated user-message provenance. */
|
|
307
|
+
export function isRuntimeContextMessageSource(
|
|
308
|
+
value: unknown,
|
|
309
|
+
): value is RuntimeContextMessageSource {
|
|
310
|
+
if (typeof value !== 'object' || value === null || Array.isArray(value)) return false
|
|
311
|
+
const candidate = value as {
|
|
312
|
+
readonly type?: unknown
|
|
313
|
+
readonly kind?: unknown
|
|
314
|
+
}
|
|
315
|
+
return (
|
|
316
|
+
candidate.type === 'runtime-context' &&
|
|
317
|
+
typeof candidate.kind === 'string' &&
|
|
318
|
+
(RUNTIME_CONTEXT_MESSAGE_KINDS as readonly string[]).includes(candidate.kind)
|
|
319
|
+
)
|
|
320
|
+
}
|
|
321
|
+
|
|
257
322
|
/**
|
|
258
323
|
* The configured model route that produced or is about to receive a message.
|
|
259
324
|
*
|
|
@@ -349,6 +414,7 @@ export type ToolResultBlock =
|
|
|
349
414
|
readonly type: 'image'
|
|
350
415
|
readonly data: string
|
|
351
416
|
readonly mediaType: string
|
|
417
|
+
readonly modelOmission?: ModelContentOmission
|
|
352
418
|
}
|
|
353
419
|
| DocumentAttachment
|
|
354
420
|
|
|
@@ -401,6 +467,17 @@ export function createUserMessage(
|
|
|
401
467
|
}
|
|
402
468
|
}
|
|
403
469
|
|
|
470
|
+
/** Build provider-visible context that no operator authored. */
|
|
471
|
+
export function createRuntimeContextMessage(
|
|
472
|
+
content: string,
|
|
473
|
+
kind: RuntimeContextMessageKind,
|
|
474
|
+
): UserMessage {
|
|
475
|
+
return createUserMessage(content, undefined, {
|
|
476
|
+
type: 'runtime-context',
|
|
477
|
+
kind,
|
|
478
|
+
})
|
|
479
|
+
}
|
|
480
|
+
|
|
404
481
|
/** Build the retained user-context message that carries live project policy. */
|
|
405
482
|
export function createProjectInstructionMessage(
|
|
406
483
|
content: string,
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
} from '../../constants/plugin/index.js'
|
|
11
11
|
import type { PluginId, RunId } from '../ids/index.js'
|
|
12
12
|
import type { Message, ToolResultContent } from '../message/index.js'
|
|
13
|
+
import type { CancelCause } from '../run/cancel-cause.js'
|
|
13
14
|
import type { ToolResult } from '../tool/index.js'
|
|
14
15
|
|
|
15
16
|
// ---------------------------------------------------------------------------
|
|
@@ -85,6 +86,7 @@ export function assertPluginContributionType(type: PluginContributionType): void
|
|
|
85
86
|
export type PluginHookEvent =
|
|
86
87
|
| 'run_start'
|
|
87
88
|
| 'run_end'
|
|
89
|
+
| 'run_interrupt'
|
|
88
90
|
| 'pre_tool_use'
|
|
89
91
|
| 'post_tool_use'
|
|
90
92
|
| 'pre_llm_call'
|
|
@@ -96,6 +98,7 @@ export function assertPluginHookEvent(event: PluginHookEvent): void {
|
|
|
96
98
|
switch (event) {
|
|
97
99
|
case 'run_start':
|
|
98
100
|
case 'run_end':
|
|
101
|
+
case 'run_interrupt':
|
|
99
102
|
case 'pre_tool_use':
|
|
100
103
|
case 'post_tool_use':
|
|
101
104
|
case 'pre_llm_call':
|
|
@@ -147,6 +150,15 @@ export interface PluginHookContext {
|
|
|
147
150
|
readonly toolInput?: unknown
|
|
148
151
|
readonly toolResult?: ToolResult
|
|
149
152
|
readonly iteration?: number
|
|
153
|
+
/**
|
|
154
|
+
* Why the run was stopped, on `run_interrupt`.
|
|
155
|
+
*
|
|
156
|
+
* That hook is emitted only for a root run carrying the explicit `user`
|
|
157
|
+
* cause. Keeping the field typed as the complete cause vocabulary lets a
|
|
158
|
+
* host narrow normally and leaves room for a future, deliberate expansion
|
|
159
|
+
* without overloading `event` or an error sentence.
|
|
160
|
+
*/
|
|
161
|
+
readonly cancelCause?: CancelCause
|
|
150
162
|
|
|
151
163
|
/**
|
|
152
164
|
* The request about to be sent, on `pre_llm_call`.
|
|
@@ -176,6 +188,9 @@ export interface PluginHookContext {
|
|
|
176
188
|
readonly response?: Readonly<PluginModelResponse>
|
|
177
189
|
/**
|
|
178
190
|
* Aborts when this hook's run is cancelled or its deadline expires.
|
|
191
|
+
* `run_interrupt` is the exception: the run is already cancelled, so its
|
|
192
|
+
* handler receives a fresh signal that represents only the bounded cleanup
|
|
193
|
+
* deadline. The original verdict is available as `cancelCause`.
|
|
179
194
|
*
|
|
180
195
|
* The runtime stops waiting on a slow hook either way, but in-process
|
|
181
196
|
* JavaScript cannot be forcibly stopped. Without a signal the hook itself
|
|
@@ -11,11 +11,14 @@ export type ProviderErrorKind =
|
|
|
11
11
|
* Serializable provider-failure metadata carried by failed runs and events.
|
|
12
12
|
*
|
|
13
13
|
* No response body, URL, or `cause` belongs here. `detail` is the one thing
|
|
14
|
-
* the provider itself said, and it arrives scrubbed
|
|
14
|
+
* the provider itself said, and it arrives scrubbed. `providerCode` preserves
|
|
15
|
+
* a bounded machine identifier independently of wording — see below.
|
|
15
16
|
*/
|
|
16
17
|
export interface ProviderErrorInfo {
|
|
17
18
|
readonly kind: ProviderErrorKind
|
|
18
19
|
readonly providerId: string
|
|
20
|
+
/** Provider-defined machine code, preserved only when it is a bounded safe token. */
|
|
21
|
+
readonly providerCode?: string
|
|
19
22
|
readonly status?: number
|
|
20
23
|
readonly retryAfterMs?: number
|
|
21
24
|
/**
|
|
@@ -163,6 +163,24 @@ export interface LLMProvider {
|
|
|
163
163
|
thinking?: import('./chat.js').ThinkingConfig,
|
|
164
164
|
): readonly import('./chat.js').ReasoningEffort[] | undefined
|
|
165
165
|
|
|
166
|
+
/**
|
|
167
|
+
* The effort a model uses when a request omits an explicit level.
|
|
168
|
+
*
|
|
169
|
+
* A directional control cannot infer this from the menu: a model may start
|
|
170
|
+
* anywhere in its advertised order, so treating "default" as an item before
|
|
171
|
+
* the first level can make an increase lower the effective effort. The
|
|
172
|
+
* method is optional because many drivers cannot establish a model-owned
|
|
173
|
+
* default. A present method returning `undefined` means this particular
|
|
174
|
+
* model is unknown.
|
|
175
|
+
*
|
|
176
|
+
* When both this and {@link LLMProvider.reasoningEffortLevelsFor} return an
|
|
177
|
+
* exact value, the default must be a member of that menu.
|
|
178
|
+
*/
|
|
179
|
+
reasoningEffortDefaultFor?(
|
|
180
|
+
model: string,
|
|
181
|
+
thinking?: import('./chat.js').ThinkingConfig,
|
|
182
|
+
): import('./chat.js').ReasoningEffort | undefined
|
|
183
|
+
|
|
166
184
|
/**
|
|
167
185
|
* Legacy effort menu which cannot distinguish an unknown model from a model
|
|
168
186
|
* with no effort support.
|
package/src/types/run/events.ts
CHANGED
|
@@ -320,7 +320,12 @@ type CoreRunEvent =
|
|
|
320
320
|
* draws eleven siblings where there is one call with eleven
|
|
321
321
|
* children.
|
|
322
322
|
*/
|
|
323
|
-
via?: {
|
|
323
|
+
via?: {
|
|
324
|
+
readonly tool: string
|
|
325
|
+
readonly toolUseId: ToolUseId
|
|
326
|
+
/** The code runtime's request id, when that was the dispatch source. */
|
|
327
|
+
readonly runtimeToolCallId?: string
|
|
328
|
+
}
|
|
324
329
|
}
|
|
325
330
|
/**
|
|
326
331
|
* A tool saying how far along it is.
|
|
@@ -334,7 +339,10 @@ type CoreRunEvent =
|
|
|
334
339
|
* duration: the host could show that a tool had started and then nothing
|
|
335
340
|
* at all until it either finished or timed out. The model never sees
|
|
336
341
|
* these; they answer "is it still working?", which is a question only a
|
|
337
|
-
* human asks.
|
|
342
|
+
* human asks. It is latest state rather than a lossless log: the executor
|
|
343
|
+
* bounds each UTF-8 message and coalesces intermediate updates when the
|
|
344
|
+
* live consumer falls behind. Complete output belongs to the terminal
|
|
345
|
+
* `tool_completed` result.
|
|
338
346
|
*/
|
|
339
347
|
| {
|
|
340
348
|
type: 'tool_progress'
|
|
@@ -412,7 +420,11 @@ type CoreRunEvent =
|
|
|
412
420
|
isError: boolean
|
|
413
421
|
/** See {@link tool_executing}'s `via`. Carried on both, so a
|
|
414
422
|
* consumer can pair them without holding the start event. */
|
|
415
|
-
via?: {
|
|
423
|
+
via?: {
|
|
424
|
+
readonly tool: string
|
|
425
|
+
readonly toolUseId: ToolUseId
|
|
426
|
+
readonly runtimeToolCallId?: string
|
|
427
|
+
}
|
|
416
428
|
/**
|
|
417
429
|
* Wall-clock the tool took. Computed since the first version of
|
|
418
430
|
* the executor but only ever logged; a host asking "which tool
|
|
@@ -603,10 +615,12 @@ type CoreRunEvent =
|
|
|
603
615
|
| {
|
|
604
616
|
type: 'message_history_repaired'
|
|
605
617
|
runId: RunId
|
|
606
|
-
source: 'fresh-history' | 'abandoned-checkpoint'
|
|
618
|
+
source: 'fresh-history' | 'abandoned-checkpoint' | 'provider-rejected-image'
|
|
607
619
|
duplicateToolResultsRemoved: number
|
|
608
620
|
orphanedToolResultsRemoved: number
|
|
609
621
|
syntheticToolResultsInserted: number
|
|
622
|
+
/** Exact number of durable image occurrences withheld from later requests. */
|
|
623
|
+
providerRejectedImagesSuppressed?: number
|
|
610
624
|
}
|
|
611
625
|
| {
|
|
612
626
|
type: 'token_usage_updated'
|
|
@@ -141,22 +141,27 @@ export interface SandboxExecOptions {
|
|
|
141
141
|
readonly data: string
|
|
142
142
|
}) => void
|
|
143
143
|
/**
|
|
144
|
-
* Cancellation for the command. A backend that
|
|
145
|
-
*
|
|
144
|
+
* Cancellation for the command. A backend that accepts it must terminate
|
|
145
|
+
* the owned process or prove that admission never happened. A backend that
|
|
146
|
+
* cannot make that guarantee must refuse before admission; silently
|
|
147
|
+
* ignoring the signal is not a compliant implementation.
|
|
146
148
|
*
|
|
147
149
|
* Without it a Stop (or a per-tool deadline) could only ever abandon
|
|
148
150
|
* the *wait* — the sandboxed process kept running after the host
|
|
149
151
|
* believed the run had been cancelled.
|
|
150
152
|
*
|
|
151
|
-
* **Who honours it.** The in-process local sandbox does: the
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
153
|
+
* **Who honours it.** The in-process local sandbox does: the run owns a
|
|
154
|
+
* listener until the process group's shared stdio closes, and terminates
|
|
155
|
+
* that group directly. The HTTP-container backends in `@namzu/sandbox` also
|
|
156
|
+
* do: a
|
|
157
|
+
* current peer reserves an execution before admission and confirms its
|
|
158
|
+
* cancellation over a separate control request. Older worker and microVM
|
|
159
|
+
* images are refused when this option is present, because aborting only the HTTP
|
|
160
|
+
* or framed data request would abandon the wait and leave the command
|
|
161
|
+
* running.
|
|
157
162
|
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
163
|
+
* Every backend shipped by Namzu therefore either enforces the signal or
|
|
164
|
+
* returns an explicit unsupported error before running the command.
|
|
160
165
|
*/
|
|
161
166
|
readonly signal?: AbortSignal
|
|
162
167
|
}
|