@code-yeongyu/senpi 2026.9.21-2 → 2026.9.22-2
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 +56 -0
- package/dist/bundle/chunks/{anthropic-messages-C3ZY2ANT.js → anthropic-messages-2P7APOOQ.js} +1 -1
- package/dist/bundle/chunks/{app-server-command-HSX5RFAP.js → app-server-command-PRNA6QQU.js} +1 -1
- package/dist/bundle/chunks/{azure-openai-responses-7TAGS2VU.js → azure-openai-responses-3AH7MJWF.js} +1 -1
- package/dist/bundle/chunks/{bun-extension-importer-UO7V2MZ7.js → bun-extension-importer-H4IJCWWQ.js} +1 -1
- package/dist/bundle/chunks/{chunk-OSDJ2SYO.js → chunk-5XC2FNJ5.js} +1 -1
- package/dist/bundle/chunks/{chunk-D5CL7PPD.js → chunk-64JQFFHH.js} +2 -2
- package/dist/bundle/chunks/{chunk-Z3KQB2R3.js → chunk-6OD4TT33.js} +95 -39
- package/dist/bundle/chunks/{chunk-NEEAKXDT.js → chunk-7EH64T6E.js} +2 -2
- package/dist/bundle/chunks/{chunk-MIVOQT3Q.js → chunk-ARJJU3MS.js} +1 -1
- package/dist/bundle/chunks/chunk-BOZ37BOT.js +14 -0
- package/dist/bundle/chunks/{chunk-POMPEGWQ.js → chunk-F3DXL5MX.js} +1 -1
- package/dist/bundle/chunks/{chunk-GLKVDRNP.js → chunk-GXUYWMN2.js} +1 -1
- package/dist/bundle/chunks/chunk-HH3KJDWA.js +2 -0
- package/dist/bundle/chunks/{chunk-B7W62BM7.js → chunk-IPRJIKLL.js} +1 -1
- package/dist/bundle/chunks/chunk-JEFYJDHP.js +8 -0
- package/dist/bundle/chunks/{chunk-T6XA2IZR.js → chunk-JR4X6ECO.js} +1 -1
- package/dist/bundle/chunks/{chunk-I425CMTO.js → chunk-JZ6YQU3A.js} +4 -4
- package/dist/bundle/chunks/{chunk-KNM6SRPE.js → chunk-K3HEWWSS.js} +1 -1
- package/dist/bundle/chunks/{chunk-M2XAY6I7.js → chunk-M2HSO7MH.js} +1 -1
- package/dist/bundle/chunks/{chunk-UYVPLEOL.js → chunk-NK2RNX25.js} +1 -1
- package/dist/bundle/chunks/chunk-NMB4C6ZZ.js +2 -0
- package/dist/bundle/chunks/{chunk-VEO3ABZR.js → chunk-OLJ7LQJY.js} +1 -1
- package/dist/bundle/chunks/{chunk-GVI2HP7N.js → chunk-OPNVT7BU.js} +1 -1
- package/dist/bundle/chunks/{chunk-XHMOFY4T.js → chunk-R6LVC7SP.js} +4 -4
- package/dist/bundle/chunks/{chunk-3SLCHXZO.js → chunk-UCPWK6TZ.js} +2 -2
- package/dist/bundle/chunks/{chunk-B2IM56LB.js → chunk-VYIJQQ5I.js} +1 -1
- package/dist/bundle/chunks/{chunk-47GF6XYZ.js → chunk-YT2ZSZOY.js} +1 -1
- package/dist/bundle/chunks/{cli-main-GQTEEZ2V.js → cli-main-AFJNXUSL.js} +1 -1
- package/dist/bundle/chunks/github-copilot.js +1 -1
- package/dist/bundle/chunks/{google-generative-ai-JWIH75VF.js → google-generative-ai-Y2IYMUVC.js} +1 -1
- package/dist/bundle/chunks/{google-vertex-IRGAY5XR.js → google-vertex-TKBBMPHV.js} +1 -1
- package/dist/bundle/chunks/{host-command-KOEKIHIZ.js → host-command-OVA6GEWC.js} +1 -1
- package/dist/bundle/chunks/host-lifecycle-IDQPLYEA.js +3 -0
- package/dist/bundle/chunks/host-lifecycle.js +10 -6
- package/dist/bundle/chunks/{interactive-host-runtime-2KTFEW7O.js → interactive-host-runtime-F5L4USLR.js} +1 -1
- package/dist/bundle/chunks/{interactive-mode-I3ILWXQB.js → interactive-mode-UFBSCOP7.js} +1 -1
- package/dist/bundle/chunks/kimi-coding.js +2 -2
- package/dist/bundle/chunks/{list-tips-2KX65NWZ.js → list-tips-2QG7ASHS.js} +1 -1
- package/dist/bundle/chunks/{mistral-conversations-VOBYATVJ.js → mistral-conversations-ZYDVFRYF.js} +1 -1
- package/dist/bundle/chunks/multi-session-host-EUTEGVLS.js +21 -0
- package/dist/bundle/chunks/openai-codex-responses-MEIUNROM.js +10 -0
- package/dist/bundle/chunks/{openai-completions-YK6QTYOH.js → openai-completions-4V76L5ZJ.js} +1 -1
- package/dist/bundle/chunks/openai-responses-YR7WRBG3.js +2 -0
- package/dist/bundle/chunks/{package-manager-cli-HOL6CAI6.js → package-manager-cli-JPUWMUEJ.js} +1 -1
- package/dist/bundle/chunks/rotation-stream-S56Y7WMM.js +2 -0
- package/dist/bundle/chunks/{rpc-mode-L3DSGTVM.js → rpc-mode-JDVHUBZY.js} +1 -1
- package/dist/bundle/chunks/{session-picker-L3FYEQBL.js → session-picker-PFPJVVIC.js} +1 -1
- package/dist/bundle/chunks/session-worker.js +225 -164
- package/dist/bundle/cli.js +1 -1
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/rpc-entry.js +1 -1
- package/dist/core/agent-session.d.ts +6 -4
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +9 -7
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/credential-pool/classify.d.ts.map +1 -1
- package/dist/core/credential-pool/classify.js +12 -0
- package/dist/core/credential-pool/classify.js.map +1 -1
- package/dist/core/credential-pool/failover.d.ts +37 -5
- package/dist/core/credential-pool/failover.d.ts.map +1 -1
- package/dist/core/credential-pool/failover.js +60 -24
- package/dist/core/credential-pool/failover.js.map +1 -1
- package/dist/core/credential-pool/rotation-events.d.ts +5 -0
- package/dist/core/credential-pool/rotation-events.d.ts.map +1 -0
- package/dist/core/credential-pool/rotation-events.js +25 -0
- package/dist/core/credential-pool/rotation-events.js.map +1 -0
- package/dist/core/credential-pool/rotation-stream.d.ts +4 -3
- package/dist/core/credential-pool/rotation-stream.d.ts.map +1 -1
- package/dist/core/credential-pool/rotation-stream.js +8 -11
- package/dist/core/credential-pool/rotation-stream.js.map +1 -1
- package/dist/core/extensions/builtin/ask-user/schema.d.ts +2 -25
- package/dist/core/extensions/builtin/ask-user/schema.d.ts.map +1 -1
- package/dist/core/extensions/builtin/ask-user/schema.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/api-id.d.ts +7 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/api-id.d.ts.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/api-id.js +7 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/api-id.js.map +1 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/index.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/index.js +3 -2
- package/dist/core/extensions/builtin/claude-sdk-oauth/index.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-binding.js +22 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-binding.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-observability.d.ts +2 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-observability.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-observability.js +4 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-observability.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-reattach.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-reattach.js +18 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-reattach.js.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-turn-attempt.d.ts.map +1 -1
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-turn-attempt.js +18 -0
- package/dist/core/extensions/builtin/claude-sdk-oauth/session-turn-attempt.js.map +1 -1
- package/dist/core/extensions/builtin/compaction/deterministic-fallback.d.ts +2 -7
- package/dist/core/extensions/builtin/compaction/deterministic-fallback.d.ts.map +1 -1
- package/dist/core/extensions/builtin/compaction/deterministic-fallback.js +2 -8
- package/dist/core/extensions/builtin/compaction/deterministic-fallback.js.map +1 -1
- package/dist/core/extensions/builtin/gpt-apply-patch/extension.js +1 -1
- package/dist/core/extensions/builtin/gpt-apply-patch/extension.js.map +1 -1
- package/dist/core/extensions/builtin/mcp/expose/naming.d.ts +0 -1
- package/dist/core/extensions/builtin/mcp/expose/naming.d.ts.map +1 -1
- package/dist/core/extensions/builtin/mcp/expose/naming.js +0 -3
- package/dist/core/extensions/builtin/mcp/expose/naming.js.map +1 -1
- package/dist/core/extensions/builtin/mcp/expose/register.d.ts +1 -2
- package/dist/core/extensions/builtin/mcp/expose/register.d.ts.map +1 -1
- package/dist/core/extensions/builtin/mcp/expose/register.js +0 -21
- package/dist/core/extensions/builtin/mcp/expose/register.js.map +1 -1
- package/dist/core/extensions/builtin/mcp/expose/schema-compat.d.ts +2 -2
- package/dist/core/extensions/builtin/mcp/expose/schema-compat.d.ts.map +1 -1
- package/dist/core/extensions/builtin/mcp/expose/schema-compat.js +2 -2
- package/dist/core/extensions/builtin/mcp/expose/schema-compat.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/file-operations.js +1 -1
- package/dist/core/extensions/builtin/prompt-preset/file-operations.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/grok-4.7.d.ts +3 -0
- package/dist/core/extensions/builtin/prompt-preset/grok-4.7.d.ts.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/grok-4.7.js +105 -0
- package/dist/core/extensions/builtin/prompt-preset/grok-4.7.js.map +1 -0
- package/dist/core/extensions/builtin/prompt-preset/presets.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/presets.js +14 -0
- package/dist/core/extensions/builtin/prompt-preset/presets.js.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/settings.d.ts +1 -1
- package/dist/core/extensions/builtin/prompt-preset/settings.d.ts.map +1 -1
- package/dist/core/extensions/builtin/prompt-preset/settings.js +1 -0
- package/dist/core/extensions/builtin/prompt-preset/settings.js.map +1 -1
- package/dist/core/extensions/bun-extension-importer.d.ts +1 -0
- package/dist/core/extensions/bun-extension-importer.d.ts.map +1 -1
- package/dist/core/extensions/bun-extension-importer.js +4 -0
- package/dist/core/extensions/bun-extension-importer.js.map +1 -1
- package/dist/core/extensions/extension-module-cache.d.ts +48 -0
- package/dist/core/extensions/extension-module-cache.d.ts.map +1 -0
- package/dist/core/extensions/extension-module-cache.js +111 -0
- package/dist/core/extensions/extension-module-cache.js.map +1 -0
- package/dist/core/extensions/loader.d.ts +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +14 -56
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/http-dispatcher.d.ts +29 -0
- package/dist/core/http-dispatcher.d.ts.map +1 -1
- package/dist/core/http-dispatcher.js +30 -3
- package/dist/core/http-dispatcher.js.map +1 -1
- package/dist/core/model-resolver.js +1 -1
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/retry-fallback/billing.d.ts.map +1 -1
- package/dist/core/retry-fallback/billing.js +20 -1
- package/dist/core/retry-fallback/billing.js.map +1 -1
- package/dist/core/session-manager.d.ts +3 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +12 -6
- package/dist/core/session-manager.js.map +1 -1
- package/dist/modes/interactive/components/assistant-render-descriptors.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-render-descriptors.js +8 -7
- package/dist/modes/interactive/components/assistant-render-descriptors.js.map +1 -1
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +7 -5
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/custom-capability.d.ts +7 -0
- package/dist/modes/rpc/custom-capability.d.ts.map +1 -1
- package/dist/modes/rpc/custom-capability.js +7 -0
- package/dist/modes/rpc/custom-capability.js.map +1 -1
- package/dist/modes/rpc/handoff-activity.d.ts +4 -0
- package/dist/modes/rpc/handoff-activity.d.ts.map +1 -0
- package/dist/modes/rpc/handoff-activity.js +6 -0
- package/dist/modes/rpc/handoff-activity.js.map +1 -0
- package/dist/modes/rpc/host-child-exit.d.ts +19 -0
- package/dist/modes/rpc/host-child-exit.d.ts.map +1 -0
- package/dist/modes/rpc/host-child-exit.js +35 -0
- package/dist/modes/rpc/host-child-exit.js.map +1 -0
- package/dist/modes/rpc/host-crash-record.d.ts +24 -0
- package/dist/modes/rpc/host-crash-record.d.ts.map +1 -0
- package/dist/modes/rpc/host-crash-record.js +75 -0
- package/dist/modes/rpc/host-crash-record.js.map +1 -0
- package/dist/modes/rpc/host-crash-record.test.d.ts +2 -0
- package/dist/modes/rpc/host-crash-record.test.d.ts.map +1 -0
- package/dist/modes/rpc/host-crash-record.test.js +91 -0
- package/dist/modes/rpc/host-crash-record.test.js.map +1 -0
- package/dist/modes/rpc/host-ensure.d.ts.map +1 -1
- package/dist/modes/rpc/host-ensure.js +60 -17
- package/dist/modes/rpc/host-ensure.js.map +1 -1
- package/dist/modes/rpc/host-lifecycle.d.ts +4 -10
- package/dist/modes/rpc/host-lifecycle.d.ts.map +1 -1
- package/dist/modes/rpc/host-lifecycle.js +83 -51
- package/dist/modes/rpc/host-lifecycle.js.map +1 -1
- package/dist/modes/rpc/host-supersession.d.ts +13 -2
- package/dist/modes/rpc/host-supersession.d.ts.map +1 -1
- package/dist/modes/rpc/host-supersession.js +40 -7
- package/dist/modes/rpc/host-supersession.js.map +1 -1
- package/dist/modes/rpc/multi-session-host.d.ts +1 -0
- package/dist/modes/rpc/multi-session-host.d.ts.map +1 -1
- package/dist/modes/rpc/multi-session-host.js +40 -7
- package/dist/modes/rpc/multi-session-host.js.map +1 -1
- package/dist/modes/rpc/observer-link.d.ts +48 -0
- package/dist/modes/rpc/observer-link.d.ts.map +1 -0
- package/dist/modes/rpc/observer-link.js +56 -0
- package/dist/modes/rpc/observer-link.js.map +1 -0
- package/dist/modes/rpc/rpc-mode.d.ts +12 -2
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +12 -2
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +36 -1
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js +8 -0
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/modes/rpc/session-command-router.d.ts +10 -4
- package/dist/modes/rpc/session-command-router.d.ts.map +1 -1
- package/dist/modes/rpc/session-command-router.js +95 -19
- package/dist/modes/rpc/session-command-router.js.map +1 -1
- package/dist/modes/rpc/session-event-writer.d.ts +5 -3
- package/dist/modes/rpc/session-event-writer.d.ts.map +1 -1
- package/dist/modes/rpc/session-event-writer.js +21 -2
- package/dist/modes/rpc/session-event-writer.js.map +1 -1
- package/dist/modes/rpc/session-registry.d.ts +6 -1
- package/dist/modes/rpc/session-registry.d.ts.map +1 -1
- package/dist/modes/rpc/session-registry.js +34 -3
- package/dist/modes/rpc/session-registry.js.map +1 -1
- package/dist/modes/rpc/session-worker-client.d.ts +1 -0
- package/dist/modes/rpc/session-worker-client.d.ts.map +1 -1
- package/dist/modes/rpc/session-worker-client.js +3 -0
- package/dist/modes/rpc/session-worker-client.js.map +1 -1
- package/dist/modes/rpc/session-worker-protocol.d.ts +3 -1
- package/dist/modes/rpc/session-worker-protocol.d.ts.map +1 -1
- package/dist/modes/rpc/session-worker-protocol.js.map +1 -1
- package/dist/modes/rpc/session-worker.js +7 -1
- package/dist/modes/rpc/session-worker.js.map +1 -1
- package/dist/modes/rpc/socket-ownership.d.ts +16 -0
- package/dist/modes/rpc/socket-ownership.d.ts.map +1 -1
- package/dist/modes/rpc/socket-ownership.js +28 -4
- package/dist/modes/rpc/socket-ownership.js.map +1 -1
- package/dist/modes/rpc/worker-session-registry.d.ts +12 -5
- package/dist/modes/rpc/worker-session-registry.d.ts.map +1 -1
- package/dist/modes/rpc/worker-session-registry.js +10 -2
- package/dist/modes/rpc/worker-session-registry.js.map +1 -1
- package/docs/providers.md +9 -1
- package/docs/rpc.md +72 -10
- package/docs/settings.md +1 -1
- package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +29 -0
- package/node_modules/@code-yeongyu/senpi-codemode/README.md +51 -13
- package/node_modules/@code-yeongyu/senpi-codemode/package.json +4 -4
- package/node_modules/@code-yeongyu/senpi-codemode/src/bridges/agent-bridge.ts +53 -9
- package/node_modules/@code-yeongyu/senpi-codemode/src/bridges/reserved-dispatch.ts +1 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/config/settings.ts +18 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/extension/eval-status.ts +9 -4
- package/node_modules/@code-yeongyu/senpi-codemode/src/index.ts +6 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/AGENTS.md +2 -2
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/jl/prelude.jl +10 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/context-manager.ts +18 -6
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/kernel-contract.ts +2 -6
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/prelude.ts +1 -1
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/run-queue.ts +17 -7
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/worker-runtime.js +6 -1
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/py/kernel-contract.ts +2 -5
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/py/kernel.ts +37 -5
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/py/prelude.py +11 -2
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/rb/prelude.rb +6 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/shared/subprocess-contract.ts +2 -5
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/shared/subprocess-kernel.ts +14 -4
- package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/shared/subprocess-queue.ts +18 -5
- package/node_modules/@code-yeongyu/senpi-codemode/src/prompt/eval-prompt-template.ts +3 -2
- package/node_modules/@code-yeongyu/senpi-codemode/src/prompt/eval-prompt.ts +4 -1
- package/node_modules/@code-yeongyu/senpi-codemode/src/timeouts/idle-timeout.ts +9 -2
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/AGENTS.md +2 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/cell-execution.ts +19 -2
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/cell-runtime.ts +11 -3
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/detached-cell-contract.ts +6 -1
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/detached-cell-manager.ts +72 -20
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/detached-cell-snapshot.ts +28 -4
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/detached-cell-state.ts +5 -4
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/detached-cell-status.ts +5 -2
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/detached-eval-result.ts +76 -25
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/eval-execution-event.ts +4 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/eval-kernel-reset-refused-error.ts +12 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/eval-request.ts +2 -1
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/eval-tool-options.ts +3 -1
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/eval-tool.ts +58 -37
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/managed-cell.ts +15 -8
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/render.ts +32 -8
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/run-eval-cell.ts +89 -25
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/terminal-snapshot-store.ts +4 -0
- package/node_modules/@code-yeongyu/senpi-codemode/src/tool/types.ts +51 -10
- package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts +2 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js +2 -13
- package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/index.d.ts +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/index.js +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/tool-arguments.d.ts +5 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/tool-arguments.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/tool-arguments.js +20 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/tool-arguments.js.map +1 -0
- package/node_modules/@earendil-works/pi-agent-core/package.json +3 -3
- package/node_modules/@earendil-works/pi-ai/README.md +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js +14 -56
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js +18 -27
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/websocket-transport-failure.d.ts +40 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/websocket-transport-failure.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/websocket-transport-failure.js +102 -0
- package/node_modules/@earendil-works/pi-ai/dist/api/websocket-transport-failure.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/kimi-coding.d.ts +4 -3
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/kimi-coding.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/kimi-coding.js +28 -14
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/kimi-coding.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/kimi-region.d.ts +44 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/kimi-region.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/kimi-region.js +120 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/kimi-region.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/pool/failover.d.ts +2 -2
- package/node_modules/@earendil-works/pi-ai/dist/auth/pool/failover.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/pool/failover.js +2 -2
- package/node_modules/@earendil-works/pi-ai/dist/auth/pool/failover.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/pool/slots.d.ts +3 -0
- package/node_modules/@earendil-works/pi-ai/dist/auth/pool/slots.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/pool/slots.js +21 -15
- package/node_modules/@earendil-works/pi-ai/dist/auth/pool/slots.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/compat.d.ts +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/compat.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/compat.js +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/compat.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/index.d.ts +2 -0
- package/node_modules/@earendil-works/pi-ai/dist/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/index.js +2 -0
- package/node_modules/@earendil-works/pi-ai/dist/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/legacy-provider-ids.d.ts +8 -0
- package/node_modules/@earendil-works/pi-ai/dist/legacy-provider-ids.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/legacy-provider-ids.js +26 -0
- package/node_modules/@earendil-works/pi-ai/dist/legacy-provider-ids.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-ai-gateway.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-workers-ai.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/github-copilot.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/huggingface.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode-go.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/venice.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/xai.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi-token-plan-ams.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi-token-plan-cn.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi-token-plan-sgp.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/xiaomi.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding-auth.d.ts +9 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding-auth.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding-auth.js +43 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding-auth.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.js +3 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/provider-failure-description.d.ts +19 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/provider-failure-description.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/provider-failure-description.js +63 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/provider-failure-description.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/classifiers.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/classifiers.js +5 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/classifiers.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry.d.ts +17 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry.js +22 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/retry.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/package.json +2 -2
- package/node_modules/@earendil-works/pi-pty/package.json +1 -1
- package/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/tui.js +12 -2
- package/node_modules/@earendil-works/pi-tui/dist/tui.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/package.json +7 -7
- package/dist/bundle/chunks/chunk-5J5R5AMP.js +0 -8
- package/dist/bundle/chunks/chunk-I3F6VZZF.js +0 -2
- package/dist/bundle/chunks/chunk-IDTLJYJ5.js +0 -10
- package/dist/bundle/chunks/chunk-U6Z6OBX4.js +0 -2
- package/dist/bundle/chunks/host-lifecycle-DGZJTBDJ.js +0 -3
- package/dist/bundle/chunks/multi-session-host-S5FWCIWE.js +0 -20
- package/dist/bundle/chunks/openai-codex-responses-L2PO2D6F.js +0 -10
- package/dist/bundle/chunks/openai-responses-YDUBVF4S.js +0 -2
- package/dist/bundle/chunks/rotation-stream-Y4YU6HV4.js +0 -2
|
@@ -26,7 +26,9 @@
|
|
|
26
26
|
* `agent_start`/`agent_settled` for all sessions even when no client is
|
|
27
27
|
* attached. If the observer connection is ever unhealthy, activity is reported
|
|
28
28
|
* as unknown (non-idle), so a broken observer can only keep the host alive,
|
|
29
|
-
* never kill it mid-turn.
|
|
29
|
+
* never kill it mid-turn - for one idle window. Past that, unknown has held
|
|
30
|
+
* the host open for as long as idleness itself would have, and it stops
|
|
31
|
+
* counting as busy; the link keeps reconnecting the whole time (#1979).
|
|
30
32
|
*
|
|
31
33
|
* Lifetime binding: the host is spawned with an extra inherited pipe on fd 3
|
|
32
34
|
* whose write end this supervisor holds and never writes to. The kernel closes
|
|
@@ -47,11 +49,16 @@ import { dirname, extname, join, resolve } from "node:path";
|
|
|
47
49
|
import { fileURLToPath } from "node:url";
|
|
48
50
|
import { getAgentDir, isBunBinary, isBundledNode } from "../../config.js";
|
|
49
51
|
import { processIsLive, readProcessStartTime } from "../app-server/daemon/process.js";
|
|
52
|
+
import { classifyChildExit, noteChildExit } from "./host-child-exit.js";
|
|
53
|
+
// The exit verdict moved to ./host-child-exit.ts with the crash recording it now feeds; it stays
|
|
54
|
+
// exported from here so every existing importer keeps resolving it at its original home.
|
|
55
|
+
export { classifyChildExit } from "./host-child-exit.js";
|
|
50
56
|
import { createHostDaemonPaths, generationPaths, HOST_DAEMON_DIR_ENV } from "./host-daemon-paths.js";
|
|
51
57
|
import { releaseGeneration } from "./host-daemon-registration.js";
|
|
52
58
|
import { watchForSupersession } from "./host-supersession.js";
|
|
53
59
|
import { HOST_CLEANUP_PATHS_ENV, HOST_PUBLIC_SOCKET_ENV, HOST_SCRATCH_DIR_ENV, HOST_WATCH_FD_ENV, HOST_WATCH_PPID_ENV, } from "./host-watchdog.js";
|
|
54
60
|
import { attachJsonlLineReader, MAX_RPC_LINE_CHARACTERS } from "./jsonl.js";
|
|
61
|
+
import { activeTurnsForIdleDecision, createObserverLink } from "./observer-link.js";
|
|
55
62
|
import { HOST_INSTANCE_ID_ENV } from "./protocol-identity.js";
|
|
56
63
|
import { MAX_SOCKET_PATH_BYTES, PUBLIC_SOCKET_IDENTITY_FILE, shieldSocketDuringClose, statSocketIdentity, unlinkOwnedSocket, writeSocketIdentityFile, } from "./socket-ownership.js";
|
|
57
64
|
import { authenticateSocket, createSocketSecret, ensureSocketSecret, resolveSocketTransportAddress, SOCKET_SECRET_FILE_ENV, sendSocketHandshake, socketSecretPath, } from "./socket-transport.js";
|
|
@@ -61,6 +68,9 @@ export const HOST_COLD_START_ENV = "SENPI_RPC_HOST_COLD_START";
|
|
|
61
68
|
export const HOST_IDLE_EXIT_MS_ENV = "SENPI_RPC_HOST_IDLE_EXIT_MS";
|
|
62
69
|
/** Default idle-exit window: 15 minutes of continuous no-connection, no-turn idle. */
|
|
63
70
|
export const DEFAULT_HOST_IDLE_EXIT_MS = 15 * 60_000;
|
|
71
|
+
/** Soft handoff deadline: rescan and report, never interrupt turns or in-flight requests. */
|
|
72
|
+
export const HANDOFF_GRACE_MS_ENV = "SENPI_RPC_HANDOFF_GRACE_MS";
|
|
73
|
+
export const DEFAULT_HANDOFF_GRACE_MS = 10 * 60_000;
|
|
64
74
|
const CHILD_STOP_TIMEOUT_MS = 5_000;
|
|
65
75
|
/** Win32 named-pipe shutdown can leave supervisor handles live after close starts. */
|
|
66
76
|
const WINDOWS_SUPERVISOR_SHUTDOWN_HARD_EXIT_MS = 2_000;
|
|
@@ -121,17 +131,6 @@ export function resolveHostPolicy(settings, env) {
|
|
|
121
131
|
DEFAULT_HOST_IDLE_EXIT_MS;
|
|
122
132
|
return { coldStart, idleExitMs };
|
|
123
133
|
}
|
|
124
|
-
/**
|
|
125
|
-
* How the supervisor reads its child's exit. The RPC host exits 0 only through
|
|
126
|
-
* its own clean shutdown path - including its idle/empty-host policy - so that
|
|
127
|
-
* is an intentional stop, not a crash: the supervisor mirrors its own idle exit
|
|
128
|
-
* instead of reporting failure. Any non-zero code or signal stays a crash.
|
|
129
|
-
*/
|
|
130
|
-
export function classifyChildExit(code, signal) {
|
|
131
|
-
if (code === 0 && signal === null)
|
|
132
|
-
return { reason: "rpc host exited on its own idle policy", exitCode: 0 };
|
|
133
|
-
return { reason: `rpc host process exited unexpectedly (${code ?? signal})`, exitCode: 1 };
|
|
134
|
-
}
|
|
135
134
|
/**
|
|
136
135
|
* Pure idle-window decision core. `update()` must be called with the CURRENT
|
|
137
136
|
* activity state; the window only counts continuously idle time and any
|
|
@@ -365,12 +364,41 @@ export async function runHostSupervisor(launch) {
|
|
|
365
364
|
const internalSecret = process.platform === "win32" ? await createSocketSecret(internalSecretPath) : undefined;
|
|
366
365
|
const clientSockets = new Set();
|
|
367
366
|
const busySessions = new Map();
|
|
368
|
-
|
|
369
|
-
|
|
367
|
+
// Declared before anything that can reach `currentActivity()`. A client accepted during startup
|
|
368
|
+
// asks for the activity snapshot, and a `const` read before its initializer runs is a
|
|
369
|
+
// ReferenceError that fails the connection - which is how a successor's first `open_session`
|
|
370
|
+
// came back `success: false` during a handoff.
|
|
371
|
+
let observerSocket;
|
|
372
|
+
const observerLink = createObserverLink({
|
|
373
|
+
open: async () => {
|
|
374
|
+
const secret = internalSecret;
|
|
375
|
+
const next = createConnection(resolveSocketTransportAddress(internalSocket, process.platform, secret));
|
|
376
|
+
if (secret)
|
|
377
|
+
sendSocketHandshake(next, secret);
|
|
378
|
+
await waitForConnect(next, 5_000);
|
|
379
|
+
observerSocket = next;
|
|
380
|
+
attachJsonlLineReader(next, observeHostEvent, { maxLineLength: MAX_RPC_LINE_CHARACTERS });
|
|
381
|
+
return {
|
|
382
|
+
onLost: (handler) => {
|
|
383
|
+
next.once("close", handler);
|
|
384
|
+
next.once("error", handler);
|
|
385
|
+
},
|
|
386
|
+
};
|
|
387
|
+
},
|
|
388
|
+
settled: () => shuttingDown,
|
|
389
|
+
retryDelayMs: 250,
|
|
390
|
+
now: Date.now,
|
|
391
|
+
setTimer: (run, ms) => {
|
|
392
|
+
const timer = setTimeout(run, ms);
|
|
393
|
+
timer.unref?.();
|
|
394
|
+
return { cancel: () => clearTimeout(timer) };
|
|
395
|
+
},
|
|
396
|
+
});
|
|
370
397
|
let childExitWatchTimer;
|
|
371
398
|
let stopSupersessionWatch;
|
|
372
399
|
let shuttingDown = false;
|
|
373
400
|
let draining = false;
|
|
401
|
+
let handoffGraceTimer;
|
|
374
402
|
let shutdownPromise;
|
|
375
403
|
const childLaunch = spawnableChildLaunch(resolveHostChildLaunch(launch, internalSocket));
|
|
376
404
|
const child = spawn(childLaunch.command, childLaunch.args, {
|
|
@@ -409,6 +437,7 @@ export async function runHostSupervisor(launch) {
|
|
|
409
437
|
// CREATE_NO_WINDOW gives the child a console with no window instead.
|
|
410
438
|
windowsHide: true,
|
|
411
439
|
});
|
|
440
|
+
const childStartedAt = Date.now();
|
|
412
441
|
// Nothing is ever written; the pipe exists purely so its EOF is a reliable
|
|
413
442
|
// death notification. Errors on it must not crash the supervisor.
|
|
414
443
|
child.stdio[CHILD_WATCH_FD]?.on("error", () => { });
|
|
@@ -416,6 +445,9 @@ export async function runHostSupervisor(launch) {
|
|
|
416
445
|
if (shuttingDown)
|
|
417
446
|
return;
|
|
418
447
|
const { reason, exitCode } = classifyChildExit(code, signal);
|
|
448
|
+
// Record BEFORE shutting down: `shutdown` ends in `process.exit`, so anything queued after
|
|
449
|
+
// it is never reached. Writing is best-effort and never throws into this path.
|
|
450
|
+
noteChildExit(paths.dir, code, signal, childStartedAt);
|
|
419
451
|
void shutdown(reason, exitCode);
|
|
420
452
|
});
|
|
421
453
|
const server = createServer((client) => {
|
|
@@ -444,7 +476,12 @@ export async function runHostSupervisor(launch) {
|
|
|
444
476
|
internal.pipe(client);
|
|
445
477
|
client.once("close", detach);
|
|
446
478
|
client.once("error", detach);
|
|
447
|
-
|
|
479
|
+
// Let the final lifecycle records drain through the public socket before closing it.
|
|
480
|
+
internal.once("end", () => client.end(() => client.destroy()));
|
|
481
|
+
internal.once("close", () => {
|
|
482
|
+
if (!internal.readableEnded)
|
|
483
|
+
detach();
|
|
484
|
+
});
|
|
448
485
|
internal.once("error", detach);
|
|
449
486
|
};
|
|
450
487
|
if (publicSecret)
|
|
@@ -459,13 +496,19 @@ export async function runHostSupervisor(launch) {
|
|
|
459
496
|
const decider = new IdleExitDecider(policy.coldStart === "persistent" ? Number.POSITIVE_INFINITY : policy.idleExitMs);
|
|
460
497
|
const tickIntervalMs = Math.max(20, Math.min(1_000, policy.idleExitMs / 4));
|
|
461
498
|
const ticker = setInterval(() => {
|
|
462
|
-
if (decider.update(currentActivity()) === "exit")
|
|
499
|
+
if (!draining && decider.update(currentActivity()) === "exit")
|
|
463
500
|
void shutdown("idle", 0);
|
|
464
501
|
}, tickIntervalMs);
|
|
465
502
|
function currentActivity() {
|
|
466
503
|
return {
|
|
467
504
|
connections: clientSockets.size,
|
|
468
|
-
activeTurns:
|
|
505
|
+
activeTurns: activeTurnsForIdleDecision({
|
|
506
|
+
healthy: observerLink.healthy(),
|
|
507
|
+
unhealthySince: observerLink.unhealthySince(),
|
|
508
|
+
now: Date.now(),
|
|
509
|
+
unknownGraceMs: decider.idleExitMs,
|
|
510
|
+
observedBusy: countBusySessions(),
|
|
511
|
+
}),
|
|
469
512
|
};
|
|
470
513
|
}
|
|
471
514
|
function countBusySessions() {
|
|
@@ -508,6 +551,8 @@ export async function runHostSupervisor(launch) {
|
|
|
508
551
|
process.exit(exitCode);
|
|
509
552
|
shuttingDown = true;
|
|
510
553
|
clearInterval(ticker);
|
|
554
|
+
if (handoffGraceTimer)
|
|
555
|
+
clearTimeout(handoffGraceTimer);
|
|
511
556
|
if (childExitWatchTimer)
|
|
512
557
|
clearInterval(childExitWatchTimer);
|
|
513
558
|
stopSupersessionWatch?.();
|
|
@@ -532,7 +577,8 @@ export async function runHostSupervisor(launch) {
|
|
|
532
577
|
if (internal.dir)
|
|
533
578
|
await rm(internal.dir, { recursive: true, force: true });
|
|
534
579
|
await stopChild(child);
|
|
535
|
-
|
|
580
|
+
observerLink.stop();
|
|
581
|
+
observerSocket?.destroy();
|
|
536
582
|
if (publicSocketOwned && process.platform !== "win32") {
|
|
537
583
|
// Ownership-checked: after a takeover, a newer host may have published
|
|
538
584
|
// a fresh entry at this path; only the entry THIS supervisor bound is
|
|
@@ -553,7 +599,6 @@ export async function runHostSupervisor(launch) {
|
|
|
553
599
|
process.exit(exitCode);
|
|
554
600
|
}
|
|
555
601
|
}
|
|
556
|
-
let observer;
|
|
557
602
|
let publicSocketOwned = false;
|
|
558
603
|
let publicSocketIdentity;
|
|
559
604
|
function supervisorLog(message) {
|
|
@@ -564,20 +609,29 @@ export async function runHostSupervisor(launch) {
|
|
|
564
609
|
// startup must run the same cleanup instead of Node's default kill, which
|
|
565
610
|
// would leave that directory behind.
|
|
566
611
|
/**
|
|
567
|
-
*
|
|
568
|
-
*
|
|
569
|
-
*
|
|
612
|
+
* Ask the child to announce and park attached sessions as turns/requests settle. The supervisor
|
|
613
|
+
* owns the soft grace from this instant; expiry rescans but NEVER kills busy sessions. Child
|
|
614
|
+
* exit ends the supervisor regardless of clients that keep their connections open.
|
|
570
615
|
*/
|
|
571
616
|
function drainForHandoff() {
|
|
572
617
|
if (draining || shuttingDown)
|
|
573
618
|
return;
|
|
574
619
|
draining = true;
|
|
575
620
|
supervisorLog("draining into the next generation");
|
|
621
|
+
const graceMs = parseIdleExitMs(process.env[HANDOFF_GRACE_MS_ENV]) ?? DEFAULT_HANDOFF_GRACE_MS;
|
|
622
|
+
handoffGraceTimer = setTimeout(() => {
|
|
623
|
+
supervisorLog(JSON.stringify({ event: "handoff_grace_expired", graceMs }));
|
|
624
|
+
requestChildDrain();
|
|
625
|
+
}, graceMs);
|
|
626
|
+
handoffGraceTimer.unref();
|
|
576
627
|
// The listening handle is deliberately NOT closed: libuv unlinks a pipe's bound NAME when it
|
|
577
628
|
// closes, and after a handoff that name is the successor's entry. Nothing can reach this
|
|
578
629
|
// listener by path any more (the rename moved the name), and the accept guard above turns
|
|
579
630
|
// away whatever raced it, so leaving the handle open until exit costs nothing and keeps the
|
|
580
631
|
// public path continuously answerable - no window where a client finds no socket at all.
|
|
632
|
+
requestChildDrain();
|
|
633
|
+
}
|
|
634
|
+
function requestChildDrain() {
|
|
581
635
|
if (child.pid !== undefined && child.exitCode === null && child.signalCode === null) {
|
|
582
636
|
try {
|
|
583
637
|
process.kill(child.pid, "SIGUSR1");
|
|
@@ -590,7 +644,7 @@ export async function runHostSupervisor(launch) {
|
|
|
590
644
|
registerSupervisorSignals(shutdown, drainForHandoff);
|
|
591
645
|
try {
|
|
592
646
|
await waitForListener(internalSocket, 30_000, internalSecret);
|
|
593
|
-
await
|
|
647
|
+
await observerLink.open();
|
|
594
648
|
await prepareSocketPath(bindSocket);
|
|
595
649
|
await listen(server, bindSocket, publicSecret);
|
|
596
650
|
publicSocketOwned = true;
|
|
@@ -604,40 +658,18 @@ export async function runHostSupervisor(launch) {
|
|
|
604
658
|
await writeSocketIdentityFile(join(internal.dir, PUBLIC_SOCKET_IDENTITY_FILE), publicSocketIdentity);
|
|
605
659
|
}
|
|
606
660
|
// Losing the public entry IS a drain request: nothing can reach this supervisor by path any
|
|
607
|
-
// more, and the handoff that replaced it may never have signalled (#1893).
|
|
608
|
-
|
|
609
|
-
|
|
661
|
+
// more, and the handoff that replaced it may never have signalled (#1893). A name that was
|
|
662
|
+
// deleted rather than taken over is the same loss with nobody serving the path (#1961).
|
|
663
|
+
stopSupersessionWatch = watchForSupersession({ path: publicSocket, identity: publicSocketIdentity, settled: () => shuttingDown || draining }, (loss) => {
|
|
664
|
+
supervisorLog(loss === "absent"
|
|
665
|
+
? "the public socket entry is gone; nothing can reach this generation; draining"
|
|
666
|
+
: "another generation owns the public socket; draining this one");
|
|
610
667
|
drainForHandoff();
|
|
611
668
|
});
|
|
612
669
|
}
|
|
613
670
|
catch (cause) {
|
|
614
671
|
await shutdown(`startup failed: ${errorMessage(cause)}`, 1);
|
|
615
672
|
}
|
|
616
|
-
async function connectObserver() {
|
|
617
|
-
const secret = internalSecret;
|
|
618
|
-
const next = createConnection(resolveSocketTransportAddress(internalSocket, process.platform, secret));
|
|
619
|
-
if (secret)
|
|
620
|
-
sendSocketHandshake(next, secret);
|
|
621
|
-
await waitForConnect(next, 5_000);
|
|
622
|
-
observer = next;
|
|
623
|
-
observerHealthy = true;
|
|
624
|
-
attachJsonlLineReader(next, observeHostEvent, { maxLineLength: MAX_RPC_LINE_CHARACTERS });
|
|
625
|
-
const lost = () => {
|
|
626
|
-
if (observer !== next || shuttingDown)
|
|
627
|
-
return;
|
|
628
|
-
observerHealthy = false;
|
|
629
|
-
observer = undefined;
|
|
630
|
-
if (observerReconnectTimer === undefined) {
|
|
631
|
-
observerReconnectTimer = setTimeout(() => {
|
|
632
|
-
observerReconnectTimer = undefined;
|
|
633
|
-
void connectObserver().catch(() => lost());
|
|
634
|
-
}, 250);
|
|
635
|
-
observerReconnectTimer.unref?.();
|
|
636
|
-
}
|
|
637
|
-
};
|
|
638
|
-
next.once("close", lost);
|
|
639
|
-
next.once("error", lost);
|
|
640
|
-
}
|
|
641
673
|
if (process.platform === "win32" && child.pid !== undefined) {
|
|
642
674
|
// This baseline read sits outside the startup try/catch, and readProcessStartTime
|
|
643
675
|
// THROWS when the 1s CIM probe fails (execFile's timeout SIGTERMs the PowerShell
|