@bastani/atomic 0.8.28-alpha.1 → 0.8.28-alpha.3
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 +60 -0
- package/README.md +120 -118
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/builtin/workflows/CHANGELOG.md +26 -0
- package/dist/builtin/workflows/README.md +1 -1
- package/dist/builtin/workflows/builtin/open-claude-design.ts +150 -13
- package/dist/builtin/workflows/package.json +1 -1
- package/dist/builtin/workflows/src/authoring.d.ts +5 -2
- package/dist/builtin/workflows/src/extension/dispatcher.ts +2 -0
- package/dist/builtin/workflows/src/extension/index.ts +8 -0
- package/dist/builtin/workflows/src/extension/render-result.ts +5 -2
- package/dist/builtin/workflows/src/extension/workflow-schema.ts +18 -0
- package/dist/builtin/workflows/src/runs/background/status.ts +4 -0
- package/dist/builtin/workflows/src/runs/foreground/executor.ts +1251 -110
- package/dist/builtin/workflows/src/shared/authoring-contract.d.ts +34 -10
- package/dist/builtin/workflows/src/shared/expanded-workflow-graph.ts +10 -2
- package/dist/builtin/workflows/src/shared/persistence-restore.ts +28 -9
- package/dist/builtin/workflows/src/shared/persistence-session-entries.ts +9 -3
- package/dist/builtin/workflows/src/shared/store-types.ts +10 -3
- package/dist/builtin/workflows/src/shared/store.ts +29 -7
- package/dist/builtin/workflows/src/shared/types.ts +12 -10
- package/dist/builtin/workflows/src/tui/chat-surface.ts +32 -33
- package/dist/builtin/workflows/src/tui/run-detail.ts +23 -4
- package/dist/builtin/workflows/src/tui/status-helpers.ts +4 -0
- package/dist/builtin/workflows/src/tui/status-list.ts +47 -3
- package/dist/builtin/workflows/src/tui/store-widget-installer.ts +1 -1
- package/dist/builtin/workflows/src/tui/widget.ts +12 -3
- package/dist/builtin/workflows/src/workflows/define-workflow.ts +3 -3
- package/dist/cli/args.d.ts +4 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +35 -0
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/project-trust.d.ts +10 -0
- package/dist/cli/project-trust.d.ts.map +1 -0
- package/dist/cli/project-trust.js +36 -0
- package/dist/cli/project-trust.js.map +1 -0
- package/dist/cli/startup-ui.d.ts +7 -0
- package/dist/cli/startup-ui.d.ts.map +1 -0
- package/dist/cli/startup-ui.js +57 -0
- package/dist/cli/startup-ui.js.map +1 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +24 -3
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session-runtime.d.ts +3 -1
- package/dist/core/agent-session-runtime.d.ts.map +1 -1
- package/dist/core/agent-session-runtime.js +1 -0
- package/dist/core/agent-session-runtime.js.map +1 -1
- package/dist/core/agent-session-services.d.ts +3 -1
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +3 -2
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session.d.ts +9 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +70 -21
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +4 -3
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts +3 -1
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js +9 -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 +18 -24
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/compaction/utils.d.ts +1 -1
- package/dist/core/compaction/utils.d.ts.map +1 -1
- package/dist/core/compaction/utils.js +1 -1
- package/dist/core/compaction/utils.js.map +1 -1
- package/dist/core/experimental.d.ts +2 -0
- package/dist/core/experimental.d.ts.map +1 -0
- package/dist/core/experimental.js +5 -0
- package/dist/core/experimental.js.map +1 -0
- package/dist/core/export-html/template.js +19 -6
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader.d.ts +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +6 -4
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +11 -4
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +53 -3
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +34 -4
- 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 +2 -0
- package/dist/core/footer-data-provider.d.ts.map +1 -1
- package/dist/core/footer-data-provider.js +27 -1
- package/dist/core/footer-data-provider.js.map +1 -1
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +2 -0
- package/dist/core/index.js.map +1 -1
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +64 -7
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +1 -0
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/output-guard.d.ts +1 -0
- package/dist/core/output-guard.d.ts.map +1 -1
- package/dist/core/output-guard.js +52 -22
- package/dist/core/output-guard.js.map +1 -1
- package/dist/core/package-manager.d.ts +1 -0
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +20 -8
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/project-trust.d.ts +15 -0
- package/dist/core/project-trust.d.ts.map +1 -0
- package/dist/core/project-trust.js +58 -0
- package/dist/core/project-trust.js.map +1 -0
- package/dist/core/prompt-templates.d.ts +5 -4
- package/dist/core/prompt-templates.d.ts.map +1 -1
- package/dist/core/prompt-templates.js +30 -29
- package/dist/core/prompt-templates.js.map +1 -1
- package/dist/core/provider-attribution.d.ts +4 -0
- package/dist/core/provider-attribution.d.ts.map +1 -0
- package/dist/core/provider-attribution.js +73 -0
- package/dist/core/provider-attribution.js.map +1 -0
- package/dist/core/provider-display-names.d.ts.map +1 -1
- package/dist/core/provider-display-names.js +3 -0
- package/dist/core/provider-display-names.js.map +1 -1
- package/dist/core/resolve-config-value.d.ts +9 -1
- package/dist/core/resolve-config-value.d.ts.map +1 -1
- package/dist/core/resolve-config-value.js +134 -11
- package/dist/core/resolve-config-value.js.map +1 -1
- package/dist/core/resource-loader.d.ts +12 -2
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +108 -18
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/sdk.d.ts +4 -2
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +13 -42
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-manager.d.ts +6 -7
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +99 -35
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts +15 -2
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +69 -10
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +1 -0
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +0 -3
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/ask-user-question/state/inline-input.d.ts +28 -0
- package/dist/core/tools/ask-user-question/state/inline-input.d.ts.map +1 -0
- package/dist/core/tools/ask-user-question/state/inline-input.js +56 -0
- package/dist/core/tools/ask-user-question/state/inline-input.js.map +1 -0
- package/dist/core/tools/ask-user-question/state/key-router.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/state/key-router.js +30 -4
- package/dist/core/tools/ask-user-question/state/key-router.js.map +1 -1
- package/dist/core/tools/ask-user-question/state/questionnaire-session.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/state/questionnaire-session.js +9 -8
- package/dist/core/tools/ask-user-question/state/questionnaire-session.js.map +1 -1
- package/dist/core/tools/ask-user-question/state/row-intent.d.ts +3 -2
- package/dist/core/tools/ask-user-question/state/row-intent.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/state/row-intent.js +1 -1
- package/dist/core/tools/ask-user-question/state/row-intent.js.map +1 -1
- package/dist/core/tools/ask-user-question/state/selectors/contract.d.ts +2 -0
- package/dist/core/tools/ask-user-question/state/selectors/contract.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/state/selectors/contract.js.map +1 -1
- package/dist/core/tools/ask-user-question/state/selectors/projections.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/state/selectors/projections.js +2 -0
- package/dist/core/tools/ask-user-question/state/selectors/projections.js.map +1 -1
- package/dist/core/tools/ask-user-question/state/state-reducer.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/state/state-reducer.js +36 -24
- package/dist/core/tools/ask-user-question/state/state-reducer.js.map +1 -1
- package/dist/core/tools/ask-user-question/state/state.d.ts +8 -0
- package/dist/core/tools/ask-user-question/state/state.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/state/state.js.map +1 -1
- package/dist/core/tools/ask-user-question/tool/format-answer.d.ts +6 -0
- 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 +19 -1
- 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 +3 -2
- 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 +15 -3
- package/dist/core/tools/ask-user-question/tool/response-envelope.js.map +1 -1
- package/dist/core/tools/ask-user-question/tool/types.d.ts +2 -1
- package/dist/core/tools/ask-user-question/tool/types.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/tool/types.js.map +1 -1
- package/dist/core/tools/ask-user-question/view/components/chat-row-view.d.ts +5 -2
- package/dist/core/tools/ask-user-question/view/components/chat-row-view.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/view/components/chat-row-view.js +2 -0
- package/dist/core/tools/ask-user-question/view/components/chat-row-view.js.map +1 -1
- package/dist/core/tools/ask-user-question/view/components/wrapping-select.d.ts +1 -0
- package/dist/core/tools/ask-user-question/view/components/wrapping-select.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/view/components/wrapping-select.js +2 -1
- package/dist/core/tools/ask-user-question/view/components/wrapping-select.js.map +1 -1
- package/dist/core/tools/ask-user-question/view/props-adapter.d.ts +3 -3
- package/dist/core/tools/ask-user-question/view/props-adapter.d.ts.map +1 -1
- package/dist/core/tools/ask-user-question/view/props-adapter.js +11 -4
- package/dist/core/tools/ask-user-question/view/props-adapter.js.map +1 -1
- package/dist/core/tools/bash-policy.d.ts +62 -0
- package/dist/core/tools/bash-policy.d.ts.map +1 -0
- package/dist/core/tools/bash-policy.js +1069 -0
- package/dist/core/tools/bash-policy.js.map +1 -0
- package/dist/core/tools/bash.d.ts +5 -0
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +9 -1
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js +7 -10
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +1 -1
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js +1 -1
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/index.d.ts +1 -0
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js +1 -0
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/ls.d.ts.map +1 -1
- package/dist/core/tools/ls.js +1 -1
- package/dist/core/tools/ls.js.map +1 -1
- package/dist/core/tools/oversized-tool-result.d.ts +53 -0
- package/dist/core/tools/oversized-tool-result.d.ts.map +1 -0
- package/dist/core/tools/oversized-tool-result.js +206 -0
- package/dist/core/tools/oversized-tool-result.js.map +1 -0
- package/dist/core/tools/read.d.ts +12 -0
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js +99 -34
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/render-utils.d.ts +6 -0
- package/dist/core/tools/render-utils.d.ts.map +1 -1
- package/dist/core/tools/render-utils.js +17 -1
- package/dist/core/tools/render-utils.js.map +1 -1
- package/dist/core/tools/tool-definition-wrapper.d.ts +6 -0
- package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
- package/dist/core/tools/tool-definition-wrapper.js +2 -0
- package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
- package/dist/core/tools/tool-limits.d.ts +25 -0
- package/dist/core/tools/tool-limits.d.ts.map +1 -0
- package/dist/core/tools/tool-limits.js +25 -0
- package/dist/core/tools/tool-limits.js.map +1 -0
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +1 -1
- package/dist/core/tools/write.js.map +1 -1
- package/dist/core/trust-manager.d.ts +31 -0
- package/dist/core/trust-manager.d.ts.map +1 -0
- package/dist/core/trust-manager.js +196 -0
- package/dist/core/trust-manager.js.map +1 -0
- package/dist/index.d.ts +11 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +142 -30
- package/dist/main.js.map +1 -1
- package/dist/migrations.d.ts +3 -1
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +325 -7
- package/dist/migrations.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/bash-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/bash-execution.js +2 -2
- package/dist/modes/interactive/components/bash-execution.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +6 -0
- 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/components/login-dialog.d.ts +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/dist/modes/interactive/components/login-dialog.js +9 -16
- package/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +3 -1
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +20 -0
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +22 -0
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/trust-selector.d.ts +23 -0
- package/dist/modes/interactive/components/trust-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/trust-selector.js +85 -0
- package/dist/modes/interactive/components/trust-selector.js.map +1 -0
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message.js +1 -1
- package/dist/modes/interactive/components/user-message.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +9 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +130 -9
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +10 -0
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +1 -0
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts +3 -0
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +50 -6
- 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 +23 -4
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +1 -0
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/dist/package-manager-cli.d.ts +6 -2
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +104 -10
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/utils/changelog.d.ts +1 -0
- package/dist/utils/changelog.d.ts.map +1 -1
- package/dist/utils/changelog.js +72 -0
- package/dist/utils/changelog.js.map +1 -1
- package/dist/utils/deprecation.d.ts +4 -0
- package/dist/utils/deprecation.d.ts.map +1 -0
- package/dist/utils/deprecation.js +13 -0
- package/dist/utils/deprecation.js.map +1 -0
- package/dist/utils/git.d.ts.map +1 -1
- package/dist/utils/git.js +54 -22
- package/dist/utils/git.js.map +1 -1
- package/dist/utils/json.d.ts +3 -0
- package/dist/utils/json.d.ts.map +1 -0
- package/dist/utils/json.js +7 -0
- package/dist/utils/json.js.map +1 -0
- package/dist/utils/open-browser.d.ts +9 -0
- package/dist/utils/open-browser.d.ts.map +1 -0
- package/dist/utils/open-browser.js +22 -0
- package/dist/utils/open-browser.js.map +1 -0
- package/docs/containerization.md +111 -0
- package/docs/custom-provider.md +9 -9
- package/docs/development.md +1 -1
- package/docs/docs.json +2 -0
- package/docs/extensions.md +40 -4
- package/docs/index.md +2 -0
- package/docs/models.md +10 -10
- package/docs/packages.md +1 -1
- package/docs/prompt-templates.md +9 -2
- package/docs/providers.md +18 -5
- package/docs/quickstart.md +1 -0
- package/docs/rpc.md +3 -2
- package/docs/sdk.md +47 -0
- package/docs/security.md +58 -0
- package/docs/session-format.md +2 -2
- package/docs/sessions.md +8 -0
- package/docs/settings.md +21 -4
- package/docs/skills.md +1 -1
- package/docs/terminal-setup.md +44 -2
- package/docs/themes.md +1 -1
- package/docs/tmux.md +4 -2
- package/docs/tui.md +14 -5
- package/docs/usage.md +17 -3
- package/docs/workflows.md +127 -15
- package/examples/README.md +1 -1
- package/examples/extensions/README.md +8 -5
- package/examples/extensions/bash-spawn-hook.ts +1 -1
- package/examples/extensions/built-in-tool-renderer.ts +1 -1
- package/examples/extensions/claude-rules.ts +1 -1
- package/examples/extensions/commands.ts +1 -1
- package/examples/extensions/custom-header.ts +1 -1
- package/examples/extensions/custom-provider-anthropic/index.ts +3 -3
- package/examples/extensions/custom-provider-anthropic/package-lock.json +4 -4
- package/examples/extensions/custom-provider-anthropic/package.json +6 -6
- package/examples/extensions/custom-provider-gitlab-duo/index.ts +55 -4
- package/examples/extensions/custom-provider-gitlab-duo/package.json +3 -3
- package/examples/extensions/doom-overlay/README.md +1 -1
- package/examples/extensions/doom-overlay/index.ts +2 -2
- package/examples/extensions/git-merge-and-resolve.ts +115 -0
- package/examples/extensions/gondolin/index.ts +523 -0
- package/examples/extensions/gondolin/package-lock.json +185 -0
- package/examples/extensions/gondolin/package.json +19 -0
- package/examples/extensions/handoff.ts +1 -1
- package/examples/extensions/hidden-thinking-label.ts +1 -1
- package/examples/extensions/inline-bash.ts +2 -2
- package/examples/extensions/input-transform-streaming.ts +39 -0
- package/examples/extensions/input-transform.ts +3 -3
- package/examples/extensions/interactive-shell.ts +2 -2
- package/examples/extensions/mac-system-theme.ts +2 -2
- package/examples/extensions/minimal-mode.ts +1 -1
- package/examples/extensions/modal-editor.ts +1 -1
- package/examples/extensions/model-status.ts +1 -1
- package/examples/extensions/overlay-qa-tests.ts +198 -179
- package/examples/extensions/overlay-test.ts +1 -1
- package/examples/extensions/pirate.ts +1 -1
- package/examples/extensions/preset.ts +14 -12
- package/examples/extensions/project-trust.ts +64 -0
- package/examples/extensions/prompt-customizer.ts +1 -1
- package/examples/extensions/qna.ts +1 -1
- package/examples/extensions/question.ts +1 -1
- package/examples/extensions/questionnaire.ts +1 -1
- package/examples/extensions/rainbow-editor.ts +1 -1
- package/examples/extensions/sandbox/index.ts +16 -14
- package/examples/extensions/sandbox/package-lock.json +90 -90
- package/examples/extensions/sandbox/package.json +17 -17
- package/examples/extensions/snake.ts +1 -1
- package/examples/extensions/space-invaders.ts +1 -1
- package/examples/extensions/ssh.ts +2 -2
- package/examples/extensions/subagent/README.md +13 -13
- package/examples/extensions/subagent/agents.ts +4 -2
- package/examples/extensions/subagent/index.ts +6 -6
- package/examples/extensions/summarize.ts +1 -1
- package/examples/extensions/tic-tac-toe.ts +1 -1
- package/examples/extensions/titlebar-spinner.ts +1 -1
- package/examples/extensions/todo.ts +1 -1
- package/examples/extensions/tool-override.ts +1 -1
- package/examples/extensions/tools.ts +6 -1
- package/examples/extensions/with-deps/package-lock.json +4 -4
- package/examples/extensions/with-deps/package.json +7 -7
- package/examples/extensions/working-indicator.ts +4 -4
- package/examples/extensions/working-message-test.ts +1 -1
- package/examples/sdk/01-minimal.ts +1 -1
- package/examples/sdk/03-custom-prompt.ts +1 -1
- package/examples/sdk/04-skills.ts +1 -1
- package/examples/sdk/06-extensions.ts +2 -2
- package/examples/sdk/08-prompt-templates.ts +1 -1
- package/examples/sdk/09-api-keys-and-oauth.ts +2 -2
- package/examples/sdk/README.md +2 -2
- package/package.json +4 -4
|
@@ -0,0 +1,523 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gondolin Tool Routing Example
|
|
3
|
+
*
|
|
4
|
+
* Runs Atomic's built-in tools inside a local Gondolin micro-VM. The host working
|
|
5
|
+
* directory is mounted at /workspace in the guest. File changes under
|
|
6
|
+
* /workspace write through to the host; other guest filesystem changes are
|
|
7
|
+
* isolated to the VM.
|
|
8
|
+
*
|
|
9
|
+
* Setup:
|
|
10
|
+
* cd packages/coding-agent/examples/extensions/gondolin
|
|
11
|
+
* npm install --ignore-scripts
|
|
12
|
+
*
|
|
13
|
+
* Usage:
|
|
14
|
+
* cd /path/to/project
|
|
15
|
+
* atomic -e /path/to/atomic/packages/coding-agent/examples/extensions/gondolin
|
|
16
|
+
*
|
|
17
|
+
* Requirements:
|
|
18
|
+
* - Node.js >= 23.6.0 for @earendil-works/gondolin
|
|
19
|
+
* - QEMU installed (for example, `brew install qemu` on macOS)
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import path from "node:path";
|
|
23
|
+
import { RealFSProvider, VM } from "@earendil-works/gondolin";
|
|
24
|
+
import type { ExtensionAPI, ExtensionContext } from "@bastani/atomic";
|
|
25
|
+
import {
|
|
26
|
+
type BashOperations,
|
|
27
|
+
createBashTool,
|
|
28
|
+
createEditTool,
|
|
29
|
+
createFindTool,
|
|
30
|
+
createGrepTool,
|
|
31
|
+
createLsTool,
|
|
32
|
+
createReadTool,
|
|
33
|
+
createWriteTool,
|
|
34
|
+
DEFAULT_MAX_BYTES,
|
|
35
|
+
type EditOperations,
|
|
36
|
+
type FindOperations,
|
|
37
|
+
formatSize,
|
|
38
|
+
type GrepToolDetails,
|
|
39
|
+
type GrepToolInput,
|
|
40
|
+
type LsOperations,
|
|
41
|
+
type ReadOperations,
|
|
42
|
+
truncateHead,
|
|
43
|
+
truncateLine,
|
|
44
|
+
type WriteOperations,
|
|
45
|
+
} from "@bastani/atomic";
|
|
46
|
+
|
|
47
|
+
const GUEST_WORKSPACE = "/workspace";
|
|
48
|
+
const DEFAULT_GREP_LIMIT = 100;
|
|
49
|
+
|
|
50
|
+
type TextToolResult<TDetails> = {
|
|
51
|
+
content: Array<{ type: "text"; text: string }>;
|
|
52
|
+
details: TDetails | undefined;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
function stripAtPrefix(value: string): string {
|
|
56
|
+
return value.startsWith("@") ? value.slice(1) : value;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function toPosix(value: string): string {
|
|
60
|
+
return value.split(path.sep).join(path.posix.sep);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function isInsideHostPath(root: string, value: string): boolean {
|
|
64
|
+
const relativePath = path.relative(root, value);
|
|
65
|
+
return relativePath === "" || (!relativePath.startsWith("..") && !path.isAbsolute(relativePath));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function hostPathToGuest(localCwd: string, hostPath: string): string {
|
|
69
|
+
const relativePath = path.relative(localCwd, hostPath);
|
|
70
|
+
if (!isInsideHostPath(localCwd, hostPath)) return toPosix(hostPath);
|
|
71
|
+
return relativePath ? path.posix.join(GUEST_WORKSPACE, toPosix(relativePath)) : GUEST_WORKSPACE;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function toGuestPath(localCwd: string, inputPath: string): string {
|
|
75
|
+
const trimmed = stripAtPrefix(inputPath.trim());
|
|
76
|
+
if (!trimmed) return GUEST_WORKSPACE;
|
|
77
|
+
if (path.isAbsolute(trimmed)) {
|
|
78
|
+
if (isInsideHostPath(localCwd, trimmed)) return hostPathToGuest(localCwd, trimmed);
|
|
79
|
+
return path.posix.resolve("/", toPosix(trimmed));
|
|
80
|
+
}
|
|
81
|
+
return path.posix.resolve(GUEST_WORKSPACE, toPosix(trimmed));
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function createGondolinReadOps(vm: VM, localCwd: string): ReadOperations {
|
|
85
|
+
return {
|
|
86
|
+
readFile: async (filePath) => vm.fs.readFile(toGuestPath(localCwd, filePath)),
|
|
87
|
+
access: async (filePath) => {
|
|
88
|
+
await vm.fs.access(toGuestPath(localCwd, filePath));
|
|
89
|
+
},
|
|
90
|
+
detectImageMimeType: async (filePath) => {
|
|
91
|
+
const ext = path.posix.extname(toGuestPath(localCwd, filePath)).toLowerCase();
|
|
92
|
+
if (ext === ".png") return "image/png";
|
|
93
|
+
if (ext === ".jpg" || ext === ".jpeg") return "image/jpeg";
|
|
94
|
+
if (ext === ".gif") return "image/gif";
|
|
95
|
+
if (ext === ".webp") return "image/webp";
|
|
96
|
+
return null;
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function createGondolinWriteOps(vm: VM, localCwd: string): WriteOperations {
|
|
102
|
+
return {
|
|
103
|
+
writeFile: async (filePath, content) => {
|
|
104
|
+
await vm.fs.writeFile(toGuestPath(localCwd, filePath), content, { encoding: "utf8" });
|
|
105
|
+
},
|
|
106
|
+
mkdir: async (dirPath) => {
|
|
107
|
+
await vm.fs.mkdir(toGuestPath(localCwd, dirPath), { recursive: true });
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function createGondolinEditOps(vm: VM, localCwd: string): EditOperations {
|
|
113
|
+
const readOps = createGondolinReadOps(vm, localCwd);
|
|
114
|
+
const writeOps = createGondolinWriteOps(vm, localCwd);
|
|
115
|
+
return {
|
|
116
|
+
readFile: readOps.readFile,
|
|
117
|
+
writeFile: writeOps.writeFile,
|
|
118
|
+
access: readOps.access,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function createGondolinLsOps(vm: VM, localCwd: string): LsOperations {
|
|
123
|
+
return {
|
|
124
|
+
exists: async (filePath) => {
|
|
125
|
+
try {
|
|
126
|
+
await vm.fs.access(toGuestPath(localCwd, filePath));
|
|
127
|
+
return true;
|
|
128
|
+
} catch {
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
stat: async (filePath) => vm.fs.stat(toGuestPath(localCwd, filePath)),
|
|
133
|
+
readdir: async (dirPath) => vm.fs.listDir(toGuestPath(localCwd, dirPath)),
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
async function walkGuestFiles(
|
|
138
|
+
vm: VM,
|
|
139
|
+
root: string,
|
|
140
|
+
visit: (guestPath: string, relativePath: string) => Promise<boolean>,
|
|
141
|
+
signal?: AbortSignal,
|
|
142
|
+
): Promise<boolean> {
|
|
143
|
+
if (signal?.aborted) throw new Error("Operation aborted");
|
|
144
|
+
const stat = await vm.fs.stat(root, { signal });
|
|
145
|
+
if (!stat.isDirectory()) return visit(root, path.posix.basename(root));
|
|
146
|
+
|
|
147
|
+
const walkDirectory = async (dir: string, relativeDir: string): Promise<boolean> => {
|
|
148
|
+
if (signal?.aborted) throw new Error("Operation aborted");
|
|
149
|
+
const entries = await vm.fs.listDir(dir, { signal });
|
|
150
|
+
for (const entry of entries) {
|
|
151
|
+
if (entry === ".git" || entry === "node_modules") continue;
|
|
152
|
+
const guestPath = path.posix.join(dir, entry);
|
|
153
|
+
const relativePath = relativeDir ? path.posix.join(relativeDir, entry) : entry;
|
|
154
|
+
let entryStat: Awaited<ReturnType<VM["fs"]["stat"]>>;
|
|
155
|
+
try {
|
|
156
|
+
entryStat = await vm.fs.stat(guestPath, { signal });
|
|
157
|
+
} catch {
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
if (entryStat.isDirectory()) {
|
|
161
|
+
if (!(await walkDirectory(guestPath, relativePath))) return false;
|
|
162
|
+
} else if (!(await visit(guestPath, relativePath))) {
|
|
163
|
+
return false;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return true;
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
return walkDirectory(root, "");
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function matchesToolGlob(relativePath: string, pattern: string): boolean {
|
|
173
|
+
const normalizedPattern = toPosix(pattern);
|
|
174
|
+
if (normalizedPattern.includes("/")) {
|
|
175
|
+
return (
|
|
176
|
+
path.posix.matchesGlob(relativePath, normalizedPattern) ||
|
|
177
|
+
path.posix.matchesGlob(relativePath, `**/${normalizedPattern}`)
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
return path.posix.matchesGlob(path.posix.basename(relativePath), normalizedPattern);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function createGondolinFindOps(vm: VM, localCwd: string): FindOperations {
|
|
184
|
+
return {
|
|
185
|
+
exists: async (filePath) => {
|
|
186
|
+
try {
|
|
187
|
+
await vm.fs.access(toGuestPath(localCwd, filePath));
|
|
188
|
+
return true;
|
|
189
|
+
} catch {
|
|
190
|
+
return false;
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
glob: async (pattern, cwd, options) => {
|
|
194
|
+
const root = toGuestPath(localCwd, cwd);
|
|
195
|
+
const results: string[] = [];
|
|
196
|
+
await walkGuestFiles(vm, root, async (guestPath, relativePath) => {
|
|
197
|
+
if (results.length >= options.limit) return false;
|
|
198
|
+
if (matchesToolGlob(relativePath, pattern)) results.push(guestPath);
|
|
199
|
+
return results.length < options.limit;
|
|
200
|
+
});
|
|
201
|
+
return results;
|
|
202
|
+
},
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function createLineMatcher(pattern: string, literal: boolean | undefined, ignoreCase: boolean | undefined) {
|
|
207
|
+
if (literal) {
|
|
208
|
+
const needle = ignoreCase ? pattern.toLowerCase() : pattern;
|
|
209
|
+
return (line: string) => (ignoreCase ? line.toLowerCase() : line).includes(needle);
|
|
210
|
+
}
|
|
211
|
+
const regex = new RegExp(pattern, ignoreCase ? "i" : undefined);
|
|
212
|
+
return (line: string) => regex.test(line);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
function appendGrepBlock(params: {
|
|
216
|
+
outputLines: string[];
|
|
217
|
+
lines: string[];
|
|
218
|
+
relativePath: string;
|
|
219
|
+
lineIndex: number;
|
|
220
|
+
contextLines: number;
|
|
221
|
+
}): boolean {
|
|
222
|
+
let linesTruncated = false;
|
|
223
|
+
const start = params.contextLines > 0 ? Math.max(0, params.lineIndex - params.contextLines) : params.lineIndex;
|
|
224
|
+
const end =
|
|
225
|
+
params.contextLines > 0
|
|
226
|
+
? Math.min(params.lines.length - 1, params.lineIndex + params.contextLines)
|
|
227
|
+
: params.lineIndex;
|
|
228
|
+
|
|
229
|
+
for (let index = start; index <= end; index++) {
|
|
230
|
+
const rawLine = params.lines[index] ?? "";
|
|
231
|
+
const { text, wasTruncated } = truncateLine(rawLine.replace(/\r/g, ""));
|
|
232
|
+
if (wasTruncated) linesTruncated = true;
|
|
233
|
+
const separator = index === params.lineIndex ? ":" : "-";
|
|
234
|
+
params.outputLines.push(`${params.relativePath}${separator}${index + 1}${separator} ${text}`);
|
|
235
|
+
}
|
|
236
|
+
return linesTruncated;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
async function executeGondolinGrep(
|
|
240
|
+
vm: VM,
|
|
241
|
+
localCwd: string,
|
|
242
|
+
params: GrepToolInput,
|
|
243
|
+
signal?: AbortSignal,
|
|
244
|
+
): Promise<TextToolResult<GrepToolDetails>> {
|
|
245
|
+
const root = toGuestPath(localCwd, params.path ?? ".");
|
|
246
|
+
const rootStat = await vm.fs.stat(root, { signal });
|
|
247
|
+
const rootIsDirectory = rootStat.isDirectory();
|
|
248
|
+
const matcher = createLineMatcher(params.pattern, params.literal, params.ignoreCase);
|
|
249
|
+
const contextLines = params.context && params.context > 0 ? params.context : 0;
|
|
250
|
+
const effectiveLimit = Math.max(1, params.limit ?? DEFAULT_GREP_LIMIT);
|
|
251
|
+
const outputLines: string[] = [];
|
|
252
|
+
const details: GrepToolDetails = {};
|
|
253
|
+
let matchCount = 0;
|
|
254
|
+
let matchLimitReached = false;
|
|
255
|
+
let linesTruncated = false;
|
|
256
|
+
|
|
257
|
+
await walkGuestFiles(
|
|
258
|
+
vm,
|
|
259
|
+
root,
|
|
260
|
+
async (guestPath, relativePath) => {
|
|
261
|
+
if (matchCount >= effectiveLimit) return false;
|
|
262
|
+
if (params.glob && !matchesToolGlob(relativePath, params.glob)) return true;
|
|
263
|
+
let content: string;
|
|
264
|
+
try {
|
|
265
|
+
content = await vm.fs.readFile(guestPath, { encoding: "utf8", signal });
|
|
266
|
+
} catch {
|
|
267
|
+
return true;
|
|
268
|
+
}
|
|
269
|
+
const lines = content.replace(/\r\n/g, "\n").replace(/\r/g, "\n").split("\n");
|
|
270
|
+
const displayPath = rootIsDirectory ? relativePath : path.posix.basename(guestPath);
|
|
271
|
+
for (let index = 0; index < lines.length; index++) {
|
|
272
|
+
if (signal?.aborted) throw new Error("Operation aborted");
|
|
273
|
+
if (!matcher(lines[index] ?? "")) continue;
|
|
274
|
+
matchCount++;
|
|
275
|
+
if (appendGrepBlock({ outputLines, lines, relativePath: displayPath, lineIndex: index, contextLines })) {
|
|
276
|
+
linesTruncated = true;
|
|
277
|
+
}
|
|
278
|
+
if (matchCount >= effectiveLimit) {
|
|
279
|
+
matchLimitReached = true;
|
|
280
|
+
return false;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
return true;
|
|
284
|
+
},
|
|
285
|
+
signal,
|
|
286
|
+
);
|
|
287
|
+
|
|
288
|
+
if (matchCount === 0) return { content: [{ type: "text", text: "No matches found" }], details: undefined };
|
|
289
|
+
|
|
290
|
+
const rawOutput = outputLines.join("\n");
|
|
291
|
+
const truncation = truncateHead(rawOutput, { maxLines: Number.MAX_SAFE_INTEGER });
|
|
292
|
+
const notices: string[] = [];
|
|
293
|
+
let output = truncation.content;
|
|
294
|
+
|
|
295
|
+
if (matchLimitReached) {
|
|
296
|
+
details.matchLimitReached = effectiveLimit;
|
|
297
|
+
notices.push(`${effectiveLimit} matches limit reached`);
|
|
298
|
+
}
|
|
299
|
+
if (linesTruncated) {
|
|
300
|
+
details.linesTruncated = true;
|
|
301
|
+
notices.push("long lines truncated");
|
|
302
|
+
}
|
|
303
|
+
if (truncation.truncated) {
|
|
304
|
+
details.truncation = truncation;
|
|
305
|
+
notices.push(`${formatSize(DEFAULT_MAX_BYTES)} limit reached`);
|
|
306
|
+
}
|
|
307
|
+
if (notices.length > 0) output += `\n\n[${notices.join(". ")}]`;
|
|
308
|
+
|
|
309
|
+
return {
|
|
310
|
+
content: [{ type: "text", text: output }],
|
|
311
|
+
details: Object.keys(details).length > 0 ? details : undefined,
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
function createGondolinBashOps(vm: VM, localCwd: string, shellPath: string): BashOperations {
|
|
316
|
+
return {
|
|
317
|
+
exec: async (command, cwd, { onData, signal, timeout }) => {
|
|
318
|
+
if (signal?.aborted) throw new Error("aborted");
|
|
319
|
+
const guestCwd = toGuestPath(localCwd, cwd);
|
|
320
|
+
const controller = new AbortController();
|
|
321
|
+
const onAbort = () => controller.abort();
|
|
322
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
323
|
+
|
|
324
|
+
let timedOut = false;
|
|
325
|
+
const timer =
|
|
326
|
+
timeout && timeout > 0
|
|
327
|
+
? setTimeout(() => {
|
|
328
|
+
timedOut = true;
|
|
329
|
+
controller.abort();
|
|
330
|
+
}, timeout * 1000)
|
|
331
|
+
: undefined;
|
|
332
|
+
|
|
333
|
+
try {
|
|
334
|
+
const proc = vm.exec([shellPath, "-lc", command], {
|
|
335
|
+
cwd: guestCwd,
|
|
336
|
+
// Deliberately do not forward the host shell environment into the VM.
|
|
337
|
+
// Atomic authentication and other host secrets stay on the host.
|
|
338
|
+
signal: controller.signal,
|
|
339
|
+
stdout: "pipe",
|
|
340
|
+
stderr: "pipe",
|
|
341
|
+
});
|
|
342
|
+
for await (const chunk of proc.output()) onData(chunk.data);
|
|
343
|
+
const result = await proc;
|
|
344
|
+
return { exitCode: result.exitCode };
|
|
345
|
+
} catch (error) {
|
|
346
|
+
if (signal?.aborted) throw new Error("aborted");
|
|
347
|
+
if (timedOut) throw new Error(`timeout:${timeout}`);
|
|
348
|
+
throw error;
|
|
349
|
+
} finally {
|
|
350
|
+
if (timer) clearTimeout(timer);
|
|
351
|
+
signal?.removeEventListener("abort", onAbort);
|
|
352
|
+
}
|
|
353
|
+
},
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
export default function (pi: ExtensionAPI) {
|
|
358
|
+
const localCwd = process.cwd();
|
|
359
|
+
const localRead = createReadTool(localCwd);
|
|
360
|
+
const localWrite = createWriteTool(localCwd);
|
|
361
|
+
const localEdit = createEditTool(localCwd);
|
|
362
|
+
const localBash = createBashTool(localCwd);
|
|
363
|
+
const localGrep = createGrepTool(localCwd);
|
|
364
|
+
const localFind = createFindTool(localCwd);
|
|
365
|
+
const localLs = createLsTool(localCwd);
|
|
366
|
+
|
|
367
|
+
let vm: VM | undefined;
|
|
368
|
+
let vmStarting: Promise<VM> | undefined;
|
|
369
|
+
let shellPath = "/bin/sh";
|
|
370
|
+
|
|
371
|
+
async function startVm(ctx?: ExtensionContext): Promise<VM> {
|
|
372
|
+
ctx?.ui.setStatus("gondolin", ctx.ui.theme.fg("accent", `Gondolin: starting ${GUEST_WORKSPACE}`));
|
|
373
|
+
const created = await VM.create({
|
|
374
|
+
sessionLabel: `atomic ${path.basename(localCwd)}`,
|
|
375
|
+
vfs: {
|
|
376
|
+
mounts: {
|
|
377
|
+
[GUEST_WORKSPACE]: new RealFSProvider(localCwd),
|
|
378
|
+
},
|
|
379
|
+
},
|
|
380
|
+
});
|
|
381
|
+
const bashProbe = await created.exec(["/bin/sh", "-lc", "command -v bash || true"]);
|
|
382
|
+
shellPath = bashProbe.stdout.trim() || "/bin/sh";
|
|
383
|
+
vm = created;
|
|
384
|
+
ctx?.ui.setStatus(
|
|
385
|
+
"gondolin",
|
|
386
|
+
ctx.ui.theme.fg("accent", `Gondolin: ${created.id.slice(0, 8)} (${GUEST_WORKSPACE})`),
|
|
387
|
+
);
|
|
388
|
+
ctx?.ui.notify(`Gondolin VM ready. ${localCwd} is mounted at ${GUEST_WORKSPACE}.`, "info");
|
|
389
|
+
return created;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
async function ensureVm(ctx?: ExtensionContext): Promise<VM> {
|
|
393
|
+
if (vm) return vm;
|
|
394
|
+
if (!vmStarting) {
|
|
395
|
+
vmStarting = startVm(ctx).finally(() => {
|
|
396
|
+
vmStarting = undefined;
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
return vmStarting;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
pi.on("session_start", async (_event, ctx) => {
|
|
403
|
+
await ensureVm(ctx);
|
|
404
|
+
});
|
|
405
|
+
|
|
406
|
+
pi.on("session_shutdown", async (_event, ctx) => {
|
|
407
|
+
const activeVm = vm;
|
|
408
|
+
vm = undefined;
|
|
409
|
+
vmStarting = undefined;
|
|
410
|
+
if (!activeVm) return;
|
|
411
|
+
ctx.ui.setStatus("gondolin", ctx.ui.theme.fg("muted", "Gondolin: stopping"));
|
|
412
|
+
try {
|
|
413
|
+
await activeVm.close();
|
|
414
|
+
} finally {
|
|
415
|
+
ctx.ui.setStatus("gondolin", undefined);
|
|
416
|
+
}
|
|
417
|
+
});
|
|
418
|
+
|
|
419
|
+
pi.registerCommand("gondolin", {
|
|
420
|
+
description: "Show Gondolin VM status",
|
|
421
|
+
handler: async (_args, ctx) => {
|
|
422
|
+
const activeVm = await ensureVm(ctx);
|
|
423
|
+
ctx.ui.notify(
|
|
424
|
+
[
|
|
425
|
+
`Gondolin VM: ${activeVm.id}`,
|
|
426
|
+
`Host workspace: ${localCwd}`,
|
|
427
|
+
`Guest workspace: ${GUEST_WORKSPACE}`,
|
|
428
|
+
`Shell: ${shellPath}`,
|
|
429
|
+
].join("\n"),
|
|
430
|
+
"info",
|
|
431
|
+
);
|
|
432
|
+
},
|
|
433
|
+
});
|
|
434
|
+
|
|
435
|
+
pi.registerTool({
|
|
436
|
+
...localRead,
|
|
437
|
+
async execute(id, params, signal, onUpdate, ctx) {
|
|
438
|
+
const activeVm = await ensureVm(ctx);
|
|
439
|
+
const tool = createReadTool(GUEST_WORKSPACE, {
|
|
440
|
+
operations: createGondolinReadOps(activeVm, localCwd),
|
|
441
|
+
});
|
|
442
|
+
return tool.execute(id, params, signal, onUpdate);
|
|
443
|
+
},
|
|
444
|
+
});
|
|
445
|
+
|
|
446
|
+
pi.registerTool({
|
|
447
|
+
...localWrite,
|
|
448
|
+
async execute(id, params, signal, onUpdate, ctx) {
|
|
449
|
+
const activeVm = await ensureVm(ctx);
|
|
450
|
+
const tool = createWriteTool(GUEST_WORKSPACE, {
|
|
451
|
+
operations: createGondolinWriteOps(activeVm, localCwd),
|
|
452
|
+
});
|
|
453
|
+
return tool.execute(id, params, signal, onUpdate);
|
|
454
|
+
},
|
|
455
|
+
});
|
|
456
|
+
|
|
457
|
+
pi.registerTool({
|
|
458
|
+
...localEdit,
|
|
459
|
+
async execute(id, params, signal, onUpdate, ctx) {
|
|
460
|
+
const activeVm = await ensureVm(ctx);
|
|
461
|
+
const tool = createEditTool(GUEST_WORKSPACE, {
|
|
462
|
+
operations: createGondolinEditOps(activeVm, localCwd),
|
|
463
|
+
});
|
|
464
|
+
return tool.execute(id, params, signal, onUpdate);
|
|
465
|
+
},
|
|
466
|
+
});
|
|
467
|
+
|
|
468
|
+
pi.registerTool({
|
|
469
|
+
...localBash,
|
|
470
|
+
async execute(id, params, signal, onUpdate, ctx) {
|
|
471
|
+
const activeVm = await ensureVm(ctx);
|
|
472
|
+
const tool = createBashTool(GUEST_WORKSPACE, {
|
|
473
|
+
operations: createGondolinBashOps(activeVm, localCwd, shellPath),
|
|
474
|
+
});
|
|
475
|
+
return tool.execute(id, params, signal, onUpdate);
|
|
476
|
+
},
|
|
477
|
+
});
|
|
478
|
+
|
|
479
|
+
pi.registerTool({
|
|
480
|
+
...localLs,
|
|
481
|
+
async execute(id, params, signal, onUpdate, ctx) {
|
|
482
|
+
const activeVm = await ensureVm(ctx);
|
|
483
|
+
const tool = createLsTool(GUEST_WORKSPACE, {
|
|
484
|
+
operations: createGondolinLsOps(activeVm, localCwd),
|
|
485
|
+
});
|
|
486
|
+
return tool.execute(id, params, signal, onUpdate);
|
|
487
|
+
},
|
|
488
|
+
});
|
|
489
|
+
|
|
490
|
+
pi.registerTool({
|
|
491
|
+
...localFind,
|
|
492
|
+
async execute(id, params, signal, onUpdate, ctx) {
|
|
493
|
+
const activeVm = await ensureVm(ctx);
|
|
494
|
+
const tool = createFindTool(GUEST_WORKSPACE, {
|
|
495
|
+
operations: createGondolinFindOps(activeVm, localCwd),
|
|
496
|
+
});
|
|
497
|
+
return tool.execute(id, params, signal, onUpdate);
|
|
498
|
+
},
|
|
499
|
+
});
|
|
500
|
+
|
|
501
|
+
pi.registerTool({
|
|
502
|
+
...localGrep,
|
|
503
|
+
async execute(_id, params, signal, _onUpdate, ctx) {
|
|
504
|
+
const activeVm = await ensureVm(ctx);
|
|
505
|
+
return executeGondolinGrep(activeVm, localCwd, params, signal);
|
|
506
|
+
},
|
|
507
|
+
});
|
|
508
|
+
|
|
509
|
+
pi.on("user_bash", async (_event, ctx) => {
|
|
510
|
+
const activeVm = await ensureVm(ctx);
|
|
511
|
+
return { operations: createGondolinBashOps(activeVm, localCwd, shellPath) };
|
|
512
|
+
});
|
|
513
|
+
|
|
514
|
+
pi.on("before_agent_start", async (event, ctx) => {
|
|
515
|
+
await ensureVm(ctx);
|
|
516
|
+
const localLine = `Current working directory: ${localCwd}`;
|
|
517
|
+
const guestLine = `Current working directory: ${GUEST_WORKSPACE} (Gondolin VM; host workspace mounted from ${localCwd})`;
|
|
518
|
+
const systemPrompt = event.systemPrompt.includes(localLine)
|
|
519
|
+
? event.systemPrompt.replace(localLine, guestLine)
|
|
520
|
+
: `${event.systemPrompt}\n\n${guestLine}`;
|
|
521
|
+
return { systemPrompt };
|
|
522
|
+
});
|
|
523
|
+
}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "atomic-extension-gondolin",
|
|
3
|
+
"version": "0.79.1",
|
|
4
|
+
"lockfileVersion": 3,
|
|
5
|
+
"requires": true,
|
|
6
|
+
"packages": {
|
|
7
|
+
"": {
|
|
8
|
+
"name": "atomic-extension-gondolin",
|
|
9
|
+
"version": "0.79.1",
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@earendil-works/gondolin": "0.12.0"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"node_modules/@cto.af/wtf8": {
|
|
15
|
+
"version": "0.0.5",
|
|
16
|
+
"resolved": "https://registry.npmjs.org/@cto.af/wtf8/-/wtf8-0.0.5.tgz",
|
|
17
|
+
"integrity": "sha512-LfUFi+Vv4eDzj+XAtR89e3wwjXA/NZjUSwU5NhwbBrLecxPaBYFy3exCuc1j+D4UZeOVdqlsl8G7LmOt18V0tg==",
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">=20"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"node_modules/@earendil-works/gondolin": {
|
|
24
|
+
"version": "0.12.0",
|
|
25
|
+
"resolved": "https://registry.npmjs.org/@earendil-works/gondolin/-/gondolin-0.12.0.tgz",
|
|
26
|
+
"integrity": "sha512-BXbvzQKb5QmxY5NtthRDONJTu7+IDKbzqWGrJyyNXMP7N681Tx0Q9TK8pK1ba8nUvYQTipNJyGZOsJfYiZll1A==",
|
|
27
|
+
"license": "Apache-2.0",
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"cbor2": "^2.3.0",
|
|
30
|
+
"node-forge": "^1.3.3",
|
|
31
|
+
"ssh2": "^1.17.0",
|
|
32
|
+
"undici": "^6.21.0"
|
|
33
|
+
},
|
|
34
|
+
"bin": {
|
|
35
|
+
"gondolin": "dist/bin/gondolin.js"
|
|
36
|
+
},
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=23.6.0"
|
|
39
|
+
},
|
|
40
|
+
"optionalDependencies": {
|
|
41
|
+
"@earendil-works/gondolin-krun-runner-darwin-arm64": "0.12.0",
|
|
42
|
+
"@earendil-works/gondolin-krun-runner-linux-x64": "0.12.0"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"node_modules/@earendil-works/gondolin-krun-runner-darwin-arm64": {
|
|
46
|
+
"version": "0.12.0",
|
|
47
|
+
"resolved": "https://registry.npmjs.org/@earendil-works/gondolin-krun-runner-darwin-arm64/-/gondolin-krun-runner-darwin-arm64-0.12.0.tgz",
|
|
48
|
+
"integrity": "sha512-ftDlusht4PcT7Y3TuPrZIKrCXy3isiBTVMvlXYK0pcud2uXY6uwFTGeunYgP+8ND/60ddb+MImqbfmkcK8B84A==",
|
|
49
|
+
"cpu": [
|
|
50
|
+
"arm64"
|
|
51
|
+
],
|
|
52
|
+
"license": "Apache-2.0",
|
|
53
|
+
"optional": true,
|
|
54
|
+
"os": [
|
|
55
|
+
"darwin"
|
|
56
|
+
],
|
|
57
|
+
"bin": {
|
|
58
|
+
"gondolin-krun-runner": "bin/gondolin-krun-runner"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"node_modules/@earendil-works/gondolin-krun-runner-linux-x64": {
|
|
62
|
+
"version": "0.12.0",
|
|
63
|
+
"resolved": "https://registry.npmjs.org/@earendil-works/gondolin-krun-runner-linux-x64/-/gondolin-krun-runner-linux-x64-0.12.0.tgz",
|
|
64
|
+
"integrity": "sha512-RRYsgwe2r5ApKmFNy469QgwnyjAHpAs9XANdWpTd9ol4iUYOY3sX7e0xIooAKxd+ktxGI4N/xRWicwGen3D/Ow==",
|
|
65
|
+
"cpu": [
|
|
66
|
+
"x64"
|
|
67
|
+
],
|
|
68
|
+
"license": "Apache-2.0",
|
|
69
|
+
"optional": true,
|
|
70
|
+
"os": [
|
|
71
|
+
"linux"
|
|
72
|
+
],
|
|
73
|
+
"bin": {
|
|
74
|
+
"gondolin-krun-runner": "bin/gondolin-krun-runner"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"node_modules/asn1": {
|
|
78
|
+
"version": "0.2.6",
|
|
79
|
+
"resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz",
|
|
80
|
+
"integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==",
|
|
81
|
+
"license": "MIT",
|
|
82
|
+
"dependencies": {
|
|
83
|
+
"safer-buffer": "~2.1.0"
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"node_modules/bcrypt-pbkdf": {
|
|
87
|
+
"version": "1.0.2",
|
|
88
|
+
"resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz",
|
|
89
|
+
"integrity": "sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==",
|
|
90
|
+
"license": "BSD-3-Clause",
|
|
91
|
+
"dependencies": {
|
|
92
|
+
"tweetnacl": "^0.14.3"
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
"node_modules/buildcheck": {
|
|
96
|
+
"version": "0.0.7",
|
|
97
|
+
"resolved": "https://registry.npmjs.org/buildcheck/-/buildcheck-0.0.7.tgz",
|
|
98
|
+
"integrity": "sha512-lHblz4ahamxpTmnsk+MNTRWsjYKv965MwOrSJyeD588rR3Jcu7swE+0wN5F+PbL5cjgu/9ObkhfzEPuofEMwLA==",
|
|
99
|
+
"optional": true,
|
|
100
|
+
"engines": {
|
|
101
|
+
"node": ">=10.0.0"
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
"node_modules/cbor2": {
|
|
105
|
+
"version": "2.3.0",
|
|
106
|
+
"resolved": "https://registry.npmjs.org/cbor2/-/cbor2-2.3.0.tgz",
|
|
107
|
+
"integrity": "sha512-76WB3hq8BoaGkMkBVJ27fW5LJU+qqDLEpgRNCG/SYKhODWXpVPOTD4UcUto3IEzYLA52nsvbhb0wabhHDn3qXg==",
|
|
108
|
+
"license": "MIT",
|
|
109
|
+
"dependencies": {
|
|
110
|
+
"@cto.af/wtf8": "0.0.5"
|
|
111
|
+
},
|
|
112
|
+
"engines": {
|
|
113
|
+
"node": ">=20"
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
"node_modules/cpu-features": {
|
|
117
|
+
"version": "0.0.10",
|
|
118
|
+
"resolved": "https://registry.npmjs.org/cpu-features/-/cpu-features-0.0.10.tgz",
|
|
119
|
+
"integrity": "sha512-9IkYqtX3YHPCzoVg1Py+o9057a3i0fp7S530UWokCSaFVTc7CwXPRiOjRjBQQ18ZCNafx78YfnG+HALxtVmOGA==",
|
|
120
|
+
"hasInstallScript": true,
|
|
121
|
+
"optional": true,
|
|
122
|
+
"dependencies": {
|
|
123
|
+
"buildcheck": "~0.0.6",
|
|
124
|
+
"nan": "^2.19.0"
|
|
125
|
+
},
|
|
126
|
+
"engines": {
|
|
127
|
+
"node": ">=10.0.0"
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
"node_modules/nan": {
|
|
131
|
+
"version": "2.27.0",
|
|
132
|
+
"resolved": "https://registry.npmjs.org/nan/-/nan-2.27.0.tgz",
|
|
133
|
+
"integrity": "sha512-hC+0LidcL3XE4rp1C4H54KujgXKzbfyTngZTwBByQxsOxCEKZT0MPQ4hOKUH2jU1OYstqdDH4onyHPDzcV0XdQ==",
|
|
134
|
+
"license": "MIT",
|
|
135
|
+
"optional": true
|
|
136
|
+
},
|
|
137
|
+
"node_modules/node-forge": {
|
|
138
|
+
"version": "1.4.0",
|
|
139
|
+
"resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.4.0.tgz",
|
|
140
|
+
"integrity": "sha512-LarFH0+6VfriEhqMMcLX2F7SwSXeWwnEAJEsYm5QKWchiVYVvJyV9v7UDvUv+w5HO23ZpQTXDv/GxdDdMyOuoQ==",
|
|
141
|
+
"license": "(BSD-3-Clause OR GPL-2.0)",
|
|
142
|
+
"engines": {
|
|
143
|
+
"node": ">= 6.13.0"
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
"node_modules/safer-buffer": {
|
|
147
|
+
"version": "2.1.2",
|
|
148
|
+
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
|
149
|
+
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
|
|
150
|
+
"license": "MIT"
|
|
151
|
+
},
|
|
152
|
+
"node_modules/ssh2": {
|
|
153
|
+
"version": "1.17.0",
|
|
154
|
+
"resolved": "https://registry.npmjs.org/ssh2/-/ssh2-1.17.0.tgz",
|
|
155
|
+
"integrity": "sha512-wPldCk3asibAjQ/kziWQQt1Wh3PgDFpC0XpwclzKcdT1vql6KeYxf5LIt4nlFkUeR8WuphYMKqUA56X4rjbfgQ==",
|
|
156
|
+
"hasInstallScript": true,
|
|
157
|
+
"dependencies": {
|
|
158
|
+
"asn1": "^0.2.6",
|
|
159
|
+
"bcrypt-pbkdf": "^1.0.2"
|
|
160
|
+
},
|
|
161
|
+
"engines": {
|
|
162
|
+
"node": ">=10.16.0"
|
|
163
|
+
},
|
|
164
|
+
"optionalDependencies": {
|
|
165
|
+
"cpu-features": "~0.0.10",
|
|
166
|
+
"nan": "^2.23.0"
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
"node_modules/tweetnacl": {
|
|
170
|
+
"version": "0.14.5",
|
|
171
|
+
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",
|
|
172
|
+
"integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==",
|
|
173
|
+
"license": "Unlicense"
|
|
174
|
+
},
|
|
175
|
+
"node_modules/undici": {
|
|
176
|
+
"version": "6.26.0",
|
|
177
|
+
"resolved": "https://registry.npmjs.org/undici/-/undici-6.26.0.tgz",
|
|
178
|
+
"integrity": "sha512-4yqz8a3n5HmGTlsbADNtr/dJlhkh/55Rq798G6ibiULcXbDtaLpTl1pvdqcbFfeoj3iSi52lePFM7h9H21cw/A==",
|
|
179
|
+
"license": "MIT",
|
|
180
|
+
"engines": {
|
|
181
|
+
"node": ">=18.17"
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|