@bastani/atomic 0.10.9 → 0.10.10-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +57 -0
- package/README.md +211 -155
- package/dist/_shared/dist-KOELCESV.js +2 -2
- package/dist/_shared/fork-row-index-UAUAQRD5.js +2 -2
- package/dist/_shared/lib-4PES5P4V.js +2 -2
- package/dist/_shared/mode-interactive-sdk-7KXUFI2F.js +27 -12
- package/dist/_shared/mode-interactive-sdk-7KXUFI2F.js.map +1 -1
- package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js +47 -7
- package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js.map +1 -1
- package/dist/_shared/mode-shared-2QJSCUM6.js +48 -19
- package/dist/_shared/mode-shared-2QJSCUM6.js.map +1 -1
- package/dist/_shared/{p1a-prewarm-UQY3X2UK.js → p1a-prewarm-XIU57JHF.js} +5 -5
- package/dist/_shared/{p1a-prewarm-UQY3X2UK.js.map → p1a-prewarm-XIU57JHF.js.map} +1 -1
- package/dist/_shared/p2-shell-main-B2WIALFD.js +30 -25
- package/dist/_shared/p2-shell-main-B2WIALFD.js.map +1 -1
- package/dist/_shared/runtime-O4KCSG4C.js +5 -5
- package/dist/_shared/{sdk-OSBEPR3Q.js → sdk-RRLVN7ER.js} +15 -9
- package/dist/_shared/sdk-RRLVN7ER.js.map +1 -0
- package/dist/_shared/session-data-AHTU7IS6.js +2 -2
- package/dist/_shared/session-manager-list-2BLEEZVG.js +1 -1
- package/dist/_shared/settings-startup-8-DNZ2RIHM.js +4 -1
- package/dist/_shared/settings-startup-8-DNZ2RIHM.js.map +1 -1
- package/dist/_shared/{startup-0-0-TYUFUOJZ.js → startup-0-0-4VG2G44V.js} +427 -33
- package/dist/_shared/startup-0-0-4VG2G44V.js.map +1 -0
- package/dist/_shared/{startup-0-1-W2G2UY7R.js → startup-0-1-XTIL65D4.js} +18 -11
- package/dist/_shared/startup-0-1-XTIL65D4.js.map +1 -0
- package/dist/_shared/{startup-0-2-UXBUEOXW.js → startup-0-2-27OWFHV6.js} +145 -58
- package/dist/_shared/startup-0-2-27OWFHV6.js.map +1 -0
- package/dist/_shared/startup-0-3-T4DVFYWX.js +15 -25
- package/dist/_shared/startup-0-3-T4DVFYWX.js.map +1 -1
- package/dist/_shared/{startup-0-4-HN5EB4K7.js → startup-0-4-ZMJV547D.js} +81 -12
- package/dist/_shared/startup-0-4-ZMJV547D.js.map +1 -0
- package/dist/_shared/startup-0-5-FD2P735I.js +90 -50
- package/dist/_shared/startup-0-5-FD2P735I.js.map +1 -1
- package/dist/_shared/startup-10-0-TDQNBDDL.js +5 -5
- package/dist/_shared/startup-12-0-55AAXBJZ.js +13 -7
- package/dist/_shared/startup-12-0-55AAXBJZ.js.map +1 -1
- package/dist/_shared/startup-14-0-MLX36RBG.js +4 -4
- package/dist/_shared/startup-15-0-YUKGAC63.js +4 -4
- package/dist/_shared/startup-15-1-4S7FLMNG.js +88 -28
- package/dist/_shared/startup-15-1-4S7FLMNG.js.map +1 -1
- package/dist/_shared/startup-8-0-34CBHPZH.js +5 -5
- package/dist/_shared/startup-8-1-4KANEHRA.js +61 -17
- package/dist/_shared/startup-8-1-4KANEHRA.js.map +1 -1
- package/dist/_shared/storage-command-7MGXLJGZ.js +4 -4
- package/dist/_shared/task-unsaved-answer-VJ2KTB4V.js +2 -2
- package/dist/_shared/tree-outline-MUEPK5B7.js +2 -2
- package/dist/builtin/intercom/CHANGELOG.md +6 -0
- package/dist/builtin/intercom/README.md +85 -114
- package/dist/builtin/intercom/broker/broker.bundle.mjs +3 -3
- package/dist/builtin/intercom/broker/presence-handler.ts +1 -1
- package/dist/builtin/intercom/group.ts +7 -3
- package/dist/builtin/intercom/index.bundle.mjs +1 -1
- package/dist/builtin/intercom/package.json +1 -1
- package/dist/builtin/mcp/README.md +37 -27
- package/dist/builtin/mcp/index.bundle.mjs +1 -1
- package/dist/builtin/mcp/package.json +1 -1
- package/dist/builtin/subagents/CHANGELOG.md +8 -0
- package/dist/builtin/subagents/README.md +71 -138
- package/dist/builtin/subagents/package.json +1 -1
- package/dist/builtin/subagents/src/extension/index.bundle.mjs +213 -74
- package/dist/builtin/web-access/CHANGELOG.md +9 -0
- package/dist/builtin/web-access/README.md +60 -87
- package/dist/builtin/web-access/index.bundle.mjs +387 -351
- package/dist/builtin/web-access/package.json +1 -1
- package/dist/cli/args.js +2 -2
- package/dist/cli/auth-cli.code.js +4 -4
- package/dist/cli/auth-cli.impl.js +3 -3
- package/dist/cli/auth-cli.js +3 -3
- package/dist/cli/blueprint-command.code.js +2 -2
- package/dist/cli/blueprint-command.impl.js +3 -3
- package/dist/cli/blueprint-command.js +3 -3
- package/dist/cli/intercom-command.code.js +3 -3
- package/dist/cli/intercom-command.impl.js +3 -3
- package/dist/cli/intercom-command.js +3 -3
- package/dist/cli/list-models.code.js +3 -3
- package/dist/cli/list-models.impl.js +3 -3
- package/dist/cli/list-models.js +3 -3
- package/dist/cli/session-picker.code.js +2 -2
- package/dist/cli/session-picker.impl.js +3 -3
- package/dist/cli/session-picker.js +3 -3
- package/dist/cli/startup-ui.code.js +2 -2
- package/dist/cli/startup-ui.impl.js +3 -3
- package/dist/cli/startup-ui.js +3 -3
- package/dist/cli/storage-command.impl.js +3 -3
- package/dist/cli/storage-command.js +3 -3
- package/dist/cli/storage-search-session.code.js +2 -2
- package/dist/cli/storage-search-session.impl.js +3 -3
- package/dist/cli/storage-search-session.js +3 -3
- package/dist/cli/team-command.code.js +2 -2
- package/dist/cli/team-command.impl.js +3 -3
- package/dist/cli/team-command.js +3 -3
- package/dist/cli.js +2 -2
- package/dist/core/agent-session-methods.d.ts +4 -1
- package/dist/core/agent-session-methods.js.map +1 -1
- package/dist/core/agent-session.d.ts +3 -0
- package/dist/core/compaction/compactor.d.ts +20 -14
- package/dist/core/compaction/errors.d.ts +120 -0
- package/dist/core/compaction/index.d.ts +1 -0
- package/dist/core/compaction/model-resolver.d.ts +2 -2
- package/dist/core/debug.impl.js +3 -3
- package/dist/core/debug.js +3 -3
- package/dist/core/export-html/card-projection.impl.js +3 -3
- package/dist/core/export-html/card-projection.js +3 -3
- package/dist/core/export-html/index.code.js +2 -2
- package/dist/core/export-html/index.impl.js +3 -3
- package/dist/core/export-html/index.js +3 -3
- package/dist/core/export-html/json-spans.impl.js +3 -3
- package/dist/core/export-html/json-spans.js +3 -3
- package/dist/core/export-html/oversized-render-inputs.impl.js +3 -3
- package/dist/core/export-html/oversized-render-inputs.js +3 -3
- package/dist/core/export-html/tool-renderer.code.js +1 -1
- package/dist/core/export-html/tool-renderer.impl.js +3 -3
- package/dist/core/export-html/tool-renderer.js +3 -3
- package/dist/core/extensions/api-types.d.ts +1 -1
- package/dist/core/extensions/api-types.js.map +1 -1
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/jiti-loader.impl.js +3 -3
- package/dist/core/extensions/jiti-loader.js +3 -3
- package/dist/core/extensions/jiti-static-loader.impl.js +3 -3
- package/dist/core/extensions/jiti-static-loader.js +3 -3
- package/dist/core/extensions/loader-host-modules.code.js +1 -1
- package/dist/core/extensions/loader-host-modules.impl.js +3 -3
- package/dist/core/extensions/loader-host-modules.js +3 -3
- package/dist/core/extensions/loader-virtual-modules.js +1 -1
- package/dist/core/extensions/provider-types.d.ts +18 -6
- package/dist/core/extensions/provider-types.js.map +1 -1
- package/dist/core/extensions/runner-context.js +1 -1
- package/dist/core/intercom-broker-control-host.code.js +1 -1
- package/dist/core/intercom-broker-control-host.impl.js +3 -3
- package/dist/core/intercom-broker-control-host.js +3 -3
- package/dist/core/intercom-broker-control.code.js +3 -3
- package/dist/core/intercom-broker-control.impl.js +3 -3
- package/dist/core/intercom-broker-control.js +3 -3
- package/dist/core/model-config.d.ts +40 -0
- package/dist/core/model-registry.js +1 -1
- package/dist/core/model-resolver-scope.d.ts +4 -4
- package/dist/core/model-runtime.d.ts +1 -1
- package/dist/core/package-manager-storage-adapters.impl.js +3 -3
- package/dist/core/package-manager-storage-adapters.js +3 -3
- package/dist/core/provider-composer-internal.d.ts +11 -2
- package/dist/core/sdk.code.js +3 -3
- package/dist/core/sdk.impl.js +3 -3
- package/dist/core/sdk.js +3 -3
- package/dist/core/session-manager-core.js +5 -5
- package/dist/core/session-manager-list.impl.js +3 -3
- package/dist/core/session-manager-list.js +3 -3
- package/dist/core/session-manager.code.js +1 -1
- package/dist/core/session-manager.impl.js +3 -3
- package/dist/core/session-manager.js +3 -3
- package/dist/core/session-storage.impl.js +3 -3
- package/dist/core/session-storage.js +3 -3
- package/dist/core/settings-manager-basic-accessors.d.ts +6 -2
- package/dist/core/storage/index.js +2 -2
- package/dist/core/storage/node-sqlite-thread.js +2 -2
- package/dist/core/storage/node-sqlite.js +2 -2
- package/dist/core/storage/offline-snapshot-file.impl.js +3 -3
- package/dist/core/storage/offline-snapshot-file.js +3 -3
- package/dist/core/storage/provider.js +2 -2
- package/dist/core/storage/selection.js +2 -2
- package/dist/core/storage/session/branch-fork-source.code.js +2 -2
- package/dist/core/storage/session/branch-fork-source.impl.js +3 -3
- package/dist/core/storage/session/branch-fork-source.js +3 -3
- package/dist/core/storage/session/card-view.impl.js +3 -3
- package/dist/core/storage/session/card-view.js +3 -3
- package/dist/core/storage/session/child-reader.code.js +3 -3
- package/dist/core/storage/session/child-reader.impl.js +3 -3
- package/dist/core/storage/session/child-reader.js +3 -3
- package/dist/core/storage/session/chunked-resume-projection.impl.js +3 -3
- package/dist/core/storage/session/chunked-resume-projection.js +3 -3
- package/dist/core/storage/session/expanded-child-details.code.js +2 -2
- package/dist/core/storage/session/expanded-child-details.impl.js +3 -3
- package/dist/core/storage/session/expanded-child-details.js +3 -3
- package/dist/core/storage/session/fork-row-bytes.impl.js +3 -3
- package/dist/core/storage/session/fork-row-bytes.js +3 -3
- package/dist/core/storage/session/fork-row-index.impl.js +3 -3
- package/dist/core/storage/session/fork-row-index.js +3 -3
- package/dist/core/storage/session/fork-staging.code.js +2 -2
- package/dist/core/storage/session/fork-staging.impl.js +3 -3
- package/dist/core/storage/session/fork-staging.js +3 -3
- package/dist/core/storage/session/fork-window.code.js +3 -3
- package/dist/core/storage/session/fork-window.impl.js +3 -3
- package/dist/core/storage/session/fork-window.js +3 -3
- package/dist/core/storage/session/history-pages.impl.js +3 -3
- package/dist/core/storage/session/history-pages.js +3 -3
- package/dist/core/storage/session/jsonl-entry-projection.impl.js +3 -3
- package/dist/core/storage/session/jsonl-entry-projection.js +3 -3
- package/dist/core/storage/session/jsonl-session-store.impl.js +3 -3
- package/dist/core/storage/session/jsonl-session-store.js +3 -3
- package/dist/core/storage/session/memory-session-store.impl.js +3 -3
- package/dist/core/storage/session/memory-session-store.js +3 -3
- package/dist/core/storage/session/pinned-branch-resume.code.js +3 -3
- package/dist/core/storage/session/pinned-branch-resume.impl.js +3 -3
- package/dist/core/storage/session/pinned-branch-resume.js +3 -3
- package/dist/core/storage/session/released-history-files.code.js +3 -3
- package/dist/core/storage/session/released-history-files.impl.js +3 -3
- package/dist/core/storage/session/released-history-files.js +3 -3
- package/dist/core/storage/session/resident-fork-rows.impl.js +3 -3
- package/dist/core/storage/session/resident-fork-rows.js +3 -3
- package/dist/core/storage/session/session-resume.impl.js +3 -3
- package/dist/core/storage/session/session-resume.js +3 -3
- package/dist/core/storage/session/snapshot-cut.impl.js +3 -3
- package/dist/core/storage/session/snapshot-cut.js +3 -3
- package/dist/core/storage/session/snapshot-history.code.js +3 -3
- package/dist/core/storage/session/snapshot-history.impl.js +3 -3
- package/dist/core/storage/session/snapshot-history.js +3 -3
- package/dist/core/storage/session/sql-session-store.code.js +1 -1
- package/dist/core/storage/session/sql-session-store.impl.js +3 -3
- package/dist/core/storage/session/sql-session-store.js +3 -3
- package/dist/core/storage/session/tree-outline.impl.js +3 -3
- package/dist/core/storage/session/tree-outline.js +3 -3
- package/dist/core/storage/session/tree-presentation.impl.js +3 -3
- package/dist/core/storage/session/tree-presentation.js +3 -3
- package/dist/core/storage/storage-status.impl.js +3 -3
- package/dist/core/storage/storage-status.js +3 -3
- package/dist/core/storage/team.impl.js +3 -3
- package/dist/core/storage/team.js +3 -3
- package/dist/core/structured-output/index.code.js +1 -1
- package/dist/core/structured-output/index.impl.js +3 -3
- package/dist/core/structured-output/index.js +3 -3
- package/dist/core/tasks/task-completion-entry.impl.js +3 -3
- package/dist/core/tasks/task-completion-entry.js +3 -3
- package/dist/core/tasks/task-file-history.code.js +3 -3
- package/dist/core/tasks/task-file-history.impl.js +3 -3
- package/dist/core/tasks/task-file-history.js +3 -3
- package/dist/core/tasks/task-reference-archive.code.js +4 -4
- package/dist/core/tasks/task-reference-archive.js +3 -3
- package/dist/core/tasks/task-reference-identity.code.js +1 -1
- package/dist/core/tasks/task-reference-identity.js +3 -3
- package/dist/core/tasks/task-reference-stream.impl.js +3 -3
- package/dist/core/tasks/task-reference-stream.js +3 -3
- package/dist/core/tasks/task-unsaved-answer.impl.js +3 -3
- package/dist/core/tasks/task-unsaved-answer.js +3 -3
- package/dist/core/tasks/task-view-source.impl.js +3 -3
- package/dist/core/tasks/task-view-source.js +3 -3
- package/dist/core/tools/read-url.code.js +2 -2
- package/dist/core/tools/read-url.impl.js +3 -3
- package/dist/core/tools/read-url.js +3 -3
- package/dist/core/worktree-snapshot/blob-store.js +2 -2
- package/dist/core/worktree-snapshot/errors.code.js +3 -3
- package/dist/core/worktree-snapshot/errors.impl.js +3 -3
- package/dist/core/worktree-snapshot/errors.js +3 -3
- package/dist/core/worktree-snapshot/session-index-reset.impl.js +3 -3
- package/dist/core/worktree-snapshot/session-index-reset.js +3 -3
- package/dist/extensions/codemode/execute.code.js +1 -1
- package/dist/extensions/codemode/execute.impl.js +3 -3
- package/dist/extensions/codemode/execute.js +3 -3
- package/dist/extensions/codemode/renderer.code.js +2 -2
- package/dist/extensions/codemode/renderer.impl.js +3 -3
- package/dist/extensions/codemode/renderer.js +3 -3
- package/dist/extensions/mcp/cli.code.js +2 -2
- package/dist/extensions/mcp/cli.impl.js +3 -3
- package/dist/extensions/mcp/cli.js +3 -3
- package/dist/extensions/mcp/cli.lazy.code.js +2 -2
- package/dist/extensions/mcp/cli.lazy.impl.js +3 -3
- package/dist/extensions/mcp/cli.lazy.js +3 -3
- package/dist/extensions/mcp/runtime.code.js +1 -1
- package/dist/extensions/mcp/runtime.impl.js +3 -3
- package/dist/extensions/mcp/runtime.js +3 -3
- package/dist/index-extensions.d.ts +1 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +7 -7
- package/dist/main-first-time-setup.code.js +2 -2
- package/dist/main-first-time-setup.impl.js +3 -3
- package/dist/main-first-time-setup.js +3 -3
- package/dist/modes/interactive/components/settings-selector-types.d.ts +1 -0
- package/dist/modes/interactive/components/settings-selector-types.js.map +1 -1
- package/dist/modes/interactive/components/stored-tree-view.code.js +2 -2
- package/dist/modes/interactive/components/stored-tree-view.impl.js +3 -3
- package/dist/modes/interactive/components/stored-tree-view.js +3 -3
- package/dist/modes/interactive/components/user-message-selector-archive.impl.js +3 -3
- package/dist/modes/interactive/components/user-message-selector-archive.js +3 -3
- package/dist/modes/interactive/theme/color-utils.d.ts +5 -5
- package/dist/modes/interactive/theme/theme-loading.d.ts +1 -0
- package/dist/modes/interactive-engine/engine-prewarm.js +1 -1
- package/dist/modes/interactive-engine/remote-model-catalog.d.ts +1 -0
- package/dist/modes/print-mode.js +1 -1
- package/dist/modes/rpc/rpc-client-api.d.ts +6 -0
- package/dist/modes/rpc/rpc-types.d.ts +29 -2
- package/dist/package-manager-cli.code.js +5 -5
- package/dist/package-manager-cli.impl.js +3 -3
- package/dist/package-manager-cli.js +3 -3
- package/dist/rpc-entry.js +1 -1
- package/dist/startup-files.json +1 -1
- package/dist/startup-stages/5.js +1 -1
- package/dist/startup-stages/7.js +1 -1
- package/dist/startup-stages/8.js +1 -2
- package/dist/startup-stages/9.js +2 -1
- package/dist/utils/native-module.d.ts +44 -0
- package/dist/utils/startup-database-spare.code.js +3 -3
- package/dist/utils/startup-database-spare.impl.js +3 -3
- package/dist/utils/startup-database-spare.js +3 -3
- package/dist/utils/tools-manager.code.js +1 -1
- package/dist/utils/tools-manager.impl.js +3 -3
- package/dist/utils/tools-manager.js +3 -3
- package/docs/background-tasks.md +235 -243
- package/docs/build.md +12 -11
- package/docs/codemode.md +60 -51
- package/docs/compaction/reference.md +61 -24
- package/docs/compaction.md +117 -65
- package/docs/computer-use.md +179 -146
- package/docs/containerization.md +79 -33
- package/docs/custom-provider/api-reference.md +148 -11
- package/docs/custom-provider/oauth.md +44 -27
- package/docs/custom-provider/override.md +14 -7
- package/docs/custom-provider/registration.md +75 -65
- package/docs/custom-provider/streaming.md +42 -19
- package/docs/custom-provider.md +25 -61
- package/docs/development.md +47 -43
- package/docs/docs.json +33 -33
- package/docs/environment-variables.md +83 -57
- package/docs/extensions/api-reference.md +323 -734
- package/docs/extensions/authoring.md +186 -269
- package/docs/extensions/events.md +308 -375
- package/docs/extensions/examples.md +122 -74
- package/docs/extensions/ui.md +217 -197
- package/docs/extensions.md +152 -259
- package/docs/getting-started/authentication.md +27 -14
- package/docs/getting-started/first-session.md +25 -26
- package/docs/getting-started/installation.md +62 -84
- package/docs/getting-started/project-instructions.md +39 -14
- package/docs/guides/configuration.md +42 -20
- package/docs/guides/intercom.md +17 -13
- package/docs/guides/non-interactive.md +29 -16
- package/docs/guides/orchestration.md +16 -10
- package/docs/guides/resume-on-any-machine.md +54 -49
- package/docs/guides/subagents.md +22 -14
- package/docs/guides/team-setup.md +37 -26
- package/docs/guides.md +22 -21
- package/docs/herdr.md +21 -16
- package/docs/index.md +16 -17
- package/docs/intercom/operations.md +68 -66
- package/docs/intercom/reference.md +196 -191
- package/docs/intercom.md +103 -92
- package/docs/json.md +71 -71
- package/docs/keybindings.md +63 -50
- package/docs/libraries/agent-core.md +49 -8
- package/docs/libraries/ai.md +21 -12
- package/docs/libraries/codemode.md +28 -6
- package/docs/libraries/schema.md +7 -7
- package/docs/libraries/telemetry.md +7 -7
- package/docs/libraries/tui.md +74 -94
- package/docs/libraries.md +5 -5
- package/docs/llama-cpp.md +38 -33
- package/docs/mcp-servers.md +96 -90
- package/docs/models/reference.md +46 -33
- package/docs/models-configuration.md +12 -6
- package/docs/models.md +93 -88
- package/docs/orchestration/migrating-workflows.md +21 -19
- package/docs/orchestration/patterns.md +35 -20
- package/docs/orchestration.md +22 -21
- package/docs/packages/authoring.md +28 -19
- package/docs/packages/reference.md +75 -16
- package/docs/packages.md +31 -33
- package/docs/programmatic.md +22 -21
- package/docs/prompt-templates.md +63 -41
- package/docs/providers/reference.md +35 -19
- package/docs/providers.md +61 -71
- package/docs/quickstart.md +32 -46
- package/docs/reference/cli.md +249 -252
- package/docs/reference.md +23 -20
- package/docs/rpc/examples.md +74 -17
- package/docs/rpc/extension-ui.md +79 -62
- package/docs/rpc/protocol.md +816 -358
- package/docs/rpc.md +75 -151
- package/docs/sdk/reference.md +175 -45
- package/docs/sdk/structured-decisions.md +92 -62
- package/docs/sdk/web-server.md +79 -46
- package/docs/sdk.md +237 -195
- package/docs/security.md +106 -43
- package/docs/session-format.md +96 -59
- package/docs/sessions.md +149 -113
- package/docs/settings.md +289 -204
- package/docs/shell-aliases.md +15 -6
- package/docs/skills/authoring.md +17 -9
- package/docs/skills/reference.md +23 -21
- package/docs/skills.md +104 -97
- package/docs/storage.md +140 -242
- package/docs/subagents/authoring.md +147 -16
- package/docs/subagents/reference.md +100 -30
- package/docs/subagents.md +220 -252
- package/docs/terminal-setup.md +97 -69
- package/docs/termux.md +51 -85
- package/docs/themes/reference.md +51 -37
- package/docs/themes.md +49 -54
- package/docs/tmux.md +38 -21
- package/docs/tools.md +198 -147
- package/docs/tui/reference.md +64 -32
- package/docs/tui.md +38 -66
- package/docs/usage.md +76 -78
- package/docs/verification.md +25 -25
- package/docs/web-access.md +72 -55
- package/docs/windows.md +53 -58
- package/docs/worktree-snapshots.md +62 -65
- package/package.json +8 -8
- package/schemas/models.schema.json +51 -0
- package/dist/_shared/sdk-OSBEPR3Q.js.map +0 -1
- package/dist/_shared/startup-0-0-TYUFUOJZ.js.map +0 -1
- package/dist/_shared/startup-0-1-W2G2UY7R.js.map +0 -1
- package/dist/_shared/startup-0-2-UXBUEOXW.js.map +0 -1
- package/dist/_shared/startup-0-4-HN5EB4K7.js.map +0 -1
package/docs/extensions/ui.md
CHANGED
|
@@ -1,26 +1,18 @@
|
|
|
1
1
|
---
|
|
2
|
-
title: Extension UI
|
|
3
|
-
|
|
2
|
+
title: "Extension UI"
|
|
3
|
+
sidebarTitle: "Custom UI"
|
|
4
|
+
description: "Build dialogs, widgets, status indicators, host-native pickers and forms, custom overlays, editors, and message renderers."
|
|
4
5
|
---
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
<div id="custom-ui" />
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
Extensions interact with users through `ctx.ui` methods and customize how messages, entries, and tools render.
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
Check `ctx.hasUI` (or `ctx.mode === "tui"`) before showing interactive UI. For reusable component patterns (`SelectList`, `BorderedLoader`, `SettingsList`, working indicators, widgets, autocomplete, and custom footers), see [TUI components](/tui).
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
> **Interactive mode note:** In default interactive mode, extensions run in a separate background worker process. Dialogs, `ctx.ui.custom()`, widgets, status, notifications, and host-native pickers and forms work everywhere. APIs that require synchronous terminal UI callbacks (`onTerminalInput`, sync `getEditorText`, `setEditorComponent`, `addAutocompleteProvider`, `setHeader`, and `setFooter`) warn and do not run in default interactive mode. See [Responsive UI and crash recovery](/extensions#interactive-callback-isolation).
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
- Async operations with cancellation (`BorderedLoader`)
|
|
16
|
-
- Settings toggles (`SettingsList`)
|
|
17
|
-
- Status indicators (`setStatus`)
|
|
18
|
-
- Working message, visibility, and indicator from accepted prompt startup through active turns (`setWorkingMessage`, `setWorkingVisible`, `setWorkingIndicator`)
|
|
19
|
-
- Widgets above and below the editor (`setWidget`)
|
|
20
|
-
- Autocomplete providers layered on top of built-in slash and path completion (`addAutocompleteProvider`)
|
|
21
|
-
- Custom footers (`setFooter`)
|
|
22
|
-
|
|
23
|
-
### Dialogs
|
|
15
|
+
## Dialogs
|
|
24
16
|
|
|
25
17
|
```typescript
|
|
26
18
|
// Select from options
|
|
@@ -39,25 +31,19 @@ const text = await ctx.ui.editor("Edit:", "prefilled text");
|
|
|
39
31
|
ctx.ui.notify("Done!", "info"); // "info" | "warning" | "error"
|
|
40
32
|
```
|
|
41
33
|
|
|
42
|
-
Notifications emitted
|
|
34
|
+
Notifications emitted during extension loading or startup always appear below the startup `RESOURCES` line.
|
|
43
35
|
|
|
44
|
-
|
|
36
|
+
### Timed dialogs with countdown
|
|
45
37
|
|
|
46
|
-
Dialogs
|
|
38
|
+
Dialogs accept `{ timeout }` (in milliseconds) to auto-dismiss with a live countdown:
|
|
47
39
|
|
|
48
40
|
```typescript
|
|
49
|
-
//
|
|
41
|
+
// Shows "Title (5s)", "Title (4s)", and auto-dismisses at 0
|
|
50
42
|
const confirmed = await ctx.ui.confirm(
|
|
51
43
|
"Timed Confirmation",
|
|
52
44
|
"This dialog will auto-cancel in 5 seconds. Confirm?",
|
|
53
45
|
{ timeout: 5000 }
|
|
54
46
|
);
|
|
55
|
-
|
|
56
|
-
if (confirmed) {
|
|
57
|
-
// User confirmed
|
|
58
|
-
} else {
|
|
59
|
-
// User cancelled or timed out
|
|
60
|
-
}
|
|
61
47
|
```
|
|
62
48
|
|
|
63
49
|
Return values on timeout or caller abort:
|
|
@@ -66,11 +52,11 @@ Return values on timeout or caller abort:
|
|
|
66
52
|
- `confirm()` returns `false`
|
|
67
53
|
- `input()` and `editor()` return `undefined`
|
|
68
54
|
|
|
69
|
-
|
|
55
|
+
Cancelling all pending input, closing the session, or replacing its input host can still reject with `HumanInputCancelled`.
|
|
70
56
|
|
|
71
|
-
|
|
57
|
+
### Manual dismissal with AbortSignal
|
|
72
58
|
|
|
73
|
-
|
|
59
|
+
Pass `{ signal }` to dismiss a dialog programmatically and distinguish a timeout from a user cancel:
|
|
74
60
|
|
|
75
61
|
```typescript
|
|
76
62
|
const controller = new AbortController();
|
|
@@ -87,31 +73,80 @@ clearTimeout(timeoutId);
|
|
|
87
73
|
if (confirmed) {
|
|
88
74
|
// User confirmed
|
|
89
75
|
} else if (controller.signal.aborted) {
|
|
90
|
-
//
|
|
76
|
+
// Timed out
|
|
91
77
|
} else {
|
|
92
|
-
// User cancelled (
|
|
78
|
+
// User cancelled (Escape or "No")
|
|
93
79
|
}
|
|
94
80
|
```
|
|
95
81
|
|
|
96
|
-
See [examples/extensions/timed-confirm.ts](https://github.com/bastani-inc/atomic/blob/main/packages/coding-agent/examples/extensions/timed-confirm.ts)
|
|
82
|
+
See [examples/extensions/timed-confirm.ts](https://github.com/bastani-inc/atomic/blob/main/packages/coding-agent/examples/extensions/timed-confirm.ts).
|
|
83
|
+
|
|
84
|
+
## Host-native pickers and forms
|
|
85
|
+
|
|
86
|
+
These APIs render directly in the terminal UI process so typing, search, validation, and keybindings stay instant even in default interactive mode. They are omitted in print and headless RPC modes (check before calling).
|
|
87
|
+
|
|
88
|
+
### Session picker (`ctx.ui.hostSessionPicker`)
|
|
89
|
+
|
|
90
|
+
Open a searchable session-style picker with JSON-safe `HostSessionPickerRow` items (`SessionInfo` with `createdAt` and `modifiedAt` in epoch milliseconds):
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
const picker = ctx.ui.hostSessionPicker?.({
|
|
94
|
+
title: "Resume session",
|
|
95
|
+
sessions: rows,
|
|
96
|
+
onDelete: async (path) => {
|
|
97
|
+
await deleteSession(path);
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
// Update rows dynamically, surface a transient error, or close early:
|
|
102
|
+
picker?.update(updatedRows);
|
|
103
|
+
picker?.error("Could not refresh list");
|
|
104
|
+
|
|
105
|
+
const selectedPath = await picker?.result; // Selected path or undefined on cancel
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
The returned `HostSessionPickerHandle` exposes `result`, `update(rows)`, `error(message)`, and `close()`. See [Host-native session picker](/tui/reference#host-native-session-picker).
|
|
97
109
|
|
|
98
|
-
###
|
|
110
|
+
### Structured input form (`ctx.ui.hostInputForm`)
|
|
99
111
|
|
|
100
|
-
|
|
112
|
+
Open an inline structured form with JSON-safe field descriptors (`string`, `text`, `number`, `integer`, `boolean`, or `select`) and raw `initialValue` strings:
|
|
113
|
+
|
|
114
|
+
```typescript
|
|
115
|
+
const values = await ctx.ui.hostInputForm?.({
|
|
116
|
+
title: "Configure endpoint",
|
|
117
|
+
fields: [
|
|
118
|
+
{ name: "url", label: "Base URL", type: "string", initialValue: "https://api.example.com" },
|
|
119
|
+
{ name: "retries", label: "Retries", type: "integer", initialValue: "3" },
|
|
120
|
+
],
|
|
121
|
+
});
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
`hostInputForm()` resolves to a raw `Record<string, string>` or `undefined` on cancel, and rejects with `"The host could not read this input form."` if the host cannot read the form. See [Host-native input form](/tui/reference#host-native-input-form).
|
|
125
|
+
|
|
126
|
+
### Native questionnaire (`ctx.ui.hostQuestionnaire`)
|
|
127
|
+
|
|
128
|
+
Optional `ctx.ui.hostQuestionnaire?(params, signal)` delegates a full `ask_user_question` questionnaire to a host that implements native question UI. It returns the `QuestionnaireResult`, or `undefined` when the host cannot display it (so the caller renders the questionnaire itself).
|
|
129
|
+
|
|
130
|
+
## Widgets, status, header, and footer
|
|
131
|
+
|
|
132
|
+
Inline custom UIs opened with `{ purpose: "navigation" }` temporarily hide all `setWidget()` widgets above and below the editor (including the agent panel) as well as queued-message and pending-shell previews. Widgets keep updating in the background and return with their latest content once the navigation view closes. Overlays and `"prompt"` custom UIs do not hide them.
|
|
101
133
|
|
|
102
134
|
```typescript
|
|
103
135
|
// Status in footer (persistent until cleared)
|
|
104
136
|
ctx.ui.setStatus("my-ext", "Processing...");
|
|
105
|
-
ctx.ui.setStatus("my-ext", undefined);
|
|
137
|
+
ctx.ui.setStatus("my-ext", undefined);
|
|
106
138
|
|
|
107
|
-
//
|
|
139
|
+
// Request a TUI repaint after async state changes
|
|
140
|
+
ctx.ui.requestRender();
|
|
141
|
+
|
|
142
|
+
// Working loader customization (active from prompt submission through the turn)
|
|
108
143
|
ctx.ui.setWorkingMessage("Thinking deeply...");
|
|
109
|
-
ctx.ui.setWorkingMessage();
|
|
110
|
-
ctx.ui.setWorkingVisible(false);
|
|
111
|
-
ctx.ui.setWorkingVisible(true);
|
|
144
|
+
ctx.ui.setWorkingMessage(); // Restore default
|
|
145
|
+
ctx.ui.setWorkingVisible(false); // Hide working row (compaction indicator stays visible)
|
|
146
|
+
ctx.ui.setWorkingVisible(true);
|
|
112
147
|
|
|
113
|
-
// Working indicator customization (
|
|
114
|
-
ctx.ui.setWorkingIndicator({ frames: [ctx.ui.theme.fg("accent", "●")] });
|
|
148
|
+
// Working indicator customization (see TUI Pattern 4b)
|
|
149
|
+
ctx.ui.setWorkingIndicator({ frames: [ctx.ui.theme.fg("accent", "●")] });
|
|
115
150
|
ctx.ui.setWorkingIndicator({
|
|
116
151
|
frames: [
|
|
117
152
|
ctx.ui.theme.fg("dim", "·"),
|
|
@@ -121,99 +156,84 @@ ctx.ui.setWorkingIndicator({
|
|
|
121
156
|
],
|
|
122
157
|
intervalMs: 120,
|
|
123
158
|
});
|
|
124
|
-
ctx.ui.setWorkingIndicator({ frames: [] });
|
|
125
|
-
ctx.ui.setWorkingIndicator();
|
|
126
|
-
|
|
127
|
-
//
|
|
159
|
+
ctx.ui.setWorkingIndicator({ frames: [] }); // Hide indicator
|
|
160
|
+
ctx.ui.setWorkingIndicator(); // Restore default ∀ ramp
|
|
161
|
+
|
|
162
|
+
// Label shown when thinking blocks are collapsed (Ctrl+T)
|
|
163
|
+
ctx.ui.setHiddenThinkingLabel("Pondering...");
|
|
164
|
+
ctx.ui.setHiddenThinkingLabel(); // Restore default
|
|
128
165
|
|
|
129
|
-
// Widget above editor
|
|
166
|
+
// Widget above or below editor
|
|
130
167
|
ctx.ui.setWidget("my-widget", ["Line 1", "Line 2"]);
|
|
131
|
-
// Widget below editor
|
|
132
168
|
ctx.ui.setWidget("my-widget", ["Line 1", "Line 2"], { placement: "belowEditor" });
|
|
133
169
|
ctx.ui.setWidget("my-widget", (tui, theme) => new Text(theme.fg("accent", "Custom"), 0, 0));
|
|
134
|
-
ctx.ui.setWidget("my-widget", undefined);
|
|
170
|
+
ctx.ui.setWidget("my-widget", undefined); // Clear
|
|
135
171
|
|
|
136
|
-
//
|
|
137
|
-
ctx.ui.
|
|
138
|
-
|
|
172
|
+
// Scrollable widget with capped height and release callback
|
|
173
|
+
ctx.ui.setWidget(
|
|
174
|
+
"my-scrollable",
|
|
175
|
+
(tui, theme) => myScrollableComponent, // Implements ScrollableWidgetComponent (getScrollRequest?, onScroll?)
|
|
176
|
+
{ placement: "aboveEditor", scroll: { maxHeight: 12, maxHeightFraction: 0.35 } },
|
|
177
|
+
);
|
|
178
|
+
const unsubscribeRelease = ctx.ui.onWidgetRelease?.("my-scrollable", () => {
|
|
179
|
+
// Clean up resources when the host releases this widget
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
// Custom startup header and custom footer (embedded/non-worker interactive sessions)
|
|
183
|
+
ctx.ui.setHeader((tui, theme) => new Text(theme.fg("accent", "Custom header"), 0, 0));
|
|
184
|
+
ctx.ui.setHeader(undefined); // Restore built-in header
|
|
185
|
+
|
|
186
|
+
ctx.ui.setFooter((tui, theme, footerData) => ({
|
|
187
|
+
render(width) {
|
|
188
|
+
const branch = footerData.getGitBranch() ?? "";
|
|
189
|
+
return [theme.fg("dim", `Custom footer ${branch}`)];
|
|
190
|
+
},
|
|
139
191
|
invalidate() {},
|
|
140
192
|
}));
|
|
141
|
-
ctx.ui.setFooter(undefined);
|
|
193
|
+
ctx.ui.setFooter(undefined); // Restore built-in footer
|
|
142
194
|
|
|
143
|
-
//
|
|
195
|
+
// Read built-in footer data (git branch, extension statuses) directly
|
|
196
|
+
const footerData = ctx.ui.getFooterDataProvider();
|
|
197
|
+
|
|
198
|
+
// Terminal window/tab title
|
|
144
199
|
ctx.ui.setTitle("atomic - my-project");
|
|
145
200
|
|
|
146
|
-
// Editor text
|
|
201
|
+
// Editor text and paste
|
|
147
202
|
ctx.ui.setEditorText("Prefill text");
|
|
148
203
|
const current = ctx.ui.getEditorText();
|
|
204
|
+
ctx.ui.pasteToEditor("pasted content"); // Applies normal paste handling and large-paste collapse
|
|
149
205
|
|
|
150
|
-
//
|
|
151
|
-
ctx.ui.
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
async getSuggestions(lines, line, col, options) {
|
|
156
|
-
const beforeCursor = (lines[line] ?? "").slice(0, col);
|
|
157
|
-
const match = beforeCursor.match(/(?:^|[ \t])#([^\s#]*)$/);
|
|
158
|
-
if (!match) {
|
|
159
|
-
return current.getSuggestions(lines, line, col, options);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
return {
|
|
163
|
-
prefix: `#${match[1] ?? ""}`,
|
|
164
|
-
items: [{ value: "#42", label: "#42", description: "Fix login redirect" }],
|
|
165
|
-
};
|
|
166
|
-
},
|
|
167
|
-
applyCompletion(lines, line, col, item, prefix) {
|
|
168
|
-
return current.applyCompletion(lines, line, col, item, prefix);
|
|
169
|
-
},
|
|
170
|
-
shouldTriggerFileCompletion(lines, line, col) {
|
|
171
|
-
return current.shouldTriggerFileCompletion?.(lines, line, col) ?? true;
|
|
172
|
-
},
|
|
173
|
-
}));
|
|
206
|
+
// Raw terminal input interceptor (embedded/non-worker interactive sessions)
|
|
207
|
+
const stopInput = ctx.ui.onTerminalInput((data) => {
|
|
208
|
+
if (data === "\x07") return { consume: true };
|
|
209
|
+
return undefined;
|
|
210
|
+
});
|
|
174
211
|
|
|
175
212
|
// Tool output expansion
|
|
176
213
|
const wasExpanded = ctx.ui.getToolsExpanded();
|
|
177
214
|
ctx.ui.setToolsExpanded(true);
|
|
178
215
|
ctx.ui.setToolsExpanded(wasExpanded);
|
|
179
216
|
|
|
180
|
-
//
|
|
181
|
-
ctx.ui.
|
|
182
|
-
const
|
|
183
|
-
ctx.ui.
|
|
184
|
-
new WrappedEditor(tui, theme, keybindings, currentEditor?.(tui, theme, keybindings))
|
|
185
|
-
);
|
|
186
|
-
ctx.ui.setEditorComponent(undefined); // Restore default editor
|
|
187
|
-
|
|
188
|
-
// Theme management (see Themes for creating custom themes)
|
|
189
|
-
const themes = ctx.ui.getAllThemes(); // [{ name: "dark", path: "/..." | undefined }, ...]
|
|
190
|
-
const lightTheme = ctx.ui.getTheme("light"); // Load without switching
|
|
191
|
-
const result = ctx.ui.setTheme("light"); // Switch by name
|
|
217
|
+
// Theme management
|
|
218
|
+
const themes = ctx.ui.getAllThemes(); // [{ name: "dark", path: "/..." | undefined }, ...]
|
|
219
|
+
const lightTheme = ctx.ui.getTheme("light");
|
|
220
|
+
const result = ctx.ui.setTheme("light");
|
|
192
221
|
if (!result.success) {
|
|
193
222
|
ctx.ui.notify(`Failed: ${result.error}`, "error");
|
|
194
223
|
}
|
|
195
|
-
ctx.ui.setTheme(lightTheme
|
|
196
|
-
ctx.ui.theme.fg("accent", "styled text");
|
|
224
|
+
if (lightTheme) ctx.ui.setTheme(lightTheme);
|
|
225
|
+
ctx.ui.theme.fg("accent", "styled text");
|
|
197
226
|
```
|
|
198
227
|
|
|
199
|
-
Calling `setToolsExpanded()` with the current value is a no-op.
|
|
200
|
-
|
|
201
|
-
The default indicator is `∀`. `ATOMIC_REDUCED_MOTION=1` makes it static, and `NO_COLOR` disables foreground colors. Custom frames and intervals render as supplied; add colors with `ctx.ui.theme.fg(...)` if wanted.
|
|
202
|
-
|
|
203
|
-
These APIs customize presentation only; they do not start work or emit an extension stream event before prompt startup. See [Working indicator customization](/tui#pattern-4b-working-indicator-customization) for accepted-prompt, pre-stream, and agent-turn handoff timing.
|
|
204
|
-
|
|
205
|
-
### Autocomplete providers
|
|
228
|
+
Calling `setToolsExpanded()` with the current value is a no-op. `ATOMIC_REDUCED_MOTION=1` makes the default `∀` working indicator static, and `NO_COLOR` disables foreground colors. Custom frames render verbatim; apply theme colors with `ctx.ui.theme.fg(...)` when needed.
|
|
206
229
|
|
|
207
|
-
|
|
230
|
+
These APIs customize display only; they do not start turns or emit stream events. See [Working indicator customization](/tui#pattern-4b-working-indicator-customization) for timing details.
|
|
208
231
|
|
|
209
|
-
|
|
232
|
+
## Autocomplete providers
|
|
210
233
|
|
|
211
|
-
|
|
234
|
+
Use `ctx.ui.addAutocompleteProvider()` (available when running directly in the terminal UI process) to layer custom completion on top of built-in slash-command and path completion.
|
|
212
235
|
|
|
213
|
-
-
|
|
214
|
-
- Return your own suggestions when your extension-specific syntax matches.
|
|
215
|
-
- Delegate to `current.getSuggestions(...)` otherwise.
|
|
216
|
-
- Delegate `applyCompletion(...)` unless you need custom insertion behavior.
|
|
236
|
+
Return the complete result from the wrapped provider, including its metadata. Slash-command suggestions can set `completeOnConfirm: false` so `Enter` submits the typed command literally until the user navigates the list, while `Tab` still accepts the highlighted item.
|
|
217
237
|
|
|
218
238
|
```typescript
|
|
219
239
|
atomic.on("session_start", (_event, ctx) => {
|
|
@@ -246,16 +266,18 @@ atomic.on("session_start", (_event, ctx) => {
|
|
|
246
266
|
});
|
|
247
267
|
```
|
|
248
268
|
|
|
249
|
-
See [github-issue-autocomplete.ts](https://github.com/bastani-inc/atomic/blob/main/packages/coding-agent/examples/extensions/github-issue-autocomplete.ts) for a complete example
|
|
269
|
+
See [github-issue-autocomplete.ts](https://github.com/bastani-inc/atomic/blob/main/packages/coding-agent/examples/extensions/github-issue-autocomplete.ts) for a complete example using `gh issue list`.
|
|
250
270
|
|
|
251
|
-
|
|
271
|
+
## Custom components
|
|
252
272
|
|
|
253
|
-
|
|
273
|
+
Use `ctx.ui.custom()` to mount an interactive component until it calls `done(value)`. The `factory` callback may be synchronous or async (`Promise<ExtensionCustomComponent>`):
|
|
254
274
|
|
|
255
275
|
```typescript
|
|
256
276
|
import { Text, type Component } from "@bastani/atomic-tui";
|
|
257
277
|
|
|
258
278
|
class ConfirmPrompt implements Component {
|
|
279
|
+
constructor(private readonly done: (value: boolean) => void) {}
|
|
280
|
+
|
|
259
281
|
render(width: number): string[] {
|
|
260
282
|
return new Text("Enter Confirm · Escape Cancel", 1, 1).render(width);
|
|
261
283
|
}
|
|
@@ -273,63 +295,65 @@ class ConfirmPrompt implements Component {
|
|
|
273
295
|
}
|
|
274
296
|
return false;
|
|
275
297
|
}
|
|
276
|
-
|
|
277
|
-
constructor(private readonly done: (value: boolean) => void) {}
|
|
278
298
|
}
|
|
279
299
|
|
|
280
|
-
const result = await ctx.ui.custom<boolean>((_tui, _theme, _keybindings, done) => {
|
|
300
|
+
const result = await ctx.ui.custom<boolean>(async (_tui, _theme, _keybindings, done) => {
|
|
281
301
|
return new ConfirmPrompt(done);
|
|
282
302
|
});
|
|
283
|
-
|
|
284
|
-
if (result) {
|
|
285
|
-
// User pressed Enter
|
|
286
|
-
}
|
|
287
303
|
```
|
|
288
304
|
|
|
289
|
-
The
|
|
305
|
+
The factory receives four arguments:
|
|
290
306
|
|
|
291
|
-
- `tui
|
|
292
|
-
- `theme
|
|
293
|
-
- `keybindings
|
|
294
|
-
- `done(value)
|
|
307
|
+
- `tui`: TUI instance for screen dimensions and focus management
|
|
308
|
+
- `theme`: current theme for styling
|
|
309
|
+
- `keybindings`: configured `KeybindingsManager` for shortcut matching
|
|
310
|
+
- `done(value)`: closes the component and resolves `ctx.ui.custom()` with `value` (must be JSON-serializable in default interactive mode)
|
|
295
311
|
|
|
296
|
-
|
|
312
|
+
Supported `options`:
|
|
297
313
|
|
|
298
|
-
|
|
314
|
+
| Option | Type | Purpose |
|
|
315
|
+
| --- | --- | --- |
|
|
316
|
+
| `purpose` | `"prompt" \| "navigation"` | Defaults to `"prompt"`. `"navigation"` skips approval-prompt events and temporarily hides widgets while an inline view is open. |
|
|
317
|
+
| `overlay` | `boolean` | Render as a floating modal over existing content instead of replacing the editor. |
|
|
318
|
+
| `overlayOptions` | `OverlayOptions \| (() => OverlayOptions)` | Static or dynamic positioning and sizing options; function form recomputes on terminal resize. |
|
|
319
|
+
| `onHandle` | `(handle: OverlayHandle) => void` | Receive the overlay handle to show or hide it programmatically. |
|
|
320
|
+
| `reserveTranscriptRows` | `boolean` | Overlay-only. Reserves at least six visible transcript rows above a bottom-anchored blocking dialog. |
|
|
321
|
+
| `handlesCtrlC` | `boolean` | Set `true` when the component handles `Ctrl+C` itself; otherwise Atomic closes it on the first `Ctrl+C` press. |
|
|
322
|
+
| `handlesInternalUiAction` | `boolean` | Declare that the component handles internal UI actions such as jump-to-bottom links. |
|
|
323
|
+
| `deferInlineCustomUiFocus` | `boolean` | Keep a pending inline custom UI unfocused in the background while this overlay is open. |
|
|
324
|
+
| `blocked` | `{ kind: ProgramStatus["kind"], message: string }` | Report Atomic as blocked on user input (OSC 7501 status) while waiting. |
|
|
325
|
+
| `signal` | `AbortSignal` | Dismiss the custom UI programmatically. In default interactive mode, aborting resolves `ctx.ui.custom()` with `undefined` (like user cancel); when embedded in the same process, it rejects with the signal's abort reason. |
|
|
299
326
|
|
|
300
|
-
|
|
327
|
+
### Input handling contract
|
|
301
328
|
|
|
302
|
-
|
|
329
|
+
- `handleInput(data)` must return `true` when it consumes an input and `false` or `undefined` when it does not.
|
|
330
|
+
- In fullscreen mode, an unhandled viewport key continues to the transcript. If a component does not reply in time, the key also falls through to the transcript.
|
|
331
|
+
- An async `handleInput()` is judged when its promise settles: only a resolved `true` consumes the key, while `false`, `undefined`, and rejections fall through.
|
|
332
|
+
- A component without `handleInput` declines all keys so viewport keys continue scrolling the transcript behind it.
|
|
333
|
+
- Set `{ handlesCtrlC: true }` whenever your component binds `Ctrl+C` itself. Otherwise Atomic closes the component on the first `Ctrl+C` so a hung component cannot trap the keyboard. See [Responsive UI and crash recovery](/extensions#interactive-callback-isolation).
|
|
303
334
|
|
|
304
335
|
See [TUI components](/tui) for the full component API.
|
|
305
336
|
|
|
306
|
-
|
|
337
|
+
### Overlay mode
|
|
307
338
|
|
|
308
|
-
Pass `{ overlay: true }` to render
|
|
309
|
-
|
|
310
|
-
```typescript
|
|
311
|
-
const result = await ctx.ui.custom<string | null>(
|
|
312
|
-
(tui, theme, keybindings, done) => new MyOverlayComponent({ onClose: done }),
|
|
313
|
-
{ overlay: true }
|
|
314
|
-
);
|
|
315
|
-
```
|
|
316
|
-
|
|
317
|
-
For positioning (anchors, margins, percentages, and responsive visibility), pass `overlayOptions`. Use `onHandle` to control visibility programmatically:
|
|
339
|
+
Pass `{ overlay: true }` to render a floating modal without clearing the screen:
|
|
318
340
|
|
|
319
341
|
```typescript
|
|
320
342
|
const result = await ctx.ui.custom<string | null>(
|
|
321
343
|
(tui, theme, keybindings, done) => new MyOverlayComponent({ onClose: done }),
|
|
322
344
|
{
|
|
323
345
|
overlay: true,
|
|
324
|
-
overlayOptions: { anchor: "top-right", width: "50%", margin: 2 },
|
|
325
|
-
onHandle: (handle) => {
|
|
326
|
-
|
|
346
|
+
overlayOptions: () => ({ anchor: "top-right", width: "50%", margin: 2 }),
|
|
347
|
+
onHandle: (handle) => {
|
|
348
|
+
// handle.setHidden(true/false)
|
|
349
|
+
},
|
|
350
|
+
},
|
|
327
351
|
);
|
|
328
352
|
```
|
|
329
353
|
|
|
330
|
-
See [
|
|
354
|
+
See [overlay-qa-tests.ts](https://github.com/bastani-inc/atomic/blob/main/packages/coding-agent/examples/extensions/overlay-qa-tests.ts) for positioning and resize examples.
|
|
331
355
|
|
|
332
|
-
Pass `{ reserveTranscriptRows: true }` for a blocking bottom dialog that must leave at least six transcript rows visible
|
|
356
|
+
Pass `{ reserveTranscriptRows: true }` for a blocking bottom dialog that must leave at least six transcript rows visible:
|
|
333
357
|
|
|
334
358
|
```typescript
|
|
335
359
|
const result = await ctx.ui.custom<string | null>(
|
|
@@ -338,13 +362,13 @@ const result = await ctx.ui.custom<string | null>(
|
|
|
338
362
|
overlay: true,
|
|
339
363
|
reserveTranscriptRows: true,
|
|
340
364
|
overlayOptions: { anchor: "bottom-center", width: "100%" },
|
|
341
|
-
}
|
|
365
|
+
},
|
|
342
366
|
);
|
|
343
367
|
```
|
|
344
368
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
Embed `OVERLAY_ACTIVE_ROW_MARKER` once per frame on the
|
|
369
|
+
- Set `overlayOptions.anchor` to `bottom-left`, `bottom-center`, or `bottom-right`; `row` and nonzero `offsetY` are rejected.
|
|
370
|
+
- A reserving overlay always passes fullscreen transcript scroll keys and vertical mouse wheel input through to the transcript, even when a nested input has focus, while keeping all other keyboard and mouse input.
|
|
371
|
+
- Embed `OVERLAY_ACTIVE_ROW_MARKER` from `@bastani/atomic` once per frame on the active row so it remains visible when the dialog is cropped (zero visible width, stripped before terminal output):
|
|
348
372
|
|
|
349
373
|
```typescript
|
|
350
374
|
import { OVERLAY_ACTIVE_ROW_MARKER } from "@bastani/atomic";
|
|
@@ -356,9 +380,9 @@ render(width: number): string[] {
|
|
|
356
380
|
}
|
|
357
381
|
```
|
|
358
382
|
|
|
359
|
-
|
|
383
|
+
## Custom editor
|
|
360
384
|
|
|
361
|
-
Replace the main input editor
|
|
385
|
+
Replace the main input editor (available when extensions run directly in the terminal UI process) by extending `CustomEditor`:
|
|
362
386
|
|
|
363
387
|
```typescript
|
|
364
388
|
import { CustomEditor, type ExtensionAPI } from "@bastani/atomic";
|
|
@@ -376,14 +400,14 @@ class VimEditor extends CustomEditor {
|
|
|
376
400
|
this.mode = "insert";
|
|
377
401
|
return true;
|
|
378
402
|
}
|
|
379
|
-
return super.handleInput(data);
|
|
403
|
+
return super.handleInput(data);
|
|
380
404
|
}
|
|
381
405
|
}
|
|
382
406
|
|
|
383
407
|
export default function (atomic: ExtensionAPI) {
|
|
384
408
|
atomic.on("session_start", (_event, ctx) => {
|
|
385
409
|
ctx.ui.setEditorComponent((tui, theme, keybindings) =>
|
|
386
|
-
new VimEditor(tui, theme, keybindings)
|
|
410
|
+
new VimEditor(tui, theme, keybindings),
|
|
387
411
|
);
|
|
388
412
|
});
|
|
389
413
|
}
|
|
@@ -391,40 +415,28 @@ export default function (atomic: ExtensionAPI) {
|
|
|
391
415
|
|
|
392
416
|
Key points:
|
|
393
417
|
|
|
394
|
-
- Extend `CustomEditor` (not base `Editor`)
|
|
395
|
-
-
|
|
396
|
-
-
|
|
397
|
-
-
|
|
398
|
-
- Call `ctx.ui.getEditorComponent()` before `setEditorComponent()` to wrap a previously configured custom editor.
|
|
399
|
-
- Pass `undefined` to restore the default editor: `ctx.ui.setEditorComponent(undefined)`.
|
|
400
|
-
- When a custom editor installed through `ctx.ui.setEditorComponent()` exposes `setAutocompleteMaxVisible()`, Atomic initializes it from the active `autocompleteMaxVisible` setting.
|
|
418
|
+
- Extend `CustomEditor` (not base `Editor`) so built-in shortcuts such as Escape, Ctrl+D, model switching, and prompt navigation (`Down` to focus the agent panel, `Left` to return from a subagent to `main`) keep working via `super.handleInput(data)`.
|
|
419
|
+
- Pass `{ embedWorkingStatus: true }` as the fourth `CustomEditor` constructor argument to draw the working indicator inside the editor's top border instead of a standalone row.
|
|
420
|
+
- Capture `const previous = ctx.ui.getEditorComponent()` before calling `setEditorComponent()` to wrap another extension's editor, and pass `undefined` to restore the default editor.
|
|
421
|
+
- If your custom editor implements `setAutocompleteMaxVisible()`, Atomic initializes it from `autocompleteMaxVisible` in settings.
|
|
401
422
|
|
|
402
|
-
|
|
423
|
+
## Message rendering
|
|
403
424
|
|
|
404
|
-
|
|
405
|
-
const previous = ctx.ui.getEditorComponent();
|
|
406
|
-
ctx.ui.setEditorComponent((tui, theme, keybindings) =>
|
|
407
|
-
new MyEditor(tui, theme, keybindings, { base: previous?.(tui, theme, keybindings) })
|
|
408
|
-
);
|
|
409
|
-
```
|
|
410
|
-
|
|
411
|
-
See [TUI components](/tui) Pattern 7 for a complete example with a mode indicator.
|
|
412
|
-
|
|
413
|
-
### Message rendering
|
|
414
|
-
|
|
415
|
-
Register a custom renderer for messages with your `customType`:
|
|
425
|
+
Register a custom renderer for messages carrying your `customType`:
|
|
416
426
|
|
|
417
427
|
```typescript
|
|
418
428
|
import { Text } from "@bastani/atomic-tui";
|
|
419
429
|
|
|
420
430
|
atomic.registerMessageRenderer("my-extension", (message, options, theme) => {
|
|
431
|
+
if (!message.details) return null; // Suppress completely (no box, no spacer)
|
|
432
|
+
|
|
421
433
|
const { expanded, outputPad } = options;
|
|
422
434
|
let text = theme.fg("accent", `[${message.customType}] `);
|
|
423
435
|
text += message.content;
|
|
424
436
|
|
|
425
|
-
if (expanded
|
|
437
|
+
if (expanded) {
|
|
426
438
|
text += "\n" + theme.fg("dim", JSON.stringify(message.details, null, 2));
|
|
427
|
-
} else
|
|
439
|
+
} else {
|
|
428
440
|
text += ` (${options.keyHint("app.tools.expand", "to expand")})`;
|
|
429
441
|
}
|
|
430
442
|
|
|
@@ -432,55 +444,63 @@ atomic.registerMessageRenderer("my-extension", (message, options, theme) => {
|
|
|
432
444
|
});
|
|
433
445
|
```
|
|
434
446
|
|
|
435
|
-
|
|
447
|
+
Return-value contract for `registerMessageRenderer`:
|
|
448
|
+
|
|
449
|
+
- **`Component`:** Mounts and renders your component in the transcript.
|
|
450
|
+
- **`null`:** Suppresses the message completely (zero rows, no spacer, and no default fallback box). Useful for hiding rehydrated messages whose backing state no longer exists.
|
|
451
|
+
- **`undefined`:** Falls back to Atomic's default boxed `[customType]` rendering.
|
|
436
452
|
|
|
437
|
-
|
|
453
|
+
In fullscreen mode, clicking a custom message toggles `expanded` for that message alone (just as `Ctrl+O` toggles every block) and calls your renderer again. When running directly in the terminal UI process, a component can intercept clicks first by returning `{ handled: true }` from `handleMouse`; in default interactive mode, rendered rows are sent without custom mouse callbacks. A tool's title row always toggles first.
|
|
438
454
|
|
|
439
|
-
|
|
455
|
+
Send matching messages with `atomic.sendMessage()`:
|
|
440
456
|
|
|
441
457
|
```typescript
|
|
442
|
-
atomic.sendMessage({
|
|
443
|
-
customType: "my-extension",
|
|
458
|
+
await atomic.sendMessage({
|
|
459
|
+
customType: "my-extension",
|
|
444
460
|
content: "Status update",
|
|
445
|
-
display: true,
|
|
446
|
-
details: {
|
|
461
|
+
display: true,
|
|
462
|
+
details: { step: 2 },
|
|
447
463
|
});
|
|
448
464
|
```
|
|
449
465
|
|
|
450
|
-
|
|
466
|
+
## Theme colors
|
|
451
467
|
|
|
452
|
-
All render functions receive
|
|
468
|
+
All render functions receive the active `theme` object. See [Customize themes](/themes) and [Theme reference](/themes/reference) for all color tokens.
|
|
453
469
|
|
|
454
470
|
```typescript
|
|
455
|
-
// Foreground colors
|
|
456
|
-
theme.fg("toolTitle", text)
|
|
457
|
-
theme.fg("accent", text)
|
|
458
|
-
theme.fg("success", text)
|
|
459
|
-
theme.fg("error", text)
|
|
460
|
-
theme.fg("warning", text)
|
|
461
|
-
theme.fg("muted", text)
|
|
462
|
-
theme.fg("dim", text)
|
|
471
|
+
// Foreground and background colors
|
|
472
|
+
theme.fg("toolTitle", text)
|
|
473
|
+
theme.fg("accent", text)
|
|
474
|
+
theme.fg("success", text)
|
|
475
|
+
theme.fg("error", text)
|
|
476
|
+
theme.fg("warning", text)
|
|
477
|
+
theme.fg("muted", text)
|
|
478
|
+
theme.fg("dim", text)
|
|
479
|
+
theme.bg("selectedBg", text)
|
|
463
480
|
|
|
464
481
|
// Text styles
|
|
465
482
|
theme.bold(text)
|
|
466
483
|
theme.italic(text)
|
|
484
|
+
theme.underline(text)
|
|
485
|
+
theme.dim(text)
|
|
486
|
+
theme.inverse(text)
|
|
467
487
|
theme.strikethrough(text)
|
|
488
|
+
|
|
489
|
+
// Raw ANSI escape sequences
|
|
490
|
+
theme.getFgAnsi("accent")
|
|
491
|
+
theme.getBgAnsi("selectedBg")
|
|
468
492
|
```
|
|
469
493
|
|
|
470
|
-
|
|
494
|
+
Syntax highlighting helper for custom renderers:
|
|
471
495
|
|
|
472
496
|
```typescript
|
|
473
497
|
import { highlightCode, getLanguageFromPath } from "@bastani/atomic";
|
|
474
498
|
|
|
475
|
-
|
|
476
|
-
const highlighted = highlightCode("
|
|
477
|
-
|
|
478
|
-
// Auto-detect language from file path
|
|
479
|
-
const lang = getLanguageFromPath("/path/to/file.rs"); // "rust"
|
|
480
|
-
const highlighted = highlightCode(code, lang, theme);
|
|
499
|
+
const lang = getLanguageFromPath("/path/to/file.rs"); // "rust"
|
|
500
|
+
const highlighted = highlightCode("fn main() {}", lang, theme);
|
|
481
501
|
```
|
|
482
502
|
|
|
483
|
-
|
|
503
|
+
Line-range label helper for `read`-like tools (`formatReadLineRange` accepts numbers, numeric strings, and `null`, returning `""` for missing or malformed ranges):
|
|
484
504
|
|
|
485
505
|
```typescript
|
|
486
506
|
import { formatReadLineRange } from "@bastani/atomic";
|
|
@@ -492,4 +512,4 @@ formatReadLineRange("abc", 13); // ""
|
|
|
492
512
|
|
|
493
513
|
## Next steps
|
|
494
514
|
|
|
495
|
-
Try the runnable [
|
|
515
|
+
Try the runnable [Extension examples](/extensions/examples), and check context properties and method signatures in the [Extension API reference](/extensions/api-reference).
|