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,306 @@
|
|
|
1
|
+
import { cellsToAnsi } from './ansi';
|
|
2
|
+
import { cellEqual, continuationCell, defaultStyle, emptyCell } from './cell';
|
|
3
|
+
import { blendOver, OPAQUE_BLACK, withOpacity } from './color';
|
|
4
|
+
import { intersectRect, isEmptyRect } from './insets';
|
|
5
|
+
import { DEFAULT_BORDER_CHARS } from './types';
|
|
6
|
+
export function createCellBuffer(width, height, backdropColor) {
|
|
7
|
+
const w = Math.max(0, width);
|
|
8
|
+
const h = Math.max(0, height);
|
|
9
|
+
const cells = new Array(w * h);
|
|
10
|
+
for (let i = 0; i < cells.length; i++)
|
|
11
|
+
cells[i] = emptyCell();
|
|
12
|
+
return {
|
|
13
|
+
width: w,
|
|
14
|
+
height: h,
|
|
15
|
+
cells,
|
|
16
|
+
backdropColor: backdropColor ?? OPAQUE_BLACK,
|
|
17
|
+
opacityStack: [],
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export function setBackdropColor(buf, color) {
|
|
21
|
+
buf.backdropColor = { ...color, a: 1 };
|
|
22
|
+
}
|
|
23
|
+
export function pushOpacity(buf, opacity) {
|
|
24
|
+
buf.opacityStack.push(Math.max(0, Math.min(1, opacity)));
|
|
25
|
+
}
|
|
26
|
+
export function popOpacity(buf) {
|
|
27
|
+
buf.opacityStack.pop();
|
|
28
|
+
}
|
|
29
|
+
export function effectiveOpacity(buf) {
|
|
30
|
+
let o = 1;
|
|
31
|
+
for (const v of buf.opacityStack)
|
|
32
|
+
o *= v;
|
|
33
|
+
return o;
|
|
34
|
+
}
|
|
35
|
+
function bufferRect(buf) {
|
|
36
|
+
return { x: 0, y: 0, width: buf.width, height: buf.height };
|
|
37
|
+
}
|
|
38
|
+
function hasDecoration(style) {
|
|
39
|
+
return style.reverse || style.underline || style.bold || style.italic || style.dim ||
|
|
40
|
+
style.strikethrough || style.blink || style.link !== undefined;
|
|
41
|
+
}
|
|
42
|
+
function getIndex(buf, x, y) {
|
|
43
|
+
return y * buf.width + x;
|
|
44
|
+
}
|
|
45
|
+
export function getCell(buf, x, y) {
|
|
46
|
+
return buf.cells[getIndex(buf, x, y)];
|
|
47
|
+
}
|
|
48
|
+
export function compositeCell(buf, x, y, incoming, opacity = 1) {
|
|
49
|
+
if (x < 0 || x >= buf.width || y < 0 || y >= buf.height)
|
|
50
|
+
return;
|
|
51
|
+
if (incoming.width === 0)
|
|
52
|
+
return;
|
|
53
|
+
const existing = buf.cells[getIndex(buf, x, y)];
|
|
54
|
+
const incomingBg = opacity < 1 ? withOpacity(incoming.style.bg, opacity) : incoming.style.bg;
|
|
55
|
+
const incomingFg = opacity < 1 ? withOpacity(incoming.style.fg, opacity) : incoming.style.fg;
|
|
56
|
+
let newBg;
|
|
57
|
+
if (incomingBg.a <= 0) {
|
|
58
|
+
newBg = existing.style.bg;
|
|
59
|
+
}
|
|
60
|
+
else if (incomingBg.a >= 1) {
|
|
61
|
+
newBg = incomingBg;
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
const baseBg = existing.style.bg.a <= 0 ? buf.backdropColor : existing.style.bg;
|
|
65
|
+
newBg = blendOver(incomingBg, baseBg);
|
|
66
|
+
}
|
|
67
|
+
const isTransparentSpace = incoming.grapheme === ' ' && incomingBg.a < 1 && !hasDecoration(incoming.style);
|
|
68
|
+
if (isTransparentSpace) {
|
|
69
|
+
existing.style = { ...existing.style, bg: newBg };
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const newStyle = {
|
|
73
|
+
...incoming.style,
|
|
74
|
+
fg: incomingFg,
|
|
75
|
+
bg: newBg,
|
|
76
|
+
};
|
|
77
|
+
buf.cells[getIndex(buf, x, y)] = {
|
|
78
|
+
grapheme: incoming.grapheme,
|
|
79
|
+
width: incoming.width,
|
|
80
|
+
style: newStyle,
|
|
81
|
+
};
|
|
82
|
+
if (incoming.width === 2 && x + 1 < buf.width) {
|
|
83
|
+
const cont = continuationCell();
|
|
84
|
+
cont.style = newStyle;
|
|
85
|
+
buf.cells[getIndex(buf, x + 1, y)] = cont;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
export function fillBackground(buf, rect, color, clip) {
|
|
89
|
+
if (color.a <= 0)
|
|
90
|
+
return;
|
|
91
|
+
const opacity = effectiveOpacity(buf);
|
|
92
|
+
const tinted = opacity < 1 ? withOpacity(color, opacity) : color;
|
|
93
|
+
if (tinted.a <= 0)
|
|
94
|
+
return;
|
|
95
|
+
const safe = intersectRect(intersectRect(rect, clip), bufferRect(buf));
|
|
96
|
+
if (isEmptyRect(safe))
|
|
97
|
+
return;
|
|
98
|
+
for (let y = safe.y; y < safe.y + safe.height; y++) {
|
|
99
|
+
for (let x = safe.x; x < safe.x + safe.width; x++) {
|
|
100
|
+
const cell = buf.cells[getIndex(buf, x, y)];
|
|
101
|
+
const baseBg = cell.style.bg.a <= 0 ? buf.backdropColor : cell.style.bg;
|
|
102
|
+
cell.style = { ...cell.style, bg: blendOver(tinted, baseBg) };
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
export function writeCells(buf, x, y, cells, clip) {
|
|
107
|
+
if (cells.length === 0)
|
|
108
|
+
return;
|
|
109
|
+
const safe = intersectRect(clip, bufferRect(buf));
|
|
110
|
+
if (isEmptyRect(safe))
|
|
111
|
+
return;
|
|
112
|
+
if (y < safe.y || y >= safe.y + safe.height)
|
|
113
|
+
return;
|
|
114
|
+
const opacity = effectiveOpacity(buf);
|
|
115
|
+
let col = x;
|
|
116
|
+
for (let i = 0; i < cells.length; i++) {
|
|
117
|
+
const cell = cells[i];
|
|
118
|
+
if (cell.width === 0)
|
|
119
|
+
continue;
|
|
120
|
+
if (col >= safe.x + safe.width)
|
|
121
|
+
break;
|
|
122
|
+
if (cell.width === 2) {
|
|
123
|
+
if (col + 1 >= safe.x + safe.width || col < safe.x) {
|
|
124
|
+
if (col >= safe.x && col < safe.x + safe.width) {
|
|
125
|
+
const sub = {
|
|
126
|
+
grapheme: ' ',
|
|
127
|
+
width: 1,
|
|
128
|
+
style: cell.style,
|
|
129
|
+
};
|
|
130
|
+
compositeCell(buf, col, y, sub, opacity);
|
|
131
|
+
}
|
|
132
|
+
col += cell.width;
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
if (col >= safe.x) {
|
|
137
|
+
compositeCell(buf, col, y, cell, opacity);
|
|
138
|
+
}
|
|
139
|
+
col += cell.width;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
export function drawBorderCells(buf, rect, style, clip) {
|
|
143
|
+
if (rect.width <= 0 || rect.height <= 0)
|
|
144
|
+
return;
|
|
145
|
+
const safe = intersectRect(clip, bufferRect(buf));
|
|
146
|
+
if (isEmptyRect(safe))
|
|
147
|
+
return;
|
|
148
|
+
const resolved = resolveBorder(style);
|
|
149
|
+
const chars = resolved.chars;
|
|
150
|
+
const top = rect.y;
|
|
151
|
+
const bottom = rect.y + rect.height - 1;
|
|
152
|
+
const left = rect.x;
|
|
153
|
+
const right = rect.x + rect.width - 1;
|
|
154
|
+
const drawAt = (x, y, grapheme) => {
|
|
155
|
+
if (x < safe.x || x >= safe.x + safe.width)
|
|
156
|
+
return;
|
|
157
|
+
if (y < safe.y || y >= safe.y + safe.height)
|
|
158
|
+
return;
|
|
159
|
+
const cell = { grapheme, width: 1, style: defaultStyle() };
|
|
160
|
+
compositeCell(buf, x, y, cell);
|
|
161
|
+
};
|
|
162
|
+
if (resolved.top && rect.height >= 1) {
|
|
163
|
+
for (let x = left; x <= right; x++) {
|
|
164
|
+
let ch = chars.horizontal;
|
|
165
|
+
if (x === left && resolved.left)
|
|
166
|
+
ch = chars.topLeft;
|
|
167
|
+
else if (x === right && resolved.right)
|
|
168
|
+
ch = chars.topRight;
|
|
169
|
+
drawAt(x, top, ch);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
if (resolved.bottom && rect.height >= 2) {
|
|
173
|
+
for (let x = left; x <= right; x++) {
|
|
174
|
+
let ch = chars.horizontal;
|
|
175
|
+
if (x === left && resolved.left)
|
|
176
|
+
ch = chars.bottomLeft;
|
|
177
|
+
else if (x === right && resolved.right)
|
|
178
|
+
ch = chars.bottomRight;
|
|
179
|
+
drawAt(x, bottom, ch);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
if (resolved.left && rect.width >= 1) {
|
|
183
|
+
const startY = resolved.top ? top + 1 : top;
|
|
184
|
+
const endY = resolved.bottom ? bottom - 1 : bottom;
|
|
185
|
+
for (let y = startY; y <= endY; y++)
|
|
186
|
+
drawAt(left, y, chars.vertical);
|
|
187
|
+
}
|
|
188
|
+
if (resolved.right && rect.width >= 2) {
|
|
189
|
+
const startY = resolved.top ? top + 1 : top;
|
|
190
|
+
const endY = resolved.bottom ? bottom - 1 : bottom;
|
|
191
|
+
for (let y = startY; y <= endY; y++)
|
|
192
|
+
drawAt(right, y, chars.vertical);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
export function cellBufferToLines(buf) {
|
|
196
|
+
const lines = new Array(buf.height);
|
|
197
|
+
for (let y = 0; y < buf.height; y++) {
|
|
198
|
+
const row = new Array(buf.width);
|
|
199
|
+
for (let x = 0; x < buf.width; x++) {
|
|
200
|
+
row[x] = finalizeCell(buf, buf.cells[getIndex(buf, x, y)]);
|
|
201
|
+
}
|
|
202
|
+
lines[y] = cellsToAnsi(row);
|
|
203
|
+
}
|
|
204
|
+
return lines;
|
|
205
|
+
}
|
|
206
|
+
function finalizeCell(buf, cell) {
|
|
207
|
+
const bg = cell.style.bg;
|
|
208
|
+
if (bg.a >= 1)
|
|
209
|
+
return cell;
|
|
210
|
+
if (bg.a <= 0)
|
|
211
|
+
return cell;
|
|
212
|
+
return {
|
|
213
|
+
grapheme: cell.grapheme,
|
|
214
|
+
width: cell.width,
|
|
215
|
+
style: { ...cell.style, bg: blendOver(bg, buf.backdropColor) },
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
function resolveBorder(style) {
|
|
219
|
+
if (style === true) {
|
|
220
|
+
return { top: true, right: true, bottom: true, left: true, chars: DEFAULT_BORDER_CHARS };
|
|
221
|
+
}
|
|
222
|
+
return {
|
|
223
|
+
top: style.top !== false,
|
|
224
|
+
right: style.right !== false,
|
|
225
|
+
bottom: style.bottom !== false,
|
|
226
|
+
left: style.left !== false,
|
|
227
|
+
chars: style.chars ?? DEFAULT_BORDER_CHARS,
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
function cellIsBlank(cell) {
|
|
231
|
+
if (cell.grapheme !== ' ' && cell.grapheme !== '')
|
|
232
|
+
return false;
|
|
233
|
+
const s = cell.style;
|
|
234
|
+
if (s.bold || s.dim || s.italic || s.underline || s.strikethrough || s.reverse || s.blink || s.link !== undefined) {
|
|
235
|
+
return false;
|
|
236
|
+
}
|
|
237
|
+
if (s.fg.intent !== 'default')
|
|
238
|
+
return false;
|
|
239
|
+
if (s.bg.intent !== 'default' && s.bg.a > 0)
|
|
240
|
+
return false;
|
|
241
|
+
return true;
|
|
242
|
+
}
|
|
243
|
+
function isBlankRow(buf, y) {
|
|
244
|
+
const base = y * buf.width;
|
|
245
|
+
for (let x = 0; x < buf.width; x++) {
|
|
246
|
+
if (!cellIsBlank(buf.cells[base + x]))
|
|
247
|
+
return false;
|
|
248
|
+
}
|
|
249
|
+
return true;
|
|
250
|
+
}
|
|
251
|
+
export function bufferUsedHeight(buf) {
|
|
252
|
+
for (let y = buf.height - 1; y >= 0; y--) {
|
|
253
|
+
if (!isBlankRow(buf, y))
|
|
254
|
+
return y + 1;
|
|
255
|
+
}
|
|
256
|
+
return 0;
|
|
257
|
+
}
|
|
258
|
+
export function diffBuffer(prev, next, maxRow, mergeGap = 4) {
|
|
259
|
+
const runs = [];
|
|
260
|
+
const width = next.width;
|
|
261
|
+
const rows = Math.min(maxRow, next.height);
|
|
262
|
+
for (let y = 0; y < rows; y++) {
|
|
263
|
+
const base = y * width;
|
|
264
|
+
if (isBlankRow(next, y)) {
|
|
265
|
+
if (!isBlankRow(prev, y))
|
|
266
|
+
runs.push({ y, x: 0, cells: [], clear: true });
|
|
267
|
+
continue;
|
|
268
|
+
}
|
|
269
|
+
let x = 0;
|
|
270
|
+
let prevEnd = 0;
|
|
271
|
+
while (x < width) {
|
|
272
|
+
if (cellEqual(prev.cells[base + x], next.cells[base + x])) {
|
|
273
|
+
x++;
|
|
274
|
+
continue;
|
|
275
|
+
}
|
|
276
|
+
let start = x;
|
|
277
|
+
while (start > prevEnd && next.cells[base + start].width === 0)
|
|
278
|
+
start--;
|
|
279
|
+
let lastChange = x;
|
|
280
|
+
let gap = 0;
|
|
281
|
+
let xi = x + 1;
|
|
282
|
+
while (xi < width) {
|
|
283
|
+
if (!cellEqual(prev.cells[base + xi], next.cells[base + xi])) {
|
|
284
|
+
lastChange = xi;
|
|
285
|
+
gap = 0;
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
gap++;
|
|
289
|
+
if (gap > mergeGap)
|
|
290
|
+
break;
|
|
291
|
+
}
|
|
292
|
+
xi++;
|
|
293
|
+
}
|
|
294
|
+
let end = lastChange + 1;
|
|
295
|
+
if (end < width && next.cells[base + end].width === 0)
|
|
296
|
+
end++;
|
|
297
|
+
const cells = [];
|
|
298
|
+
for (let i = start; i < end; i++)
|
|
299
|
+
cells.push(finalizeCell(next, next.cells[base + i]));
|
|
300
|
+
runs.push({ y, x: start, cells });
|
|
301
|
+
prevEnd = end;
|
|
302
|
+
x = end;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
return runs;
|
|
306
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Color } from './types';
|
|
2
|
+
export type ColorIntent = 'rgb' | 'indexed' | 'default';
|
|
3
|
+
export interface Rgba {
|
|
4
|
+
r: number;
|
|
5
|
+
g: number;
|
|
6
|
+
b: number;
|
|
7
|
+
a: number;
|
|
8
|
+
intent: ColorIntent;
|
|
9
|
+
index?: number;
|
|
10
|
+
}
|
|
11
|
+
export declare const DEFAULT_FG: Rgba;
|
|
12
|
+
export declare const DEFAULT_BG: Rgba;
|
|
13
|
+
export declare const TRANSPARENT: Rgba;
|
|
14
|
+
export declare const OPAQUE_BLACK: Rgba;
|
|
15
|
+
export declare function colorToRgba(color: Color, alpha?: number): Rgba;
|
|
16
|
+
export declare function indexedColor(index: number, alpha?: number): Rgba;
|
|
17
|
+
export declare function rgbColor(r: number, g: number, b: number, alpha?: number): Rgba;
|
|
18
|
+
export declare function blendOver(front: Rgba, back: Rgba): Rgba;
|
|
19
|
+
export declare function withOpacity(color: Rgba, opacity: number): Rgba;
|
|
20
|
+
export declare function rgbaEqual(a: Rgba, b: Rgba): boolean;
|
|
21
|
+
export declare function rgbaToSgr(color: Rgba, layer: 'fg' | 'bg'): string;
|
|
22
|
+
export declare function palette256(index: number): [number, number, number];
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
export const DEFAULT_FG = { r: 200, g: 200, b: 200, a: 1, intent: 'default' };
|
|
2
|
+
export const DEFAULT_BG = { r: 0, g: 0, b: 0, a: 0, intent: 'default' };
|
|
3
|
+
export const TRANSPARENT = { r: 0, g: 0, b: 0, a: 0, intent: 'rgb' };
|
|
4
|
+
export const OPAQUE_BLACK = { r: 0, g: 0, b: 0, a: 1, intent: 'rgb' };
|
|
5
|
+
const NAMED_COLOR_INDEX = {
|
|
6
|
+
black: 0,
|
|
7
|
+
red: 1,
|
|
8
|
+
green: 2,
|
|
9
|
+
yellow: 3,
|
|
10
|
+
blue: 4,
|
|
11
|
+
magenta: 5,
|
|
12
|
+
cyan: 6,
|
|
13
|
+
white: 7,
|
|
14
|
+
brightBlack: 8,
|
|
15
|
+
brightRed: 9,
|
|
16
|
+
brightGreen: 10,
|
|
17
|
+
brightYellow: 11,
|
|
18
|
+
brightBlue: 12,
|
|
19
|
+
brightMagenta: 13,
|
|
20
|
+
brightCyan: 14,
|
|
21
|
+
brightWhite: 15,
|
|
22
|
+
};
|
|
23
|
+
const ANSI_16_RGB = [
|
|
24
|
+
[0, 0, 0],
|
|
25
|
+
[170, 0, 0],
|
|
26
|
+
[0, 170, 0],
|
|
27
|
+
[170, 85, 0],
|
|
28
|
+
[0, 0, 170],
|
|
29
|
+
[170, 0, 170],
|
|
30
|
+
[0, 170, 170],
|
|
31
|
+
[170, 170, 170],
|
|
32
|
+
[85, 85, 85],
|
|
33
|
+
[255, 85, 85],
|
|
34
|
+
[85, 255, 85],
|
|
35
|
+
[255, 255, 85],
|
|
36
|
+
[85, 85, 255],
|
|
37
|
+
[255, 85, 255],
|
|
38
|
+
[85, 255, 255],
|
|
39
|
+
[255, 255, 255],
|
|
40
|
+
];
|
|
41
|
+
export function colorToRgba(color, alpha = 1) {
|
|
42
|
+
if (color === 'default') {
|
|
43
|
+
return { ...DEFAULT_FG, a: alpha };
|
|
44
|
+
}
|
|
45
|
+
if (typeof color === 'string' && color.startsWith('#')) {
|
|
46
|
+
const parsed = parseHex(color);
|
|
47
|
+
if (parsed)
|
|
48
|
+
return { ...parsed, a: alpha * parsed.a };
|
|
49
|
+
}
|
|
50
|
+
const index = NAMED_COLOR_INDEX[color];
|
|
51
|
+
if (index !== undefined) {
|
|
52
|
+
const [r, g, b] = ANSI_16_RGB[index];
|
|
53
|
+
return { r, g, b, a: alpha, intent: 'indexed', index };
|
|
54
|
+
}
|
|
55
|
+
return { ...TRANSPARENT };
|
|
56
|
+
}
|
|
57
|
+
export function indexedColor(index, alpha = 1) {
|
|
58
|
+
const [r, g, b] = palette256(index);
|
|
59
|
+
return { r, g, b, a: alpha, intent: 'indexed', index };
|
|
60
|
+
}
|
|
61
|
+
export function rgbColor(r, g, b, alpha = 1) {
|
|
62
|
+
return { r, g, b, a: alpha, intent: 'rgb' };
|
|
63
|
+
}
|
|
64
|
+
export function blendOver(front, back) {
|
|
65
|
+
if (front.a <= 0)
|
|
66
|
+
return back;
|
|
67
|
+
if (front.a >= 1)
|
|
68
|
+
return front;
|
|
69
|
+
const fa = front.a;
|
|
70
|
+
const ba = back.a;
|
|
71
|
+
const outA = fa + ba * (1 - fa);
|
|
72
|
+
if (outA <= 0)
|
|
73
|
+
return { ...TRANSPARENT };
|
|
74
|
+
const r = (front.r * fa + back.r * ba * (1 - fa)) / outA;
|
|
75
|
+
const g = (front.g * fa + back.g * ba * (1 - fa)) / outA;
|
|
76
|
+
const b = (front.b * fa + back.b * ba * (1 - fa)) / outA;
|
|
77
|
+
const intent = front.intent === back.intent ? front.intent : 'rgb';
|
|
78
|
+
return {
|
|
79
|
+
r: Math.round(r),
|
|
80
|
+
g: Math.round(g),
|
|
81
|
+
b: Math.round(b),
|
|
82
|
+
a: outA,
|
|
83
|
+
intent,
|
|
84
|
+
index: intent === 'indexed' ? (front.index ?? back.index) : undefined,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
export function withOpacity(color, opacity) {
|
|
88
|
+
if (opacity >= 1)
|
|
89
|
+
return color;
|
|
90
|
+
if (opacity <= 0)
|
|
91
|
+
return { ...color, a: 0 };
|
|
92
|
+
return { ...color, a: color.a * opacity };
|
|
93
|
+
}
|
|
94
|
+
export function rgbaEqual(a, b) {
|
|
95
|
+
return (a.r === b.r &&
|
|
96
|
+
a.g === b.g &&
|
|
97
|
+
a.b === b.b &&
|
|
98
|
+
a.a === b.a &&
|
|
99
|
+
a.intent === b.intent &&
|
|
100
|
+
a.index === b.index);
|
|
101
|
+
}
|
|
102
|
+
export function rgbaToSgr(color, layer) {
|
|
103
|
+
if (color.intent === 'default') {
|
|
104
|
+
return layer === 'fg' ? '39' : '49';
|
|
105
|
+
}
|
|
106
|
+
if (color.intent === 'indexed' && color.index !== undefined && color.a >= 1) {
|
|
107
|
+
if (color.index < 16) {
|
|
108
|
+
const base = layer === 'fg' ? 30 : 40;
|
|
109
|
+
return color.index < 8 ? `${base + color.index}` : `${base + 60 + (color.index - 8)}`;
|
|
110
|
+
}
|
|
111
|
+
return `${layer === 'fg' ? 38 : 48};5;${color.index}`;
|
|
112
|
+
}
|
|
113
|
+
return `${layer === 'fg' ? 38 : 48};2;${color.r};${color.g};${color.b}`;
|
|
114
|
+
}
|
|
115
|
+
function parseHex(hex) {
|
|
116
|
+
const body = hex.slice(1);
|
|
117
|
+
if (/^[0-9a-fA-F]{3}$/.test(body)) {
|
|
118
|
+
return {
|
|
119
|
+
r: Number.parseInt(body[0] + body[0], 16),
|
|
120
|
+
g: Number.parseInt(body[1] + body[1], 16),
|
|
121
|
+
b: Number.parseInt(body[2] + body[2], 16),
|
|
122
|
+
a: 1,
|
|
123
|
+
intent: 'rgb',
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
if (/^[0-9a-fA-F]{6}$/.test(body)) {
|
|
127
|
+
return {
|
|
128
|
+
r: Number.parseInt(body.slice(0, 2), 16),
|
|
129
|
+
g: Number.parseInt(body.slice(2, 4), 16),
|
|
130
|
+
b: Number.parseInt(body.slice(4, 6), 16),
|
|
131
|
+
a: 1,
|
|
132
|
+
intent: 'rgb',
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
if (/^[0-9a-fA-F]{8}$/.test(body)) {
|
|
136
|
+
return {
|
|
137
|
+
r: Number.parseInt(body.slice(0, 2), 16),
|
|
138
|
+
g: Number.parseInt(body.slice(2, 4), 16),
|
|
139
|
+
b: Number.parseInt(body.slice(4, 6), 16),
|
|
140
|
+
a: Number.parseInt(body.slice(6, 8), 16) / 255,
|
|
141
|
+
intent: 'rgb',
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
return undefined;
|
|
145
|
+
}
|
|
146
|
+
export function palette256(index) {
|
|
147
|
+
if (index < 0 || index > 255)
|
|
148
|
+
return [0, 0, 0];
|
|
149
|
+
if (index < 16)
|
|
150
|
+
return ANSI_16_RGB[index];
|
|
151
|
+
if (index < 232) {
|
|
152
|
+
const i = index - 16;
|
|
153
|
+
const r = Math.floor(i / 36);
|
|
154
|
+
const g = Math.floor((i % 36) / 6);
|
|
155
|
+
const b = i % 6;
|
|
156
|
+
return [step6(r), step6(g), step6(b)];
|
|
157
|
+
}
|
|
158
|
+
const v = 8 + (index - 232) * 10;
|
|
159
|
+
return [v, v, v];
|
|
160
|
+
}
|
|
161
|
+
function step6(v) {
|
|
162
|
+
return v === 0 ? 0 : 55 + v * 40;
|
|
163
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { BorderStyle, Insets, Rect } from './types';
|
|
2
|
+
export declare function normalizeInsets(input?: number | Partial<Insets>): Insets;
|
|
3
|
+
export declare function borderInsets(border?: boolean | BorderStyle): Insets;
|
|
4
|
+
export declare function shrinkRect(rect: Rect, insets: Insets): Rect;
|
|
5
|
+
export declare function intersectRect(a: Rect, b: Rect): Rect;
|
|
6
|
+
export declare function containsPoint(rect: Rect, x: number, y: number): boolean;
|
|
7
|
+
export declare function isEmptyRect(rect: Rect): boolean;
|
|
8
|
+
export declare function insetsForAxis(insets: Insets, axis: 'width' | 'height'): number;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
const ZERO_INSETS = { top: 0, right: 0, bottom: 0, left: 0 };
|
|
2
|
+
export function normalizeInsets(input) {
|
|
3
|
+
if (input === undefined)
|
|
4
|
+
return { ...ZERO_INSETS };
|
|
5
|
+
if (typeof input === 'number') {
|
|
6
|
+
return { top: input, right: input, bottom: input, left: input };
|
|
7
|
+
}
|
|
8
|
+
return {
|
|
9
|
+
top: input.top ?? 0,
|
|
10
|
+
right: input.right ?? 0,
|
|
11
|
+
bottom: input.bottom ?? 0,
|
|
12
|
+
left: input.left ?? 0,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export function borderInsets(border) {
|
|
16
|
+
if (!border)
|
|
17
|
+
return { ...ZERO_INSETS };
|
|
18
|
+
if (border === true) {
|
|
19
|
+
return { top: 1, right: 1, bottom: 1, left: 1 };
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
top: border.top === false ? 0 : 1,
|
|
23
|
+
right: border.right === false ? 0 : 1,
|
|
24
|
+
bottom: border.bottom === false ? 0 : 1,
|
|
25
|
+
left: border.left === false ? 0 : 1,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export function shrinkRect(rect, insets) {
|
|
29
|
+
const x = rect.x + insets.left;
|
|
30
|
+
const y = rect.y + insets.top;
|
|
31
|
+
const width = Math.max(0, rect.width - insets.left - insets.right);
|
|
32
|
+
const height = Math.max(0, rect.height - insets.top - insets.bottom);
|
|
33
|
+
return { x, y, width, height };
|
|
34
|
+
}
|
|
35
|
+
export function intersectRect(a, b) {
|
|
36
|
+
const x = Math.max(a.x, b.x);
|
|
37
|
+
const y = Math.max(a.y, b.y);
|
|
38
|
+
const right = Math.min(a.x + a.width, b.x + b.width);
|
|
39
|
+
const bottom = Math.min(a.y + a.height, b.y + b.height);
|
|
40
|
+
return {
|
|
41
|
+
x,
|
|
42
|
+
y,
|
|
43
|
+
width: Math.max(0, right - x),
|
|
44
|
+
height: Math.max(0, bottom - y),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export function containsPoint(rect, x, y) {
|
|
48
|
+
return x >= rect.x && x < rect.x + rect.width && y >= rect.y && y < rect.y + rect.height;
|
|
49
|
+
}
|
|
50
|
+
export function isEmptyRect(rect) {
|
|
51
|
+
return rect.width <= 0 || rect.height <= 0;
|
|
52
|
+
}
|
|
53
|
+
export function insetsForAxis(insets, axis) {
|
|
54
|
+
return axis === 'width' ? insets.left + insets.right : insets.top + insets.bottom;
|
|
55
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface Rect {
|
|
2
|
+
readonly x: number;
|
|
3
|
+
readonly y: number;
|
|
4
|
+
readonly width: number;
|
|
5
|
+
readonly height: number;
|
|
6
|
+
}
|
|
7
|
+
export interface Insets {
|
|
8
|
+
readonly top: number;
|
|
9
|
+
readonly right: number;
|
|
10
|
+
readonly bottom: number;
|
|
11
|
+
readonly left: number;
|
|
12
|
+
}
|
|
13
|
+
export interface Size {
|
|
14
|
+
readonly width: number;
|
|
15
|
+
readonly height: number;
|
|
16
|
+
}
|
|
17
|
+
export type Color = `#${string}` | 'default' | 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'brightBlack' | 'brightRed' | 'brightGreen' | 'brightYellow' | 'brightBlue' | 'brightMagenta' | 'brightCyan' | 'brightWhite';
|
|
18
|
+
export interface BorderChars {
|
|
19
|
+
horizontal: string;
|
|
20
|
+
vertical: string;
|
|
21
|
+
topLeft: string;
|
|
22
|
+
topRight: string;
|
|
23
|
+
bottomLeft: string;
|
|
24
|
+
bottomRight: string;
|
|
25
|
+
}
|
|
26
|
+
export interface BorderStyle {
|
|
27
|
+
top?: boolean;
|
|
28
|
+
right?: boolean;
|
|
29
|
+
bottom?: boolean;
|
|
30
|
+
left?: boolean;
|
|
31
|
+
chars?: BorderChars;
|
|
32
|
+
}
|
|
33
|
+
export declare const DEFAULT_BORDER_CHARS: BorderChars;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { InputEvent } from './events';
|
|
2
|
+
export interface TerminalInputParserOptions {
|
|
3
|
+
maxBufferBytes?: number;
|
|
4
|
+
maxPasteBytes?: number;
|
|
5
|
+
}
|
|
6
|
+
export declare class TerminalInputParser {
|
|
7
|
+
private readonly options;
|
|
8
|
+
private buffer;
|
|
9
|
+
private paste;
|
|
10
|
+
private inPaste;
|
|
11
|
+
private pasteOverflowed;
|
|
12
|
+
constructor(options?: TerminalInputParserOptions);
|
|
13
|
+
feed(data: string): InputEvent[];
|
|
14
|
+
flushPending(): InputEvent[];
|
|
15
|
+
hasPending(): boolean;
|
|
16
|
+
private get maxBufferBytes();
|
|
17
|
+
private get maxPasteBytes();
|
|
18
|
+
}
|