@bastani/atomic 0.8.26-alpha.1 → 0.8.26-alpha.11
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 +79 -0
- package/README.md +5 -5
- package/dist/builtin/intercom/CHANGELOG.md +60 -0
- package/dist/builtin/intercom/package.json +2 -2
- package/dist/builtin/mcp/CHANGELOG.md +60 -0
- package/dist/builtin/mcp/package.json +3 -3
- package/dist/builtin/subagents/CHANGELOG.md +61 -0
- package/dist/builtin/subagents/agents/codebase-analyzer.md +1 -1
- package/dist/builtin/subagents/agents/codebase-locator.md +1 -1
- package/dist/builtin/subagents/agents/codebase-online-researcher.md +9 -9
- package/dist/builtin/subagents/agents/codebase-pattern-finder.md +1 -1
- package/dist/builtin/subagents/agents/codebase-research-analyzer.md +1 -1
- package/dist/builtin/subagents/agents/codebase-research-locator.md +1 -1
- package/dist/builtin/subagents/agents/debugger.md +6 -6
- package/dist/builtin/subagents/package.json +4 -4
- package/dist/builtin/subagents/prompts/parallel-handoff-plan.md +1 -1
- package/dist/builtin/subagents/skills/browser/EXAMPLES.md +151 -0
- package/dist/builtin/subagents/skills/browser/LICENSE.txt +21 -0
- package/dist/builtin/subagents/skills/browser/REFERENCE.md +451 -0
- package/dist/builtin/subagents/skills/browser/SKILL.md +170 -0
- package/dist/builtin/subagents/skills/subagent/SKILL.md +4 -4
- package/dist/builtin/subagents/src/runs/background/subagent-runner.ts +55 -12
- package/dist/builtin/subagents/src/runs/foreground/execution.ts +71 -12
- package/dist/builtin/subagents/src/runs/shared/acceptance.ts +2 -1
- package/dist/builtin/subagents/src/runs/shared/final-drain.ts +34 -0
- package/dist/builtin/subagents/src/runs/shared/model-fallback.ts +416 -7
- package/dist/builtin/subagents/src/runs/shared/worktree.ts +2 -2
- package/dist/builtin/web-access/CHANGELOG.md +60 -0
- package/dist/builtin/web-access/package.json +2 -2
- package/dist/builtin/workflows/CHANGELOG.md +72 -0
- package/dist/builtin/workflows/README.md +10 -8
- package/dist/builtin/workflows/builtin/deep-research-codebase.ts +11 -8
- package/dist/builtin/workflows/builtin/goal.ts +137 -109
- package/dist/builtin/workflows/builtin/index.d.ts +2 -0
- package/dist/builtin/workflows/builtin/open-claude-design.ts +228 -151
- package/dist/builtin/workflows/builtin/ralph.d.ts +2 -0
- package/dist/builtin/workflows/builtin/ralph.ts +452 -279
- package/dist/builtin/workflows/package.json +2 -2
- package/dist/builtin/workflows/skills/create-spec/SKILL.md +14 -0
- package/dist/builtin/workflows/skills/research-codebase/SKILL.md +29 -10
- package/dist/builtin/workflows/src/extension/index.ts +10 -2
- package/dist/builtin/workflows/src/extension/runtime.ts +35 -3
- package/dist/builtin/workflows/src/extension/wiring.ts +13 -1
- package/dist/builtin/workflows/src/runs/background/status.ts +52 -6
- package/dist/builtin/workflows/src/runs/foreground/executor.ts +453 -21
- package/dist/builtin/workflows/src/runs/foreground/stage-runner.ts +77 -11
- package/dist/builtin/workflows/src/runs/shared/model-fallback.ts +402 -8
- package/dist/builtin/workflows/src/runs/shared/worktree.ts +2 -2
- package/dist/builtin/workflows/src/shared/authoring-contract.d.ts +2 -2
- package/dist/builtin/workflows/src/shared/persistence-restore.ts +182 -6
- package/dist/builtin/workflows/src/shared/persistence-session-entries.ts +76 -6
- package/dist/builtin/workflows/src/shared/stage-prompt.ts +33 -2
- package/dist/builtin/workflows/src/shared/store-types.ts +31 -0
- package/dist/builtin/workflows/src/shared/store.ts +160 -18
- package/dist/builtin/workflows/src/shared/types.ts +3 -3
- package/dist/builtin/workflows/src/shared/workflow-failures.ts +758 -132
- package/dist/builtin/workflows/src/tui/stage-chat-view.ts +39 -3
- package/dist/builtin/workflows/src/tui/store-widget-installer.ts +74 -74
- package/dist/core/agent-session.d.ts +33 -6
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +157 -182
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/atomic-guide-command.d.ts.map +1 -1
- package/dist/core/atomic-guide-command.js +11 -9
- package/dist/core/atomic-guide-command.js.map +1 -1
- 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 +6 -3
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +23 -10
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/compaction/context-compaction.d.ts +175 -0
- package/dist/core/compaction/context-compaction.d.ts.map +1 -0
- package/dist/core/compaction/context-compaction.js +1636 -0
- package/dist/core/compaction/context-compaction.js.map +1 -0
- package/dist/core/compaction/index.d.ts +1 -0
- package/dist/core/compaction/index.d.ts.map +1 -1
- package/dist/core/compaction/index.js +1 -0
- package/dist/core/compaction/index.js.map +1 -1
- package/dist/core/extensions/types.d.ts +3 -2
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/footer-data-provider.d.ts.map +1 -1
- package/dist/core/footer-data-provider.js +3 -0
- package/dist/core/footer-data-provider.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/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +14 -7
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/session-manager.d.ts +41 -1
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +146 -7
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +1 -1
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/tools/ask-user-question/tool/format-answer.d.ts +5 -5
- package/dist/core/tools/ask-user-question/tool/format-answer.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/tool/format-answer.js +5 -5
- package/dist/core/tools/ask-user-question/tool/format-answer.js.map +1 -1
- package/dist/core/tools/ask-user-question/tool/response-envelope.d.ts +16 -3
- package/dist/core/tools/ask-user-question/tool/response-envelope.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/tool/response-envelope.js +21 -3
- package/dist/core/tools/ask-user-question/tool/response-envelope.js.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/modes/index.d.ts +1 -1
- package/dist/modes/index.d.ts.map +1 -1
- package/dist/modes/index.js.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.d.ts.map +1 -1
- package/dist/modes/interactive/components/chat-session-host.js +17 -0
- package/dist/modes/interactive/components/chat-session-host.js.map +1 -1
- package/dist/modes/interactive/components/context-compaction-summary-message.d.ts +17 -0
- package/dist/modes/interactive/components/context-compaction-summary-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/context-compaction-summary-message.js +83 -0
- package/dist/modes/interactive/components/context-compaction-summary-message.js.map +1 -0
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +4 -1
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/index.d.ts +1 -0
- package/dist/modes/interactive/components/index.d.ts.map +1 -1
- package/dist/modes/interactive/components/index.js +1 -0
- package/dist/modes/interactive/components/index.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +75 -10
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +13 -8
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +8 -1
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +4 -0
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +14 -3
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/utils/git-env.d.ts +10 -0
- package/dist/utils/git-env.d.ts.map +1 -0
- package/dist/utils/git-env.js +33 -0
- package/dist/utils/git-env.js.map +1 -0
- package/docs/compaction.md +185 -50
- package/docs/custom-provider.md +11 -9
- package/docs/extensions.md +46 -42
- package/docs/index.md +13 -6
- package/docs/json.md +15 -12
- package/docs/packages.md +2 -0
- package/docs/providers.md +4 -1
- package/docs/quickstart.md +18 -11
- package/docs/rpc.md +38 -23
- package/docs/sdk.md +17 -8
- package/docs/session-format.md +26 -13
- package/docs/sessions.md +3 -3
- package/docs/settings.md +2 -2
- package/docs/skills.md +1 -15
- package/docs/termux.md +9 -10
- package/docs/themes.md +2 -2
- package/docs/tmux.md +3 -3
- package/docs/tui.md +19 -32
- package/docs/usage.md +2 -2
- package/docs/workflows.md +60 -16
- package/package.json +6 -12
- package/dist/builtin/subagents/skills/browser-use/SKILL.md +0 -234
- package/dist/builtin/subagents/skills/browser-use/references/cdp-python.md +0 -76
- package/dist/builtin/subagents/skills/browser-use/references/multi-session.md +0 -92
- package/node_modules/@earendil-works/pi-tui/README.md +0 -779
- package/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts +0 -54
- package/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/autocomplete.js +0 -632
- package/node_modules/@earendil-works/pi-tui/dist/autocomplete.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/box.d.ts +0 -22
- package/node_modules/@earendil-works/pi-tui/dist/components/box.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/box.js +0 -104
- package/node_modules/@earendil-works/pi-tui/dist/components/box.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.d.ts +0 -22
- package/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.js +0 -35
- package/node_modules/@earendil-works/pi-tui/dist/components/cancellable-loader.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts +0 -249
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.js +0 -1857
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/image.d.ts +0 -28
- package/node_modules/@earendil-works/pi-tui/dist/components/image.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/image.js +0 -89
- package/node_modules/@earendil-works/pi-tui/dist/components/image.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/input.d.ts +0 -37
- package/node_modules/@earendil-works/pi-tui/dist/components/input.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/input.js +0 -378
- package/node_modules/@earendil-works/pi-tui/dist/components/input.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/loader.d.ts +0 -31
- package/node_modules/@earendil-works/pi-tui/dist/components/loader.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/loader.js +0 -69
- package/node_modules/@earendil-works/pi-tui/dist/components/loader.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts +0 -96
- package/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js +0 -644
- package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/select-list.d.ts +0 -50
- package/node_modules/@earendil-works/pi-tui/dist/components/select-list.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/select-list.js +0 -159
- package/node_modules/@earendil-works/pi-tui/dist/components/select-list.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.d.ts +0 -50
- package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.js +0 -185
- package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/spacer.d.ts +0 -12
- package/node_modules/@earendil-works/pi-tui/dist/components/spacer.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/spacer.js +0 -23
- package/node_modules/@earendil-works/pi-tui/dist/components/spacer.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/text.d.ts +0 -19
- package/node_modules/@earendil-works/pi-tui/dist/components/text.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/text.js +0 -89
- package/node_modules/@earendil-works/pi-tui/dist/components/text.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.d.ts +0 -13
- package/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.js +0 -51
- package/node_modules/@earendil-works/pi-tui/dist/components/truncated-text.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/editor-component.d.ts +0 -39
- package/node_modules/@earendil-works/pi-tui/dist/editor-component.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/editor-component.js +0 -2
- package/node_modules/@earendil-works/pi-tui/dist/editor-component.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/fuzzy.d.ts +0 -16
- package/node_modules/@earendil-works/pi-tui/dist/fuzzy.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/fuzzy.js +0 -110
- package/node_modules/@earendil-works/pi-tui/dist/fuzzy.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/index.d.ts +0 -23
- package/node_modules/@earendil-works/pi-tui/dist/index.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/index.js +0 -32
- package/node_modules/@earendil-works/pi-tui/dist/index.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts +0 -193
- package/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/keybindings.js +0 -174
- package/node_modules/@earendil-works/pi-tui/dist/keybindings.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/keys.d.ts +0 -184
- package/node_modules/@earendil-works/pi-tui/dist/keys.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/keys.js +0 -1173
- package/node_modules/@earendil-works/pi-tui/dist/keys.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/kill-ring.d.ts +0 -28
- package/node_modules/@earendil-works/pi-tui/dist/kill-ring.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/kill-ring.js +0 -44
- package/node_modules/@earendil-works/pi-tui/dist/kill-ring.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.d.ts +0 -3
- package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.js +0 -53
- package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.d.ts +0 -50
- package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.js +0 -361
- package/node_modules/@earendil-works/pi-tui/dist/stdin-buffer.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts +0 -90
- package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js +0 -366
- package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts +0 -113
- package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal.js +0 -472
- package/node_modules/@earendil-works/pi-tui/dist/terminal.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts +0 -227
- package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/tui.js +0 -1106
- package/node_modules/@earendil-works/pi-tui/dist/tui.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/undo-stack.d.ts +0 -17
- package/node_modules/@earendil-works/pi-tui/dist/undo-stack.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/undo-stack.js +0 -25
- package/node_modules/@earendil-works/pi-tui/dist/undo-stack.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/utils.d.ts +0 -84
- package/node_modules/@earendil-works/pi-tui/dist/utils.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/utils.js +0 -1029
- package/node_modules/@earendil-works/pi-tui/dist/utils.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/word-navigation.d.ts +0 -25
- package/node_modules/@earendil-works/pi-tui/dist/word-navigation.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-tui/dist/word-navigation.js +0 -96
- package/node_modules/@earendil-works/pi-tui/dist/word-navigation.js.map +0 -1
- package/node_modules/@earendil-works/pi-tui/native/darwin/prebuilds/darwin-arm64/darwin-modifiers.node +0 -0
- package/node_modules/@earendil-works/pi-tui/native/darwin/prebuilds/darwin-x64/darwin-modifiers.node +0 -0
- package/node_modules/@earendil-works/pi-tui/native/win32/prebuilds/win32-arm64/win32-console-mode.node +0 -0
- package/node_modules/@earendil-works/pi-tui/native/win32/prebuilds/win32-x64/win32-console-mode.node +0 -0
- package/node_modules/@earendil-works/pi-tui/package.json +0 -47
- package/node_modules/get-east-asian-width/index.d.ts +0 -60
- package/node_modules/get-east-asian-width/index.js +0 -30
- package/node_modules/get-east-asian-width/license +0 -9
- package/node_modules/get-east-asian-width/lookup-data.js +0 -21
- package/node_modules/get-east-asian-width/lookup.js +0 -138
- package/node_modules/get-east-asian-width/package.json +0 -71
- package/node_modules/get-east-asian-width/readme.md +0 -65
- package/node_modules/get-east-asian-width/utilities.js +0 -24
- package/node_modules/marked/LICENSE.md +0 -44
- package/node_modules/marked/README.md +0 -106
- package/node_modules/marked/bin/main.js +0 -282
- package/node_modules/marked/bin/marked.js +0 -15
- package/node_modules/marked/lib/marked.cjs +0 -2211
- package/node_modules/marked/lib/marked.cjs.map +0 -7
- package/node_modules/marked/lib/marked.d.cts +0 -728
- package/node_modules/marked/lib/marked.d.ts +0 -728
- package/node_modules/marked/lib/marked.esm.js +0 -2189
- package/node_modules/marked/lib/marked.esm.js.map +0 -7
- package/node_modules/marked/lib/marked.umd.js +0 -2213
- package/node_modules/marked/lib/marked.umd.js.map +0 -7
- package/node_modules/marked/man/marked.1 +0 -111
- package/node_modules/marked/man/marked.1.md +0 -92
- package/node_modules/marked/marked.min.js +0 -69
- package/node_modules/marked/package.json +0 -111
|
@@ -62,7 +62,7 @@ export function currentModelFullId(model: { provider: string; id: string } | und
|
|
|
62
62
|
return `${String(model.provider)}/${model.id}`;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
const RETRYABLE_MODEL_FAILURE_PATTERNS = [
|
|
65
|
+
const RETRYABLE_MODEL_FAILURE_PATTERNS: readonly RegExp[] = [
|
|
66
66
|
/rate\s*limit/i,
|
|
67
67
|
/too many requests/i,
|
|
68
68
|
/\b429\b/,
|
|
@@ -71,6 +71,7 @@ const RETRYABLE_MODEL_FAILURE_PATTERNS = [
|
|
|
71
71
|
/credit/i,
|
|
72
72
|
/auth(?:entication)?/i,
|
|
73
73
|
/unauthori[sz]ed/i,
|
|
74
|
+
/\b40[13]\b/,
|
|
74
75
|
/forbidden/i,
|
|
75
76
|
/api key/i,
|
|
76
77
|
/token expired/i,
|
|
@@ -90,14 +91,422 @@ const RETRYABLE_MODEL_FAILURE_PATTERNS = [
|
|
|
90
91
|
/upstream/i,
|
|
91
92
|
/timed? out/i,
|
|
92
93
|
/timeout/i,
|
|
93
|
-
/\
|
|
94
|
-
/\b503\b/,
|
|
95
|
-
/\b504\b/,
|
|
94
|
+
/\b50[0-4]\b/,
|
|
96
95
|
];
|
|
97
96
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
97
|
+
const NON_RETRYABLE_FAILURE_PATTERNS: readonly RegExp[] = [
|
|
98
|
+
/command failed/i,
|
|
99
|
+
/tests? failed/i,
|
|
100
|
+
/shell/i,
|
|
101
|
+
/missing file/i,
|
|
102
|
+
/no such file/i,
|
|
103
|
+
/completion guard/i,
|
|
104
|
+
/cancel/i,
|
|
105
|
+
/abort/i,
|
|
106
|
+
/interrupted/i,
|
|
107
|
+
];
|
|
108
|
+
|
|
109
|
+
const CANCELLED_FAILURE_PATTERNS: readonly RegExp[] = [
|
|
110
|
+
/cancel/i,
|
|
111
|
+
/abort/i,
|
|
112
|
+
/interrupted/i,
|
|
113
|
+
];
|
|
114
|
+
|
|
115
|
+
export type ModelFallbackFailureKind =
|
|
116
|
+
| "auth_on_candidate_provider"
|
|
117
|
+
| "rate_limit"
|
|
118
|
+
| "provider_unavailable"
|
|
119
|
+
| "network_timeout"
|
|
120
|
+
| "model_unavailable"
|
|
121
|
+
| "cancelled"
|
|
122
|
+
| "task_failure"
|
|
123
|
+
| "unknown";
|
|
124
|
+
|
|
125
|
+
export type ModelFallbackFailureSource =
|
|
126
|
+
| "assistant_message"
|
|
127
|
+
| "diagnostic"
|
|
128
|
+
| "throw"
|
|
129
|
+
| "structured"
|
|
130
|
+
| "string_fallback";
|
|
131
|
+
|
|
132
|
+
export interface ModelFallbackFailureSignal {
|
|
133
|
+
readonly kind: ModelFallbackFailureKind;
|
|
134
|
+
readonly message: string;
|
|
135
|
+
readonly source: ModelFallbackFailureSource;
|
|
136
|
+
readonly stopReason?: string;
|
|
137
|
+
readonly status?: number;
|
|
138
|
+
readonly code?: string | number;
|
|
139
|
+
readonly name?: string;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
const FALLBACKABLE_FAILURE_KINDS: ReadonlySet<ModelFallbackFailureKind> = new Set([
|
|
143
|
+
"auth_on_candidate_provider",
|
|
144
|
+
"rate_limit",
|
|
145
|
+
"provider_unavailable",
|
|
146
|
+
"network_timeout",
|
|
147
|
+
"model_unavailable",
|
|
148
|
+
]);
|
|
149
|
+
|
|
150
|
+
function asRecord(value: unknown): Record<string, unknown> | undefined {
|
|
151
|
+
return value !== null && typeof value === "object" ? value as Record<string, unknown> : undefined;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function field(value: unknown, key: string): unknown {
|
|
155
|
+
return asRecord(value)?.[key];
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
function stringField(value: unknown, key: string): string | undefined {
|
|
159
|
+
const raw = field(value, key);
|
|
160
|
+
return typeof raw === "string" && raw.trim().length > 0 ? raw : undefined;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function errorName(value: unknown): string | undefined {
|
|
164
|
+
return value instanceof Error ? value.name : stringField(value, "name");
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function directMessageFrom(value: unknown): string | undefined {
|
|
168
|
+
return stringField(value, "errorMessage")
|
|
169
|
+
?? stringField(value, "message")
|
|
170
|
+
?? stringField(value, "statusText");
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function integerFrom(value: unknown): number | undefined {
|
|
174
|
+
if (typeof value === "number" && Number.isInteger(value)) return value;
|
|
175
|
+
if (typeof value !== "string" || value.trim().length === 0) return undefined;
|
|
176
|
+
const parsed = Number(value.trim());
|
|
177
|
+
return Number.isInteger(parsed) ? parsed : undefined;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
function statusFrom(value: unknown): number | undefined {
|
|
181
|
+
return integerFrom(field(value, "status"))
|
|
182
|
+
?? integerFrom(field(value, "statusCode"))
|
|
183
|
+
?? integerFrom(field(value, "httpStatus"));
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
function codeFrom(value: unknown): string | number | undefined {
|
|
187
|
+
const rawCode = field(value, "code");
|
|
188
|
+
return typeof rawCode === "string" || typeof rawCode === "number" ? rawCode : undefined;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function stopReasonFrom(value: unknown): string | undefined {
|
|
192
|
+
return stringField(value, "stopReason");
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
function finishReasonFrom(value: unknown): string | undefined {
|
|
196
|
+
return stringField(value, "finish_reason") ?? stringField(value, "finishReason");
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function causeOf(value: unknown): unknown {
|
|
200
|
+
return value instanceof Error ? value.cause : field(value, "cause");
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function diagnosticErrors(value: unknown): readonly unknown[] {
|
|
204
|
+
const diagnostics = field(value, "diagnostics");
|
|
205
|
+
if (!Array.isArray(diagnostics)) return [];
|
|
206
|
+
const errors: unknown[] = [];
|
|
207
|
+
for (const diagnostic of diagnostics) {
|
|
208
|
+
const diagnosticError = field(diagnostic, "error");
|
|
209
|
+
errors.push(diagnosticError ?? diagnostic);
|
|
210
|
+
}
|
|
211
|
+
return errors;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
function normalizeCode(value: string | number | undefined): string | undefined {
|
|
215
|
+
if (value === undefined) return undefined;
|
|
216
|
+
const normalized = String(value)
|
|
217
|
+
.trim()
|
|
218
|
+
.toLowerCase()
|
|
219
|
+
.replace(/[^a-z0-9]+/g, "_")
|
|
220
|
+
.replace(/^_+|_+$/g, "");
|
|
221
|
+
return normalized.length > 0 ? normalized : undefined;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
function kindFromStatus(status: number | undefined): ModelFallbackFailureKind | undefined {
|
|
225
|
+
switch (status) {
|
|
226
|
+
case 401:
|
|
227
|
+
case 403:
|
|
228
|
+
return "auth_on_candidate_provider";
|
|
229
|
+
case 408:
|
|
230
|
+
return "network_timeout";
|
|
231
|
+
case 404:
|
|
232
|
+
return "model_unavailable";
|
|
233
|
+
case 429:
|
|
234
|
+
return "rate_limit";
|
|
235
|
+
default:
|
|
236
|
+
if (status !== undefined && status >= 500 && status <= 599) return "provider_unavailable";
|
|
237
|
+
return undefined;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
function refusalKindFromCode(code: string | number | undefined): ModelFallbackFailureKind | undefined {
|
|
242
|
+
const normalizedCode = normalizeCode(code);
|
|
243
|
+
if (normalizedCode === undefined) return undefined;
|
|
244
|
+
if (normalizedCode.includes("content_filter") || normalizedCode.includes("contentfilter")) return "task_failure";
|
|
245
|
+
if (normalizedCode.includes("safety") || normalizedCode.includes("policy")) return "task_failure";
|
|
246
|
+
switch (normalizedCode) {
|
|
247
|
+
case "blocked":
|
|
248
|
+
case "blocked_by_provider":
|
|
249
|
+
case "blocked_by_safety":
|
|
250
|
+
case "blocked_by_policy":
|
|
251
|
+
case "provider_refusal":
|
|
252
|
+
case "refusal":
|
|
253
|
+
case "tool_refusal":
|
|
254
|
+
case "tool_call_refusal":
|
|
255
|
+
case "tool_use_refusal":
|
|
256
|
+
return "task_failure";
|
|
257
|
+
default:
|
|
258
|
+
return undefined;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
function kindFromCode(code: string | number | undefined): ModelFallbackFailureKind | undefined {
|
|
263
|
+
const normalizedCode = normalizeCode(code);
|
|
264
|
+
if (normalizedCode === undefined) return undefined;
|
|
265
|
+
const refusalKind = refusalKindFromCode(code);
|
|
266
|
+
if (refusalKind !== undefined) return refusalKind;
|
|
267
|
+
const httpStatusKind = kindFromStatus(integerFrom(code));
|
|
268
|
+
if (httpStatusKind !== undefined) return httpStatusKind;
|
|
269
|
+
|
|
270
|
+
switch (normalizedCode) {
|
|
271
|
+
case "auth":
|
|
272
|
+
case "auth_required":
|
|
273
|
+
case "authentication_required":
|
|
274
|
+
case "unauthorized":
|
|
275
|
+
case "forbidden":
|
|
276
|
+
case "invalid_api_key":
|
|
277
|
+
case "missing_api_key":
|
|
278
|
+
case "invalid_key":
|
|
279
|
+
return "auth_on_candidate_provider";
|
|
280
|
+
case "etimedout":
|
|
281
|
+
case "econnreset":
|
|
282
|
+
case "econnrefused":
|
|
283
|
+
case "enotfound":
|
|
284
|
+
case "eai_again":
|
|
285
|
+
case "fetch_failed":
|
|
286
|
+
case "network_error":
|
|
287
|
+
case "timeout":
|
|
288
|
+
case "timeout_error":
|
|
289
|
+
case "und_err_connect_timeout":
|
|
290
|
+
return "network_timeout";
|
|
291
|
+
case "rate_limit":
|
|
292
|
+
case "rate_limit_exceeded":
|
|
293
|
+
case "too_many_requests":
|
|
294
|
+
case "quota_exceeded":
|
|
295
|
+
return "rate_limit";
|
|
296
|
+
case "aborterror":
|
|
297
|
+
case "aborted":
|
|
298
|
+
case "cancelled":
|
|
299
|
+
case "canceled":
|
|
300
|
+
return "cancelled";
|
|
301
|
+
case "model_not_found":
|
|
302
|
+
case "model_unavailable":
|
|
303
|
+
case "model_disabled":
|
|
304
|
+
case "unknown_model":
|
|
305
|
+
return "model_unavailable";
|
|
306
|
+
case "provider_error":
|
|
307
|
+
case "api_error":
|
|
308
|
+
case "service_unavailable":
|
|
309
|
+
case "temporarily_unavailable":
|
|
310
|
+
case "overloaded":
|
|
311
|
+
return "provider_unavailable";
|
|
312
|
+
default:
|
|
313
|
+
return undefined;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
const PROVIDER_REFUSAL_FAILURE_PATTERNS: readonly RegExp[] = [
|
|
318
|
+
/\bfinish[_\s-]?reason\b[^\n]*\bcontent[_\s-]?filter\b/i,
|
|
319
|
+
/\bcontent[_\s-]?filter(?:ed|ing)?\b/i,
|
|
320
|
+
/\b(?:safety|policy)\b[^\n]*\b(?:refus(?:e|al|ed|es|ing)?|block(?:ed|ing)?|filter(?:ed|ing)?|violat(?:e|ion|ed|ing)?|disallow(?:ed|ing)?|reject(?:ed|ion|ing)?)\b/i,
|
|
321
|
+
/\b(?:refus(?:e|al|ed|es|ing)?|block(?:ed|ing)?|filter(?:ed|ing)?|violat(?:e|ion|ed|ing)?|disallow(?:ed|ing)?|reject(?:ed|ion|ing)?)\b[^\n]*\b(?:safety|policy)\b/i,
|
|
322
|
+
/\btool[_\s-]?(?:call|use)?[_\s-]?refus(?:e|al|ed|es|ing)?\b/i,
|
|
323
|
+
/\btool(?:\s+call|\s+use)?\b[^\n]*\brefus(?:e|al|ed|es|ing)?\b/i,
|
|
324
|
+
/\brefus(?:e|al|ed|es|ing)?\b[^\n]*\btool(?:\s+call|\s+use)?\b/i,
|
|
325
|
+
/\bprovider[_\s-]?refus(?:e|al|ed|es|ing)?\b/i,
|
|
326
|
+
/\bprovider\b[^\n]*\brefus(?:e|al|ed|es|ing)?\b[^\n]*\b(?:prompt|request|content|policy|safety)\b/i,
|
|
327
|
+
];
|
|
328
|
+
|
|
329
|
+
function refusalKindFromMessage(message: string): ModelFallbackFailureKind | undefined {
|
|
330
|
+
if (CANCELLED_FAILURE_PATTERNS.some((pattern) => pattern.test(message))) return "cancelled";
|
|
331
|
+
if (NON_RETRYABLE_FAILURE_PATTERNS.some((pattern) => pattern.test(message))) return "task_failure";
|
|
332
|
+
if (PROVIDER_REFUSAL_FAILURE_PATTERNS.some((pattern) => pattern.test(message))) return "task_failure";
|
|
333
|
+
return undefined;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
function fallbackKindFromMessage(message: string, name: string | undefined): ModelFallbackFailureKind | undefined {
|
|
337
|
+
const refusalKind = refusalKindFromMessage(message);
|
|
338
|
+
if (refusalKind !== undefined) return refusalKind;
|
|
339
|
+
const nameKind = kindFromCode(name);
|
|
340
|
+
if (nameKind !== undefined) return nameKind;
|
|
341
|
+
if (!RETRYABLE_MODEL_FAILURE_PATTERNS.some((pattern) => pattern.test(message))) return undefined;
|
|
342
|
+
if (/rate\s*limit|too many requests|\b429\b|quota|billing|credit/i.test(message)) return "rate_limit";
|
|
343
|
+
if (/auth|unauthori[sz]ed|\b40[13]\b|api key|token expired|forbidden|invalid key/i.test(message)) return "auth_on_candidate_provider";
|
|
344
|
+
if (/model.*(?:unavailable|disabled|not found|unknown)|(?:unavailable|disabled|not found|unknown).*model/i.test(message)) return "model_unavailable";
|
|
345
|
+
if (/network|fetch failed|socket|connection refused|timeout|timed? out/i.test(message)) return "network_timeout";
|
|
346
|
+
return "provider_unavailable";
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
function signalSource(value: unknown, fallback: ModelFallbackFailureSource | undefined): ModelFallbackFailureSource {
|
|
350
|
+
if (fallback !== undefined) return fallback;
|
|
351
|
+
if (stopReasonFrom(value) !== undefined || diagnosticErrors(value).length > 0) return "assistant_message";
|
|
352
|
+
if (value instanceof Error) return "throw";
|
|
353
|
+
return "structured";
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
function makeSignal(
|
|
357
|
+
kind: ModelFallbackFailureKind,
|
|
358
|
+
value: unknown,
|
|
359
|
+
source: ModelFallbackFailureSource | undefined,
|
|
360
|
+
): ModelFallbackFailureSignal {
|
|
361
|
+
const status = statusFrom(value);
|
|
362
|
+
const code = codeFrom(value);
|
|
363
|
+
const name = errorName(value);
|
|
364
|
+
const stopReason = stopReasonFrom(value);
|
|
365
|
+
return {
|
|
366
|
+
kind,
|
|
367
|
+
message: modelFailureMessage(value),
|
|
368
|
+
source: signalSource(value, source),
|
|
369
|
+
...(stopReason !== undefined ? { stopReason } : {}),
|
|
370
|
+
...(status !== undefined ? { status } : {}),
|
|
371
|
+
...(code !== undefined ? { code } : {}),
|
|
372
|
+
...(name !== undefined ? { name } : {}),
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
function fallbackSignalFromMessage(
|
|
377
|
+
value: unknown,
|
|
378
|
+
source: ModelFallbackFailureSource | undefined,
|
|
379
|
+
): ModelFallbackFailureSignal | undefined {
|
|
380
|
+
const message = modelFailureMessage(value);
|
|
381
|
+
if (!message.trim()) return undefined;
|
|
382
|
+
const kind = fallbackKindFromMessage(message, errorName(value));
|
|
383
|
+
return kind === undefined ? undefined : makeSignal(kind, value, source);
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
function classifyAssistantRefusalSignal(
|
|
387
|
+
value: unknown,
|
|
388
|
+
source: ModelFallbackFailureSource | undefined,
|
|
389
|
+
): ModelFallbackFailureSignal | undefined {
|
|
390
|
+
const codeRefusalKind = refusalKindFromCode(codeFrom(value))
|
|
391
|
+
?? refusalKindFromCode(errorName(value))
|
|
392
|
+
?? refusalKindFromCode(finishReasonFrom(value));
|
|
393
|
+
if (codeRefusalKind !== undefined) return makeSignal(codeRefusalKind, value, source);
|
|
394
|
+
|
|
395
|
+
const messageRefusalKind = refusalKindFromMessage(directMessageFrom(value) ?? "");
|
|
396
|
+
return messageRefusalKind === undefined ? undefined : makeSignal(messageRefusalKind, value, source);
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
function isRefusalSignal(signal: ModelFallbackFailureSignal): boolean {
|
|
400
|
+
return signal.kind === "cancelled" || signal.kind === "task_failure";
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
function structuredSignal(
|
|
404
|
+
value: unknown,
|
|
405
|
+
seen: Set<unknown>,
|
|
406
|
+
source?: ModelFallbackFailureSource,
|
|
407
|
+
): ModelFallbackFailureSignal | undefined {
|
|
408
|
+
if (value === undefined || value === null || seen.has(value)) return undefined;
|
|
409
|
+
if (typeof value === "object") seen.add(value);
|
|
410
|
+
|
|
411
|
+
const stopReason = stopReasonFrom(value)?.toLowerCase();
|
|
412
|
+
if (stopReason === "aborted") return makeSignal("cancelled", value, source);
|
|
413
|
+
|
|
414
|
+
const directRefusalSignal = classifyAssistantRefusalSignal(value, source);
|
|
415
|
+
if (directRefusalSignal !== undefined) return directRefusalSignal;
|
|
416
|
+
|
|
417
|
+
const codeKind = kindFromCode(codeFrom(value));
|
|
418
|
+
const nameKind = kindFromCode(errorName(value));
|
|
419
|
+
if (codeKind === "cancelled" || nameKind === "cancelled") return makeSignal("cancelled", value, source);
|
|
420
|
+
|
|
421
|
+
let firstNestedFallbackSignal: ModelFallbackFailureSignal | undefined;
|
|
422
|
+
const nestedSeen = new Set(seen);
|
|
423
|
+
for (const diagnosticError of diagnosticErrors(value)) {
|
|
424
|
+
const diagnosticSignal = structuredSignal(diagnosticError, nestedSeen, "diagnostic")
|
|
425
|
+
?? fallbackSignalFromMessage(diagnosticError, "diagnostic");
|
|
426
|
+
if (diagnosticSignal === undefined) continue;
|
|
427
|
+
if (isRefusalSignal(diagnosticSignal)) return diagnosticSignal;
|
|
428
|
+
firstNestedFallbackSignal ??= diagnosticSignal;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
const cause = causeOf(value);
|
|
432
|
+
const causeSignal = structuredSignal(cause, nestedSeen, source)
|
|
433
|
+
?? fallbackSignalFromMessage(cause, source);
|
|
434
|
+
if (causeSignal !== undefined) {
|
|
435
|
+
if (isRefusalSignal(causeSignal)) return causeSignal;
|
|
436
|
+
firstNestedFallbackSignal ??= causeSignal;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
const statusKind = kindFromStatus(statusFrom(value));
|
|
440
|
+
if (statusKind !== undefined) return makeSignal(statusKind, value, source);
|
|
441
|
+
if (codeKind !== undefined) return makeSignal(codeKind, value, source);
|
|
442
|
+
if (nameKind !== undefined) return makeSignal(nameKind, value, source);
|
|
443
|
+
|
|
444
|
+
if (firstNestedFallbackSignal !== undefined) return firstNestedFallbackSignal;
|
|
445
|
+
|
|
446
|
+
if (stopReason === "error") return makeSignal("provider_unavailable", value, source);
|
|
447
|
+
|
|
448
|
+
return undefined;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
function messageFromUnknown(value: unknown, seen: Set<unknown>): string | undefined {
|
|
452
|
+
if (value === undefined || value === null || seen.has(value)) return undefined;
|
|
453
|
+
if (typeof value === "string") return value.trim().length > 0 ? value : undefined;
|
|
454
|
+
if (typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") return String(value);
|
|
455
|
+
if (typeof value === "symbol" || typeof value === "function") return undefined;
|
|
456
|
+
seen.add(value);
|
|
457
|
+
|
|
458
|
+
if (value instanceof Error && value.message.trim().length > 0) return value.message;
|
|
459
|
+
const directMessage = directMessageFrom(value);
|
|
460
|
+
if (directMessage !== undefined) return directMessage;
|
|
461
|
+
|
|
462
|
+
for (const diagnosticError of diagnosticErrors(value)) {
|
|
463
|
+
const diagnosticMessage = messageFromUnknown(diagnosticError, seen);
|
|
464
|
+
if (diagnosticMessage !== undefined) return diagnosticMessage;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
const causeMessage = messageFromUnknown(causeOf(value), seen);
|
|
468
|
+
if (causeMessage !== undefined) return causeMessage;
|
|
469
|
+
|
|
470
|
+
const stopReason = stopReasonFrom(value);
|
|
471
|
+
if (stopReason !== undefined) return `Assistant message ended with stopReason:${stopReason}`;
|
|
472
|
+
const finishReason = finishReasonFrom(value);
|
|
473
|
+
if (finishReason !== undefined) return `Model request finished with finish_reason:${finishReason}`;
|
|
474
|
+
const status = statusFrom(value);
|
|
475
|
+
if (status !== undefined) return `Model request failed with status ${status}`;
|
|
476
|
+
const code = codeFrom(value);
|
|
477
|
+
if (code !== undefined) return `Model request failed with code ${String(code)}`;
|
|
478
|
+
|
|
479
|
+
return undefined;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
export function modelFailureMessage(error: unknown): string {
|
|
483
|
+
const structuredMessage = messageFromUnknown(error, new Set());
|
|
484
|
+
if (structuredMessage !== undefined) return structuredMessage;
|
|
485
|
+
const rendered = String(error);
|
|
486
|
+
return rendered === "[object Object]" ? "Model request failed" : rendered;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
export function normalizeModelFailureSignal(error: unknown): ModelFallbackFailureSignal {
|
|
490
|
+
const structured = structuredSignal(error, new Set());
|
|
491
|
+
if (structured !== undefined) return structured;
|
|
492
|
+
|
|
493
|
+
const message = modelFailureMessage(error);
|
|
494
|
+
const name = errorName(error);
|
|
495
|
+
const fallbackKind = message.trim().length > 0
|
|
496
|
+
? fallbackKindFromMessage(message, name)
|
|
497
|
+
: undefined;
|
|
498
|
+
return {
|
|
499
|
+
kind: fallbackKind ?? "unknown",
|
|
500
|
+
message,
|
|
501
|
+
source: "string_fallback",
|
|
502
|
+
...(name !== undefined ? { name } : {}),
|
|
503
|
+
};
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
export function isRetryableModelFailure(error: unknown): boolean {
|
|
507
|
+
if (error === undefined) return false;
|
|
508
|
+
const signal = normalizeModelFailureSignal(error);
|
|
509
|
+
return FALLBACKABLE_FAILURE_KINDS.has(signal.kind);
|
|
101
510
|
}
|
|
102
511
|
|
|
103
512
|
export function formatModelAttemptNote(attempt: ModelAttemptSummary, nextModel?: string): string {
|
|
@@ -2,7 +2,7 @@ import { spawnSync } from "node:child_process";
|
|
|
2
2
|
import * as fs from "node:fs";
|
|
3
3
|
import * as os from "node:os";
|
|
4
4
|
import * as path from "node:path";
|
|
5
|
-
import { APP_NAME } from "@bastani/atomic";
|
|
5
|
+
import { APP_NAME, createGitEnvironment } from "@bastani/atomic";
|
|
6
6
|
|
|
7
7
|
export interface WorktreeSetup {
|
|
8
8
|
cwd: string;
|
|
@@ -82,7 +82,7 @@ interface RepoState {
|
|
|
82
82
|
const DEFAULT_WORKTREE_SETUP_HOOK_TIMEOUT_MS = 30000;
|
|
83
83
|
|
|
84
84
|
function runGit(cwd: string, args: string[]): GitResult {
|
|
85
|
-
const result = spawnSync("git", ["-C", cwd, ...args], { encoding: "utf-8" });
|
|
85
|
+
const result = spawnSync("git", ["-C", cwd, ...args], { encoding: "utf-8", env: createGitEnvironment() });
|
|
86
86
|
return {
|
|
87
87
|
stdout: result.stdout ?? "",
|
|
88
88
|
stderr: result.stderr ?? "",
|
|
@@ -4,6 +4,66 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.8.26-alpha.11] - 2026-06-08
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- Published a synchronized Atomic 0.8.26-alpha.11 prerelease alongside the subagent codebase-agent tool restriction changes; no functional changes were made in the web-access extension.
|
|
12
|
+
|
|
13
|
+
## [0.8.26-alpha.10] - 2026-06-08
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
- Bumped package version for the Atomic 0.8.26-alpha.10 prerelease.
|
|
18
|
+
|
|
19
|
+
## [0.8.26-alpha.9] - 2026-06-07
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- Bumped package version for the Atomic 0.8.26-alpha.9 prerelease.
|
|
24
|
+
|
|
25
|
+
## [0.8.26-alpha.8] - 2026-06-07
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
|
|
29
|
+
- Bumped package version for the Atomic 0.8.26-alpha.8 prerelease.
|
|
30
|
+
|
|
31
|
+
## [0.8.26-alpha.7] - 2026-06-07
|
|
32
|
+
|
|
33
|
+
### Changed
|
|
34
|
+
|
|
35
|
+
- Bumped package version for the Atomic 0.8.26-alpha.7 prerelease.
|
|
36
|
+
|
|
37
|
+
## [0.8.26-alpha.6] - 2026-06-06
|
|
38
|
+
|
|
39
|
+
### Changed
|
|
40
|
+
|
|
41
|
+
- Bumped package version for the Atomic 0.8.26-alpha.6 prerelease.
|
|
42
|
+
|
|
43
|
+
## [0.8.26-alpha.5] - 2026-06-06
|
|
44
|
+
|
|
45
|
+
### Changed
|
|
46
|
+
|
|
47
|
+
- Bumped package version for the Atomic 0.8.26-alpha.5 prerelease.
|
|
48
|
+
|
|
49
|
+
## [0.8.26-alpha.4] - 2026-06-05
|
|
50
|
+
|
|
51
|
+
### Changed
|
|
52
|
+
|
|
53
|
+
- Bumped package version for the Atomic 0.8.26-alpha.4 prerelease.
|
|
54
|
+
|
|
55
|
+
## [0.8.26-alpha.3] - 2026-06-05
|
|
56
|
+
|
|
57
|
+
### Changed
|
|
58
|
+
|
|
59
|
+
- Bumped package version for the Atomic 0.8.26-alpha.3 prerelease.
|
|
60
|
+
|
|
61
|
+
## [0.8.26-alpha.2] - 2026-06-05
|
|
62
|
+
|
|
63
|
+
### Changed
|
|
64
|
+
|
|
65
|
+
- Bumped package version for the Atomic 0.8.26-alpha.2 prerelease.
|
|
66
|
+
|
|
7
67
|
## [0.8.26-alpha.1] - 2026-06-05
|
|
8
68
|
|
|
9
69
|
### Changed
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bastani/web-access",
|
|
3
|
-
"version": "0.8.26-alpha.
|
|
3
|
+
"version": "0.8.26-alpha.11",
|
|
4
4
|
"private": true,
|
|
5
5
|
"description": "Atomic extension for web search, URL fetching, GitHub repo cloning, PDF/video extraction. Fork of: https://github.com/nicobailon/pi-web-access",
|
|
6
6
|
"contributors": [
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"@bastani/atomic": "*",
|
|
33
|
-
"@earendil-works/pi-tui": "
|
|
33
|
+
"@earendil-works/pi-tui": "^0.78.1"
|
|
34
34
|
},
|
|
35
35
|
"peerDependenciesMeta": {
|
|
36
36
|
"@bastani/atomic": {
|
|
@@ -6,6 +6,78 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.8.26-alpha.11] - 2026-06-08
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
- Published a synchronized Atomic 0.8.26-alpha.11 prerelease alongside the subagent codebase-agent tool restriction changes; no functional changes were made in the workflows extension.
|
|
14
|
+
|
|
15
|
+
## [0.8.26-alpha.10] - 2026-06-08
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- Bumped package version for the Atomic 0.8.26-alpha.10 prerelease.
|
|
20
|
+
|
|
21
|
+
## [0.8.26-alpha.9] - 2026-06-07
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
|
|
25
|
+
- Bumped package version for the Atomic 0.8.26-alpha.9 prerelease.
|
|
26
|
+
|
|
27
|
+
## [0.8.26-alpha.8] - 2026-06-07
|
|
28
|
+
|
|
29
|
+
### Changed
|
|
30
|
+
|
|
31
|
+
- Updated workflow-stage chat so `/compact` is the no-argument compaction command and `/context-compact` is no longer handled locally.
|
|
32
|
+
|
|
33
|
+
## [0.8.26-alpha.7] - 2026-06-07
|
|
34
|
+
|
|
35
|
+
### Changed
|
|
36
|
+
|
|
37
|
+
- Refined bundled workflow prompts to keep natural instructions inside meaningful XML sections while removing redundant wrapper noise.
|
|
38
|
+
|
|
39
|
+
### Fixed
|
|
40
|
+
|
|
41
|
+
- Fixed the builtin `goal` and `ralph` workflows to fork looped worker/orchestrator-stage sessions from their matching prior iteration, preserving accumulated context while keeping reviewer stages independent ([#1275](https://github.com/bastani-inc/atomic/issues/1275)).
|
|
42
|
+
- Fixed workflow completion gates to rely on structured decision fields instead of manual text/regex heuristics in `goal` and `open-claude-design`.
|
|
43
|
+
|
|
44
|
+
## [0.8.26-alpha.6] - 2026-06-06
|
|
45
|
+
|
|
46
|
+
### Changed
|
|
47
|
+
|
|
48
|
+
- Bumped package version for the Atomic 0.8.26-alpha.6 prerelease.
|
|
49
|
+
|
|
50
|
+
## [0.8.26-alpha.5] - 2026-06-06
|
|
51
|
+
|
|
52
|
+
### Fixed
|
|
53
|
+
|
|
54
|
+
- Fixed the workflow global tool-event hook ignoring unscoped parent-session prompts instead of attributing them to running stages, preventing false `awaiting_input` / "needs attention" states from unrelated `ask_user_question` calls ([#1261](https://github.com/bastani-inc/atomic/issues/1261)).
|
|
55
|
+
|
|
56
|
+
## [0.8.26-alpha.4] - 2026-06-05
|
|
57
|
+
|
|
58
|
+
### Changed
|
|
59
|
+
|
|
60
|
+
- Upgraded builtin workflow fallback model tiers so degraded runs land on stronger models: bumped `github-copilot/claude-opus-4.8` fallbacks from `:medium` to `:xhigh` in `deep-research-codebase` and `ralph`, replaced `claude-sonnet-4-8`/`4.8` fallbacks with `claude-opus-4-8`/`4.8` in the `goal` and `ralph` runner configs, and raised `claude-sonnet-4-6`/`4.6` fallbacks from `:medium` to `:high` in `open-claude-design` ([#1259](https://github.com/bastani-inc/atomic/issues/1259)).
|
|
61
|
+
|
|
62
|
+
## [0.8.26-alpha.3] - 2026-06-05
|
|
63
|
+
|
|
64
|
+
### Changed
|
|
65
|
+
|
|
66
|
+
- Changed the builtin `ralph` workflow to include the workflow current working directory in every stage prompt so planner, implementation, simplification, review, and PR handoff stages keep repository work anchored to the workflow checkout.
|
|
67
|
+
- Changed the builtin `ralph` workflow to skip pull-request creation by default unless `create_pr=true`, omit `pr_report` when disabled, and keep provider-aware PR/MR/review creation instructions in the final stage ([#1255](https://github.com/bastani-inc/atomic/issues/1255)).
|
|
68
|
+
|
|
69
|
+
## [0.8.26-alpha.2] - 2026-06-05
|
|
70
|
+
|
|
71
|
+
### Changed
|
|
72
|
+
|
|
73
|
+
- Updated the `research-codebase` skill to capture a `breaking_changes_allowed` compatibility posture before research fanout, carry it through sub-agent prompts, and record it in research documents so downstream specs and workflows do not preserve legacy APIs by default when breaking changes are allowed ([#1225](https://github.com/bastani-inc/atomic/issues/1225)).
|
|
74
|
+
|
|
75
|
+
### Fixed
|
|
76
|
+
|
|
77
|
+
- Fixed stage-local workflow HIL `input` and `editor` prompts losing draft text across Ctrl+D detach/reattach; drafts are kept live-only in memory and cleared when the prompt or run/stage exits ([#1179](https://github.com/bastani-inc/atomic/issues/1179)).
|
|
78
|
+
- Fixed workflow worktree Git commands to strip ambient repository-local Git environment variables before inspecting or creating targeted worktrees.
|
|
79
|
+
- Suppressed intermediate model fallback failure warnings from successful workflow stages while preserving final failures and raw per-attempt diagnostics ([#1226](https://github.com/bastani-inc/atomic/issues/1226)).
|
|
80
|
+
|
|
9
81
|
## [0.8.26-alpha.1] - 2026-06-05
|
|
10
82
|
|
|
11
83
|
### Fixed
|
|
@@ -587,20 +587,22 @@ Child workflow outputs: `result`, `status`, `approved`, `goal_id`, `objective`,
|
|
|
587
587
|
|
|
588
588
|
### `ralph`
|
|
589
589
|
|
|
590
|
-
Plan → orchestrate → simplify → review
|
|
590
|
+
Plan → orchestrate → simplify → review workflow with optional final-stage PR handoff: write an RFC-style technical design document under `specs/`, delegate implementation through sub-agents, simplify recent changes, run parallel reviewers, and iterate until approval or the loop limit. Ralph skips PR creation by default; prompt text alone does not opt in. Pass `create_pr=true` to authorize only the final `pull-request` stage to inspect provider credentials and attempt provider-appropriate PR/MR/review creation (for example GitHub `gh`, Azure Repos `az repos pr create`, or Sapling/Phabricator tooling). Ralph's own PR-creation instructions live in that final stage. Reviewers inspect repository infrastructure directly as needed; Ralph no longer runs separate `infra-*` discovery stages.
|
|
591
591
|
|
|
592
592
|
```text
|
|
593
593
|
/workflow ralph prompt="Plan and migrate the database layer to Drizzle ORM" max_loops=3 base_branch=develop
|
|
594
|
+
/workflow ralph prompt="Plan and migrate the database layer to Drizzle ORM" max_loops=3 base_branch=develop create_pr=true
|
|
594
595
|
```
|
|
595
596
|
|
|
596
|
-
| Input
|
|
597
|
-
|
|
|
598
|
-
| `prompt`
|
|
599
|
-
| `max_loops` | `number`
|
|
600
|
-
| `base_branch` | `string`
|
|
601
|
-
| `git_worktree_dir` | `string`
|
|
597
|
+
| Input | Type | Required | Default | Description |
|
|
598
|
+
| ------------------ | --------- | -------- | ------------- | ------------------------------------------------------------- |
|
|
599
|
+
| `prompt` | `text` | ✓ | — | Task, feature request, issue summary, or spec path to plan, execute, refine, and review. |
|
|
600
|
+
| `max_loops` | `number` | — | `10` | Maximum plan/orchestrate/review iterations before completion or optional final handoff. |
|
|
601
|
+
| `base_branch` | `string` | — | `origin/main` | Branch reviewers and the optional final stage compare the current delta with; also used to create a missing worktree. |
|
|
602
|
+
| `git_worktree_dir` | `string` | — | `""` | Optional reusable Git worktree root. Empty runs in the invoking checkout; non-empty values run Ralph stages in the created/reused worktree. |
|
|
603
|
+
| `create_pr` | `boolean` | — | `false` | Safe-by-default PR creation flag. Omitted or `false` skips the final `pull-request` stage and omits `pr_report`; prompt text alone does not opt in, and only strict `true` authorizes the final `pull-request` stage to attempt provider-appropriate PR/MR/review creation. |
|
|
602
604
|
|
|
603
|
-
Child workflow outputs: `result`, `plan`, `plan_path`, `implementation_notes_path`, `
|
|
605
|
+
Child workflow outputs: `result`, `plan`, `plan_path`, `implementation_notes_path`, `approved`, `iterations_completed`, `review_report`, and `review_report_path`. `pr_report` is included only when `create_pr=true` and the final `pull-request` stage runs.
|
|
604
606
|
|
|
605
607
|
### `open-claude-design`
|
|
606
608
|
|