@draht/coding-agent 2026.7.30 → 2026.9.5-1
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 +154 -0
- package/README.md +46 -2
- package/agents/debugger.md +12 -1
- package/agents/git-committer.md +1 -0
- package/agents/implementer.md +20 -0
- package/agents/investigator.md +75 -0
- package/agents/reviewer.md +7 -0
- package/agents/spec-reviewer.md +66 -0
- package/agents/verifier.md +4 -3
- package/bin/draht-tools.cjs +472 -41
- package/dist/agents/debugger.md +12 -1
- package/dist/agents/git-committer.md +1 -0
- package/dist/agents/implementer.md +20 -0
- package/dist/agents/investigator.md +75 -0
- package/dist/agents/reviewer.md +7 -0
- package/dist/agents/spec-reviewer.md +66 -0
- package/dist/agents/verifier.md +4 -3
- package/dist/cli/args.d.ts +10 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +69 -2
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/attach-mode.d.ts +61 -0
- package/dist/cli/attach-mode.d.ts.map +1 -1
- package/dist/cli/attach-mode.js +243 -5
- package/dist/cli/attach-mode.js.map +1 -1
- package/dist/cli/credential-print.d.ts +1 -1
- package/dist/cli/credential-print.d.ts.map +1 -1
- package/dist/cli/credential-print.js +5 -4
- package/dist/cli/credential-print.js.map +1 -1
- package/dist/config.d.ts +9 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +31 -4
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts +17 -1
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +87 -30
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-services.d.ts +1 -1
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +1 -0
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +35 -16
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +149 -64
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage.d.ts +5 -1
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +72 -15
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/builtins/checkpoints.d.ts +20 -0
- package/dist/core/builtins/checkpoints.d.ts.map +1 -0
- package/dist/core/builtins/checkpoints.js +161 -0
- package/dist/core/builtins/checkpoints.js.map +1 -0
- package/dist/core/builtins/duet.d.ts +26 -0
- package/dist/core/builtins/duet.d.ts.map +1 -0
- package/dist/core/builtins/duet.js +660 -0
- package/dist/core/builtins/duet.js.map +1 -0
- package/dist/core/builtins/index.d.ts.map +1 -1
- package/dist/core/builtins/index.js +7 -1
- package/dist/core/builtins/index.js.map +1 -1
- package/dist/core/builtins/subagent.d.ts +24 -4
- package/dist/core/builtins/subagent.d.ts.map +1 -1
- package/dist/core/builtins/subagent.js +278 -35
- package/dist/core/builtins/subagent.js.map +1 -1
- package/dist/core/checkpoints/checkpoint-cli.d.ts +17 -0
- package/dist/core/checkpoints/checkpoint-cli.d.ts.map +1 -0
- package/dist/core/checkpoints/checkpoint-cli.js +78 -0
- package/dist/core/checkpoints/checkpoint-cli.js.map +1 -0
- package/dist/core/checkpoints/checkpoint-manager.d.ts +294 -0
- package/dist/core/checkpoints/checkpoint-manager.d.ts.map +1 -0
- package/dist/core/checkpoints/checkpoint-manager.js +865 -0
- package/dist/core/checkpoints/checkpoint-manager.js.map +1 -0
- package/dist/core/checkpoints/rewind.d.ts +141 -0
- package/dist/core/checkpoints/rewind.d.ts.map +1 -0
- package/dist/core/checkpoints/rewind.js +246 -0
- package/dist/core/checkpoints/rewind.js.map +1 -0
- package/dist/core/compaction/branch-summarization.d.ts +1 -1
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +9 -4
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +5 -0
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +25 -4
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +83 -20
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +13 -2
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +37 -2
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +189 -6
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/http-dispatcher.d.ts.map +1 -1
- package/dist/core/http-dispatcher.js +7 -0
- package/dist/core/http-dispatcher.js.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/keybindings.d.ts +5 -0
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +1 -0
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/model-registry.d.ts +3 -2
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +8 -8
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +34 -7
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/model-runtime.d.ts +7 -1
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +30 -10
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/multi-agent/permission-gate.d.ts.map +1 -1
- package/dist/core/multi-agent/permission-gate.js +4 -3
- package/dist/core/multi-agent/permission-gate.js.map +1 -1
- package/dist/core/multi-agent/worktree.d.ts +2 -0
- package/dist/core/multi-agent/worktree.d.ts.map +1 -1
- package/dist/core/multi-agent/worktree.js +2 -2
- package/dist/core/multi-agent/worktree.js.map +1 -1
- package/dist/core/package-manager.d.ts +7 -1
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +21 -44
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/permission-relay/index.d.ts +19 -0
- package/dist/core/permission-relay/index.d.ts.map +1 -0
- package/dist/core/permission-relay/index.js +49 -0
- package/dist/core/permission-relay/index.js.map +1 -0
- package/dist/core/permission-relay/relay-ui-context.d.ts +39 -0
- package/dist/core/permission-relay/relay-ui-context.d.ts.map +1 -0
- package/dist/core/permission-relay/relay-ui-context.js +788 -0
- package/dist/core/permission-relay/relay-ui-context.js.map +1 -0
- package/dist/core/permission-relay/types.d.ts +222 -0
- package/dist/core/permission-relay/types.d.ts.map +1 -0
- package/dist/core/permission-relay/types.js +15 -0
- package/dist/core/permission-relay/types.js.map +1 -0
- package/dist/core/pi-manifest.d.ts +14 -0
- package/dist/core/pi-manifest.d.ts.map +1 -0
- package/dist/core/pi-manifest.js +35 -0
- package/dist/core/pi-manifest.js.map +1 -0
- package/dist/core/project-trust.js +2 -2
- package/dist/core/project-trust.js.map +1 -1
- package/dist/core/resource-loader.d.ts +21 -0
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +101 -24
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/sandbox/bash-operations.d.ts +149 -0
- package/dist/core/sandbox/bash-operations.d.ts.map +1 -0
- package/dist/core/sandbox/bash-operations.js +163 -0
- package/dist/core/sandbox/bash-operations.js.map +1 -0
- package/dist/core/sandbox/env.d.ts +83 -0
- package/dist/core/sandbox/env.d.ts.map +1 -0
- package/dist/core/sandbox/env.js +123 -0
- package/dist/core/sandbox/env.js.map +1 -0
- package/dist/core/sandbox/executor.d.ts +104 -0
- package/dist/core/sandbox/executor.d.ts.map +1 -0
- package/dist/core/sandbox/executor.js +92 -0
- package/dist/core/sandbox/executor.js.map +1 -0
- package/dist/core/sandbox/index.d.ts +36 -0
- package/dist/core/sandbox/index.d.ts.map +1 -0
- package/dist/core/sandbox/index.js +36 -0
- package/dist/core/sandbox/index.js.map +1 -0
- package/dist/core/sandbox/linux.d.ts +121 -0
- package/dist/core/sandbox/linux.d.ts.map +1 -0
- package/dist/core/sandbox/linux.js +260 -0
- package/dist/core/sandbox/linux.js.map +1 -0
- package/dist/core/sandbox/policy.d.ts +142 -0
- package/dist/core/sandbox/policy.d.ts.map +1 -0
- package/dist/core/sandbox/policy.js +297 -0
- package/dist/core/sandbox/policy.js.map +1 -0
- package/dist/core/sandbox/real-path.d.ts +112 -0
- package/dist/core/sandbox/real-path.d.ts.map +1 -0
- package/dist/core/sandbox/real-path.js +158 -0
- package/dist/core/sandbox/real-path.js.map +1 -0
- package/dist/core/sandbox/seatbelt-profile.d.ts +95 -0
- package/dist/core/sandbox/seatbelt-profile.d.ts.map +1 -0
- package/dist/core/sandbox/seatbelt-profile.js +239 -0
- package/dist/core/sandbox/seatbelt-profile.js.map +1 -0
- package/dist/core/sandbox/seatbelt.d.ts +95 -0
- package/dist/core/sandbox/seatbelt.d.ts.map +1 -0
- package/dist/core/sandbox/seatbelt.js +154 -0
- package/dist/core/sandbox/seatbelt.js.map +1 -0
- package/dist/core/sandbox/self-test.d.ts +109 -0
- package/dist/core/sandbox/self-test.d.ts.map +1 -0
- package/dist/core/sandbox/self-test.js +369 -0
- package/dist/core/sandbox/self-test.js.map +1 -0
- package/dist/core/sandbox/spawn.d.ts +33 -0
- package/dist/core/sandbox/spawn.d.ts.map +1 -0
- package/dist/core/sandbox/spawn.js +87 -0
- package/dist/core/sandbox/spawn.js.map +1 -0
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +3 -1
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager.d.ts +60 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +53 -6
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts +21 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +36 -16
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/skills.d.ts +3 -1
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +19 -6
- package/dist/core/skills.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +1 -0
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/soak/soak-log.d.ts +298 -0
- package/dist/core/soak/soak-log.d.ts.map +1 -0
- package/dist/core/soak/soak-log.js +660 -0
- package/dist/core/soak/soak-log.js.map +1 -0
- package/dist/core/soak/soak-reader.d.ts +60 -0
- package/dist/core/soak/soak-reader.d.ts.map +1 -0
- package/dist/core/soak/soak-reader.js +106 -0
- package/dist/core/soak/soak-reader.js.map +1 -0
- package/dist/core/socket-server/discovery.d.ts +78 -1
- package/dist/core/socket-server/discovery.d.ts.map +1 -1
- package/dist/core/socket-server/discovery.js +356 -37
- package/dist/core/socket-server/discovery.js.map +1 -1
- package/dist/core/socket-server/index.d.ts +10 -4
- package/dist/core/socket-server/index.d.ts.map +1 -1
- package/dist/core/socket-server/index.js +6 -3
- package/dist/core/socket-server/index.js.map +1 -1
- package/dist/core/socket-server/permission-delivery.d.ts +125 -0
- package/dist/core/socket-server/permission-delivery.d.ts.map +1 -0
- package/dist/core/socket-server/permission-delivery.js +152 -0
- package/dist/core/socket-server/permission-delivery.js.map +1 -0
- package/dist/core/socket-server/permission-registry.d.ts +301 -0
- package/dist/core/socket-server/permission-registry.d.ts.map +1 -0
- package/dist/core/socket-server/permission-registry.js +410 -0
- package/dist/core/socket-server/permission-registry.js.map +1 -0
- package/dist/core/socket-server/permission-relay.d.ts +81 -0
- package/dist/core/socket-server/permission-relay.d.ts.map +1 -0
- package/dist/core/socket-server/permission-relay.js +528 -0
- package/dist/core/socket-server/permission-relay.js.map +1 -0
- package/dist/core/socket-server/safe-text.d.ts +83 -0
- package/dist/core/socket-server/safe-text.d.ts.map +1 -0
- package/dist/core/socket-server/safe-text.js +277 -0
- package/dist/core/socket-server/safe-text.js.map +1 -0
- package/dist/core/socket-server/session-integration.d.ts +65 -2
- package/dist/core/socket-server/session-integration.d.ts.map +1 -1
- package/dist/core/socket-server/session-integration.js +434 -32
- package/dist/core/socket-server/session-integration.js.map +1 -1
- package/dist/core/socket-server/socket-client.d.ts +21 -2
- package/dist/core/socket-server/socket-client.d.ts.map +1 -1
- package/dist/core/socket-server/socket-client.js +52 -1
- package/dist/core/socket-server/socket-client.js.map +1 -1
- package/dist/core/socket-server/socket-server.d.ts +152 -1
- package/dist/core/socket-server/socket-server.d.ts.map +1 -1
- package/dist/core/socket-server/socket-server.js +775 -26
- package/dist/core/socket-server/socket-server.js.map +1 -1
- package/dist/core/socket-server/types.d.ts +106 -2
- package/dist/core/socket-server/types.d.ts.map +1 -1
- package/dist/core/socket-server/types.js +13 -1
- package/dist/core/socket-server/types.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +8 -9
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/bash.d.ts +1 -1
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +5 -2
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +17 -2
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/find.d.ts +3 -0
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +11 -18
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/trust-manager.d.ts +6 -4
- package/dist/core/trust-manager.d.ts.map +1 -1
- package/dist/core/trust-manager.js +55 -21
- package/dist/core/trust-manager.js.map +1 -1
- package/dist/extensions/index.d.ts.map +1 -1
- package/dist/extensions/index.js +5 -1
- package/dist/extensions/index.js.map +1 -1
- package/dist/extensions/llama/provider.d.ts.map +1 -1
- package/dist/extensions/llama/provider.js +5 -1
- package/dist/extensions/llama/provider.js.map +1 -1
- package/dist/extensions/stub-provider/index.d.ts +9 -0
- package/dist/extensions/stub-provider/index.d.ts.map +1 -0
- package/dist/extensions/stub-provider/index.js +13 -0
- package/dist/extensions/stub-provider/index.js.map +1 -0
- package/dist/extensions/stub-provider/provider.d.ts +77 -0
- package/dist/extensions/stub-provider/provider.d.ts.map +1 -0
- package/dist/extensions/stub-provider/provider.js +193 -0
- package/dist/extensions/stub-provider/provider.js.map +1 -0
- package/dist/hooks/gsd/draht-quality-gate.js +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +242 -45
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/config-selector.js +3 -2
- package/dist/modes/interactive/components/config-selector.js.map +1 -1
- package/dist/modes/interactive/components/extension-selector.d.ts +49 -0
- package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-selector.js +202 -5
- package/dist/modes/interactive/components/extension-selector.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +10 -2
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +2 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +10 -0
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +10 -1
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector.d.ts +20 -2
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector.js +21 -5
- package/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +97 -3
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +394 -24
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +165 -7
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +68 -1
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/prompts/commands/atomic-commit.md +1 -12
- package/dist/prompts/commands/brainstorm.md +12 -15
- package/dist/prompts/commands/create-verification-skill.md +108 -0
- package/dist/prompts/commands/discuss-phase.md +3 -14
- package/dist/prompts/commands/execute-phase.md +3 -11
- package/dist/prompts/commands/fix.md +41 -18
- package/dist/prompts/commands/grill.md +66 -0
- package/dist/prompts/commands/init-project.md +5 -15
- package/dist/prompts/commands/map-codebase.md +1 -13
- package/dist/prompts/commands/new-project.md +5 -15
- package/dist/prompts/commands/next-milestone.md +1 -13
- package/dist/prompts/commands/orchestrate.md +1 -1
- package/dist/prompts/commands/pause-work.md +1 -13
- package/dist/prompts/commands/plan-phase.md +2 -11
- package/dist/prompts/commands/progress.md +0 -13
- package/dist/prompts/commands/quick.md +3 -11
- package/dist/prompts/commands/resolve-conflicts.md +71 -0
- package/dist/prompts/commands/resume-work.md +0 -13
- package/dist/prompts/commands/review.md +4 -13
- package/dist/prompts/commands/triage.md +159 -0
- package/dist/prompts/commands/verify-work.md +4 -14
- package/dist/prompts/commands/why.md +135 -0
- package/dist/skills/atomic-reasoning/SKILL.md +115 -0
- package/dist/skills/blast-radius/SKILL.md +55 -0
- package/dist/skills/epistemics/SKILL.md +99 -0
- package/dist/skills/hexagon-animation/SKILL.md +49 -0
- package/dist/skills/hexagon-animation/generate.mjs +81 -0
- package/dist/skills/hexagon-animation/template.html +361 -0
- package/dist/skills/typescript-discipline/SKILL.md +50 -0
- package/dist/skills/typescript-discipline/references/patterns.md +294 -0
- package/dist/skills/unslop/SKILL.md +101 -0
- package/dist/utils/canonical-path.d.ts +28 -0
- package/dist/utils/canonical-path.d.ts.map +1 -0
- package/dist/utils/canonical-path.js +90 -0
- package/dist/utils/canonical-path.js.map +1 -0
- package/dist/utils/child-process.d.ts +12 -1
- package/dist/utils/child-process.d.ts.map +1 -1
- package/dist/utils/child-process.js +25 -8
- package/dist/utils/child-process.js.map +1 -1
- package/dist/utils/clipboard.d.ts +1 -1
- package/dist/utils/clipboard.d.ts.map +1 -1
- package/dist/utils/clipboard.js +22 -2
- package/dist/utils/clipboard.js.map +1 -1
- package/dist/utils/exif-orientation.d.ts.map +1 -1
- package/dist/utils/exif-orientation.js +2 -3
- package/dist/utils/exif-orientation.js.map +1 -1
- package/dist/utils/paths.d.ts +2 -7
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +13 -15
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +6 -4
- package/dist/utils/shell.js.map +1 -1
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +3 -5
- package/dist/utils/tools-manager.js.map +1 -1
- package/docs/attachable-sessions.md +79 -0
- package/docs/compaction.md +21 -21
- package/docs/containerization.md +23 -23
- package/docs/custom-provider.md +16 -16
- package/docs/development.md +9 -9
- package/docs/docs.json +6 -2
- package/docs/duet.md +42 -0
- package/docs/extensions.md +58 -58
- package/docs/index.md +10 -10
- package/docs/json.md +7 -7
- package/docs/keybindings.md +6 -5
- package/docs/llama-cpp.md +6 -6
- package/docs/models.md +6 -6
- package/docs/packages.md +43 -43
- package/docs/prompt-templates.md +4 -4
- package/docs/providers.md +12 -12
- package/docs/quickstart.md +32 -32
- package/docs/rpc.md +83 -12
- package/docs/sdk.md +15 -15
- package/docs/security.md +18 -18
- package/docs/session-format.md +35 -13
- package/docs/sessions.md +17 -14
- package/docs/settings.md +25 -18
- package/docs/shell-aliases.md +2 -2
- package/docs/skills.md +12 -11
- package/docs/terminal-setup.md +12 -12
- package/docs/termux.md +6 -6
- package/docs/themes.md +11 -11
- package/docs/tmux.md +4 -4
- package/docs/tui.md +5 -5
- package/docs/usage.md +50 -50
- package/docs/windows.md +2 -2
- package/examples/extensions/overlay-qa-tests.ts +3 -3
- package/hooks/gsd/draht-quality-gate.js +3 -3
- package/package.json +11 -10
- package/prompts/commands/atomic-commit.md +1 -12
- package/prompts/commands/brainstorm.md +12 -15
- package/prompts/commands/create-verification-skill.md +108 -0
- package/prompts/commands/discuss-phase.md +3 -14
- package/prompts/commands/execute-phase.md +3 -11
- package/prompts/commands/fix.md +41 -18
- package/prompts/commands/grill.md +66 -0
- package/prompts/commands/init-project.md +5 -15
- package/prompts/commands/map-codebase.md +1 -13
- package/prompts/commands/new-project.md +5 -15
- package/prompts/commands/next-milestone.md +1 -13
- package/prompts/commands/orchestrate.md +1 -1
- package/prompts/commands/pause-work.md +1 -13
- package/prompts/commands/plan-phase.md +2 -11
- package/prompts/commands/progress.md +0 -13
- package/prompts/commands/quick.md +3 -11
- package/prompts/commands/resolve-conflicts.md +71 -0
- package/prompts/commands/resume-work.md +0 -13
- package/prompts/commands/review.md +4 -13
- package/prompts/commands/triage.md +159 -0
- package/prompts/commands/verify-work.md +4 -14
- package/prompts/commands/why.md +135 -0
- package/skills/atomic-reasoning/SKILL.md +115 -0
- package/skills/blast-radius/SKILL.md +55 -0
- package/skills/epistemics/SKILL.md +99 -0
- package/skills/hexagon-animation/SKILL.md +49 -0
- package/skills/hexagon-animation/generate.mjs +81 -0
- package/skills/hexagon-animation/template.html +361 -0
- package/skills/typescript-discipline/SKILL.md +50 -0
- package/skills/typescript-discipline/references/patterns.md +294 -0
- package/skills/unslop/SKILL.md +101 -0
- package/dist/prompts/agents/build.md +0 -86
- package/dist/prompts/agents/plan.md +0 -79
- package/dist/prompts/agents/verify.md +0 -69
- package/prompts/agents/build.md +0 -86
- package/prompts/agents/plan.md +0 -79
- package/prompts/agents/verify.md +0 -69
|
@@ -4,37 +4,451 @@
|
|
|
4
4
|
* Wires up socket server to broadcast agent output and forward client input.
|
|
5
5
|
*/
|
|
6
6
|
import path from "node:path";
|
|
7
|
-
import { getAgentDir } from "../../config.js";
|
|
7
|
+
import { APP_NAME, getAgentDir } from "../../config.js";
|
|
8
|
+
import { getSoakLog, SOAK_EVENTS, startupDeltaMs } from "../soak/soak-log.js";
|
|
9
|
+
import { PermissionDelivery } from "./permission-delivery.js";
|
|
10
|
+
import { PermissionRegistry } from "./permission-registry.js";
|
|
11
|
+
import { createSocketPermissionRelay } from "./permission-relay.js";
|
|
8
12
|
import { SocketServer } from "./socket-server.js";
|
|
13
|
+
/**
|
|
14
|
+
* SOAK RECORDING (R35-ALWAYS.11). Every seam below hands the process-wide soak log
|
|
15
|
+
* one line and returns; nothing here may do anything else.
|
|
16
|
+
*
|
|
17
|
+
* THE THREE RULES, and they are the whole contract of this helper:
|
|
18
|
+
* • NEVER stdout, NEVER stderr. The TUI owns the terminal and a default-on
|
|
19
|
+
* session's streams are asserted identical to a feature-off run, so one stray
|
|
20
|
+
* byte from here surfaces as somebody else's regression.
|
|
21
|
+
* • NEVER throw into a caller. `SoakLog` swallows its own failures; this wrapper
|
|
22
|
+
* covers the one thing it cannot, which is failing to be constructed at all.
|
|
23
|
+
* • NEVER build a record any other way than `log.record()` / `log.heartbeat()`.
|
|
24
|
+
* Those stamp the mandatory fields (wall, pid, rss, sessionId…) LAST, over the
|
|
25
|
+
* caller's, which is what keeps a seam field innocently named `pid` — the lock
|
|
26
|
+
* files carry one — from shadowing the record's own and getting the whole line
|
|
27
|
+
* dropped by the reader as malformed.
|
|
28
|
+
*
|
|
29
|
+
* SCOPE LIMIT, stated rather than implied: this records what the SESSION PROCESS
|
|
30
|
+
* observes. A tailnet drop, a daemon restart, a gateway-side refusal — none of
|
|
31
|
+
* those are visible from here, and Phase 35 does not cover them. The daemon half
|
|
32
|
+
* is a SEPARATE writer implementing the file-format contract documented at the top
|
|
33
|
+
* of `soak/soak-log.ts`; it must not import this module or share one with it,
|
|
34
|
+
* because Phase 38's boundary gate forbids a module spanning that line. The two
|
|
35
|
+
* halves are joined at verdict time by `sessionId` and `wall`.
|
|
36
|
+
*/
|
|
37
|
+
function soak(use) {
|
|
38
|
+
try {
|
|
39
|
+
use(getSoakLog());
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
// Deliberately empty, and deliberately not logged anywhere.
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* A prompt that arrived over the socket and did not simply run.
|
|
47
|
+
*
|
|
48
|
+
* The prompt TEXT is never recorded — only how long it was. This file writes into
|
|
49
|
+
* a log that is kept for weeks and read by a verdict tool; "what did the operator
|
|
50
|
+
* type from their phone" is not a question a resilience soak needs answered, and a
|
|
51
|
+
* log that could answer it is one more place a secret can end up.
|
|
52
|
+
*/
|
|
53
|
+
function recordPromptRejected(code, clientId, prompt, reason) {
|
|
54
|
+
soak((log) => log.record(SOAK_EVENTS.PROMPT_REJECTED, {
|
|
55
|
+
code,
|
|
56
|
+
clientId,
|
|
57
|
+
promptChars: prompt.length,
|
|
58
|
+
...(reason === undefined ? {} : { reason }),
|
|
59
|
+
}, code === "PROMPT_FAILED" ? "error" : "info"));
|
|
60
|
+
}
|
|
61
|
+
const DISABLED_SESSION = {
|
|
62
|
+
socketPath: null,
|
|
63
|
+
sessionId: null,
|
|
64
|
+
// No socket, so nobody can be asked anything remotely. Handing this to a session would make
|
|
65
|
+
// `hasUI()` claim a surface that does not exist.
|
|
66
|
+
relay: null,
|
|
67
|
+
rebind: async () => { },
|
|
68
|
+
stop: async () => { },
|
|
69
|
+
stopSync: () => { },
|
|
70
|
+
};
|
|
9
71
|
/**
|
|
10
72
|
* Wrap an agent session with a socket server if attachable mode is enabled.
|
|
11
73
|
*
|
|
12
|
-
* Returns
|
|
74
|
+
* Returns a handle that owns the socket's lifetime.
|
|
13
75
|
*/
|
|
14
76
|
export async function makeSessionAttachable(options) {
|
|
15
77
|
if (!options.enabled) {
|
|
16
|
-
return
|
|
78
|
+
return DISABLED_SESSION;
|
|
17
79
|
}
|
|
18
|
-
const session = options.session;
|
|
19
80
|
const agentDir = getAgentDir();
|
|
20
81
|
const socketDir = path.join(agentDir, "sockets");
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
82
|
+
const warn = options.onWarning ?? ((message) => console.error(message));
|
|
83
|
+
const log = options.log ?? ((message) => console.log(message));
|
|
84
|
+
let server = null;
|
|
85
|
+
let unsubscribe = null;
|
|
86
|
+
let stopped = false;
|
|
87
|
+
/**
|
|
88
|
+
* The relay for the session currently bound.
|
|
89
|
+
*
|
|
90
|
+
* It lives HERE, in the bind closure, for one reason each way: it must die with the session
|
|
91
|
+
* (an ask belongs to the session that raised it and may not survive into its replacement), and
|
|
92
|
+
* it must survive CLIENT CHURN (`#handleClientDisconnect` only removes a client, so a phone
|
|
93
|
+
* that drops its connection mid-ask must be able to reconnect and be shown the same ask). A
|
|
94
|
+
* relay in the UI decorator would satisfy neither: that object is rebuilt on every extension
|
|
95
|
+
* reload.
|
|
96
|
+
*/
|
|
97
|
+
let relay = null;
|
|
98
|
+
/** Ends every pending ask fail-closed. Set alongside {@link relay}; null when nothing is bound. */
|
|
99
|
+
let cancelPending = null;
|
|
100
|
+
/**
|
|
101
|
+
* The last thing this handle records, from whichever exit path reached it.
|
|
102
|
+
*
|
|
103
|
+
* Both callers are guarded by `stopped`, so exactly one `socket_teardown` is
|
|
104
|
+
* written per handle — which is what makes "every bind has a teardown" a claim a
|
|
105
|
+
* verdict can check rather than a hope. The heartbeat is stopped here and the
|
|
106
|
+
* client-count provider dropped with it: it closes over a server that is about to
|
|
107
|
+
* be gone.
|
|
108
|
+
*/
|
|
109
|
+
const recordTeardown = (exitPath) => {
|
|
110
|
+
soak((log) => {
|
|
111
|
+
log.record(SOAK_EVENTS.SOCKET_TEARDOWN, {
|
|
112
|
+
exitPath,
|
|
113
|
+
socketPath: server?.socketPath ?? null,
|
|
114
|
+
clients: server?.clientCount ?? 0,
|
|
115
|
+
});
|
|
116
|
+
log.stopHeartbeat();
|
|
117
|
+
log.setClientCountProvider(undefined);
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* `previousSessionId` is null for the FIRST bind of this process and carries the
|
|
122
|
+
* outgoing session's id for every later one, which is the only thing that tells a
|
|
123
|
+
* `socket_bind` from a `socket_rebind` in the log: both end with a live socket,
|
|
124
|
+
* but only one of them means a client that was attached has been dropped.
|
|
125
|
+
*/
|
|
126
|
+
const bind = async (session, cwd, previousSessionId) => {
|
|
127
|
+
// Get session ID from the session manager header
|
|
128
|
+
const header = session.sessionManager.getHeader();
|
|
129
|
+
if (!header) {
|
|
130
|
+
throw new Error("Cannot make session attachable: no session header found");
|
|
131
|
+
}
|
|
132
|
+
// Stamped BEFORE start(), so a bind that is REFUSED — the socket cap, a busy
|
|
133
|
+
// twin — still records under the session it was refused for. Everything the
|
|
134
|
+
// writer stamps from here on carries this id, which is what lets Phase 39 join
|
|
135
|
+
// this stream against the session's own durable rows.
|
|
136
|
+
soak((log) => log.setSessionId(header.id));
|
|
137
|
+
const next = new SocketServer({
|
|
138
|
+
sessionId: header.id,
|
|
139
|
+
socketDir,
|
|
140
|
+
cwd,
|
|
141
|
+
maxClients: 10,
|
|
142
|
+
broadcastInputEcho: true,
|
|
143
|
+
});
|
|
144
|
+
await next.start();
|
|
145
|
+
unsubscribe = subscribeToSession(session, next);
|
|
146
|
+
soak((log) => {
|
|
147
|
+
// The live client count for the heartbeat comes from the server itself, so a
|
|
148
|
+
// gauge never disagrees with the thing it measures.
|
|
149
|
+
log.setClientCountProvider(() => next.clientCount);
|
|
150
|
+
log.record(previousSessionId === null ? SOAK_EVENTS.SOCKET_BIND : SOAK_EVENTS.SOCKET_REBIND, {
|
|
151
|
+
socketPath: next.socketPath,
|
|
152
|
+
cwd,
|
|
153
|
+
// R39-RESIL.6 wants the startup delta by name. It equals the `uptimeMs` the
|
|
154
|
+
// writer stamps on every record; carrying it explicitly means a verdict tool
|
|
155
|
+
// can ask a bind for "how long did this session take to publish itself" without
|
|
156
|
+
// knowing that the two are the same number.
|
|
157
|
+
startupDeltaMs: startupDeltaMs(),
|
|
158
|
+
...(previousSessionId === null ? {} : { previousSessionId, outcome: "bound" }),
|
|
159
|
+
});
|
|
160
|
+
// ONE heartbeat right now, before the interval's first tick. A session shorter
|
|
161
|
+
// than the heartbeat period would otherwise contribute no gauge at all, and the
|
|
162
|
+
// fd/socket gauges at bind are the baseline every later heartbeat is read
|
|
163
|
+
// against. `startHeartbeat` is idempotent and its timer is unref'd, so a rebind
|
|
164
|
+
// neither starts a second one nor keeps the process alive.
|
|
165
|
+
log.heartbeat();
|
|
166
|
+
log.startHeartbeat();
|
|
167
|
+
});
|
|
168
|
+
// ── the permission relay for THIS session ──────────────────────────────────────────────
|
|
169
|
+
const registry = new PermissionRegistry({ sessionId: header.id });
|
|
170
|
+
const delivery = new PermissionDelivery({ pending: () => registry.pending() });
|
|
171
|
+
/**
|
|
172
|
+
* Whether THIS bind still owns the socket. A relay whose session was replaced or stopped
|
|
173
|
+
* must write nothing: a late timer or a straggling socket callback would otherwise reach a
|
|
174
|
+
* server that has already been torn down.
|
|
175
|
+
*/
|
|
176
|
+
let boundLive = true;
|
|
177
|
+
const bound = createSocketPermissionRelay({
|
|
178
|
+
registry,
|
|
179
|
+
delivery,
|
|
180
|
+
server: () => (boundLive ? next : null),
|
|
181
|
+
recorder: () => session.sessionManager,
|
|
182
|
+
sessionId: header.id,
|
|
183
|
+
cwd,
|
|
184
|
+
onWarning: warn,
|
|
185
|
+
});
|
|
186
|
+
relay = bound;
|
|
187
|
+
cancelPending = () => {
|
|
188
|
+
// Cancel FIRST — the announcement has to go out while the socket is still up — and only
|
|
189
|
+
// then close the door behind it.
|
|
190
|
+
bound.cancelAll();
|
|
191
|
+
boundLive = false;
|
|
192
|
+
};
|
|
193
|
+
// An answer is NOT input. It must never reach the `onInput` funnel below, which hands
|
|
194
|
+
// everything it receives to `session.prompt(...)` — that is exactly how a "Yes" tapped on
|
|
195
|
+
// a phone became a queued chat message while the agent sat waiting for a decision nobody
|
|
196
|
+
// could deliver.
|
|
197
|
+
next.onPermissionResponse((message, clientId) => {
|
|
198
|
+
bound.handleResponse(message, clientId);
|
|
199
|
+
});
|
|
200
|
+
// Fired right after `session_metadata`, so a client that attached mid-ask is shown it on a
|
|
201
|
+
// surface that already knows which session it is looking at. Replay is a SEND, not a state
|
|
202
|
+
// transition: the ask stays pending until somebody actually answers it.
|
|
203
|
+
//
|
|
204
|
+
// NOT the `client_attach` soak seam, though it is the obvious candidate and the
|
|
205
|
+
// plan named it: this callback is gated by `#mayReceivePermissionFrames`, so a
|
|
206
|
+
// read-only peer, or any client built before geist/0.3 that declares no
|
|
207
|
+
// capabilities, attaches WITHOUT reaching it. Recording here would have paired
|
|
208
|
+
// every such client's `client_detach` — which is ungated — with no attach at all,
|
|
209
|
+
// and Phase 39 counts attaches against detaches. Both records are therefore made
|
|
210
|
+
// one layer down, at the connection bookkeeping in `socket-server.ts`, where the
|
|
211
|
+
// two seams are symmetric by construction.
|
|
212
|
+
next.onAttachReplay((clientId) => {
|
|
213
|
+
bound.replayTo(clientId);
|
|
214
|
+
});
|
|
215
|
+
// Per-connection bookkeeping only. The ask itself is untouched: a client that was shown an
|
|
216
|
+
// ask and then died must not take that ask with it.
|
|
217
|
+
// The matching half of the note above: `client_detach` is recorded in
|
|
218
|
+
// `socket-server.ts`, not here.
|
|
219
|
+
next.onClientDisconnect((clientId) => {
|
|
220
|
+
bound.forgetClient(clientId);
|
|
221
|
+
});
|
|
222
|
+
// Forward input from socket clients to session
|
|
223
|
+
next.onInput((data, clientId) => {
|
|
224
|
+
// Concurrent-writer policy (R32-FLEET.7): QUEUE, and say so.
|
|
225
|
+
//
|
|
226
|
+
// Without a `streamingBehavior`, AgentSession.prompt() refuses outright while the
|
|
227
|
+
// agent is mid-turn. Over a socket that refusal reached only the sender, while every
|
|
228
|
+
// OTHER attached client had already been shown the prompt as an `input_echo` - so on
|
|
229
|
+
// a second screen the message appeared, was never answered, and was never explained.
|
|
230
|
+
// That is precisely the "vanished message" a phone must never be shown.
|
|
231
|
+
//
|
|
232
|
+
// `followUp` is the queueing mode chosen over `steer`: the running turn finishes
|
|
233
|
+
// exactly as it would have (steering rewrites what the agent is currently doing,
|
|
234
|
+
// which no remote client can see well enough to intend), the queued prompt runs next,
|
|
235
|
+
// and its output streams to every attached client like any other turn. Order is
|
|
236
|
+
// preserved, and nothing is dropped.
|
|
237
|
+
//
|
|
238
|
+
// Queuing silently would trade a vanished message for an unexplained pause, so the
|
|
239
|
+
// client that sent it is told on the relayed error channel, under a code a renderer
|
|
240
|
+
// can switch on rather than prose it would have to match.
|
|
241
|
+
const queueing = session.isStreaming;
|
|
242
|
+
// An unhandled rejection here would take the whole agent down under Node's default
|
|
243
|
+
// --unhandled-rejections=throw, so remote input is never left floating: genuine
|
|
244
|
+
// failures (no model, no credentials) are reported to the client that sent them and
|
|
245
|
+
// the session keeps running.
|
|
246
|
+
void Promise.resolve()
|
|
247
|
+
.then(() => session.prompt(data, { streamingBehavior: "followUp" }))
|
|
248
|
+
.then(() => {
|
|
249
|
+
// `queueing` is sampled before the call and confirmed after it: a prompt that
|
|
250
|
+
// was accepted immediately must not be announced as deferred, and a turn that
|
|
251
|
+
// ended in between needs no notice because nothing is waiting.
|
|
252
|
+
if (!queueing || !session.isStreaming)
|
|
253
|
+
return;
|
|
254
|
+
next.sendErrorToClient(clientId, "The agent is mid-turn. Your prompt was queued and runs when the current turn finishes.", "PROMPT_QUEUED");
|
|
255
|
+
// NO `requestId` here, and that is not an omission. A prompt over the
|
|
256
|
+
// socket is not a permission ask: it creates no `PermissionResolutionEntry`
|
|
257
|
+
// and there is nothing on the durable side to join it to. The records that
|
|
258
|
+
// DO carry one are the permission refusals in `socket-server.ts`.
|
|
259
|
+
recordPromptRejected("PROMPT_QUEUED", clientId, data);
|
|
260
|
+
})
|
|
261
|
+
.catch((error) => {
|
|
262
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
263
|
+
next.sendErrorToClient(clientId, `Prompt failed: ${message}`, "PROMPT_FAILED");
|
|
264
|
+
recordPromptRejected("PROMPT_FAILED", clientId, data, message);
|
|
265
|
+
});
|
|
266
|
+
});
|
|
267
|
+
return next;
|
|
268
|
+
};
|
|
269
|
+
server = await bind(options.session, options.cwd, null);
|
|
270
|
+
if (options.announce !== false) {
|
|
271
|
+
log(`\n🔗 Attachable session started: ${server.sessionId}`);
|
|
272
|
+
log(` Socket: ${server.socketPath}`);
|
|
273
|
+
log(` Attach: ${APP_NAME} --attach ${server.sessionId}\n`);
|
|
25
274
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
275
|
+
return {
|
|
276
|
+
get socketPath() {
|
|
277
|
+
return server?.socketPath ?? null;
|
|
278
|
+
},
|
|
279
|
+
get sessionId() {
|
|
280
|
+
return server?.sessionId ?? null;
|
|
281
|
+
},
|
|
282
|
+
get relay() {
|
|
283
|
+
return relay;
|
|
284
|
+
},
|
|
285
|
+
async rebind(nextSession, nextCwd) {
|
|
286
|
+
if (stopped)
|
|
287
|
+
return;
|
|
288
|
+
// Read before anything is torn down: after the swap there is nothing left that
|
|
289
|
+
// remembers which session the socket used to carry.
|
|
290
|
+
const previousSessionId = server?.sessionId ?? null;
|
|
291
|
+
try {
|
|
292
|
+
unsubscribe?.();
|
|
293
|
+
unsubscribe = null;
|
|
294
|
+
// FAIL CLOSED FIRST, while the old socket is still open. These asks gate tool calls
|
|
295
|
+
// in a session that is being replaced: nothing they authorise may proceed, the
|
|
296
|
+
// agent arm holding each one has to be released rather than left dangling, and the
|
|
297
|
+
// clients watching them have to be told — which is only possible before the server
|
|
298
|
+
// they are attached to is stopped.
|
|
299
|
+
cancelPending?.();
|
|
300
|
+
cancelPending = null;
|
|
301
|
+
relay = null;
|
|
302
|
+
const previous = server;
|
|
303
|
+
server = null;
|
|
304
|
+
if (previous) {
|
|
305
|
+
// Attached clients are watching a session that no longer exists; tell them
|
|
306
|
+
// before the socket goes away so they can re-attach to the new one.
|
|
307
|
+
previous.broadcastError(`Session replaced. Re-attach with: ${APP_NAME} --list-sessions`, "SESSION_REPLACED");
|
|
308
|
+
await previous.stop();
|
|
309
|
+
}
|
|
310
|
+
server = await bind(nextSession, nextCwd, previousSessionId);
|
|
311
|
+
}
|
|
312
|
+
catch (error) {
|
|
313
|
+
// A failed rebind must not break the session switch itself. The socket stays
|
|
314
|
+
// closed, so the session simply stops being attachable.
|
|
315
|
+
server = null;
|
|
316
|
+
relay = null;
|
|
317
|
+
cancelPending = null;
|
|
318
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
319
|
+
// A session that quietly stopped being attachable is exactly the kind of
|
|
320
|
+
// disappearance a week-long soak is run to catch, and the notice above goes
|
|
321
|
+
// to a terminal nobody will be reading in six days.
|
|
322
|
+
soak((log) => {
|
|
323
|
+
log.record(SOAK_EVENTS.SOCKET_REBIND, { outcome: "failed", previousSessionId, reason: message }, "error");
|
|
324
|
+
// The provider closes over a server that no longer exists. The heartbeat
|
|
325
|
+
// itself keeps running: fd, rss and the directory gauges stay meaningful,
|
|
326
|
+
// and a gap in them would look like the process died.
|
|
327
|
+
log.setClientCountProvider(undefined);
|
|
328
|
+
});
|
|
329
|
+
warn(`Attachable session could not follow the session switch: ${message}`);
|
|
330
|
+
}
|
|
331
|
+
},
|
|
332
|
+
async stop() {
|
|
333
|
+
if (stopped)
|
|
334
|
+
return;
|
|
335
|
+
stopped = true;
|
|
336
|
+
// Recorded on ENTRY, not after the awaits below: `SocketServer.stop()` waits on
|
|
337
|
+
// peers that may take the full close grace period, and a teardown nobody
|
|
338
|
+
// recorded because the process was killed while waiting is a teardown Phase 39
|
|
339
|
+
// reads as a session that vanished.
|
|
340
|
+
recordTeardown("stop");
|
|
341
|
+
unsubscribe?.();
|
|
342
|
+
unsubscribe = null;
|
|
343
|
+
// Before the socket goes away: an unanswered ask fails closed, is announced, and is
|
|
344
|
+
// recorded. Anything still parked on one gets its `undefined` instead of hanging.
|
|
345
|
+
cancelPending?.();
|
|
346
|
+
cancelPending = null;
|
|
347
|
+
relay = null;
|
|
348
|
+
const current = server;
|
|
349
|
+
server = null;
|
|
350
|
+
await current?.stop();
|
|
351
|
+
},
|
|
352
|
+
stopSync() {
|
|
353
|
+
if (stopped)
|
|
354
|
+
return;
|
|
355
|
+
stopped = true;
|
|
356
|
+
// Synchronous, like everything else on this path: the writer appends with
|
|
357
|
+
// `writeSync`, so this record survives `process.on("exit")` and a signal handler.
|
|
358
|
+
recordTeardown("stopSync");
|
|
359
|
+
try {
|
|
360
|
+
unsubscribe?.();
|
|
361
|
+
}
|
|
362
|
+
catch { }
|
|
363
|
+
unsubscribe = null;
|
|
364
|
+
// Synchronous by construction — settle, announce and append are all synchronous — so
|
|
365
|
+
// this works from `process.on("exit")` and from a signal handler.
|
|
366
|
+
try {
|
|
367
|
+
cancelPending?.();
|
|
368
|
+
}
|
|
369
|
+
catch { }
|
|
370
|
+
cancelPending = null;
|
|
371
|
+
relay = null;
|
|
372
|
+
const current = server;
|
|
373
|
+
server = null;
|
|
374
|
+
current?.stopSync();
|
|
375
|
+
},
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* Remove the socket on process exit and on signals.
|
|
380
|
+
*
|
|
381
|
+
* The mode run loops (interactive, print, rpc) end in `process.exit()` and never return
|
|
382
|
+
* to their caller, so a `finally` around them is not enough: without this the .sock and
|
|
383
|
+
* .lock files outlive the process and keep showing up in `--list-sessions`.
|
|
384
|
+
*
|
|
385
|
+
* @returns unregister function
|
|
386
|
+
*/
|
|
387
|
+
export function registerAttachableSessionCleanup(handle) {
|
|
388
|
+
const onExit = () => {
|
|
389
|
+
handle.stopSync();
|
|
390
|
+
};
|
|
391
|
+
process.on("exit", onExit);
|
|
392
|
+
const signals = ["SIGINT", "SIGTERM"];
|
|
393
|
+
if (process.platform !== "win32") {
|
|
394
|
+
signals.push("SIGHUP");
|
|
395
|
+
}
|
|
396
|
+
const handlers = new Map();
|
|
397
|
+
for (const signal of signals) {
|
|
398
|
+
/**
|
|
399
|
+
* Listeners that were ALREADY on this signal when the socket was registered.
|
|
400
|
+
*
|
|
401
|
+
* The guard below used to be `process.listenerCount(signal) > 1`, and under default-on
|
|
402
|
+
* that turned SIGINT into a no-op for every interactive session. Measured against the
|
|
403
|
+
* emitted binary: `proper-lockfile` pulls in `signal-exit`, which installs its own
|
|
404
|
+
* SIGINT/SIGTERM listener at import time — long before this function runs. That listener
|
|
405
|
+
* is a BOOKKEEPER, not an owner: it only acts when it is the sole listener
|
|
406
|
+
* (`listeners.length === emitter.count`) and otherwise assumes somebody else will end the
|
|
407
|
+
* process. So a plain `kill -INT` found two listeners, each of which deferred to the
|
|
408
|
+
* other, and the session survived a signal that killed it before the socket existed
|
|
409
|
+
* (control run: signal 2; default-on run: still alive at the 60 s deadline, socket and
|
|
410
|
+
* lock left on disk). Node applies the default disposition only when a signal has NO
|
|
411
|
+
* listener, so one polite listener is enough to make Ctrl+C stop working.
|
|
412
|
+
*
|
|
413
|
+
* The snapshot is the discriminator, and it is exact rather than heuristic because of
|
|
414
|
+
* WHERE this runs: `registerAttachableSessionCleanup` is called once, after the socket is
|
|
415
|
+
* bound and before any mode installs shutdown handling. Anything present at that instant
|
|
416
|
+
* came from a library that was already coping without us. Anything added AFTER is draht's
|
|
417
|
+
* own — interactive mode's graceful SIGTERM/SIGHUP shutdown, or the Ctrl+Z SIGINT guard —
|
|
418
|
+
* and those really do own the signal: the first ends in `process.exit()` (where the
|
|
419
|
+
* "exit" listener above removes the files) and the second deliberately keeps the process
|
|
420
|
+
* alive, where deleting the socket would be wrong.
|
|
421
|
+
*/
|
|
422
|
+
const preexisting = new Set(process.listeners(signal));
|
|
423
|
+
const handler = () => {
|
|
424
|
+
const owners = process.listeners(signal).filter((listener) => listener !== handler && !preexisting.has(listener));
|
|
425
|
+
if (owners.length > 0)
|
|
426
|
+
return;
|
|
427
|
+
handle.stopSync();
|
|
428
|
+
// Nobody else owns this signal: drop out of the way and re-raise it so the process
|
|
429
|
+
// still dies from the signal it was sent. The pre-existing bookkeeper now finds
|
|
430
|
+
// itself alone and does its own re-raise, which reaches the default disposition.
|
|
431
|
+
process.off(signal, handler);
|
|
432
|
+
process.kill(process.pid, signal);
|
|
433
|
+
};
|
|
434
|
+
process.on(signal, handler);
|
|
435
|
+
handlers.set(signal, handler);
|
|
436
|
+
}
|
|
437
|
+
return () => {
|
|
438
|
+
process.off("exit", onExit);
|
|
439
|
+
for (const [signal, handler] of handlers) {
|
|
440
|
+
process.off(signal, handler);
|
|
441
|
+
}
|
|
442
|
+
handlers.clear();
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Mirror session output onto the socket.
|
|
447
|
+
*
|
|
448
|
+
* @returns unsubscribe function
|
|
449
|
+
*/
|
|
450
|
+
function subscribeToSession(session, socketServer) {
|
|
451
|
+
return session.subscribe((event) => {
|
|
38
452
|
// Broadcast different event types
|
|
39
453
|
if (event.type === "message_update") {
|
|
40
454
|
// Handle streaming updates (text and thinking deltas)
|
|
@@ -61,17 +475,5 @@ export async function makeSessionAttachable(options) {
|
|
|
61
475
|
}
|
|
62
476
|
}
|
|
63
477
|
});
|
|
64
|
-
// Forward input from socket clients to session
|
|
65
|
-
socketServer.onInput((data, _clientId) => {
|
|
66
|
-
// Send message to session
|
|
67
|
-
void session.prompt(data);
|
|
68
|
-
});
|
|
69
|
-
console.log(`\n🔗 Attachable session started: ${sessionId}`);
|
|
70
|
-
console.log(` Socket: ${socketServer.socketPath}`);
|
|
71
|
-
console.log(` Attach: draht --attach ${sessionId}\n`);
|
|
72
|
-
// Return cleanup function
|
|
73
|
-
return async () => {
|
|
74
|
-
await socketServer.stop();
|
|
75
|
-
};
|
|
76
478
|
}
|
|
77
479
|
//# sourceMappingURL=session-integration.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-integration.js","sourceRoot":"","sources":["../../../src/core/socket-server/session-integration.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAOlD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,OAAiC;IAC5E,IAAI,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;QACtB,OAAO,KAAK,IAAI,EAAE,GAAE,CAAC,CAAC,CAAC,gBAAgB;IACxC,CAAC;IAED,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAChC,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAC;IAC/B,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IAEjD,iDAAiD;IACjD,MAAM,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,SAAS,EAAE,CAAC;IAClD,IAAI,CAAC,MAAM,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;IAC5E,CAAC;IACD,MAAM,SAAS,GAAG,MAAM,CAAC,EAAE,CAAC;IAE5B,MAAM,YAAY,GAAG,IAAI,YAAY,CAAC;QACrC,SAAS;QACT,SAAS;QACT,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;QAClB,UAAU,EAAE,EAAE;QACd,kBAAkB,EAAE,IAAI;KACxB,CAAC,CAAC;IAEH,sBAAsB;IACtB,MAAM,YAAY,CAAC,KAAK,EAAE,CAAC;IAE3B,kDAAkD;IAClD,OA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,CAAC;IAC3B,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,GAAG,CAAC,oCAAoC,SAAS,EAAE,CAAC,CAAC;IAC7D,OAAO,CAAC,GAAG,CAAC,cAAc,YAAY,CAAC,UAAU,EAAE,CAAC,CAAC;IACrD,OAAO,CAAC,GAAG,CAAC,6BAA6B,SAAS,IAAI,CAAC,CAAC;IAExD,0BAA0B;IAC1B,OAAO,KAAK,IAAI,EAAE;QACjB,MAAM,YAAY,CAAC,IAAI,EAAE,CAAC;IAC3B,CAAC,CAAC;AACH,CAAC","sourcesContent":["/**\n * Integration layer between AgentSession and SocketServer\n *\n * Wires up socket server to broadcast agent output and forward client input.\n */\n\nimport path from \"node:path\";\nimport { getAgentDir } from \"../../config.js\";\nimport type { AgentSession } from \"../agent-session.js\";\nimport { SocketServer } from \"./socket-server.js\";\n\nexport interface AttachableSessionOptions {\n\tsession: AgentSession;\n\tenabled: boolean;\n}\n\n/**\n * Wrap an agent session with a socket server if attachable mode is enabled.\n *\n * Returns cleanup function to stop the socket server.\n */\nexport async function makeSessionAttachable(options: AttachableSessionOptions): Promise<() => Promise<void>> {\n\tif (!options.enabled) {\n\t\treturn async () => {}; // No-op cleanup\n\t}\n\n\tconst session = options.session;\n\tconst agentDir = getAgentDir();\n\tconst socketDir = path.join(agentDir, \"sockets\");\n\n\t// Get session ID from the session manager header\n\tconst header = session.sessionManager.getHeader();\n\tif (!header) {\n\t\tthrow new Error(\"Cannot make session attachable: no session header found\");\n\t}\n\tconst sessionId = header.id;\n\n\tconst socketServer = new SocketServer({\n\t\tsessionId,\n\t\tsocketDir,\n\t\tcwd: process.cwd(),\n\t\tmaxClients: 10,\n\t\tbroadcastInputEcho: true,\n\t});\n\n\t// Start socket server\n\tawait socketServer.start();\n\n\t// Subscribe to session events to broadcast output\n\tsession.subscribe((event) => {\n\t\t// Broadcast different event types\n\t\tif (event.type === \"message_update\") {\n\t\t\t// Handle streaming updates (text and thinking deltas)\n\t\t\tconst assistantEvent = event.assistantMessageEvent;\n\t\t\tif (assistantEvent.type === \"text_delta\") {\n\t\t\t\tsocketServer.broadcastOutput(assistantEvent.delta, \"stdout\");\n\t\t\t} else if (assistantEvent.type === \"thinking_delta\") {\n\t\t\t\tsocketServer.broadcastOutput(`[Thinking] ${assistantEvent.delta}\\n`, \"stdout\");\n\t\t\t}\n\t\t} else if (event.type === \"tool_execution_start\") {\n\t\t\tsocketServer.broadcastOutput(`\\n[Tool: ${event.toolName}]\\n`, \"stdout\");\n\t\t} else if (event.type === \"tool_execution_end\") {\n\t\t\t// Broadcast tool result\n\t\t\tconst result = event.result;\n\t\t\tif (result?.content) {\n\t\t\t\tfor (const content of result.content) {\n\t\t\t\t\tif (content.type === \"text\") {\n\t\t\t\t\t\tsocketServer.broadcastOutput(`${content.text}\\n`, \"stdout\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n\n\t// Forward input from socket clients to session\n\tsocketServer.onInput((data: string, _clientId: string) => {\n\t\t// Send message to session\n\t\tvoid session.prompt(data);\n\t});\n\n\tconsole.log(`\\n🔗 Attachable session started: ${sessionId}`);\n\tconsole.log(` Socket: ${socketServer.socketPath}`);\n\tconsole.log(` Attach: draht --attach ${sessionId}\\n`);\n\n\t// Return cleanup function\n\treturn async () => {\n\t\tawait socketServer.stop();\n\t};\n}\n"]}
|
|
1
|
+
{"version":3,"file":"session-integration.js","sourceRoot":"","sources":["../../../src/core/socket-server/session-integration.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAGxD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAgB,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC5F,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAwB,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACpF,O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,IAAI,IAAI,EAAE,QAAQ,CAAC,CAAC;oBAC7D,CAAC;gBACF,CAAC;YACF,CAAC;QACF,CAAC;IACF,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Integration layer between AgentSession and SocketServer\n *\n * Wires up socket server to broadcast agent output and forward client input.\n */\n\nimport path from \"node:path\";\nimport { APP_NAME, getAgentDir } from \"../../config.js\";\nimport type { AgentSession } from \"../agent-session.js\";\nimport type { PermissionRelay } from \"../permission-relay/types.js\";\nimport { getSoakLog, SOAK_EVENTS, type SoakLog, startupDeltaMs } from \"../soak/soak-log.js\";\nimport { PermissionDelivery } from \"./permission-delivery.js\";\nimport { type PermissionEntry, PermissionRegistry } from \"./permission-registry.js\";\nimport { createSocketPermissionRelay, type SocketPermissionRelay } from \"./permission-relay.js\";\nimport { SocketServer } from \"./socket-server.js\";\n\n/**\n * SOAK RECORDING (R35-ALWAYS.11). Every seam below hands the process-wide soak log\n * one line and returns; nothing here may do anything else.\n *\n * THE THREE RULES, and they are the whole contract of this helper:\n * • NEVER stdout, NEVER stderr. The TUI owns the terminal and a default-on\n * session's streams are asserted identical to a feature-off run, so one stray\n * byte from here surfaces as somebody else's regression.\n * • NEVER throw into a caller. `SoakLog` swallows its own failures; this wrapper\n * covers the one thing it cannot, which is failing to be constructed at all.\n * • NEVER build a record any other way than `log.record()` / `log.heartbeat()`.\n * Those stamp the mandatory fields (wall, pid, rss, sessionId…) LAST, over the\n * caller's, which is what keeps a seam field innocently named `pid` — the lock\n * files carry one — from shadowing the record's own and getting the whole line\n * dropped by the reader as malformed.\n *\n * SCOPE LIMIT, stated rather than implied: this records what the SESSION PROCESS\n * observes. A tailnet drop, a daemon restart, a gateway-side refusal — none of\n * those are visible from here, and Phase 35 does not cover them. The daemon half\n * is a SEPARATE writer implementing the file-format contract documented at the top\n * of `soak/soak-log.ts`; it must not import this module or share one with it,\n * because Phase 38's boundary gate forbids a module spanning that line. The two\n * halves are joined at verdict time by `sessionId` and `wall`.\n */\nfunction soak(use: (log: SoakLog) => void): void {\n\ttry {\n\t\tuse(getSoakLog());\n\t} catch {\n\t\t// Deliberately empty, and deliberately not logged anywhere.\n\t}\n}\n\n/**\n * A prompt that arrived over the socket and did not simply run.\n *\n * The prompt TEXT is never recorded — only how long it was. This file writes into\n * a log that is kept for weeks and read by a verdict tool; \"what did the operator\n * type from their phone\" is not a question a resilience soak needs answered, and a\n * log that could answer it is one more place a secret can end up.\n */\nfunction recordPromptRejected(code: string, clientId: string, prompt: string, reason?: string): void {\n\tsoak((log) =>\n\t\tlog.record(\n\t\t\tSOAK_EVENTS.PROMPT_REJECTED,\n\t\t\t{\n\t\t\t\tcode,\n\t\t\t\tclientId,\n\t\t\t\tpromptChars: prompt.length,\n\t\t\t\t...(reason === undefined ? {} : { reason }),\n\t\t\t},\n\t\t\tcode === \"PROMPT_FAILED\" ? \"error\" : \"info\",\n\t\t),\n\t);\n}\n\nexport interface AttachableSessionOptions {\n\tsession: AgentSession;\n\tenabled: boolean;\n\t/**\n\t * Working directory of the session, recorded in the lock file so discovery can\n\t * report which project a session belongs to. This is the session's resolved cwd,\n\t * which differs from `process.cwd()` when a session from another project is\n\t * selected via --session/--resume.\n\t */\n\tcwd: string;\n\t/** Reports non-fatal problems (default: stderr). */\n\tonWarning?: (message: string) => void;\n\t/** Prints the startup banner (default: stdout). */\n\tlog?: (message: string) => void;\n\t/**\n\t * Whether to print the three-line \"Attachable session started\" banner (default: true).\n\t *\n\t * Interactive mode does NOT take over stdout (main.ts only calls `takeOverStdout()` for\n\t * non-interactive modes), so under default-on this banner would print a socket path into\n\t * every session's scrollback in the instant before the TUI claims the terminal. Measured,\n\t * it is the ENTIRE stdout delta of default-on. The implicit path passes `announce: false`;\n\t * an explicit `--attachable` keeps the banner, because someone who typed the flag is\n\t * entitled to be told the socket exists and where.\n\t */\n\tannounce?: boolean;\n}\n\n/**\n * Handle for a session exposed on a Unix socket.\n *\n * The socket is bound to one session at a time. When the runtime replaces the session\n * (/new, /resume, /fork, /import) the old session object is disposed, so the handle has\n * to follow along via {@link AttachableSession.rebind}.\n */\nexport interface AttachableSession {\n\t/** Path of the socket currently bound, or null when attachable mode is off or stopped. */\n\treadonly socketPath: string | null;\n\t/** Session id the socket currently advertises, or null when nothing is bound. */\n\treadonly sessionId: string | null;\n\t/**\n\t * The pending-ask registry's public face, or null when nothing is bound.\n\t *\n\t * Hand this to {@link AgentSession.setPermissionRelay} — and hand the CURRENT one over again\n\t * after every {@link AttachableSession.rebind}, because a rebind builds a new registry for the\n\t * new session and the old handle is dead. The relay lives here, in this closure, and NOT in the\n\t * UI decorator: a new `ExtensionRunner` (and therefore a new decorator) is built on every\n\t * extension reload, which would orphan every ask raised before it with the agent still parked\n\t * on the answer.\n\t */\n\treadonly relay: PermissionRelay | null;\n\t/** Follow a session replacement: close the old socket and bind one for the new session. */\n\trebind(session: AgentSession, cwd: string): Promise<void>;\n\t/** Close the socket and remove the .sock/.lock files. */\n\tstop(): Promise<void>;\n\t/** Same as {@link stop}, for synchronous exit paths (`process.on(\"exit\")`, signals). */\n\tstopSync(): void;\n}\n\nconst DISABLED_SESSION: AttachableSession = {\n\tsocketPath: null,\n\tsessionId: null,\n\t// No socket, so nobody can be asked anything remotely. Handing this to a session would make\n\t// `hasUI()` claim a surface that does not exist.\n\trelay: null,\n\trebind: async () => {},\n\tstop: async () => {},\n\tstopSync: () => {},\n};\n\n/**\n * Wrap an agent session with a socket server if attachable mode is enabled.\n *\n * Returns a handle that owns the socket's lifetime.\n */\nexport async function makeSessionAttachable(options: AttachableSessionOptions): Promise<AttachableSession> {\n\tif (!options.enabled) {\n\t\treturn DISABLED_SESSION;\n\t}\n\n\tconst agentDir = getAgentDir();\n\tconst socketDir = path.join(agentDir, \"sockets\");\n\tconst warn = options.onWarning ?? ((message: string) => console.error(message));\n\tconst log = options.log ?? ((message: string) => console.log(message));\n\n\tlet server: SocketServer | null = null;\n\tlet unsubscribe: (() => void) | null = null;\n\tlet stopped = false;\n\t/**\n\t * The relay for the session currently bound.\n\t *\n\t * It lives HERE, in the bind closure, for one reason each way: it must die with the session\n\t * (an ask belongs to the session that raised it and may not survive into its replacement), and\n\t * it must survive CLIENT CHURN (`#handleClientDisconnect` only removes a client, so a phone\n\t * that drops its connection mid-ask must be able to reconnect and be shown the same ask). A\n\t * relay in the UI decorator would satisfy neither: that object is rebuilt on every extension\n\t * reload.\n\t */\n\tlet relay: SocketPermissionRelay | null = null;\n\t/** Ends every pending ask fail-closed. Set alongside {@link relay}; null when nothing is bound. */\n\tlet cancelPending: (() => void) | null = null;\n\n\t/**\n\t * The last thing this handle records, from whichever exit path reached it.\n\t *\n\t * Both callers are guarded by `stopped`, so exactly one `socket_teardown` is\n\t * written per handle — which is what makes \"every bind has a teardown\" a claim a\n\t * verdict can check rather than a hope. The heartbeat is stopped here and the\n\t * client-count provider dropped with it: it closes over a server that is about to\n\t * be gone.\n\t */\n\tconst recordTeardown = (exitPath: \"stop\" | \"stopSync\"): void => {\n\t\tsoak((log) => {\n\t\t\tlog.record(SOAK_EVENTS.SOCKET_TEARDOWN, {\n\t\t\t\texitPath,\n\t\t\t\tsocketPath: server?.socketPath ?? null,\n\t\t\t\tclients: server?.clientCount ?? 0,\n\t\t\t});\n\t\t\tlog.stopHeartbeat();\n\t\t\tlog.setClientCountProvider(undefined);\n\t\t});\n\t};\n\n\t/**\n\t * `previousSessionId` is null for the FIRST bind of this process and carries the\n\t * outgoing session's id for every later one, which is the only thing that tells a\n\t * `socket_bind` from a `socket_rebind` in the log: both end with a live socket,\n\t * but only one of them means a client that was attached has been dropped.\n\t */\n\tconst bind = async (session: AgentSession, cwd: string, previousSessionId: string | null): Promise<SocketServer> => {\n\t\t// Get session ID from the session manager header\n\t\tconst header = session.sessionManager.getHeader();\n\t\tif (!header) {\n\t\t\tthrow new Error(\"Cannot make session attachable: no session header found\");\n\t\t}\n\n\t\t// Stamped BEFORE start(), so a bind that is REFUSED — the socket cap, a busy\n\t\t// twin — still records under the session it was refused for. Everything the\n\t\t// writer stamps from here on carries this id, which is what lets Phase 39 join\n\t\t// this stream against the session's own durable rows.\n\t\tsoak((log) => log.setSessionId(header.id));\n\n\t\tconst next = new SocketServer({\n\t\t\tsessionId: header.id,\n\t\t\tsocketDir,\n\t\t\tcwd,\n\t\t\tmaxClients: 10,\n\t\t\tbroadcastInputEcho: true,\n\t\t});\n\n\t\tawait next.start();\n\t\tunsubscribe = subscribeToSession(session, next);\n\n\t\tsoak((log) => {\n\t\t\t// The live client count for the heartbeat comes from the server itself, so a\n\t\t\t// gauge never disagrees with the thing it measures.\n\t\t\tlog.setClientCountProvider(() => next.clientCount);\n\t\t\tlog.record(previousSessionId === null ? SOAK_EVENTS.SOCKET_BIND : SOAK_EVENTS.SOCKET_REBIND, {\n\t\t\t\tsocketPath: next.socketPath,\n\t\t\t\tcwd,\n\t\t\t\t// R39-RESIL.6 wants the startup delta by name. It equals the `uptimeMs` the\n\t\t\t\t// writer stamps on every record; carrying it explicitly means a verdict tool\n\t\t\t\t// can ask a bind for \"how long did this session take to publish itself\" without\n\t\t\t\t// knowing that the two are the same number.\n\t\t\t\tstartupDeltaMs: startupDeltaMs(),\n\t\t\t\t...(previousSessionId === null ? {} : { previousSessionId, outcome: \"bound\" }),\n\t\t\t});\n\t\t\t// ONE heartbeat right now, before the interval's first tick. A session shorter\n\t\t\t// than the heartbeat period would otherwise contribute no gauge at all, and the\n\t\t\t// fd/socket gauges at bind are the baseline every later heartbeat is read\n\t\t\t// against. `startHeartbeat` is idempotent and its timer is unref'd, so a rebind\n\t\t\t// neither starts a second one nor keeps the process alive.\n\t\t\tlog.heartbeat();\n\t\t\tlog.startHeartbeat();\n\t\t});\n\n\t\t// ── the permission relay for THIS session ──────────────────────────────────────────────\n\t\tconst registry = new PermissionRegistry({ sessionId: header.id });\n\t\tconst delivery = new PermissionDelivery<PermissionEntry>({ pending: () => registry.pending() });\n\t\t/**\n\t\t * Whether THIS bind still owns the socket. A relay whose session was replaced or stopped\n\t\t * must write nothing: a late timer or a straggling socket callback would otherwise reach a\n\t\t * server that has already been torn down.\n\t\t */\n\t\tlet boundLive = true;\n\t\tconst bound = createSocketPermissionRelay({\n\t\t\tregistry,\n\t\t\tdelivery,\n\t\t\tserver: () => (boundLive ? next : null),\n\t\t\trecorder: () => session.sessionManager,\n\t\t\tsessionId: header.id,\n\t\t\tcwd,\n\t\t\tonWarning: warn,\n\t\t});\n\t\trelay = bound;\n\t\tcancelPending = () => {\n\t\t\t// Cancel FIRST — the announcement has to go out while the socket is still up — and only\n\t\t\t// then close the door behind it.\n\t\t\tbound.cancelAll();\n\t\t\tboundLive = false;\n\t\t};\n\n\t\t// An answer is NOT input. It must never reach the `onInput` funnel below, which hands\n\t\t// everything it receives to `session.prompt(...)` — that is exactly how a \"Yes\" tapped on\n\t\t// a phone became a queued chat message while the agent sat waiting for a decision nobody\n\t\t// could deliver.\n\t\tnext.onPermissionResponse((message, clientId) => {\n\t\t\tbound.handleResponse(message, clientId);\n\t\t});\n\t\t// Fired right after `session_metadata`, so a client that attached mid-ask is shown it on a\n\t\t// surface that already knows which session it is looking at. Replay is a SEND, not a state\n\t\t// transition: the ask stays pending until somebody actually answers it.\n\t\t//\n\t\t// NOT the `client_attach` soak seam, though it is the obvious candidate and the\n\t\t// plan named it: this callback is gated by `#mayReceivePermissionFrames`, so a\n\t\t// read-only peer, or any client built before geist/0.3 that declares no\n\t\t// capabilities, attaches WITHOUT reaching it. Recording here would have paired\n\t\t// every such client's `client_detach` — which is ungated — with no attach at all,\n\t\t// and Phase 39 counts attaches against detaches. Both records are therefore made\n\t\t// one layer down, at the connection bookkeeping in `socket-server.ts`, where the\n\t\t// two seams are symmetric by construction.\n\t\tnext.onAttachReplay((clientId) => {\n\t\t\tbound.replayTo(clientId);\n\t\t});\n\t\t// Per-connection bookkeeping only. The ask itself is untouched: a client that was shown an\n\t\t// ask and then died must not take that ask with it.\n\t\t// The matching half of the note above: `client_detach` is recorded in\n\t\t// `socket-server.ts`, not here.\n\t\tnext.onClientDisconnect((clientId) => {\n\t\t\tbound.forgetClient(clientId);\n\t\t});\n\n\t\t// Forward input from socket clients to session\n\t\tnext.onInput((data: string, clientId: string) => {\n\t\t\t// Concurrent-writer policy (R32-FLEET.7): QUEUE, and say so.\n\t\t\t//\n\t\t\t// Without a `streamingBehavior`, AgentSession.prompt() refuses outright while the\n\t\t\t// agent is mid-turn. Over a socket that refusal reached only the sender, while every\n\t\t\t// OTHER attached client had already been shown the prompt as an `input_echo` - so on\n\t\t\t// a second screen the message appeared, was never answered, and was never explained.\n\t\t\t// That is precisely the \"vanished message\" a phone must never be shown.\n\t\t\t//\n\t\t\t// `followUp` is the queueing mode chosen over `steer`: the running turn finishes\n\t\t\t// exactly as it would have (steering rewrites what the agent is currently doing,\n\t\t\t// which no remote client can see well enough to intend), the queued prompt runs next,\n\t\t\t// and its output streams to every attached client like any other turn. Order is\n\t\t\t// preserved, and nothing is dropped.\n\t\t\t//\n\t\t\t// Queuing silently would trade a vanished message for an unexplained pause, so the\n\t\t\t// client that sent it is told on the relayed error channel, under a code a renderer\n\t\t\t// can switch on rather than prose it would have to match.\n\t\t\tconst queueing = session.isStreaming;\n\t\t\t// An unhandled rejection here would take the whole agent down under Node's default\n\t\t\t// --unhandled-rejections=throw, so remote input is never left floating: genuine\n\t\t\t// failures (no model, no credentials) are reported to the client that sent them and\n\t\t\t// the session keeps running.\n\t\t\tvoid Promise.resolve()\n\t\t\t\t.then(() => session.prompt(data, { streamingBehavior: \"followUp\" }))\n\t\t\t\t.then(() => {\n\t\t\t\t\t// `queueing` is sampled before the call and confirmed after it: a prompt that\n\t\t\t\t\t// was accepted immediately must not be announced as deferred, and a turn that\n\t\t\t\t\t// ended in between needs no notice because nothing is waiting.\n\t\t\t\t\tif (!queueing || !session.isStreaming) return;\n\t\t\t\t\tnext.sendErrorToClient(\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t\t\"The agent is mid-turn. Your prompt was queued and runs when the current turn finishes.\",\n\t\t\t\t\t\t\"PROMPT_QUEUED\",\n\t\t\t\t\t);\n\t\t\t\t\t// NO `requestId` here, and that is not an omission. A prompt over the\n\t\t\t\t\t// socket is not a permission ask: it creates no `PermissionResolutionEntry`\n\t\t\t\t\t// and there is nothing on the durable side to join it to. The records that\n\t\t\t\t\t// DO carry one are the permission refusals in `socket-server.ts`.\n\t\t\t\t\trecordPromptRejected(\"PROMPT_QUEUED\", clientId, data);\n\t\t\t\t})\n\t\t\t\t.catch((error: unknown) => {\n\t\t\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\t\t\tnext.sendErrorToClient(clientId, `Prompt failed: ${message}`, \"PROMPT_FAILED\");\n\t\t\t\t\trecordPromptRejected(\"PROMPT_FAILED\", clientId, data, message);\n\t\t\t\t});\n\t\t});\n\n\t\treturn next;\n\t};\n\n\tserver = await bind(options.session, options.cwd, null);\n\n\tif (options.announce !== false) {\n\t\tlog(`\\n🔗 Attachable session started: ${server.sessionId}`);\n\t\tlog(` Socket: ${server.socketPath}`);\n\t\tlog(` Attach: ${APP_NAME} --attach ${server.sessionId}\\n`);\n\t}\n\n\treturn {\n\t\tget socketPath(): string | null {\n\t\t\treturn server?.socketPath ?? null;\n\t\t},\n\t\tget sessionId(): string | null {\n\t\t\treturn server?.sessionId ?? null;\n\t\t},\n\t\tget relay(): PermissionRelay | null {\n\t\t\treturn relay;\n\t\t},\n\n\t\tasync rebind(nextSession: AgentSession, nextCwd: string): Promise<void> {\n\t\t\tif (stopped) return;\n\t\t\t// Read before anything is torn down: after the swap there is nothing left that\n\t\t\t// remembers which session the socket used to carry.\n\t\t\tconst previousSessionId = server?.sessionId ?? null;\n\t\t\ttry {\n\t\t\t\tunsubscribe?.();\n\t\t\t\tunsubscribe = null;\n\n\t\t\t\t// FAIL CLOSED FIRST, while the old socket is still open. These asks gate tool calls\n\t\t\t\t// in a session that is being replaced: nothing they authorise may proceed, the\n\t\t\t\t// agent arm holding each one has to be released rather than left dangling, and the\n\t\t\t\t// clients watching them have to be told — which is only possible before the server\n\t\t\t\t// they are attached to is stopped.\n\t\t\t\tcancelPending?.();\n\t\t\t\tcancelPending = null;\n\t\t\t\trelay = null;\n\n\t\t\t\tconst previous = server;\n\t\t\t\tserver = null;\n\t\t\t\tif (previous) {\n\t\t\t\t\t// Attached clients are watching a session that no longer exists; tell them\n\t\t\t\t\t// before the socket goes away so they can re-attach to the new one.\n\t\t\t\t\tprevious.broadcastError(\n\t\t\t\t\t\t`Session replaced. Re-attach with: ${APP_NAME} --list-sessions`,\n\t\t\t\t\t\t\"SESSION_REPLACED\",\n\t\t\t\t\t);\n\t\t\t\t\tawait previous.stop();\n\t\t\t\t}\n\n\t\t\t\tserver = await bind(nextSession, nextCwd, previousSessionId);\n\t\t\t} catch (error) {\n\t\t\t\t// A failed rebind must not break the session switch itself. The socket stays\n\t\t\t\t// closed, so the session simply stops being attachable.\n\t\t\t\tserver = null;\n\t\t\t\trelay = null;\n\t\t\t\tcancelPending = null;\n\t\t\t\tconst message = error instanceof Error ? error.message : String(error);\n\t\t\t\t// A session that quietly stopped being attachable is exactly the kind of\n\t\t\t\t// disappearance a week-long soak is run to catch, and the notice above goes\n\t\t\t\t// to a terminal nobody will be reading in six days.\n\t\t\t\tsoak((log) => {\n\t\t\t\t\tlog.record(\n\t\t\t\t\t\tSOAK_EVENTS.SOCKET_REBIND,\n\t\t\t\t\t\t{ outcome: \"failed\", previousSessionId, reason: message },\n\t\t\t\t\t\t\"error\",\n\t\t\t\t\t);\n\t\t\t\t\t// The provider closes over a server that no longer exists. The heartbeat\n\t\t\t\t\t// itself keeps running: fd, rss and the directory gauges stay meaningful,\n\t\t\t\t\t// and a gap in them would look like the process died.\n\t\t\t\t\tlog.setClientCountProvider(undefined);\n\t\t\t\t});\n\t\t\t\twarn(`Attachable session could not follow the session switch: ${message}`);\n\t\t\t}\n\t\t},\n\n\t\tasync stop(): Promise<void> {\n\t\t\tif (stopped) return;\n\t\t\tstopped = true;\n\t\t\t// Recorded on ENTRY, not after the awaits below: `SocketServer.stop()` waits on\n\t\t\t// peers that may take the full close grace period, and a teardown nobody\n\t\t\t// recorded because the process was killed while waiting is a teardown Phase 39\n\t\t\t// reads as a session that vanished.\n\t\t\trecordTeardown(\"stop\");\n\t\t\tunsubscribe?.();\n\t\t\tunsubscribe = null;\n\t\t\t// Before the socket goes away: an unanswered ask fails closed, is announced, and is\n\t\t\t// recorded. Anything still parked on one gets its `undefined` instead of hanging.\n\t\t\tcancelPending?.();\n\t\t\tcancelPending = null;\n\t\t\trelay = null;\n\t\t\tconst current = server;\n\t\t\tserver = null;\n\t\t\tawait current?.stop();\n\t\t},\n\n\t\tstopSync(): void {\n\t\t\tif (stopped) return;\n\t\t\tstopped = true;\n\t\t\t// Synchronous, like everything else on this path: the writer appends with\n\t\t\t// `writeSync`, so this record survives `process.on(\"exit\")` and a signal handler.\n\t\t\trecordTeardown(\"stopSync\");\n\t\t\ttry {\n\t\t\t\tunsubscribe?.();\n\t\t\t} catch {}\n\t\t\tunsubscribe = null;\n\t\t\t// Synchronous by construction — settle, announce and append are all synchronous — so\n\t\t\t// this works from `process.on(\"exit\")` and from a signal handler.\n\t\t\ttry {\n\t\t\t\tcancelPending?.();\n\t\t\t} catch {}\n\t\t\tcancelPending = null;\n\t\t\trelay = null;\n\t\t\tconst current = server;\n\t\t\tserver = null;\n\t\t\tcurrent?.stopSync();\n\t\t},\n\t};\n}\n\n/**\n * Remove the socket on process exit and on signals.\n *\n * The mode run loops (interactive, print, rpc) end in `process.exit()` and never return\n * to their caller, so a `finally` around them is not enough: without this the .sock and\n * .lock files outlive the process and keep showing up in `--list-sessions`.\n *\n * @returns unregister function\n */\nexport function registerAttachableSessionCleanup(handle: Pick<AttachableSession, \"stopSync\">): () => void {\n\tconst onExit = (): void => {\n\t\thandle.stopSync();\n\t};\n\tprocess.on(\"exit\", onExit);\n\n\tconst signals: NodeJS.Signals[] = [\"SIGINT\", \"SIGTERM\"];\n\tif (process.platform !== \"win32\") {\n\t\tsignals.push(\"SIGHUP\");\n\t}\n\n\tconst handlers = new Map<NodeJS.Signals, () => void>();\n\tfor (const signal of signals) {\n\t\t/**\n\t\t * Listeners that were ALREADY on this signal when the socket was registered.\n\t\t *\n\t\t * The guard below used to be `process.listenerCount(signal) > 1`, and under default-on\n\t\t * that turned SIGINT into a no-op for every interactive session. Measured against the\n\t\t * emitted binary: `proper-lockfile` pulls in `signal-exit`, which installs its own\n\t\t * SIGINT/SIGTERM listener at import time — long before this function runs. That listener\n\t\t * is a BOOKKEEPER, not an owner: it only acts when it is the sole listener\n\t\t * (`listeners.length === emitter.count`) and otherwise assumes somebody else will end the\n\t\t * process. So a plain `kill -INT` found two listeners, each of which deferred to the\n\t\t * other, and the session survived a signal that killed it before the socket existed\n\t\t * (control run: signal 2; default-on run: still alive at the 60 s deadline, socket and\n\t\t * lock left on disk). Node applies the default disposition only when a signal has NO\n\t\t * listener, so one polite listener is enough to make Ctrl+C stop working.\n\t\t *\n\t\t * The snapshot is the discriminator, and it is exact rather than heuristic because of\n\t\t * WHERE this runs: `registerAttachableSessionCleanup` is called once, after the socket is\n\t\t * bound and before any mode installs shutdown handling. Anything present at that instant\n\t\t * came from a library that was already coping without us. Anything added AFTER is draht's\n\t\t * own — interactive mode's graceful SIGTERM/SIGHUP shutdown, or the Ctrl+Z SIGINT guard —\n\t\t * and those really do own the signal: the first ends in `process.exit()` (where the\n\t\t * \"exit\" listener above removes the files) and the second deliberately keeps the process\n\t\t * alive, where deleting the socket would be wrong.\n\t\t */\n\t\tconst preexisting = new Set<unknown>(process.listeners(signal));\n\t\tconst handler = (): void => {\n\t\t\tconst owners = (process.listeners(signal) as unknown[]).filter(\n\t\t\t\t(listener) => listener !== handler && !preexisting.has(listener),\n\t\t\t);\n\t\t\tif (owners.length > 0) return;\n\t\t\thandle.stopSync();\n\t\t\t// Nobody else owns this signal: drop out of the way and re-raise it so the process\n\t\t\t// still dies from the signal it was sent. The pre-existing bookkeeper now finds\n\t\t\t// itself alone and does its own re-raise, which reaches the default disposition.\n\t\t\tprocess.off(signal, handler);\n\t\t\tprocess.kill(process.pid, signal);\n\t\t};\n\t\tprocess.on(signal, handler);\n\t\thandlers.set(signal, handler);\n\t}\n\n\treturn () => {\n\t\tprocess.off(\"exit\", onExit);\n\t\tfor (const [signal, handler] of handlers) {\n\t\t\tprocess.off(signal, handler);\n\t\t}\n\t\thandlers.clear();\n\t};\n}\n\n/**\n * Mirror session output onto the socket.\n *\n * @returns unsubscribe function\n */\nfunction subscribeToSession(session: AgentSession, socketServer: SocketServer): () => void {\n\treturn session.subscribe((event) => {\n\t\t// Broadcast different event types\n\t\tif (event.type === \"message_update\") {\n\t\t\t// Handle streaming updates (text and thinking deltas)\n\t\t\tconst assistantEvent = event.assistantMessageEvent;\n\t\t\tif (assistantEvent.type === \"text_delta\") {\n\t\t\t\tsocketServer.broadcastOutput(assistantEvent.delta, \"stdout\");\n\t\t\t} else if (assistantEvent.type === \"thinking_delta\") {\n\t\t\t\tsocketServer.broadcastOutput(`[Thinking] ${assistantEvent.delta}\\n`, \"stdout\");\n\t\t\t}\n\t\t} else if (event.type === \"tool_execution_start\") {\n\t\t\tsocketServer.broadcastOutput(`\\n[Tool: ${event.toolName}]\\n`, \"stdout\");\n\t\t} else if (event.type === \"tool_execution_end\") {\n\t\t\t// Broadcast tool result\n\t\t\tconst result = event.result;\n\t\t\tif (result?.content) {\n\t\t\t\tfor (const content of result.content) {\n\t\t\t\t\tif (content.type === \"text\") {\n\t\t\t\t\t\tsocketServer.broadcastOutput(`${content.text}\\n`, \"stdout\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t});\n}\n"]}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Connects to a Unix domain socket, sends input, and receives output.
|
|
5
5
|
* Used when running `draht --attach <session-id>`.
|
|
6
6
|
*/
|
|
7
|
-
import type
|
|
7
|
+
import { type ClientMode, type PermissionRequestMessage, type PermissionResolvedMessage } from "./types.js";
|
|
8
8
|
export interface SocketClientOptions {
|
|
9
9
|
/** Path to the Unix socket */
|
|
10
10
|
socketPath: string;
|
|
@@ -33,6 +33,14 @@ export declare class SocketClient {
|
|
|
33
33
|
* Send input to the session.
|
|
34
34
|
*/
|
|
35
35
|
sendInput(data: string): void;
|
|
36
|
+
/**
|
|
37
|
+
* Answer a permission ask by naming one of the options it offered.
|
|
38
|
+
*
|
|
39
|
+
* The answer names an option id, never a decision: what an id means is fixed
|
|
40
|
+
* by the ask that offered it, so a client cannot approve something it was
|
|
41
|
+
* only offered the chance to deny.
|
|
42
|
+
*/
|
|
43
|
+
sendPermissionResponse(requestId: string, optionId: string): void;
|
|
36
44
|
/**
|
|
37
45
|
* Set callback for output received from session.
|
|
38
46
|
*/
|
|
@@ -55,11 +63,22 @@ export declare class SocketClient {
|
|
|
55
63
|
onInputEcho(callback: (data: string, clientId: string) => void): void;
|
|
56
64
|
/**
|
|
57
65
|
* Set callback for errors.
|
|
66
|
+
*
|
|
67
|
+
* `code` identifies the frame: the caller needs it to tell a recoverable condition
|
|
68
|
+
* (a rejected prompt, a replaced session) from a fatal one.
|
|
58
69
|
*/
|
|
59
|
-
onError(callback: (message: string) => void): void;
|
|
70
|
+
onError(callback: (message: string, code?: string) => void): void;
|
|
60
71
|
/**
|
|
61
72
|
* Set callback for disconnect.
|
|
62
73
|
*/
|
|
63
74
|
onDisconnect(callback: () => void): void;
|
|
75
|
+
/**
|
|
76
|
+
* Set callback for a permission ask raised by the session.
|
|
77
|
+
*/
|
|
78
|
+
onPermissionRequest(callback: (message: PermissionRequestMessage) => void): void;
|
|
79
|
+
/**
|
|
80
|
+
* Set callback for the outcome of a permission ask.
|
|
81
|
+
*/
|
|
82
|
+
onPermissionResolved(callback: (message: PermissionResolvedMessage) => void): void;
|
|
64
83
|
}
|
|
65
84
|
//# sourceMappingURL=socket-client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"socket-client.d.ts","sourceRoot":"","sources":["../../../src/core/socket-server/socket-client.ts"],"names":[],"mappings":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