@namzu/sdk 59.0.0 → 60.1.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 +120 -0
- package/dist/agents/QueryAgent.d.ts.map +1 -1
- package/dist/agents/QueryAgent.js +1 -0
- package/dist/agents/QueryAgent.js.map +1 -1
- package/dist/bridge/a2a/mapper.d.ts.map +1 -1
- package/dist/bridge/a2a/mapper.js +16 -0
- package/dist/bridge/a2a/mapper.js.map +1 -1
- package/dist/bridge/acp/update.d.ts.map +1 -1
- package/dist/bridge/acp/update.js +1 -0
- package/dist/bridge/acp/update.js.map +1 -1
- package/dist/bridge/sse/mapper.d.ts.map +1 -1
- package/dist/bridge/sse/mapper.js +12 -0
- package/dist/bridge/sse/mapper.js.map +1 -1
- 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/constants/continuation.d.ts +9 -0
- package/dist/constants/continuation.d.ts.map +1 -1
- package/dist/constants/continuation.js +9 -0
- package/dist/constants/continuation.js.map +1 -1
- package/dist/contracts/session/api.d.ts +7 -1
- package/dist/contracts/session/api.d.ts.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/manager/session/turn-recorder.d.ts.map +1 -1
- package/dist/manager/session/turn-recorder.js +1 -0
- package/dist/manager/session/turn-recorder.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/collect-chat-completion.d.ts.map +1 -1
- package/dist/provider/collect-chat-completion.js +4 -0
- package/dist/provider/collect-chat-completion.js.map +1 -1
- package/dist/provider/fallback.d.ts.map +1 -1
- package/dist/provider/fallback.js +11 -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/mock.d.ts +2 -0
- package/dist/provider/mock.d.ts.map +1 -1
- package/dist/provider/mock.js +16 -8
- package/dist/provider/mock.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 +78 -0
- package/dist/provider/model-window-suffix.js.map +1 -0
- 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 +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 +34 -0
- package/dist/runtime/query/index.d.ts.map +1 -1
- package/dist/runtime/query/index.js +32 -5
- package/dist/runtime/query/index.js.map +1 -1
- package/dist/runtime/query/iteration/effort-clamp.d.ts +13 -0
- package/dist/runtime/query/iteration/effort-clamp.d.ts.map +1 -0
- package/dist/runtime/query/iteration/effort-clamp.js +42 -0
- package/dist/runtime/query/iteration/effort-clamp.js.map +1 -0
- package/dist/runtime/query/iteration/index.d.ts +34 -0
- package/dist/runtime/query/iteration/index.d.ts.map +1 -1
- package/dist/runtime/query/iteration/index.js +199 -6
- package/dist/runtime/query/iteration/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 +9 -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/iteration/stream-turn.d.ts.map +1 -1
- package/dist/runtime/query/iteration/stream-turn.js +6 -0
- package/dist/runtime/query/iteration/stream-turn.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/memory/disk.d.ts.map +1 -1
- package/dist/store/memory/disk.js +1 -1
- package/dist/store/memory/disk.js.map +1 -1
- package/dist/store/memory/markdown.d.ts.map +1 -1
- package/dist/store/memory/markdown.js +1 -1
- package/dist/store/memory/markdown.js.map +1 -1
- package/dist/store/memory/operation-lock.d.ts +20 -4
- package/dist/store/memory/operation-lock.d.ts.map +1 -1
- package/dist/store/memory/operation-lock.js +235 -58
- package/dist/store/memory/operation-lock.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/turn/reporter.d.ts.map +1 -1
- package/dist/turn/reporter.js +11 -0
- package/dist/turn/reporter.js.map +1 -1
- package/dist/types/agent/query.d.ts +2 -0
- package/dist/types/agent/query.d.ts.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/message/index.d.ts +1 -1
- package/dist/types/message/index.d.ts.map +1 -1
- package/dist/types/message/index.js +1 -0
- package/dist/types/message/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/provider/chat.d.ts +19 -0
- package/dist/types/provider/chat.d.ts.map +1 -1
- package/dist/types/provider/config.d.ts +7 -0
- package/dist/types/provider/config.d.ts.map +1 -1
- package/dist/types/provider/index.d.ts +1 -1
- package/dist/types/provider/index.d.ts.map +1 -1
- package/dist/types/provider/interface.d.ts +15 -0
- package/dist/types/provider/interface.d.ts.map +1 -1
- package/dist/types/provider/stream.d.ts +6 -0
- package/dist/types/provider/stream.d.ts.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/events.d.ts +34 -0
- package/dist/types/session/events.d.ts.map +1 -1
- package/dist/types/session/events.js.map +1 -1
- package/dist/types/session/records.d.ts +298 -34
- package/dist/types/session/records.d.ts.map +1 -1
- package/dist/types/session/records.js +35 -1
- package/dist/types/session/records.js.map +1 -1
- package/dist/types/session/stop-reason.d.ts +11 -0
- package/dist/types/session/stop-reason.d.ts.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/agents/QueryAgent.ts +1 -0
- package/src/bridge/a2a/mapper.ts +19 -0
- package/src/bridge/acp/update.ts +6 -1
- package/src/bridge/sse/mapper.ts +13 -0
- package/src/compaction/context-window.ts +163 -2
- package/src/constants/continuation.ts +13 -0
- package/src/contracts/session/api.ts +6 -0
- 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/manager/session/turn-recorder.ts +1 -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/collect-chat-completion.ts +3 -0
- package/src/provider/fallback.ts +17 -0
- package/src/provider/idle-timeout.ts +9 -0
- package/src/provider/mock.ts +19 -9
- package/src/provider/model-window-suffix.ts +85 -0
- package/src/provider/retry.ts +9 -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 +65 -7
- package/src/runtime/query/iteration/effort-clamp.ts +46 -0
- package/src/runtime/query/iteration/index.ts +260 -6
- package/src/runtime/query/iteration/outstanding-work.ts +12 -3
- package/src/runtime/query/iteration/phases/context.ts +9 -0
- package/src/runtime/query/iteration/phases/tool-review.ts +73 -8
- package/src/runtime/query/iteration/stream-turn.ts +5 -0
- 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/memory/disk.ts +1 -0
- package/src/store/memory/markdown.ts +1 -0
- package/src/store/memory/operation-lock.ts +288 -57
- 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/turn/reporter.ts +12 -0
- package/src/types/agent/query.ts +2 -0
- package/src/types/computer-use/index.ts +157 -15
- package/src/types/message/index.ts +5 -3
- package/src/types/plugin/index.ts +8 -0
- package/src/types/provider/chat.ts +20 -0
- package/src/types/provider/config.ts +7 -0
- package/src/types/provider/index.ts +1 -0
- package/src/types/provider/interface.ts +20 -0
- package/src/types/provider/stream.ts +6 -0
- package/src/types/sandbox/index.ts +40 -1
- package/src/types/session/events.ts +65 -5
- package/src/types/session/records.ts +39 -2
- package/src/types/session/stop-reason.ts +11 -0
- package/src/types/tool/index.ts +30 -0
- package/src/types/tool/presentation.ts +8 -0
|
@@ -102,7 +102,12 @@ type CoreSessionEvent =
|
|
|
102
102
|
/** The token ledger this turn spends from, keyed by the root turn. */
|
|
103
103
|
budget?: TurnBudgetBinding
|
|
104
104
|
}
|
|
105
|
-
| {
|
|
105
|
+
| {
|
|
106
|
+
type: 'iteration_started'
|
|
107
|
+
sessionId: SessionId
|
|
108
|
+
turnId: TurnId
|
|
109
|
+
iteration: number
|
|
110
|
+
}
|
|
106
111
|
/**
|
|
107
112
|
* Who answers when this turn asks a human, changed mid-turn.
|
|
108
113
|
*
|
|
@@ -454,6 +459,40 @@ type CoreSessionEvent =
|
|
|
454
459
|
*/
|
|
455
460
|
restart?: boolean
|
|
456
461
|
}
|
|
462
|
+
/**
|
|
463
|
+
* The model declined to answer, and what the turn did about it.
|
|
464
|
+
*
|
|
465
|
+
* The provider finished a reply as a refusal or a safety block. The refused
|
|
466
|
+
* reply is kept out of the history sent next. `outcome` says what followed:
|
|
467
|
+
*
|
|
468
|
+
* - `'fallback'`: the request is being re-run on `fallbackModel`, which the
|
|
469
|
+
* rest of the turn keeps. A host that owns the session's model is expected
|
|
470
|
+
* to keep it for later turns too and to say so.
|
|
471
|
+
* - `'retry'`: no other model was available and the refused reply had
|
|
472
|
+
* partial output, so the request is being re-run once on the same model
|
|
473
|
+
* with a note that the previous reply was stopped.
|
|
474
|
+
* - `'declined'`: nothing recovered it. The turn settles with stop reason
|
|
475
|
+
* `'refused'`.
|
|
476
|
+
*
|
|
477
|
+
* Like `provider_fallback`, this is the feature's honesty: a swapped model
|
|
478
|
+
* must be shown, not logged. It is emitted before the re-run starts.
|
|
479
|
+
*/
|
|
480
|
+
| {
|
|
481
|
+
type: 'model_refusal'
|
|
482
|
+
sessionId: SessionId
|
|
483
|
+
turnId: TurnId
|
|
484
|
+
iteration: number
|
|
485
|
+
/** The model that declined. */
|
|
486
|
+
model: string
|
|
487
|
+
providerId: string
|
|
488
|
+
outcome: 'fallback' | 'retry' | 'declined'
|
|
489
|
+
/** The model the request moves to. Set only with `outcome: 'fallback'`. */
|
|
490
|
+
fallbackModel?: string
|
|
491
|
+
/** The provider's own classification, when it gave one. */
|
|
492
|
+
category?: string
|
|
493
|
+
/** The provider's own sentence, when it gave one. Show it; do not parse it. */
|
|
494
|
+
explanation?: string
|
|
495
|
+
}
|
|
457
496
|
| {
|
|
458
497
|
type: 'tool_completed'
|
|
459
498
|
/** Bounded result view; omitted when output was overridden or truncated. */
|
|
@@ -892,7 +931,12 @@ type CoreSessionEvent =
|
|
|
892
931
|
steps: PlanStep[]
|
|
893
932
|
summary?: string
|
|
894
933
|
}
|
|
895
|
-
| {
|
|
934
|
+
| {
|
|
935
|
+
type: 'plan_approved'
|
|
936
|
+
sessionId: SessionId
|
|
937
|
+
turnId: TurnId
|
|
938
|
+
planId: PlanId
|
|
939
|
+
}
|
|
896
940
|
| {
|
|
897
941
|
type: 'plan_rejected'
|
|
898
942
|
sessionId: SessionId
|
|
@@ -923,7 +967,12 @@ type CoreSessionEvent =
|
|
|
923
967
|
* through `onContextCreated`, so they proved the plan settled without ever
|
|
924
968
|
* asking whether a consumer of the EVENT STREAM could see it.
|
|
925
969
|
*/
|
|
926
|
-
| {
|
|
970
|
+
| {
|
|
971
|
+
type: 'plan_completed'
|
|
972
|
+
sessionId: SessionId
|
|
973
|
+
turnId: TurnId
|
|
974
|
+
planId: PlanId
|
|
975
|
+
}
|
|
927
976
|
/**
|
|
928
977
|
* The plan is over and it did not finish.
|
|
929
978
|
*
|
|
@@ -931,7 +980,13 @@ type CoreSessionEvent =
|
|
|
931
980
|
* an event that says "failed" without saying why puts the reader back
|
|
932
981
|
* where the missing event did.
|
|
933
982
|
*/
|
|
934
|
-
| {
|
|
983
|
+
| {
|
|
984
|
+
type: 'plan_failed'
|
|
985
|
+
sessionId: SessionId
|
|
986
|
+
turnId: TurnId
|
|
987
|
+
planId: PlanId
|
|
988
|
+
reason?: string
|
|
989
|
+
}
|
|
935
990
|
| {
|
|
936
991
|
type: 'agent_pending'
|
|
937
992
|
sessionId: SessionId
|
|
@@ -1103,7 +1158,12 @@ type CoreSessionEvent =
|
|
|
1103
1158
|
exitCode: number
|
|
1104
1159
|
durationMs: number
|
|
1105
1160
|
}
|
|
1106
|
-
| {
|
|
1161
|
+
| {
|
|
1162
|
+
type: 'sandbox_destroyed'
|
|
1163
|
+
sessionId: SessionId
|
|
1164
|
+
turnId?: TurnId
|
|
1165
|
+
sandboxId: SandboxId
|
|
1166
|
+
}
|
|
1107
1167
|
// ─────────────────────────────────────────────────────────────────────
|
|
1108
1168
|
// v3 message + tool-input lifecycle (additive 2026-05; see
|
|
1109
1169
|
// ses_001-tool-stream-events). These are not yet emitted by the
|
|
@@ -236,6 +236,7 @@ const stopReason = z.enum([
|
|
|
236
236
|
'step_refused',
|
|
237
237
|
'structured_output_failed',
|
|
238
238
|
'output_limit',
|
|
239
|
+
'refused',
|
|
239
240
|
'answer_rejected',
|
|
240
241
|
'input_guardrail',
|
|
241
242
|
'output_guardrail',
|
|
@@ -278,7 +279,9 @@ export const TurnSettlementSchema = z
|
|
|
278
279
|
const completedSettlement = TurnSettlementSchema.extend({
|
|
279
280
|
status: z.enum(['completed', 'cancelled']),
|
|
280
281
|
})
|
|
281
|
-
const failedSettlement = TurnSettlementSchema.extend({
|
|
282
|
+
const failedSettlement = TurnSettlementSchema.extend({
|
|
283
|
+
status: z.literal('failed'),
|
|
284
|
+
})
|
|
282
285
|
|
|
283
286
|
/** A body too large for one record, written (and fsynced) to `tool-results/` before the record. */
|
|
284
287
|
const spill = z
|
|
@@ -653,6 +656,7 @@ const SESSION_EVENT_TYPE_TABLE: Record<SessionEventType, true> = {
|
|
|
653
656
|
hosted_tool: true,
|
|
654
657
|
provider_retry: true,
|
|
655
658
|
provider_fallback: true,
|
|
659
|
+
model_refusal: true,
|
|
656
660
|
tool_completed: true,
|
|
657
661
|
user_question_asked: true,
|
|
658
662
|
user_question_answered: true,
|
|
@@ -747,6 +751,7 @@ const TURN_BOUND_OTHER_TYPE_LIST = [
|
|
|
747
751
|
'hosted_tool',
|
|
748
752
|
'provider_retry',
|
|
749
753
|
'provider_fallback',
|
|
754
|
+
'model_refusal',
|
|
750
755
|
'tool_completed',
|
|
751
756
|
'user_question_asked',
|
|
752
757
|
'user_question_answered',
|
|
@@ -798,6 +803,36 @@ const RECORD_OPTIONS = [
|
|
|
798
803
|
...z.ZodDiscriminatedUnionOption<'type'>[],
|
|
799
804
|
]
|
|
800
805
|
|
|
806
|
+
/**
|
|
807
|
+
* A record of a type this reader does not know, written by a newer writer
|
|
808
|
+
* that flagged it `ignorable: true`: a promise that no reader needs it to
|
|
809
|
+
* rebuild the conversation. It is kept in the hash chain and verified like any
|
|
810
|
+
* other record, but never moves the fold. A known type never qualifies (its
|
|
811
|
+
* own schema decides), and an unknown type without the flag is still refused,
|
|
812
|
+
* so a record that does move the fold fails loudly on an older reader.
|
|
813
|
+
*/
|
|
814
|
+
export const IgnorableRecordSchema = z
|
|
815
|
+
.object({
|
|
816
|
+
...envelopeShape,
|
|
817
|
+
type: z
|
|
818
|
+
.string()
|
|
819
|
+
.min(1)
|
|
820
|
+
.refine((type) => !(SESSION_RECORD_TYPES as readonly string[]).includes(type), {
|
|
821
|
+
message: 'a type this reader knows is validated by its own schema',
|
|
822
|
+
}),
|
|
823
|
+
ignorable: z.literal(true),
|
|
824
|
+
})
|
|
825
|
+
.passthrough()
|
|
826
|
+
.superRefine((record, context) => {
|
|
827
|
+
if (record.seq === 1 || record.prev === null) {
|
|
828
|
+
context.addIssue({
|
|
829
|
+
code: z.ZodIssueCode.custom,
|
|
830
|
+
path: ['type'],
|
|
831
|
+
message: 'session_started is the first record of a session log, and only the first',
|
|
832
|
+
})
|
|
833
|
+
}
|
|
834
|
+
})
|
|
835
|
+
|
|
801
836
|
/** Validates one session record: envelope, discriminant, and every specified payload. */
|
|
802
837
|
export const SessionRecordSchema = z
|
|
803
838
|
.discriminatedUnion('type', RECORD_OPTIONS)
|
|
@@ -973,7 +1008,9 @@ export type SessionEventRecord<T extends PersistedSessionEventType = PersistedSe
|
|
|
973
1008
|
? Omit<EventOf<T>, 'sessionId' | 'turnId' | 'lineage' | 'v' | 'seq' | 'generation'> &
|
|
974
1009
|
RecordEnvelope &
|
|
975
1010
|
(T extends 'tool_completed'
|
|
976
|
-
? {
|
|
1011
|
+
? {
|
|
1012
|
+
readonly structuredResultSpill?: z.infer<typeof structuredResultSpill>
|
|
1013
|
+
}
|
|
977
1014
|
: T extends 'turn_completed'
|
|
978
1015
|
? {
|
|
979
1016
|
readonly resultSpill?: z.infer<typeof spill>
|
|
@@ -53,6 +53,17 @@ export type StopReason =
|
|
|
53
53
|
* looking for a loop instead of at the reviewer.
|
|
54
54
|
*/
|
|
55
55
|
| 'answer_rejected'
|
|
56
|
+
/**
|
|
57
|
+
* The model declined to answer and nothing recovered it.
|
|
58
|
+
*
|
|
59
|
+
* Its provider finished the reply as a refusal or a safety block, and the
|
|
60
|
+
* one automatic retry this turn allows was not available or was refused
|
|
61
|
+
* too. Distinct from `end_turn` so a host never reads a declined request
|
|
62
|
+
* as a finished one, and from `error` because nothing failed: the model
|
|
63
|
+
* answered, and the answer was no. The refused reply is not in the
|
|
64
|
+
* history; a `model_refusal` event carries what the provider said.
|
|
65
|
+
*/
|
|
66
|
+
| 'refused'
|
|
56
67
|
/** An input guardrail refused the turn before it started. */
|
|
57
68
|
| 'input_guardrail'
|
|
58
69
|
/** An output guardrail refused the produced result. */
|
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'
|