mu-harness 0.16.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/core/src/agent.d.ts +39 -0
- package/esm/core/src/agent.js +96 -0
- package/esm/core/src/index.d.ts +4 -0
- package/esm/core/src/index.js +2 -0
- package/esm/core/src/types.d.ts +59 -0
- package/esm/core/src/types.js +3 -0
- package/esm/harness/npm/src/_dnt.polyfills.d.ts +11 -0
- package/esm/harness/npm/src/_dnt.polyfills.js +15 -0
- package/esm/harness/npm/src/agents/index.d.ts +4 -0
- package/esm/harness/npm/src/agents/index.js +3 -0
- package/esm/harness/npm/src/agents/loader.d.ts +2 -0
- package/esm/harness/npm/src/agents/loader.js +24 -0
- package/esm/harness/npm/src/agents/parser.d.ts +2 -0
- package/esm/harness/npm/src/agents/parser.js +20 -0
- package/esm/harness/npm/src/agents/registry.d.ts +6 -0
- package/esm/harness/npm/src/agents/registry.js +31 -0
- package/esm/harness/npm/src/agents/types.d.ts +8 -0
- package/esm/harness/npm/src/agents/types.js +1 -0
- package/esm/harness/npm/src/channels/channel.d.ts +7 -0
- package/esm/harness/npm/src/channels/channel.js +25 -0
- package/esm/harness/npm/src/channels/index.d.ts +3 -0
- package/esm/harness/npm/src/channels/index.js +2 -0
- package/esm/harness/npm/src/channels/manager.d.ts +6 -0
- package/esm/harness/npm/src/channels/manager.js +28 -0
- package/esm/harness/npm/src/channels/types.d.ts +30 -0
- package/esm/harness/npm/src/channels/types.js +1 -0
- package/esm/harness/npm/src/commands/defaults.d.ts +9 -0
- package/esm/harness/npm/src/commands/defaults.js +53 -0
- package/esm/harness/npm/src/commands/index.d.ts +3 -0
- package/esm/harness/npm/src/commands/index.js +2 -0
- package/esm/harness/npm/src/commands/registry.d.ts +2 -0
- package/esm/harness/npm/src/commands/registry.js +59 -0
- package/esm/harness/npm/src/commands/types.d.ts +23 -0
- package/esm/harness/npm/src/commands/types.js +1 -0
- package/esm/harness/npm/src/common/frontmatter.d.ts +6 -0
- package/esm/harness/npm/src/common/frontmatter.js +18 -0
- package/esm/harness/npm/src/common/index.d.ts +2 -0
- package/esm/harness/npm/src/common/index.js +2 -0
- package/esm/harness/npm/src/common/utils.d.ts +5 -0
- package/esm/harness/npm/src/common/utils.js +13 -0
- package/esm/harness/npm/src/config/index.d.ts +2 -0
- package/esm/harness/npm/src/config/index.js +1 -0
- package/esm/harness/npm/src/config/resolve.d.ts +2 -0
- package/esm/harness/npm/src/config/resolve.js +10 -0
- package/esm/harness/npm/src/config/types.d.ts +15 -0
- package/esm/harness/npm/src/config/types.js +1 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_chars.d.ts +32 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_chars.js +48 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_dumper_state.d.ts +105 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_dumper_state.js +638 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_loader_state.d.ts +63 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_loader_state.js +1371 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_schema.d.ts +43 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_schema.js +117 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/binary.d.ts +2 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/binary.js +103 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/bool.d.ts +2 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/bool.js +32 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/float.d.ts +2 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/float.js +96 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/int.d.ts +2 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/int.js +159 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/map.d.ts +2 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/map.js +14 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/merge.d.ts +2 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/merge.js +10 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/nil.d.ts +2 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/nil.js +22 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/omap.d.ts +2 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/omap.js +29 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/pairs.d.ts +2 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/pairs.js +19 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/regexp.d.ts +2 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/regexp.js +30 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/seq.d.ts +2 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/seq.js +10 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/set.d.ts +2 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/set.js +14 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/str.d.ts +2 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/str.js +9 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/timestamp.d.ts +2 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/timestamp.js +81 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/undefined.d.ts +2 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/undefined.js +20 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type.d.ts +31 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type.js +6 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_utils.d.ts +3 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_utils.js +13 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/mod.d.ts +49 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/mod.js +52 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/parse.d.ts +75 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/parse.js +91 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/stringify.d.ts +99 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/stringify.js +33 -0
- package/esm/harness/npm/src/harness/create.d.ts +2 -0
- package/esm/harness/npm/src/harness/create.js +139 -0
- package/esm/harness/npm/src/harness/index.d.ts +3 -0
- package/esm/harness/npm/src/harness/index.js +2 -0
- package/esm/harness/npm/src/harness/models.d.ts +16 -0
- package/esm/harness/npm/src/harness/models.js +30 -0
- package/esm/harness/npm/src/harness/types.d.ts +35 -0
- package/esm/harness/npm/src/harness/types.js +1 -0
- package/esm/harness/npm/src/hooks/index.d.ts +3 -0
- package/esm/harness/npm/src/hooks/index.js +2 -0
- package/esm/harness/npm/src/hooks/merge-hooks.d.ts +2 -0
- package/esm/harness/npm/src/hooks/merge-hooks.js +42 -0
- package/esm/harness/npm/src/hooks/types.d.ts +20 -0
- package/esm/harness/npm/src/hooks/types.js +1 -0
- package/esm/harness/npm/src/hooks/with-hooks.d.ts +3 -0
- package/esm/harness/npm/src/hooks/with-hooks.js +12 -0
- package/esm/harness/npm/src/index.d.ts +15 -0
- package/esm/harness/npm/src/index.js +15 -0
- package/esm/harness/npm/src/permissions/allow-list.d.ts +4 -0
- package/esm/harness/npm/src/permissions/allow-list.js +8 -0
- package/esm/harness/npm/src/permissions/approval.d.ts +17 -0
- package/esm/harness/npm/src/permissions/approval.js +13 -0
- package/esm/harness/npm/src/permissions/glob.d.ts +1 -0
- package/esm/harness/npm/src/permissions/glob.js +2 -0
- package/esm/harness/npm/src/permissions/index.d.ts +3 -0
- package/esm/harness/npm/src/permissions/index.js +3 -0
- package/esm/harness/npm/src/plugin/define.d.ts +2 -0
- package/esm/harness/npm/src/plugin/define.js +1 -0
- package/esm/harness/npm/src/plugin/import-ts.d.ts +1 -0
- package/esm/harness/npm/src/plugin/import-ts.js +85 -0
- package/esm/harness/npm/src/plugin/index.d.ts +5 -0
- package/esm/harness/npm/src/plugin/index.js +4 -0
- package/esm/harness/npm/src/plugin/resolve.d.ts +13 -0
- package/esm/harness/npm/src/plugin/resolve.js +17 -0
- package/esm/harness/npm/src/plugin/store.d.ts +8 -0
- package/esm/harness/npm/src/plugin/store.js +26 -0
- package/esm/harness/npm/src/plugin/types.d.ts +11 -0
- package/esm/harness/npm/src/plugin/types.js +1 -0
- package/esm/harness/npm/src/scheduler/command.d.ts +3 -0
- package/esm/harness/npm/src/scheduler/command.js +19 -0
- package/esm/harness/npm/src/scheduler/engine/index.d.ts +3 -0
- package/esm/harness/npm/src/scheduler/engine/index.js +2 -0
- package/esm/harness/npm/src/scheduler/engine/scheduler.d.ts +12 -0
- package/esm/harness/npm/src/scheduler/engine/scheduler.js +65 -0
- package/esm/harness/npm/src/scheduler/engine/store.d.ts +4 -0
- package/esm/harness/npm/src/scheduler/engine/store.js +55 -0
- package/esm/harness/npm/src/scheduler/engine/types.d.ts +37 -0
- package/esm/harness/npm/src/scheduler/engine/types.js +1 -0
- package/esm/harness/npm/src/scheduler/index.d.ts +4 -0
- package/esm/harness/npm/src/scheduler/index.js +3 -0
- package/esm/harness/npm/src/scheduler/tool.d.ts +8 -0
- package/esm/harness/npm/src/scheduler/tool.js +49 -0
- package/esm/harness/npm/src/session/agent-session.d.ts +15 -0
- package/esm/harness/npm/src/session/agent-session.js +82 -0
- package/esm/harness/npm/src/session/catalog.d.ts +24 -0
- package/esm/harness/npm/src/session/catalog.js +55 -0
- package/esm/harness/npm/src/session/index.d.ts +7 -0
- package/esm/harness/npm/src/session/index.js +6 -0
- package/esm/harness/npm/src/session/manager.d.ts +39 -0
- package/esm/harness/npm/src/session/manager.js +62 -0
- package/esm/harness/npm/src/session/persist.d.ts +3 -0
- package/esm/harness/npm/src/session/persist.js +21 -0
- package/esm/harness/npm/src/session/store.d.ts +13 -0
- package/esm/harness/npm/src/session/store.js +24 -0
- package/esm/harness/npm/src/session/title.d.ts +9 -0
- package/esm/harness/npm/src/session/title.js +24 -0
- package/esm/harness/npm/src/session/types.d.ts +17 -0
- package/esm/harness/npm/src/session/types.js +1 -0
- package/esm/harness/npm/src/skills/index.d.ts +7 -0
- package/esm/harness/npm/src/skills/index.js +6 -0
- package/esm/harness/npm/src/skills/loader.d.ts +2 -0
- package/esm/harness/npm/src/skills/loader.js +26 -0
- package/esm/harness/npm/src/skills/parser.d.ts +2 -0
- package/esm/harness/npm/src/skills/parser.js +10 -0
- package/esm/harness/npm/src/skills/registry.d.ts +8 -0
- package/esm/harness/npm/src/skills/registry.js +16 -0
- package/esm/harness/npm/src/skills/run.d.ts +14 -0
- package/esm/harness/npm/src/skills/run.js +45 -0
- package/esm/harness/npm/src/skills/tool.d.ts +3 -0
- package/esm/harness/npm/src/skills/tool.js +31 -0
- package/esm/harness/npm/src/skills/types.d.ts +6 -0
- package/esm/harness/npm/src/skills/types.js +1 -0
- package/esm/harness/npm/src/skills/writer.d.ts +7 -0
- package/esm/harness/npm/src/skills/writer.js +43 -0
- package/esm/harness/npm/src/subAgents/index.d.ts +4 -0
- package/esm/harness/npm/src/subAgents/index.js +3 -0
- package/esm/harness/npm/src/subAgents/registry.d.ts +2 -0
- package/esm/harness/npm/src/subAgents/registry.js +18 -0
- package/esm/harness/npm/src/subAgents/runner.d.ts +15 -0
- package/esm/harness/npm/src/subAgents/runner.js +33 -0
- package/esm/harness/npm/src/subAgents/tool.d.ts +6 -0
- package/esm/harness/npm/src/subAgents/tool.js +30 -0
- package/esm/harness/npm/src/subAgents/types.d.ts +18 -0
- package/esm/harness/npm/src/subAgents/types.js +1 -0
- package/esm/harness/npm/src/tui/channel.d.ts +3 -0
- package/esm/harness/npm/src/tui/channel.js +53 -0
- package/esm/harness/npm/src/tui/components/composer.d.ts +3 -0
- package/esm/harness/npm/src/tui/components/composer.js +13 -0
- package/esm/harness/npm/src/tui/components/header.d.ts +3 -0
- package/esm/harness/npm/src/tui/components/header.js +1 -0
- package/esm/harness/npm/src/tui/components/index.d.ts +5 -0
- package/esm/harness/npm/src/tui/components/index.js +5 -0
- package/esm/harness/npm/src/tui/components/message.d.ts +6 -0
- package/esm/harness/npm/src/tui/components/message.js +26 -0
- package/esm/harness/npm/src/tui/components/status.d.ts +3 -0
- package/esm/harness/npm/src/tui/components/status.js +8 -0
- package/esm/harness/npm/src/tui/components/transcript.d.ts +4 -0
- package/esm/harness/npm/src/tui/components/transcript.js +4 -0
- package/esm/harness/npm/src/tui/index.d.ts +7 -0
- package/esm/harness/npm/src/tui/index.js +10 -0
- package/esm/harness/npm/src/tui/kit.d.ts +15 -0
- package/esm/harness/npm/src/tui/kit.js +7 -0
- package/esm/harness/npm/src/tui/types.d.ts +38 -0
- package/esm/harness/npm/src/tui/types.js +1 -0
- package/esm/package.json +3 -0
- package/esm/tui/src/capabilities.d.ts +72 -0
- package/esm/tui/src/capabilities.js +90 -0
- package/esm/tui/src/components/command-palette.d.ts +24 -0
- package/esm/tui/src/components/command-palette.js +60 -0
- package/esm/tui/src/components/editor.d.ts +26 -0
- package/esm/tui/src/components/editor.js +111 -0
- package/esm/tui/src/components/scroll-view.d.ts +14 -0
- package/esm/tui/src/components/scroll-view.js +45 -0
- package/esm/tui/src/components/select-list.d.ts +24 -0
- package/esm/tui/src/components/select-list.js +69 -0
- package/esm/tui/src/events.d.ts +56 -0
- package/esm/tui/src/events.js +6 -0
- package/esm/tui/src/index.d.ts +17 -0
- package/esm/tui/src/index.js +13 -0
- package/esm/tui/src/inputRouter.d.ts +28 -0
- package/esm/tui/src/inputRouter.js +122 -0
- package/esm/tui/src/keybinds.d.ts +13 -0
- package/esm/tui/src/keybinds.js +15 -0
- package/esm/tui/src/keyboard.d.ts +2 -0
- package/esm/tui/src/keyboard.js +305 -0
- package/esm/tui/src/layout/ansi.d.ts +3 -0
- package/esm/tui/src/layout/ansi.js +323 -0
- package/esm/tui/src/layout/cell.d.ts +24 -0
- package/esm/tui/src/layout/cell.js +46 -0
- package/esm/tui/src/layout/cellbuffer.d.ts +29 -0
- package/esm/tui/src/layout/cellbuffer.js +306 -0
- package/esm/tui/src/layout/color.d.ts +22 -0
- package/esm/tui/src/layout/color.js +163 -0
- package/esm/tui/src/layout/insets.d.ts +8 -0
- package/esm/tui/src/layout/insets.js +55 -0
- package/esm/tui/src/layout/types.d.ts +33 -0
- package/esm/tui/src/layout/types.js +8 -0
- package/esm/tui/src/parser.d.ts +18 -0
- package/esm/tui/src/parser.js +136 -0
- package/esm/tui/src/renderer.d.ts +32 -0
- package/esm/tui/src/renderer.js +168 -0
- package/esm/tui/src/surface.d.ts +27 -0
- package/esm/tui/src/surface.js +110 -0
- package/esm/tui/src/terminal.d.ts +48 -0
- package/esm/tui/src/terminal.js +255 -0
- package/esm/tui/src/tui.d.ts +60 -0
- package/esm/tui/src/tui.js +194 -0
- package/esm/tui/src/types/terminal.d.ts +20 -0
- package/esm/tui/src/types/terminal.js +1 -0
- package/esm/tui/src/utils.d.ts +6 -0
- package/esm/tui/src/utils.js +292 -0
- package/esm/tui/src/views.d.ts +35 -0
- package/esm/tui/src/views.js +112 -0
- package/package.json +23 -0
- package/script/core/src/agent.d.ts +39 -0
- package/script/core/src/agent.js +101 -0
- package/script/core/src/index.d.ts +4 -0
- package/script/core/src/index.js +10 -0
- package/script/core/src/types.d.ts +59 -0
- package/script/core/src/types.js +9 -0
- package/script/harness/npm/src/_dnt.polyfills.d.ts +11 -0
- package/script/harness/npm/src/_dnt.polyfills.js +16 -0
- package/script/harness/npm/src/agents/index.d.ts +4 -0
- package/script/harness/npm/src/agents/index.js +9 -0
- package/script/harness/npm/src/agents/loader.d.ts +2 -0
- package/script/harness/npm/src/agents/loader.js +28 -0
- package/script/harness/npm/src/agents/parser.d.ts +2 -0
- package/script/harness/npm/src/agents/parser.js +24 -0
- package/script/harness/npm/src/agents/registry.d.ts +6 -0
- package/script/harness/npm/src/agents/registry.js +35 -0
- package/script/harness/npm/src/agents/types.d.ts +8 -0
- package/script/harness/npm/src/agents/types.js +2 -0
- package/script/harness/npm/src/channels/channel.d.ts +7 -0
- package/script/harness/npm/src/channels/channel.js +29 -0
- package/script/harness/npm/src/channels/index.d.ts +3 -0
- package/script/harness/npm/src/channels/index.js +7 -0
- package/script/harness/npm/src/channels/manager.d.ts +6 -0
- package/script/harness/npm/src/channels/manager.js +32 -0
- package/script/harness/npm/src/channels/types.d.ts +30 -0
- package/script/harness/npm/src/channels/types.js +2 -0
- package/script/harness/npm/src/commands/defaults.d.ts +9 -0
- package/script/harness/npm/src/commands/defaults.js +61 -0
- package/script/harness/npm/src/commands/index.d.ts +3 -0
- package/script/harness/npm/src/commands/index.js +11 -0
- package/script/harness/npm/src/commands/registry.d.ts +2 -0
- package/script/harness/npm/src/commands/registry.js +63 -0
- package/script/harness/npm/src/commands/types.d.ts +23 -0
- package/script/harness/npm/src/commands/types.js +2 -0
- package/script/harness/npm/src/common/frontmatter.d.ts +6 -0
- package/script/harness/npm/src/common/frontmatter.js +23 -0
- package/script/harness/npm/src/common/index.d.ts +2 -0
- package/script/harness/npm/src/common/index.js +8 -0
- package/script/harness/npm/src/common/utils.d.ts +5 -0
- package/script/harness/npm/src/common/utils.js +17 -0
- package/script/harness/npm/src/config/index.d.ts +2 -0
- package/script/harness/npm/src/config/index.js +5 -0
- package/script/harness/npm/src/config/resolve.d.ts +2 -0
- package/script/harness/npm/src/config/resolve.js +14 -0
- package/script/harness/npm/src/config/types.d.ts +15 -0
- package/script/harness/npm/src/config/types.js +2 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_chars.d.ts +32 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_chars.js +55 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_dumper_state.d.ts +105 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_dumper_state.js +642 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_loader_state.d.ts +63 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_loader_state.js +1375 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_schema.d.ts +43 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_schema.js +121 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/binary.d.ts +2 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/binary.js +106 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/bool.d.ts +2 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/bool.js +35 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/float.d.ts +2 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/float.js +99 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/int.d.ts +2 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/int.js +162 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/map.d.ts +2 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/map.js +17 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/merge.d.ts +2 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/merge.js +13 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/nil.d.ts +2 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/nil.js +25 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/omap.d.ts +2 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/omap.js +32 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/pairs.d.ts +2 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/pairs.js +22 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/regexp.d.ts +2 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/regexp.js +33 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/seq.d.ts +2 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/seq.js +13 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/set.d.ts +2 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/set.js +17 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/str.d.ts +2 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/str.js +12 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/timestamp.d.ts +2 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/timestamp.js +84 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/undefined.d.ts +2 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/undefined.js +23 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type.d.ts +31 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type.js +7 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_utils.d.ts +3 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_utils.js +18 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/mod.d.ts +49 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/mod.js +68 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/parse.d.ts +75 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/parse.js +95 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/stringify.d.ts +99 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/stringify.js +36 -0
- package/script/harness/npm/src/harness/create.d.ts +2 -0
- package/script/harness/npm/src/harness/create.js +146 -0
- package/script/harness/npm/src/harness/index.d.ts +3 -0
- package/script/harness/npm/src/harness/index.js +7 -0
- package/script/harness/npm/src/harness/models.d.ts +16 -0
- package/script/harness/npm/src/harness/models.js +34 -0
- package/script/harness/npm/src/harness/types.d.ts +35 -0
- package/script/harness/npm/src/harness/types.js +2 -0
- package/script/harness/npm/src/hooks/index.d.ts +3 -0
- package/script/harness/npm/src/hooks/index.js +7 -0
- package/script/harness/npm/src/hooks/merge-hooks.d.ts +2 -0
- package/script/harness/npm/src/hooks/merge-hooks.js +46 -0
- package/script/harness/npm/src/hooks/types.d.ts +20 -0
- package/script/harness/npm/src/hooks/types.js +2 -0
- package/script/harness/npm/src/hooks/with-hooks.d.ts +3 -0
- package/script/harness/npm/src/hooks/with-hooks.js +16 -0
- package/script/harness/npm/src/index.d.ts +15 -0
- package/script/harness/npm/src/index.js +31 -0
- package/script/harness/npm/src/permissions/allow-list.d.ts +4 -0
- package/script/harness/npm/src/permissions/allow-list.js +13 -0
- package/script/harness/npm/src/permissions/approval.d.ts +17 -0
- package/script/harness/npm/src/permissions/approval.js +17 -0
- package/script/harness/npm/src/permissions/glob.d.ts +1 -0
- package/script/harness/npm/src/permissions/glob.js +6 -0
- package/script/harness/npm/src/permissions/index.d.ts +3 -0
- package/script/harness/npm/src/permissions/index.js +10 -0
- package/script/harness/npm/src/plugin/define.d.ts +2 -0
- package/script/harness/npm/src/plugin/define.js +5 -0
- package/script/harness/npm/src/plugin/import-ts.d.ts +1 -0
- package/script/harness/npm/src/plugin/import-ts.js +122 -0
- package/script/harness/npm/src/plugin/index.d.ts +5 -0
- package/script/harness/npm/src/plugin/index.js +11 -0
- package/script/harness/npm/src/plugin/resolve.d.ts +13 -0
- package/script/harness/npm/src/plugin/resolve.js +21 -0
- package/script/harness/npm/src/plugin/store.d.ts +8 -0
- package/script/harness/npm/src/plugin/store.js +30 -0
- package/script/harness/npm/src/plugin/types.d.ts +11 -0
- package/script/harness/npm/src/plugin/types.js +2 -0
- package/script/harness/npm/src/scheduler/command.d.ts +3 -0
- package/script/harness/npm/src/scheduler/command.js +23 -0
- package/script/harness/npm/src/scheduler/engine/index.d.ts +3 -0
- package/script/harness/npm/src/scheduler/engine/index.js +7 -0
- package/script/harness/npm/src/scheduler/engine/scheduler.d.ts +12 -0
- package/script/harness/npm/src/scheduler/engine/scheduler.js +69 -0
- package/script/harness/npm/src/scheduler/engine/store.d.ts +4 -0
- package/script/harness/npm/src/scheduler/engine/store.js +59 -0
- package/script/harness/npm/src/scheduler/engine/types.d.ts +37 -0
- package/script/harness/npm/src/scheduler/engine/types.js +2 -0
- package/script/harness/npm/src/scheduler/index.d.ts +4 -0
- package/script/harness/npm/src/scheduler/index.js +10 -0
- package/script/harness/npm/src/scheduler/tool.d.ts +8 -0
- package/script/harness/npm/src/scheduler/tool.js +53 -0
- package/script/harness/npm/src/session/agent-session.d.ts +15 -0
- package/script/harness/npm/src/session/agent-session.js +86 -0
- package/script/harness/npm/src/session/catalog.d.ts +24 -0
- package/script/harness/npm/src/session/catalog.js +59 -0
- package/script/harness/npm/src/session/index.d.ts +7 -0
- package/script/harness/npm/src/session/index.js +17 -0
- package/script/harness/npm/src/session/manager.d.ts +39 -0
- package/script/harness/npm/src/session/manager.js +66 -0
- package/script/harness/npm/src/session/persist.d.ts +3 -0
- package/script/harness/npm/src/session/persist.js +25 -0
- package/script/harness/npm/src/session/store.d.ts +13 -0
- package/script/harness/npm/src/session/store.js +28 -0
- package/script/harness/npm/src/session/title.d.ts +9 -0
- package/script/harness/npm/src/session/title.js +30 -0
- package/script/harness/npm/src/session/types.d.ts +17 -0
- package/script/harness/npm/src/session/types.js +2 -0
- package/script/harness/npm/src/skills/index.d.ts +7 -0
- package/script/harness/npm/src/skills/index.js +16 -0
- package/script/harness/npm/src/skills/loader.d.ts +2 -0
- package/script/harness/npm/src/skills/loader.js +30 -0
- package/script/harness/npm/src/skills/parser.d.ts +2 -0
- package/script/harness/npm/src/skills/parser.js +14 -0
- package/script/harness/npm/src/skills/registry.d.ts +8 -0
- package/script/harness/npm/src/skills/registry.js +20 -0
- package/script/harness/npm/src/skills/run.d.ts +14 -0
- package/script/harness/npm/src/skills/run.js +50 -0
- package/script/harness/npm/src/skills/tool.d.ts +3 -0
- package/script/harness/npm/src/skills/tool.js +35 -0
- package/script/harness/npm/src/skills/types.d.ts +6 -0
- package/script/harness/npm/src/skills/types.js +2 -0
- package/script/harness/npm/src/skills/writer.d.ts +7 -0
- package/script/harness/npm/src/skills/writer.js +47 -0
- package/script/harness/npm/src/subAgents/index.d.ts +4 -0
- package/script/harness/npm/src/subAgents/index.js +9 -0
- package/script/harness/npm/src/subAgents/registry.d.ts +2 -0
- package/script/harness/npm/src/subAgents/registry.js +22 -0
- package/script/harness/npm/src/subAgents/runner.d.ts +15 -0
- package/script/harness/npm/src/subAgents/runner.js +37 -0
- package/script/harness/npm/src/subAgents/tool.d.ts +6 -0
- package/script/harness/npm/src/subAgents/tool.js +34 -0
- package/script/harness/npm/src/subAgents/types.d.ts +18 -0
- package/script/harness/npm/src/subAgents/types.js +2 -0
- package/script/harness/npm/src/tui/channel.d.ts +3 -0
- package/script/harness/npm/src/tui/channel.js +57 -0
- package/script/harness/npm/src/tui/components/composer.d.ts +3 -0
- package/script/harness/npm/src/tui/components/composer.js +17 -0
- package/script/harness/npm/src/tui/components/header.d.ts +3 -0
- package/script/harness/npm/src/tui/components/header.js +5 -0
- package/script/harness/npm/src/tui/components/index.d.ts +5 -0
- package/script/harness/npm/src/tui/components/index.js +16 -0
- package/script/harness/npm/src/tui/components/message.d.ts +6 -0
- package/script/harness/npm/src/tui/components/message.js +32 -0
- package/script/harness/npm/src/tui/components/status.d.ts +3 -0
- package/script/harness/npm/src/tui/components/status.js +12 -0
- package/script/harness/npm/src/tui/components/transcript.d.ts +4 -0
- package/script/harness/npm/src/tui/components/transcript.js +9 -0
- package/script/harness/npm/src/tui/index.d.ts +7 -0
- package/script/harness/npm/src/tui/index.js +29 -0
- package/script/harness/npm/src/tui/kit.d.ts +15 -0
- package/script/harness/npm/src/tui/kit.js +10 -0
- package/script/harness/npm/src/tui/types.d.ts +38 -0
- package/script/harness/npm/src/tui/types.js +2 -0
- package/script/package.json +3 -0
- package/script/tui/src/capabilities.d.ts +72 -0
- package/script/tui/src/capabilities.js +98 -0
- package/script/tui/src/components/command-palette.d.ts +24 -0
- package/script/tui/src/components/command-palette.js +65 -0
- package/script/tui/src/components/editor.d.ts +26 -0
- package/script/tui/src/components/editor.js +116 -0
- package/script/tui/src/components/scroll-view.d.ts +14 -0
- package/script/tui/src/components/scroll-view.js +50 -0
- package/script/tui/src/components/select-list.d.ts +24 -0
- package/script/tui/src/components/select-list.js +74 -0
- package/script/tui/src/events.d.ts +56 -0
- package/script/tui/src/events.js +9 -0
- package/script/tui/src/index.d.ts +17 -0
- package/script/tui/src/index.js +46 -0
- package/script/tui/src/inputRouter.d.ts +28 -0
- package/script/tui/src/inputRouter.js +126 -0
- package/script/tui/src/keybinds.d.ts +13 -0
- package/script/tui/src/keybinds.js +18 -0
- package/script/tui/src/keyboard.d.ts +2 -0
- package/script/tui/src/keyboard.js +308 -0
- package/script/tui/src/layout/ansi.d.ts +3 -0
- package/script/tui/src/layout/ansi.js +327 -0
- package/script/tui/src/layout/cell.d.ts +24 -0
- package/script/tui/src/layout/cell.js +54 -0
- package/script/tui/src/layout/cellbuffer.d.ts +29 -0
- package/script/tui/src/layout/cellbuffer.js +321 -0
- package/script/tui/src/layout/color.d.ts +22 -0
- package/script/tui/src/layout/color.js +174 -0
- package/script/tui/src/layout/insets.d.ts +8 -0
- package/script/tui/src/layout/insets.js +64 -0
- package/script/tui/src/layout/types.d.ts +33 -0
- package/script/tui/src/layout/types.js +11 -0
- package/script/tui/src/parser.d.ts +18 -0
- package/script/tui/src/parser.js +140 -0
- package/script/tui/src/renderer.d.ts +32 -0
- package/script/tui/src/renderer.js +175 -0
- package/script/tui/src/surface.d.ts +27 -0
- package/script/tui/src/surface.js +115 -0
- package/script/tui/src/terminal.d.ts +48 -0
- package/script/tui/src/terminal.js +262 -0
- package/script/tui/src/tui.d.ts +60 -0
- package/script/tui/src/tui.js +198 -0
- package/script/tui/src/types/terminal.d.ts +20 -0
- package/script/tui/src/types/terminal.js +2 -0
- package/script/tui/src/utils.d.ts +6 -0
- package/script/tui/src/utils.js +300 -0
- package/script/tui/src/views.d.ts +35 -0
- package/script/tui/src/views.js +123 -0
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import process from 'node:process';
|
|
2
|
+
import { createDefaultCapabilities, mergeCapabilities, } from './capabilities';
|
|
3
|
+
async function drainStdin(opts) {
|
|
4
|
+
const maxMs = opts?.maxMs ?? 200;
|
|
5
|
+
const idleMs = opts?.idleMs ?? 30;
|
|
6
|
+
let lastDataTime = Date.now();
|
|
7
|
+
const onData = () => {
|
|
8
|
+
lastDataTime = Date.now();
|
|
9
|
+
};
|
|
10
|
+
process.stdin.on('data', onData);
|
|
11
|
+
const endTime = Date.now() + maxMs;
|
|
12
|
+
try {
|
|
13
|
+
while (true) {
|
|
14
|
+
const now = Date.now();
|
|
15
|
+
if (now - endTime >= 0)
|
|
16
|
+
break;
|
|
17
|
+
if (now - lastDataTime >= idleMs)
|
|
18
|
+
break;
|
|
19
|
+
await new Promise((resolve) => setTimeout(resolve, Math.min(idleMs, endTime - now)));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
finally {
|
|
23
|
+
process.stdin.removeListener('data', onData);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const MODE_ENABLE = {
|
|
27
|
+
alternateScreen: '\x1b[?1049h',
|
|
28
|
+
bracketedPaste: '\x1b[?2004h',
|
|
29
|
+
focusEvents: '\x1b[?1004h',
|
|
30
|
+
sgrMouse: '\x1b[?1006h',
|
|
31
|
+
mouseDrag: '\x1b[?1002h',
|
|
32
|
+
mouseMotion: '\x1b[?1003h',
|
|
33
|
+
pixelMouse: '\x1b[?1016h',
|
|
34
|
+
synchronizedOutput: '\x1b[?2026h',
|
|
35
|
+
kittyKeyboard: '\x1b[>1u',
|
|
36
|
+
modifyOtherKeys: '\x1b[>4;2m',
|
|
37
|
+
};
|
|
38
|
+
const MODE_DISABLE = {
|
|
39
|
+
alternateScreen: '\x1b[?1049l',
|
|
40
|
+
bracketedPaste: '\x1b[?2004l',
|
|
41
|
+
focusEvents: '\x1b[?1004l',
|
|
42
|
+
sgrMouse: '\x1b[?1006l',
|
|
43
|
+
mouseDrag: '\x1b[?1002l',
|
|
44
|
+
mouseMotion: '\x1b[?1003l',
|
|
45
|
+
pixelMouse: '\x1b[?1016l',
|
|
46
|
+
synchronizedOutput: '\x1b[?2026l',
|
|
47
|
+
kittyKeyboard: '\x1b[<u',
|
|
48
|
+
modifyOtherKeys: '\x1b[>4;0m',
|
|
49
|
+
};
|
|
50
|
+
export class ProcessTerminal {
|
|
51
|
+
options;
|
|
52
|
+
_columns;
|
|
53
|
+
_rows;
|
|
54
|
+
onData = null;
|
|
55
|
+
onResize = null;
|
|
56
|
+
cleanupHandlers = [];
|
|
57
|
+
stdinDataHandler = null;
|
|
58
|
+
stdoutResizeHandler = null;
|
|
59
|
+
started = false;
|
|
60
|
+
enabledModes = [];
|
|
61
|
+
capabilities;
|
|
62
|
+
constructor(options = {}) {
|
|
63
|
+
this.options = options;
|
|
64
|
+
this._columns = process.stdout.columns || 80;
|
|
65
|
+
this._rows = process.stdout.rows || 24;
|
|
66
|
+
this.capabilities = mergeCapabilities(createDefaultCapabilities(), options.capabilities);
|
|
67
|
+
}
|
|
68
|
+
get columns() {
|
|
69
|
+
return this._columns;
|
|
70
|
+
}
|
|
71
|
+
get rows() {
|
|
72
|
+
return this._rows;
|
|
73
|
+
}
|
|
74
|
+
write(data) {
|
|
75
|
+
if (process.stdout.isTTY) {
|
|
76
|
+
process.stdout.write(data);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
hideCursor() {
|
|
80
|
+
this.write('\x1b[?25l');
|
|
81
|
+
}
|
|
82
|
+
showCursor() {
|
|
83
|
+
this.write('\x1b[?25h');
|
|
84
|
+
}
|
|
85
|
+
clearScreen() {
|
|
86
|
+
this.write('\x1b[2J\x1b[H');
|
|
87
|
+
}
|
|
88
|
+
clearLine() {
|
|
89
|
+
this.write('\x1b[2K');
|
|
90
|
+
}
|
|
91
|
+
clearFromCursor() {
|
|
92
|
+
this.write('\x1b[0J');
|
|
93
|
+
}
|
|
94
|
+
moveBy(lines) {
|
|
95
|
+
if (lines > 0) {
|
|
96
|
+
this.write(`\x1b[${lines}B`);
|
|
97
|
+
}
|
|
98
|
+
else if (lines < 0) {
|
|
99
|
+
this.write(`\x1b[${-lines}A`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
enableMode(mode) {
|
|
103
|
+
if (!process.stdout.isTTY || this.enabledModes.includes(mode))
|
|
104
|
+
return;
|
|
105
|
+
this.write(MODE_ENABLE[mode]);
|
|
106
|
+
this.enabledModes.push(mode);
|
|
107
|
+
}
|
|
108
|
+
disableMode(mode) {
|
|
109
|
+
const index = this.enabledModes.lastIndexOf(mode);
|
|
110
|
+
if (index === -1)
|
|
111
|
+
return;
|
|
112
|
+
this.write(MODE_DISABLE[mode]);
|
|
113
|
+
this.enabledModes.splice(index, 1);
|
|
114
|
+
}
|
|
115
|
+
enableMouse() {
|
|
116
|
+
this.enableMode('sgrMouse');
|
|
117
|
+
this.enableMode('mouseDrag');
|
|
118
|
+
}
|
|
119
|
+
disableMouse() {
|
|
120
|
+
this.disableMode('pixelMouse');
|
|
121
|
+
this.disableMode('mouseMotion');
|
|
122
|
+
this.disableMode('mouseDrag');
|
|
123
|
+
this.disableMode('sgrMouse');
|
|
124
|
+
}
|
|
125
|
+
start(onInput, onResize) {
|
|
126
|
+
if (this.started || !(process.stdin.isTTY && process.stdout.isTTY)) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
this.started = true;
|
|
130
|
+
this.onData = onInput;
|
|
131
|
+
this.onResize = onResize;
|
|
132
|
+
process.stdin.setRawMode(true);
|
|
133
|
+
process.stdin.resume();
|
|
134
|
+
process.stdin.setEncoding('utf8');
|
|
135
|
+
this.stdinDataHandler = (chunk) => {
|
|
136
|
+
this.onData?.(chunk);
|
|
137
|
+
};
|
|
138
|
+
process.stdin.on('data', this.stdinDataHandler);
|
|
139
|
+
this.stdoutResizeHandler = () => {
|
|
140
|
+
this._columns = process.stdout.columns || 80;
|
|
141
|
+
this._rows = process.stdout.rows || 24;
|
|
142
|
+
this.onResize?.();
|
|
143
|
+
};
|
|
144
|
+
process.stdout.on('resize', this.stdoutResizeHandler);
|
|
145
|
+
this._columns = process.stdout.columns || 80;
|
|
146
|
+
this._rows = process.stdout.rows || 24;
|
|
147
|
+
const handleSigInt = () => {
|
|
148
|
+
this.stop();
|
|
149
|
+
if (process.pid)
|
|
150
|
+
process.kill(process.pid, 'SIGINT');
|
|
151
|
+
};
|
|
152
|
+
process.once('SIGINT', handleSigInt);
|
|
153
|
+
this.cleanupHandlers.push(() => process.removeListener('SIGINT', handleSigInt));
|
|
154
|
+
const handleSigTerm = () => {
|
|
155
|
+
this.stop();
|
|
156
|
+
if (process.pid)
|
|
157
|
+
process.kill(process.pid, 'SIGTERM');
|
|
158
|
+
};
|
|
159
|
+
process.once('SIGTERM', handleSigTerm);
|
|
160
|
+
this.cleanupHandlers.push(() => process.removeListener('SIGTERM', handleSigTerm));
|
|
161
|
+
const handleSigHup = () => {
|
|
162
|
+
this.stop();
|
|
163
|
+
if (process.pid)
|
|
164
|
+
process.kill(process.pid, 'SIGHUP');
|
|
165
|
+
};
|
|
166
|
+
process.once('SIGHUP', handleSigHup);
|
|
167
|
+
this.cleanupHandlers.push(() => process.removeListener('SIGHUP', handleSigHup));
|
|
168
|
+
const handleExit = () => {
|
|
169
|
+
this.stopNow();
|
|
170
|
+
};
|
|
171
|
+
process.once('exit', handleExit);
|
|
172
|
+
this.cleanupHandlers.push(() => process.removeListener('exit', handleExit));
|
|
173
|
+
this.applyStartupModes();
|
|
174
|
+
this.hideCursor();
|
|
175
|
+
}
|
|
176
|
+
stop() {
|
|
177
|
+
if (!this.started)
|
|
178
|
+
return;
|
|
179
|
+
this.started = false;
|
|
180
|
+
this.write('\x1b[?2026l');
|
|
181
|
+
this.restoreModes();
|
|
182
|
+
this.write('\x1b[0m\x1b]8;;\x07');
|
|
183
|
+
this.showCursor();
|
|
184
|
+
if (this.stdinDataHandler) {
|
|
185
|
+
process.stdin.removeListener('data', this.stdinDataHandler);
|
|
186
|
+
this.stdinDataHandler = null;
|
|
187
|
+
}
|
|
188
|
+
if (this.stdoutResizeHandler) {
|
|
189
|
+
process.stdout.removeListener('resize', this.stdoutResizeHandler);
|
|
190
|
+
this.stdoutResizeHandler = null;
|
|
191
|
+
}
|
|
192
|
+
void this.restoreInputAfterDrain();
|
|
193
|
+
this.onData = null;
|
|
194
|
+
this.onResize = null;
|
|
195
|
+
for (const cleanup of this.cleanupHandlers) {
|
|
196
|
+
try {
|
|
197
|
+
cleanup();
|
|
198
|
+
}
|
|
199
|
+
catch {
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
this.cleanupHandlers.length = 0;
|
|
203
|
+
}
|
|
204
|
+
applyStartupModes() {
|
|
205
|
+
if (this.options.alternateScreen)
|
|
206
|
+
this.enableMode('alternateScreen');
|
|
207
|
+
if (this.options.bracketedPaste)
|
|
208
|
+
this.enableMode('bracketedPaste');
|
|
209
|
+
if (this.options.focusEvents)
|
|
210
|
+
this.enableMode('focusEvents');
|
|
211
|
+
if (this.options.keyboard) {
|
|
212
|
+
this.enableMode('kittyKeyboard');
|
|
213
|
+
this.enableMode('modifyOtherKeys');
|
|
214
|
+
}
|
|
215
|
+
if (this.options.mouse) {
|
|
216
|
+
this.enableMode('sgrMouse');
|
|
217
|
+
if (this.options.mouse === true || this.options.mouse.drag)
|
|
218
|
+
this.enableMode('mouseDrag');
|
|
219
|
+
if (this.options.mouse !== true && this.options.mouse.motion)
|
|
220
|
+
this.enableMode('mouseMotion');
|
|
221
|
+
if (this.options.mouse !== true && this.options.mouse.pixel)
|
|
222
|
+
this.enableMode('pixelMouse');
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
restoreModes() {
|
|
226
|
+
for (let i = this.enabledModes.length - 1; i >= 0; i--) {
|
|
227
|
+
this.write(MODE_DISABLE[this.enabledModes[i]]);
|
|
228
|
+
}
|
|
229
|
+
this.enabledModes.length = 0;
|
|
230
|
+
}
|
|
231
|
+
async restoreInputAfterDrain() {
|
|
232
|
+
try {
|
|
233
|
+
await drainStdin();
|
|
234
|
+
}
|
|
235
|
+
catch {
|
|
236
|
+
}
|
|
237
|
+
finally {
|
|
238
|
+
this.restoreInputNow();
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
stopNow() {
|
|
242
|
+
if (!this.started)
|
|
243
|
+
return;
|
|
244
|
+
this.started = false;
|
|
245
|
+
this.write('\x1b[?2026l');
|
|
246
|
+
this.restoreModes();
|
|
247
|
+
this.write('\x1b[0m\x1b]8;;\x07');
|
|
248
|
+
this.showCursor();
|
|
249
|
+
this.restoreInputNow();
|
|
250
|
+
}
|
|
251
|
+
restoreInputNow() {
|
|
252
|
+
process.stdin.pause();
|
|
253
|
+
process.stdin.setRawMode(false);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { InputEvent } from './events';
|
|
2
|
+
import type { GlobalKeybinding } from './keybinds';
|
|
3
|
+
import type { Color } from './layout/types';
|
|
4
|
+
import { type Command } from './components/command-palette';
|
|
5
|
+
import type { Component } from './surface';
|
|
6
|
+
import type { Terminal } from './types/terminal';
|
|
7
|
+
import { type ModalOptions, type ToastKind } from './views';
|
|
8
|
+
export interface TuiOptions {
|
|
9
|
+
synchronizedOutput?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface LayerHandle {
|
|
12
|
+
close(): void;
|
|
13
|
+
}
|
|
14
|
+
export interface ToastHandle {
|
|
15
|
+
dismiss(): void;
|
|
16
|
+
}
|
|
17
|
+
export declare class TUI {
|
|
18
|
+
private readonly terminal;
|
|
19
|
+
private root;
|
|
20
|
+
private focused;
|
|
21
|
+
private entries;
|
|
22
|
+
private backdrop;
|
|
23
|
+
private layers;
|
|
24
|
+
private toasts;
|
|
25
|
+
private escapeUnsub;
|
|
26
|
+
private started;
|
|
27
|
+
private terminalFocused;
|
|
28
|
+
private readonly renderer;
|
|
29
|
+
private readonly inputRouter;
|
|
30
|
+
constructor(terminal: Terminal, options?: TuiOptions);
|
|
31
|
+
setRoot(component: Component | null): void;
|
|
32
|
+
setBackgroundColor(color: Color): void;
|
|
33
|
+
setFocus(component: Component | null): void;
|
|
34
|
+
getFocused(): Component | null;
|
|
35
|
+
pushLayer(layer: Component, opts?: {
|
|
36
|
+
focus?: Component;
|
|
37
|
+
onClose?: () => void;
|
|
38
|
+
}): LayerHandle;
|
|
39
|
+
showModal(content: Component, opts?: ModalOptions & {
|
|
40
|
+
onClose?: () => void;
|
|
41
|
+
}): LayerHandle;
|
|
42
|
+
showCommandPalette(commands: Command[]): LayerHandle;
|
|
43
|
+
toast(message: string, opts?: {
|
|
44
|
+
duration?: number;
|
|
45
|
+
kind?: ToastKind;
|
|
46
|
+
}): ToastHandle;
|
|
47
|
+
private dismissToast;
|
|
48
|
+
private popTopLayer;
|
|
49
|
+
private removeLayer;
|
|
50
|
+
private composedRoot;
|
|
51
|
+
navigateFocus(direction: 'next' | 'previous'): Component | null;
|
|
52
|
+
addGlobalKeybinding(binding: GlobalKeybinding): () => void;
|
|
53
|
+
addInputInterceptor(listener: (event: InputEvent) => boolean | undefined): () => void;
|
|
54
|
+
requestRender(force?: boolean): void;
|
|
55
|
+
renderNow(): void;
|
|
56
|
+
componentAt(x: number, y: number): Component | null;
|
|
57
|
+
start(): void;
|
|
58
|
+
stop(): void;
|
|
59
|
+
private handleResize;
|
|
60
|
+
}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { InputRouter } from './inputRouter';
|
|
2
|
+
import { colorToRgba, OPAQUE_BLACK } from './layout/color';
|
|
3
|
+
import { containsPoint } from './layout/insets';
|
|
4
|
+
import { commandPalette } from './components/command-palette';
|
|
5
|
+
import { Renderer } from './renderer';
|
|
6
|
+
import { modal, toast as toastView } from './views';
|
|
7
|
+
export class TUI {
|
|
8
|
+
terminal;
|
|
9
|
+
root = null;
|
|
10
|
+
focused = null;
|
|
11
|
+
entries = [];
|
|
12
|
+
backdrop = OPAQUE_BLACK;
|
|
13
|
+
layers = [];
|
|
14
|
+
toasts = [];
|
|
15
|
+
escapeUnsub;
|
|
16
|
+
started = false;
|
|
17
|
+
terminalFocused = true;
|
|
18
|
+
renderer;
|
|
19
|
+
inputRouter;
|
|
20
|
+
constructor(terminal, options = {}) {
|
|
21
|
+
this.terminal = terminal;
|
|
22
|
+
this.renderer = new Renderer(terminal, {
|
|
23
|
+
getRoot: () => this.composedRoot(),
|
|
24
|
+
isFocused: (component) => component === this.focused && this.terminalFocused,
|
|
25
|
+
setEntries: (entries) => {
|
|
26
|
+
this.entries = entries;
|
|
27
|
+
},
|
|
28
|
+
getBackdropColor: () => this.backdrop,
|
|
29
|
+
}, options.synchronizedOutput ?? true);
|
|
30
|
+
this.inputRouter = new InputRouter({
|
|
31
|
+
getFocused: () => this.focused,
|
|
32
|
+
getEntries: () => this.entries,
|
|
33
|
+
getTerminalFocused: () => this.terminalFocused,
|
|
34
|
+
setTerminalFocused: (focused) => {
|
|
35
|
+
this.terminalFocused = focused;
|
|
36
|
+
},
|
|
37
|
+
requestRender: (force) => this.requestRender(force),
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
setRoot(component) {
|
|
41
|
+
this.root = component;
|
|
42
|
+
this.requestRender(true);
|
|
43
|
+
}
|
|
44
|
+
setBackgroundColor(color) {
|
|
45
|
+
this.backdrop = { ...colorToRgba(color), a: 1 };
|
|
46
|
+
this.requestRender(true);
|
|
47
|
+
}
|
|
48
|
+
setFocus(component) {
|
|
49
|
+
this.focused = component;
|
|
50
|
+
this.requestRender();
|
|
51
|
+
}
|
|
52
|
+
getFocused() {
|
|
53
|
+
return this.focused;
|
|
54
|
+
}
|
|
55
|
+
pushLayer(layer, opts = {}) {
|
|
56
|
+
const entry = { layer, prevFocus: this.focused, onClose: opts.onClose };
|
|
57
|
+
this.layers.push(entry);
|
|
58
|
+
if (opts.focus)
|
|
59
|
+
this.focused = opts.focus;
|
|
60
|
+
if (!this.escapeUnsub) {
|
|
61
|
+
this.escapeUnsub = this.addGlobalKeybinding({ chord: { key: 'escape' }, handler: () => this.popTopLayer() });
|
|
62
|
+
}
|
|
63
|
+
this.requestRender(true);
|
|
64
|
+
return { close: () => this.removeLayer(entry) };
|
|
65
|
+
}
|
|
66
|
+
showModal(content, opts = {}) {
|
|
67
|
+
return this.pushLayer(modal(content, opts), { focus: content, onClose: opts.onClose });
|
|
68
|
+
}
|
|
69
|
+
showCommandPalette(commands) {
|
|
70
|
+
const ref = {};
|
|
71
|
+
const palette = commandPalette(commands, {
|
|
72
|
+
onRun: (command) => {
|
|
73
|
+
ref.handle?.close();
|
|
74
|
+
command.run();
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
ref.handle = this.pushLayer(palette, { focus: palette });
|
|
78
|
+
return ref.handle;
|
|
79
|
+
}
|
|
80
|
+
toast(message, opts = {}) {
|
|
81
|
+
const entry = { view: toastView(message, { kind: opts.kind }) };
|
|
82
|
+
this.toasts.push(entry);
|
|
83
|
+
this.requestRender();
|
|
84
|
+
const timer = setTimeout(() => this.dismissToast(entry), opts.duration ?? 3000);
|
|
85
|
+
return {
|
|
86
|
+
dismiss: () => {
|
|
87
|
+
clearTimeout(timer);
|
|
88
|
+
this.dismissToast(entry);
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
dismissToast(entry) {
|
|
93
|
+
const index = this.toasts.indexOf(entry);
|
|
94
|
+
if (index === -1)
|
|
95
|
+
return;
|
|
96
|
+
this.toasts.splice(index, 1);
|
|
97
|
+
this.requestRender();
|
|
98
|
+
}
|
|
99
|
+
popTopLayer() {
|
|
100
|
+
const top = this.layers[this.layers.length - 1];
|
|
101
|
+
if (top)
|
|
102
|
+
this.removeLayer(top);
|
|
103
|
+
}
|
|
104
|
+
removeLayer(entry) {
|
|
105
|
+
const index = this.layers.indexOf(entry);
|
|
106
|
+
if (index === -1)
|
|
107
|
+
return;
|
|
108
|
+
this.layers.splice(index, 1);
|
|
109
|
+
this.focused = entry.prevFocus;
|
|
110
|
+
if (this.layers.length === 0 && this.escapeUnsub) {
|
|
111
|
+
this.escapeUnsub();
|
|
112
|
+
this.escapeUnsub = undefined;
|
|
113
|
+
}
|
|
114
|
+
entry.onClose?.();
|
|
115
|
+
this.requestRender(true);
|
|
116
|
+
}
|
|
117
|
+
composedRoot() {
|
|
118
|
+
if (this.layers.length === 0 && this.toasts.length === 0)
|
|
119
|
+
return this.root;
|
|
120
|
+
const root = this.root;
|
|
121
|
+
const layers = this.layers;
|
|
122
|
+
const toasts = this.toasts;
|
|
123
|
+
return {
|
|
124
|
+
render: (s) => {
|
|
125
|
+
const full = { x: 0, y: 0, width: s.width, height: s.height };
|
|
126
|
+
if (root)
|
|
127
|
+
s.child(root, full);
|
|
128
|
+
for (const entry of layers)
|
|
129
|
+
s.child(entry.layer, full);
|
|
130
|
+
let y = 0;
|
|
131
|
+
for (const entry of toasts) {
|
|
132
|
+
const w = Math.min(40, s.width);
|
|
133
|
+
const h = s.measure(entry.view, w);
|
|
134
|
+
if (y + h > s.height)
|
|
135
|
+
break;
|
|
136
|
+
s.child(entry.view, { x: s.width - w, y, width: w, height: h });
|
|
137
|
+
y += h + 1;
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
navigateFocus(direction) {
|
|
143
|
+
const focusables = this.entries.filter((entry) => entry.component.handleInput).map((entry) => entry.component);
|
|
144
|
+
if (focusables.length === 0)
|
|
145
|
+
return null;
|
|
146
|
+
const current = this.focused ? focusables.indexOf(this.focused) : -1;
|
|
147
|
+
const forward = direction === 'next';
|
|
148
|
+
const next = forward ? (current + 1) % focusables.length : (current - 1 + focusables.length) % focusables.length;
|
|
149
|
+
this.setFocus(focusables[next]);
|
|
150
|
+
return focusables[next];
|
|
151
|
+
}
|
|
152
|
+
addGlobalKeybinding(binding) {
|
|
153
|
+
return this.inputRouter.addGlobalKeybinding(binding);
|
|
154
|
+
}
|
|
155
|
+
addInputInterceptor(listener) {
|
|
156
|
+
return this.inputRouter.addInputInterceptor(listener);
|
|
157
|
+
}
|
|
158
|
+
requestRender(force = false) {
|
|
159
|
+
this.renderer.requestRender(force);
|
|
160
|
+
}
|
|
161
|
+
renderNow() {
|
|
162
|
+
this.renderer.doRender();
|
|
163
|
+
}
|
|
164
|
+
componentAt(x, y) {
|
|
165
|
+
for (let i = this.entries.length - 1; i >= 0; i--) {
|
|
166
|
+
if (containsPoint(this.entries[i].rect, x, y))
|
|
167
|
+
return this.entries[i].component;
|
|
168
|
+
}
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
171
|
+
start() {
|
|
172
|
+
if (this.started)
|
|
173
|
+
return;
|
|
174
|
+
this.started = true;
|
|
175
|
+
this.renderer.setStopped(false);
|
|
176
|
+
this.inputRouter.setStopped(false);
|
|
177
|
+
this.terminal.start?.((data) => this.inputRouter.feed(data), () => this.handleResize());
|
|
178
|
+
this.terminal.hideCursor();
|
|
179
|
+
this.requestRender(true);
|
|
180
|
+
}
|
|
181
|
+
stop() {
|
|
182
|
+
if (!this.started)
|
|
183
|
+
return;
|
|
184
|
+
this.started = false;
|
|
185
|
+
this.renderer.setStopped(true);
|
|
186
|
+
this.inputRouter.setStopped(true);
|
|
187
|
+
this.renderer.moveCursorAfterRenderedContent();
|
|
188
|
+
this.terminal.stop?.();
|
|
189
|
+
this.terminal.showCursor();
|
|
190
|
+
}
|
|
191
|
+
handleResize() {
|
|
192
|
+
this.requestRender(true);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { Capabilities } from '../capabilities';
|
|
2
|
+
export type TerminalMode = 'alternateScreen' | 'bracketedPaste' | 'focusEvents' | 'sgrMouse' | 'mouseDrag' | 'mouseMotion' | 'pixelMouse' | 'synchronizedOutput' | 'kittyKeyboard' | 'modifyOtherKeys';
|
|
3
|
+
export interface Terminal {
|
|
4
|
+
readonly columns: number;
|
|
5
|
+
readonly rows: number;
|
|
6
|
+
write: (data: string) => void;
|
|
7
|
+
hideCursor: () => void;
|
|
8
|
+
showCursor: () => void;
|
|
9
|
+
clearScreen: () => void;
|
|
10
|
+
clearLine: () => void;
|
|
11
|
+
clearFromCursor: () => void;
|
|
12
|
+
moveBy: (lines: number) => void;
|
|
13
|
+
enableMode?: (mode: TerminalMode) => void;
|
|
14
|
+
disableMode?: (mode: TerminalMode) => void;
|
|
15
|
+
enableMouse?: () => void;
|
|
16
|
+
disableMouse?: () => void;
|
|
17
|
+
start?: (onInput: (data: string) => void, onResize: () => void) => void;
|
|
18
|
+
stop?: () => void;
|
|
19
|
+
readonly capabilities?: Capabilities;
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function stripAnsi(s: string): string;
|
|
2
|
+
export declare function visibleWidth(s: string): number;
|
|
3
|
+
export declare function charWidth(code: number): number;
|
|
4
|
+
export declare function truncateToWidth(s: string, width: number, ellipsis?: string): string;
|
|
5
|
+
export declare function wrapText(text: string, width: number): string[];
|
|
6
|
+
export declare function sliceByColumn(s: string, start: number, end: number, strict?: boolean): string;
|