terminal-pilot 0.0.30 → 0.0.32
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/dist/cli.js +1599 -497
- package/dist/cli.js.map +4 -4
- package/dist/commands/close-session.js +489 -6
- package/dist/commands/close-session.js.map +4 -4
- package/dist/commands/create-session.js +489 -6
- package/dist/commands/create-session.js.map +4 -4
- package/dist/commands/fill.js +489 -6
- package/dist/commands/fill.js.map +4 -4
- package/dist/commands/get-session.js +489 -6
- package/dist/commands/get-session.js.map +4 -4
- package/dist/commands/index.js +630 -44
- package/dist/commands/index.js.map +4 -4
- package/dist/commands/install.js +626 -40
- package/dist/commands/install.js.map +4 -4
- package/dist/commands/installer.js +68 -17
- package/dist/commands/installer.js.map +4 -4
- package/dist/commands/list-sessions.js +489 -6
- package/dist/commands/list-sessions.js.map +4 -4
- package/dist/commands/press-key.js +489 -6
- package/dist/commands/press-key.js.map +4 -4
- package/dist/commands/read-history.js +489 -6
- package/dist/commands/read-history.js.map +4 -4
- package/dist/commands/read-screen.js +489 -6
- package/dist/commands/read-screen.js.map +4 -4
- package/dist/commands/resize.js +489 -6
- package/dist/commands/resize.js.map +4 -4
- package/dist/commands/runtime.js.map +1 -1
- package/dist/commands/screenshot.js +489 -6
- package/dist/commands/screenshot.js.map +4 -4
- package/dist/commands/send-signal.js +489 -6
- package/dist/commands/send-signal.js.map +4 -4
- package/dist/commands/type.js +489 -6
- package/dist/commands/type.js.map +4 -4
- package/dist/commands/uninstall.js +554 -20
- package/dist/commands/uninstall.js.map +4 -4
- package/dist/commands/wait-for-exit.js +489 -6
- package/dist/commands/wait-for-exit.js.map +4 -4
- package/dist/commands/wait-for.js +489 -6
- package/dist/commands/wait-for.js.map +4 -4
- package/dist/testing/cli-repl.js +1599 -497
- package/dist/testing/cli-repl.js.map +4 -4
- package/dist/testing/qa-cli.js +1609 -507
- package/dist/testing/qa-cli.js.map +4 -4
- package/node_modules/@poe-code/agent-defs/README.md +35 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/claude-code.d.ts +2 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/claude-code.js +21 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/claude-desktop.d.ts +2 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/claude-desktop.js +18 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/codex.d.ts +2 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/codex.js +25 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/cursor.d.ts +2 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/cursor.js +15 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/gemini-cli.d.ts +2 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/gemini-cli.js +16 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/goose.d.ts +2 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/goose.js +16 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/index.d.ts +9 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/index.js +9 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/kimi.d.ts +2 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/kimi.js +16 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/opencode.d.ts +2 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/opencode.js +20 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/poe-agent.d.ts +2 -0
- package/node_modules/@poe-code/agent-defs/dist/agents/poe-agent.js +14 -0
- package/node_modules/@poe-code/agent-defs/dist/index.d.ts +5 -0
- package/node_modules/@poe-code/agent-defs/dist/index.js +3 -0
- package/node_modules/@poe-code/agent-defs/dist/registry.d.ts +3 -0
- package/node_modules/@poe-code/agent-defs/dist/registry.js +45 -0
- package/node_modules/@poe-code/agent-defs/dist/specifier.d.ts +7 -0
- package/node_modules/@poe-code/agent-defs/dist/specifier.js +40 -0
- package/node_modules/@poe-code/agent-defs/dist/types.d.ts +28 -0
- package/node_modules/@poe-code/agent-defs/dist/types.js +1 -0
- package/node_modules/@poe-code/agent-defs/package.json +20 -0
- package/node_modules/@poe-code/agent-skill-config/dist/apply.js +2 -1
- package/node_modules/@poe-code/agent-skill-config/dist/bridge-active-skills.d.ts +1 -0
- package/node_modules/@poe-code/agent-skill-config/dist/bridge-active-skills.js +37 -18
- package/node_modules/@poe-code/agent-skill-config/dist/resolve-skill-reference.js +8 -4
- package/node_modules/@poe-code/agent-skill-config/package.json +1 -5
- package/node_modules/@poe-code/config-mutations/README.md +55 -0
- package/node_modules/@poe-code/config-mutations/dist/error-codes.d.ts +1 -0
- package/node_modules/@poe-code/config-mutations/dist/error-codes.js +6 -0
- package/node_modules/@poe-code/config-mutations/dist/execution/apply-mutation.d.ts +6 -0
- package/node_modules/@poe-code/config-mutations/dist/execution/apply-mutation.js +829 -0
- package/node_modules/@poe-code/config-mutations/dist/execution/path-utils.d.ts +17 -0
- package/node_modules/@poe-code/config-mutations/dist/execution/path-utils.js +64 -0
- package/node_modules/@poe-code/config-mutations/dist/execution/run-mutations.d.ts +7 -0
- package/node_modules/@poe-code/config-mutations/dist/execution/run-mutations.js +39 -0
- package/node_modules/@poe-code/config-mutations/dist/formats/index.d.ts +13 -0
- package/node_modules/@poe-code/config-mutations/dist/formats/index.js +49 -0
- package/node_modules/@poe-code/config-mutations/dist/formats/json.d.ts +32 -0
- package/node_modules/@poe-code/config-mutations/dist/formats/json.js +171 -0
- package/node_modules/@poe-code/config-mutations/dist/formats/object.d.ts +4 -0
- package/node_modules/@poe-code/config-mutations/dist/formats/object.js +27 -0
- package/node_modules/@poe-code/config-mutations/dist/formats/toml.d.ts +2 -0
- package/node_modules/@poe-code/config-mutations/dist/formats/toml.js +75 -0
- package/node_modules/@poe-code/config-mutations/dist/formats/yaml.d.ts +2 -0
- package/node_modules/@poe-code/config-mutations/dist/formats/yaml.js +76 -0
- package/node_modules/@poe-code/config-mutations/dist/fs-utils.d.ts +18 -0
- package/node_modules/@poe-code/config-mutations/dist/fs-utils.js +43 -0
- package/node_modules/@poe-code/config-mutations/dist/index.d.ts +8 -0
- package/node_modules/@poe-code/config-mutations/dist/index.js +8 -0
- package/node_modules/@poe-code/config-mutations/dist/mutations/config-mutation.d.ts +47 -0
- package/node_modules/@poe-code/config-mutations/dist/mutations/config-mutation.js +34 -0
- package/node_modules/@poe-code/config-mutations/dist/mutations/file-mutation.d.ts +62 -0
- package/node_modules/@poe-code/config-mutations/dist/mutations/file-mutation.js +55 -0
- package/node_modules/@poe-code/config-mutations/dist/mutations/template-mutation.d.ts +40 -0
- package/node_modules/@poe-code/config-mutations/dist/mutations/template-mutation.js +32 -0
- package/node_modules/@poe-code/config-mutations/dist/template/render.d.ts +6 -0
- package/node_modules/@poe-code/config-mutations/dist/template/render.js +8 -0
- package/node_modules/@poe-code/config-mutations/dist/testing/format-utils.d.ts +7 -0
- package/node_modules/@poe-code/config-mutations/dist/testing/format-utils.js +21 -0
- package/node_modules/@poe-code/config-mutations/dist/testing/index.d.ts +3 -0
- package/node_modules/@poe-code/config-mutations/dist/testing/index.js +2 -0
- package/node_modules/@poe-code/config-mutations/dist/testing/mock-fs.d.ts +25 -0
- package/node_modules/@poe-code/config-mutations/dist/testing/mock-fs.js +194 -0
- package/node_modules/@poe-code/config-mutations/dist/types.d.ts +168 -0
- package/node_modules/@poe-code/config-mutations/dist/types.js +6 -0
- package/node_modules/@poe-code/config-mutations/package.json +29 -0
- package/node_modules/@poe-code/frontmatter/README.md +35 -0
- package/node_modules/@poe-code/frontmatter/dist/fences.d.ts +25 -0
- package/node_modules/@poe-code/frontmatter/dist/fences.js +100 -0
- package/node_modules/@poe-code/frontmatter/dist/index.d.ts +3 -0
- package/node_modules/@poe-code/frontmatter/dist/index.js +3 -0
- package/node_modules/@poe-code/frontmatter/dist/parse.d.ts +20 -0
- package/node_modules/@poe-code/frontmatter/dist/parse.js +209 -0
- package/node_modules/@poe-code/frontmatter/dist/stringify.d.ts +1 -0
- package/node_modules/@poe-code/frontmatter/dist/stringify.js +48 -0
- package/node_modules/@poe-code/frontmatter/package.json +25 -0
- package/node_modules/toolcraft-design/README.md +160 -0
- package/node_modules/toolcraft-design/dist/acp/components.d.ts +12 -0
- package/node_modules/toolcraft-design/dist/acp/components.js +137 -0
- package/node_modules/toolcraft-design/dist/acp/index.d.ts +3 -0
- package/node_modules/toolcraft-design/dist/acp/index.js +2 -0
- package/node_modules/toolcraft-design/dist/acp/writer.d.ts +13 -0
- package/node_modules/toolcraft-design/dist/acp/writer.js +21 -0
- package/node_modules/toolcraft-design/dist/components/browser.d.ts +15 -0
- package/node_modules/toolcraft-design/dist/components/browser.js +31 -0
- package/node_modules/toolcraft-design/dist/components/catalog.d.ts +26 -0
- package/node_modules/toolcraft-design/dist/components/catalog.js +95 -0
- package/node_modules/toolcraft-design/dist/components/color.d.ts +31 -0
- package/node_modules/toolcraft-design/dist/components/color.js +102 -0
- package/node_modules/toolcraft-design/dist/components/command-errors.d.ts +16 -0
- package/node_modules/toolcraft-design/dist/components/command-errors.js +23 -0
- package/node_modules/toolcraft-design/dist/components/detail-card.d.ts +22 -0
- package/node_modules/toolcraft-design/dist/components/detail-card.js +45 -0
- package/node_modules/toolcraft-design/dist/components/help-formatter-plain.d.ts +5 -0
- package/node_modules/toolcraft-design/dist/components/help-formatter-plain.js +132 -0
- package/node_modules/toolcraft-design/dist/components/help-formatter.d.ts +33 -0
- package/node_modules/toolcraft-design/dist/components/help-formatter.js +213 -0
- package/node_modules/toolcraft-design/dist/components/index.d.ts +16 -0
- package/node_modules/toolcraft-design/dist/components/index.js +10 -0
- package/node_modules/toolcraft-design/dist/components/logger.d.ts +11 -0
- package/node_modules/toolcraft-design/dist/components/logger.js +60 -0
- package/node_modules/toolcraft-design/dist/components/symbols.d.ts +12 -0
- package/node_modules/toolcraft-design/dist/components/symbols.js +71 -0
- package/node_modules/toolcraft-design/dist/components/table.d.ts +15 -0
- package/node_modules/toolcraft-design/dist/components/table.js +302 -0
- package/node_modules/toolcraft-design/dist/components/template.d.ts +10 -0
- package/node_modules/toolcraft-design/dist/components/template.js +437 -0
- package/node_modules/toolcraft-design/dist/components/text.d.ts +16 -0
- package/node_modules/toolcraft-design/dist/components/text.js +145 -0
- package/node_modules/toolcraft-design/dist/dashboard/ansi.d.ts +18 -0
- package/node_modules/toolcraft-design/dist/dashboard/ansi.js +343 -0
- package/node_modules/toolcraft-design/dist/dashboard/buffer.d.ts +25 -0
- package/node_modules/toolcraft-design/dist/dashboard/buffer.js +219 -0
- package/node_modules/toolcraft-design/dist/dashboard/components/border.d.ts +9 -0
- package/node_modules/toolcraft-design/dist/dashboard/components/border.js +123 -0
- package/node_modules/toolcraft-design/dist/dashboard/components/footer.d.ts +8 -0
- package/node_modules/toolcraft-design/dist/dashboard/components/footer.js +56 -0
- package/node_modules/toolcraft-design/dist/dashboard/components/output-pane.d.ts +12 -0
- package/node_modules/toolcraft-design/dist/dashboard/components/output-pane.js +268 -0
- package/node_modules/toolcraft-design/dist/dashboard/components/stats-pane.d.ts +7 -0
- package/node_modules/toolcraft-design/dist/dashboard/components/stats-pane.js +107 -0
- package/node_modules/toolcraft-design/dist/dashboard/dashboard.d.ts +20 -0
- package/node_modules/toolcraft-design/dist/dashboard/dashboard.js +167 -0
- package/node_modules/toolcraft-design/dist/dashboard/demo.d.ts +13 -0
- package/node_modules/toolcraft-design/dist/dashboard/demo.js +145 -0
- package/node_modules/toolcraft-design/dist/dashboard/index.d.ts +8 -0
- package/node_modules/toolcraft-design/dist/dashboard/index.js +4 -0
- package/node_modules/toolcraft-design/dist/dashboard/keymap.d.ts +8 -0
- package/node_modules/toolcraft-design/dist/dashboard/keymap.js +233 -0
- package/node_modules/toolcraft-design/dist/dashboard/layout.d.ts +25 -0
- package/node_modules/toolcraft-design/dist/dashboard/layout.js +79 -0
- package/node_modules/toolcraft-design/dist/dashboard/should-use-dashboard.d.ts +10 -0
- package/node_modules/toolcraft-design/dist/dashboard/should-use-dashboard.js +7 -0
- package/node_modules/toolcraft-design/dist/dashboard/snapshot.d.ts +10 -0
- package/node_modules/toolcraft-design/dist/dashboard/snapshot.js +68 -0
- package/node_modules/toolcraft-design/dist/dashboard/store.d.ts +8 -0
- package/node_modules/toolcraft-design/dist/dashboard/store.js +51 -0
- package/node_modules/toolcraft-design/dist/dashboard/terminal-width.d.ts +4 -0
- package/node_modules/toolcraft-design/dist/dashboard/terminal-width.js +71 -0
- package/node_modules/toolcraft-design/dist/dashboard/terminal.d.ts +37 -0
- package/node_modules/toolcraft-design/dist/dashboard/terminal.js +264 -0
- package/node_modules/toolcraft-design/dist/dashboard/types.d.ts +38 -0
- package/node_modules/toolcraft-design/dist/dashboard/types.js +1 -0
- package/node_modules/toolcraft-design/dist/explorer/actions.d.ts +16 -0
- package/node_modules/toolcraft-design/dist/explorer/actions.js +39 -0
- package/node_modules/toolcraft-design/dist/explorer/demo.d.ts +13 -0
- package/node_modules/toolcraft-design/dist/explorer/demo.js +297 -0
- package/node_modules/toolcraft-design/dist/explorer/events.d.ts +67 -0
- package/node_modules/toolcraft-design/dist/explorer/events.js +1 -0
- package/node_modules/toolcraft-design/dist/explorer/filter.d.ts +10 -0
- package/node_modules/toolcraft-design/dist/explorer/filter.js +95 -0
- package/node_modules/toolcraft-design/dist/explorer/index.d.ts +8 -0
- package/node_modules/toolcraft-design/dist/explorer/index.js +8 -0
- package/node_modules/toolcraft-design/dist/explorer/jobs.d.ts +7 -0
- package/node_modules/toolcraft-design/dist/explorer/jobs.js +59 -0
- package/node_modules/toolcraft-design/dist/explorer/keymap.d.ts +21 -0
- package/node_modules/toolcraft-design/dist/explorer/keymap.js +376 -0
- package/node_modules/toolcraft-design/dist/explorer/layout.d.ts +20 -0
- package/node_modules/toolcraft-design/dist/explorer/layout.js +73 -0
- package/node_modules/toolcraft-design/dist/explorer/reducer.d.ts +9 -0
- package/node_modules/toolcraft-design/dist/explorer/reducer.js +782 -0
- package/node_modules/toolcraft-design/dist/explorer/render/detail.d.ts +4 -0
- package/node_modules/toolcraft-design/dist/explorer/render/detail.js +97 -0
- package/node_modules/toolcraft-design/dist/explorer/render/footer.d.ts +4 -0
- package/node_modules/toolcraft-design/dist/explorer/render/footer.js +73 -0
- package/node_modules/toolcraft-design/dist/explorer/render/header.d.ts +4 -0
- package/node_modules/toolcraft-design/dist/explorer/render/header.js +49 -0
- package/node_modules/toolcraft-design/dist/explorer/render/index.d.ts +8 -0
- package/node_modules/toolcraft-design/dist/explorer/render/index.js +53 -0
- package/node_modules/toolcraft-design/dist/explorer/render/list.d.ts +4 -0
- package/node_modules/toolcraft-design/dist/explorer/render/list.js +116 -0
- package/node_modules/toolcraft-design/dist/explorer/render/modal.d.ts +3 -0
- package/node_modules/toolcraft-design/dist/explorer/render/modal.js +87 -0
- package/node_modules/toolcraft-design/dist/explorer/render/test-fixtures.d.ts +8 -0
- package/node_modules/toolcraft-design/dist/explorer/render/test-fixtures.js +156 -0
- package/node_modules/toolcraft-design/dist/explorer/render/text.d.ts +12 -0
- package/node_modules/toolcraft-design/dist/explorer/render/text.js +81 -0
- package/node_modules/toolcraft-design/dist/explorer/runtime.d.ts +2 -0
- package/node_modules/toolcraft-design/dist/explorer/runtime.js +340 -0
- package/node_modules/toolcraft-design/dist/explorer/runtime.test-helpers.d.ts +50 -0
- package/node_modules/toolcraft-design/dist/explorer/runtime.test-helpers.js +101 -0
- package/node_modules/toolcraft-design/dist/explorer/state.d.ts +137 -0
- package/node_modules/toolcraft-design/dist/explorer/state.js +86 -0
- package/node_modules/toolcraft-design/dist/explorer/theme.d.ts +27 -0
- package/node_modules/toolcraft-design/dist/explorer/theme.js +29 -0
- package/node_modules/toolcraft-design/dist/index.d.ts +50 -0
- package/node_modules/toolcraft-design/dist/index.js +43 -0
- package/node_modules/toolcraft-design/dist/internal/color-support.d.ts +9 -0
- package/node_modules/toolcraft-design/dist/internal/color-support.js +12 -0
- package/node_modules/toolcraft-design/dist/internal/output-format.d.ts +6 -0
- package/node_modules/toolcraft-design/dist/internal/output-format.js +22 -0
- package/node_modules/toolcraft-design/dist/internal/strip-ansi.d.ts +1 -0
- package/node_modules/toolcraft-design/dist/internal/strip-ansi.js +50 -0
- package/node_modules/toolcraft-design/dist/internal/theme-detect.d.ts +12 -0
- package/node_modules/toolcraft-design/dist/internal/theme-detect.js +71 -0
- package/node_modules/toolcraft-design/dist/internal/theme-state.d.ts +12 -0
- package/node_modules/toolcraft-design/dist/internal/theme-state.js +35 -0
- package/node_modules/toolcraft-design/dist/prompts/index.d.ts +91 -0
- package/node_modules/toolcraft-design/dist/prompts/index.js +137 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/cancel-symbol.d.ts +2 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/cancel-symbol.js +4 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/confirm.d.ts +9 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/confirm.js +47 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/core.d.ts +55 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/core.js +274 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/glyphs.d.ts +20 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/glyphs.js +53 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/index.d.ts +6 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/index.js +6 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/keys.d.ts +2 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/keys.js +28 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/multiselect.d.ts +13 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/multiselect.js +131 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/pagination.d.ts +10 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/pagination.js +52 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/password.d.ts +10 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/password.js +55 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/select.d.ts +18 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/select.js +89 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/test-helpers.d.ts +21 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/test-helpers.js +32 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/text.d.ts +12 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/text.js +60 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/wrap.d.ts +4 -0
- package/node_modules/toolcraft-design/dist/prompts/interactive/wrap.js +18 -0
- package/node_modules/toolcraft-design/dist/prompts/primitives/cancel.d.ts +2 -0
- package/node_modules/toolcraft-design/dist/prompts/primitives/cancel.js +9 -0
- package/node_modules/toolcraft-design/dist/prompts/primitives/intro.d.ts +1 -0
- package/node_modules/toolcraft-design/dist/prompts/primitives/intro.js +16 -0
- package/node_modules/toolcraft-design/dist/prompts/primitives/log.d.ts +18 -0
- package/node_modules/toolcraft-design/dist/prompts/primitives/log.js +104 -0
- package/node_modules/toolcraft-design/dist/prompts/primitives/note.d.ts +1 -0
- package/node_modules/toolcraft-design/dist/prompts/primitives/note.js +39 -0
- package/node_modules/toolcraft-design/dist/prompts/primitives/outro.d.ts +1 -0
- package/node_modules/toolcraft-design/dist/prompts/primitives/outro.js +16 -0
- package/node_modules/toolcraft-design/dist/prompts/primitives/spinner.d.ts +6 -0
- package/node_modules/toolcraft-design/dist/prompts/primitives/spinner.js +74 -0
- package/node_modules/toolcraft-design/dist/prompts/theme.d.ts +11 -0
- package/node_modules/toolcraft-design/dist/prompts/theme.js +15 -0
- package/node_modules/toolcraft-design/dist/static/index.d.ts +4 -0
- package/node_modules/toolcraft-design/dist/static/index.js +2 -0
- package/node_modules/toolcraft-design/dist/static/menu.d.ts +11 -0
- package/node_modules/toolcraft-design/dist/static/menu.js +42 -0
- package/node_modules/toolcraft-design/dist/static/spinner.d.ts +14 -0
- package/node_modules/toolcraft-design/dist/static/spinner.js +52 -0
- package/node_modules/toolcraft-design/dist/terminal-markdown/ast.d.ts +92 -0
- package/node_modules/toolcraft-design/dist/terminal-markdown/ast.js +1 -0
- package/node_modules/toolcraft-design/dist/terminal-markdown/demo-content.d.ts +2 -0
- package/node_modules/toolcraft-design/dist/terminal-markdown/demo-content.js +139 -0
- package/node_modules/toolcraft-design/dist/terminal-markdown/index.d.ts +6 -0
- package/node_modules/toolcraft-design/dist/terminal-markdown/index.js +8 -0
- package/node_modules/toolcraft-design/dist/terminal-markdown/parser/block.d.ts +7 -0
- package/node_modules/toolcraft-design/dist/terminal-markdown/parser/block.js +1495 -0
- package/node_modules/toolcraft-design/dist/terminal-markdown/parser/frontmatter.d.ts +8 -0
- package/node_modules/toolcraft-design/dist/terminal-markdown/parser/frontmatter.js +36 -0
- package/node_modules/toolcraft-design/dist/terminal-markdown/parser/inline.d.ts +10 -0
- package/node_modules/toolcraft-design/dist/terminal-markdown/parser/inline.js +1190 -0
- package/node_modules/toolcraft-design/dist/terminal-markdown/parser.d.ts +5 -0
- package/node_modules/toolcraft-design/dist/terminal-markdown/parser.js +42 -0
- package/node_modules/toolcraft-design/dist/terminal-markdown/renderer.d.ts +6 -0
- package/node_modules/toolcraft-design/dist/terminal-markdown/renderer.js +615 -0
- package/node_modules/toolcraft-design/dist/terminal-markdown/testing/theme-render-fixture.d.ts +1 -0
- package/node_modules/toolcraft-design/dist/terminal-markdown/testing/theme-render-fixture.js +27 -0
- package/node_modules/toolcraft-design/dist/tokens/brand.d.ts +5 -0
- package/node_modules/toolcraft-design/dist/tokens/brand.js +5 -0
- package/node_modules/toolcraft-design/dist/tokens/colors.d.ts +37 -0
- package/node_modules/toolcraft-design/dist/tokens/colors.js +85 -0
- package/node_modules/toolcraft-design/dist/tokens/index.d.ts +6 -0
- package/node_modules/toolcraft-design/dist/tokens/index.js +5 -0
- package/node_modules/toolcraft-design/dist/tokens/spacing.d.ts +6 -0
- package/node_modules/toolcraft-design/dist/tokens/spacing.js +6 -0
- package/node_modules/toolcraft-design/dist/tokens/typography.d.ts +7 -0
- package/node_modules/toolcraft-design/dist/tokens/typography.js +8 -0
- package/node_modules/toolcraft-design/dist/tokens/widths.d.ts +5 -0
- package/node_modules/toolcraft-design/dist/tokens/widths.js +5 -0
- package/node_modules/toolcraft-design/package.json +44 -0
- package/package.json +15 -5
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { resolveOutputFormat } from "../internal/output-format.js";
|
|
2
|
+
export function shouldUseInteractiveDashboard(enabled, io = process) {
|
|
3
|
+
return enabled === true
|
|
4
|
+
&& resolveOutputFormat() === "terminal"
|
|
5
|
+
&& Boolean(io.stdin.isTTY)
|
|
6
|
+
&& Boolean(io.stdout.isTTY);
|
|
7
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { DashboardStats, OutputItem } from "./types.js";
|
|
2
|
+
export type SnapshotOptions = {
|
|
3
|
+
width?: number;
|
|
4
|
+
height?: number;
|
|
5
|
+
title?: string;
|
|
6
|
+
statsTitle?: string;
|
|
7
|
+
items?: OutputItem[];
|
|
8
|
+
stats?: DashboardStats;
|
|
9
|
+
};
|
|
10
|
+
export declare function renderDashboardSnapshot(opts?: SnapshotOptions): string;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { ScreenBuffer, cellToAnsi } from "./buffer.js";
|
|
2
|
+
import { renderBorder } from "./components/border.js";
|
|
3
|
+
import { defaultHints, renderFooter } from "./components/footer.js";
|
|
4
|
+
import { renderOutputPane } from "./components/output-pane.js";
|
|
5
|
+
import { renderStatsPane } from "./components/stats-pane.js";
|
|
6
|
+
import { computeDashboardLayout } from "./layout.js";
|
|
7
|
+
const SNAPSHOT_WIDTH = 80;
|
|
8
|
+
const SNAPSHOT_HEIGHT = 20;
|
|
9
|
+
const RIGHT_PANE_WIDTH = 25;
|
|
10
|
+
export function renderDashboardSnapshot(opts = {}) {
|
|
11
|
+
const width = opts.width ?? SNAPSHOT_WIDTH;
|
|
12
|
+
const height = opts.height ?? SNAPSHOT_HEIGHT;
|
|
13
|
+
const title = opts.title ?? "Agent Output";
|
|
14
|
+
const statsTitle = opts.statsTitle ?? "Stats";
|
|
15
|
+
const items = opts.items ?? defaultItems();
|
|
16
|
+
const stats = opts.stats ?? defaultStats();
|
|
17
|
+
const layout = computeDashboardLayout({
|
|
18
|
+
totalWidth: width,
|
|
19
|
+
totalHeight: height,
|
|
20
|
+
rightPaneWidth: RIGHT_PANE_WIDTH
|
|
21
|
+
});
|
|
22
|
+
const buffer = new ScreenBuffer(width, height);
|
|
23
|
+
renderBorder(buffer, layout, {
|
|
24
|
+
leftTitle: title,
|
|
25
|
+
rightTitle: statsTitle,
|
|
26
|
+
style: { dim: true }
|
|
27
|
+
});
|
|
28
|
+
renderOutputPane(buffer, layout.leftPane, items);
|
|
29
|
+
renderStatsPane(buffer, layout.rightPane, stats);
|
|
30
|
+
renderFooter(buffer, layout.footer, defaultHints());
|
|
31
|
+
return bufferToAnsi(buffer);
|
|
32
|
+
}
|
|
33
|
+
function bufferToAnsi(buffer) {
|
|
34
|
+
const lines = [];
|
|
35
|
+
for (let y = 0; y < buffer.height; y += 1) {
|
|
36
|
+
let line = "";
|
|
37
|
+
for (let x = 0; x < buffer.width; x += 1) {
|
|
38
|
+
line += cellToAnsi(buffer.get(x, y));
|
|
39
|
+
}
|
|
40
|
+
lines.push(line);
|
|
41
|
+
}
|
|
42
|
+
return lines.join("\n");
|
|
43
|
+
}
|
|
44
|
+
function defaultItems() {
|
|
45
|
+
const now = Date.now();
|
|
46
|
+
return [
|
|
47
|
+
{ kind: "info", text: "Analyzing repository state", ts: now },
|
|
48
|
+
{ kind: "tool", text: "Running npm test -- --runInBand", ts: now + 500 },
|
|
49
|
+
{ kind: "success", text: "Generated provider config", ts: now + 1000 },
|
|
50
|
+
{ kind: "status", text: "Streaming model response", ts: now + 1500 },
|
|
51
|
+
{ kind: "info", text: "Inspecting agent configuration", ts: now + 2000 },
|
|
52
|
+
{ kind: "tool", text: "Executing npm run lint:types", ts: now + 2500 },
|
|
53
|
+
{ kind: "error", text: "Retrying transient network request", ts: now + 3000 },
|
|
54
|
+
{ kind: "success", text: "Updated dashboard layout", ts: now + 3500 },
|
|
55
|
+
{ kind: "info", text: "Collecting recent command output", ts: now + 4000 },
|
|
56
|
+
{ kind: "status", text: "Waiting for follow-up task", ts: now + 4500 }
|
|
57
|
+
];
|
|
58
|
+
}
|
|
59
|
+
function defaultStats() {
|
|
60
|
+
return {
|
|
61
|
+
status: "running",
|
|
62
|
+
iterations: 5,
|
|
63
|
+
tokensIn: 685,
|
|
64
|
+
tokensOut: 445,
|
|
65
|
+
elapsedMs: 5000,
|
|
66
|
+
currentAction: "Executing tool call"
|
|
67
|
+
};
|
|
68
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { DashboardState, DashboardStats, OutputItem } from "./types.js";
|
|
2
|
+
export type DashboardStore = {
|
|
3
|
+
getState(): DashboardState;
|
|
4
|
+
appendOutput(item: OutputItem): void;
|
|
5
|
+
updateStats(partial: Partial<DashboardStats>): void;
|
|
6
|
+
onChange(handler: () => void): () => void;
|
|
7
|
+
};
|
|
8
|
+
export declare function createStore(): DashboardStore;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const MAX_RETAINED_OUTPUT = 256;
|
|
2
|
+
export function createStore() {
|
|
3
|
+
let state = {
|
|
4
|
+
output: [],
|
|
5
|
+
stats: {
|
|
6
|
+
status: "idle",
|
|
7
|
+
iterations: 0,
|
|
8
|
+
tokensIn: 0,
|
|
9
|
+
tokensOut: 0,
|
|
10
|
+
elapsedMs: 0
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
const listeners = new Set();
|
|
14
|
+
function notify() {
|
|
15
|
+
for (const listener of listeners) {
|
|
16
|
+
listener();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
function getState() {
|
|
20
|
+
return state;
|
|
21
|
+
}
|
|
22
|
+
function appendOutput(item) {
|
|
23
|
+
const next = state.output.length >= MAX_RETAINED_OUTPUT
|
|
24
|
+
? [...state.output.slice(state.output.length - MAX_RETAINED_OUTPUT + 1), item]
|
|
25
|
+
: [...state.output, item];
|
|
26
|
+
state = { ...state, output: next };
|
|
27
|
+
notify();
|
|
28
|
+
}
|
|
29
|
+
function updateStats(partial) {
|
|
30
|
+
state = {
|
|
31
|
+
...state,
|
|
32
|
+
stats: {
|
|
33
|
+
...state.stats,
|
|
34
|
+
...partial
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
notify();
|
|
38
|
+
}
|
|
39
|
+
function onChange(handler) {
|
|
40
|
+
listeners.add(handler);
|
|
41
|
+
return () => {
|
|
42
|
+
listeners.delete(handler);
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
getState,
|
|
47
|
+
appendOutput,
|
|
48
|
+
updateStats,
|
|
49
|
+
onChange
|
|
50
|
+
};
|
|
51
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function graphemes(value: string): string[];
|
|
2
|
+
export declare function displayWidth(value: string, startColumn?: number): number;
|
|
3
|
+
export declare function expandTabs(value: string, startColumn?: number): string;
|
|
4
|
+
export declare function graphemeWidth(segment: string): number;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
const graphemeSegmenter = new Intl.Segmenter(undefined, { granularity: "grapheme" });
|
|
2
|
+
export function graphemes(value) {
|
|
3
|
+
return Array.from(graphemeSegmenter.segment(value), ({ segment }) => segment);
|
|
4
|
+
}
|
|
5
|
+
export function displayWidth(value, startColumn = 0) {
|
|
6
|
+
let column = startColumn;
|
|
7
|
+
for (const segment of graphemes(value)) {
|
|
8
|
+
if (segment === "\t") {
|
|
9
|
+
column += 8 - (column % 8);
|
|
10
|
+
continue;
|
|
11
|
+
}
|
|
12
|
+
column += graphemeWidth(segment);
|
|
13
|
+
}
|
|
14
|
+
return column - startColumn;
|
|
15
|
+
}
|
|
16
|
+
export function expandTabs(value, startColumn = 0) {
|
|
17
|
+
let column = startColumn;
|
|
18
|
+
let expanded = "";
|
|
19
|
+
for (const segment of graphemes(value)) {
|
|
20
|
+
if (segment === "\t") {
|
|
21
|
+
const spaces = 8 - (column % 8);
|
|
22
|
+
expanded += " ".repeat(spaces);
|
|
23
|
+
column += spaces;
|
|
24
|
+
continue;
|
|
25
|
+
}
|
|
26
|
+
expanded += segment;
|
|
27
|
+
column += graphemeWidth(segment);
|
|
28
|
+
}
|
|
29
|
+
return expanded;
|
|
30
|
+
}
|
|
31
|
+
export function graphemeWidth(segment) {
|
|
32
|
+
const codePoint = segment.codePointAt(0);
|
|
33
|
+
if (codePoint === undefined || isZeroWidthCodePoint(codePoint)) {
|
|
34
|
+
return 0;
|
|
35
|
+
}
|
|
36
|
+
return isWideCodePoint(codePoint) || isFlagSegment(segment) ? 2 : 1;
|
|
37
|
+
}
|
|
38
|
+
function isZeroWidthCodePoint(codePoint) {
|
|
39
|
+
return (codePoint >= 0x0300 && codePoint <= 0x036f)
|
|
40
|
+
|| (codePoint >= 0x1ab0 && codePoint <= 0x1aff)
|
|
41
|
+
|| (codePoint >= 0x1dc0 && codePoint <= 0x1dff)
|
|
42
|
+
|| (codePoint >= 0x20d0 && codePoint <= 0x20ff)
|
|
43
|
+
|| (codePoint >= 0xfe20 && codePoint <= 0xfe2f);
|
|
44
|
+
}
|
|
45
|
+
function isFlagSegment(segment) {
|
|
46
|
+
const codePoints = [...segment].map((character) => character.codePointAt(0));
|
|
47
|
+
return codePoints.length === 2
|
|
48
|
+
&& codePoints.every((codePoint) => codePoint !== undefined && codePoint >= 0x1f1e6 && codePoint <= 0x1f1ff);
|
|
49
|
+
}
|
|
50
|
+
function isWideCodePoint(codePoint) {
|
|
51
|
+
return ((codePoint >= 0x1100 && codePoint <= 0x115f)
|
|
52
|
+
|| codePoint === 0x2329
|
|
53
|
+
|| codePoint === 0x232a
|
|
54
|
+
|| (codePoint >= 0x2e80 && codePoint <= 0x303e)
|
|
55
|
+
|| (codePoint >= 0x3041 && codePoint <= 0x33bf)
|
|
56
|
+
|| (codePoint >= 0x3400 && codePoint <= 0x4dbf)
|
|
57
|
+
|| (codePoint >= 0x4e00 && codePoint <= 0xa4cf)
|
|
58
|
+
|| (codePoint >= 0xa960 && codePoint <= 0xa97f)
|
|
59
|
+
|| (codePoint >= 0xac00 && codePoint <= 0xd7af)
|
|
60
|
+
|| (codePoint >= 0xf900 && codePoint <= 0xfaff)
|
|
61
|
+
|| (codePoint >= 0xfe10 && codePoint <= 0xfe19)
|
|
62
|
+
|| (codePoint >= 0xfe30 && codePoint <= 0xfe6f)
|
|
63
|
+
|| (codePoint >= 0xff00 && codePoint <= 0xff60)
|
|
64
|
+
|| (codePoint >= 0xffe0 && codePoint <= 0xffe6)
|
|
65
|
+
|| (codePoint >= 0x1b000 && codePoint <= 0x1b0ff)
|
|
66
|
+
|| codePoint === 0x1f004
|
|
67
|
+
|| codePoint === 0x1f0cf
|
|
68
|
+
|| (codePoint >= 0x1f200 && codePoint <= 0x1fffd)
|
|
69
|
+
|| (codePoint >= 0x20000 && codePoint <= 0x2fffd)
|
|
70
|
+
|| (codePoint >= 0x30000 && codePoint <= 0x3fffd));
|
|
71
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Cell } from "./types.js";
|
|
2
|
+
export type KeypressEvent = {
|
|
3
|
+
name?: string;
|
|
4
|
+
ch?: string;
|
|
5
|
+
ctrl: boolean;
|
|
6
|
+
meta: boolean;
|
|
7
|
+
shift: boolean;
|
|
8
|
+
};
|
|
9
|
+
export type TerminalDriver = {
|
|
10
|
+
enterRawMode(): void;
|
|
11
|
+
exitRawMode(): void;
|
|
12
|
+
enterAltScreen(): void;
|
|
13
|
+
exitAltScreen(): void;
|
|
14
|
+
disableLineWrap(): void;
|
|
15
|
+
enableLineWrap(): void;
|
|
16
|
+
hideCursor(): void;
|
|
17
|
+
showCursor(): void;
|
|
18
|
+
moveTo(x: number, y: number): void;
|
|
19
|
+
write(text: string): void;
|
|
20
|
+
flush(changes: Array<{
|
|
21
|
+
x: number;
|
|
22
|
+
y: number;
|
|
23
|
+
cell: Cell;
|
|
24
|
+
}>): void;
|
|
25
|
+
getSize(): {
|
|
26
|
+
cols: number;
|
|
27
|
+
rows: number;
|
|
28
|
+
};
|
|
29
|
+
onResize(handler: () => void): () => void;
|
|
30
|
+
onKeypress(handler: (key: KeypressEvent) => void): () => void;
|
|
31
|
+
destroy(): void;
|
|
32
|
+
};
|
|
33
|
+
export declare function createTerminalDriver(opts?: {
|
|
34
|
+
stdin?: NodeJS.ReadStream;
|
|
35
|
+
stdout?: NodeJS.WriteStream;
|
|
36
|
+
}): TerminalDriver;
|
|
37
|
+
export declare function parseKeypress(data: Buffer): KeypressEvent | undefined;
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import readline from "node:readline";
|
|
2
|
+
import { PassThrough } from "node:stream";
|
|
3
|
+
import { cellToAnsi } from "./buffer.js";
|
|
4
|
+
export function createTerminalDriver(opts) {
|
|
5
|
+
const stdin = (opts?.stdin ?? process.stdin);
|
|
6
|
+
const stdout = (opts?.stdout ?? process.stdout);
|
|
7
|
+
const resizeListeners = new Set();
|
|
8
|
+
const keypressListeners = new Set();
|
|
9
|
+
let rawMode = false;
|
|
10
|
+
let altScreen = false;
|
|
11
|
+
let lineWrapEnabled = true;
|
|
12
|
+
let cursorHidden = false;
|
|
13
|
+
let destroyed = false;
|
|
14
|
+
readline.emitKeypressEvents(stdin);
|
|
15
|
+
function enterRawMode() {
|
|
16
|
+
if (destroyed || rawMode) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
stdin.setRawMode?.(true);
|
|
20
|
+
stdin.resume();
|
|
21
|
+
rawMode = true;
|
|
22
|
+
}
|
|
23
|
+
function exitRawMode() {
|
|
24
|
+
if (destroyed || !rawMode) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
stdin.setRawMode?.(false);
|
|
28
|
+
stdin.pause();
|
|
29
|
+
rawMode = false;
|
|
30
|
+
}
|
|
31
|
+
function enterAltScreen() {
|
|
32
|
+
if (destroyed || altScreen) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
write("\u001b[?1049h");
|
|
36
|
+
altScreen = true;
|
|
37
|
+
}
|
|
38
|
+
function exitAltScreen() {
|
|
39
|
+
if (destroyed || !altScreen) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
write("\u001b[?1049l");
|
|
43
|
+
altScreen = false;
|
|
44
|
+
}
|
|
45
|
+
function disableLineWrap() {
|
|
46
|
+
if (destroyed || !lineWrapEnabled) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
write("\u001b[?7l");
|
|
50
|
+
lineWrapEnabled = false;
|
|
51
|
+
}
|
|
52
|
+
function enableLineWrap() {
|
|
53
|
+
if (destroyed || lineWrapEnabled) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
write("\u001b[?7h");
|
|
57
|
+
lineWrapEnabled = true;
|
|
58
|
+
}
|
|
59
|
+
function hideCursor() {
|
|
60
|
+
if (destroyed || cursorHidden) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
write("\u001b[?25l");
|
|
64
|
+
cursorHidden = true;
|
|
65
|
+
}
|
|
66
|
+
function showCursor() {
|
|
67
|
+
if (destroyed || !cursorHidden) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
write("\u001b[?25h");
|
|
71
|
+
cursorHidden = false;
|
|
72
|
+
}
|
|
73
|
+
function moveTo(x, y) {
|
|
74
|
+
if (destroyed) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
write(cursorPositionAnsi(x, y));
|
|
78
|
+
}
|
|
79
|
+
function write(text) {
|
|
80
|
+
if (destroyed || text.length === 0) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
stdout.write(text);
|
|
84
|
+
}
|
|
85
|
+
function flush(changes) {
|
|
86
|
+
if (destroyed || changes.length === 0) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
let output = "";
|
|
90
|
+
for (const change of changes) {
|
|
91
|
+
output += `${cursorPositionAnsi(change.x, change.y)}${cellToAnsi(change.cell)}`;
|
|
92
|
+
}
|
|
93
|
+
write(output);
|
|
94
|
+
}
|
|
95
|
+
function getSize() {
|
|
96
|
+
return {
|
|
97
|
+
cols: normalizeSize(stdout.columns),
|
|
98
|
+
rows: normalizeSize(stdout.rows)
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function onResize(handler) {
|
|
102
|
+
if (destroyed) {
|
|
103
|
+
return () => { };
|
|
104
|
+
}
|
|
105
|
+
const listener = () => {
|
|
106
|
+
handler();
|
|
107
|
+
};
|
|
108
|
+
resizeListeners.add(listener);
|
|
109
|
+
stdout.on("resize", listener);
|
|
110
|
+
return () => {
|
|
111
|
+
if (!resizeListeners.delete(listener)) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
stdout.off("resize", listener);
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
function onKeypress(handler) {
|
|
118
|
+
if (destroyed) {
|
|
119
|
+
return () => { };
|
|
120
|
+
}
|
|
121
|
+
const listener = (str, key) => {
|
|
122
|
+
const event = toKeypressEvent(str, key);
|
|
123
|
+
if (event !== undefined) {
|
|
124
|
+
handler(event);
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
keypressListeners.add(listener);
|
|
128
|
+
stdin.on("keypress", listener);
|
|
129
|
+
return () => {
|
|
130
|
+
if (!keypressListeners.delete(listener)) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
stdin.off("keypress", listener);
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
function destroy() {
|
|
137
|
+
if (destroyed) {
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
for (const listener of keypressListeners) {
|
|
141
|
+
stdin.off("keypress", listener);
|
|
142
|
+
}
|
|
143
|
+
keypressListeners.clear();
|
|
144
|
+
for (const listener of resizeListeners) {
|
|
145
|
+
stdout.off("resize", listener);
|
|
146
|
+
}
|
|
147
|
+
resizeListeners.clear();
|
|
148
|
+
exitRawMode();
|
|
149
|
+
enableLineWrap();
|
|
150
|
+
exitAltScreen();
|
|
151
|
+
showCursor();
|
|
152
|
+
destroyed = true;
|
|
153
|
+
}
|
|
154
|
+
return {
|
|
155
|
+
enterRawMode,
|
|
156
|
+
exitRawMode,
|
|
157
|
+
enterAltScreen,
|
|
158
|
+
exitAltScreen,
|
|
159
|
+
disableLineWrap,
|
|
160
|
+
enableLineWrap,
|
|
161
|
+
hideCursor,
|
|
162
|
+
showCursor,
|
|
163
|
+
moveTo,
|
|
164
|
+
write,
|
|
165
|
+
flush,
|
|
166
|
+
getSize,
|
|
167
|
+
onResize,
|
|
168
|
+
onKeypress,
|
|
169
|
+
destroy
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
export function parseKeypress(data) {
|
|
173
|
+
if (data.length === 0) {
|
|
174
|
+
return undefined;
|
|
175
|
+
}
|
|
176
|
+
const stream = new PassThrough();
|
|
177
|
+
const stdin = stream;
|
|
178
|
+
let event;
|
|
179
|
+
readline.emitKeypressEvents(stdin);
|
|
180
|
+
stdin.on("keypress", (str, key) => {
|
|
181
|
+
event = toKeypressEvent(str, key);
|
|
182
|
+
});
|
|
183
|
+
stream.emit("data", data);
|
|
184
|
+
stream.destroy();
|
|
185
|
+
return event;
|
|
186
|
+
}
|
|
187
|
+
function toKeypressEvent(str, key) {
|
|
188
|
+
const controlCharacter = controlCharacterToKeypress(key?.sequence);
|
|
189
|
+
if (controlCharacter !== undefined) {
|
|
190
|
+
return controlCharacter;
|
|
191
|
+
}
|
|
192
|
+
const ctrl = key?.ctrl ?? false;
|
|
193
|
+
const meta = key?.meta ?? false;
|
|
194
|
+
const shift = key?.shift ?? false;
|
|
195
|
+
const ch = extractPrintableCharacter(str, key?.sequence);
|
|
196
|
+
if (ch !== undefined) {
|
|
197
|
+
return { ch, ctrl, meta, shift };
|
|
198
|
+
}
|
|
199
|
+
if (key?.name === undefined) {
|
|
200
|
+
return undefined;
|
|
201
|
+
}
|
|
202
|
+
return {
|
|
203
|
+
name: key.name,
|
|
204
|
+
ctrl,
|
|
205
|
+
meta,
|
|
206
|
+
shift
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
function extractPrintableCharacter(str, sequence) {
|
|
210
|
+
if (isPrintableCharacter(str)) {
|
|
211
|
+
return str;
|
|
212
|
+
}
|
|
213
|
+
if (isSinglePrintableSequence(sequence)) {
|
|
214
|
+
return sequence;
|
|
215
|
+
}
|
|
216
|
+
if (sequence === undefined || sequence.length <= 1 || sequence[0] !== "\u001b") {
|
|
217
|
+
return undefined;
|
|
218
|
+
}
|
|
219
|
+
const candidate = sequence.slice(1);
|
|
220
|
+
return isPrintableCharacter(candidate) ? candidate : undefined;
|
|
221
|
+
}
|
|
222
|
+
function isSinglePrintableSequence(value) {
|
|
223
|
+
if (value === undefined || Array.from(value).length !== 1) {
|
|
224
|
+
return false;
|
|
225
|
+
}
|
|
226
|
+
const codePoint = value.codePointAt(0);
|
|
227
|
+
return codePoint !== undefined && codePoint >= 0x20 && codePoint !== 0x7f;
|
|
228
|
+
}
|
|
229
|
+
function isPrintableCharacter(value) {
|
|
230
|
+
if (value === undefined || Array.from(value).length !== 1) {
|
|
231
|
+
return false;
|
|
232
|
+
}
|
|
233
|
+
const codePoint = value.codePointAt(0);
|
|
234
|
+
return codePoint !== undefined && codePoint >= 0x20 && codePoint !== 0x7f;
|
|
235
|
+
}
|
|
236
|
+
function controlCharacterToKeypress(sequence) {
|
|
237
|
+
if (sequence === "\u001f") {
|
|
238
|
+
return { ch: "/", ctrl: true, meta: false, shift: false };
|
|
239
|
+
}
|
|
240
|
+
if (sequence !== undefined && sequence.length === 1) {
|
|
241
|
+
const code = sequence.charCodeAt(0);
|
|
242
|
+
if (code >= 1 && code <= 26 && code !== 9 && code !== 10 && code !== 13) {
|
|
243
|
+
return {
|
|
244
|
+
name: String.fromCharCode(code + 96),
|
|
245
|
+
ctrl: true,
|
|
246
|
+
meta: false,
|
|
247
|
+
shift: false
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
return undefined;
|
|
252
|
+
}
|
|
253
|
+
function cursorPositionAnsi(x, y) {
|
|
254
|
+
return `\u001b[${normalizeCoordinate(y) + 1};${normalizeCoordinate(x) + 1}H`;
|
|
255
|
+
}
|
|
256
|
+
function normalizeCoordinate(value) {
|
|
257
|
+
return Math.max(0, Math.floor(value));
|
|
258
|
+
}
|
|
259
|
+
function normalizeSize(value) {
|
|
260
|
+
if (value === undefined || !Number.isFinite(value)) {
|
|
261
|
+
return 0;
|
|
262
|
+
}
|
|
263
|
+
return Math.max(0, Math.floor(value));
|
|
264
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export type OutputItemKind = "info" | "success" | "error" | "tool" | "status";
|
|
2
|
+
export type OutputItem = {
|
|
3
|
+
kind: OutputItemKind;
|
|
4
|
+
text: string;
|
|
5
|
+
ts: number;
|
|
6
|
+
};
|
|
7
|
+
export type DashboardStats = {
|
|
8
|
+
status: "idle" | "running" | "paused" | "done" | "error";
|
|
9
|
+
iterations: number;
|
|
10
|
+
iterationsLabel?: string;
|
|
11
|
+
tokensIn: number;
|
|
12
|
+
tokensOut: number;
|
|
13
|
+
elapsedMs: number;
|
|
14
|
+
currentAction?: string;
|
|
15
|
+
};
|
|
16
|
+
export type Command = "quit" | "forceQuit" | "edit" | "pause" | "retry" | "view-log";
|
|
17
|
+
export type DashboardState = {
|
|
18
|
+
output: OutputItem[];
|
|
19
|
+
stats: DashboardStats;
|
|
20
|
+
};
|
|
21
|
+
export type CellStyle = {
|
|
22
|
+
fg?: string;
|
|
23
|
+
bg?: string;
|
|
24
|
+
bold?: boolean;
|
|
25
|
+
dim?: boolean;
|
|
26
|
+
inverse?: boolean;
|
|
27
|
+
underline?: boolean;
|
|
28
|
+
};
|
|
29
|
+
export type Cell = {
|
|
30
|
+
ch: string;
|
|
31
|
+
style: CellStyle;
|
|
32
|
+
};
|
|
33
|
+
export type Rect = {
|
|
34
|
+
x: number;
|
|
35
|
+
y: number;
|
|
36
|
+
width: number;
|
|
37
|
+
height: number;
|
|
38
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ExplorerEvent } from "./events.js";
|
|
2
|
+
import type { Action, ActionContext, ExplorerState, Row, Tone } from "./state.js";
|
|
3
|
+
export type ActionSource = "row" | "detail";
|
|
4
|
+
type ExplorerKeypressEvent = Extract<ExplorerEvent, {
|
|
5
|
+
type: "key";
|
|
6
|
+
}>["key"];
|
|
7
|
+
export type ActionRuntimeHandles = {
|
|
8
|
+
refresh: () => Promise<void>;
|
|
9
|
+
suspendAnd: <T>(fn: () => Promise<T>) => Promise<T>;
|
|
10
|
+
toast: (msg: string, tone?: Tone) => void;
|
|
11
|
+
confirm: (prompt: string) => Promise<boolean>;
|
|
12
|
+
exit: (after?: () => void | Promise<void>) => void;
|
|
13
|
+
};
|
|
14
|
+
export declare function resolveAction<R>(state: ExplorerState, keyEvent: ExplorerKeypressEvent): Action<R> | null;
|
|
15
|
+
export declare function buildActionContext<R>(state: ExplorerState, _action: Action<R>, source: ActionSource, runtimeHandles: ActionRuntimeHandles, rowsOverride?: Row[]): ActionContext<R>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export function resolveAction(state, keyEvent) {
|
|
2
|
+
const target = state.bindings.resolve(keyEvent);
|
|
3
|
+
if (target?.type !== "action") {
|
|
4
|
+
return null;
|
|
5
|
+
}
|
|
6
|
+
const actionState = state.actionState.get(target.id);
|
|
7
|
+
if (actionState?.available !== true ||
|
|
8
|
+
actionState.running === true ||
|
|
9
|
+
actionState.action === undefined) {
|
|
10
|
+
return null;
|
|
11
|
+
}
|
|
12
|
+
return actionState.action;
|
|
13
|
+
}
|
|
14
|
+
export function buildActionContext(state, _action, source, runtimeHandles, rowsOverride) {
|
|
15
|
+
const row = rowsOverride?.[0] ?? currentRow(state) ?? { id: "", title: "" };
|
|
16
|
+
return {
|
|
17
|
+
row,
|
|
18
|
+
rows: rowsOverride ?? selectedRows(state, row),
|
|
19
|
+
item: source === "detail" ? currentDetailItem(state) : undefined,
|
|
20
|
+
filter: state.filter,
|
|
21
|
+
refresh: runtimeHandles.refresh,
|
|
22
|
+
suspendAnd: runtimeHandles.suspendAnd,
|
|
23
|
+
toast: runtimeHandles.toast,
|
|
24
|
+
confirm: runtimeHandles.confirm,
|
|
25
|
+
exit: runtimeHandles.exit
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function currentRow(state) {
|
|
29
|
+
return state.rows[state.filtered[state.cursor] ?? -1];
|
|
30
|
+
}
|
|
31
|
+
function currentDetailItem(state) {
|
|
32
|
+
return state.detail.items?.[state.detail.cursor];
|
|
33
|
+
}
|
|
34
|
+
function selectedRows(state, fallback) {
|
|
35
|
+
if (!state.multiSelect || state.selected.size === 0) {
|
|
36
|
+
return fallback.id === "" ? [] : [fallback];
|
|
37
|
+
}
|
|
38
|
+
return state.rows.filter((row) => state.selected.has(row.id));
|
|
39
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ExplorerConfig } from "./state.js";
|
|
2
|
+
type ExplorerDemoMode = "single-detail-mode" | "list-detail-mode";
|
|
3
|
+
export interface ExplorerDemoOptions {
|
|
4
|
+
mode: ExplorerDemoMode;
|
|
5
|
+
slowDetail: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface BuildExplorerDemoConfigOptions extends ExplorerDemoOptions {
|
|
8
|
+
onReorder?: (orderedIds: string[]) => void | Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
export declare function parseExplorerDemoOptions(argv?: string[], env?: NodeJS.ProcessEnv): ExplorerDemoOptions;
|
|
11
|
+
export declare function buildExplorerDemoConfig(options: BuildExplorerDemoConfigOptions): ExplorerConfig<void>;
|
|
12
|
+
export declare function main(): Promise<void>;
|
|
13
|
+
export {};
|