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,33 @@
|
|
|
1
|
+
// Ported from js-yaml v3.13.1:
|
|
2
|
+
// https://github.com/nodeca/js-yaml/commit/665aadda42349dcae869f12040d9b10ef18d12da
|
|
3
|
+
// Copyright 2011-2015 by Vitaly Puzrin. All rights reserved. MIT license.
|
|
4
|
+
// Copyright 2018-2026 the Deno authors. MIT license.
|
|
5
|
+
// This module is browser compatible.
|
|
6
|
+
import { DumperState } from "./_dumper_state.js";
|
|
7
|
+
import { SCHEMA_MAP } from "./_schema.js";
|
|
8
|
+
/**
|
|
9
|
+
* Converts a JavaScript object or value to a YAML document string.
|
|
10
|
+
*
|
|
11
|
+
* @example Usage
|
|
12
|
+
* ```ts
|
|
13
|
+
* import { stringify } from "@std/yaml/stringify";
|
|
14
|
+
* import { assertEquals } from "@std/assert";
|
|
15
|
+
*
|
|
16
|
+
* const data = { id: 1, name: "Alice" };
|
|
17
|
+
* const yaml = stringify(data);
|
|
18
|
+
*
|
|
19
|
+
* assertEquals(yaml, "id: 1\nname: Alice\n");
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @throws {TypeError} If `data` contains invalid types.
|
|
23
|
+
* @param data The data to serialize.
|
|
24
|
+
* @param options The options for serialization.
|
|
25
|
+
* @returns A YAML string.
|
|
26
|
+
*/
|
|
27
|
+
export function stringify(data, options = {}) {
|
|
28
|
+
const state = new DumperState({
|
|
29
|
+
...options,
|
|
30
|
+
schema: SCHEMA_MAP.get(options.schema),
|
|
31
|
+
});
|
|
32
|
+
return state.stringify(data);
|
|
33
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { join } from 'node:path';
|
|
2
|
+
import process from 'node:process';
|
|
3
|
+
import { createAgentRegistry, loadAgents } from '../agents/index.js';
|
|
4
|
+
import { createAgentsCommand, createCommandRegistry, createHelpCommand, createSessionsCommand, createSkillsCommand, } from '../commands/index.js';
|
|
5
|
+
import { createHarnessConfig } from '../config/index.js';
|
|
6
|
+
import { mergeHooks } from '../hooks/index.js';
|
|
7
|
+
import { allowList } from '../permissions/index.js';
|
|
8
|
+
import { createPluginStore } from '../plugin/index.js';
|
|
9
|
+
import { createScheduler, createScheduleTaskTool, createTasksCommand, createTaskStore } from '../scheduler/index.js';
|
|
10
|
+
import { createAgentSession, createSessionCatalog, createSessionManager, createSessionStore, persistTo, runTitler, } from '../session/index.js';
|
|
11
|
+
import { createRunSkillTool, createSkillRegistry, createSkillTool, createSkillWriterTool, loadSkills, runSkill, } from '../skills/index.js';
|
|
12
|
+
import { createSubAgentRegistry, createSubAgentTool, runSubAgent } from '../subAgents/index.js';
|
|
13
|
+
import { createModelRegistry } from './models.js';
|
|
14
|
+
const TITLE_AGENT = {
|
|
15
|
+
name: 'title',
|
|
16
|
+
description: 'Generates a concise session title from the first user message.',
|
|
17
|
+
prompt: 'Generate a concise title (3 to 6 words) for the conversation based on the user message. Reply with ONLY the title — no quotes, no trailing punctuation, no explanation.',
|
|
18
|
+
tools: [],
|
|
19
|
+
};
|
|
20
|
+
export const createHarness = async (options) => {
|
|
21
|
+
const { hostName, xdg, providers, model, agents: hostAgents = [], skills: hostSkills = [], title, titleModel, scheduler: enableScheduler = false, ...sessionDefaults } = options;
|
|
22
|
+
const cwd = options.cwd ?? process.cwd();
|
|
23
|
+
const config = createHarnessConfig({ hostName, xdg });
|
|
24
|
+
const models = createModelRegistry({ providers, default: model });
|
|
25
|
+
const plugins = createPluginStore({ dir: join(config.configDir, 'plugins') });
|
|
26
|
+
const newId = () => crypto.randomUUID();
|
|
27
|
+
const pluginAgents = (sessionDefaults.plugins ?? []).flatMap((plugin) => plugin.agents ?? []);
|
|
28
|
+
const diskAgents = await loadAgents(join(config.configDir, 'agents'));
|
|
29
|
+
const agents = createAgentRegistry([...hostAgents, ...pluginAgents, ...diskAgents]);
|
|
30
|
+
const skillsDir = join(config.configDir, 'skills');
|
|
31
|
+
const cwdSkillsDir = join(cwd, 'skills');
|
|
32
|
+
const pluginSkills = (sessionDefaults.plugins ?? []).flatMap((plugin) => plugin.skills ?? []);
|
|
33
|
+
const cwdSkills = await loadSkills(cwdSkillsDir);
|
|
34
|
+
const diskSkills = await loadSkills(skillsDir);
|
|
35
|
+
const skills = createSkillRegistry([...hostSkills, ...pluginSkills, ...cwdSkills, ...diskSkills]);
|
|
36
|
+
const skillTools = [
|
|
37
|
+
createSkillTool(skills),
|
|
38
|
+
createSkillWriterTool({ dirs: { local: cwdSkillsDir, config: skillsDir }, registry: skills }),
|
|
39
|
+
];
|
|
40
|
+
const tasks = enableScheduler ? createTaskStore({ dir: join(config.configDir, 'tasks') }) : undefined;
|
|
41
|
+
let schedulerTools = [];
|
|
42
|
+
const runs = createSubAgentRegistry();
|
|
43
|
+
const store = createSessionStore({ dir: join(config.dataDir, 'sessions') });
|
|
44
|
+
const sessionTools = (extra = []) => [...(sessionDefaults.tools ?? []), ...extra, ...skillTools, ...schedulerTools];
|
|
45
|
+
const persona = (agent, opts) => createAgentSession({
|
|
46
|
+
tools: opts.tools,
|
|
47
|
+
plugins: sessionDefaults.plugins,
|
|
48
|
+
system: agent.prompt,
|
|
49
|
+
hooks: opts.hooks ?? allowList(agent.tools),
|
|
50
|
+
...models.resolve(opts.model ?? agent.model),
|
|
51
|
+
id: newId(),
|
|
52
|
+
});
|
|
53
|
+
const spawn = (agent) => persistTo(store, persona(agent, {
|
|
54
|
+
tools: sessionTools(),
|
|
55
|
+
hooks: mergeHooks([sessionDefaults.hooks, allowList(agent.tools)]),
|
|
56
|
+
}));
|
|
57
|
+
const scheduler = enableScheduler && tasks
|
|
58
|
+
? createScheduler({
|
|
59
|
+
store: tasks,
|
|
60
|
+
run: async (task) => {
|
|
61
|
+
try {
|
|
62
|
+
if (!task.agent)
|
|
63
|
+
throw new Error('scheduled task is missing an agent');
|
|
64
|
+
const output = await runSkill({ skills, agents, spawn, runs, parentId: task.id }, {
|
|
65
|
+
skill: task.skill,
|
|
66
|
+
task: task.prompt,
|
|
67
|
+
agent: task.agent,
|
|
68
|
+
});
|
|
69
|
+
return { ok: true, output };
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
return { ok: false, error: error instanceof Error ? error.message : String(error) };
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
})
|
|
76
|
+
: undefined;
|
|
77
|
+
if (tasks && scheduler) {
|
|
78
|
+
schedulerTools = [
|
|
79
|
+
createRunSkillTool({ skills, agents, spawn, runs }),
|
|
80
|
+
createScheduleTaskTool({ store: tasks, skills, onChange: () => scheduler.reload() }),
|
|
81
|
+
];
|
|
82
|
+
}
|
|
83
|
+
const titleSpawn = (agent) => persona(agent, { model: titleModel });
|
|
84
|
+
const catalog = createSessionCatalog({ file: join(config.dataDir, 'sessions.db') });
|
|
85
|
+
runs.subscribe((run) => catalog.record(run.runId, { cwd, parentId: run.parentId }));
|
|
86
|
+
const sessions = createSessionManager({
|
|
87
|
+
store,
|
|
88
|
+
catalog,
|
|
89
|
+
newId,
|
|
90
|
+
cwd,
|
|
91
|
+
title: title === false ? undefined : ({ id, text }) => {
|
|
92
|
+
void runTitler({
|
|
93
|
+
id,
|
|
94
|
+
text,
|
|
95
|
+
setTitle: (sid, value) => catalog.setTitle(sid, value),
|
|
96
|
+
generate: (input) => runSubAgent(TITLE_AGENT, input, { spawn: titleSpawn }).then((result) => result.text),
|
|
97
|
+
});
|
|
98
|
+
},
|
|
99
|
+
revive: ({ id, model: ref, messages }) => createAgentSession({
|
|
100
|
+
...sessionDefaults,
|
|
101
|
+
tools: sessionTools([createSubAgentTool({ registry: agents, spawn, runs, parentId: id })]),
|
|
102
|
+
...models.resolve(ref),
|
|
103
|
+
id,
|
|
104
|
+
messages,
|
|
105
|
+
}),
|
|
106
|
+
});
|
|
107
|
+
const commands = createCommandRegistry([
|
|
108
|
+
createAgentsCommand(agents),
|
|
109
|
+
createSkillsCommand(skills),
|
|
110
|
+
createSessionsCommand(sessions),
|
|
111
|
+
...(tasks ? [createTasksCommand(tasks)] : []),
|
|
112
|
+
]);
|
|
113
|
+
commands.register(createHelpCommand(() => commands.list()));
|
|
114
|
+
if (scheduler)
|
|
115
|
+
await scheduler.start();
|
|
116
|
+
return {
|
|
117
|
+
config,
|
|
118
|
+
models,
|
|
119
|
+
plugins,
|
|
120
|
+
sessions,
|
|
121
|
+
agents,
|
|
122
|
+
skills,
|
|
123
|
+
subAgents: runs,
|
|
124
|
+
dispatchSubAgent: async (agent, task, parentId) => {
|
|
125
|
+
const def = agents.get(agent);
|
|
126
|
+
if (!def)
|
|
127
|
+
throw new Error(`unknown sub-agent "${agent}"`);
|
|
128
|
+
return await runSubAgent(def, task, { spawn, runs, parentId });
|
|
129
|
+
},
|
|
130
|
+
scheduler,
|
|
131
|
+
tasks,
|
|
132
|
+
commands,
|
|
133
|
+
cwd,
|
|
134
|
+
close: () => {
|
|
135
|
+
scheduler?.stop();
|
|
136
|
+
catalog.close();
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Provider } from 'mu-core';
|
|
2
|
+
export interface ModelRegistryOptions {
|
|
3
|
+
providers: Record<string, Provider>;
|
|
4
|
+
default: string;
|
|
5
|
+
}
|
|
6
|
+
export interface ResolvedModel {
|
|
7
|
+
provider: Provider;
|
|
8
|
+
model: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ModelRegistry {
|
|
11
|
+
readonly selected: string;
|
|
12
|
+
readonly providers: string[];
|
|
13
|
+
select(ref: string): void;
|
|
14
|
+
resolve(ref?: string): ResolvedModel;
|
|
15
|
+
}
|
|
16
|
+
export declare const createModelRegistry: (options: ModelRegistryOptions) => ModelRegistry;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export const createModelRegistry = (options) => {
|
|
2
|
+
const { providers } = options;
|
|
3
|
+
let selected = options.default;
|
|
4
|
+
const resolve = (ref) => {
|
|
5
|
+
const value = ref ?? selected;
|
|
6
|
+
const slash = value.indexOf('/');
|
|
7
|
+
if (slash <= 0 || slash === value.length - 1) {
|
|
8
|
+
throw new Error(`ModelRegistry: model must be "provider/model", got "${value}"`);
|
|
9
|
+
}
|
|
10
|
+
const name = value.slice(0, slash);
|
|
11
|
+
const provider = providers[name];
|
|
12
|
+
if (!provider)
|
|
13
|
+
throw new Error(`ModelRegistry: unknown provider "${name}"`);
|
|
14
|
+
return { provider, model: value.slice(slash + 1) };
|
|
15
|
+
};
|
|
16
|
+
resolve(selected);
|
|
17
|
+
return {
|
|
18
|
+
get selected() {
|
|
19
|
+
return selected;
|
|
20
|
+
},
|
|
21
|
+
get providers() {
|
|
22
|
+
return Object.keys(providers);
|
|
23
|
+
},
|
|
24
|
+
select: (ref) => {
|
|
25
|
+
resolve(ref);
|
|
26
|
+
selected = ref;
|
|
27
|
+
},
|
|
28
|
+
resolve,
|
|
29
|
+
};
|
|
30
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Provider } from 'mu-core';
|
|
2
|
+
import type { Agent, AgentRegistry } from '../agents/index.js';
|
|
3
|
+
import type { CommandRegistry } from '../commands/index.js';
|
|
4
|
+
import type { HarnessConfig, HarnessConfigOptions } from '../config/index.js';
|
|
5
|
+
import type { PluginStore } from '../plugin/index.js';
|
|
6
|
+
import type { Scheduler, TaskStore } from '../scheduler/index.js';
|
|
7
|
+
import type { AgentSessionConfig, SessionManager } from '../session/index.js';
|
|
8
|
+
import type { Skill, SkillRegistry } from '../skills/index.js';
|
|
9
|
+
import type { SubAgentRegistry, SubAgentResult } from '../subAgents/index.js';
|
|
10
|
+
import type { ModelRegistry } from './models.js';
|
|
11
|
+
export type HarnessOptions = HarnessConfigOptions & Omit<AgentSessionConfig, 'provider' | 'model' | 'id' | 'messages'> & {
|
|
12
|
+
providers: Record<string, Provider>;
|
|
13
|
+
model: string;
|
|
14
|
+
agents?: Agent[];
|
|
15
|
+
skills?: Skill[];
|
|
16
|
+
title?: boolean;
|
|
17
|
+
titleModel?: string;
|
|
18
|
+
cwd?: string;
|
|
19
|
+
scheduler?: boolean;
|
|
20
|
+
};
|
|
21
|
+
export interface Harness {
|
|
22
|
+
readonly config: HarnessConfig;
|
|
23
|
+
readonly models: ModelRegistry;
|
|
24
|
+
readonly plugins: PluginStore;
|
|
25
|
+
readonly sessions: SessionManager;
|
|
26
|
+
readonly agents: AgentRegistry;
|
|
27
|
+
readonly skills: SkillRegistry;
|
|
28
|
+
readonly subAgents: SubAgentRegistry;
|
|
29
|
+
dispatchSubAgent(agent: string, task: string, parentId: string): Promise<SubAgentResult>;
|
|
30
|
+
readonly commands: CommandRegistry;
|
|
31
|
+
readonly scheduler?: Scheduler;
|
|
32
|
+
readonly tasks?: TaskStore;
|
|
33
|
+
readonly cwd: string;
|
|
34
|
+
close(): void;
|
|
35
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export const mergeHooks = (list) => {
|
|
2
|
+
const hooks = list.filter((h) => h !== undefined);
|
|
3
|
+
const merged = {};
|
|
4
|
+
if (hooks.some((h) => h.sessionStart)) {
|
|
5
|
+
merged.sessionStart = async () => {
|
|
6
|
+
for (const h of hooks)
|
|
7
|
+
await h.sessionStart?.();
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
if (hooks.some((h) => h.prepareRequest)) {
|
|
11
|
+
merged.prepareRequest = async (req) => {
|
|
12
|
+
let current = req;
|
|
13
|
+
for (const h of hooks) {
|
|
14
|
+
const next = await h.prepareRequest?.(current);
|
|
15
|
+
if (next)
|
|
16
|
+
current = { system: next.system ?? current.system, tools: next.tools ?? current.tools };
|
|
17
|
+
}
|
|
18
|
+
return current;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
if (hooks.some((h) => h.beforeToolCall)) {
|
|
22
|
+
merged.beforeToolCall = async (call) => {
|
|
23
|
+
for (const h of hooks) {
|
|
24
|
+
const blocked = await h.beforeToolCall?.(call);
|
|
25
|
+
if (blocked)
|
|
26
|
+
return blocked;
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
if (hooks.some((h) => h.afterToolCall)) {
|
|
31
|
+
merged.afterToolCall = async (call) => {
|
|
32
|
+
let result = call.result;
|
|
33
|
+
for (const h of hooks) {
|
|
34
|
+
const next = await h.afterToolCall?.({ name: call.name, result });
|
|
35
|
+
if (next)
|
|
36
|
+
result = next;
|
|
37
|
+
}
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
return merged;
|
|
42
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ContentPart, Tool } from 'mu-core';
|
|
2
|
+
export interface PreparedRequest {
|
|
3
|
+
system?: string;
|
|
4
|
+
tools?: Tool[];
|
|
5
|
+
}
|
|
6
|
+
export interface AgentSessionHooks {
|
|
7
|
+
sessionStart?(): void | Promise<void>;
|
|
8
|
+
prepareRequest?(req: {
|
|
9
|
+
system: string;
|
|
10
|
+
tools: Tool[];
|
|
11
|
+
}): PreparedRequest | void | Promise<PreparedRequest | void>;
|
|
12
|
+
beforeToolCall?(call: {
|
|
13
|
+
name: string;
|
|
14
|
+
input: unknown;
|
|
15
|
+
}): void | ContentPart[] | Promise<void | ContentPart[]>;
|
|
16
|
+
afterToolCall?(call: {
|
|
17
|
+
name: string;
|
|
18
|
+
result: ContentPart[];
|
|
19
|
+
}): void | ContentPart[] | Promise<void | ContentPart[]>;
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const withHooks = (tool, hooks) => {
|
|
2
|
+
if (!hooks.beforeToolCall && !hooks.afterToolCall)
|
|
3
|
+
return tool;
|
|
4
|
+
const run = async (input, ctx) => {
|
|
5
|
+
const blocked = await hooks.beforeToolCall?.({ name: tool.name, input });
|
|
6
|
+
if (blocked)
|
|
7
|
+
return blocked;
|
|
8
|
+
const result = await tool.run(input, ctx);
|
|
9
|
+
return (await hooks.afterToolCall?.({ name: tool.name, result })) ?? result;
|
|
10
|
+
};
|
|
11
|
+
return Object.assign(Object.create(tool), { run });
|
|
12
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import "./_dnt.polyfills.js";
|
|
2
|
+
export * from './agents/index.js';
|
|
3
|
+
export * from './channels/index.js';
|
|
4
|
+
export * from './commands/index.js';
|
|
5
|
+
export * from './common/index.js';
|
|
6
|
+
export * from './config/index.js';
|
|
7
|
+
export * from './harness/index.js';
|
|
8
|
+
export * from './hooks/index.js';
|
|
9
|
+
export * from './permissions/index.js';
|
|
10
|
+
export * from './plugin/index.js';
|
|
11
|
+
export * from './scheduler/index.js';
|
|
12
|
+
export * from './session/index.js';
|
|
13
|
+
export * from './skills/index.js';
|
|
14
|
+
export * from './subAgents/index.js';
|
|
15
|
+
export * from './tui/index.js';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import "./_dnt.polyfills.js";
|
|
2
|
+
export * from './agents/index.js';
|
|
3
|
+
export * from './channels/index.js';
|
|
4
|
+
export * from './commands/index.js';
|
|
5
|
+
export * from './common/index.js';
|
|
6
|
+
export * from './config/index.js';
|
|
7
|
+
export * from './harness/index.js';
|
|
8
|
+
export * from './hooks/index.js';
|
|
9
|
+
export * from './permissions/index.js';
|
|
10
|
+
export * from './plugin/index.js';
|
|
11
|
+
export * from './scheduler/index.js';
|
|
12
|
+
export * from './session/index.js';
|
|
13
|
+
export * from './skills/index.js';
|
|
14
|
+
export * from './subAgents/index.js';
|
|
15
|
+
export * from './tui/index.js';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Tool } from 'mu-core';
|
|
2
|
+
import type { AgentSessionHooks } from '../hooks/index.js';
|
|
3
|
+
export declare const filterTools: (pool: Tool[], allow: string[] | undefined) => Tool[];
|
|
4
|
+
export declare const allowList: (names: string[] | undefined) => AgentSessionHooks;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { matchesAnyGlob } from './glob.js';
|
|
2
|
+
export const filterTools = (pool, allow) => {
|
|
3
|
+
const patterns = allow ?? [];
|
|
4
|
+
return pool.filter((tool) => matchesAnyGlob(tool.name, patterns));
|
|
5
|
+
};
|
|
6
|
+
export const allowList = (names) => ({
|
|
7
|
+
prepareRequest: ({ tools }) => ({ tools: filterTools(tools, names) }),
|
|
8
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ContentPart } from 'mu-core';
|
|
2
|
+
import type { AgentSessionHooks } from '../hooks/index.js';
|
|
3
|
+
export interface ApprovalCall {
|
|
4
|
+
id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
input: unknown;
|
|
7
|
+
}
|
|
8
|
+
export interface RequireApprovalOptions {
|
|
9
|
+
needsApproval(call: {
|
|
10
|
+
name: string;
|
|
11
|
+
input: unknown;
|
|
12
|
+
}): boolean;
|
|
13
|
+
prompt(call: ApprovalCall): boolean | Promise<boolean>;
|
|
14
|
+
onDeny?(call: ApprovalCall): ContentPart[];
|
|
15
|
+
newId?(): string;
|
|
16
|
+
}
|
|
17
|
+
export declare const requireApproval: (options: RequireApprovalOptions) => AgentSessionHooks;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export const requireApproval = (options) => {
|
|
2
|
+
const newId = options.newId ?? (() => crypto.randomUUID());
|
|
3
|
+
return {
|
|
4
|
+
beforeToolCall: async ({ name, input }) => {
|
|
5
|
+
if (!options.needsApproval({ name, input }))
|
|
6
|
+
return;
|
|
7
|
+
const call = { id: newId(), name, input };
|
|
8
|
+
if (await options.prompt(call))
|
|
9
|
+
return;
|
|
10
|
+
return options.onDeny?.(call) ?? [{ type: 'text', text: `Denied: ${call.name}` }];
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const matchesAnyGlob: (value: string, patterns: string[]) => boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const definePlugin = (plugin) => plugin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const importModule: (spec: string) => Promise<Record<string, unknown>>;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { transformSync } from '@swc/wasm-typescript';
|
|
2
|
+
import { mkdir, mkdtemp, readFile, writeFile } from 'node:fs/promises';
|
|
3
|
+
import { tmpdir } from 'node:os';
|
|
4
|
+
import { dirname, isAbsolute, join, relative, resolve, sep } from 'node:path';
|
|
5
|
+
import { pathToFileURL } from 'node:url';
|
|
6
|
+
const TS_EXT = /\.(?:[cm]?ts|tsx)$/;
|
|
7
|
+
const REMOTE = /^(?:npm|jsr|node|bun|http|https|data|file):/;
|
|
8
|
+
const SPECIFIER = /(?:\bfrom|\bimport|\bexport\s*\*\s*from|\bimport)\s*\(?\s*(['"])(\.{1,2}\/[^'"]+)\1/g;
|
|
9
|
+
const isLocalTs = (spec) => TS_EXT.test(spec) && !REMOTE.test(spec);
|
|
10
|
+
const toAbs = (spec) => {
|
|
11
|
+
if (spec.startsWith('file://'))
|
|
12
|
+
return resolve(decodeURIComponent(new URL(spec).pathname));
|
|
13
|
+
return isAbsolute(spec) ? spec : resolve(spec);
|
|
14
|
+
};
|
|
15
|
+
const resolveRelative = async (from, spec) => {
|
|
16
|
+
const base = resolve(dirname(from), spec);
|
|
17
|
+
const candidates = TS_EXT.test(base) ? [base] : [
|
|
18
|
+
base,
|
|
19
|
+
`${base}.ts`,
|
|
20
|
+
`${base}.tsx`,
|
|
21
|
+
`${base}.mts`,
|
|
22
|
+
`${base}.cts`,
|
|
23
|
+
join(base, 'index.ts'),
|
|
24
|
+
join(base, 'index.tsx'),
|
|
25
|
+
];
|
|
26
|
+
for (const candidate of candidates) {
|
|
27
|
+
try {
|
|
28
|
+
await readFile(candidate);
|
|
29
|
+
return candidate;
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
throw new Error(`cannot resolve "${spec}" from ${from}`);
|
|
36
|
+
};
|
|
37
|
+
const collect = async (entry) => {
|
|
38
|
+
const sources = new Map();
|
|
39
|
+
const pending = [entry];
|
|
40
|
+
while (pending.length > 0) {
|
|
41
|
+
const file = pending.pop();
|
|
42
|
+
if (sources.has(file))
|
|
43
|
+
continue;
|
|
44
|
+
const source = await readFile(file, 'utf-8');
|
|
45
|
+
sources.set(file, source);
|
|
46
|
+
for (const match of source.matchAll(SPECIFIER)) {
|
|
47
|
+
pending.push(await resolveRelative(file, match[2]));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return sources;
|
|
51
|
+
};
|
|
52
|
+
const commonBase = (files) => {
|
|
53
|
+
if (files.length === 1)
|
|
54
|
+
return dirname(files[0]);
|
|
55
|
+
const split = files.map((f) => dirname(f).split(sep));
|
|
56
|
+
const first = split[0];
|
|
57
|
+
let i = 0;
|
|
58
|
+
while (i < first.length && split.every((parts) => parts[i] === first[i]))
|
|
59
|
+
i++;
|
|
60
|
+
return first.slice(0, i).join(sep) || sep;
|
|
61
|
+
};
|
|
62
|
+
const outName = (path) => path.replace(TS_EXT, '.mjs');
|
|
63
|
+
const rewriteSpecifiers = (code) => code.replace(SPECIFIER, (whole, quote, spec) => whole.replace(`${quote}${spec}${quote}`, `${quote}${outName(spec)}${quote}`));
|
|
64
|
+
const transpileTree = async (entry) => {
|
|
65
|
+
const sources = await collect(entry);
|
|
66
|
+
if (sources.size === 1) {
|
|
67
|
+
const { code } = transformSync(sources.get(entry), { mode: 'transform', module: true });
|
|
68
|
+
return `data:text/javascript;base64,${btoa(unescape(encodeURIComponent(code)))}`;
|
|
69
|
+
}
|
|
70
|
+
const base = commonBase([...sources.keys()]);
|
|
71
|
+
const outDir = await mkdtemp(join(tmpdir(), 'mu-plugin-'));
|
|
72
|
+
for (const [file, source] of sources) {
|
|
73
|
+
const { code } = transformSync(source, { mode: 'transform', module: true });
|
|
74
|
+
const out = join(outDir, outName(relative(base, file)));
|
|
75
|
+
await mkdir(dirname(out), { recursive: true });
|
|
76
|
+
await writeFile(out, rewriteSpecifiers(code), 'utf-8');
|
|
77
|
+
}
|
|
78
|
+
return pathToFileURL(join(outDir, outName(relative(base, entry)))).href;
|
|
79
|
+
};
|
|
80
|
+
export const importModule = async (spec) => {
|
|
81
|
+
if (!isLocalTs(spec))
|
|
82
|
+
return (await import(spec));
|
|
83
|
+
const url = await transpileTree(toAbs(spec));
|
|
84
|
+
return (await import(url));
|
|
85
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type { Plugin } from './types.js';
|
|
2
|
+
export { definePlugin } from './define.js';
|
|
3
|
+
export { resolve, type Resolved, type ResolveInput } from './resolve.js';
|
|
4
|
+
export { createPluginStore, type PluginStore } from './store.js';
|
|
5
|
+
export { importModule } from './import-ts.js';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Tool } from 'mu-core';
|
|
2
|
+
import { type AgentSessionHooks } from '../hooks/index.js';
|
|
3
|
+
import type { Plugin } from './types.js';
|
|
4
|
+
export interface Resolved {
|
|
5
|
+
tools: Tool[];
|
|
6
|
+
hooks: AgentSessionHooks;
|
|
7
|
+
}
|
|
8
|
+
export interface ResolveInput {
|
|
9
|
+
tools?: Tool[];
|
|
10
|
+
hooks?: AgentSessionHooks;
|
|
11
|
+
plugins?: Plugin[];
|
|
12
|
+
}
|
|
13
|
+
export declare const resolve: (config: ResolveInput) => Resolved;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { mergeHooks } from '../hooks/index.js';
|
|
2
|
+
export const resolve = (config) => {
|
|
3
|
+
const plugins = config.plugins ?? [];
|
|
4
|
+
return {
|
|
5
|
+
tools: dedupeTools([...plugins.flatMap((p) => p.tools ?? []), ...(config.tools ?? [])]),
|
|
6
|
+
hooks: mergeHooks([...plugins.map((p) => p.hooks), config.hooks]),
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
const dedupeTools = (tools) => {
|
|
10
|
+
const seen = new Set();
|
|
11
|
+
for (const tool of tools) {
|
|
12
|
+
if (seen.has(tool.name))
|
|
13
|
+
throw new Error(`AgentSession: duplicate tool name "${tool.name}"`);
|
|
14
|
+
seen.add(tool.name);
|
|
15
|
+
}
|
|
16
|
+
return tools;
|
|
17
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { mkdir, readdir, rm, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
const fileFor = (dir, name) => {
|
|
4
|
+
if (name.includes('/') || name.includes('..') || name === '')
|
|
5
|
+
throw new Error(`PluginStore: invalid name "${name}"`);
|
|
6
|
+
return join(dir, name);
|
|
7
|
+
};
|
|
8
|
+
export const createPluginStore = ({ dir }) => ({
|
|
9
|
+
write: async (name, content) => {
|
|
10
|
+
const path = fileFor(dir, name);
|
|
11
|
+
await mkdir(dir, { recursive: true });
|
|
12
|
+
await writeFile(path, content, 'utf-8');
|
|
13
|
+
return path;
|
|
14
|
+
},
|
|
15
|
+
list: async () => {
|
|
16
|
+
try {
|
|
17
|
+
return await readdir(dir);
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return [];
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
remove: async (name) => {
|
|
24
|
+
await rm(fileFor(dir, name), { force: true });
|
|
25
|
+
},
|
|
26
|
+
});
|