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,56 @@
|
|
|
1
|
+
export interface Modifiers {
|
|
2
|
+
shift: boolean;
|
|
3
|
+
ctrl: boolean;
|
|
4
|
+
alt: boolean;
|
|
5
|
+
meta: boolean;
|
|
6
|
+
}
|
|
7
|
+
export type KeyEventKind = 'press' | 'repeat' | 'release';
|
|
8
|
+
export interface KeyInputEvent extends Modifiers {
|
|
9
|
+
type: 'key';
|
|
10
|
+
key: string;
|
|
11
|
+
kind: KeyEventKind;
|
|
12
|
+
text?: string;
|
|
13
|
+
source: 'legacy' | 'xterm' | 'csi-u' | 'kitty' | 'unknown';
|
|
14
|
+
raw: string;
|
|
15
|
+
}
|
|
16
|
+
export interface TextInputEvent {
|
|
17
|
+
type: 'text';
|
|
18
|
+
text: string;
|
|
19
|
+
raw: string;
|
|
20
|
+
}
|
|
21
|
+
export type MouseButton = 'left' | 'middle' | 'right' | 'wheelUp' | 'wheelDown' | 'wheelLeft' | 'wheelRight' | 'unknown';
|
|
22
|
+
export type MouseEventKind = 'press' | 'release' | 'drag' | 'move' | 'wheel';
|
|
23
|
+
export interface MouseInputEvent extends Modifiers {
|
|
24
|
+
type: 'mouse';
|
|
25
|
+
kind: MouseEventKind;
|
|
26
|
+
button: MouseButton;
|
|
27
|
+
x: number;
|
|
28
|
+
y: number;
|
|
29
|
+
localX?: number;
|
|
30
|
+
localY?: number;
|
|
31
|
+
coordinateSpace: 'cells' | 'pixels';
|
|
32
|
+
source: 'sgr' | 'x10' | 'urxvt' | 'pixel' | 'unknown';
|
|
33
|
+
raw: string;
|
|
34
|
+
}
|
|
35
|
+
export interface PasteInputEvent {
|
|
36
|
+
type: 'paste';
|
|
37
|
+
text: string;
|
|
38
|
+
raw: string;
|
|
39
|
+
}
|
|
40
|
+
export interface FocusInputEvent {
|
|
41
|
+
type: 'focus';
|
|
42
|
+
focused: boolean;
|
|
43
|
+
raw: string;
|
|
44
|
+
}
|
|
45
|
+
export interface ResizeInputEvent {
|
|
46
|
+
type: 'resize';
|
|
47
|
+
columns: number;
|
|
48
|
+
rows: number;
|
|
49
|
+
}
|
|
50
|
+
export interface TerminalResponseEvent {
|
|
51
|
+
type: 'terminalResponse';
|
|
52
|
+
raw: string;
|
|
53
|
+
sequence: 'csi' | 'osc' | 'dcs' | 'apc' | 'pm' | 'sos' | 'escape' | 'unknown';
|
|
54
|
+
}
|
|
55
|
+
export type InputEvent = KeyInputEvent | TextInputEvent | MouseInputEvent | PasteInputEvent | FocusInputEvent | ResizeInputEvent | TerminalResponseEvent;
|
|
56
|
+
export declare const NO_MODIFIERS: Modifiers;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type { Component, Surface, SurfaceEntry } from './surface';
|
|
2
|
+
export { measure, measureWidth, renderToBuffer } from './surface';
|
|
3
|
+
export { box, type BoxOptions, column, flex, type FlexItem, modal, type ModalOptions, overlay, type OverlayOptions, row, text, toast, type ToastKind, type ToastOptions, } from './views';
|
|
4
|
+
export { Editor, editor, type EditorOptions } from './components/editor';
|
|
5
|
+
export { ScrollView, scrollView } from './components/scroll-view';
|
|
6
|
+
export { type SelectItem, SelectList, selectList } from './components/select-list';
|
|
7
|
+
export { type Command, CommandPalette, commandPalette, type CommandPaletteOptions } from './components/command-palette';
|
|
8
|
+
export { type LayerHandle, type ToastHandle, TUI, type TuiOptions } from './tui';
|
|
9
|
+
export { ProcessTerminal, type ProcessTerminalOptions } from './terminal';
|
|
10
|
+
export type { Terminal, TerminalMode } from './types/terminal';
|
|
11
|
+
export type { InputEvent, KeyInputEvent, Modifiers, MouseInputEvent } from './events';
|
|
12
|
+
export { parseInput } from './keyboard';
|
|
13
|
+
export { TerminalInputParser } from './parser';
|
|
14
|
+
export { type GlobalKeybinding, type KeyChord, keyMatches } from './keybinds';
|
|
15
|
+
export { type Capabilities, capability, type CapabilitySource, createDefaultCapabilities, mergeCapabilities, type PartialCapabilities, } from './capabilities';
|
|
16
|
+
export { truncateToWidth, visibleWidth, wrapText } from './utils';
|
|
17
|
+
export type { Color, Rect } from './layout/types';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { measure, measureWidth, renderToBuffer } from './surface';
|
|
2
|
+
export { box, column, flex, modal, overlay, row, text, toast, } from './views';
|
|
3
|
+
export { Editor, editor } from './components/editor';
|
|
4
|
+
export { ScrollView, scrollView } from './components/scroll-view';
|
|
5
|
+
export { SelectList, selectList } from './components/select-list';
|
|
6
|
+
export { CommandPalette, commandPalette } from './components/command-palette';
|
|
7
|
+
export { TUI } from './tui';
|
|
8
|
+
export { ProcessTerminal } from './terminal';
|
|
9
|
+
export { parseInput } from './keyboard';
|
|
10
|
+
export { TerminalInputParser } from './parser';
|
|
11
|
+
export { keyMatches } from './keybinds';
|
|
12
|
+
export { capability, createDefaultCapabilities, mergeCapabilities, } from './capabilities';
|
|
13
|
+
export { truncateToWidth, visibleWidth, wrapText } from './utils';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { InputEvent } from './events';
|
|
2
|
+
import type { GlobalKeybinding } from './keybinds';
|
|
3
|
+
import type { Component, SurfaceEntry } from './surface';
|
|
4
|
+
export interface InputRouterHost {
|
|
5
|
+
getFocused(): Component | null;
|
|
6
|
+
getEntries(): SurfaceEntry[];
|
|
7
|
+
setTerminalFocused(focused: boolean): void;
|
|
8
|
+
getTerminalFocused(): boolean;
|
|
9
|
+
requestRender(force?: boolean): void;
|
|
10
|
+
}
|
|
11
|
+
export declare class InputRouter {
|
|
12
|
+
private readonly host;
|
|
13
|
+
private readonly parser;
|
|
14
|
+
private readonly inputInterceptors;
|
|
15
|
+
private readonly globalKeybindings;
|
|
16
|
+
private pendingEscapeTimer;
|
|
17
|
+
private readonly escapeTimeoutMs;
|
|
18
|
+
private stopped;
|
|
19
|
+
constructor(host: InputRouterHost);
|
|
20
|
+
setStopped(stopped: boolean): void;
|
|
21
|
+
addInputInterceptor(listener: (event: InputEvent) => boolean | undefined): () => void;
|
|
22
|
+
addGlobalKeybinding(binding: GlobalKeybinding): () => void;
|
|
23
|
+
feed(data: string): void;
|
|
24
|
+
private dispatchEvents;
|
|
25
|
+
dispatchEvent(event: InputEvent): void;
|
|
26
|
+
private handleMouseEvent;
|
|
27
|
+
private handleGlobalKeybinding;
|
|
28
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { keyMatches } from './keybinds';
|
|
2
|
+
import { containsPoint } from './layout/insets';
|
|
3
|
+
import { TerminalInputParser } from './parser';
|
|
4
|
+
export class InputRouter {
|
|
5
|
+
host;
|
|
6
|
+
parser;
|
|
7
|
+
inputInterceptors = [];
|
|
8
|
+
globalKeybindings = [];
|
|
9
|
+
pendingEscapeTimer;
|
|
10
|
+
escapeTimeoutMs = 25;
|
|
11
|
+
stopped = false;
|
|
12
|
+
constructor(host) {
|
|
13
|
+
this.host = host;
|
|
14
|
+
this.parser = new TerminalInputParser();
|
|
15
|
+
}
|
|
16
|
+
setStopped(stopped) {
|
|
17
|
+
this.stopped = stopped;
|
|
18
|
+
if (stopped && this.pendingEscapeTimer) {
|
|
19
|
+
clearTimeout(this.pendingEscapeTimer);
|
|
20
|
+
this.pendingEscapeTimer = undefined;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
addInputInterceptor(listener) {
|
|
24
|
+
this.inputInterceptors.push(listener);
|
|
25
|
+
return () => {
|
|
26
|
+
const index = this.inputInterceptors.indexOf(listener);
|
|
27
|
+
if (index !== -1)
|
|
28
|
+
this.inputInterceptors.splice(index, 1);
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
addGlobalKeybinding(binding) {
|
|
32
|
+
this.globalKeybindings.push(binding);
|
|
33
|
+
return () => {
|
|
34
|
+
const index = this.globalKeybindings.indexOf(binding);
|
|
35
|
+
if (index !== -1)
|
|
36
|
+
this.globalKeybindings.splice(index, 1);
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
feed(data) {
|
|
40
|
+
this.dispatchEvents(this.parser.feed(data));
|
|
41
|
+
if (this.parser.hasPending()) {
|
|
42
|
+
if (!this.pendingEscapeTimer) {
|
|
43
|
+
this.pendingEscapeTimer = setTimeout(() => {
|
|
44
|
+
this.pendingEscapeTimer = undefined;
|
|
45
|
+
this.dispatchEvents(this.parser.flushPending());
|
|
46
|
+
}, this.escapeTimeoutMs);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
else if (this.pendingEscapeTimer) {
|
|
50
|
+
clearTimeout(this.pendingEscapeTimer);
|
|
51
|
+
this.pendingEscapeTimer = undefined;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
dispatchEvents(events) {
|
|
55
|
+
for (const event of events)
|
|
56
|
+
this.dispatchEvent(event);
|
|
57
|
+
}
|
|
58
|
+
dispatchEvent(event) {
|
|
59
|
+
for (const interceptor of this.inputInterceptors.slice()) {
|
|
60
|
+
try {
|
|
61
|
+
if (interceptor(event)) {
|
|
62
|
+
this.host.requestRender();
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
// a faulty interceptor must not break input
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (event.type === 'mouse') {
|
|
71
|
+
this.handleMouseEvent(event);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (event.type === 'focus') {
|
|
75
|
+
if (this.host.getTerminalFocused() !== event.focused) {
|
|
76
|
+
this.host.setTerminalFocused(event.focused);
|
|
77
|
+
this.host.requestRender();
|
|
78
|
+
}
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (event.type === 'key' && this.handleGlobalKeybinding(event))
|
|
82
|
+
return;
|
|
83
|
+
const focused = this.host.getFocused();
|
|
84
|
+
if (event.type === 'key' && event.kind === 'release' && !focused?.wantsKeyRelease)
|
|
85
|
+
return;
|
|
86
|
+
if (focused?.handleInput) {
|
|
87
|
+
focused.handleInput(event);
|
|
88
|
+
this.host.requestRender();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
handleMouseEvent(event) {
|
|
92
|
+
if (this.stopped)
|
|
93
|
+
return;
|
|
94
|
+
const entries = this.host.getEntries();
|
|
95
|
+
for (let i = entries.length - 1; i >= 0; i--) {
|
|
96
|
+
const entry = entries[i];
|
|
97
|
+
if (!entry.component.handleInput)
|
|
98
|
+
continue;
|
|
99
|
+
if (!containsPoint(entry.rect, event.x, event.y))
|
|
100
|
+
continue;
|
|
101
|
+
entry.component.handleInput({ ...event, localX: event.x - entry.rect.x, localY: event.y - entry.rect.y });
|
|
102
|
+
this.host.requestRender();
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const focused = this.host.getFocused();
|
|
106
|
+
if (focused?.handleInput) {
|
|
107
|
+
focused.handleInput(event);
|
|
108
|
+
this.host.requestRender();
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
handleGlobalKeybinding(event) {
|
|
112
|
+
if (event.type !== 'key')
|
|
113
|
+
return false;
|
|
114
|
+
for (const binding of this.globalKeybindings) {
|
|
115
|
+
if (keyMatches(binding.chord, event)) {
|
|
116
|
+
binding.handler(event);
|
|
117
|
+
return true;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { InputEvent, KeyInputEvent } from './events';
|
|
2
|
+
export interface KeyChord {
|
|
3
|
+
key?: string;
|
|
4
|
+
shift?: boolean;
|
|
5
|
+
ctrl?: boolean;
|
|
6
|
+
meta?: boolean;
|
|
7
|
+
alt?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface GlobalKeybinding {
|
|
10
|
+
chord: KeyChord;
|
|
11
|
+
handler: (event: KeyInputEvent) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare function keyMatches(chord: KeyChord, event: InputEvent): boolean;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export function keyMatches(chord, event) {
|
|
2
|
+
if (event.type !== 'key')
|
|
3
|
+
return false;
|
|
4
|
+
if (chord.key !== undefined && chord.key !== event.key)
|
|
5
|
+
return false;
|
|
6
|
+
if ((chord.shift ?? false) !== event.shift)
|
|
7
|
+
return false;
|
|
8
|
+
if ((chord.ctrl ?? false) !== event.ctrl)
|
|
9
|
+
return false;
|
|
10
|
+
if ((chord.meta ?? false) !== event.meta)
|
|
11
|
+
return false;
|
|
12
|
+
if ((chord.alt ?? false) !== event.alt)
|
|
13
|
+
return false;
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
import { NO_MODIFIERS } from './events';
|
|
2
|
+
// deno-lint-ignore no-control-regex
|
|
3
|
+
const CSI_U_RE = /^\x1b\[(\d+)(?::[\d:]+)?(?:;(\d+(?::\d+)?))?(?:;([\d:]+))?u$/;
|
|
4
|
+
// deno-lint-ignore no-control-regex
|
|
5
|
+
const LEGACY_KITTY_RE = /^\x1b\[<(\d+);(\d+)u$/;
|
|
6
|
+
// deno-lint-ignore no-control-regex
|
|
7
|
+
const XTERM_MODIFIED_RE = /^\x1b\[27;(\d+);(\d+)~$/;
|
|
8
|
+
// deno-lint-ignore no-control-regex
|
|
9
|
+
const SGR_MOUSE_RE = /^\x1b\[<(\d+);(\d+);(\d+)([Mm])$/;
|
|
10
|
+
// deno-lint-ignore no-control-regex
|
|
11
|
+
const CSI_TILDE_RE = /^\x1b\[([0-9;]*)~$/;
|
|
12
|
+
// deno-lint-ignore no-control-regex
|
|
13
|
+
const CSI_KEY_RE = /^\x1b\[([0-9;]*)([A-HIOPR])$/;
|
|
14
|
+
// deno-lint-ignore no-control-regex
|
|
15
|
+
const SS3_RE = /^\x1bO([A-DFHPQS])$/;
|
|
16
|
+
// deno-lint-ignore no-control-regex
|
|
17
|
+
const ALT_PREFIX_RE = /^\x1b(.+)$/;
|
|
18
|
+
// deno-lint-ignore no-control-regex
|
|
19
|
+
const CTRL_RE = /^[\x01-\x1a]$/;
|
|
20
|
+
const CSI_KEY_MAP = {
|
|
21
|
+
A: 'up',
|
|
22
|
+
B: 'down',
|
|
23
|
+
C: 'right',
|
|
24
|
+
D: 'left',
|
|
25
|
+
H: 'home',
|
|
26
|
+
F: 'end',
|
|
27
|
+
P: 'f1',
|
|
28
|
+
Q: 'f2',
|
|
29
|
+
R: 'f3',
|
|
30
|
+
1: 'home',
|
|
31
|
+
2: 'insert',
|
|
32
|
+
3: 'delete',
|
|
33
|
+
4: 'end',
|
|
34
|
+
5: 'pageUp',
|
|
35
|
+
6: 'pageDown',
|
|
36
|
+
};
|
|
37
|
+
const CSI_NUM_KEY_MAP = {
|
|
38
|
+
11: 'f1',
|
|
39
|
+
12: 'f2',
|
|
40
|
+
13: 'f3',
|
|
41
|
+
14: 'f4',
|
|
42
|
+
15: 'f5',
|
|
43
|
+
17: 'f6',
|
|
44
|
+
18: 'f7',
|
|
45
|
+
19: 'f8',
|
|
46
|
+
20: 'f9',
|
|
47
|
+
21: 'f10',
|
|
48
|
+
23: 'f11',
|
|
49
|
+
24: 'f12',
|
|
50
|
+
};
|
|
51
|
+
const SS3_KEY_MAP = {
|
|
52
|
+
A: 'up',
|
|
53
|
+
B: 'down',
|
|
54
|
+
C: 'right',
|
|
55
|
+
D: 'left',
|
|
56
|
+
H: 'home',
|
|
57
|
+
F: 'end',
|
|
58
|
+
P: 'f1',
|
|
59
|
+
Q: 'f2',
|
|
60
|
+
R: 'f3',
|
|
61
|
+
S: 'f4',
|
|
62
|
+
};
|
|
63
|
+
export function parseInput(raw) {
|
|
64
|
+
if (raw.length === 0)
|
|
65
|
+
return null;
|
|
66
|
+
if (raw === '\r' || raw === '\n') {
|
|
67
|
+
return key('enter', { raw, source: 'legacy' });
|
|
68
|
+
}
|
|
69
|
+
if (raw === '\x1b') {
|
|
70
|
+
return key('escape', { raw, source: 'legacy' });
|
|
71
|
+
}
|
|
72
|
+
if (raw === '\t') {
|
|
73
|
+
return key('tab', { raw, source: 'legacy' });
|
|
74
|
+
}
|
|
75
|
+
if (raw === '\x7f' || raw === '\b') {
|
|
76
|
+
return key('backspace', { raw, source: 'legacy' });
|
|
77
|
+
}
|
|
78
|
+
if (CTRL_RE.test(raw)) {
|
|
79
|
+
const code = raw.charCodeAt(0);
|
|
80
|
+
if (code === 9 || code === 10 || code === 13)
|
|
81
|
+
return null;
|
|
82
|
+
return key(String.fromCharCode(code + 96), { raw, source: 'legacy', ctrl: true });
|
|
83
|
+
}
|
|
84
|
+
const mouseMatch = raw.match(SGR_MOUSE_RE);
|
|
85
|
+
if (mouseMatch) {
|
|
86
|
+
return parseSgrMouse(raw, mouseMatch);
|
|
87
|
+
}
|
|
88
|
+
if (raw === '\x1b[I') {
|
|
89
|
+
return { type: 'focus', focused: true, raw };
|
|
90
|
+
}
|
|
91
|
+
if (raw === '\x1b[O') {
|
|
92
|
+
return { type: 'focus', focused: false, raw };
|
|
93
|
+
}
|
|
94
|
+
const csiUMatch = raw.match(CSI_U_RE);
|
|
95
|
+
if (csiUMatch) {
|
|
96
|
+
const code = Number.parseInt(csiUMatch[1], 10);
|
|
97
|
+
const encodedModifiers = csiUMatch[2] ? Number.parseInt(csiUMatch[2], 10) : 1;
|
|
98
|
+
const modifiers = decodeEncodedModifiers(encodedModifiers);
|
|
99
|
+
const eventType = decodeKittyEventType(csiUMatch[2]);
|
|
100
|
+
return key(codepointToKey(code), {
|
|
101
|
+
...modifiers,
|
|
102
|
+
kind: eventType,
|
|
103
|
+
raw,
|
|
104
|
+
source: 'csi-u',
|
|
105
|
+
text: codepointToText(code),
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
const legacyKittyMatch = raw.match(LEGACY_KITTY_RE);
|
|
109
|
+
if (legacyKittyMatch) {
|
|
110
|
+
const code = Number.parseInt(legacyKittyMatch[1], 10);
|
|
111
|
+
const modifiers = decodeEncodedModifiers(Number.parseInt(legacyKittyMatch[2], 10));
|
|
112
|
+
return key(codepointToKey(code), { ...modifiers, raw, source: 'kitty', text: codepointToText(code) });
|
|
113
|
+
}
|
|
114
|
+
const xtermMatch = raw.match(XTERM_MODIFIED_RE);
|
|
115
|
+
if (xtermMatch) {
|
|
116
|
+
const first = Number.parseInt(xtermMatch[1], 10);
|
|
117
|
+
const second = Number.parseInt(xtermMatch[2], 10);
|
|
118
|
+
const modifierParam = first <= 8 && second > 8 ? first : second;
|
|
119
|
+
const code = first <= 8 && second > 8 ? second : first;
|
|
120
|
+
const modifiers = decodeEncodedModifiers(modifierParam);
|
|
121
|
+
return key(codepointToKey(code), { ...modifiers, raw, source: 'xterm', text: codepointToText(code) });
|
|
122
|
+
}
|
|
123
|
+
const csiTildeMatch = raw.match(CSI_TILDE_RE);
|
|
124
|
+
if (csiTildeMatch) {
|
|
125
|
+
const params = splitParams(csiTildeMatch[1]);
|
|
126
|
+
const keyName = params.length > 0 ? (CSI_NUM_KEY_MAP[params[0]] ?? CSI_KEY_MAP[params[0]]) : undefined;
|
|
127
|
+
if (keyName) {
|
|
128
|
+
return key(keyName, { ...decodeOptionalModifier(params[1]), raw, source: 'xterm' });
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
const csiMatch = raw.match(CSI_KEY_RE);
|
|
132
|
+
if (csiMatch) {
|
|
133
|
+
const params = splitParams(csiMatch[1]);
|
|
134
|
+
const final = csiMatch[2];
|
|
135
|
+
const keyName = CSI_KEY_MAP[final] ?? (params.length > 0 ? CSI_KEY_MAP[params[0]] : undefined);
|
|
136
|
+
if (keyName) {
|
|
137
|
+
return key(keyName, { ...decodeOptionalModifier(params[1]), raw, source: 'xterm' });
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
const ss3Match = raw.match(SS3_RE);
|
|
141
|
+
if (ss3Match) {
|
|
142
|
+
return key(SS3_KEY_MAP[ss3Match[1]] ?? ss3Match[1], { raw, source: 'legacy' });
|
|
143
|
+
}
|
|
144
|
+
if (isControlSequence(raw)) {
|
|
145
|
+
return { type: 'terminalResponse', raw, sequence: classifySequence(raw) };
|
|
146
|
+
}
|
|
147
|
+
const altMatch = raw.match(ALT_PREFIX_RE);
|
|
148
|
+
if (altMatch) {
|
|
149
|
+
const inner = parseInput(altMatch[1]);
|
|
150
|
+
if (inner?.type === 'key') {
|
|
151
|
+
return { ...inner, alt: true, meta: true, raw };
|
|
152
|
+
}
|
|
153
|
+
if (inner?.type === 'text') {
|
|
154
|
+
return key(inner.text, { raw, source: 'legacy', alt: true, meta: true, text: inner.text });
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
const chars = Array.from(raw);
|
|
158
|
+
if (chars.length === 1) {
|
|
159
|
+
return key(chars[0], { raw, source: 'legacy', text: chars[0] });
|
|
160
|
+
}
|
|
161
|
+
if (!raw.includes('\x1b')) {
|
|
162
|
+
return { type: 'text', text: raw, raw };
|
|
163
|
+
}
|
|
164
|
+
return { type: 'terminalResponse', raw, sequence: classifySequence(raw) };
|
|
165
|
+
}
|
|
166
|
+
function key(name, opts) {
|
|
167
|
+
return {
|
|
168
|
+
type: 'key',
|
|
169
|
+
key: name,
|
|
170
|
+
kind: opts.kind ?? 'press',
|
|
171
|
+
shift: opts.shift ?? false,
|
|
172
|
+
ctrl: opts.ctrl ?? false,
|
|
173
|
+
alt: opts.alt ?? false,
|
|
174
|
+
meta: opts.meta ?? false,
|
|
175
|
+
source: opts.source,
|
|
176
|
+
raw: opts.raw,
|
|
177
|
+
...(opts.text ? { text: opts.text } : {}),
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
function parseSgrMouse(raw, match) {
|
|
181
|
+
const cb = Number.parseInt(match[1], 10);
|
|
182
|
+
const x = Number.parseInt(match[2], 10) - 1;
|
|
183
|
+
const y = Number.parseInt(match[3], 10) - 1;
|
|
184
|
+
const final = match[4];
|
|
185
|
+
const modifiers = decodeMouseModifiers(cb);
|
|
186
|
+
const code = cb & ~(4 | 8 | 16);
|
|
187
|
+
const isRelease = final === 'm' || (code & 3) === 3;
|
|
188
|
+
const isWheel = code >= 64 && code <= 67;
|
|
189
|
+
const buttonCode = code & 3;
|
|
190
|
+
const isMove = (code & 32) !== 0 && buttonCode === 3;
|
|
191
|
+
const isDrag = (code & 32) !== 0 && buttonCode < 3;
|
|
192
|
+
return {
|
|
193
|
+
type: 'mouse',
|
|
194
|
+
kind: isWheel ? 'wheel' : isDrag ? 'drag' : isMove ? 'move' : isRelease ? 'release' : 'press',
|
|
195
|
+
button: mouseButton(code, buttonCode),
|
|
196
|
+
x,
|
|
197
|
+
y,
|
|
198
|
+
coordinateSpace: 'cells',
|
|
199
|
+
source: 'sgr',
|
|
200
|
+
raw,
|
|
201
|
+
...modifiers,
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
function mouseButton(code, buttonCode) {
|
|
205
|
+
if (code === 64)
|
|
206
|
+
return 'wheelUp';
|
|
207
|
+
if (code === 65)
|
|
208
|
+
return 'wheelDown';
|
|
209
|
+
if (code === 66)
|
|
210
|
+
return 'wheelLeft';
|
|
211
|
+
if (code === 67)
|
|
212
|
+
return 'wheelRight';
|
|
213
|
+
if (buttonCode === 0)
|
|
214
|
+
return 'left';
|
|
215
|
+
if (buttonCode === 1)
|
|
216
|
+
return 'middle';
|
|
217
|
+
if (buttonCode === 2)
|
|
218
|
+
return 'right';
|
|
219
|
+
return 'unknown';
|
|
220
|
+
}
|
|
221
|
+
function decodeMouseModifiers(cb) {
|
|
222
|
+
return {
|
|
223
|
+
shift: (cb & 4) !== 0,
|
|
224
|
+
alt: (cb & 8) !== 0,
|
|
225
|
+
meta: (cb & 8) !== 0,
|
|
226
|
+
ctrl: (cb & 16) !== 0,
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
function decodeEncodedModifiers(encoded) {
|
|
230
|
+
const mask = Math.max(0, encoded - 1);
|
|
231
|
+
return {
|
|
232
|
+
shift: (mask & 1) !== 0,
|
|
233
|
+
alt: (mask & 2) !== 0,
|
|
234
|
+
ctrl: (mask & 4) !== 0,
|
|
235
|
+
meta: (mask & 8) !== 0 || (mask & 32) !== 0,
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
function decodeOptionalModifier(param) {
|
|
239
|
+
if (!param)
|
|
240
|
+
return { ...NO_MODIFIERS };
|
|
241
|
+
return decodeEncodedModifiers(Number.parseInt(param, 10));
|
|
242
|
+
}
|
|
243
|
+
function splitParams(params) {
|
|
244
|
+
return params.length === 0 ? [] : params.split(';').filter(Boolean);
|
|
245
|
+
}
|
|
246
|
+
function codepointToKey(code) {
|
|
247
|
+
const named = {
|
|
248
|
+
1: 'escape',
|
|
249
|
+
2: 'insert',
|
|
250
|
+
3: 'delete',
|
|
251
|
+
4: 'end',
|
|
252
|
+
5: 'pageUp',
|
|
253
|
+
6: 'pageDown',
|
|
254
|
+
7: 'home',
|
|
255
|
+
8: 'end',
|
|
256
|
+
9: 'tab',
|
|
257
|
+
13: 'enter',
|
|
258
|
+
27: 'escape',
|
|
259
|
+
127: 'backspace',
|
|
260
|
+
};
|
|
261
|
+
return named[code] ?? codepointToText(code) ?? `unknown:${code}`;
|
|
262
|
+
}
|
|
263
|
+
function codepointToText(code) {
|
|
264
|
+
if (code < 0x20 || code === 0x7f)
|
|
265
|
+
return undefined;
|
|
266
|
+
try {
|
|
267
|
+
return String.fromCodePoint(code);
|
|
268
|
+
}
|
|
269
|
+
catch {
|
|
270
|
+
return undefined;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
function decodeKittyEventType(modifierAndType) {
|
|
274
|
+
const eventType = modifierAndType?.split(':')[1];
|
|
275
|
+
if (eventType === '2')
|
|
276
|
+
return 'repeat';
|
|
277
|
+
if (eventType === '3')
|
|
278
|
+
return 'release';
|
|
279
|
+
return 'press';
|
|
280
|
+
}
|
|
281
|
+
function classifySequence(raw) {
|
|
282
|
+
if (raw.startsWith('\x1b['))
|
|
283
|
+
return 'csi';
|
|
284
|
+
if (raw.startsWith('\x1b]'))
|
|
285
|
+
return 'osc';
|
|
286
|
+
if (raw.startsWith('\x1bP'))
|
|
287
|
+
return 'dcs';
|
|
288
|
+
if (raw.startsWith('\x1b_'))
|
|
289
|
+
return 'apc';
|
|
290
|
+
if (raw.startsWith('\x1b^'))
|
|
291
|
+
return 'pm';
|
|
292
|
+
if (raw.startsWith('\x1bX'))
|
|
293
|
+
return 'sos';
|
|
294
|
+
if (raw.startsWith('\x1b'))
|
|
295
|
+
return 'escape';
|
|
296
|
+
return 'unknown';
|
|
297
|
+
}
|
|
298
|
+
function isControlSequence(raw) {
|
|
299
|
+
return (raw.startsWith('\x1b[') ||
|
|
300
|
+
raw.startsWith('\x1b]') ||
|
|
301
|
+
raw.startsWith('\x1bP') ||
|
|
302
|
+
raw.startsWith('\x1b_') ||
|
|
303
|
+
raw.startsWith('\x1b^') ||
|
|
304
|
+
raw.startsWith('\x1bX'));
|
|
305
|
+
}
|