@bastani/atomic 0.10.2 → 0.10.3-alpha.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 +44 -0
- package/dist/builtin/intercom/CHANGELOG.md +11 -0
- package/dist/builtin/intercom/broker/broker-instance.ts +2 -13
- package/dist/builtin/intercom/broker/broker.ts +158 -73
- package/dist/builtin/intercom/broker/durable-ended-queue.ts +14 -2
- package/dist/builtin/intercom/broker/host-command-environment.ts +13 -0
- package/dist/builtin/intercom/broker/hosted-session-errors.ts +1 -0
- package/dist/builtin/intercom/broker/multinode-router.ts +111 -16
- package/dist/builtin/intercom/broker/multinode-state-store.ts +50 -4
- package/dist/builtin/intercom/broker/open-broker-state.ts +5 -4
- package/dist/builtin/intercom/broker/spawn.ts +144 -25
- package/dist/builtin/intercom/broker/sql-add-column.ts +33 -0
- package/dist/builtin/intercom/broker/sql-known-session-store.ts +120 -36
- package/dist/builtin/intercom/broker/sql-outbox-store.ts +75 -13
- package/dist/builtin/intercom/broker/start-announcement.ts +55 -10
- package/dist/builtin/intercom/broker/watchdog.ts +10 -7
- package/dist/builtin/intercom/index.bundle.mjs +111 -27
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +13 -0
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/skills/skill-creator/SKILL.md +30 -52
- package/dist/builtin/subagents/skills/skill-creator/eval-viewer/generate_review.py +34 -40
- package/dist/builtin/subagents/skills/skill-creator/eval-viewer/viewer.html +2 -2
- package/dist/builtin/subagents/skills/skill-creator/scripts/atomic_cli.py +668 -0
- package/dist/builtin/subagents/skills/skill-creator/scripts/generate_report.py +3 -3
- package/dist/builtin/subagents/skills/skill-creator/scripts/improve_description.py +42 -38
- package/dist/builtin/subagents/skills/skill-creator/scripts/run_eval.py +268 -176
- package/dist/builtin/subagents/skills/skill-creator/scripts/run_loop.py +20 -11
- package/dist/builtin/subagents/skills/skill-creator/scripts/utils.py +1 -1
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +163 -97
- package/dist/builtin/web-access/CHANGELOG.md +7 -0
- package/dist/builtin/web-access/index.bundle.mjs +5 -4
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/core/agent-session-auto-compaction.d.ts +10 -1
- package/dist/core/agent-session-auto-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-auto-compaction.js +54 -2
- package/dist/core/agent-session-auto-compaction.js.map +1 -1
- package/dist/core/agent-session-compaction.d.ts +4 -0
- package/dist/core/agent-session-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-compaction.js +17 -2
- package/dist/core/agent-session-compaction.js.map +1 -1
- package/dist/core/agent-session-custom-message-commit.d.ts.map +1 -1
- package/dist/core/agent-session-custom-message-commit.js +3 -1
- package/dist/core/agent-session-custom-message-commit.js.map +1 -1
- package/dist/core/agent-session-events.d.ts +2 -0
- package/dist/core/agent-session-events.d.ts.map +1 -1
- package/dist/core/agent-session-events.js +34 -13
- package/dist/core/agent-session-events.js.map +1 -1
- package/dist/core/agent-session-export.d.ts.map +1 -1
- package/dist/core/agent-session-export.js +3 -0
- package/dist/core/agent-session-export.js.map +1 -1
- package/dist/core/agent-session-message-queue.d.ts +27 -0
- package/dist/core/agent-session-message-queue.d.ts.map +1 -1
- package/dist/core/agent-session-message-queue.js +213 -30
- package/dist/core/agent-session-message-queue.js.map +1 -1
- package/dist/core/agent-session-methods.d.ts +6 -1
- package/dist/core/agent-session-methods.d.ts.map +1 -1
- package/dist/core/agent-session-methods.js.map +1 -1
- package/dist/core/agent-session-prompt.d.ts.map +1 -1
- package/dist/core/agent-session-prompt.js +35 -3
- package/dist/core/agent-session-prompt.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +2 -2
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-state.d.ts.map +1 -1
- package/dist/core/agent-session-state.js +6 -1
- package/dist/core/agent-session-state.js.map +1 -1
- package/dist/core/agent-session-tool-hooks.d.ts.map +1 -1
- package/dist/core/agent-session-tool-hooks.js +15 -2
- package/dist/core/agent-session-tool-hooks.js.map +1 -1
- package/dist/core/agent-session-typed-queue.d.ts +14 -1
- package/dist/core/agent-session-typed-queue.d.ts.map +1 -1
- package/dist/core/agent-session-typed-queue.js +26 -1
- package/dist/core/agent-session-typed-queue.js.map +1 -1
- package/dist/core/agent-session-types.d.ts +5 -0
- package/dist/core/agent-session-types.d.ts.map +1 -1
- package/dist/core/agent-session-types.js.map +1 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +2 -1
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/async-scope.d.ts +9 -4
- package/dist/core/async-scope.d.ts.map +1 -1
- package/dist/core/async-scope.js +13 -5
- package/dist/core/async-scope.js.map +1 -1
- package/dist/core/builtin-diagnostics.js +2 -2
- package/dist/core/builtin-diagnostics.js.map +1 -1
- package/dist/core/chat-admission-order.d.ts.map +1 -1
- package/dist/core/chat-admission-order.js +2 -1
- package/dist/core/chat-admission-order.js.map +1 -1
- package/dist/core/chat-record-saves.d.ts +4 -0
- package/dist/core/chat-record-saves.d.ts.map +1 -0
- package/dist/core/chat-record-saves.js +25 -0
- package/dist/core/chat-record-saves.js.map +1 -0
- package/dist/core/command-deliveries.d.ts +62 -0
- package/dist/core/command-deliveries.d.ts.map +1 -0
- package/dist/core/command-deliveries.js +139 -0
- package/dist/core/command-deliveries.js.map +1 -0
- package/dist/core/diagnostic-writer.d.ts.map +1 -1
- package/dist/core/diagnostic-writer.js +5 -4
- package/dist/core/diagnostic-writer.js.map +1 -1
- package/dist/core/extension-startup-close.d.ts +1 -2
- package/dist/core/extension-startup-close.d.ts.map +1 -1
- package/dist/core/extension-startup-close.js +2 -2
- package/dist/core/extension-startup-close.js.map +1 -1
- package/dist/core/extensions/jiti-aliases.d.ts +11 -0
- package/dist/core/extensions/jiti-aliases.d.ts.map +1 -0
- package/dist/core/extensions/jiti-aliases.js +28 -0
- package/dist/core/extensions/jiti-aliases.js.map +1 -0
- package/dist/core/extensions/loader-api.js +3 -3
- package/dist/core/extensions/loader-api.js.map +1 -1
- package/dist/core/extensions/loader-bindings.js +2 -2
- package/dist/core/extensions/loader-bindings.js.map +1 -1
- package/dist/core/extensions/loader-rollback.d.ts +1 -2
- package/dist/core/extensions/loader-rollback.d.ts.map +1 -1
- package/dist/core/extensions/loader-rollback.js +2 -2
- package/dist/core/extensions/loader-rollback.js.map +1 -1
- package/dist/core/extensions/loader-virtual-modules.d.ts.map +1 -1
- package/dist/core/extensions/loader-virtual-modules.js +53 -9
- package/dist/core/extensions/loader-virtual-modules.js.map +1 -1
- package/dist/core/extensions/native-builtin-entries.d.ts +5 -0
- package/dist/core/extensions/native-builtin-entries.d.ts.map +1 -1
- package/dist/core/extensions/native-builtin-entries.js +8 -1
- package/dist/core/extensions/native-builtin-entries.js.map +1 -1
- package/dist/core/extensions/reloadable-scripts.d.ts +21 -2
- package/dist/core/extensions/reloadable-scripts.d.ts.map +1 -1
- package/dist/core/extensions/reloadable-scripts.js +11 -3
- package/dist/core/extensions/reloadable-scripts.js.map +1 -1
- package/dist/core/extensions/source-builtin-imports.d.ts +40 -0
- package/dist/core/extensions/source-builtin-imports.d.ts.map +1 -0
- package/dist/core/extensions/source-builtin-imports.js +142 -0
- package/dist/core/extensions/source-builtin-imports.js.map +1 -0
- package/dist/core/extensions/transform-graph.d.ts +15 -0
- package/dist/core/extensions/transform-graph.d.ts.map +1 -0
- package/dist/core/extensions/transform-graph.js +85 -0
- package/dist/core/extensions/transform-graph.js.map +1 -0
- package/dist/core/extensions/ts-source-specifiers.d.ts +2 -0
- package/dist/core/extensions/ts-source-specifiers.d.ts.map +1 -1
- package/dist/core/extensions/ts-source-specifiers.js +7 -0
- package/dist/core/extensions/ts-source-specifiers.js.map +1 -1
- package/dist/core/extensions/ts-transform-worker.d.ts +2 -0
- package/dist/core/extensions/ts-transform-worker.d.ts.map +1 -0
- package/dist/core/extensions/ts-transform-worker.js +43 -0
- package/dist/core/extensions/ts-transform-worker.js.map +1 -0
- package/dist/core/message-admission.d.ts.map +1 -1
- package/dist/core/message-admission.js +4 -4
- package/dist/core/message-admission.js.map +1 -1
- package/dist/core/messages.d.ts +5 -0
- package/dist/core/messages.d.ts.map +1 -1
- package/dist/core/messages.js +35 -0
- package/dist/core/messages.js.map +1 -1
- package/dist/core/model-fallback-failures.d.ts +1 -1
- package/dist/core/model-fallback-failures.d.ts.map +1 -1
- package/dist/core/model-fallback-failures.js +18 -1
- package/dist/core/model-fallback-failures.js.map +1 -1
- package/dist/core/process-start-token.d.ts +7 -0
- package/dist/core/process-start-token.d.ts.map +1 -1
- package/dist/core/process-start-token.js +14 -0
- package/dist/core/process-start-token.js.map +1 -1
- package/dist/core/project-trust-electorate.d.ts +24 -0
- package/dist/core/project-trust-electorate.d.ts.map +1 -0
- package/dist/core/project-trust-electorate.js +52 -0
- package/dist/core/project-trust-electorate.js.map +1 -0
- package/dist/core/project-trust-state.d.ts +15 -0
- package/dist/core/project-trust-state.d.ts.map +1 -1
- package/dist/core/project-trust-state.js +15 -0
- package/dist/core/project-trust-state.js.map +1 -1
- package/dist/core/provider-request-admission.d.ts.map +1 -1
- package/dist/core/provider-request-admission.js +2 -2
- package/dist/core/provider-request-admission.js.map +1 -1
- package/dist/core/queued-input-admission.js +2 -2
- package/dist/core/queued-input-admission.js.map +1 -1
- package/dist/core/queued-message-delivery.d.ts +2 -2
- package/dist/core/queued-message-delivery.d.ts.map +1 -1
- package/dist/core/queued-message-delivery.js +6 -3
- package/dist/core/queued-message-delivery.js.map +1 -1
- package/dist/core/resource-admission-scope.js +2 -2
- package/dist/core/resource-admission-scope.js.map +1 -1
- package/dist/core/resume/blueprint/process.d.ts +3 -4
- package/dist/core/resume/blueprint/process.d.ts.map +1 -1
- package/dist/core/resume/blueprint/process.js +33 -17
- package/dist/core/resume/blueprint/process.js.map +1 -1
- package/dist/core/resume/path-mapping.js +4 -4
- package/dist/core/resume/path-mapping.js.map +1 -1
- package/dist/core/resume/session-resume.d.ts +9 -0
- package/dist/core/resume/session-resume.d.ts.map +1 -1
- package/dist/core/resume/session-resume.js +27 -2
- package/dist/core/resume/session-resume.js.map +1 -1
- package/dist/core/resume-cache-checkpoint.d.ts +27 -1
- package/dist/core/resume-cache-checkpoint.d.ts.map +1 -1
- package/dist/core/resume-cache-checkpoint.js +45 -0
- package/dist/core/resume-cache-checkpoint.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +7 -31
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-lifecycle-scope.d.ts +1 -2
- package/dist/core/session-lifecycle-scope.d.ts.map +1 -1
- package/dist/core/session-lifecycle-scope.js +2 -2
- package/dist/core/session-lifecycle-scope.js.map +1 -1
- package/dist/core/session-lifecycle-work.js +2 -2
- package/dist/core/session-lifecycle-work.js.map +1 -1
- package/dist/core/session-manager-core.d.ts.map +1 -1
- package/dist/core/session-manager-core.js +3 -0
- package/dist/core/session-manager-core.js.map +1 -1
- package/dist/core/session-storage.d.ts +12 -0
- package/dist/core/session-storage.d.ts.map +1 -1
- package/dist/core/session-storage.js +68 -1
- package/dist/core/session-storage.js.map +1 -1
- package/dist/core/settings-lock-directory.d.ts.map +1 -1
- package/dist/core/settings-lock-directory.js +4 -3
- package/dist/core/settings-lock-directory.js.map +1 -1
- package/dist/core/settings-write-ownership.d.ts +1 -2
- package/dist/core/settings-write-ownership.d.ts.map +1 -1
- package/dist/core/settings-write-ownership.js +2 -2
- package/dist/core/settings-write-ownership.js.map +1 -1
- package/dist/core/storage/node-sqlite-thread.d.ts.map +1 -1
- package/dist/core/storage/node-sqlite-thread.js +6 -4
- package/dist/core/storage/node-sqlite-thread.js.map +1 -1
- package/dist/core/storage/node-sqlite.d.ts.map +1 -1
- package/dist/core/storage/node-sqlite.js +22 -8
- package/dist/core/storage/node-sqlite.js.map +1 -1
- package/dist/core/system-prompt.d.ts +16 -2
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +33 -6
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tasks/agent-adapter.d.ts.map +1 -1
- package/dist/core/tasks/agent-adapter.js +2 -1
- package/dist/core/tasks/agent-adapter.js.map +1 -1
- package/dist/core/tasks/completion.d.ts +3 -2
- package/dist/core/tasks/completion.d.ts.map +1 -1
- package/dist/core/tasks/completion.js.map +1 -1
- package/dist/core/tasks/execution-scope.js +2 -2
- package/dist/core/tasks/execution-scope.js.map +1 -1
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +2 -1
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/history-regex-worker.d.ts.map +1 -1
- package/dist/core/tools/history-regex-worker.js +3 -2
- package/dist/core/tools/history-regex-worker.js.map +1 -1
- package/dist/core/tools/shell-task-render.d.ts +3 -2
- package/dist/core/tools/shell-task-render.d.ts.map +1 -1
- package/dist/core/tools/shell-task-render.js +7 -5
- package/dist/core/tools/shell-task-render.js.map +1 -1
- package/dist/core/tools/shell-task-status.d.ts +6 -2
- package/dist/core/tools/shell-task-status.d.ts.map +1 -1
- package/dist/core/tools/shell-task-status.js +13 -8
- package/dist/core/tools/shell-task-status.js.map +1 -1
- package/dist/core/tools/sqlite-selector-connection.d.ts.map +1 -1
- package/dist/core/tools/sqlite-selector-connection.js +4 -3
- package/dist/core/tools/sqlite-selector-connection.js.map +1 -1
- package/dist/core/tools/windows-directory-security.d.ts.map +1 -1
- package/dist/core/tools/windows-directory-security.js +2 -1
- package/dist/core/tools/windows-directory-security.js.map +1 -1
- package/dist/core/worktree-snapshot/git.js +2 -2
- package/dist/core/worktree-snapshot/git.js.map +1 -1
- package/dist/extensions/mcp/index.d.ts +6 -1
- package/dist/extensions/mcp/index.d.ts.map +1 -1
- package/dist/extensions/mcp/index.js +150 -18
- package/dist/extensions/mcp/index.js.map +1 -1
- package/dist/extensions/mcp/tool-records.d.ts +44 -9
- package/dist/extensions/mcp/tool-records.d.ts.map +1 -1
- package/dist/extensions/mcp/tool-records.js +58 -16
- package/dist/extensions/mcp/tool-records.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/main-session.d.ts +3 -1
- package/dist/main-session.d.ts.map +1 -1
- package/dist/main-session.js +1 -0
- package/dist/main-session.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +230 -96
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/agent-view/agent-view-bridge.d.ts +5 -0
- package/dist/modes/interactive/agent-view/agent-view-bridge.d.ts.map +1 -1
- package/dist/modes/interactive/agent-view/agent-view-bridge.js.map +1 -1
- package/dist/modes/interactive/agent-view/agent-view-switcher.d.ts +5 -2
- package/dist/modes/interactive/agent-view/agent-view-switcher.d.ts.map +1 -1
- package/dist/modes/interactive/agent-view/agent-view-switcher.js +3 -3
- package/dist/modes/interactive/agent-view/agent-view-switcher.js.map +1 -1
- package/dist/modes/interactive/agent-view/contracts.d.ts +6 -0
- package/dist/modes/interactive/agent-view/contracts.d.ts.map +1 -1
- package/dist/modes/interactive/agent-view/contracts.js.map +1 -1
- package/dist/modes/interactive/agent-view/install.d.ts.map +1 -1
- package/dist/modes/interactive/agent-view/install.js +2 -1
- package/dist/modes/interactive/agent-view/install.js.map +1 -1
- package/dist/modes/interactive/agent-view/open-port.d.ts +4 -2
- package/dist/modes/interactive/agent-view/open-port.d.ts.map +1 -1
- package/dist/modes/interactive/agent-view/open-port.js +4 -3
- package/dist/modes/interactive/agent-view/open-port.js.map +1 -1
- package/dist/modes/interactive/agent-view/prompt-retarget.d.ts.map +1 -1
- package/dist/modes/interactive/agent-view/prompt-retarget.js +18 -5
- package/dist/modes/interactive/agent-view/prompt-retarget.js.map +1 -1
- package/dist/modes/interactive/agent-view/remote-port.d.ts +10 -1
- package/dist/modes/interactive/agent-view/remote-port.d.ts.map +1 -1
- package/dist/modes/interactive/agent-view/remote-port.js +36 -4
- package/dist/modes/interactive/agent-view/remote-port.js.map +1 -1
- package/dist/modes/interactive/agent-view/viewed-keys.d.ts +56 -0
- package/dist/modes/interactive/agent-view/viewed-keys.d.ts.map +1 -0
- package/dist/modes/interactive/agent-view/viewed-keys.js +63 -0
- package/dist/modes/interactive/agent-view/viewed-keys.js.map +1 -0
- package/dist/modes/interactive/agent-view/viewed-submit.d.ts +14 -4
- package/dist/modes/interactive/agent-view/viewed-submit.d.ts.map +1 -1
- package/dist/modes/interactive/agent-view/viewed-submit.js +51 -17
- package/dist/modes/interactive/agent-view/viewed-submit.js.map +1 -1
- package/dist/modes/interactive/components/agent-panel.d.ts.map +1 -1
- package/dist/modes/interactive/components/agent-panel.js +8 -21
- package/dist/modes/interactive/components/agent-panel.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-actions.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-actions.js +18 -5
- package/dist/modes/interactive/components/chat-session-host-actions.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-rendering.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-rendering.js +6 -0
- package/dist/modes/interactive/components/chat-session-host-rendering.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-state.d.ts +1 -0
- package/dist/modes/interactive/components/chat-session-host-state.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-state.js +2 -0
- package/dist/modes/interactive/components/chat-session-host-state.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-types.d.ts +5 -0
- package/dist/modes/interactive/components/chat-session-host-types.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host-types.js.map +1 -1
- package/dist/modes/interactive/components/custom-editor.d.ts +33 -2
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-editor.js +58 -2
- package/dist/modes/interactive/components/custom-editor.js.map +1 -1
- package/dist/modes/interactive/components/host-session-picker.js +2 -2
- package/dist/modes/interactive/components/host-session-picker.js.map +1 -1
- package/dist/modes/interactive/components/main-composer-keys.d.ts +16 -5
- package/dist/modes/interactive/components/main-composer-keys.d.ts.map +1 -1
- package/dist/modes/interactive/components/main-composer-keys.js +27 -8
- package/dist/modes/interactive/components/main-composer-keys.js.map +1 -1
- package/dist/modes/interactive/components/notice-line.d.ts +8 -25
- package/dist/modes/interactive/components/notice-line.d.ts.map +1 -1
- package/dist/modes/interactive/components/notice-line.js +18 -17
- package/dist/modes/interactive/components/notice-line.js.map +1 -1
- package/dist/modes/interactive/components/prompt-slot.d.ts +20 -3
- package/dist/modes/interactive/components/prompt-slot.d.ts.map +1 -1
- package/dist/modes/interactive/components/prompt-slot.js +82 -32
- package/dist/modes/interactive/components/prompt-slot.js.map +1 -1
- package/dist/modes/interactive/components/queued-messages-view.d.ts +5 -2
- package/dist/modes/interactive/components/queued-messages-view.d.ts.map +1 -1
- package/dist/modes/interactive/components/queued-messages-view.js +12 -5
- package/dist/modes/interactive/components/queued-messages-view.js.map +1 -1
- package/dist/modes/interactive/components/task-board.d.ts +5 -8
- package/dist/modes/interactive/components/task-board.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-board.js +5 -49
- package/dist/modes/interactive/components/task-board.js.map +1 -1
- package/dist/modes/interactive/components/task-completion-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-completion-message.js +9 -2
- package/dist/modes/interactive/components/task-completion-message.js.map +1 -1
- package/dist/modes/interactive/components/task-marks.d.ts +19 -0
- package/dist/modes/interactive/components/task-marks.d.ts.map +1 -0
- package/dist/modes/interactive/components/task-marks.js +25 -0
- package/dist/modes/interactive/components/task-marks.js.map +1 -0
- package/dist/modes/interactive/components/task-row.d.ts +10 -2
- package/dist/modes/interactive/components/task-row.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-row.js +39 -32
- package/dist/modes/interactive/components/task-row.js.map +1 -1
- package/dist/modes/interactive/components/task-transcript-page.d.ts +7 -0
- package/dist/modes/interactive/components/task-transcript-page.d.ts.map +1 -1
- package/dist/modes/interactive/components/task-transcript-page.js +106 -10
- package/dist/modes/interactive/components/task-transcript-page.js.map +1 -1
- package/dist/modes/interactive/components/tool-block-families.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-block-families.js +8 -9
- package/dist/modes/interactive/components/tool-block-families.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +5 -1
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/extension-command-hold.d.ts.map +1 -1
- package/dist/modes/interactive/extension-command-hold.js +5 -7
- package/dist/modes/interactive/extension-command-hold.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-dialogs.js +6 -1
- package/dist/modes/interactive/interactive-extension-dialogs.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-runtime.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-extension-runtime.js +21 -7
- package/dist/modes/interactive/interactive-extension-runtime.js.map +1 -1
- package/dist/modes/interactive/interactive-initial-session-binding.d.ts +1 -2
- package/dist/modes/interactive/interactive-initial-session-binding.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-initial-session-binding.js +2 -2
- package/dist/modes/interactive/interactive-initial-session-binding.js.map +1 -1
- package/dist/modes/interactive/interactive-input-handling.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-input-handling.js +13 -4
- package/dist/modes/interactive/interactive-input-handling.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.d.ts +2 -1
- package/dist/modes/interactive/interactive-mode-base.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.js +6 -1
- package/dist/modes/interactive/interactive-mode-base.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-helpers.d.ts +4 -2
- package/dist/modes/interactive/interactive-mode-helpers.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-helpers.js +6 -0
- package/dist/modes/interactive/interactive-mode-helpers.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.d.ts +5 -0
- package/dist/modes/interactive/interactive-mode-surface.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.js.map +1 -1
- package/dist/modes/interactive/interactive-process-lifecycle.js +96 -17
- package/dist/modes/interactive/interactive-process-lifecycle.js.map +1 -1
- package/dist/modes/interactive/interactive-queueing.d.ts +5 -0
- package/dist/modes/interactive/interactive-queueing.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-queueing.js +37 -5
- package/dist/modes/interactive/interactive-queueing.js.map +1 -1
- package/dist/modes/interactive/interactive-render-chat.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-render-chat.js +45 -4
- package/dist/modes/interactive/interactive-render-chat.js.map +1 -1
- package/dist/modes/interactive/interactive-resource-disclosure.d.ts +4 -1
- package/dist/modes/interactive/interactive-resource-disclosure.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-resource-disclosure.js +20 -1
- package/dist/modes/interactive/interactive-resource-disclosure.js.map +1 -1
- package/dist/modes/interactive/interactive-resource-rendering.js +3 -0
- package/dist/modes/interactive/interactive-resource-rendering.js.map +1 -1
- package/dist/modes/interactive/interactive-startup.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-startup.js +43 -5
- package/dist/modes/interactive/interactive-startup.js.map +1 -1
- package/dist/modes/interactive-engine/activity-watchdog.d.ts +6 -3
- package/dist/modes/interactive-engine/activity-watchdog.d.ts.map +1 -1
- package/dist/modes/interactive-engine/activity-watchdog.js +3 -2
- package/dist/modes/interactive-engine/activity-watchdog.js.map +1 -1
- package/dist/modes/interactive-engine/engine-health.d.ts +2 -0
- package/dist/modes/interactive-engine/engine-health.d.ts.map +1 -1
- package/dist/modes/interactive-engine/engine-health.js.map +1 -1
- package/dist/modes/interactive-engine/engine-quit-intent.d.ts +10 -0
- package/dist/modes/interactive-engine/engine-quit-intent.d.ts.map +1 -1
- package/dist/modes/interactive-engine/engine-quit-intent.js +33 -0
- package/dist/modes/interactive-engine/engine-quit-intent.js.map +1 -1
- package/dist/modes/interactive-engine/extension-ui-bridge.d.ts +7 -1
- package/dist/modes/interactive-engine/extension-ui-bridge.d.ts.map +1 -1
- package/dist/modes/interactive-engine/extension-ui-bridge.js +15 -2
- package/dist/modes/interactive-engine/extension-ui-bridge.js.map +1 -1
- package/dist/modes/interactive-engine/host-listener-failures.d.ts +24 -0
- package/dist/modes/interactive-engine/host-listener-failures.d.ts.map +1 -0
- package/dist/modes/interactive-engine/host-listener-failures.js +98 -0
- package/dist/modes/interactive-engine/host-listener-failures.js.map +1 -0
- package/dist/modes/interactive-engine/isolated-runtime.d.ts +16 -0
- package/dist/modes/interactive-engine/isolated-runtime.d.ts.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.js +74 -7
- package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -1
- package/dist/modes/interactive-engine/protocol.d.ts +5 -0
- package/dist/modes/interactive-engine/protocol.d.ts.map +1 -1
- package/dist/modes/interactive-engine/protocol.js +8 -2
- package/dist/modes/interactive-engine/protocol.js.map +1 -1
- package/dist/modes/interactive-engine/remote-component.d.ts +13 -0
- package/dist/modes/interactive-engine/remote-component.d.ts.map +1 -1
- package/dist/modes/interactive-engine/remote-component.js +69 -4
- package/dist/modes/interactive-engine/remote-component.js.map +1 -1
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +34 -6
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/agent-panel-bridge.d.ts +7 -0
- package/dist/modes/rpc/agent-panel-bridge.d.ts.map +1 -1
- package/dist/modes/rpc/agent-panel-bridge.js +11 -1
- package/dist/modes/rpc/agent-panel-bridge.js.map +1 -1
- package/dist/modes/rpc/agent-view-rpc-panel.d.ts.map +1 -1
- package/dist/modes/rpc/agent-view-rpc-panel.js +11 -5
- package/dist/modes/rpc/agent-view-rpc-panel.js.map +1 -1
- package/dist/modes/rpc/rpc-client-process.d.ts +8 -1
- package/dist/modes/rpc/rpc-client-process.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client-process.js +89 -65
- package/dist/modes/rpc/rpc-client-process.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +21 -0
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +77 -33
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-event-buffer.d.ts +5 -0
- package/dist/modes/rpc/rpc-event-buffer.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-event-buffer.js +8 -2
- package/dist/modes/rpc/rpc-event-buffer.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +9 -2
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/utils/shell.d.ts +5 -1
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js +14 -7
- package/dist/utils/shell.js.map +1 -1
- package/dist/utils/worker-threads.d.ts +10 -4
- package/dist/utils/worker-threads.d.ts.map +1 -1
- package/dist/utils/worker-threads.js +10 -4
- package/dist/utils/worker-threads.js.map +1 -1
- package/docs/background-tasks.md +10 -10
- package/docs/compaction.md +1 -0
- package/docs/development.md +1 -1
- package/docs/environment-variables.md +4 -0
- package/docs/extensions/api-reference.md +2 -0
- package/docs/extensions/events.md +1 -1
- package/docs/getting-started/installation.md +1 -0
- package/docs/guides/non-interactive.md +2 -0
- package/docs/guides/resume-on-any-machine.md +3 -1
- package/docs/intercom/reference.md +1 -1
- package/docs/keybindings.md +6 -5
- package/docs/libraries/ai.md +2 -1
- package/docs/mcp-servers.md +1 -1
- package/docs/sdk/reference.md +1 -1
- package/docs/sdk.md +6 -0
- package/docs/security.md +4 -2
- package/docs/settings.md +2 -1
- package/docs/storage.md +2 -0
- package/docs/subagents.md +2 -2
- package/docs/tui/reference.md +3 -1
- package/npm-shrinkwrap.json +49 -49
- package/package.json +6 -6
|
@@ -8714,11 +8714,15 @@ function parseBrokerStartAnnouncement(text, announcement) {
|
|
|
8714
8714
|
if (!text.endsWith(`
|
|
8715
8715
|
`))
|
|
8716
8716
|
return;
|
|
8717
|
-
const [token, pid, ...rest] = text.trim().split(/\s+/u);
|
|
8717
|
+
const [token, pid, started, ...rest] = text.trim().split(/\s+/u);
|
|
8718
8718
|
if (token !== announcement.token || rest.length > 0)
|
|
8719
8719
|
return;
|
|
8720
|
+
if (started !== undefined && !CREATION_TIME_PATTERN.test(started))
|
|
8721
|
+
return;
|
|
8720
8722
|
const parsed = Number(pid);
|
|
8721
|
-
|
|
8723
|
+
if (!Number.isInteger(parsed) || parsed <= 0)
|
|
8724
|
+
return;
|
|
8725
|
+
return started === undefined ? { pid: parsed } : { pid: parsed, started };
|
|
8722
8726
|
}
|
|
8723
8727
|
async function readBrokerStartAnnouncementAsync(announcement) {
|
|
8724
8728
|
let text;
|
|
@@ -8729,8 +8733,20 @@ async function readBrokerStartAnnouncementAsync(announcement) {
|
|
|
8729
8733
|
}
|
|
8730
8734
|
return parseBrokerStartAnnouncement(text, announcement);
|
|
8731
8735
|
}
|
|
8732
|
-
var BROKER_ANNOUNCE_PATH_ENV = "ATOMIC_INTERCOM_BROKER_ANNOUNCE_PATH", BROKER_ANNOUNCE_TOKEN_ENV = "ATOMIC_INTERCOM_BROKER_ANNOUNCE_TOKEN";
|
|
8733
|
-
var init_start_announcement = () => {
|
|
8736
|
+
var BROKER_ANNOUNCE_PATH_ENV = "ATOMIC_INTERCOM_BROKER_ANNOUNCE_PATH", BROKER_ANNOUNCE_TOKEN_ENV = "ATOMIC_INTERCOM_BROKER_ANNOUNCE_TOKEN", BROKER_ANNOUNCE_START_ENV = "ATOMIC_INTERCOM_BROKER_ANNOUNCE_START", CREATION_TIME_PATTERN;
|
|
8737
|
+
var init_start_announcement = __esm(() => {
|
|
8738
|
+
CREATION_TIME_PATTERN = /^[1-9]\d*$/u;
|
|
8739
|
+
});
|
|
8740
|
+
|
|
8741
|
+
// dist/builtin/intercom/broker/host-command-environment.ts
|
|
8742
|
+
function hostCommandEnvironment(env = process.env) {
|
|
8743
|
+
const result = {};
|
|
8744
|
+
for (const [key, value] of Object.entries(env)) {
|
|
8745
|
+
if (key.toLowerCase() !== "psmodulepath")
|
|
8746
|
+
result[key] = value;
|
|
8747
|
+
}
|
|
8748
|
+
return result;
|
|
8749
|
+
}
|
|
8734
8750
|
|
|
8735
8751
|
// dist/builtin/intercom/broker/control-request.ts
|
|
8736
8752
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
@@ -8865,6 +8881,7 @@ import {
|
|
|
8865
8881
|
isIntercomBrokerStopTimeoutError,
|
|
8866
8882
|
processSharedStorageSelection,
|
|
8867
8883
|
processSharedStorageSelectionAsync,
|
|
8884
|
+
readProcessCreationTime,
|
|
8868
8885
|
takeTakeoverMutex,
|
|
8869
8886
|
takeTakeoverMutexAsync
|
|
8870
8887
|
} from "@bastani/atomic";
|
|
@@ -8993,7 +9010,11 @@ function buildBrokerSpawnOptions(storage, extensionDir = EXTENSION_DIR, stderr =
|
|
|
8993
9010
|
env: createChildProcessEnvironment({
|
|
8994
9011
|
NODE_NO_WARNINGS: "1",
|
|
8995
9012
|
...storage === undefined ? {} : { [BROKER_STORAGE_ENV]: storage },
|
|
8996
|
-
...announcement === undefined ? {} : {
|
|
9013
|
+
...announcement === undefined ? {} : {
|
|
9014
|
+
[BROKER_ANNOUNCE_PATH_ENV]: announcement.path,
|
|
9015
|
+
[BROKER_ANNOUNCE_TOKEN_ENV]: announcement.token,
|
|
9016
|
+
[BROKER_ANNOUNCE_START_ENV]: "1"
|
|
9017
|
+
}
|
|
8997
9018
|
}),
|
|
8998
9019
|
windowsHide: true
|
|
8999
9020
|
};
|
|
@@ -9169,21 +9190,26 @@ ${log}`)));
|
|
|
9169
9190
|
};
|
|
9170
9191
|
child.once("error", onError);
|
|
9171
9192
|
child.once("exit", onExit);
|
|
9172
|
-
waitForBroker(readyTimeoutMs, announcement === undefined ? undefined : () => readBrokerStartAnnouncementAsync(announcement), cancelSignal).then(() => {
|
|
9193
|
+
waitForBroker(readyTimeoutMs, announcement === undefined ? undefined : async () => (await readBrokerStartAnnouncementAsync(announcement))?.pid, cancelSignal).then(() => {
|
|
9173
9194
|
cleanup();
|
|
9174
9195
|
resolve();
|
|
9175
9196
|
}, async (error) => {
|
|
9176
9197
|
cleanup();
|
|
9177
9198
|
const starting = launch.kind === "direct" && child.exitCode === null && child.signalCode === null;
|
|
9178
|
-
let
|
|
9199
|
+
let abandoned;
|
|
9179
9200
|
if (signal?.aborted) {
|
|
9180
|
-
if (launch.kind === "direct")
|
|
9181
|
-
|
|
9182
|
-
|
|
9183
|
-
|
|
9201
|
+
if (launch.kind === "direct") {
|
|
9202
|
+
if (starting && child.pid !== undefined)
|
|
9203
|
+
abandoned = { kind: "group", pid: child.pid };
|
|
9204
|
+
} else if (announcement !== undefined) {
|
|
9205
|
+
const announced = await readBrokerStartAnnouncementAsync(announcement);
|
|
9206
|
+
if (announced?.started !== undefined) {
|
|
9207
|
+
abandoned = { kind: "announced", pid: announced.pid, started: announced.started };
|
|
9208
|
+
}
|
|
9209
|
+
}
|
|
9184
9210
|
}
|
|
9185
|
-
if (
|
|
9186
|
-
stopStartingBroker(
|
|
9211
|
+
if (abandoned !== undefined) {
|
|
9212
|
+
stopStartingBroker(abandoned).finally(() => reject(toError3(error)));
|
|
9187
9213
|
return;
|
|
9188
9214
|
}
|
|
9189
9215
|
keepLock = starting && await handSpawnLockToBrokerAsync(child.pid, lockOwner);
|
|
@@ -9200,24 +9226,82 @@ ${log}`)));
|
|
|
9200
9226
|
await releaseSpawnLockAsync(lockOwner);
|
|
9201
9227
|
}
|
|
9202
9228
|
}
|
|
9203
|
-
|
|
9204
|
-
|
|
9205
|
-
|
|
9206
|
-
|
|
9207
|
-
|
|
9208
|
-
|
|
9209
|
-
|
|
9210
|
-
|
|
9211
|
-
|
|
9212
|
-
|
|
9229
|
+
function stopAnnouncedBrokerScript(pid, started, waitMs) {
|
|
9230
|
+
return `$ErrorActionPreference = 'Stop'
|
|
9231
|
+
function Hold([int]$id) {
|
|
9232
|
+
try { $p = [System.Diagnostics.Process]::GetProcessById($id); $null = $p.Handle; $p } catch { $null }
|
|
9233
|
+
}
|
|
9234
|
+
function Created($p) {
|
|
9235
|
+
try { $p.StartTime.ToFileTimeUtc() } catch { $null }
|
|
9236
|
+
}
|
|
9237
|
+
function Micros([datetime]$time) { $time.ToUniversalTime().ToString('yyyyMMddHHmmssffffff') }
|
|
9238
|
+
$broker = Hold ${pid}
|
|
9239
|
+
if ($null -eq $broker) { exit 3 }
|
|
9240
|
+
$brokerCreated = Created $broker
|
|
9241
|
+
if ($null -eq $brokerCreated -or $brokerCreated -ne [long]'${started}') { exit 3 }
|
|
9242
|
+
$held = New-Object System.Collections.ArrayList
|
|
9243
|
+
[void]$held.Add($broker)
|
|
9244
|
+
$ids = New-Object 'System.Collections.Generic.HashSet[int]'
|
|
9245
|
+
[void]$ids.Add($broker.Id)
|
|
9246
|
+
$snapshot = @()
|
|
9247
|
+
try { $snapshot = @(Get-CimInstance -ClassName Win32_Process -Property ProcessId, ParentProcessId, CreationDate) } catch { }
|
|
9248
|
+
$level = @(, @($broker, $brokerCreated))
|
|
9249
|
+
while ($level.Count -gt 0) {
|
|
9250
|
+
$next = @()
|
|
9251
|
+
foreach ($parent in $level) {
|
|
9252
|
+
foreach ($entry in $snapshot) {
|
|
9253
|
+
if ($entry.ParentProcessId -ne $parent[0].Id -or $ids.Contains([int]$entry.ProcessId) -or $null -eq $entry.CreationDate) { continue }
|
|
9254
|
+
$child = Hold $entry.ProcessId
|
|
9255
|
+
if ($null -eq $child) { continue }
|
|
9256
|
+
$created = Created $child
|
|
9257
|
+
if ($null -eq $created -or $created -lt $parent[1]) { continue }
|
|
9258
|
+
if ((Micros $child.StartTime) -ne (Micros $entry.CreationDate)) { continue }
|
|
9259
|
+
[void]$held.Add($child)
|
|
9260
|
+
[void]$ids.Add($child.Id)
|
|
9261
|
+
$next += , @($child, $created)
|
|
9262
|
+
}
|
|
9263
|
+
}
|
|
9264
|
+
$level = $next
|
|
9265
|
+
}
|
|
9266
|
+
foreach ($p in $held) { try { $p.Kill() } catch { } }
|
|
9267
|
+
if ($broker.WaitForExit(${waitMs})) { exit 0 } else { exit 4 }
|
|
9268
|
+
`;
|
|
9269
|
+
}
|
|
9270
|
+
async function stopAnnouncedBroker(pid, started) {
|
|
9271
|
+
const entered = performance.now();
|
|
9272
|
+
const bound = ANNOUNCED_BROKER_STOP_START_MS + STARTING_BROKER_KILL_WAIT_MS + ANNOUNCED_BROKER_STOP_MARGIN_MS;
|
|
9273
|
+
if (await readProcessCreationTime(pid) !== started)
|
|
9213
9274
|
return;
|
|
9214
|
-
|
|
9275
|
+
if (performance.now() - entered >= ANNOUNCED_BROKER_STOP_START_MS)
|
|
9276
|
+
return;
|
|
9277
|
+
const systemRoot = process.env.SystemRoot || process.env.windir || "C:\\Windows";
|
|
9278
|
+
await new Promise((resolve) => {
|
|
9279
|
+
const powershell = spawn(join4(systemRoot, "System32", "WindowsPowerShell", "v1.0", "powershell.exe"), [
|
|
9280
|
+
"-NoProfile",
|
|
9281
|
+
"-NonInteractive",
|
|
9282
|
+
"-EncodedCommand",
|
|
9283
|
+
Buffer.from(stopAnnouncedBrokerScript(pid, started, STARTING_BROKER_KILL_WAIT_MS), "utf16le").toString("base64")
|
|
9284
|
+
], { cwd: systemRoot, env: hostCommandEnvironment(), stdio: "ignore", windowsHide: true });
|
|
9285
|
+
powershell.unref();
|
|
9286
|
+
const done = () => {
|
|
9287
|
+
clearTimeout(timer);
|
|
9288
|
+
resolve();
|
|
9289
|
+
};
|
|
9290
|
+
const timer = setTimeout(done, bound - (performance.now() - entered));
|
|
9291
|
+
powershell.once("error", done);
|
|
9292
|
+
powershell.once("exit", done);
|
|
9293
|
+
});
|
|
9294
|
+
}
|
|
9295
|
+
async function stopStartingBroker(broker) {
|
|
9296
|
+
if (broker.kind === "announced")
|
|
9297
|
+
return stopAnnouncedBroker(broker.pid, broker.started);
|
|
9298
|
+
const deadline = Date.now() + STARTING_BROKER_KILL_WAIT_MS;
|
|
9215
9299
|
try {
|
|
9216
|
-
process.kill(-pid, "SIGKILL");
|
|
9300
|
+
process.kill(-broker.pid, "SIGKILL");
|
|
9217
9301
|
} catch {
|
|
9218
9302
|
return;
|
|
9219
9303
|
}
|
|
9220
|
-
while (isProcessAlive3(-pid) && Date.now() < deadline)
|
|
9304
|
+
while (isProcessAlive3(-broker.pid) && Date.now() < deadline)
|
|
9221
9305
|
await sleep2(STARTING_BROKER_KILL_POLL_MS);
|
|
9222
9306
|
}
|
|
9223
9307
|
async function upgradeBroker(brokerCommand, brokerArgs, readyTimeoutMs = BROKER_READY_TIMEOUT_MS, extensionDir = EXTENSION_DIR, own = BROKER_PROTOCOL, stopTimeoutMs = BROKER_UPGRADE_STOP_TIMEOUT_MS, signal) {
|
|
@@ -9499,7 +9583,7 @@ async function brokerStartTimeoutError(timeoutMs) {
|
|
|
9499
9583
|
` + "The broker did not answer on its socket in time; it may still be starting, which a busy machine or an empty jiti " + "cache slows. Try again, or raise `brokerStartupTimeoutMs` in the Intercom config.json (default " + `${BROKER_READY_TIMEOUT_MS} ms).
|
|
9500
9584
|
${await describeBrokerLogAsync()}`);
|
|
9501
9585
|
}
|
|
9502
|
-
var EXTENSION_DIR, BROKER_LOG_TAIL_BYTES, BROKER_POLL_INITIAL_INTERVAL_MS = 10, BROKER_POLL_MAX_INTERVAL_MS = 100, BROKER_SPAWN_LOCK_MAX_AGE_MS = 60000, INTERNAL_INTERCOM_BROKER_ARG = "--atomic-internal-intercom-broker", BROKER_LOG_RELEASE_WAIT_MS = 1000, STARTING_BROKER_KILL_WAIT_MS = 5000, STARTING_BROKER_KILL_POLL_MS = 10, UPGRADE_LOCK_POLL_MS = 50, SPAWN_LOCK_MUTEX_WAIT_MS = 2000, SPAWN_LOCK_RENEW_AFTER_MS = 1e4, OWNERSHIP_READ_RETRY_BUDGET_MS = 2000, OWNERSHIP_READ_BACKOFF_START_MS = 10, OWNERSHIP_READ_BACKOFF_MAX_MS = 100, TRANSIENT_OWNERSHIP_READ_CODES, ownershipReadSleeper, warnedUnknownHolder;
|
|
9586
|
+
var EXTENSION_DIR, BROKER_LOG_TAIL_BYTES, BROKER_POLL_INITIAL_INTERVAL_MS = 10, BROKER_POLL_MAX_INTERVAL_MS = 100, BROKER_SPAWN_LOCK_MAX_AGE_MS = 60000, INTERNAL_INTERCOM_BROKER_ARG = "--atomic-internal-intercom-broker", BROKER_LOG_RELEASE_WAIT_MS = 1000, STARTING_BROKER_KILL_WAIT_MS = 5000, STARTING_BROKER_KILL_POLL_MS = 10, ANNOUNCED_BROKER_STOP_START_MS = 5000, ANNOUNCED_BROKER_STOP_MARGIN_MS = 1000, UPGRADE_LOCK_POLL_MS = 50, SPAWN_LOCK_MUTEX_WAIT_MS = 2000, SPAWN_LOCK_RENEW_AFTER_MS = 1e4, OWNERSHIP_READ_RETRY_BUDGET_MS = 2000, OWNERSHIP_READ_BACKOFF_START_MS = 10, OWNERSHIP_READ_BACKOFF_MAX_MS = 100, TRANSIENT_OWNERSHIP_READ_CODES, ownershipReadSleeper, warnedUnknownHolder;
|
|
9503
9587
|
var init_spawn = __esm(() => {
|
|
9504
9588
|
init_socket_liveness();
|
|
9505
9589
|
init_rename_retry();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bastani/intercom",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.3-alpha.1",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "Atomic extension providing a private coordination channel between parent and child agent sessions. Fork of: https://github.com/nicobailon/pi-intercom",
|
|
6
6
|
"contributors": [
|
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [0.10.3-alpha.1] - 2026-11-21
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- `skill-creator`'s description optimization runs Atomic: `run_eval.py`, `run_loop.py` and `improve_description.py` start `atomic -p` with your Atomic models and credentials, and never start `claude`. Each trigger query loads the candidate description as a temporary skill, with only the read tool and no extensions or MCP servers, so the model has no tool that runs commands or edits files, and nothing is written into your project. A query counts as triggered when the model's first tool call reads that skill's `SKILL.md`. `--model` takes an Atomic model pattern such as `provider/id` ([#5625](https://github.com/bastani-inc/atomic/issues/5625)).
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- Stopping `skill-creator`'s description scripts with Ctrl+C, `kill` or by closing the terminal (on Windows Ctrl+C, Ctrl+Break or closing the console) stops every evaluation process (each `atomic` they started and whatever that started), removes their temporary files and exits with that signal's status; the report left open in your browser is not touched. Ctrl+Z, `fg` and `bg` pause and continue the evaluation together with the script. Importing the scripts leaves your signal handlers alone, and `scripts.atomic_cli.cancel()` stops an evaluation in progress. Queries now run on Windows, and the review viewer picks a free port instead of stopping the program that listens on port 3117 ([#5625](https://github.com/bastani-inc/atomic/issues/5625)).
|
|
14
|
+
- Subagent result rows, status lists, launch cards and `pause`, `quit` and `resume` results use the agent panel's marks: a running subagent shows a still grey `◯` instead of `∀` or a pulsing dot, a finished one a green `●`, and an interrupted, killed, paused or quit one a red `◯`. A subagent waiting for an answer shows `◆` and one paused with Esc `‖`. A foreground subagent that continued on its own reads `Continued` with the running mark instead of `Stopped` ([#6122](https://github.com/bastani-inc/atomic/issues/6122)).
|
|
15
|
+
- A subagent woken while it waited no longer gets "You were released while you waited…" queued behind the turn it continues, nor a request just to read it: the results that wake it continue its turn, and messages sent to it arrive as their own. It is prompted with that text only when nothing else starts its turn.
|
|
16
|
+
- A subagent woken while it waited keeps its original task as its label in heartbeats, completion notices, `/tasks` and the agent panel, instead of showing the wake prompt. A subagent you resume with a message still shows that message.
|
|
17
|
+
|
|
5
18
|
## [0.10.2] - 2026-11-20
|
|
6
19
|
|
|
7
20
|
### Breaking Changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bastani/subagents",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.3-alpha.1",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "Atomic extension for delegating tasks to subagents with parallel execution. Fork of: https://github.com/nicobailon/pi-subagents",
|
|
6
6
|
"contributors": [
|
|
@@ -17,7 +17,7 @@ At a high level, the process of creating a skill goes like this:
|
|
|
17
17
|
|
|
18
18
|
- Decide what you want the skill to do and roughly how it should do it
|
|
19
19
|
- Write a draft of the skill
|
|
20
|
-
- Create a few test prompts and run
|
|
20
|
+
- Create a few test prompts and run an agent with access to the skill on them
|
|
21
21
|
- Help the user evaluate the results both qualitatively and quantitatively
|
|
22
22
|
- While the runs happen in the background, draft some quantitative evals if there aren't any (if there are some, you can either use as is or modify if you feel something needs to change about them). Then explain them to the user (or if they already existed, explain the ones that already exist)
|
|
23
23
|
- Use the `eval-viewer/generate_review.py` script to show the user the results for them to look at, and also let them look at the quantitative metrics
|
|
@@ -37,7 +37,7 @@ Cool? Cool.
|
|
|
37
37
|
|
|
38
38
|
## Communicating with the user
|
|
39
39
|
|
|
40
|
-
The skill creator is liable to be used by people across a wide range of familiarity with coding jargon. If you haven't heard (and how could you, it's only very recently that it started), there's a trend now where the power of
|
|
40
|
+
The skill creator is liable to be used by people across a wide range of familiarity with coding jargon. If you haven't heard (and how could you, it's only very recently that it started), there's a trend now where the power of coding agents is inspiring plumbers to open up their terminals, parents and grandparents to google "how to install npm". On the other hand, the bulk of users are probably fairly computer-literate.
|
|
41
41
|
|
|
42
42
|
So please pay attention to context cues to understand how to phrase your communication! In the default case, just to give you some idea:
|
|
43
43
|
|
|
@@ -54,7 +54,7 @@ It's OK to briefly explain terms if you're in doubt, and feel free to clarify te
|
|
|
54
54
|
|
|
55
55
|
Start by understanding the user's intent. The current conversation might already contain a workflow the user wants to capture (e.g., they say "turn this into a skill"). If so, extract answers from the conversation history first — the tools used, the sequence of steps, corrections the user made, input/output formats observed. The user may need to fill the gaps, and should confirm before proceeding to the next step.
|
|
56
56
|
|
|
57
|
-
1. What should this skill enable
|
|
57
|
+
1. What should this skill enable the agent to do?
|
|
58
58
|
2. When should this skill trigger? (what user phrases/contexts)
|
|
59
59
|
3. What's the expected output format?
|
|
60
60
|
4. Should we set up test cases to verify the skill works? Skills with objectively verifiable outputs (file transforms, data extraction, code generation, fixed workflow steps) benefit from test cases. Skills with subjective outputs (writing style, art) often don't need them. Suggest the appropriate default based on the skill type, but let the user decide.
|
|
@@ -70,7 +70,7 @@ Check available MCPs - if useful for research (searching docs, finding similar s
|
|
|
70
70
|
Based on the user interview, fill in these components:
|
|
71
71
|
|
|
72
72
|
- **name**: Skill identifier
|
|
73
|
-
- **description**: When to trigger, what it does. This is the primary triggering mechanism - include both what the skill does AND specific contexts for when to use it. All "when to use" info goes here, not in the body. Note: currently
|
|
73
|
+
- **description**: When to trigger, what it does. This is the primary triggering mechanism - include both what the skill does AND specific contexts for when to use it. All "when to use" info goes here, not in the body. Note: models currently tend to "undertrigger" skills -- to not use them when they'd be useful. To combat this, please make the skill descriptions a little bit "pushy". So for instance, instead of "How to build a simple fast dashboard to display internal sales data.", you might write "How to build a simple fast dashboard to display internal sales data. Make sure to use this skill whenever the user mentions dashboards, data visualization, internal metrics, or wants to display any kind of company data, even if they don't explicitly ask for a 'dashboard.'"
|
|
74
74
|
- **compatibility**: Required tools, dependencies (optional, rarely needed)
|
|
75
75
|
- **the rest of the skill :)**
|
|
76
76
|
|
|
@@ -112,7 +112,7 @@ cloud-deploy/
|
|
|
112
112
|
├── gcp.md
|
|
113
113
|
└── azure.md
|
|
114
114
|
```
|
|
115
|
-
|
|
115
|
+
The agent reads only the relevant reference file.
|
|
116
116
|
|
|
117
117
|
#### Principle of Lack of Surprise
|
|
118
118
|
|
|
@@ -212,7 +212,7 @@ Update the `eval_metadata.json` files and `evals/evals.json` with the assertions
|
|
|
212
212
|
|
|
213
213
|
### Step 3: As runs complete, capture timing data
|
|
214
214
|
|
|
215
|
-
When each subagent
|
|
215
|
+
When each subagent run completes, its result reports its token usage and how long it took. Save this data immediately to `timing.json` in the run directory:
|
|
216
216
|
|
|
217
217
|
```json
|
|
218
218
|
{
|
|
@@ -222,7 +222,7 @@ When each subagent task completes, you receive a notification containing `total_
|
|
|
222
222
|
}
|
|
223
223
|
```
|
|
224
224
|
|
|
225
|
-
|
|
225
|
+
Capture it as each run completes rather than trying to collect it all at the end.
|
|
226
226
|
|
|
227
227
|
### Step 4: Grade, aggregate, and launch the viewer
|
|
228
228
|
|
|
@@ -250,7 +250,9 @@ Put each with_skill version before its baseline counterpart.
|
|
|
250
250
|
```
|
|
251
251
|
For iteration 2+, also pass `--previous-workspace <workspace>/iteration-<N-1>`.
|
|
252
252
|
|
|
253
|
-
|
|
253
|
+
The viewer serves on port 3117, or on a free port when another program uses 3117; open the URL it prints.
|
|
254
|
+
|
|
255
|
+
**Headless environments:** If `webbrowser.open()` is not available or the environment has no display (for example on a remote server), use `--static <output_path>` to write a standalone HTML file instead of starting a server. Feedback will be downloaded as a `feedback.json` file when the user clicks "Submit All Reviews". After download, copy `feedback.json` into the workspace directory for the next iteration to pick up.
|
|
254
256
|
|
|
255
257
|
Note: please use generate_review.py to create the viewer; there's no need to write custom HTML.
|
|
256
258
|
|
|
@@ -338,7 +340,7 @@ This is optional, requires subagents, and most users won't need it. The human re
|
|
|
338
340
|
|
|
339
341
|
## Description Optimization
|
|
340
342
|
|
|
341
|
-
The description field in SKILL.md frontmatter is the primary mechanism that determines whether
|
|
343
|
+
The description field in SKILL.md frontmatter is the primary mechanism that determines whether the model uses a skill. After creating or improving a skill, offer to optimize the description for better triggering accuracy.
|
|
342
344
|
|
|
343
345
|
### Step 1: Generate trigger eval queries
|
|
344
346
|
|
|
@@ -351,7 +353,7 @@ Create 20 eval queries — a mix of should-trigger and should-not-trigger. Save
|
|
|
351
353
|
]
|
|
352
354
|
```
|
|
353
355
|
|
|
354
|
-
The queries must be realistic and something
|
|
356
|
+
The queries must be realistic and something an Atomic user would actually type. Not abstract requests, but requests that are concrete and specific and have a good amount of detail. For instance, file paths, personal context about the user's job or situation, column names and values, company names, URLs. A little bit of backstory. Some might be in lowercase or contain abbreviations or typos or casual speech. Use a mix of different lengths, and focus on edge cases rather than making them clear-cut (the user will get a chance to sign off on them).
|
|
355
357
|
|
|
356
358
|
Bad: `"Format this data"`, `"Extract text from PDF"`, `"Create a chart"`
|
|
357
359
|
|
|
@@ -382,28 +384,30 @@ This step matters — bad eval queries lead to bad descriptions.
|
|
|
382
384
|
|
|
383
385
|
Tell the user: "This will take some time — I'll run the optimization loop in the background and check on it periodically."
|
|
384
386
|
|
|
385
|
-
Save the eval set to the workspace, then run in the background:
|
|
387
|
+
Save the eval set to the workspace, then run this in the background from the user's project directory (the queries run there, as a session started in that project would). Run the script by its path, not with `python -m`, so a `scripts` package of the user's project cannot stand in for the skill-creator's:
|
|
386
388
|
|
|
387
389
|
```bash
|
|
388
|
-
python -
|
|
390
|
+
PYTHONPATH=<skill-creator-path> python <skill-creator-path>/scripts/run_loop.py \
|
|
389
391
|
--eval-set <path-to-trigger-eval.json> \
|
|
390
392
|
--skill-path <path-to-skill> \
|
|
391
|
-
--model
|
|
393
|
+
--model "$ATOMIC_PROVIDER/$ATOMIC_MODEL" \
|
|
392
394
|
--max-iterations 5 \
|
|
393
395
|
--verbose
|
|
394
396
|
```
|
|
395
397
|
|
|
396
|
-
|
|
398
|
+
`--model` takes an Atomic model pattern (`provider/id`, optionally with `:<thinking>`). Atomic's bash tool sets `ATOMIC_PROVIDER` and `ATOMIC_MODEL` to the current session's model; use it so the triggering test matches what the user actually experiences.
|
|
397
399
|
|
|
398
400
|
While it runs, periodically tail the output to give the user updates on which iteration it's on and what the scores look like.
|
|
399
401
|
|
|
400
|
-
This handles the full optimization loop automatically. It splits the eval set into 60% train and 40% held-out test, evaluates the current description (running each query 3 times to get a reliable trigger rate), then
|
|
402
|
+
This handles the full optimization loop automatically. It splits the eval set into 60% train and 40% held-out test, evaluates the current description (running each query 3 times to get a reliable trigger rate), then asks the model to propose improvements based on what failed. It re-evaluates each new description on both train and test, iterating up to 5 times. When it's done, it opens an HTML report in the browser showing the results per iteration and returns JSON with `best_description` — selected by test score rather than train score to avoid overfitting.
|
|
403
|
+
|
|
404
|
+
Each query runs `atomic -p` with the candidate description loaded as a temporary skill. The query's Atomic has only the read tool and loads no extensions or MCP servers, so the model has no tool that runs commands or edits files, and nothing is written into the project. A query counts as triggered when the model's first tool call reads that skill's `SKILL.md`. The improvement step runs `atomic -p` without tools. Stopping the script (Ctrl+C, `kill`, or closing the terminal) stops every evaluation process (each `atomic` it started and whatever that started), removes its temporary files and exits with the status of that signal; Ctrl+Z pauses them with the script. The report it opened in the browser stays open; pass `--report none` to skip opening it.
|
|
401
405
|
|
|
402
406
|
### How skill triggering works
|
|
403
407
|
|
|
404
|
-
Understanding the triggering mechanism helps design better eval queries. Skills appear in
|
|
408
|
+
Understanding the triggering mechanism helps design better eval queries. Skills appear in the model's available skills list with their name, description and location, and the model decides whether to read a skill's `SKILL.md` based on that description. The important thing to know is that the model only consults skills for tasks it can't easily handle on its own — simple, one-step queries like "read this PDF" may not trigger a skill even if the description matches perfectly, because the model can handle them directly with basic tools. Complex, multi-step, or specialized queries reliably trigger skills when the description matches.
|
|
405
409
|
|
|
406
|
-
This means your eval queries should be substantive enough that
|
|
410
|
+
This means your eval queries should be substantive enough that the model would actually benefit from consulting a skill. Simple queries like "read file X" are poor test cases — they won't trigger skills regardless of description quality.
|
|
407
411
|
|
|
408
412
|
### Step 4: Apply the result
|
|
409
413
|
|
|
@@ -411,54 +415,28 @@ Take `best_description` from the JSON output and update the skill's SKILL.md fro
|
|
|
411
415
|
|
|
412
416
|
---
|
|
413
417
|
|
|
414
|
-
### Package
|
|
418
|
+
### Package (optional)
|
|
415
419
|
|
|
416
|
-
|
|
420
|
+
If the user wants a file to share or install elsewhere, package the skill:
|
|
417
421
|
|
|
418
422
|
```bash
|
|
419
423
|
python -m scripts.package_skill <path/to/skill-folder>
|
|
420
424
|
```
|
|
421
425
|
|
|
422
|
-
|
|
426
|
+
Then tell the user where the resulting `.skill` file is.
|
|
423
427
|
|
|
424
428
|
---
|
|
425
429
|
|
|
426
|
-
##
|
|
427
|
-
|
|
428
|
-
In Claude.ai, the core workflow is the same (draft → test → review → improve → repeat), but because Claude.ai doesn't have subagents, some mechanics change. Here's what to adapt:
|
|
429
|
-
|
|
430
|
-
**Running test cases**: No subagents means no parallel execution. For each test case, read the skill's SKILL.md, then follow its instructions to accomplish the test prompt yourself. Do them one at a time. This is less rigorous than independent subagents (you wrote the skill and you're also running it, so you have full context), but it's a useful sanity check — and the human review step compensates. Skip the baseline runs — just use the skill to complete the task as requested.
|
|
431
|
-
|
|
432
|
-
**Reviewing results**: If you can't open a browser (e.g., Claude.ai's VM has no display, or you're on a remote server), skip the browser reviewer entirely. Instead, present results directly in the conversation. For each test case, show the prompt and the output. If the output is a file the user needs to see (like a .docx or .xlsx), save it to the filesystem and tell them where it is so they can download and inspect it. Ask for feedback inline: "How does this look? Anything you'd change?"
|
|
433
|
-
|
|
434
|
-
**Benchmarking**: Skip the quantitative benchmarking — it relies on baseline comparisons which aren't meaningful without subagents. Focus on qualitative feedback from the user.
|
|
435
|
-
|
|
436
|
-
**The iteration loop**: Same as before — improve the skill, rerun the test cases, ask for feedback — just without the browser reviewer in the middle. You can still organize results into iteration directories on the filesystem if you have one.
|
|
430
|
+
## Updating an existing skill
|
|
437
431
|
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
**Blind comparison**: Requires subagents. Skip it.
|
|
441
|
-
|
|
442
|
-
**Packaging**: The `package_skill.py` script works anywhere with Python and a filesystem. On Claude.ai, you can run it and the user can download the resulting `.skill` file.
|
|
443
|
-
|
|
444
|
-
**Updating an existing skill**: The user might be asking you to update an existing skill, not create a new one. In this case:
|
|
432
|
+
The user might be asking you to update an existing skill, not create a new one. In this case:
|
|
445
433
|
- **Preserve the original name.** Note the skill's directory name and `name` frontmatter field -- use them unchanged. E.g., if the installed skill is `research-helper`, output `research-helper.skill` (not `research-helper-v2`).
|
|
446
434
|
- **Copy to a writeable location before editing.** The installed skill path may be read-only. Copy to `/tmp/skill-name/`, edit there, and package from the copy.
|
|
447
435
|
- **If packaging manually, stage in `/tmp/` first**, then copy to the output directory -- direct writes may fail due to permissions.
|
|
448
436
|
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
## Cowork-Specific Instructions
|
|
452
|
-
|
|
453
|
-
If you're in Cowork, the main things to know are:
|
|
437
|
+
If you have no subagents, run the test cases yourself one at a time: read the skill's SKILL.md, then follow its instructions to accomplish each test prompt. This is less rigorous than independent subagents (you wrote the skill and you're also running it), so skip the baseline runs and the quantitative benchmark, and rely on the human review. If you can't open a browser, present each prompt and its output in the conversation and ask for feedback inline.
|
|
454
438
|
|
|
455
|
-
|
|
456
|
-
- You don't have a browser or display, so when generating the eval viewer, use `--static <output_path>` to write a standalone HTML file instead of starting a server. Then proffer a link that the user can click to open the HTML in their browser.
|
|
457
|
-
- For whatever reason, the Cowork setup seems to disincline Claude from generating the eval viewer after running the tests, so just to reiterate: whether you're in Cowork or in Claude Code, after running tests, you should always generate the eval viewer for the human to look at examples before revising the skill yourself and trying to make corrections, using `generate_review.py` (not writing your own boutique html code). Sorry in advance but I'm gonna go all caps here: GENERATE THE EVAL VIEWER *BEFORE* evaluating inputs yourself. You want to get them in front of the human ASAP!
|
|
458
|
-
- Feedback works differently: since there's no running server, the viewer's "Submit All Reviews" button will download `feedback.json` as a file. You can then read it from there (you may have to request access first).
|
|
459
|
-
- Packaging works — `package_skill.py` just needs Python and a filesystem.
|
|
460
|
-
- Description optimization (`run_loop.py` / `run_eval.py`) should work in Cowork just fine since it uses `claude -p` via subprocess, not a browser, but please save it until you've fully finished making the skill and the user agrees it's in good shape.
|
|
461
|
-
- **Updating an existing skill**: The user might be asking you to update an existing skill, not create a new one. Follow the update guidance in the claude.ai section above.
|
|
439
|
+
Whatever the environment, after running tests, always generate the eval viewer for the human to look at examples before revising the skill yourself, using `generate_review.py` (not writing your own boutique html code). Get the results in front of the human as soon as possible.
|
|
462
440
|
|
|
463
441
|
---
|
|
464
442
|
|
|
@@ -479,13 +457,13 @@ Repeating one more time the core loop here for emphasis:
|
|
|
479
457
|
|
|
480
458
|
- Figure out what the skill is about
|
|
481
459
|
- Draft or edit the skill
|
|
482
|
-
- Run
|
|
460
|
+
- Run an agent with access to the skill on test prompts
|
|
483
461
|
- With the user, evaluate the outputs:
|
|
484
462
|
- Create benchmark.json and run `eval-viewer/generate_review.py` to help the user review them
|
|
485
463
|
- Run quantitative evals
|
|
486
464
|
- Repeat until you and the user are satisfied
|
|
487
465
|
- Package the final skill and return it to the user.
|
|
488
466
|
|
|
489
|
-
Please add steps to your TodoList, if you have such a thing, to make sure you don't forget.
|
|
467
|
+
Please add steps to your TodoList, if you have such a thing, to make sure you don't forget. In particular, put "Create evals JSON and run `eval-viewer/generate_review.py` so human can review test cases" in it to make sure it happens.
|
|
490
468
|
|
|
491
469
|
Good luck!
|
|
@@ -18,10 +18,8 @@ import json
|
|
|
18
18
|
import mimetypes
|
|
19
19
|
import os
|
|
20
20
|
import re
|
|
21
|
-
import
|
|
22
|
-
import subprocess
|
|
21
|
+
import socket
|
|
23
22
|
import sys
|
|
24
|
-
import time
|
|
25
23
|
import webbrowser
|
|
26
24
|
from functools import partial
|
|
27
25
|
from http.server import HTTPServer, BaseHTTPRequestHandler
|
|
@@ -91,7 +89,7 @@ def build_run(root: Path, run_dir: Path) -> dict | None:
|
|
|
91
89
|
for candidate in [run_dir / "eval_metadata.json", run_dir.parent / "eval_metadata.json"]:
|
|
92
90
|
if candidate.exists():
|
|
93
91
|
try:
|
|
94
|
-
metadata = json.loads(candidate.read_text())
|
|
92
|
+
metadata = json.loads(candidate.read_text(encoding="utf-8"))
|
|
95
93
|
prompt = metadata.get("prompt", "")
|
|
96
94
|
eval_id = metadata.get("eval_id")
|
|
97
95
|
except (json.JSONDecodeError, OSError):
|
|
@@ -104,7 +102,7 @@ def build_run(root: Path, run_dir: Path) -> dict | None:
|
|
|
104
102
|
for candidate in [run_dir / "transcript.md", run_dir / "outputs" / "transcript.md"]:
|
|
105
103
|
if candidate.exists():
|
|
106
104
|
try:
|
|
107
|
-
text = candidate.read_text()
|
|
105
|
+
text = candidate.read_text(encoding="utf-8")
|
|
108
106
|
match = re.search(r"## Eval Prompt\n\n([\s\S]*?)(?=\n##|$)", text)
|
|
109
107
|
if match:
|
|
110
108
|
prompt = match.group(1).strip()
|
|
@@ -131,7 +129,7 @@ def build_run(root: Path, run_dir: Path) -> dict | None:
|
|
|
131
129
|
for candidate in [run_dir / "grading.json", run_dir.parent / "grading.json"]:
|
|
132
130
|
if candidate.exists():
|
|
133
131
|
try:
|
|
134
|
-
grading = json.loads(candidate.read_text())
|
|
132
|
+
grading = json.loads(candidate.read_text(encoding="utf-8"))
|
|
135
133
|
except (json.JSONDecodeError, OSError):
|
|
136
134
|
pass
|
|
137
135
|
if grading:
|
|
@@ -153,7 +151,7 @@ def embed_file(path: Path) -> dict:
|
|
|
153
151
|
|
|
154
152
|
if ext in TEXT_EXTENSIONS:
|
|
155
153
|
try:
|
|
156
|
-
content = path.read_text(errors="replace")
|
|
154
|
+
content = path.read_text(encoding="utf-8", errors="replace")
|
|
157
155
|
except OSError:
|
|
158
156
|
content = "(Error reading file)"
|
|
159
157
|
return {
|
|
@@ -222,7 +220,7 @@ def load_previous_iteration(workspace: Path) -> dict[str, dict]:
|
|
|
222
220
|
feedback_path = workspace / "feedback.json"
|
|
223
221
|
if feedback_path.exists():
|
|
224
222
|
try:
|
|
225
|
-
data = json.loads(feedback_path.read_text())
|
|
223
|
+
data = json.loads(feedback_path.read_text(encoding="utf-8"))
|
|
226
224
|
feedback_map = {
|
|
227
225
|
r["run_id"]: r["feedback"]
|
|
228
226
|
for r in data.get("reviews", [])
|
|
@@ -255,7 +253,7 @@ def generate_html(
|
|
|
255
253
|
) -> str:
|
|
256
254
|
"""Generate the complete standalone HTML page with embedded data."""
|
|
257
255
|
template_path = Path(__file__).parent / "viewer.html"
|
|
258
|
-
template = template_path.read_text()
|
|
256
|
+
template = template_path.read_text(encoding="utf-8")
|
|
259
257
|
|
|
260
258
|
# Build previous_feedback and previous_outputs maps for the template
|
|
261
259
|
previous_feedback: dict[str, str] = {}
|
|
@@ -285,25 +283,28 @@ def generate_html(
|
|
|
285
283
|
# HTTP server (stdlib only, zero dependencies)
|
|
286
284
|
# ---------------------------------------------------------------------------
|
|
287
285
|
|
|
288
|
-
|
|
289
|
-
"""
|
|
286
|
+
class ReviewServer(HTTPServer):
|
|
287
|
+
"""An HTTP server that never takes over a port another program listens on.
|
|
288
|
+
|
|
289
|
+
On Windows, SO_REUSEADDR would let it bind a port that is already in use,
|
|
290
|
+
so it asks for the port exclusively there instead.
|
|
291
|
+
"""
|
|
292
|
+
|
|
293
|
+
allow_reuse_address = os.name != "nt"
|
|
294
|
+
|
|
295
|
+
def server_bind(self) -> None:
|
|
296
|
+
if os.name == "nt":
|
|
297
|
+
self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_EXCLUSIVEADDRUSE, 1)
|
|
298
|
+
super().server_bind()
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
def start_server(port: int, handler) -> HTTPServer:
|
|
302
|
+
"""Serve on the given port, or on a free one when another program uses it."""
|
|
290
303
|
try:
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
for pid_str in result.stdout.strip().split("\n"):
|
|
296
|
-
if pid_str.strip():
|
|
297
|
-
try:
|
|
298
|
-
os.kill(int(pid_str.strip()), signal.SIGTERM)
|
|
299
|
-
except (ProcessLookupError, ValueError):
|
|
300
|
-
pass
|
|
301
|
-
if result.stdout.strip():
|
|
302
|
-
time.sleep(0.5)
|
|
303
|
-
except subprocess.TimeoutExpired:
|
|
304
|
-
pass
|
|
305
|
-
except FileNotFoundError:
|
|
306
|
-
print("Note: lsof not found, cannot check if port is in use", file=sys.stderr)
|
|
304
|
+
return ReviewServer(("127.0.0.1", port), handler)
|
|
305
|
+
except OSError:
|
|
306
|
+
return ReviewServer(("127.0.0.1", 0), handler)
|
|
307
|
+
|
|
307
308
|
|
|
308
309
|
class ReviewHandler(BaseHTTPRequestHandler):
|
|
309
310
|
"""Serves the review HTML and handles feedback saves.
|
|
@@ -336,7 +337,7 @@ class ReviewHandler(BaseHTTPRequestHandler):
|
|
|
336
337
|
benchmark = None
|
|
337
338
|
if self.benchmark_path and self.benchmark_path.exists():
|
|
338
339
|
try:
|
|
339
|
-
benchmark = json.loads(self.benchmark_path.read_text())
|
|
340
|
+
benchmark = json.loads(self.benchmark_path.read_text(encoding="utf-8"))
|
|
340
341
|
except (json.JSONDecodeError, OSError):
|
|
341
342
|
pass
|
|
342
343
|
html = generate_html(runs, self.skill_name, self.previous, benchmark)
|
|
@@ -387,7 +388,7 @@ class ReviewHandler(BaseHTTPRequestHandler):
|
|
|
387
388
|
def main() -> None:
|
|
388
389
|
parser = argparse.ArgumentParser(description="Generate and serve eval review")
|
|
389
390
|
parser.add_argument("workspace", type=Path, help="Path to workspace directory")
|
|
390
|
-
parser.add_argument("--port", "-p", type=int, default=3117, help="Server port (default: 3117)")
|
|
391
|
+
parser.add_argument("--port", "-p", type=int, default=3117, help="Server port (default: 3117; a free port when it is in use)")
|
|
391
392
|
parser.add_argument("--skill-name", "-n", type=str, default=None, help="Skill name for header")
|
|
392
393
|
parser.add_argument(
|
|
393
394
|
"--previous-workspace", type=Path, default=None,
|
|
@@ -424,27 +425,20 @@ def main() -> None:
|
|
|
424
425
|
benchmark = None
|
|
425
426
|
if benchmark_path and benchmark_path.exists():
|
|
426
427
|
try:
|
|
427
|
-
benchmark = json.loads(benchmark_path.read_text())
|
|
428
|
+
benchmark = json.loads(benchmark_path.read_text(encoding="utf-8"))
|
|
428
429
|
except (json.JSONDecodeError, OSError):
|
|
429
430
|
pass
|
|
430
431
|
|
|
431
432
|
if args.static:
|
|
432
433
|
html = generate_html(runs, skill_name, previous, benchmark)
|
|
433
434
|
args.static.parent.mkdir(parents=True, exist_ok=True)
|
|
434
|
-
args.static.write_text(html)
|
|
435
|
+
args.static.write_text(html, encoding="utf-8")
|
|
435
436
|
print(f"\n Static viewer written to: {args.static}\n")
|
|
436
437
|
sys.exit(0)
|
|
437
438
|
|
|
438
|
-
# Kill any existing process on the target port
|
|
439
|
-
port = args.port
|
|
440
|
-
_kill_port(port)
|
|
441
439
|
handler = partial(ReviewHandler, workspace, skill_name, feedback_path, previous, benchmark_path)
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
except OSError:
|
|
445
|
-
# Port still in use after kill attempt — find a free one
|
|
446
|
-
server = HTTPServer(("127.0.0.1", 0), handler)
|
|
447
|
-
port = server.server_address[1]
|
|
440
|
+
server = start_server(args.port, handler)
|
|
441
|
+
port = server.server_address[1]
|
|
448
442
|
|
|
449
443
|
url = f"http://localhost:{port}"
|
|
450
444
|
print(f"\n Eval Viewer")
|