@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
|
@@ -294,6 +294,17 @@ export class AwaitedJobs {
|
|
|
294
294
|
noticesDelivered() {
|
|
295
295
|
this.exits = [];
|
|
296
296
|
}
|
|
297
|
+
/**
|
|
298
|
+
* Say that a tool result has handed the model this job's exit and output.
|
|
299
|
+
* Its entry goes, so a hold is not opened for a result the model has read;
|
|
300
|
+
* the notice for the same exit is withdrawn by the caller.
|
|
301
|
+
*/
|
|
302
|
+
collected(id) {
|
|
303
|
+
this.outstanding.delete(id);
|
|
304
|
+
this.exits = this.exits.filter((job) => job.id !== id);
|
|
305
|
+
for (const wake of [...this.arrivals])
|
|
306
|
+
wake();
|
|
307
|
+
}
|
|
297
308
|
/**
|
|
298
309
|
* Take the recorded exits together with the text that delivers them, or
|
|
299
310
|
* take neither.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"awaited-jobs.js","sourceRoot":"","sources":["../../../src/runtime/jobs/awaited-jobs.ts"],"names":[],"mappings":"AA0CA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,OAAO,WAAW;IAaL;IAEA;IA6BA;IAEA;IA7ClB,oEAAoE;IACnD,WAAW,GAAG,IAAI,GAAG,EAAU,CAAA;IAChD,0CAA0C;IAClC,KAAK,GAAoB,EAAE,CAAA;IAClB,QAAQ,GAAG,IAAI,GAAG,EAAc,CAAA;IACzC,MAAM,CAAa;IAC3B,gEAAgE;IAC/C,QAAQ,GAAG,IAAI,GAAG,EAAU,CAAA;IAC7C,qEAAqE;IAC7D,eAAe,GAAG,CAAC,CAAA;IAE3B,YACkB,MAAwB;IACzC,4EAA4E;IAC3D,KAAa;IAC9B;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACc,YAA4B;IAC7C,wEAAwE;IAC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AAC,QAAQ,CAAC,KAAK,EAAE,CAAA;IACtB,CAAC;CACD"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What the host's exit has to stop: a job's process, and how to signal it.
|
|
3
|
+
*/
|
|
4
|
+
export interface HostExitTarget {
|
|
5
|
+
readonly child: {
|
|
6
|
+
readonly pid?: number | undefined;
|
|
7
|
+
};
|
|
8
|
+
/** The spawner's own kill, when it gave one; otherwise the process group is signalled. */
|
|
9
|
+
readonly kill?: (signal: NodeJS.Signals) => void;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Track a running job so the host's exit stops it. Returns the untrack, to be
|
|
13
|
+
* called once the job has ended. The listener is installed once per process, on
|
|
14
|
+
* the first job, and is put first so a later listener that throws cannot
|
|
15
|
+
* keep it from running.
|
|
16
|
+
*/
|
|
17
|
+
export declare function stopAtHostExit(target: HostExitTarget): () => void;
|
|
18
|
+
/** Jobs the host's exit would stop. For tests. */
|
|
19
|
+
export declare function trackedForHostExit(): number;
|
|
20
|
+
//# sourceMappingURL=host-exit-finalizer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-exit-finalizer.d.ts","sourceRoot":"","sources":["../../../src/runtime/jobs/host-exit-finalizer.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,QAAQ,CAAC,KAAK,EAAE;QAAE,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,CAAA;IACrD,0FAA0F;IAC1F,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,KAAK,IAAI,CAAA;CAChD;AAqCD;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,IAAI,CASjE;AAED,kDAAkD;AAClD,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { killTrees } from '../../process/kill-tree.js';
|
|
2
|
+
const live = new Set();
|
|
3
|
+
let installed = false;
|
|
4
|
+
/**
|
|
5
|
+
* Runs when the host process is about to end, by whatever road: `process.exit`,
|
|
6
|
+
* an uncaught exception, the event loop emptying. It is synchronous on purpose.
|
|
7
|
+
* An `exit` listener cannot await, so it starts no promise and no timer, signals
|
|
8
|
+
* each live job with SIGKILL (its own kill when it gave one, then its process
|
|
9
|
+
* group and any descendant found by the environment tag), and does not wait for any of them
|
|
10
|
+
* to stop or claim that they have. A job that was already stopped has been
|
|
11
|
+
* untracked and is not touched.
|
|
12
|
+
*
|
|
13
|
+
* It does not cover a SIGKILL of the host itself, which no listener can see.
|
|
14
|
+
*/
|
|
15
|
+
function finalizeAtHostExit() {
|
|
16
|
+
const children = [];
|
|
17
|
+
for (const target of live) {
|
|
18
|
+
children.push(target.child);
|
|
19
|
+
try {
|
|
20
|
+
target.kill?.('SIGKILL');
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
// The process is already gone; the host is exiting either way.
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
live.clear();
|
|
27
|
+
try {
|
|
28
|
+
// One pass over the machine's processes for all the jobs, not one each.
|
|
29
|
+
// Every job goes through it, whether or not it has a kill of its own, so
|
|
30
|
+
// a descendant that left the process group is found in both cases.
|
|
31
|
+
killTrees(children, 'SIGKILL');
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
// As above.
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Track a running job so the host's exit stops it. Returns the untrack, to be
|
|
39
|
+
* called once the job has ended. The listener is installed once per process, on
|
|
40
|
+
* the first job, and is put first so a later listener that throws cannot
|
|
41
|
+
* keep it from running.
|
|
42
|
+
*/
|
|
43
|
+
export function stopAtHostExit(target) {
|
|
44
|
+
live.add(target);
|
|
45
|
+
if (!installed) {
|
|
46
|
+
installed = true;
|
|
47
|
+
process.prependListener('exit', finalizeAtHostExit);
|
|
48
|
+
}
|
|
49
|
+
return () => {
|
|
50
|
+
live.delete(target);
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/** Jobs the host's exit would stop. For tests. */
|
|
54
|
+
export function trackedForHostExit() {
|
|
55
|
+
return live.size;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=host-exit-finalizer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host-exit-finalizer.js","sourceRoot":"","sources":["../../../src/runtime/jobs/host-exit-finalizer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAA;AAWtD,MAAM,IAAI,GAAG,IAAI,GAAG,EAAkB,CAAA;AACtC,IAAI,SAAS,GAAG,KAAK,CAAA;AAErB;;;;;;;;;;GAUG;AACH,SAAS,kBAAkB;IAC1B,MAAM,QAAQ,GAA8B,EAAE,CAAA;IAC9C,KAAK,MAAM,MAAM,IAAI,IAAI,EAAE,CAAC;QAC3B,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QAC3B,IAAI,CAAC;YACJ,MAAM,CAAC,IAAI,EAAE,CAAC,SAAS,CAAC,CAAA;QACzB,CAAC;QAAC,MAAM,CAAC;YACR,+DAA+D;QAChE,CAAC;IACF,CAAC;IACD,IAAI,CAAC,KAAK,EAAE,CAAA;IACZ,IAAI,CAAC;QACJ,wEAAwE;QACxE,yEAAyE;QACzE,mEAAmE;QACnE,SAAS,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAA;IAC/B,CAAC;IAAC,MAAM,CAAC;QACR,YAAY;IACb,CAAC;AACF,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,MAAsB;IACpD,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;IAChB,IAAI,CAAC,SAAS,EAAE,CAAC;QAChB,SAAS,GAAG,IAAI,CAAA;QAChB,OAAO,CAAC,eAAe,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAA;IACpD,CAAC;IACD,OAAO,GAAG,EAAE;QACX,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IACpB,CAAC,CAAA;AACF,CAAC;AAED,kDAAkD;AAClD,MAAM,UAAU,kBAAkB;IACjC,OAAO,IAAI,CAAC,IAAI,CAAA;AACjB,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a host can say about one running item, from three facts it reads
|
|
3
|
+
* itself: where it is, when it last made progress, and whether it is alive.
|
|
4
|
+
*
|
|
5
|
+
* Pure: no clock, no process probe. The caller passes `now` and the probe's
|
|
6
|
+
* answer, so the same table of cases runs under a fake clock. The kinds
|
|
7
|
+
* (background job, monitor, delegated agent, workflow run) share one verdict
|
|
8
|
+
* so the outstanding-work note and every status read print the same words.
|
|
9
|
+
*/
|
|
10
|
+
/** Silence shorter than this still reads as progress. */
|
|
11
|
+
export declare const LIVENESS_QUIET_MS = 30000;
|
|
12
|
+
/**
|
|
13
|
+
* Silence from an item that is alive and has no known reason to wait. The
|
|
14
|
+
* same number `wait_for_job` uses for its idle bound, so there is one
|
|
15
|
+
* threshold to explain.
|
|
16
|
+
*/
|
|
17
|
+
export declare const LIVENESS_STALLED_MS: number;
|
|
18
|
+
export type LivenessKind = 'job' | 'monitor' | 'agent' | 'workflow';
|
|
19
|
+
export type LivenessVerdict = 'progressing' | 'waiting' | 'stalled' | 'dead' | 'finished';
|
|
20
|
+
export interface LivenessInput {
|
|
21
|
+
readonly kind: LivenessKind;
|
|
22
|
+
readonly id: string;
|
|
23
|
+
/** Short name the person would recognise: a command, a description, a workflow name. */
|
|
24
|
+
readonly label: string;
|
|
25
|
+
/** Where it is: the last output line, the current tool, the phase. One line, already bounded. */
|
|
26
|
+
readonly where?: string;
|
|
27
|
+
readonly startedAt: number;
|
|
28
|
+
/** When it last made progress (epoch ms). Absent means it has not yet: the start counts. */
|
|
29
|
+
readonly lastProgressAt?: number;
|
|
30
|
+
/** The probe's answer: is the process or run still there. */
|
|
31
|
+
readonly alive: boolean;
|
|
32
|
+
/** A result or an end has arrived. */
|
|
33
|
+
readonly finished?: boolean;
|
|
34
|
+
/** What it is known to be waiting on, when it is waiting for a reason (a tool, a free slot). */
|
|
35
|
+
readonly waitingOn?: string;
|
|
36
|
+
readonly waitingSince?: number;
|
|
37
|
+
}
|
|
38
|
+
export interface Liveness {
|
|
39
|
+
readonly kind: LivenessKind;
|
|
40
|
+
readonly id: string;
|
|
41
|
+
readonly label: string;
|
|
42
|
+
readonly where?: string;
|
|
43
|
+
readonly verdict: LivenessVerdict;
|
|
44
|
+
/** Whole seconds since the last progress (or the start). */
|
|
45
|
+
readonly idleSeconds: number;
|
|
46
|
+
/** Whole seconds since it started. */
|
|
47
|
+
readonly ageSeconds: number;
|
|
48
|
+
/** Present when the verdict is `waiting` with a reason. */
|
|
49
|
+
readonly waitingOn?: string;
|
|
50
|
+
readonly waitingSeconds?: number;
|
|
51
|
+
}
|
|
52
|
+
export interface LivenessThresholds {
|
|
53
|
+
readonly quietMs?: number;
|
|
54
|
+
readonly stalledMs?: number;
|
|
55
|
+
}
|
|
56
|
+
/** Decide the verdict. Order matters: a result beats everything, then death, then the reason to wait. */
|
|
57
|
+
export declare function judgeLiveness(input: LivenessInput, now: number, thresholds?: LivenessThresholds): Liveness;
|
|
58
|
+
/** `45s`, `3m 05s`, `1h 02m`: short, for a line a person or the model reads. */
|
|
59
|
+
export declare function formatLivenessAge(totalSeconds: number): string;
|
|
60
|
+
/**
|
|
61
|
+
* One line per item, the same for the note and for the list reads:
|
|
62
|
+
* `job b1a2 "npm test" - progressing - last progress 4s ago - at: compiling`.
|
|
63
|
+
* Everything free-form is clipped and flattened; the line carries data, not
|
|
64
|
+
* instructions.
|
|
65
|
+
*/
|
|
66
|
+
export declare function formatLivenessLine(item: Liveness): string;
|
|
67
|
+
//# sourceMappingURL=liveness.d.ts.map
|
|
@@ -0,0 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CAAA;IACjC,4DAA4D;IAC5D,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,sCAAsC;IACtC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,2DAA2D;IAC3D,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAA;CAChC;AAED,MAAM,WAAW,kBAAkB;IAClC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAC3B;AAID,yGAAyG;AACzG,wBAAgB,aAAa,CAC5B,KAAK,EAAE,aAAa,EACpB,GAAG,EAAE,MAAM,EACX,UAAU,GAAE,kBAAuB,GACjC,QAAQ,CAyBV;AAED,gFAAgF;AAChF,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAM9D;AAUD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAuBzD"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a host can say about one running item, from three facts it reads
|
|
3
|
+
* itself: where it is, when it last made progress, and whether it is alive.
|
|
4
|
+
*
|
|
5
|
+
* Pure: no clock, no process probe. The caller passes `now` and the probe's
|
|
6
|
+
* answer, so the same table of cases runs under a fake clock. The kinds
|
|
7
|
+
* (background job, monitor, delegated agent, workflow run) share one verdict
|
|
8
|
+
* so the outstanding-work note and every status read print the same words.
|
|
9
|
+
*/
|
|
10
|
+
/** Silence shorter than this still reads as progress. */
|
|
11
|
+
export const LIVENESS_QUIET_MS = 30_000;
|
|
12
|
+
/**
|
|
13
|
+
* Silence from an item that is alive and has no known reason to wait. The
|
|
14
|
+
* same number `wait_for_job` uses for its idle bound, so there is one
|
|
15
|
+
* threshold to explain.
|
|
16
|
+
*/
|
|
17
|
+
export const LIVENESS_STALLED_MS = 2 * 60 * 1000;
|
|
18
|
+
const seconds = (ms) => Math.max(0, Math.floor(ms / 1000));
|
|
19
|
+
/** Decide the verdict. Order matters: a result beats everything, then death, then the reason to wait. */
|
|
20
|
+
export function judgeLiveness(input, now, thresholds = {}) {
|
|
21
|
+
const quietMs = thresholds.quietMs ?? LIVENESS_QUIET_MS;
|
|
22
|
+
const stalledMs = thresholds.stalledMs ?? LIVENESS_STALLED_MS;
|
|
23
|
+
const last = Math.max(input.startedAt, input.lastProgressAt ?? input.startedAt);
|
|
24
|
+
const idle = Math.max(0, now - last);
|
|
25
|
+
let verdict;
|
|
26
|
+
if (input.finished)
|
|
27
|
+
verdict = 'finished';
|
|
28
|
+
else if (!input.alive)
|
|
29
|
+
verdict = 'dead';
|
|
30
|
+
else if (input.waitingOn !== undefined)
|
|
31
|
+
verdict = 'waiting';
|
|
32
|
+
else if (idle >= stalledMs)
|
|
33
|
+
verdict = 'stalled';
|
|
34
|
+
else if (idle >= quietMs)
|
|
35
|
+
verdict = 'waiting';
|
|
36
|
+
else
|
|
37
|
+
verdict = 'progressing';
|
|
38
|
+
const waitingOn = verdict === 'waiting' && input.waitingOn !== undefined ? input.waitingOn : undefined;
|
|
39
|
+
const waitingSince = input.waitingSince ?? last;
|
|
40
|
+
return {
|
|
41
|
+
kind: input.kind,
|
|
42
|
+
id: input.id,
|
|
43
|
+
label: input.label,
|
|
44
|
+
...(input.where !== undefined ? { where: input.where } : {}),
|
|
45
|
+
verdict,
|
|
46
|
+
idleSeconds: seconds(idle),
|
|
47
|
+
ageSeconds: seconds(now - input.startedAt),
|
|
48
|
+
...(waitingOn !== undefined ? { waitingOn, waitingSeconds: seconds(now - waitingSince) } : {}),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/** `45s`, `3m 05s`, `1h 02m`: short, for a line a person or the model reads. */
|
|
52
|
+
export function formatLivenessAge(totalSeconds) {
|
|
53
|
+
const s = Math.max(0, Math.floor(totalSeconds));
|
|
54
|
+
if (s < 60)
|
|
55
|
+
return `${s}s`;
|
|
56
|
+
const m = Math.floor(s / 60);
|
|
57
|
+
if (m < 60)
|
|
58
|
+
return `${m}m ${String(s % 60).padStart(2, '0')}s`;
|
|
59
|
+
return `${Math.floor(m / 60)}h ${String(m % 60).padStart(2, '0')}m`;
|
|
60
|
+
}
|
|
61
|
+
function oneLine(text, max) {
|
|
62
|
+
const flat = text.replace(/\s+/g, ' ').trim();
|
|
63
|
+
return flat.length <= max ? flat : `${flat.slice(0, max - 1)}…`;
|
|
64
|
+
}
|
|
65
|
+
const LABEL_MAX = 80;
|
|
66
|
+
const WHERE_MAX = 120;
|
|
67
|
+
/**
|
|
68
|
+
* One line per item, the same for the note and for the list reads:
|
|
69
|
+
* `job b1a2 "npm test" - progressing - last progress 4s ago - at: compiling`.
|
|
70
|
+
* Everything free-form is clipped and flattened; the line carries data, not
|
|
71
|
+
* instructions.
|
|
72
|
+
*/
|
|
73
|
+
export function formatLivenessLine(item) {
|
|
74
|
+
const parts = [`${item.kind} ${item.id} "${oneLine(item.label, LABEL_MAX)}"`];
|
|
75
|
+
if (item.verdict === 'waiting' && item.waitingOn !== undefined) {
|
|
76
|
+
parts.push(`waiting on ${oneLine(item.waitingOn, LABEL_MAX)} for ${formatLivenessAge(item.waitingSeconds ?? item.idleSeconds)}`);
|
|
77
|
+
}
|
|
78
|
+
else if (item.verdict === 'finished') {
|
|
79
|
+
parts.push(`finished after ${formatLivenessAge(item.ageSeconds)}`);
|
|
80
|
+
}
|
|
81
|
+
else if (item.verdict === 'dead') {
|
|
82
|
+
parts.push(`dead: gone without a result after ${formatLivenessAge(item.ageSeconds)}, last progress ${formatLivenessAge(item.idleSeconds)} ago`);
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
parts.push(item.verdict);
|
|
86
|
+
parts.push(item.idleSeconds === 0
|
|
87
|
+
? 'last progress just now'
|
|
88
|
+
: `last progress ${formatLivenessAge(item.idleSeconds)} ago`);
|
|
89
|
+
}
|
|
90
|
+
if (item.where !== undefined && item.where.length > 0)
|
|
91
|
+
parts.push(`at: ${oneLine(item.where, WHERE_MAX)}`);
|
|
92
|
+
return parts.join(' - ');
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=liveness.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"liveness.js","sourceRoot":"","sources":["../../../src/runtime/jobs/liveness.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,yDAAyD;AACzD,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAA;AAEvC;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAA;AA6ChD,MAAM,OAAO,GAAG,CAAC,EAAU,EAAU,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,CAAA;AAE1E,yGAAyG;AACzG,MAAM,UAAU,aAAa,CAC5B,KAAoB,EACpB,GAAW,EACX,aAAiC,EAAE;IAEnC,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,IAAI,iBAAiB,CAAA;IACvD,MAAM,SAAS,GAAG,UAAU,CAAC,SAAS,IAAI,mBAAmB,CAAA;IAC7D,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,cAAc,IAAI,KAAK,CAAC,SAAS,CAAC,CAAA;IAC/E,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,GAAG,IAAI,CAAC,CAAA;IACpC,IAAI,OAAwB,CAAA;IAC5B,IAAI,KAAK,CAAC,QAAQ;QAAE,OAAO,GAAG,UAAU,CAAA;SACnC,IAAI,CAAC,KAAK,CAAC,KAAK;QAAE,OAAO,GAAG,MAAM,CAAA;SAClC,IAAI,KAAK,CAAC,SAAS,KAAK,SAAS;QAAE,OAAO,GAAG,S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,UAAU,EAAE,CAAC;QACxC,KAAK,CAAC,IAAI,CAAC,kBAAkB,iBAAiB,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,CAAA;IACnE,CAAC;SAAM,IAAI,IAAI,CAAC,OAAO,KAAK,MAAM,EAAE,CAAC;QACpC,KAAK,CAAC,IAAI,CACT,qCAAqC,iBAAiB,CAAC,IAAI,CAAC,UAAU,CAAC,mBAAmB,iBAAiB,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CACnI,CAAA;IACF,CAAC;SAAM,CAAC;QACP,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;QACxB,KAAK,CAAC,IAAI,CACT,IAAI,CAAC,WAAW,KAAK,CAAC;YACrB,CAAC,CAAC,wBAAwB;YAC1B,CAAC,CAAC,iBAAiB,iBAAiB,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAC7D,CAAA;IACF,CAAC;IACD,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC;QACpD,KAAK,CAAC,IAAI,CAAC,OAAO,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE,CAAC,CAAA;IACpD,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;AACzB,CAAC"}
|
|
@@ -31,6 +31,10 @@ export interface BackgroundJob {
|
|
|
31
31
|
readonly command: string;
|
|
32
32
|
readonly status: BackgroundJobStatus;
|
|
33
33
|
readonly startedAt: number;
|
|
34
|
+
/** When the job last wrote output (epoch ms). Absent until it has written anything. */
|
|
35
|
+
readonly lastOutputAt?: number;
|
|
36
|
+
/** The last non-empty output line, flattened and clipped to {@link LAST_OUTPUT_LINE_MAX}. */
|
|
37
|
+
readonly lastOutputLine?: string;
|
|
34
38
|
readonly exitedAt?: number;
|
|
35
39
|
readonly exitCode?: number;
|
|
36
40
|
readonly signal?: string;
|
|
@@ -251,6 +255,8 @@ export declare class UnknownBackgroundJobError extends Error {
|
|
|
251
255
|
id: string;
|
|
252
256
|
});
|
|
253
257
|
}
|
|
258
|
+
/** Longest `lastOutputLine` kept on a job record. */
|
|
259
|
+
export declare const LAST_OUTPUT_LINE_MAX = 160;
|
|
254
260
|
/**
|
|
255
261
|
* Why a command that was running in the foreground moved to the background:
|
|
256
262
|
* the person asked (`user`), or the person sent a message that has to reach
|
|
@@ -344,6 +350,13 @@ export declare class BackgroundJobRegistry {
|
|
|
344
350
|
}>;
|
|
345
351
|
/** The record, or throw for an id this registry does not know. */
|
|
346
352
|
get(id: string): BackgroundJob;
|
|
353
|
+
/**
|
|
354
|
+
* Whether the job's process group is still there, asked of the system rather
|
|
355
|
+
* than inferred from the record. A job with no process of its own to probe
|
|
356
|
+
* (a sandboxed or WebSocket source, or a platform without process groups)
|
|
357
|
+
* is alive exactly when the registry says it is running.
|
|
358
|
+
*/
|
|
359
|
+
isAlive(id: string): boolean;
|
|
347
360
|
/**
|
|
348
361
|
* Await one job's exit — the public counterpart to `onExit`, for a
|
|
349
362
|
* caller that wants a single result rather than a standing
|
|
@@ -419,6 +432,12 @@ export declare function bindOwner(registry: BackgroundJobRegistry, owner: string
|
|
|
419
432
|
* than present and silently doing nothing.
|
|
420
433
|
*/
|
|
421
434
|
readonly onAwaited?: (id: string) => void;
|
|
435
|
+
/**
|
|
436
|
+
* Be told that a tool result has handed the model this job's exit, so the
|
|
437
|
+
* notice announcing the same exit can be withdrawn. Like `onAwaited` it
|
|
438
|
+
* belongs to the turn; absent, `markCollected` is absent from the ref.
|
|
439
|
+
*/
|
|
440
|
+
readonly onCollected?: (id: string) => void;
|
|
422
441
|
/**
|
|
423
442
|
* The longest a monitor started through this binding may live. A host
|
|
424
443
|
* may lower it (a single-shot run has no tomorrow to watch for); the
|
|
@@ -435,6 +454,8 @@ export declare function bindOwner(registry: BackgroundJobRegistry, owner: string
|
|
|
435
454
|
}): {
|
|
436
455
|
kill: (id: string) => Promise<BackgroundJob>;
|
|
437
456
|
list: () => readonly BackgroundJob[];
|
|
457
|
+
isAlive: (id: string) => boolean;
|
|
458
|
+
markCollected?: ((id: string) => void) | undefined;
|
|
438
459
|
markAwaited?: ((id: string) => void) | undefined;
|
|
439
460
|
start: (params: {
|
|
440
461
|
command: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/runtime/jobs/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAO/C,OAAO,KAAK,EACX,8BAA8B,EAC9B,6BAA6B,EAC7B,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/runtime/jobs/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAO/C,OAAO,KAAK,EACX,8BAA8B,EAC9B,6BAA6B,EAC7B,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAA;AAKvE,OAAO,EAEN,KAAK,kBAAkB,EAIvB,MAAM,qBAAqB,CAAA;AAG5B;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAA;AAEjE,MAAM,WAAW,aAAa;IAC7B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,+FAA+F;IAC/F,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,MAAM,EAAE,mBAAmB,CAAA;IACpC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,uFAAuF;IACvF,QAAQ,CAAC,YAA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AAE;wBAIrC,MAAM,QAAQ,8BAA8B;EA8BjE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CACjC,GAAG,EAAE,IAAI,CACR,aAAa,EACX,aAAa,GACb,QAAQ,GACR,UAAU,GACV,QAAQ,GACR,OAAO,GACP,WAAW,GACX,WAAW,GACX,aAAa,CACf,EACD,KAAK,EAAE,IAAI,CAAC,kBAAkB,EAAE,aAAa,CAAC,GAC5C;IAAE,MAAM,EAAE,WAAW,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAuBhE"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { SANDBOX_KILL_GRACE_MS } from '../../constants/sandbox/index.js';
|
|
2
|
-
import { killTree } from '../../process/kill-tree.js';
|
|
2
|
+
import { isSignalablePid, killTree } from '../../process/kill-tree.js';
|
|
3
3
|
import { describeSpawnFailure, spawnHostShell } from '../../tools/command-shell.js';
|
|
4
4
|
import { scrubInheritedEnv } from '../../tools/env-scrub.js';
|
|
5
5
|
import { createHostOutputDecoder } from '../../tools/host-output.js';
|
|
6
6
|
import { subscribeToAbort } from '../../utils/abort.js';
|
|
7
7
|
import { oneMetadataLine } from '../system-events.js';
|
|
8
|
+
import { stopAtHostExit } from './host-exit-finalizer.js';
|
|
8
9
|
import { createBackgroundJobId } from './job-id.js';
|
|
9
10
|
import { MONITOR_TIMEOUT_CAP_MS, createMonitorStream, expiryNotice, tooMuchOutputNotice, } from './monitor-stream.js';
|
|
10
11
|
import { connectWebSocketSource, webSocketJobCommand } from './websocket-source.js';
|
|
@@ -56,7 +57,7 @@ export class UnknownBackgroundJobError extends Error {
|
|
|
56
57
|
}
|
|
57
58
|
/** Whether any process of the group led by `pid` is still alive. */
|
|
58
59
|
function groupAlive(pid) {
|
|
59
|
-
if (pid
|
|
60
|
+
if (!isSignalablePid(pid) || process.platform === 'win32')
|
|
60
61
|
return false;
|
|
61
62
|
try {
|
|
62
63
|
process.kill(-pid, 0);
|
|
@@ -66,7 +67,65 @@ function groupAlive(pid) {
|
|
|
66
67
|
return false;
|
|
67
68
|
}
|
|
68
69
|
}
|
|
70
|
+
/**
|
|
71
|
+
* The same probe for a status read: a group that exists but is not ours to
|
|
72
|
+
* signal (EPERM) is there. The close handler keeps {@link groupAlive}, which
|
|
73
|
+
* must not wait on a group it can never see end.
|
|
74
|
+
*
|
|
75
|
+
* Not proof the group is still the job's: between the group ending and the
|
|
76
|
+
* record closing, a recycled pid that leads a new group would read as alive.
|
|
77
|
+
* The close handler polls every {@link GROUP_POLL_MS}, so the window is
|
|
78
|
+
* that small.
|
|
79
|
+
*/
|
|
80
|
+
function groupPresent(pid) {
|
|
81
|
+
if (!isSignalablePid(pid))
|
|
82
|
+
return false;
|
|
83
|
+
try {
|
|
84
|
+
process.kill(-pid, 0);
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
return error.code === 'EPERM';
|
|
89
|
+
}
|
|
90
|
+
}
|
|
69
91
|
const GROUP_POLL_MS = 250;
|
|
92
|
+
/** Longest `lastOutputLine` kept on a job record. */
|
|
93
|
+
export const LAST_OUTPUT_LINE_MAX = 160;
|
|
94
|
+
/**
|
|
95
|
+
* Drop terminal control sequences and control characters, keeping one space
|
|
96
|
+
* where a control character stood. Done by code point so no pattern has to
|
|
97
|
+
* spell a control character.
|
|
98
|
+
*/
|
|
99
|
+
function plainLine(raw) {
|
|
100
|
+
let out = '';
|
|
101
|
+
let i = 0;
|
|
102
|
+
while (i < raw.length) {
|
|
103
|
+
const code = raw.charCodeAt(i);
|
|
104
|
+
if (code === 0x1b && raw[i + 1] === '[') {
|
|
105
|
+
// CSI: parameters and intermediates, then one final byte in @..~.
|
|
106
|
+
i += 2;
|
|
107
|
+
while (i < raw.length && raw.charCodeAt(i) >= 0x20 && raw.charCodeAt(i) <= 0x3f)
|
|
108
|
+
i += 1;
|
|
109
|
+
i += 1;
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
out += code < 0x20 || code === 0x7f ? ' ' : (raw[i] ?? '');
|
|
113
|
+
i += 1;
|
|
114
|
+
}
|
|
115
|
+
return out.replace(/ {2,}/g, ' ').trim();
|
|
116
|
+
}
|
|
117
|
+
/** The last non-empty line of `text`, flattened and clipped; `undefined` when it has none. */
|
|
118
|
+
function lastLineOf(text) {
|
|
119
|
+
const lines = text.split('\n');
|
|
120
|
+
for (let index = lines.length - 1; index >= 0; index -= 1) {
|
|
121
|
+
const flat = plainLine(lines[index] ?? '');
|
|
122
|
+
if (flat.length > 0)
|
|
123
|
+
return flat.length <= LAST_OUTPUT_LINE_MAX
|
|
124
|
+
? flat
|
|
125
|
+
: `${flat.slice(0, LAST_OUTPUT_LINE_MAX - 1)}…`;
|
|
126
|
+
}
|
|
127
|
+
return undefined;
|
|
128
|
+
}
|
|
70
129
|
export class BackgroundJobRegistry {
|
|
71
130
|
config;
|
|
72
131
|
jobs = new Map();
|
|
@@ -385,6 +444,7 @@ export class BackgroundJobRegistry {
|
|
|
385
444
|
if (finalized)
|
|
386
445
|
return;
|
|
387
446
|
finalized = true;
|
|
447
|
+
untrackAtHostExit();
|
|
388
448
|
entry.record = {
|
|
389
449
|
...entry.record,
|
|
390
450
|
// A job killed by this registry says `killed`, not
|
|
@@ -469,11 +529,26 @@ export class BackgroundJobRegistry {
|
|
|
469
529
|
}),
|
|
470
530
|
};
|
|
471
531
|
entry.finalize = finalizeEntry;
|
|
532
|
+
// A job that is not stopped before the host exits is an orphan: nothing
|
|
533
|
+
// owns its id any more. A remote job confirms its own termination and is
|
|
534
|
+
// not signalled from an exit listener.
|
|
535
|
+
const untrackAtHostExit = entry.terminateProcess
|
|
536
|
+
? () => { }
|
|
537
|
+
: stopAtHostExit({
|
|
538
|
+
child,
|
|
539
|
+
...(entry.killProcess ? { kill: entry.killProcess } : {}),
|
|
540
|
+
});
|
|
472
541
|
const append = (text, stream) => {
|
|
473
542
|
const chunk = { stream, offset: entry.produced, bytes: Buffer.from(text) };
|
|
474
543
|
if (chunk.bytes.length === 0)
|
|
475
544
|
return;
|
|
476
545
|
entry.produced += chunk.bytes.length;
|
|
546
|
+
const line = lastLineOf(text);
|
|
547
|
+
entry.record = {
|
|
548
|
+
...entry.record,
|
|
549
|
+
lastOutputAt: Date.now(),
|
|
550
|
+
...(line !== undefined ? { lastOutputLine: line } : {}),
|
|
551
|
+
};
|
|
477
552
|
entry.buffer += text;
|
|
478
553
|
entry.buffer = outputTail(entry.buffer, this.maxBytes).text;
|
|
479
554
|
entry.outputChunks.push(chunk);
|
|
@@ -577,6 +652,21 @@ export class BackgroundJobRegistry {
|
|
|
577
652
|
throw new UnknownBackgroundJobError({ id });
|
|
578
653
|
return entry.record;
|
|
579
654
|
}
|
|
655
|
+
/**
|
|
656
|
+
* Whether the job's process group is still there, asked of the system rather
|
|
657
|
+
* than inferred from the record. A job with no process of its own to probe
|
|
658
|
+
* (a sandboxed or WebSocket source, or a platform without process groups)
|
|
659
|
+
* is alive exactly when the registry says it is running.
|
|
660
|
+
*/
|
|
661
|
+
isAlive(id) {
|
|
662
|
+
const entry = this.jobs.get(id);
|
|
663
|
+
if (!entry || entry.record.status !== 'running')
|
|
664
|
+
return false;
|
|
665
|
+
const pid = entry.child.pid;
|
|
666
|
+
if (pid === undefined || process.platform === 'win32')
|
|
667
|
+
return true;
|
|
668
|
+
return groupPresent(pid);
|
|
669
|
+
}
|
|
580
670
|
/**
|
|
581
671
|
* Await one job's exit — the public counterpart to `onExit`, for a
|
|
582
672
|
* caller that wants a single result rather than a standing
|
|
@@ -1000,11 +1090,23 @@ export function bindOwner(registry, owner, defaults = {}) {
|
|
|
1000
1090
|
},
|
|
1001
1091
|
}
|
|
1002
1092
|
: {}),
|
|
1093
|
+
...(defaults.onCollected
|
|
1094
|
+
? {
|
|
1095
|
+
markCollected: (id) => {
|
|
1096
|
+
mine(id);
|
|
1097
|
+
defaults.onCollected?.(id);
|
|
1098
|
+
},
|
|
1099
|
+
}
|
|
1100
|
+
: {}),
|
|
1003
1101
|
kill: async (id) => {
|
|
1004
1102
|
mine(id);
|
|
1005
1103
|
return await registry.kill(id);
|
|
1006
1104
|
},
|
|
1007
1105
|
list: () => registry.list(owner),
|
|
1106
|
+
isAlive: (id) => {
|
|
1107
|
+
mine(id);
|
|
1108
|
+
return registry.isAlive(id);
|
|
1109
|
+
},
|
|
1008
1110
|
};
|
|
1009
1111
|
}
|
|
1010
1112
|
/**
|