@bastani/atomic 0.9.18-alpha.5 → 0.9.18-alpha.7
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 +88 -0
- package/README.md +3 -3
- package/dist/builtin/intercom/CHANGELOG.md +39 -0
- package/dist/builtin/intercom/README.md +22 -2
- package/dist/builtin/intercom/broker/broker.ts +676 -128
- package/dist/builtin/intercom/broker/client.ts +151 -35
- package/dist/builtin/intercom/broker/delivered-message-cache.ts +497 -37
- package/dist/builtin/intercom/broker/framing.ts +4 -2
- package/dist/builtin/intercom/broker/paths.ts +10 -0
- package/dist/builtin/intercom/broker/pending-send-registry.ts +1 -2
- package/dist/builtin/intercom/broker/send-handler.ts +311 -52
- package/dist/builtin/intercom/broker/send-signature.ts +4 -2
- package/dist/builtin/intercom/broker/socket-writes.ts +103 -0
- package/dist/builtin/intercom/broker/spawn.ts +9 -4
- package/dist/builtin/intercom/index.bundle.mjs +1410 -212
- package/dist/builtin/intercom/package.json +2 -2
- package/dist/builtin/intercom/recoverable-disconnect.ts +52 -0
- package/dist/builtin/intercom/retry-policy.ts +8 -0
- package/dist/builtin/intercom/skills/intercom/SKILL.md +17 -9
- package/dist/builtin/intercom/types.ts +27 -8
- package/dist/builtin/intercom/workflow-stage-path-matching.ts +90 -0
- package/dist/builtin/intercom/workflow-stage-target.ts +57 -0
- package/dist/builtin/mcp/index.bundle.mjs +427 -126
- package/dist/builtin/mcp/package.json +2 -2
- package/dist/builtin/subagents/CHANGELOG.md +19 -0
- package/dist/builtin/subagents/README.md +3 -3
- package/dist/builtin/subagents/agents/code-simplifier.md +2 -2
- package/dist/builtin/subagents/agents/codebase-analyzer.md +2 -2
- package/dist/builtin/subagents/agents/codebase-locator.md +2 -2
- package/dist/builtin/subagents/agents/codebase-online-researcher.md +11 -11
- package/dist/builtin/subagents/agents/codebase-pattern-finder.md +2 -2
- package/dist/builtin/subagents/agents/codebase-research-analyzer.md +2 -2
- package/dist/builtin/subagents/agents/codebase-research-locator.md +2 -2
- package/dist/builtin/subagents/agents/debugger.md +3 -3
- package/dist/builtin/subagents/agents/worker.md +2 -2
- package/dist/builtin/subagents/package.json +3 -3
- package/dist/builtin/subagents/skills/qlty/SKILL.md +29 -101
- package/dist/builtin/subagents/skills/qlty/references/manual-configuration.md +52 -0
- package/dist/builtin/subagents/skills/subagent/SKILL.md +11 -11
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +49 -132
- package/dist/builtin/web-access/package.json +2 -2
- package/dist/builtin/workflows/CHANGELOG.md +46 -0
- package/dist/builtin/workflows/README.md +7 -7
- package/dist/builtin/workflows/builtin/adversarial-verification.js +2 -2
- package/dist/builtin/workflows/builtin/{chunk-szz1ajz9.js → chunk-42s7sw0b.js} +9 -2
- package/dist/builtin/workflows/builtin/{chunk-2dqb5s2q.js → chunk-79fjkcvh.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-n58a7v26.js → chunk-b0v2xab1.js} +181 -10
- package/dist/builtin/workflows/builtin/{chunk-fghhy2a5.js → chunk-ed4jfn5t.js} +23 -5
- package/dist/builtin/workflows/builtin/{chunk-h3r2vkzc.js → chunk-hqpe2cyx.js} +60 -21
- package/dist/builtin/workflows/builtin/{chunk-hzzn6adg.js → chunk-k3w87x8y.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-82ha8p41.js → chunk-n8h4yyew.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-qwzvgxnq.js → chunk-reqr3sr3.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-c53y8bdh.js → chunk-wgccch41.js} +1 -1
- package/dist/builtin/workflows/builtin/{chunk-0x6e303p.js → chunk-zbekjqew.js} +20 -7
- package/dist/builtin/workflows/builtin/{chunk-29wrp38a.js → chunk-ze5x3d1r.js} +1 -1
- package/dist/builtin/workflows/builtin/classify-and-act.js +2 -2
- package/dist/builtin/workflows/builtin/fan-out-and-synthesize.js +2 -2
- package/dist/builtin/workflows/builtin/generate-and-filter.js +2 -2
- package/dist/builtin/workflows/builtin/goal.js +3 -3
- package/dist/builtin/workflows/builtin/index.js +11 -11
- package/dist/builtin/workflows/builtin/loop-until-done.js +2 -2
- package/dist/builtin/workflows/builtin/open-claude-design.js +2 -2
- package/dist/builtin/workflows/builtin/ralph.js +3 -3
- package/dist/builtin/workflows/builtin/steering-context.js +1 -1
- package/dist/builtin/workflows/builtin/tournament.js +2 -2
- package/dist/builtin/workflows/package.json +2 -2
- package/dist/builtin/workflows/skills/prompt-engineer/SKILL.md +39 -52
- package/dist/builtin/workflows/skills/prompt-engineer/references/advanced_patterns.md +9 -37
- package/dist/builtin/workflows/skills/prompt-engineer/references/claude_fable_5.md +49 -0
- package/dist/builtin/workflows/skills/prompt-engineer/references/claude_fable_5_1.md +57 -0
- package/dist/builtin/workflows/skills/prompt-engineer/references/claude_opus_4_8.md +57 -0
- package/dist/builtin/workflows/skills/prompt-engineer/references/claude_opus_5.md +47 -0
- package/dist/builtin/workflows/skills/prompt-engineer/references/claude_sonnet_5.md +57 -0
- package/dist/builtin/workflows/skills/prompt-engineer/references/gpt_5_5.md +60 -0
- package/dist/builtin/workflows/skills/prompt-engineer/references/gpt_5_6.md +58 -0
- package/dist/builtin/workflows/skills/prompt-engineer/references/gpt_6_astra.md +58 -0
- package/dist/builtin/workflows/skills/prompt-engineer/references/quality_improvement.md +18 -4
- package/dist/builtin/workflows/src/extension/index.bundle.mjs +3194 -737
- package/dist/builtin/workflows/src/index.js +899 -436
- package/dist/builtin/workflows/src/shared/authoring-contract-stage.d.ts +0 -10
- package/dist/cli/list-models.d.ts.map +1 -1
- package/dist/cli/list-models.js +4 -0
- package/dist/cli/list-models.js.map +1 -1
- package/dist/client/index.d.ts +1 -2
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +1 -2
- package/dist/client/index.js.map +1 -1
- package/dist/config.d.ts +0 -9
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +0 -45
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session-compaction.d.ts.map +1 -1
- package/dist/core/agent-session-compaction.js +8 -6
- package/dist/core/agent-session-compaction.js.map +1 -1
- package/dist/core/agent-session-methods.d.ts +1 -0
- 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-models.d.ts.map +1 -1
- package/dist/core/agent-session-models.js +3 -4
- package/dist/core/agent-session-models.js.map +1 -1
- package/dist/core/agent-session-queue-pause.d.ts.map +1 -1
- package/dist/core/agent-session-queue-pause.js +6 -0
- package/dist/core/agent-session-queue-pause.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +13 -5
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-tool-hooks.js +1 -1
- package/dist/core/agent-session-tool-hooks.js.map +1 -1
- package/dist/core/agent-session-tree.d.ts.map +1 -1
- package/dist/core/agent-session-tree.js +8 -0
- package/dist/core/agent-session-tree.js.map +1 -1
- package/dist/core/agent-session.d.ts +2 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +2 -0
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts +2 -2
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +4 -4
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/extensions/api-types.d.ts +8 -2
- package/dist/core/extensions/api-types.d.ts.map +1 -1
- package/dist/core/extensions/api-types.js.map +1 -1
- package/dist/core/extensions/context-types.d.ts +12 -0
- package/dist/core/extensions/context-types.d.ts.map +1 -1
- package/dist/core/extensions/context-types.js.map +1 -1
- package/dist/core/extensions/runner-shortcuts.d.ts.map +1 -1
- package/dist/core/extensions/runner-shortcuts.js +0 -1
- package/dist/core/extensions/runner-shortcuts.js.map +1 -1
- package/dist/core/fast-model-routing-transport.d.ts +12 -0
- package/dist/core/fast-model-routing-transport.d.ts.map +1 -0
- package/dist/core/{codex-fast-mode-transport.js → fast-model-routing-transport.js} +29 -29
- package/dist/core/fast-model-routing-transport.js.map +1 -0
- package/dist/core/fast-model-routing.d.ts +57 -0
- package/dist/core/fast-model-routing.d.ts.map +1 -0
- package/dist/core/fast-model-routing.js +201 -0
- package/dist/core/fast-model-routing.js.map +1 -0
- package/dist/core/fast-model-variants.d.ts +98 -0
- package/dist/core/fast-model-variants.d.ts.map +1 -0
- package/dist/core/fast-model-variants.js +148 -0
- package/dist/core/fast-model-variants.js.map +1 -0
- package/dist/core/http-dispatcher.d.ts.map +1 -1
- package/dist/core/http-dispatcher.js +4 -2
- package/dist/core/http-dispatcher.js.map +1 -1
- package/dist/core/keybindings.d.ts +0 -10
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +0 -8
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/messages.d.ts +1 -1
- package/dist/core/messages.d.ts.map +1 -1
- package/dist/core/messages.js.map +1 -1
- package/dist/core/model-config.d.ts +15 -0
- package/dist/core/model-config.d.ts.map +1 -1
- package/dist/core/model-config.js +3 -0
- package/dist/core/model-config.js.map +1 -1
- package/dist/core/model-resolver-initial.js +1 -1
- package/dist/core/model-resolver-initial.js.map +1 -1
- package/dist/core/model-runtime-streaming.d.ts +14 -1
- package/dist/core/model-runtime-streaming.d.ts.map +1 -1
- package/dist/core/model-runtime-streaming.js +25 -3
- package/dist/core/model-runtime-streaming.js.map +1 -1
- package/dist/core/model-runtime.d.ts +39 -2
- package/dist/core/model-runtime.d.ts.map +1 -1
- package/dist/core/model-runtime.js +91 -7
- package/dist/core/model-runtime.js.map +1 -1
- package/dist/core/provider-composer-internal.d.ts.map +1 -1
- package/dist/core/provider-composer-internal.js +8 -2
- package/dist/core/provider-composer-internal.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +18 -18
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager-archive.d.ts.map +1 -1
- package/dist/core/session-manager-archive.js +25 -2
- package/dist/core/session-manager-archive.js.map +1 -1
- package/dist/core/settings-manager-core.d.ts +0 -2
- package/dist/core/settings-manager-core.d.ts.map +1 -1
- package/dist/core/settings-manager-core.js +2 -9
- package/dist/core/settings-manager-core.js.map +1 -1
- package/dist/core/settings-manager-internals.d.ts +0 -1
- package/dist/core/settings-manager-internals.d.ts.map +1 -1
- package/dist/core/settings-manager-internals.js.map +1 -1
- package/dist/core/settings-manager-ui-accessors.d.ts +0 -8
- package/dist/core/settings-manager-ui-accessors.d.ts.map +1 -1
- package/dist/core/settings-manager-ui-accessors.js +0 -53
- package/dist/core/settings-manager-ui-accessors.js.map +1 -1
- package/dist/core/settings-manager.d.ts +1 -1
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/settings-types.d.ts +0 -5
- package/dist/core/settings-types.d.ts.map +1 -1
- package/dist/core/settings-types.js.map +1 -1
- package/dist/core/skills.d.ts +1 -1
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +4 -2
- package/dist/core/skills.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +0 -1
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/system-prompt.js +7 -7
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/edit.d.ts +1 -1
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +128 -3
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/hashline.d.ts +2 -2
- package/dist/core/tools/hashline.d.ts.map +1 -1
- package/dist/core/tools/hashline.js +40 -10
- package/dist/core/tools/hashline.js.map +1 -1
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +8 -8
- package/dist/core/tools/write.js.map +1 -1
- package/dist/core/workflow-stage-admission.d.ts +6 -0
- package/dist/core/workflow-stage-admission.d.ts.map +1 -1
- package/dist/core/workflow-stage-admission.js +14 -0
- package/dist/core/workflow-stage-admission.js.map +1 -1
- package/dist/index-extensions.d.ts +1 -1
- package/dist/index-extensions.d.ts.map +1 -1
- package/dist/index-extensions.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -5
- package/dist/index.js.map +1 -1
- package/dist/modes/interactive/components/atomic-working-status.d.ts +4 -0
- package/dist/modes/interactive/components/atomic-working-status.d.ts.map +1 -1
- package/dist/modes/interactive/components/atomic-working-status.js +26 -1
- package/dist/modes/interactive/components/atomic-working-status.js.map +1 -1
- package/dist/modes/interactive/components/custom-editor.d.ts +7 -0
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-editor.js +43 -0
- package/dist/modes/interactive/components/custom-editor.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +0 -6
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/index.d.ts +1 -2
- package/dist/modes/interactive/components/index.d.ts.map +1 -1
- package/dist/modes/interactive/components/index.js +0 -1
- package/dist/modes/interactive/components/index.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +6 -11
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts +2 -5
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +3 -19
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector-items.js +1 -1
- package/dist/modes/interactive/components/settings-selector-items.js.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.d.ts +1 -2
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.js +4 -11
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
- package/dist/modes/interactive/components/transcript-follow-indicator.js +3 -3
- package/dist/modes/interactive/components/transcript-follow-indicator.js.map +1 -1
- package/dist/modes/interactive/interactive-agent-events.js +8 -8
- package/dist/modes/interactive/interactive-agent-events.js.map +1 -1
- package/dist/modes/interactive/interactive-autocomplete.js +5 -16
- package/dist/modes/interactive/interactive-autocomplete.js.map +1 -1
- package/dist/modes/interactive/interactive-bash-compact.js +2 -9
- package/dist/modes/interactive/interactive-bash-compact.js.map +1 -1
- package/dist/modes/interactive/interactive-deferred-startup.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-deferred-startup.js +3 -0
- package/dist/modes/interactive/interactive-deferred-startup.js.map +1 -1
- package/dist/modes/interactive/interactive-editor-actions.js +2 -2
- package/dist/modes/interactive/interactive-editor-actions.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-custom-ui.js +1 -0
- package/dist/modes/interactive/interactive-extension-custom-ui.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-dialogs.js +7 -0
- package/dist/modes/interactive/interactive-extension-dialogs.js.map +1 -1
- package/dist/modes/interactive/interactive-extension-runtime.js +20 -10
- package/dist/modes/interactive/interactive-extension-runtime.js.map +1 -1
- package/dist/modes/interactive/interactive-hotkeys-debug.js +1 -5
- package/dist/modes/interactive/interactive-hotkeys-debug.js.map +1 -1
- package/dist/modes/interactive/interactive-initial-session-binding.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-initial-session-binding.js +3 -0
- package/dist/modes/interactive/interactive-initial-session-binding.js.map +1 -1
- package/dist/modes/interactive/interactive-input-handling.js +0 -8
- package/dist/modes/interactive/interactive-input-handling.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.d.ts +5 -1
- package/dist/modes/interactive/interactive-mode-base.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-base.js +15 -9
- package/dist/modes/interactive/interactive-mode-base.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-deps.d.ts +1 -3
- package/dist/modes/interactive/interactive-mode-deps.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode-deps.js +1 -3
- package/dist/modes/interactive/interactive-mode-deps.js.map +1 -1
- package/dist/modes/interactive/interactive-mode-surface.d.ts +9 -12
- 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-model-routing.js +10 -13
- package/dist/modes/interactive/interactive-model-routing.js.map +1 -1
- package/dist/modes/interactive/interactive-render-chat.js +29 -0
- package/dist/modes/interactive/interactive-render-chat.js.map +1 -1
- package/dist/modes/interactive/interactive-selectors.js +2 -32
- package/dist/modes/interactive/interactive-selectors.js.map +1 -1
- package/dist/modes/interactive/interactive-session-routing.js +1 -5
- package/dist/modes/interactive/interactive-session-routing.js.map +1 -1
- package/dist/modes/interactive/interactive-session-runtime.js +1 -5
- package/dist/modes/interactive/interactive-session-runtime.js.map +1 -1
- package/dist/modes/interactive/interactive-slash-commands.js +6 -13
- package/dist/modes/interactive/interactive-slash-commands.js.map +1 -1
- package/dist/modes/interactive/interactive-startup.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-startup.js +19 -13
- package/dist/modes/interactive/interactive-startup.js.map +1 -1
- package/dist/modes/interactive/interactive-tui.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-tui.js +27 -3
- package/dist/modes/interactive/interactive-tui.js.map +1 -1
- package/dist/modes/interactive-engine/engine-custom-ui.d.ts.map +1 -1
- package/dist/modes/interactive-engine/engine-custom-ui.js +1 -0
- package/dist/modes/interactive-engine/engine-custom-ui.js.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.d.ts.map +1 -1
- package/dist/modes/interactive-engine/isolated-runtime.js +4 -1
- package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -1
- package/dist/utils/child-process.d.ts.map +1 -1
- package/dist/utils/child-process.js +13 -6
- package/dist/utils/child-process.js.map +1 -1
- package/dist/utils/exif-orientation.d.ts.map +1 -1
- package/dist/utils/exif-orientation.js +2 -3
- package/dist/utils/exif-orientation.js.map +1 -1
- package/dist/utils/tools-manager.d.ts +1 -0
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +33 -18
- package/dist/utils/tools-manager.js.map +1 -1
- package/docs/custom-provider.md +2 -0
- package/docs/development.md +17 -0
- package/docs/docs.json +14 -2
- package/docs/extensions.md +9 -4
- package/docs/intercom.md +41 -7
- package/docs/keybindings.md +8 -6
- package/docs/models/evals.md +394 -0
- package/docs/models/model-selection.md +54 -27
- package/docs/models/pareto-efficiency.md +33 -16
- package/docs/models.md +37 -1
- package/docs/packages.md +2 -2
- package/docs/providers.md +44 -20
- package/docs/quickstart.md +8 -6
- package/docs/rpc.md +3 -3
- package/docs/sdk.md +2 -16
- package/docs/settings.md +19 -22
- package/docs/skills.md +4 -2
- package/docs/subagents.md +9 -3
- package/docs/tools/edit.md +373 -0
- package/docs/tools.md +3 -7
- package/docs/tui.md +2 -1
- package/docs/usage.md +3 -5
- package/docs/workflows/api-reference.md +1395 -0
- package/docs/workflows/authoring.md +678 -0
- package/docs/workflows/builtins.md +245 -0
- package/docs/workflows/operations.md +811 -0
- package/docs/workflows/reliable-design.md +2099 -0
- package/docs/workflows/verification.md +62 -0
- package/docs/workflows.md +15 -5183
- package/npm-shrinkwrap.json +584 -69
- package/package.json +7 -7
- package/dist/client/remote-session.d.ts +0 -64
- package/dist/client/remote-session.d.ts.map +0 -1
- package/dist/client/remote-session.js +0 -351
- package/dist/client/remote-session.js.map +0 -1
- package/dist/client/transcript.d.ts +0 -12
- package/dist/client/transcript.d.ts.map +0 -1
- package/dist/client/transcript.js +0 -98
- package/dist/client/transcript.js.map +0 -1
- package/dist/core/codex-fast-mode-transport.d.ts +0 -12
- package/dist/core/codex-fast-mode-transport.d.ts.map +0 -1
- package/dist/core/codex-fast-mode-transport.js.map +0 -1
- package/dist/core/codex-fast-mode.d.ts +0 -53
- package/dist/core/codex-fast-mode.d.ts.map +0 -1
- package/dist/core/codex-fast-mode.js +0 -249
- package/dist/core/codex-fast-mode.js.map +0 -1
- package/dist/modes/interactive/components/fast-mode-selector.d.ts +0 -27
- package/dist/modes/interactive/components/fast-mode-selector.d.ts.map +0 -1
- package/dist/modes/interactive/components/fast-mode-selector.js +0 -107
- package/dist/modes/interactive/components/fast-mode-selector.js.map +0 -1
- package/dist/server/create-harness.d.ts +0 -53
- package/dist/server/create-harness.d.ts.map +0 -1
- package/dist/server/create-harness.js +0 -360
- package/dist/server/create-harness.js.map +0 -1
- package/docs/models/artificial-analysis-index.md +0 -83
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { AgentHarness, type AgentHarnessOptions, type ExecutionEnv, type HarnessTool } from "@earendil-works/pi-agent-core";
|
|
2
|
-
import { type BuildSystemPromptOptions } from "../core/system-prompt.ts";
|
|
3
|
-
export interface CodingAgentHarnessTool extends HarnessTool {
|
|
4
|
-
promptSnippet?: string;
|
|
5
|
-
promptGuidelines?: string[];
|
|
6
|
-
}
|
|
7
|
-
export interface CreateCodingAgentHarnessOptions extends Omit<AgentHarnessOptions, "toolContext" | "tools"> {
|
|
8
|
-
env: ExecutionEnv;
|
|
9
|
-
bashCommandPrefix?: string;
|
|
10
|
-
/** Path to the JSONL session file exposed to default bash commands as ATOMIC_SESSION_FILE and PI_SESSION_FILE. */
|
|
11
|
-
sessionFile?: string;
|
|
12
|
-
tools?: CodingAgentHarnessTool[];
|
|
13
|
-
systemPromptOptions?: Omit<BuildSystemPromptOptions, "cwd" | "promptGuidelines" | "selectedTools" | "toolSnippets">;
|
|
14
|
-
}
|
|
15
|
-
export interface BuildCodingAgentHarnessSystemPromptOptions {
|
|
16
|
-
cwd: string;
|
|
17
|
-
tools: readonly CodingAgentHarnessTool[];
|
|
18
|
-
activeToolNames: readonly string[];
|
|
19
|
-
systemPromptOptions?: CreateCodingAgentHarnessOptions["systemPromptOptions"];
|
|
20
|
-
}
|
|
21
|
-
export declare function buildCodingAgentHarnessSystemPrompt(options: BuildCodingAgentHarnessSystemPromptOptions): string;
|
|
22
|
-
/**
|
|
23
|
-
* AgentHarness v2 is a configuration scaffold in pi-agent-core 0.84.1. The
|
|
24
|
-
* factory setup reaches `AgentHarness.create` (for a fresh session),
|
|
25
|
-
* `Session.getMetadata`, `getModel`, `getThinkingLevel`, `getTools`,
|
|
26
|
-
* `getActiveTools`, the default system-prompt callback, Atomic tool execution,
|
|
27
|
-
* and `close()` on the returned harness. The returned harness also exposes the
|
|
28
|
-
* implemented state/configuration getters and setters for model, thinking
|
|
29
|
-
* level, active tools, tools, resources, stream options, retry, compaction,
|
|
30
|
-
* steering, and follow-up modes. Its default tools route the primary operations
|
|
31
|
-
* for read, bash, edit, write, and find through the injected `ExecutionEnv`;
|
|
32
|
-
* read and edit still use Atomic's local path-variant probes and notebook
|
|
33
|
-
* projection; read also uses local archive, SQLite, and internal-resource
|
|
34
|
-
* selectors, while write still uses local generated-file, shebang, conflict,
|
|
35
|
-
* and resource helpers. Bash validates its cwd locally and uses Atomic's local
|
|
36
|
-
* temp storage for overflow output. URL fetches use the process network and do
|
|
37
|
-
* not persist host-local artifacts in this factory. `search` still uses Atomic's
|
|
38
|
-
* local filesystem/ripgrep pipeline
|
|
39
|
-
* until that tool gains a complete remote operations seam. It does not invoke
|
|
40
|
-
* `prompt`, `skill`,
|
|
41
|
-
* `promptFromTemplate`, `compact`, `navigateTree`, `resume`, `steer`, `followUp`,
|
|
42
|
-
* `nextRun`, `cancelQueued`, `recordUsage`, `abort`, `waitForIdle`,
|
|
43
|
-
* `runWhenIdle`, `peekAction`, `executeAction`, `runToCompletion`, `watch`,
|
|
44
|
-
* `lane`, `createLane`, `lanes`, `watchSession`, `hooks.on`, or `events.on`;
|
|
45
|
-
* those unfinished paths reject with `HarnessNotImplemented` at runtime. A
|
|
46
|
-
* session with existing records also reaches `create.restore`, which is
|
|
47
|
-
* intentionally outside this factory layer.
|
|
48
|
-
*/
|
|
49
|
-
export declare function createCodingAgentHarness(options: CreateCodingAgentHarnessOptions): Promise<{
|
|
50
|
-
harness: AgentHarness;
|
|
51
|
-
suspended: import("@earendil-works/pi-agent-core").SuspendedOperation[];
|
|
52
|
-
}>;
|
|
53
|
-
//# sourceMappingURL=create-harness.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-harness.d.ts","sourceRoot":"","sources":["../../src/server/create-harness.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,YAAY,EACZ,KAAK,mBAAmB,EACxB,KAAK,YAAY,EAIjB,KAAK,WAAW,EAEhB,MAAM,+BAA+B,CAAC;AAMvC,OAAO,EAAE,KAAK,wBAAwB,EAAqB,MAAM,0BAA0B,CAAC;AAK5F,MAAM,WAAW,sBAAuB,SAAQ,WAAW;IAC1D,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC5B;AAgQD,MAAM,WAAW,+BAAgC,SAAQ,IAAI,CAAC,mBAAmB,EAAE,aAAa,GAAG,OAAO,CAAC;IAC1G,GAAG,EAAE,YAAY,CAAC;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kHAAkH;IAClH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,sBAAsB,EAAE,CAAC;IACjC,mBAAmB,CAAC,EAAE,IAAI,CAAC,wBAAwB,EAAE,KAAK,GAAG,kBAAkB,GAAG,eAAe,GAAG,cAAc,CAAC,CAAC;CACpH;AAED,MAAM,WAAW,0CAA0C;IAC1D,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,SAAS,sBAAsB,EAAE,CAAC;IACzC,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,mBAAmB,CAAC,EAAE,+BAA+B,CAAC,qBAAqB,CAAC,CAAC;CAC7E;AAED,wBAAgB,mCAAmC,CAAC,OAAO,EAAE,0CAA0C,GAAG,MAAM,CAsB/G;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAsB,wBAAwB,CAAC,OAAO,EAAE,+BAA+B;;;GAkFtF"}
|
|
@@ -1,360 +0,0 @@
|
|
|
1
|
-
import { AgentHarness, } from "@earendil-works/pi-agent-core";
|
|
2
|
-
import { minimatch } from "minimatch";
|
|
3
|
-
import { getExperimentalToolSampling } from "../core/experimental.js";
|
|
4
|
-
import { buildSystemPrompt } from "../core/system-prompt.js";
|
|
5
|
-
import { createCodingToolDefinitions } from "../core/tools/index.js";
|
|
6
|
-
import { detectSupportedImageMimeType } from "../utils/mime.js";
|
|
7
|
-
function createCodingAgentHarnessTool(options) {
|
|
8
|
-
const { definition, getContext } = options;
|
|
9
|
-
const experimentalSampling = getExperimentalToolSampling();
|
|
10
|
-
return {
|
|
11
|
-
...definition,
|
|
12
|
-
promptSnippet: definition.promptSnippet,
|
|
13
|
-
promptGuidelines: definition.promptGuidelines ? [...definition.promptGuidelines] : undefined,
|
|
14
|
-
// Compose rather than double-wrap: a definition that already constrains its
|
|
15
|
-
// own sampling (including an explicit `false` opt-out, e.g. a structured-output
|
|
16
|
-
// tool constraining its caller-supplied schema) keeps that constraint; only
|
|
17
|
-
// unconstrained definitions pick up the experimental strict default. When
|
|
18
|
-
// neither applies the key stays absent — key presence is semantic downstream.
|
|
19
|
-
...(definition.constrainedSampling === undefined && experimentalSampling === undefined
|
|
20
|
-
? {}
|
|
21
|
-
: { constrainedSampling: definition.constrainedSampling ?? experimentalSampling }),
|
|
22
|
-
execute: async (toolCallId, params, signal, onUpdate) => definition.execute(toolCallId, params, signal, onUpdate, await getContext()),
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
function normalizeBashExecutionError(error, timeout) {
|
|
26
|
-
if (error.code === "aborted")
|
|
27
|
-
return new Error("aborted", { cause: error });
|
|
28
|
-
if (error.code === "timeout") {
|
|
29
|
-
const message = error.message.startsWith("timeout:") ? error.message : `timeout:${timeout ?? ""}`;
|
|
30
|
-
return new Error(message, { cause: error });
|
|
31
|
-
}
|
|
32
|
-
return error;
|
|
33
|
-
}
|
|
34
|
-
function unwrapFileResult(result) {
|
|
35
|
-
if (result.ok)
|
|
36
|
-
return result.value;
|
|
37
|
-
throw result.error;
|
|
38
|
-
}
|
|
39
|
-
function unsupportedHarnessOperation(operation) {
|
|
40
|
-
throw new Error(`Coding-agent Harness does not provide ${operation}`);
|
|
41
|
-
}
|
|
42
|
-
async function findExecutionEnvGlob(env, pattern, root, options) {
|
|
43
|
-
const matches = [];
|
|
44
|
-
const normalizedPattern = pattern.replaceAll("\\", "/");
|
|
45
|
-
const matchOptions = { dot: true, matchBase: !normalizedPattern.includes("/") };
|
|
46
|
-
const hasHiddenSegment = (value) => value.split("/").some((segment) => segment.startsWith(".") && segment.length > 1);
|
|
47
|
-
const isIgnored = (value, isDirectory) => options.ignore.some((ignorePattern) => minimatch(value, ignorePattern, { dot: true }) ||
|
|
48
|
-
(isDirectory && minimatch(`${value}/__entry__`, ignorePattern, { dot: true })));
|
|
49
|
-
const walk = async (directory, prefix) => {
|
|
50
|
-
if (matches.length >= options.limit)
|
|
51
|
-
return;
|
|
52
|
-
const result = await env.listDir(directory);
|
|
53
|
-
if (!result.ok)
|
|
54
|
-
return;
|
|
55
|
-
const entries = result.value.sort((left, right) => left.name.localeCompare(right.name));
|
|
56
|
-
for (const entry of entries) {
|
|
57
|
-
if (matches.length >= options.limit)
|
|
58
|
-
return;
|
|
59
|
-
const relativePath = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
60
|
-
if (!options.hidden && hasHiddenSegment(relativePath))
|
|
61
|
-
continue;
|
|
62
|
-
const isDirectory = entry.kind === "directory";
|
|
63
|
-
if (isIgnored(relativePath, isDirectory))
|
|
64
|
-
continue;
|
|
65
|
-
if (minimatch(relativePath, normalizedPattern, matchOptions))
|
|
66
|
-
matches.push(isDirectory ? `${relativePath}/` : relativePath);
|
|
67
|
-
if (isDirectory)
|
|
68
|
-
await walk(entry.path, relativePath);
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
const rootInfo = await env.fileInfo(root);
|
|
72
|
-
let walkRoot = root;
|
|
73
|
-
if (rootInfo.ok && rootInfo.value.kind === "symlink") {
|
|
74
|
-
const canonical = await env.canonicalPath(root);
|
|
75
|
-
if (canonical.ok)
|
|
76
|
-
walkRoot = canonical.value;
|
|
77
|
-
}
|
|
78
|
-
await walk(walkRoot, "");
|
|
79
|
-
return matches;
|
|
80
|
-
}
|
|
81
|
-
async function findExecutionEnvStat(env, path) {
|
|
82
|
-
const result = await env.fileInfo(path);
|
|
83
|
-
if (!result.ok)
|
|
84
|
-
return undefined;
|
|
85
|
-
if (result.value.kind !== "symlink") {
|
|
86
|
-
return { isFile: result.value.kind === "file", isDirectory: result.value.kind === "directory" };
|
|
87
|
-
}
|
|
88
|
-
const canonical = await env.canonicalPath(path);
|
|
89
|
-
if (!canonical.ok)
|
|
90
|
-
return undefined;
|
|
91
|
-
const target = await env.fileInfo(canonical.value);
|
|
92
|
-
if (!target.ok)
|
|
93
|
-
return undefined;
|
|
94
|
-
return { isFile: target.value.kind === "file", isDirectory: target.value.kind === "directory" };
|
|
95
|
-
}
|
|
96
|
-
async function toExecutionEnvDirectoryEntry(env, info) {
|
|
97
|
-
if (info.kind !== "symlink")
|
|
98
|
-
return {
|
|
99
|
-
name: info.name,
|
|
100
|
-
path: info.path,
|
|
101
|
-
isDirectory: info.kind === "directory",
|
|
102
|
-
mtimeMs: info.mtimeMs,
|
|
103
|
-
size: info.size,
|
|
104
|
-
};
|
|
105
|
-
const canonical = await env.canonicalPath(info.path);
|
|
106
|
-
if (!canonical.ok)
|
|
107
|
-
return undefined;
|
|
108
|
-
const target = await env.fileInfo(canonical.value);
|
|
109
|
-
if (!target.ok)
|
|
110
|
-
return undefined;
|
|
111
|
-
return {
|
|
112
|
-
name: info.name,
|
|
113
|
-
path: canonical.value,
|
|
114
|
-
isDirectory: target.value.kind === "directory",
|
|
115
|
-
mtimeMs: target.value.mtimeMs,
|
|
116
|
-
size: target.value.size,
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
async function listExecutionEnvDirectory(env, path) {
|
|
120
|
-
let result = await env.listDir(path);
|
|
121
|
-
if (!result.ok) {
|
|
122
|
-
const info = await env.fileInfo(path);
|
|
123
|
-
if (!info.ok || info.value.kind !== "symlink")
|
|
124
|
-
return undefined;
|
|
125
|
-
const canonical = await env.canonicalPath(path);
|
|
126
|
-
if (!canonical.ok)
|
|
127
|
-
return undefined;
|
|
128
|
-
result = await env.listDir(canonical.value);
|
|
129
|
-
}
|
|
130
|
-
if (!result.ok)
|
|
131
|
-
return undefined;
|
|
132
|
-
const entries = await Promise.all(result.value.map((entry) => toExecutionEnvDirectoryEntry(env, entry)));
|
|
133
|
-
return entries.filter((entry) => entry !== undefined);
|
|
134
|
-
}
|
|
135
|
-
function createExecutionEnvToolOptions(env, commandPrefix, sessionFile) {
|
|
136
|
-
return {
|
|
137
|
-
read: {
|
|
138
|
-
operations: {
|
|
139
|
-
readFile: async (path) => Buffer.from(unwrapFileResult(await env.readBinaryFile(path))),
|
|
140
|
-
access: async (path) => {
|
|
141
|
-
unwrapFileResult(await env.fileInfo(path));
|
|
142
|
-
},
|
|
143
|
-
stat: (path) => findExecutionEnvStat(env, path),
|
|
144
|
-
listDir: (path) => listExecutionEnvDirectory(env, path),
|
|
145
|
-
detectImageMimeType: async (path) => detectSupportedImageMimeType(unwrapFileResult(await env.readBinaryFile(path))),
|
|
146
|
-
},
|
|
147
|
-
},
|
|
148
|
-
bash: {
|
|
149
|
-
commandPrefix,
|
|
150
|
-
// Atomic's bash tool normally hands operations the full local spawn
|
|
151
|
-
// environment. The injected ExecutionEnv owns the base environment;
|
|
152
|
-
// keep only the session and per-command overlays at this boundary.
|
|
153
|
-
spawnHook: (context) => ({ ...context, env: {} }),
|
|
154
|
-
operations: {
|
|
155
|
-
exec: async (command, cwd, options) => {
|
|
156
|
-
const envOverrides = {};
|
|
157
|
-
for (const [key, value] of Object.entries(options.env ?? {})) {
|
|
158
|
-
if (typeof value === "string")
|
|
159
|
-
envOverrides[key] = value;
|
|
160
|
-
}
|
|
161
|
-
if (sessionFile === undefined) {
|
|
162
|
-
envOverrides.ATOMIC_SESSION_FILE = "";
|
|
163
|
-
envOverrides.PI_SESSION_FILE = "";
|
|
164
|
-
}
|
|
165
|
-
const result = await env.exec(command, {
|
|
166
|
-
cwd,
|
|
167
|
-
env: envOverrides,
|
|
168
|
-
timeout: options.timeout,
|
|
169
|
-
abortSignal: options.signal,
|
|
170
|
-
onStdout: (chunk) => options.onData(Buffer.from(chunk), "stdout"),
|
|
171
|
-
onStderr: (chunk) => options.onData(Buffer.from(chunk), "stderr"),
|
|
172
|
-
});
|
|
173
|
-
if (!result.ok)
|
|
174
|
-
throw normalizeBashExecutionError(result.error, options.timeout);
|
|
175
|
-
return { exitCode: result.value.exitCode };
|
|
176
|
-
},
|
|
177
|
-
},
|
|
178
|
-
},
|
|
179
|
-
edit: {
|
|
180
|
-
operations: {
|
|
181
|
-
readFile: async (path) => Buffer.from(unwrapFileResult(await env.readBinaryFile(path))),
|
|
182
|
-
writeFile: async (path, content) => {
|
|
183
|
-
unwrapFileResult(await env.writeFile(path, content));
|
|
184
|
-
},
|
|
185
|
-
access: async (path) => {
|
|
186
|
-
const info = unwrapFileResult(await env.fileInfo(path));
|
|
187
|
-
if (info.kind !== "file" && info.kind !== "symlink")
|
|
188
|
-
throw new Error(`Cannot edit non-file path: ${path}`);
|
|
189
|
-
},
|
|
190
|
-
},
|
|
191
|
-
},
|
|
192
|
-
write: {
|
|
193
|
-
operations: {
|
|
194
|
-
writeFile: async (path, content) => {
|
|
195
|
-
unwrapFileResult(await env.writeFile(path, content));
|
|
196
|
-
},
|
|
197
|
-
mkdir: async (path) => {
|
|
198
|
-
unwrapFileResult(await env.createDir(path));
|
|
199
|
-
},
|
|
200
|
-
},
|
|
201
|
-
},
|
|
202
|
-
find: {
|
|
203
|
-
operations: {
|
|
204
|
-
exists: async (path) => {
|
|
205
|
-
const result = await env.exists(path);
|
|
206
|
-
return result.ok && result.value;
|
|
207
|
-
},
|
|
208
|
-
stat: (path) => findExecutionEnvStat(env, path),
|
|
209
|
-
glob: (pattern, cwd, globOptions) => findExecutionEnvGlob(env, pattern, cwd, globOptions),
|
|
210
|
-
},
|
|
211
|
-
},
|
|
212
|
-
};
|
|
213
|
-
}
|
|
214
|
-
function assertExecutionEnv(env) {
|
|
215
|
-
if (typeof env?.renameFile !== "function") {
|
|
216
|
-
throw new TypeError("Coding-agent Harness requires ExecutionEnv.renameFile() to be implemented");
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
function createHarnessSessionManager(metadataId, sessionFile) {
|
|
220
|
-
return {
|
|
221
|
-
getCwd: () => unsupportedHarnessOperation("sessionManager.getCwd()"),
|
|
222
|
-
// The factory has no local session directory. URL reads still use the session id for cache scope,
|
|
223
|
-
// but skip host-local artifact persistence rather than treating the ExecutionEnv cwd as local storage.
|
|
224
|
-
getSessionDir: () => "",
|
|
225
|
-
usesDefaultSessionDir: () => unsupportedHarnessOperation("sessionManager.usesDefaultSessionDir()"),
|
|
226
|
-
getSessionId: () => metadataId,
|
|
227
|
-
getSessionFile: () => sessionFile,
|
|
228
|
-
getLeafId: () => unsupportedHarnessOperation("sessionManager.getLeafId()"),
|
|
229
|
-
getLeafEntry: () => unsupportedHarnessOperation("sessionManager.getLeafEntry()"),
|
|
230
|
-
getEntry: () => unsupportedHarnessOperation("sessionManager.getEntry()"),
|
|
231
|
-
getLabel: () => unsupportedHarnessOperation("sessionManager.getLabel()"),
|
|
232
|
-
getBranch: () => unsupportedHarnessOperation("sessionManager.getBranch()"),
|
|
233
|
-
getHeader: () => unsupportedHarnessOperation("sessionManager.getHeader()"),
|
|
234
|
-
getEntries: () => unsupportedHarnessOperation("sessionManager.getEntries()"),
|
|
235
|
-
getTree: () => unsupportedHarnessOperation("sessionManager.getTree()"),
|
|
236
|
-
getSessionName: () => unsupportedHarnessOperation("sessionManager.getSessionName()"),
|
|
237
|
-
getSessionNameState: () => unsupportedHarnessOperation("sessionManager.getSessionNameState()"),
|
|
238
|
-
};
|
|
239
|
-
}
|
|
240
|
-
export function buildCodingAgentHarnessSystemPrompt(options) {
|
|
241
|
-
const activeTools = options.activeToolNames.flatMap((name) => {
|
|
242
|
-
const tool = options.tools.find((candidate) => candidate.name === name);
|
|
243
|
-
return tool ? [tool] : [];
|
|
244
|
-
});
|
|
245
|
-
const toolSnippets = Object.fromEntries(activeTools.flatMap((tool) => {
|
|
246
|
-
const promptSnippet = tool.promptSnippet
|
|
247
|
-
?.replace(/[\r\n]+/g, " ")
|
|
248
|
-
.replace(/\s+/g, " ")
|
|
249
|
-
.trim();
|
|
250
|
-
return promptSnippet ? [[tool.name, promptSnippet]] : [];
|
|
251
|
-
}));
|
|
252
|
-
const promptGuidelines = activeTools.flatMap((tool) => tool.promptGuidelines ?? []);
|
|
253
|
-
return buildSystemPrompt({
|
|
254
|
-
...options.systemPromptOptions,
|
|
255
|
-
cwd: options.cwd,
|
|
256
|
-
selectedTools: activeTools.map((tool) => tool.name),
|
|
257
|
-
toolSnippets,
|
|
258
|
-
promptGuidelines,
|
|
259
|
-
});
|
|
260
|
-
}
|
|
261
|
-
/**
|
|
262
|
-
* AgentHarness v2 is a configuration scaffold in pi-agent-core 0.84.1. The
|
|
263
|
-
* factory setup reaches `AgentHarness.create` (for a fresh session),
|
|
264
|
-
* `Session.getMetadata`, `getModel`, `getThinkingLevel`, `getTools`,
|
|
265
|
-
* `getActiveTools`, the default system-prompt callback, Atomic tool execution,
|
|
266
|
-
* and `close()` on the returned harness. The returned harness also exposes the
|
|
267
|
-
* implemented state/configuration getters and setters for model, thinking
|
|
268
|
-
* level, active tools, tools, resources, stream options, retry, compaction,
|
|
269
|
-
* steering, and follow-up modes. Its default tools route the primary operations
|
|
270
|
-
* for read, bash, edit, write, and find through the injected `ExecutionEnv`;
|
|
271
|
-
* read and edit still use Atomic's local path-variant probes and notebook
|
|
272
|
-
* projection; read also uses local archive, SQLite, and internal-resource
|
|
273
|
-
* selectors, while write still uses local generated-file, shebang, conflict,
|
|
274
|
-
* and resource helpers. Bash validates its cwd locally and uses Atomic's local
|
|
275
|
-
* temp storage for overflow output. URL fetches use the process network and do
|
|
276
|
-
* not persist host-local artifacts in this factory. `search` still uses Atomic's
|
|
277
|
-
* local filesystem/ripgrep pipeline
|
|
278
|
-
* until that tool gains a complete remote operations seam. It does not invoke
|
|
279
|
-
* `prompt`, `skill`,
|
|
280
|
-
* `promptFromTemplate`, `compact`, `navigateTree`, `resume`, `steer`, `followUp`,
|
|
281
|
-
* `nextRun`, `cancelQueued`, `recordUsage`, `abort`, `waitForIdle`,
|
|
282
|
-
* `runWhenIdle`, `peekAction`, `executeAction`, `runToCompletion`, `watch`,
|
|
283
|
-
* `lane`, `createLane`, `lanes`, `watchSession`, `hooks.on`, or `events.on`;
|
|
284
|
-
* those unfinished paths reject with `HarnessNotImplemented` at runtime. A
|
|
285
|
-
* session with existing records also reaches `create.restore`, which is
|
|
286
|
-
* intentionally outside this factory layer.
|
|
287
|
-
*/
|
|
288
|
-
export async function createCodingAgentHarness(options) {
|
|
289
|
-
assertExecutionEnv(options.env);
|
|
290
|
-
const { env, bashCommandPrefix, sessionFile, systemPromptOptions, tools: providedTools, activeToolNames: providedActiveToolNames, systemPrompt: providedSystemPrompt, ...harnessOptions } = options;
|
|
291
|
-
let harness;
|
|
292
|
-
const getHarness = () => {
|
|
293
|
-
if (!harness)
|
|
294
|
-
throw new Error("Coding-agent Harness callback ran before Harness initialization");
|
|
295
|
-
return harness;
|
|
296
|
-
};
|
|
297
|
-
let tools = providedTools;
|
|
298
|
-
if (tools === undefined) {
|
|
299
|
-
const metadata = await options.session.getMetadata();
|
|
300
|
-
const sessionManager = createHarnessSessionManager(metadata.id, sessionFile);
|
|
301
|
-
const getContext = async () => {
|
|
302
|
-
const currentHarness = getHarness();
|
|
303
|
-
const [model, thinkingLevel] = await Promise.all([
|
|
304
|
-
currentHarness.getModel(),
|
|
305
|
-
currentHarness.getThinkingLevel(),
|
|
306
|
-
]);
|
|
307
|
-
const context = {
|
|
308
|
-
get ui() {
|
|
309
|
-
return unsupportedHarnessOperation("context.ui");
|
|
310
|
-
},
|
|
311
|
-
mode: "rpc",
|
|
312
|
-
hasUI: false,
|
|
313
|
-
cwd: env.cwd,
|
|
314
|
-
sessionManager,
|
|
315
|
-
get modelRegistry() {
|
|
316
|
-
return unsupportedHarnessOperation("context.modelRegistry");
|
|
317
|
-
},
|
|
318
|
-
model,
|
|
319
|
-
scopedModels: [],
|
|
320
|
-
thinkingLevel,
|
|
321
|
-
isIdle: () => true,
|
|
322
|
-
isProjectTrusted: () => false,
|
|
323
|
-
signal: undefined,
|
|
324
|
-
abort: () => unsupportedHarnessOperation("context.abort()"),
|
|
325
|
-
hasPendingMessages: () => false,
|
|
326
|
-
shutdown: () => unsupportedHarnessOperation("context.shutdown()"),
|
|
327
|
-
getContextUsage: () => undefined,
|
|
328
|
-
compact: () => unsupportedHarnessOperation("context.compact()"),
|
|
329
|
-
getSystemPrompt: () => unsupportedHarnessOperation("context.getSystemPrompt()"),
|
|
330
|
-
};
|
|
331
|
-
return context;
|
|
332
|
-
};
|
|
333
|
-
const toolOptions = createExecutionEnvToolOptions(env, bashCommandPrefix, sessionFile);
|
|
334
|
-
tools = createCodingToolDefinitions(env.cwd, toolOptions).map((definition) => createCodingAgentHarnessTool({ definition, getContext }));
|
|
335
|
-
}
|
|
336
|
-
const activeToolNames = [...(providedActiveToolNames ?? tools.map((tool) => tool.name))];
|
|
337
|
-
const systemPrompt = providedSystemPrompt ??
|
|
338
|
-
(async () => {
|
|
339
|
-
const currentHarness = getHarness();
|
|
340
|
-
const [currentTools, currentActiveToolNames] = await Promise.all([
|
|
341
|
-
currentHarness.getTools(),
|
|
342
|
-
currentHarness.getActiveTools(),
|
|
343
|
-
]);
|
|
344
|
-
return buildCodingAgentHarnessSystemPrompt({
|
|
345
|
-
cwd: env.cwd,
|
|
346
|
-
tools: currentTools,
|
|
347
|
-
activeToolNames: currentActiveToolNames,
|
|
348
|
-
systemPromptOptions,
|
|
349
|
-
});
|
|
350
|
-
});
|
|
351
|
-
const created = await AgentHarness.create({
|
|
352
|
-
...harnessOptions,
|
|
353
|
-
tools,
|
|
354
|
-
activeToolNames,
|
|
355
|
-
systemPrompt,
|
|
356
|
-
});
|
|
357
|
-
harness = created.harness;
|
|
358
|
-
return created;
|
|
359
|
-
}
|
|
360
|
-
//# sourceMappingURL=create-harness.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-harness.js","sourceRoot":"","sources":["../../src/server/create-harness.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,YAAY,GAQZ,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAGtE,OAAO,EAAiC,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAE5F,OAAO,EAAE,2BAA2B,EAAqB,MAAM,wBAAwB,CAAC;AACxF,OAAO,EAAE,4BAA4B,EAAE,MAAM,kBAAkB,CAAC;AAYhE,SAAS,4BAA4B,CACpC,OAAyD;IAEzD,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAC3C,MAAM,oBAAoB,GAAG,2BAA2B,EAAE,CAAC;IAC3D,OAAO;QACN,GAAG,UAAU;QACb,aAAa,EAAE,UAAU,CAAC,aAAa;QACvC,gBAAgB,EAAE,UAAU,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,SAAS;QAC5F,4EAA4E;QAC5E,gFAAgF;QAChF,4EAA4E;QAC5E,0EAA0E;QAC1E,8EAA8E;QAC9E,GAAG,CAAC,UAAU,CAAC,mBAAmB,KAAK,SAAS,IAAI,oBAAoB,KAAK,SAAS;YAC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mBAAmB;aACnB,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACJ,MAAM,OAAO,GAAG,MAAM,YAAY,CAAC,MAAM,CAAC;QACzC,GAAG,cAAc;QACjB,KAAK;QACL,eAAe;QACf,YAAY;KACZ,CAAC,CAAC;IACH,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAC1B,OAAO,OAAO,CAAC;AAChB,CAAC","sourcesContent":["import {\n\tAgentHarness,\n\ttype AgentHarnessOptions,\n\ttype ExecutionEnv,\n\ttype ExecutionError,\n\ttype FileError,\n\ttype FileInfo,\n\ttype HarnessTool,\n\ttype Result,\n} from \"@earendil-works/pi-agent-core\";\nimport { minimatch } from \"minimatch\";\nimport type { Static, TSchema } from \"typebox\";\nimport { getExperimentalToolSampling } from \"../core/experimental.ts\";\nimport type { ExtensionContext, ToolDefinition } from \"../core/extensions/types.ts\";\nimport type { ReadonlySessionManager } from \"../core/session-manager.ts\";\nimport { type BuildSystemPromptOptions, buildSystemPrompt } from \"../core/system-prompt.ts\";\nimport type { DirectoryTreeEntry } from \"../core/tools/directory-tree.ts\";\nimport { createCodingToolDefinitions, type ToolsOptions } from \"../core/tools/index.ts\";\nimport { detectSupportedImageMimeType } from \"../utils/mime.ts\";\n\nexport interface CodingAgentHarnessTool extends HarnessTool {\n\tpromptSnippet?: string;\n\tpromptGuidelines?: string[];\n}\n\ntype CodingAgentToolDefinition<TParameters extends TSchema, TDetails> = {\n\tdefinition: ToolDefinition<TParameters, TDetails>;\n\tgetContext: () => Promise<ExtensionContext>;\n};\n\nfunction createCodingAgentHarnessTool<TParameters extends TSchema, TDetails>(\n\toptions: CodingAgentToolDefinition<TParameters, TDetails>,\n): CodingAgentHarnessTool {\n\tconst { definition, getContext } = options;\n\tconst experimentalSampling = getExperimentalToolSampling();\n\treturn {\n\t\t...definition,\n\t\tpromptSnippet: definition.promptSnippet,\n\t\tpromptGuidelines: definition.promptGuidelines ? [...definition.promptGuidelines] : undefined,\n\t\t// Compose rather than double-wrap: a definition that already constrains its\n\t\t// own sampling (including an explicit `false` opt-out, e.g. a structured-output\n\t\t// tool constraining its caller-supplied schema) keeps that constraint; only\n\t\t// unconstrained definitions pick up the experimental strict default. When\n\t\t// neither applies the key stays absent — key presence is semantic downstream.\n\t\t...(definition.constrainedSampling === undefined && experimentalSampling === undefined\n\t\t\t? {}\n\t\t\t: { constrainedSampling: definition.constrainedSampling ?? experimentalSampling }),\n\t\texecute: async (toolCallId, params, signal, onUpdate) =>\n\t\t\tdefinition.execute(toolCallId, params as Static<TParameters>, signal, onUpdate, await getContext()),\n\t};\n}\n\nfunction normalizeBashExecutionError(error: ExecutionError, timeout: number | undefined): Error {\n\tif (error.code === \"aborted\") return new Error(\"aborted\", { cause: error });\n\tif (error.code === \"timeout\") {\n\t\tconst message = error.message.startsWith(\"timeout:\") ? error.message : `timeout:${timeout ?? \"\"}`;\n\t\treturn new Error(message, { cause: error });\n\t}\n\treturn error;\n}\n\nfunction unwrapFileResult<TValue>(result: Result<TValue, FileError>): TValue {\n\tif (result.ok) return result.value;\n\tthrow result.error;\n}\n\nfunction unsupportedHarnessOperation(operation: string): never {\n\tthrow new Error(`Coding-agent Harness does not provide ${operation}`);\n}\n\nasync function findExecutionEnvGlob(\n\tenv: ExecutionEnv,\n\tpattern: string,\n\troot: string,\n\toptions: { ignore: string[]; limit: number; hidden: boolean },\n): Promise<string[]> {\n\tconst matches: string[] = [];\n\tconst normalizedPattern = pattern.replaceAll(\"\\\\\", \"/\");\n\tconst matchOptions = { dot: true, matchBase: !normalizedPattern.includes(\"/\") };\n\tconst hasHiddenSegment = (value: string): boolean =>\n\t\tvalue.split(\"/\").some((segment) => segment.startsWith(\".\") && segment.length > 1);\n\tconst isIgnored = (value: string, isDirectory: boolean): boolean =>\n\t\toptions.ignore.some(\n\t\t\t(ignorePattern) =>\n\t\t\t\tminimatch(value, ignorePattern, { dot: true }) ||\n\t\t\t\t(isDirectory && minimatch(`${value}/__entry__`, ignorePattern, { dot: true })),\n\t\t);\n\tconst walk = async (directory: string, prefix: string): Promise<void> => {\n\t\tif (matches.length >= options.limit) return;\n\t\tconst result = await env.listDir(directory);\n\t\tif (!result.ok) return;\n\t\tconst entries = result.value.sort((left, right) => left.name.localeCompare(right.name));\n\t\tfor (const entry of entries) {\n\t\t\tif (matches.length >= options.limit) return;\n\t\t\tconst relativePath = prefix ? `${prefix}/${entry.name}` : entry.name;\n\t\t\tif (!options.hidden && hasHiddenSegment(relativePath)) continue;\n\t\t\tconst isDirectory = entry.kind === \"directory\";\n\t\t\tif (isIgnored(relativePath, isDirectory)) continue;\n\t\t\tif (minimatch(relativePath, normalizedPattern, matchOptions))\n\t\t\t\tmatches.push(isDirectory ? `${relativePath}/` : relativePath);\n\t\t\tif (isDirectory) await walk(entry.path, relativePath);\n\t\t}\n\t};\n\tconst rootInfo = await env.fileInfo(root);\n\tlet walkRoot = root;\n\tif (rootInfo.ok && rootInfo.value.kind === \"symlink\") {\n\t\tconst canonical = await env.canonicalPath(root);\n\t\tif (canonical.ok) walkRoot = canonical.value;\n\t}\n\tawait walk(walkRoot, \"\");\n\treturn matches;\n}\n\nasync function findExecutionEnvStat(\n\tenv: ExecutionEnv,\n\tpath: string,\n): Promise<{ isFile: boolean; isDirectory: boolean } | undefined> {\n\tconst result = await env.fileInfo(path);\n\tif (!result.ok) return undefined;\n\tif (result.value.kind !== \"symlink\") {\n\t\treturn { isFile: result.value.kind === \"file\", isDirectory: result.value.kind === \"directory\" };\n\t}\n\tconst canonical = await env.canonicalPath(path);\n\tif (!canonical.ok) return undefined;\n\tconst target = await env.fileInfo(canonical.value);\n\tif (!target.ok) return undefined;\n\treturn { isFile: target.value.kind === \"file\", isDirectory: target.value.kind === \"directory\" };\n}\n\nasync function toExecutionEnvDirectoryEntry(\n\tenv: ExecutionEnv,\n\tinfo: FileInfo,\n): Promise<DirectoryTreeEntry | undefined> {\n\tif (info.kind !== \"symlink\")\n\t\treturn {\n\t\t\tname: info.name,\n\t\t\tpath: info.path,\n\t\t\tisDirectory: info.kind === \"directory\",\n\t\t\tmtimeMs: info.mtimeMs,\n\t\t\tsize: info.size,\n\t\t};\n\tconst canonical = await env.canonicalPath(info.path);\n\tif (!canonical.ok) return undefined;\n\tconst target = await env.fileInfo(canonical.value);\n\tif (!target.ok) return undefined;\n\treturn {\n\t\tname: info.name,\n\t\tpath: canonical.value,\n\t\tisDirectory: target.value.kind === \"directory\",\n\t\tmtimeMs: target.value.mtimeMs,\n\t\tsize: target.value.size,\n\t};\n}\n\nasync function listExecutionEnvDirectory(env: ExecutionEnv, path: string): Promise<DirectoryTreeEntry[] | undefined> {\n\tlet result = await env.listDir(path);\n\tif (!result.ok) {\n\t\tconst info = await env.fileInfo(path);\n\t\tif (!info.ok || info.value.kind !== \"symlink\") return undefined;\n\t\tconst canonical = await env.canonicalPath(path);\n\t\tif (!canonical.ok) return undefined;\n\t\tresult = await env.listDir(canonical.value);\n\t}\n\tif (!result.ok) return undefined;\n\tconst entries = await Promise.all(result.value.map((entry) => toExecutionEnvDirectoryEntry(env, entry)));\n\treturn entries.filter((entry): entry is DirectoryTreeEntry => entry !== undefined);\n}\n\nfunction createExecutionEnvToolOptions(\n\tenv: ExecutionEnv,\n\tcommandPrefix: string | undefined,\n\tsessionFile: string | undefined,\n): ToolsOptions {\n\treturn {\n\t\tread: {\n\t\t\toperations: {\n\t\t\t\treadFile: async (path) => Buffer.from(unwrapFileResult(await env.readBinaryFile(path))),\n\t\t\t\taccess: async (path) => {\n\t\t\t\t\tunwrapFileResult(await env.fileInfo(path));\n\t\t\t\t},\n\t\t\t\tstat: (path) => findExecutionEnvStat(env, path),\n\t\t\t\tlistDir: (path) => listExecutionEnvDirectory(env, path),\n\t\t\t\tdetectImageMimeType: async (path) =>\n\t\t\t\t\tdetectSupportedImageMimeType(unwrapFileResult(await env.readBinaryFile(path))),\n\t\t\t},\n\t\t},\n\t\tbash: {\n\t\t\tcommandPrefix,\n\t\t\t// Atomic's bash tool normally hands operations the full local spawn\n\t\t\t// environment. The injected ExecutionEnv owns the base environment;\n\t\t\t// keep only the session and per-command overlays at this boundary.\n\t\t\tspawnHook: (context) => ({ ...context, env: {} }),\n\t\t\toperations: {\n\t\t\t\texec: async (command, cwd, options) => {\n\t\t\t\t\tconst envOverrides: Record<string, string> = {};\n\t\t\t\t\tfor (const [key, value] of Object.entries(options.env ?? {})) {\n\t\t\t\t\t\tif (typeof value === \"string\") envOverrides[key] = value;\n\t\t\t\t\t}\n\t\t\t\t\tif (sessionFile === undefined) {\n\t\t\t\t\t\tenvOverrides.ATOMIC_SESSION_FILE = \"\";\n\t\t\t\t\t\tenvOverrides.PI_SESSION_FILE = \"\";\n\t\t\t\t\t}\n\t\t\t\t\tconst result = await env.exec(command, {\n\t\t\t\t\t\tcwd,\n\t\t\t\t\t\tenv: envOverrides,\n\t\t\t\t\t\ttimeout: options.timeout,\n\t\t\t\t\t\tabortSignal: options.signal,\n\t\t\t\t\t\tonStdout: (chunk) => options.onData(Buffer.from(chunk), \"stdout\"),\n\t\t\t\t\t\tonStderr: (chunk) => options.onData(Buffer.from(chunk), \"stderr\"),\n\t\t\t\t\t});\n\t\t\t\t\tif (!result.ok) throw normalizeBashExecutionError(result.error, options.timeout);\n\t\t\t\t\treturn { exitCode: result.value.exitCode };\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tedit: {\n\t\t\toperations: {\n\t\t\t\treadFile: async (path) => Buffer.from(unwrapFileResult(await env.readBinaryFile(path))),\n\t\t\t\twriteFile: async (path, content) => {\n\t\t\t\t\tunwrapFileResult(await env.writeFile(path, content));\n\t\t\t\t},\n\t\t\t\taccess: async (path) => {\n\t\t\t\t\tconst info = unwrapFileResult(await env.fileInfo(path));\n\t\t\t\t\tif (info.kind !== \"file\" && info.kind !== \"symlink\")\n\t\t\t\t\t\tthrow new Error(`Cannot edit non-file path: ${path}`);\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\twrite: {\n\t\t\toperations: {\n\t\t\t\twriteFile: async (path, content) => {\n\t\t\t\t\tunwrapFileResult(await env.writeFile(path, content));\n\t\t\t\t},\n\t\t\t\tmkdir: async (path) => {\n\t\t\t\t\tunwrapFileResult(await env.createDir(path));\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tfind: {\n\t\t\toperations: {\n\t\t\t\texists: async (path) => {\n\t\t\t\t\tconst result = await env.exists(path);\n\t\t\t\t\treturn result.ok && result.value;\n\t\t\t\t},\n\t\t\t\tstat: (path) => findExecutionEnvStat(env, path),\n\t\t\t\tglob: (pattern, cwd, globOptions) => findExecutionEnvGlob(env, pattern, cwd, globOptions),\n\t\t\t},\n\t\t},\n\t};\n}\n\nfunction assertExecutionEnv(env: ExecutionEnv): void {\n\tif (typeof env?.renameFile !== \"function\") {\n\t\tthrow new TypeError(\"Coding-agent Harness requires ExecutionEnv.renameFile() to be implemented\");\n\t}\n}\n\nfunction createHarnessSessionManager(metadataId: string, sessionFile: string | undefined): ReadonlySessionManager {\n\treturn {\n\t\tgetCwd: () => unsupportedHarnessOperation(\"sessionManager.getCwd()\"),\n\t\t// The factory has no local session directory. URL reads still use the session id for cache scope,\n\t\t// but skip host-local artifact persistence rather than treating the ExecutionEnv cwd as local storage.\n\t\tgetSessionDir: () => \"\",\n\t\tusesDefaultSessionDir: () => unsupportedHarnessOperation(\"sessionManager.usesDefaultSessionDir()\"),\n\t\tgetSessionId: () => metadataId,\n\t\tgetSessionFile: () => sessionFile,\n\t\tgetLeafId: () => unsupportedHarnessOperation(\"sessionManager.getLeafId()\"),\n\t\tgetLeafEntry: () => unsupportedHarnessOperation(\"sessionManager.getLeafEntry()\"),\n\t\tgetEntry: () => unsupportedHarnessOperation(\"sessionManager.getEntry()\"),\n\t\tgetLabel: () => unsupportedHarnessOperation(\"sessionManager.getLabel()\"),\n\t\tgetBranch: () => unsupportedHarnessOperation(\"sessionManager.getBranch()\"),\n\t\tgetHeader: () => unsupportedHarnessOperation(\"sessionManager.getHeader()\"),\n\t\tgetEntries: () => unsupportedHarnessOperation(\"sessionManager.getEntries()\"),\n\t\tgetTree: () => unsupportedHarnessOperation(\"sessionManager.getTree()\"),\n\t\tgetSessionName: () => unsupportedHarnessOperation(\"sessionManager.getSessionName()\"),\n\t\tgetSessionNameState: () => unsupportedHarnessOperation(\"sessionManager.getSessionNameState()\"),\n\t};\n}\n\nexport interface CreateCodingAgentHarnessOptions extends Omit<AgentHarnessOptions, \"toolContext\" | \"tools\"> {\n\tenv: ExecutionEnv;\n\tbashCommandPrefix?: string;\n\t/** Path to the JSONL session file exposed to default bash commands as ATOMIC_SESSION_FILE and PI_SESSION_FILE. */\n\tsessionFile?: string;\n\ttools?: CodingAgentHarnessTool[];\n\tsystemPromptOptions?: Omit<BuildSystemPromptOptions, \"cwd\" | \"promptGuidelines\" | \"selectedTools\" | \"toolSnippets\">;\n}\n\nexport interface BuildCodingAgentHarnessSystemPromptOptions {\n\tcwd: string;\n\ttools: readonly CodingAgentHarnessTool[];\n\tactiveToolNames: readonly string[];\n\tsystemPromptOptions?: CreateCodingAgentHarnessOptions[\"systemPromptOptions\"];\n}\n\nexport function buildCodingAgentHarnessSystemPrompt(options: BuildCodingAgentHarnessSystemPromptOptions): string {\n\tconst activeTools = options.activeToolNames.flatMap((name) => {\n\t\tconst tool = options.tools.find((candidate) => candidate.name === name);\n\t\treturn tool ? [tool] : [];\n\t});\n\tconst toolSnippets = Object.fromEntries(\n\t\tactiveTools.flatMap((tool) => {\n\t\t\tconst promptSnippet = tool.promptSnippet\n\t\t\t\t?.replace(/[\\r\\n]+/g, \" \")\n\t\t\t\t.replace(/\\s+/g, \" \")\n\t\t\t\t.trim();\n\t\t\treturn promptSnippet ? [[tool.name, promptSnippet]] : [];\n\t\t}),\n\t);\n\tconst promptGuidelines = activeTools.flatMap((tool) => tool.promptGuidelines ?? []);\n\treturn buildSystemPrompt({\n\t\t...options.systemPromptOptions,\n\t\tcwd: options.cwd,\n\t\tselectedTools: activeTools.map((tool) => tool.name),\n\t\ttoolSnippets,\n\t\tpromptGuidelines,\n\t});\n}\n\n/**\n * AgentHarness v2 is a configuration scaffold in pi-agent-core 0.84.1. The\n * factory setup reaches `AgentHarness.create` (for a fresh session),\n * `Session.getMetadata`, `getModel`, `getThinkingLevel`, `getTools`,\n * `getActiveTools`, the default system-prompt callback, Atomic tool execution,\n * and `close()` on the returned harness. The returned harness also exposes the\n * implemented state/configuration getters and setters for model, thinking\n * level, active tools, tools, resources, stream options, retry, compaction,\n * steering, and follow-up modes. Its default tools route the primary operations\n * for read, bash, edit, write, and find through the injected `ExecutionEnv`;\n * read and edit still use Atomic's local path-variant probes and notebook\n * projection; read also uses local archive, SQLite, and internal-resource\n * selectors, while write still uses local generated-file, shebang, conflict,\n * and resource helpers. Bash validates its cwd locally and uses Atomic's local\n * temp storage for overflow output. URL fetches use the process network and do\n * not persist host-local artifacts in this factory. `search` still uses Atomic's\n * local filesystem/ripgrep pipeline\n * until that tool gains a complete remote operations seam. It does not invoke\n * `prompt`, `skill`,\n * `promptFromTemplate`, `compact`, `navigateTree`, `resume`, `steer`, `followUp`,\n * `nextRun`, `cancelQueued`, `recordUsage`, `abort`, `waitForIdle`,\n * `runWhenIdle`, `peekAction`, `executeAction`, `runToCompletion`, `watch`,\n * `lane`, `createLane`, `lanes`, `watchSession`, `hooks.on`, or `events.on`;\n * those unfinished paths reject with `HarnessNotImplemented` at runtime. A\n * session with existing records also reaches `create.restore`, which is\n * intentionally outside this factory layer.\n */\nexport async function createCodingAgentHarness(options: CreateCodingAgentHarnessOptions) {\n\tassertExecutionEnv(options.env);\n\tconst {\n\t\tenv,\n\t\tbashCommandPrefix,\n\t\tsessionFile,\n\t\tsystemPromptOptions,\n\t\ttools: providedTools,\n\t\tactiveToolNames: providedActiveToolNames,\n\t\tsystemPrompt: providedSystemPrompt,\n\t\t...harnessOptions\n\t} = options;\n\tlet harness: AgentHarness | undefined;\n\tconst getHarness = (): AgentHarness => {\n\t\tif (!harness) throw new Error(\"Coding-agent Harness callback ran before Harness initialization\");\n\t\treturn harness;\n\t};\n\tlet tools = providedTools;\n\tif (tools === undefined) {\n\t\tconst metadata = await options.session.getMetadata();\n\t\tconst sessionManager = createHarnessSessionManager(metadata.id, sessionFile);\n\t\tconst getContext = async (): Promise<ExtensionContext> => {\n\t\t\tconst currentHarness = getHarness();\n\t\t\tconst [model, thinkingLevel] = await Promise.all([\n\t\t\t\tcurrentHarness.getModel(),\n\t\t\t\tcurrentHarness.getThinkingLevel(),\n\t\t\t]);\n\t\t\tconst context = {\n\t\t\t\tget ui() {\n\t\t\t\t\treturn unsupportedHarnessOperation(\"context.ui\");\n\t\t\t\t},\n\t\t\t\tmode: \"rpc\",\n\t\t\t\thasUI: false,\n\t\t\t\tcwd: env.cwd,\n\t\t\t\tsessionManager,\n\t\t\t\tget modelRegistry() {\n\t\t\t\t\treturn unsupportedHarnessOperation(\"context.modelRegistry\");\n\t\t\t\t},\n\t\t\t\tmodel,\n\t\t\t\tscopedModels: [],\n\t\t\t\tthinkingLevel,\n\t\t\t\tisIdle: () => true,\n\t\t\t\tisProjectTrusted: () => false,\n\t\t\t\tsignal: undefined,\n\t\t\t\tabort: () => unsupportedHarnessOperation(\"context.abort()\"),\n\t\t\t\thasPendingMessages: () => false,\n\t\t\t\tshutdown: () => unsupportedHarnessOperation(\"context.shutdown()\"),\n\t\t\t\tgetContextUsage: () => undefined,\n\t\t\t\tcompact: () => unsupportedHarnessOperation(\"context.compact()\"),\n\t\t\t\tgetSystemPrompt: () => unsupportedHarnessOperation(\"context.getSystemPrompt()\"),\n\t\t\t} satisfies ExtensionContext;\n\t\t\treturn context;\n\t\t};\n\t\tconst toolOptions = createExecutionEnvToolOptions(env, bashCommandPrefix, sessionFile);\n\t\ttools = createCodingToolDefinitions(env.cwd, toolOptions).map((definition) =>\n\t\t\tcreateCodingAgentHarnessTool({ definition, getContext }),\n\t\t);\n\t}\n\tconst activeToolNames = [...(providedActiveToolNames ?? tools.map((tool) => tool.name))];\n\tconst systemPrompt =\n\t\tprovidedSystemPrompt ??\n\t\t(async () => {\n\t\t\tconst currentHarness = getHarness();\n\t\t\tconst [currentTools, currentActiveToolNames] = await Promise.all([\n\t\t\t\tcurrentHarness.getTools(),\n\t\t\t\tcurrentHarness.getActiveTools(),\n\t\t\t]);\n\t\t\treturn buildCodingAgentHarnessSystemPrompt({\n\t\t\t\tcwd: env.cwd,\n\t\t\t\ttools: currentTools,\n\t\t\t\tactiveToolNames: currentActiveToolNames,\n\t\t\t\tsystemPromptOptions,\n\t\t\t});\n\t\t});\n\tconst created = await AgentHarness.create({\n\t\t...harnessOptions,\n\t\ttools,\n\t\tactiveToolNames,\n\t\tsystemPrompt,\n\t});\n\tharness = created.harness;\n\treturn created;\n}\n"]}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "Benchmark Sources"
|
|
3
|
-
description: "The external benchmarks that inform Atomic model selection — Artificial Analysis and DeepSWE — broken down per benchmark: what each measures and when to reference it."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Benchmark Sources
|
|
7
|
-
|
|
8
|
-
Atomic's model-selection docs are keyed to two live external benchmark sources rather than a hand-maintained table of scores. This page lists each benchmark, what it measures, and **when to reference it** for a given workflow role — so the docs stay useful as new models ship without a manual rewrite every time.
|
|
9
|
-
|
|
10
|
-
<Warning>
|
|
11
|
-
No single benchmark is the source of truth. Use these as inputs and validate against Atomic's own workflow evals — public suites test different task distributions than real engineering loops. When Atomic's numbers disagree with a public index, Atomic's evals win. The DeepSWE snapshot used by the linked model-selection pages was updated August 26, 2026. **Last reviewed: 2026-09-01.**
|
|
12
|
-
</Warning>
|
|
13
|
-
|
|
14
|
-
## The two sources at a glance
|
|
15
|
-
|
|
16
|
-
| Source | URL | What it is | Reference it for |
|
|
17
|
-
| --- | --- | --- | --- |
|
|
18
|
-
| DeepSWE | [deepswe.datacurve.ai](https://deepswe.datacurve.ai/) | Long-horizon, contamination-free software-engineering tasks (113 tasks, 91 repos, 5 languages), all run on `mini-swe-agent` for consistency | The primary signal for coding-agent routing: real `pass@1`, cost, output tokens, and agent steps on engineering-loop work |
|
|
19
|
-
| Artificial Analysis | [artificialanalysis.ai](https://artificialanalysis.ai/) | Cross-provider intelligence, coding, and agentic indices plus per-capability breakdowns | Cross-domain intelligence, tool use, knowledge reliability, long context, and non-coding capabilities |
|
|
20
|
-
|
|
21
|
-
## DeepSWE — coding-agent performance
|
|
22
|
-
|
|
23
|
-
DeepSWE is the closest public proxy for what Atomic actually does. Tasks are written from scratch (not scraped from PRs), so no model has seen the solutions; solutions require substantially more code than SWE-bench-style suites; and verifiers test behavior rather than implementation.
|
|
24
|
-
|
|
25
|
-
- **Current snapshot:** DeepSWE v1.1, 113 tasks across 91 repositories and 5 languages, updated August 26, 2026. The site reports 26 measured models and displays 19 leaderboard rows.
|
|
26
|
-
- **Metric:** `pass@1`, plus average cost per task, output tokens, and agent steps.
|
|
27
|
-
- **When to reference:** default weighting for debugger, worker, and any code-writing role. This is the table that drives [Model Selection](/models/model-selection) and [Pareto Efficiency](/models/pareto-efficiency).
|
|
28
|
-
- **Watch:** cost and step count, not just score — a model that passes but takes 268 steps (e.g. sonnet-5) is a poor worker even at a good pass rate.
|
|
29
|
-
|
|
30
|
-
## Artificial Analysis — intelligence and capability breakdown
|
|
31
|
-
|
|
32
|
-
Artificial Analysis separates performance by benchmark, which lets a workflow pick the model that is strong at the *specific* thing a role needs. Reference the individual evaluations, not just the composite index.
|
|
33
|
-
|
|
34
|
-
### Composite indices
|
|
35
|
-
|
|
36
|
-
- **Intelligence Index (v4.1.1)** — composite of the nine evaluations below, weighted across four categories: Agents 34%, Coding 24%, Scientific Reasoning 24%, General 18%. Use as a first-pass filter when a new model appears.
|
|
37
|
-
- **Coding Index** — coding-weighted sub-index. Cross-check against DeepSWE.
|
|
38
|
-
- **Agentic Index** — tool use, planning, autonomy, complex problem solving. The best AA signal for orchestrator and reviewer roles.
|
|
39
|
-
|
|
40
|
-
### Individual evaluations — what each measures and when to reference
|
|
41
|
-
|
|
42
|
-
| Benchmark | Measures | Reference it for |
|
|
43
|
-
| --- | --- | --- |
|
|
44
|
-
| GDPval-AA v2 | Agentic real-world work tasks | Orchestrator / planner roles doing economically realistic work |
|
|
45
|
-
| τ³-Banking | Agentic tool use | Tool-heavy workflows and function-calling reliability |
|
|
46
|
-
| Terminal-Bench v2.1 | Agentic coding & terminal use | Debugger and shell-driven workers |
|
|
47
|
-
| SciCode | Coding (scientific) | Code-writing roles in technical domains |
|
|
48
|
-
| Humanity's Last Exam | Reasoning & knowledge | Hard planning / judgment gates |
|
|
49
|
-
| GPQA Diamond | Scientific reasoning | Research roles in technical domains |
|
|
50
|
-
| CritPt | Physics reasoning | Physics/engineering-heavy tasks |
|
|
51
|
-
| AA-Omniscience | Knowledge accuracy & non-hallucination | Research and any role where a confident wrong answer is costly |
|
|
52
|
-
| AA-LCR | Long-context reasoning | Large-codebase research and long-session work |
|
|
53
|
-
|
|
54
|
-
### Capability indices
|
|
55
|
-
|
|
56
|
-
Artificial Analysis also publishes per-domain capability indices — **Agentic, Coding, Finance & Accounting, Strategy & Ops, Legal, Healthcare & Medical, Engineering, Economics**. When a workflow is domain-specific, pick by the matching capability index rather than the general Intelligence Index.
|
|
57
|
-
|
|
58
|
-
## Role → benchmark map
|
|
59
|
-
|
|
60
|
-
A quick lookup for which benchmark to weight per role:
|
|
61
|
-
|
|
62
|
-
| Role | Primary benchmark | Secondary |
|
|
63
|
-
| --- | --- | --- |
|
|
64
|
-
| Debugger | DeepSWE pass@1 | Terminal-Bench v2.1 |
|
|
65
|
-
| Worker / cheap loop | DeepSWE cost & steps | — |
|
|
66
|
-
| Reviewer / judgment gate | DeepSWE pass@1 | AA Agentic Index |
|
|
67
|
-
| Planner / orchestrator | AA Agentic Index, GDPval-AA v2 | τ³-Banking (tool use) |
|
|
68
|
-
| Research | AA-LCR (long context) | AA-Omniscience (reliability) |
|
|
69
|
-
| Domain-specific work | Matching AA capability index | — |
|
|
70
|
-
|
|
71
|
-
## Keeping the docs fresh
|
|
72
|
-
|
|
73
|
-
flora131's guidance on this issue: point the model at the live benchmark URLs and describe what each measures and when to reference it, rather than hardcoding scores that go stale on every release.
|
|
74
|
-
|
|
75
|
-
1. Treat the model-selection pages as timestamped snapshots that read *from* the live sources above.
|
|
76
|
-
2. When a new model appears on DeepSWE or Artificial Analysis, add it by pulling its numbers from the source — the frontier may move (as the gpt-5.6 family did).
|
|
77
|
-
3. Mark a model **unmeasured** only if it is absent from both sources; unmeasured models may still be operational defaults.
|
|
78
|
-
4. Prefer generating the docs and any future routing policy from the same underlying data, so documentation and routing cannot drift apart.
|
|
79
|
-
|
|
80
|
-
## Related
|
|
81
|
-
|
|
82
|
-
- [Model Selection](/models/model-selection)
|
|
83
|
-
- [Pareto Efficiency](/models/pareto-efficiency)
|