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,24 @@
|
|
|
1
|
+
import { appendFile, mkdir, readFile, rm } from 'node:fs/promises';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
const EXT = '.jsonl';
|
|
4
|
+
const fileFor = (dir, id) => {
|
|
5
|
+
if (!/^[\w-]+$/.test(id))
|
|
6
|
+
throw new Error(`SessionStore: invalid session id "${id}"`);
|
|
7
|
+
return join(dir, `${id}${EXT}`);
|
|
8
|
+
};
|
|
9
|
+
export const createSessionStore = ({ dir }) => ({
|
|
10
|
+
load: async (id) => {
|
|
11
|
+
const raw = await readFile(fileFor(dir, id), 'utf-8');
|
|
12
|
+
const messages = raw.split('\n').filter(Boolean).map((line) => JSON.parse(line));
|
|
13
|
+
return { id, messages };
|
|
14
|
+
},
|
|
15
|
+
append: async (id, messages) => {
|
|
16
|
+
if (messages.length === 0)
|
|
17
|
+
return;
|
|
18
|
+
await mkdir(dir, { recursive: true });
|
|
19
|
+
await appendFile(fileFor(dir, id), messages.map((message) => `${JSON.stringify(message)}\n`).join(''));
|
|
20
|
+
},
|
|
21
|
+
delete: async (id) => {
|
|
22
|
+
await rm(fileFor(dir, id), { force: true });
|
|
23
|
+
},
|
|
24
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const titleFallback: (text: string, max?: number) => string;
|
|
2
|
+
export declare const cleanTitle: (raw: string, max?: number) => string;
|
|
3
|
+
export interface RunTitlerOptions {
|
|
4
|
+
id: string;
|
|
5
|
+
text: string;
|
|
6
|
+
setTitle(id: string, title: string): void | Promise<void>;
|
|
7
|
+
generate(text: string): Promise<string>;
|
|
8
|
+
}
|
|
9
|
+
export declare const runTitler: (options: RunTitlerOptions) => Promise<void>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export const titleFallback = (text, max = 50) => {
|
|
2
|
+
const clean = text.replace(/\s+/g, ' ').trim();
|
|
3
|
+
return clean.length > max ? `${clean.slice(0, max - 1)}…` : clean;
|
|
4
|
+
};
|
|
5
|
+
export const cleanTitle = (raw, max = 60) => {
|
|
6
|
+
const line = raw
|
|
7
|
+
.replace(/<think>[\s\S]*?<\/think>/g, '')
|
|
8
|
+
.split('\n')
|
|
9
|
+
.map((entry) => entry.trim())
|
|
10
|
+
.find((entry) => entry.length > 0) ?? '';
|
|
11
|
+
const unquoted = line.replace(/^["'`]+|["'`]+$/g, '').trim();
|
|
12
|
+
return unquoted.length > max ? `${unquoted.slice(0, max - 1)}…` : unquoted;
|
|
13
|
+
};
|
|
14
|
+
export const runTitler = async (options) => {
|
|
15
|
+
await options.setTitle(options.id, titleFallback(options.text));
|
|
16
|
+
try {
|
|
17
|
+
const title = cleanTitle(await options.generate(options.text));
|
|
18
|
+
if (title)
|
|
19
|
+
await options.setTitle(options.id, title);
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
// keep the fallback
|
|
23
|
+
}
|
|
24
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ContentPart, LoopEvent, Message } from 'mu-core';
|
|
2
|
+
export type AgentSessionEvent = {
|
|
3
|
+
type: 'turn_start';
|
|
4
|
+
input: Message;
|
|
5
|
+
} | LoopEvent | {
|
|
6
|
+
type: 'turn_end';
|
|
7
|
+
} | {
|
|
8
|
+
type: 'error';
|
|
9
|
+
error: unknown;
|
|
10
|
+
};
|
|
11
|
+
export interface AgentSession {
|
|
12
|
+
readonly id: string;
|
|
13
|
+
readonly messages: readonly Message[];
|
|
14
|
+
send(input: string | ContentPart[]): Promise<void>;
|
|
15
|
+
abort(): void;
|
|
16
|
+
subscribe(listener: (event: AgentSessionEvent) => void): () => void;
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type { Skill } from './types.js';
|
|
2
|
+
export { createSkillRegistry, type SkillRegistry } from './registry.js';
|
|
3
|
+
export { parseSkill } from './parser.js';
|
|
4
|
+
export { loadSkills } from './loader.js';
|
|
5
|
+
export { createSkillTool } from './tool.js';
|
|
6
|
+
export { createSkillWriterTool } from './writer.js';
|
|
7
|
+
export { createRunSkillTool, runSkill, type RunSkillDeps } from './run.js';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { createSkillRegistry } from './registry.js';
|
|
2
|
+
export { parseSkill } from './parser.js';
|
|
3
|
+
export { loadSkills } from './loader.js';
|
|
4
|
+
export { createSkillTool } from './tool.js';
|
|
5
|
+
export { createSkillWriterTool } from './writer.js';
|
|
6
|
+
export { createRunSkillTool, runSkill } from './run.js';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { readdir, readFile, stat } from 'node:fs/promises';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { parseSkill } from './parser.js';
|
|
4
|
+
export const loadSkills = async (dir) => {
|
|
5
|
+
let entries;
|
|
6
|
+
try {
|
|
7
|
+
entries = await readdir(dir);
|
|
8
|
+
}
|
|
9
|
+
catch {
|
|
10
|
+
return [];
|
|
11
|
+
}
|
|
12
|
+
const skills = [];
|
|
13
|
+
for (const entry of entries.sort()) {
|
|
14
|
+
const skillDir = join(dir, entry);
|
|
15
|
+
try {
|
|
16
|
+
if (!(await stat(skillDir)).isDirectory())
|
|
17
|
+
continue;
|
|
18
|
+
const source = await readFile(join(skillDir, 'SKILL.md'), 'utf-8');
|
|
19
|
+
skills.push(parseSkill(source, entry, skillDir));
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return skills;
|
|
26
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { parseFrontmatter, str } from '../common/index.js';
|
|
2
|
+
export const parseSkill = (source, fallbackName, dir) => {
|
|
3
|
+
const { fields, body } = parseFrontmatter(source);
|
|
4
|
+
return {
|
|
5
|
+
name: str(fields.name) ?? fallbackName,
|
|
6
|
+
description: str(fields.description) ?? '',
|
|
7
|
+
prompt: body,
|
|
8
|
+
dir,
|
|
9
|
+
};
|
|
10
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Skill } from './types.js';
|
|
2
|
+
export interface SkillRegistry {
|
|
3
|
+
list(): Skill[];
|
|
4
|
+
get(name: string): Skill | undefined;
|
|
5
|
+
add(skill: Skill): void;
|
|
6
|
+
select(names: string[]): SkillRegistry;
|
|
7
|
+
}
|
|
8
|
+
export declare const createSkillRegistry: (skills?: Skill[]) => SkillRegistry;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const createSkillRegistry = (skills = []) => {
|
|
2
|
+
const byName = new Map();
|
|
3
|
+
for (const skill of skills)
|
|
4
|
+
if (!byName.has(skill.name))
|
|
5
|
+
byName.set(skill.name, skill);
|
|
6
|
+
const view = (allow) => ({
|
|
7
|
+
list: () => [...byName.values()].filter((skill) => !allow || allow.has(skill.name)),
|
|
8
|
+
get: (name) => (!allow || allow.has(name) ? byName.get(name) : undefined),
|
|
9
|
+
add: (skill) => {
|
|
10
|
+
byName.set(skill.name, skill);
|
|
11
|
+
allow?.add(skill.name);
|
|
12
|
+
},
|
|
13
|
+
select: (names) => view(new Set(allow ? names.filter((name) => allow.has(name)) : names)),
|
|
14
|
+
});
|
|
15
|
+
return view();
|
|
16
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Tool } from 'mu-core';
|
|
2
|
+
import type { AgentRegistry } from '../agents/index.js';
|
|
3
|
+
import { type RunSubAgentDeps } from '../subAgents/index.js';
|
|
4
|
+
import type { SkillRegistry } from './registry.js';
|
|
5
|
+
export interface RunSkillDeps extends RunSubAgentDeps {
|
|
6
|
+
skills: SkillRegistry;
|
|
7
|
+
agents?: AgentRegistry;
|
|
8
|
+
}
|
|
9
|
+
export declare const runSkill: (deps: RunSkillDeps, args: {
|
|
10
|
+
skill: string;
|
|
11
|
+
task: string;
|
|
12
|
+
agent: string;
|
|
13
|
+
}) => Promise<string>;
|
|
14
|
+
export declare const createRunSkillTool: (deps: RunSkillDeps) => Tool;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { runSubAgent } from '../subAgents/index.js';
|
|
2
|
+
export const runSkill = async (deps, args) => {
|
|
3
|
+
const skill = deps.skills.get(args.skill);
|
|
4
|
+
if (!skill)
|
|
5
|
+
throw new Error(`unknown skill "${args.skill}"`);
|
|
6
|
+
const base = deps.agents?.get(args.agent);
|
|
7
|
+
if (!base)
|
|
8
|
+
throw new Error(`unknown agent "${args.agent}"`);
|
|
9
|
+
const agent = {
|
|
10
|
+
name: base.name,
|
|
11
|
+
description: skill.description,
|
|
12
|
+
prompt: [base.prompt, skill.prompt].filter(Boolean).join('\n\n'),
|
|
13
|
+
tools: base.tools,
|
|
14
|
+
model: base.model,
|
|
15
|
+
};
|
|
16
|
+
const result = await runSubAgent(agent, args.task, deps);
|
|
17
|
+
return result.text;
|
|
18
|
+
};
|
|
19
|
+
export const createRunSkillTool = (deps) => ({
|
|
20
|
+
name: 'run_skill',
|
|
21
|
+
description: 'Invoke a sub-agent equipped with a named skill to carry out a specific task. Returns its final answer.',
|
|
22
|
+
prompt: 'To carry out a self-contained task under a skill, call `run_skill` with the skill name, the task, and the agent persona to run it as.',
|
|
23
|
+
parameters: {
|
|
24
|
+
type: 'object',
|
|
25
|
+
properties: {
|
|
26
|
+
skill: { type: 'string', description: 'Skill name to equip the agent with.' },
|
|
27
|
+
task: { type: 'string', description: 'The precise task to carry out.' },
|
|
28
|
+
agent: { type: 'string', description: 'Agent persona to run the skill as (defines its tools).' },
|
|
29
|
+
},
|
|
30
|
+
required: ['skill', 'task', 'agent'],
|
|
31
|
+
additionalProperties: false,
|
|
32
|
+
},
|
|
33
|
+
run: async (input) => {
|
|
34
|
+
const { skill, task, agent } = (input ?? {});
|
|
35
|
+
if (!skill || !task || !agent) {
|
|
36
|
+
return [{ type: 'text', text: 'Error: run_skill requires `skill`, `task`, and `agent`.' }];
|
|
37
|
+
}
|
|
38
|
+
try {
|
|
39
|
+
return [{ type: 'text', text: await runSkill(deps, { skill, task, agent }) }];
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
return [{ type: 'text', text: `Error: ${error instanceof Error ? error.message : String(error)}` }];
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export const createSkillTool = (registry) => ({
|
|
2
|
+
name: 'skill',
|
|
3
|
+
description: "Load a named skill's instructions into the conversation, then follow them.",
|
|
4
|
+
get prompt() {
|
|
5
|
+
const list = registry.list();
|
|
6
|
+
if (!list.length)
|
|
7
|
+
return undefined;
|
|
8
|
+
const catalog = list.map((skill) => `- ${skill.name}${skill.description ? `: ${skill.description}` : ''}`).join('\n');
|
|
9
|
+
return `When a request matches one of these skills, call \`skill\` with its name BEFORE acting, then follow the returned instructions:\n${catalog}`;
|
|
10
|
+
},
|
|
11
|
+
parameters: {
|
|
12
|
+
type: 'object',
|
|
13
|
+
properties: {
|
|
14
|
+
name: { type: 'string', description: 'Skill name.' },
|
|
15
|
+
},
|
|
16
|
+
required: ['name'],
|
|
17
|
+
additionalProperties: false,
|
|
18
|
+
},
|
|
19
|
+
run: async (input) => {
|
|
20
|
+
const { name } = (input ?? {});
|
|
21
|
+
if (!name)
|
|
22
|
+
return [{ type: 'text', text: 'Error: skill requires `name`.' }];
|
|
23
|
+
const skill = registry.get(name);
|
|
24
|
+
if (!skill)
|
|
25
|
+
return [{ type: 'text', text: `Error: unknown skill "${name}".` }];
|
|
26
|
+
const header = skill.dir
|
|
27
|
+
? `Skill "${skill.name}" (bundled files live under ${skill.dir}):\n\n`
|
|
28
|
+
: `Skill "${skill.name}":\n\n`;
|
|
29
|
+
return [{ type: 'text', text: header + skill.prompt }];
|
|
30
|
+
},
|
|
31
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Tool } from 'mu-core';
|
|
2
|
+
import type { SkillRegistry } from './registry.js';
|
|
3
|
+
export type SkillScope = 'local' | 'config';
|
|
4
|
+
export declare const createSkillWriterTool: (deps: {
|
|
5
|
+
dirs: Record<SkillScope, string>;
|
|
6
|
+
registry: SkillRegistry;
|
|
7
|
+
}) => Tool;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { mkdir, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { parseSkill } from './parser.js';
|
|
4
|
+
const slug = (name) => name.trim().toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '');
|
|
5
|
+
export const createSkillWriterTool = (deps) => ({
|
|
6
|
+
name: 'create_skill',
|
|
7
|
+
description: 'Create a reusable skill: a named set of instructions the agent can load on demand later.',
|
|
8
|
+
prompt: 'When you discover a reusable workflow worth keeping, capture it with `create_skill` (name, description, instructions). Use `scope: "local"` for a skill specific to this project, or `scope: "config"` to make it available across all projects. It can then be loaded via `skill`.',
|
|
9
|
+
parameters: {
|
|
10
|
+
type: 'object',
|
|
11
|
+
properties: {
|
|
12
|
+
name: { type: 'string', description: 'Short skill name (kebab-case).' },
|
|
13
|
+
description: { type: 'string', description: 'One line describing when this skill should be used.' },
|
|
14
|
+
instructions: { type: 'string', description: 'The skill body: the instructions to follow when it is invoked.' },
|
|
15
|
+
scope: {
|
|
16
|
+
type: 'string',
|
|
17
|
+
enum: ['local', 'config'],
|
|
18
|
+
description: 'Where to save it: "local" = this project (<cwd>/skills), "config" = global config dir. Defaults to "local".',
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
required: ['name', 'description', 'instructions'],
|
|
22
|
+
additionalProperties: false,
|
|
23
|
+
},
|
|
24
|
+
run: async (input) => {
|
|
25
|
+
const { name, description, instructions, scope } = (input ?? {});
|
|
26
|
+
if (!name || !description || !instructions) {
|
|
27
|
+
return [{ type: 'text', text: 'Error: create_skill requires `name`, `description`, and `instructions`.' }];
|
|
28
|
+
}
|
|
29
|
+
const base = deps.dirs[scope ?? 'local'];
|
|
30
|
+
if (!base)
|
|
31
|
+
return [{ type: 'text', text: `Error: unknown scope "${scope}".` }];
|
|
32
|
+
const id = slug(name);
|
|
33
|
+
if (!id)
|
|
34
|
+
return [{ type: 'text', text: `Error: invalid skill name "${name}".` }];
|
|
35
|
+
const skillDir = join(base, id);
|
|
36
|
+
const file = join(skillDir, 'SKILL.md');
|
|
37
|
+
const source = `---\nname: ${id}\ndescription: ${JSON.stringify(description)}\n---\n\n${instructions.trim()}\n`;
|
|
38
|
+
await mkdir(skillDir, { recursive: true });
|
|
39
|
+
await writeFile(file, source, 'utf-8');
|
|
40
|
+
deps.registry.add(parseSkill(source, id, skillDir));
|
|
41
|
+
return [{ type: 'text', text: `Created skill "${id}" at ${file}. It is now available via the \`skill\` tool.` }];
|
|
42
|
+
},
|
|
43
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export const createSubAgentRegistry = () => {
|
|
2
|
+
const runs = new Map();
|
|
3
|
+
const listeners = new Set();
|
|
4
|
+
return {
|
|
5
|
+
register: (run) => {
|
|
6
|
+
runs.set(run.runId, run);
|
|
7
|
+
for (const listener of listeners)
|
|
8
|
+
listener(run);
|
|
9
|
+
},
|
|
10
|
+
get: (runId) => runs.get(runId),
|
|
11
|
+
list: () => [...runs.values()],
|
|
12
|
+
byParent: (parentId) => [...runs.values()].filter((run) => run.parentId === parentId),
|
|
13
|
+
subscribe: (listener) => {
|
|
14
|
+
listeners.add(listener);
|
|
15
|
+
return () => listeners.delete(listener);
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Agent } from '../agents/index.js';
|
|
2
|
+
import type { AgentSession } from '../session/index.js';
|
|
3
|
+
import type { SubAgentRegistry, SubAgentResult } from './types.js';
|
|
4
|
+
export interface RunSubAgentDeps {
|
|
5
|
+
spawn(agent: Agent): AgentSession;
|
|
6
|
+
/** When provided, the spawned run is registered (so hosts can read/observe it). */
|
|
7
|
+
runs?: SubAgentRegistry;
|
|
8
|
+
/** Parent session id the run is attributed to. */
|
|
9
|
+
parentId?: string;
|
|
10
|
+
/** Run id; defaults to the spawned session's id so persistence keys align. */
|
|
11
|
+
runId?: string;
|
|
12
|
+
/** Aborts the spawned session when the parent turn is cancelled. */
|
|
13
|
+
signal?: AbortSignal;
|
|
14
|
+
}
|
|
15
|
+
export declare const runSubAgent: (agent: Agent, task: string, deps: RunSubAgentDeps) => Promise<SubAgentResult>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const finalText = (session) => {
|
|
2
|
+
for (let i = session.messages.length - 1; i >= 0; i--) {
|
|
3
|
+
const message = session.messages[i];
|
|
4
|
+
if (message.role === 'assistant') {
|
|
5
|
+
return message.content.map((part) => (part.type === 'text' ? part.text : '')).join('');
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
return '';
|
|
9
|
+
};
|
|
10
|
+
export const runSubAgent = async (agent, task, deps) => {
|
|
11
|
+
const session = deps.spawn(agent);
|
|
12
|
+
deps.runs?.register({ runId: deps.runId ?? session.id, agent: agent.name, parentId: deps.parentId, session });
|
|
13
|
+
const { signal } = deps;
|
|
14
|
+
if (signal?.aborted)
|
|
15
|
+
session.abort();
|
|
16
|
+
const onAbort = () => session.abort();
|
|
17
|
+
signal?.addEventListener('abort', onAbort, { once: true });
|
|
18
|
+
let failure;
|
|
19
|
+
const unsubscribe = session.subscribe((event) => {
|
|
20
|
+
if (event.type === 'error')
|
|
21
|
+
failure = event.error;
|
|
22
|
+
});
|
|
23
|
+
try {
|
|
24
|
+
await session.send(task);
|
|
25
|
+
}
|
|
26
|
+
finally {
|
|
27
|
+
unsubscribe();
|
|
28
|
+
signal?.removeEventListener('abort', onAbort);
|
|
29
|
+
}
|
|
30
|
+
if (failure !== undefined)
|
|
31
|
+
throw failure instanceof Error ? failure : new Error(String(failure));
|
|
32
|
+
return { agent: agent.name, text: finalText(session) };
|
|
33
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { runSubAgent } from './runner.js';
|
|
2
|
+
export const createSubAgentTool = (deps) => ({
|
|
3
|
+
name: 'subagent',
|
|
4
|
+
description: 'Delegate an isolated task to a named sub-agent. Returns its final answer.',
|
|
5
|
+
prompt: 'Delegate self-contained research or sub-tasks to a named sub-agent with `subagent`; treat its answer as research input.',
|
|
6
|
+
parameters: {
|
|
7
|
+
type: 'object',
|
|
8
|
+
properties: {
|
|
9
|
+
agent: { type: 'string', description: 'Sub-agent name.' },
|
|
10
|
+
task: { type: 'string', description: 'The task to delegate.' },
|
|
11
|
+
},
|
|
12
|
+
required: ['agent', 'task'],
|
|
13
|
+
additionalProperties: false,
|
|
14
|
+
},
|
|
15
|
+
run: async (input, ctx) => {
|
|
16
|
+
const { agent, task } = (input ?? {});
|
|
17
|
+
if (!agent || !task)
|
|
18
|
+
return [{ type: 'text', text: 'Error: subagent requires `agent` and `task`.' }];
|
|
19
|
+
const def = deps.registry.get(agent);
|
|
20
|
+
if (!def)
|
|
21
|
+
return [{ type: 'text', text: `Error: unknown sub-agent "${agent}".` }];
|
|
22
|
+
const result = await runSubAgent(def, task, {
|
|
23
|
+
spawn: deps.spawn,
|
|
24
|
+
runs: deps.runs,
|
|
25
|
+
parentId: deps.parentId,
|
|
26
|
+
signal: ctx.signal,
|
|
27
|
+
});
|
|
28
|
+
return [{ type: 'text', text: result.text }];
|
|
29
|
+
},
|
|
30
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { AgentSession } from '../session/index.js';
|
|
2
|
+
export interface SubAgentResult {
|
|
3
|
+
agent: string;
|
|
4
|
+
text: string;
|
|
5
|
+
}
|
|
6
|
+
export interface SubAgentRun {
|
|
7
|
+
runId: string;
|
|
8
|
+
agent: string;
|
|
9
|
+
parentId?: string;
|
|
10
|
+
session: AgentSession;
|
|
11
|
+
}
|
|
12
|
+
export interface SubAgentRegistry {
|
|
13
|
+
register(run: SubAgentRun): void;
|
|
14
|
+
get(runId: string): SubAgentRun | undefined;
|
|
15
|
+
list(): SubAgentRun[];
|
|
16
|
+
byParent(parentId: string): SubAgentRun[];
|
|
17
|
+
subscribe(listener: (run: SubAgentRun) => void): () => void;
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { flex, ProcessTerminal, TUI } from 'mu-tui';
|
|
2
|
+
import { composer, header, message, status, transcript } from './components/index.js';
|
|
3
|
+
import { defaultKit } from './kit.js';
|
|
4
|
+
const defaultLayout = (parts, ctx) => ctx.components.column([parts.header, flex(parts.transcript), parts.status, parts.composer]);
|
|
5
|
+
export const createChatApp = (channel, opts = {}) => {
|
|
6
|
+
const slots = opts.slots ?? {};
|
|
7
|
+
const components = { ...defaultKit, ...opts.components };
|
|
8
|
+
const resolveMessage = slots.message ?? message;
|
|
9
|
+
const ctx = {
|
|
10
|
+
channel,
|
|
11
|
+
components,
|
|
12
|
+
renderMessage: (msg) => resolveMessage(msg, ctx),
|
|
13
|
+
status: { current: 'idle' },
|
|
14
|
+
};
|
|
15
|
+
const parts = {
|
|
16
|
+
header: (slots.header ?? header)(ctx),
|
|
17
|
+
transcript: (slots.transcript ?? transcript)(ctx),
|
|
18
|
+
status: (slots.status ?? status)(ctx),
|
|
19
|
+
composer: (slots.composer ?? composer)(ctx),
|
|
20
|
+
};
|
|
21
|
+
const root = (slots.layout ?? defaultLayout)(parts, ctx);
|
|
22
|
+
const terminal = opts.terminal ?? new ProcessTerminal({ bracketedPaste: true, focusEvents: true });
|
|
23
|
+
const tui = new TUI(terminal);
|
|
24
|
+
const unsubscribe = channel.subscribe((event) => {
|
|
25
|
+
if (event.type === 'turn_start')
|
|
26
|
+
ctx.status.current = 'thinking';
|
|
27
|
+
else if (event.type === 'turn_end')
|
|
28
|
+
ctx.status.current = 'idle';
|
|
29
|
+
else if (event.type === 'error')
|
|
30
|
+
ctx.status.current = 'error';
|
|
31
|
+
tui.requestRender();
|
|
32
|
+
});
|
|
33
|
+
tui.setRoot(root);
|
|
34
|
+
tui.setFocus(parts.composer);
|
|
35
|
+
const stop = () => {
|
|
36
|
+
unsubscribe();
|
|
37
|
+
tui.stop();
|
|
38
|
+
};
|
|
39
|
+
return {
|
|
40
|
+
tui,
|
|
41
|
+
start: () => {
|
|
42
|
+
tui.addGlobalKeybinding({
|
|
43
|
+
chord: { key: 'c', ctrl: true },
|
|
44
|
+
handler: () => {
|
|
45
|
+
stop();
|
|
46
|
+
opts.onExit?.();
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
tui.start();
|
|
50
|
+
},
|
|
51
|
+
stop,
|
|
52
|
+
};
|
|
53
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const composer = (ctx) => {
|
|
2
|
+
const input = ctx.components.editor({
|
|
3
|
+
placeholder: 'Message…',
|
|
4
|
+
onSubmit: (value) => {
|
|
5
|
+
const trimmed = value.trim();
|
|
6
|
+
if (!trimmed)
|
|
7
|
+
return;
|
|
8
|
+
input.setValue('');
|
|
9
|
+
void ctx.channel.send(trimmed);
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
return input;
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const header = (ctx) => ctx.components.text(`\x1b[1m${ctx.channel.title}\x1b[0m`);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ContentPart, Message } from 'mu-core';
|
|
2
|
+
import type { Component } from 'mu-tui';
|
|
3
|
+
import type { ChatContext } from '../types.js';
|
|
4
|
+
export declare const partToText: (part: ContentPart) => string;
|
|
5
|
+
export declare const formatMessage: (message: Message) => string;
|
|
6
|
+
export declare const message: (msg: Message, ctx: ChatContext) => Component;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export const partToText = (part) => {
|
|
2
|
+
switch (part.type) {
|
|
3
|
+
case 'text':
|
|
4
|
+
return part.text;
|
|
5
|
+
case 'tool_call':
|
|
6
|
+
return `\x1b[2m[${part.name}]\x1b[0m`;
|
|
7
|
+
case 'tool_result':
|
|
8
|
+
return part.content.map(partToText).join('');
|
|
9
|
+
case 'image':
|
|
10
|
+
return '\x1b[2m[image]\x1b[0m';
|
|
11
|
+
case 'audio':
|
|
12
|
+
return '\x1b[2m[audio]\x1b[0m';
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
const isToolResults = (message) => message.content.length > 0 && message.content.every((part) => part.type === 'tool_result');
|
|
16
|
+
const label = (message) => {
|
|
17
|
+
if (isToolResults(message))
|
|
18
|
+
return '\x1b[2mtool\x1b[0m';
|
|
19
|
+
if (message.role === 'user')
|
|
20
|
+
return '\x1b[36myou\x1b[0m';
|
|
21
|
+
if (message.role === 'assistant')
|
|
22
|
+
return '\x1b[32magent\x1b[0m';
|
|
23
|
+
return `\x1b[2m${message.role}\x1b[0m`;
|
|
24
|
+
};
|
|
25
|
+
export const formatMessage = (message) => `${label(message)} ${message.content.map(partToText).join('')}`;
|
|
26
|
+
export const message = (msg, ctx) => ctx.components.text(formatMessage(msg));
|