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,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.importModule = void 0;
|
|
37
|
+
const wasm_typescript_1 = require("@swc/wasm-typescript");
|
|
38
|
+
const promises_1 = require("node:fs/promises");
|
|
39
|
+
const node_os_1 = require("node:os");
|
|
40
|
+
const node_path_1 = require("node:path");
|
|
41
|
+
const node_url_1 = require("node:url");
|
|
42
|
+
const TS_EXT = /\.(?:[cm]?ts|tsx)$/;
|
|
43
|
+
const REMOTE = /^(?:npm|jsr|node|bun|http|https|data|file):/;
|
|
44
|
+
const SPECIFIER = /(?:\bfrom|\bimport|\bexport\s*\*\s*from|\bimport)\s*\(?\s*(['"])(\.{1,2}\/[^'"]+)\1/g;
|
|
45
|
+
const isLocalTs = (spec) => TS_EXT.test(spec) && !REMOTE.test(spec);
|
|
46
|
+
const toAbs = (spec) => {
|
|
47
|
+
if (spec.startsWith('file://'))
|
|
48
|
+
return (0, node_path_1.resolve)(decodeURIComponent(new URL(spec).pathname));
|
|
49
|
+
return (0, node_path_1.isAbsolute)(spec) ? spec : (0, node_path_1.resolve)(spec);
|
|
50
|
+
};
|
|
51
|
+
const resolveRelative = async (from, spec) => {
|
|
52
|
+
const base = (0, node_path_1.resolve)((0, node_path_1.dirname)(from), spec);
|
|
53
|
+
const candidates = TS_EXT.test(base) ? [base] : [
|
|
54
|
+
base,
|
|
55
|
+
`${base}.ts`,
|
|
56
|
+
`${base}.tsx`,
|
|
57
|
+
`${base}.mts`,
|
|
58
|
+
`${base}.cts`,
|
|
59
|
+
(0, node_path_1.join)(base, 'index.ts'),
|
|
60
|
+
(0, node_path_1.join)(base, 'index.tsx'),
|
|
61
|
+
];
|
|
62
|
+
for (const candidate of candidates) {
|
|
63
|
+
try {
|
|
64
|
+
await (0, promises_1.readFile)(candidate);
|
|
65
|
+
return candidate;
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
throw new Error(`cannot resolve "${spec}" from ${from}`);
|
|
72
|
+
};
|
|
73
|
+
const collect = async (entry) => {
|
|
74
|
+
const sources = new Map();
|
|
75
|
+
const pending = [entry];
|
|
76
|
+
while (pending.length > 0) {
|
|
77
|
+
const file = pending.pop();
|
|
78
|
+
if (sources.has(file))
|
|
79
|
+
continue;
|
|
80
|
+
const source = await (0, promises_1.readFile)(file, 'utf-8');
|
|
81
|
+
sources.set(file, source);
|
|
82
|
+
for (const match of source.matchAll(SPECIFIER)) {
|
|
83
|
+
pending.push(await resolveRelative(file, match[2]));
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return sources;
|
|
87
|
+
};
|
|
88
|
+
const commonBase = (files) => {
|
|
89
|
+
if (files.length === 1)
|
|
90
|
+
return (0, node_path_1.dirname)(files[0]);
|
|
91
|
+
const split = files.map((f) => (0, node_path_1.dirname)(f).split(node_path_1.sep));
|
|
92
|
+
const first = split[0];
|
|
93
|
+
let i = 0;
|
|
94
|
+
while (i < first.length && split.every((parts) => parts[i] === first[i]))
|
|
95
|
+
i++;
|
|
96
|
+
return first.slice(0, i).join(node_path_1.sep) || node_path_1.sep;
|
|
97
|
+
};
|
|
98
|
+
const outName = (path) => path.replace(TS_EXT, '.mjs');
|
|
99
|
+
const rewriteSpecifiers = (code) => code.replace(SPECIFIER, (whole, quote, spec) => whole.replace(`${quote}${spec}${quote}`, `${quote}${outName(spec)}${quote}`));
|
|
100
|
+
const transpileTree = async (entry) => {
|
|
101
|
+
const sources = await collect(entry);
|
|
102
|
+
if (sources.size === 1) {
|
|
103
|
+
const { code } = (0, wasm_typescript_1.transformSync)(sources.get(entry), { mode: 'transform', module: true });
|
|
104
|
+
return `data:text/javascript;base64,${btoa(unescape(encodeURIComponent(code)))}`;
|
|
105
|
+
}
|
|
106
|
+
const base = commonBase([...sources.keys()]);
|
|
107
|
+
const outDir = await (0, promises_1.mkdtemp)((0, node_path_1.join)((0, node_os_1.tmpdir)(), 'mu-plugin-'));
|
|
108
|
+
for (const [file, source] of sources) {
|
|
109
|
+
const { code } = (0, wasm_typescript_1.transformSync)(source, { mode: 'transform', module: true });
|
|
110
|
+
const out = (0, node_path_1.join)(outDir, outName((0, node_path_1.relative)(base, file)));
|
|
111
|
+
await (0, promises_1.mkdir)((0, node_path_1.dirname)(out), { recursive: true });
|
|
112
|
+
await (0, promises_1.writeFile)(out, rewriteSpecifiers(code), 'utf-8');
|
|
113
|
+
}
|
|
114
|
+
return (0, node_url_1.pathToFileURL)((0, node_path_1.join)(outDir, outName((0, node_path_1.relative)(base, entry)))).href;
|
|
115
|
+
};
|
|
116
|
+
const importModule = async (spec) => {
|
|
117
|
+
if (!isLocalTs(spec))
|
|
118
|
+
return (await Promise.resolve(`${spec}`).then(s => __importStar(require(s))));
|
|
119
|
+
const url = await transpileTree(toAbs(spec));
|
|
120
|
+
return (await Promise.resolve(`${url}`).then(s => __importStar(require(s))));
|
|
121
|
+
};
|
|
122
|
+
exports.importModule = importModule;
|
|
@@ -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,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.importModule = exports.createPluginStore = exports.resolve = exports.definePlugin = void 0;
|
|
4
|
+
var define_js_1 = require("./define.js");
|
|
5
|
+
Object.defineProperty(exports, "definePlugin", { enumerable: true, get: function () { return define_js_1.definePlugin; } });
|
|
6
|
+
var resolve_js_1 = require("./resolve.js");
|
|
7
|
+
Object.defineProperty(exports, "resolve", { enumerable: true, get: function () { return resolve_js_1.resolve; } });
|
|
8
|
+
var store_js_1 = require("./store.js");
|
|
9
|
+
Object.defineProperty(exports, "createPluginStore", { enumerable: true, get: function () { return store_js_1.createPluginStore; } });
|
|
10
|
+
var import_ts_js_1 = require("./import-ts.js");
|
|
11
|
+
Object.defineProperty(exports, "importModule", { enumerable: true, get: function () { return import_ts_js_1.importModule; } });
|
|
@@ -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,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resolve = void 0;
|
|
4
|
+
const index_js_1 = require("../hooks/index.js");
|
|
5
|
+
const resolve = (config) => {
|
|
6
|
+
const plugins = config.plugins ?? [];
|
|
7
|
+
return {
|
|
8
|
+
tools: dedupeTools([...plugins.flatMap((p) => p.tools ?? []), ...(config.tools ?? [])]),
|
|
9
|
+
hooks: (0, index_js_1.mergeHooks)([...plugins.map((p) => p.hooks), config.hooks]),
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
exports.resolve = resolve;
|
|
13
|
+
const dedupeTools = (tools) => {
|
|
14
|
+
const seen = new Set();
|
|
15
|
+
for (const tool of tools) {
|
|
16
|
+
if (seen.has(tool.name))
|
|
17
|
+
throw new Error(`AgentSession: duplicate tool name "${tool.name}"`);
|
|
18
|
+
seen.add(tool.name);
|
|
19
|
+
}
|
|
20
|
+
return tools;
|
|
21
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createPluginStore = void 0;
|
|
4
|
+
const promises_1 = require("node:fs/promises");
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
|
+
const fileFor = (dir, name) => {
|
|
7
|
+
if (name.includes('/') || name.includes('..') || name === '')
|
|
8
|
+
throw new Error(`PluginStore: invalid name "${name}"`);
|
|
9
|
+
return (0, node_path_1.join)(dir, name);
|
|
10
|
+
};
|
|
11
|
+
const createPluginStore = ({ dir }) => ({
|
|
12
|
+
write: async (name, content) => {
|
|
13
|
+
const path = fileFor(dir, name);
|
|
14
|
+
await (0, promises_1.mkdir)(dir, { recursive: true });
|
|
15
|
+
await (0, promises_1.writeFile)(path, content, 'utf-8');
|
|
16
|
+
return path;
|
|
17
|
+
},
|
|
18
|
+
list: async () => {
|
|
19
|
+
try {
|
|
20
|
+
return await (0, promises_1.readdir)(dir);
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return [];
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
remove: async (name) => {
|
|
27
|
+
await (0, promises_1.rm)(fileFor(dir, name), { force: true });
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
exports.createPluginStore = createPluginStore;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Tool } from 'mu-core';
|
|
2
|
+
import type { Agent } from '../agents/index.js';
|
|
3
|
+
import type { AgentSessionHooks } from '../hooks/index.js';
|
|
4
|
+
import type { Skill } from '../skills/index.js';
|
|
5
|
+
export interface Plugin {
|
|
6
|
+
name: string;
|
|
7
|
+
tools?: Tool[];
|
|
8
|
+
hooks?: AgentSessionHooks;
|
|
9
|
+
agents?: Agent[];
|
|
10
|
+
skills?: Skill[];
|
|
11
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createTasksCommand = void 0;
|
|
4
|
+
const createTasksCommand = (tasks) => ({
|
|
5
|
+
name: 'tasks',
|
|
6
|
+
description: 'List scheduled tasks',
|
|
7
|
+
run: async () => {
|
|
8
|
+
const list = await tasks.list();
|
|
9
|
+
if (list.length === 0)
|
|
10
|
+
return { ok: true, output: 'No tasks scheduled.' };
|
|
11
|
+
const describe = (t) => {
|
|
12
|
+
const when = t.schedule.kind === 'cron'
|
|
13
|
+
? t.schedule.expr
|
|
14
|
+
: t.schedule.kind === 'interval'
|
|
15
|
+
? `every ${t.schedule.ms}ms`
|
|
16
|
+
: 'once';
|
|
17
|
+
const state = t.enabled ? when : `${when} (disabled)`;
|
|
18
|
+
return `- ${t.id} — ${t.skill} [${state}]`;
|
|
19
|
+
};
|
|
20
|
+
return { ok: true, output: list.map(describe).join('\n') };
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
exports.createTasksCommand = createTasksCommand;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createScheduler = exports.createTaskStore = void 0;
|
|
4
|
+
var store_js_1 = require("./store.js");
|
|
5
|
+
Object.defineProperty(exports, "createTaskStore", { enumerable: true, get: function () { return store_js_1.createTaskStore; } });
|
|
6
|
+
var scheduler_js_1 = require("./scheduler.js");
|
|
7
|
+
Object.defineProperty(exports, "createScheduler", { enumerable: true, get: function () { return scheduler_js_1.createScheduler; } });
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Task, TaskRunner, TaskStore } from './types.js';
|
|
2
|
+
export interface Scheduler {
|
|
3
|
+
start(): Promise<void>;
|
|
4
|
+
stop(): void;
|
|
5
|
+
reload(): Promise<void>;
|
|
6
|
+
runNow(id: string): Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
export declare const createScheduler: (deps: {
|
|
9
|
+
store: TaskStore;
|
|
10
|
+
run: TaskRunner;
|
|
11
|
+
onError?: (error: unknown, task: Task) => void;
|
|
12
|
+
}) => Scheduler;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createScheduler = void 0;
|
|
4
|
+
const croner_1 = require("croner");
|
|
5
|
+
const createScheduler = (deps) => {
|
|
6
|
+
const { store, run } = deps;
|
|
7
|
+
const crons = new Map();
|
|
8
|
+
const timers = new Map();
|
|
9
|
+
let started = false;
|
|
10
|
+
const fire = async (id) => {
|
|
11
|
+
const task = await store.get(id);
|
|
12
|
+
if (!task || !task.enabled)
|
|
13
|
+
return;
|
|
14
|
+
try {
|
|
15
|
+
const result = await run(task);
|
|
16
|
+
await store.update(id, { lastRun: Date.now(), lastResult: result });
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
deps.onError?.(error, task);
|
|
20
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
21
|
+
await store.update(id, { lastRun: Date.now(), lastResult: { ok: false, error: message } });
|
|
22
|
+
}
|
|
23
|
+
if (task.schedule.kind === 'once')
|
|
24
|
+
await store.update(id, { enabled: false });
|
|
25
|
+
};
|
|
26
|
+
const clear = () => {
|
|
27
|
+
for (const cron of crons.values())
|
|
28
|
+
cron.stop();
|
|
29
|
+
for (const timer of timers.values())
|
|
30
|
+
clearTimeout(timer);
|
|
31
|
+
crons.clear();
|
|
32
|
+
timers.clear();
|
|
33
|
+
};
|
|
34
|
+
const schedule = (task) => {
|
|
35
|
+
if (!task.enabled)
|
|
36
|
+
return;
|
|
37
|
+
const s = task.schedule;
|
|
38
|
+
if (s.kind === 'cron') {
|
|
39
|
+
crons.set(task.id, new croner_1.Cron(s.expr, () => void fire(task.id)));
|
|
40
|
+
}
|
|
41
|
+
else if (s.kind === 'interval') {
|
|
42
|
+
timers.set(task.id, setInterval(() => void fire(task.id), s.ms));
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
const delay = s.at ? Math.max(0, s.at - Date.now()) : 0;
|
|
46
|
+
timers.set(task.id, setTimeout(() => void fire(task.id), delay));
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const reload = async () => {
|
|
50
|
+
clear();
|
|
51
|
+
if (!started)
|
|
52
|
+
return;
|
|
53
|
+
for (const task of await store.list())
|
|
54
|
+
schedule(task);
|
|
55
|
+
};
|
|
56
|
+
return {
|
|
57
|
+
start: async () => {
|
|
58
|
+
started = true;
|
|
59
|
+
await reload();
|
|
60
|
+
},
|
|
61
|
+
stop: () => {
|
|
62
|
+
started = false;
|
|
63
|
+
clear();
|
|
64
|
+
},
|
|
65
|
+
reload,
|
|
66
|
+
runNow: (id) => fire(id),
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
exports.createScheduler = createScheduler;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createTaskStore = void 0;
|
|
4
|
+
const promises_1 = require("node:fs/promises");
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
|
+
const createTaskStore = (options) => {
|
|
7
|
+
const { dir } = options;
|
|
8
|
+
const file = (id) => (0, node_path_1.join)(dir, `${id}.json`);
|
|
9
|
+
const read = async (id) => {
|
|
10
|
+
try {
|
|
11
|
+
return JSON.parse(await (0, promises_1.readFile)(file(id), 'utf-8'));
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
const write = async (task) => {
|
|
18
|
+
await (0, promises_1.mkdir)(dir, { recursive: true });
|
|
19
|
+
await (0, promises_1.writeFile)(file(task.id), JSON.stringify(task, null, 2), 'utf-8');
|
|
20
|
+
};
|
|
21
|
+
return {
|
|
22
|
+
list: async () => {
|
|
23
|
+
let entries;
|
|
24
|
+
try {
|
|
25
|
+
entries = await (0, promises_1.readdir)(dir);
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return [];
|
|
29
|
+
}
|
|
30
|
+
const tasks = [];
|
|
31
|
+
for (const name of entries.sort()) {
|
|
32
|
+
if (!name.endsWith('.json'))
|
|
33
|
+
continue;
|
|
34
|
+
const task = await read(name.slice(0, -'.json'.length));
|
|
35
|
+
if (task)
|
|
36
|
+
tasks.push(task);
|
|
37
|
+
}
|
|
38
|
+
return tasks;
|
|
39
|
+
},
|
|
40
|
+
get: read,
|
|
41
|
+
create: async (input) => {
|
|
42
|
+
const task = { ...input, id: crypto.randomUUID(), enabled: input.enabled ?? true, createdAt: Date.now() };
|
|
43
|
+
await write(task);
|
|
44
|
+
return task;
|
|
45
|
+
},
|
|
46
|
+
update: async (id, patch) => {
|
|
47
|
+
const task = await read(id);
|
|
48
|
+
if (!task)
|
|
49
|
+
return undefined;
|
|
50
|
+
const next = { ...task, ...patch, id: task.id };
|
|
51
|
+
await write(next);
|
|
52
|
+
return next;
|
|
53
|
+
},
|
|
54
|
+
remove: async (id) => {
|
|
55
|
+
await (0, promises_1.rm)(file(id), { force: true });
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
exports.createTaskStore = createTaskStore;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export type Schedule = {
|
|
2
|
+
kind: 'cron';
|
|
3
|
+
expr: string;
|
|
4
|
+
} | {
|
|
5
|
+
kind: 'interval';
|
|
6
|
+
ms: number;
|
|
7
|
+
} | {
|
|
8
|
+
kind: 'once';
|
|
9
|
+
at?: number;
|
|
10
|
+
};
|
|
11
|
+
export interface TaskResult {
|
|
12
|
+
ok: boolean;
|
|
13
|
+
output?: string;
|
|
14
|
+
error?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface Task {
|
|
17
|
+
id: string;
|
|
18
|
+
skill: string;
|
|
19
|
+
prompt: string;
|
|
20
|
+
agent?: string;
|
|
21
|
+
schedule: Schedule;
|
|
22
|
+
enabled: boolean;
|
|
23
|
+
createdAt: number;
|
|
24
|
+
lastRun?: number;
|
|
25
|
+
lastResult?: TaskResult;
|
|
26
|
+
}
|
|
27
|
+
export type TaskInput = Omit<Task, 'id' | 'enabled' | 'createdAt' | 'lastRun' | 'lastResult'> & {
|
|
28
|
+
enabled?: boolean;
|
|
29
|
+
};
|
|
30
|
+
export type TaskRunner = (task: Task) => Promise<TaskResult>;
|
|
31
|
+
export interface TaskStore {
|
|
32
|
+
list(): Promise<Task[]>;
|
|
33
|
+
get(id: string): Promise<Task | undefined>;
|
|
34
|
+
create(input: TaskInput): Promise<Task>;
|
|
35
|
+
update(id: string, patch: Partial<Task>): Promise<Task | undefined>;
|
|
36
|
+
remove(id: string): Promise<void>;
|
|
37
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export type { Schedule, Task, TaskInput, TaskResult, TaskRunner, TaskStore } from './engine/index.js';
|
|
2
|
+
export { createScheduler, createTaskStore, type Scheduler } from './engine/index.js';
|
|
3
|
+
export { createScheduleTaskTool } from './tool.js';
|
|
4
|
+
export { createTasksCommand } from './command.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createTasksCommand = exports.createScheduleTaskTool = exports.createTaskStore = exports.createScheduler = void 0;
|
|
4
|
+
var index_js_1 = require("./engine/index.js");
|
|
5
|
+
Object.defineProperty(exports, "createScheduler", { enumerable: true, get: function () { return index_js_1.createScheduler; } });
|
|
6
|
+
Object.defineProperty(exports, "createTaskStore", { enumerable: true, get: function () { return index_js_1.createTaskStore; } });
|
|
7
|
+
var tool_js_1 = require("./tool.js");
|
|
8
|
+
Object.defineProperty(exports, "createScheduleTaskTool", { enumerable: true, get: function () { return tool_js_1.createScheduleTaskTool; } });
|
|
9
|
+
var command_js_1 = require("./command.js");
|
|
10
|
+
Object.defineProperty(exports, "createTasksCommand", { enumerable: true, get: function () { return command_js_1.createTasksCommand; } });
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Tool } from 'mu-core';
|
|
2
|
+
import type { TaskStore } from './engine/index.js';
|
|
3
|
+
import type { SkillRegistry } from '../skills/index.js';
|
|
4
|
+
export declare const createScheduleTaskTool: (deps: {
|
|
5
|
+
store: TaskStore;
|
|
6
|
+
skills: SkillRegistry;
|
|
7
|
+
onChange?: () => void | Promise<void>;
|
|
8
|
+
}) => Tool;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createScheduleTaskTool = void 0;
|
|
4
|
+
const toSchedule = (raw) => {
|
|
5
|
+
const { cron, everyMs, at } = (raw ?? {});
|
|
6
|
+
if (typeof cron === 'string' && cron.trim())
|
|
7
|
+
return { kind: 'cron', expr: cron.trim() };
|
|
8
|
+
if (typeof everyMs === 'number' && everyMs > 0)
|
|
9
|
+
return { kind: 'interval', ms: everyMs };
|
|
10
|
+
if (typeof at === 'number')
|
|
11
|
+
return { kind: 'once', at };
|
|
12
|
+
return undefined;
|
|
13
|
+
};
|
|
14
|
+
const createScheduleTaskTool = (deps) => ({
|
|
15
|
+
name: 'schedule_task',
|
|
16
|
+
description: 'Persist a recurring (cron / heartbeat) or one-shot task that runs a sub-agent under a skill on a given prompt.',
|
|
17
|
+
prompt: 'Use `schedule_task` to register work that should run later or on a schedule: a `cron` expression, an `everyMs` heartbeat, or a one-shot `at` timestamp. It invokes a skill on a prompt, like `run_skill`.',
|
|
18
|
+
parameters: {
|
|
19
|
+
type: 'object',
|
|
20
|
+
properties: {
|
|
21
|
+
skill: { type: 'string', description: 'Skill name to run.' },
|
|
22
|
+
prompt: { type: 'string', description: 'The task prompt handed to the agent on each run.' },
|
|
23
|
+
agent: { type: 'string', description: 'Agent persona to run the skill as (defines its tools).' },
|
|
24
|
+
schedule: {
|
|
25
|
+
type: 'object',
|
|
26
|
+
description: 'Exactly one of: cron, everyMs, at.',
|
|
27
|
+
properties: {
|
|
28
|
+
cron: { type: 'string', description: 'Cron expression, e.g. "0 9 * * *".' },
|
|
29
|
+
everyMs: { type: 'number', description: 'Heartbeat interval in milliseconds.' },
|
|
30
|
+
at: { type: 'number', description: 'One-shot epoch-ms timestamp (omit to run as soon as scheduled).' },
|
|
31
|
+
},
|
|
32
|
+
additionalProperties: false,
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
required: ['skill', 'prompt', 'agent', 'schedule'],
|
|
36
|
+
additionalProperties: false,
|
|
37
|
+
},
|
|
38
|
+
run: async (input) => {
|
|
39
|
+
const { skill, prompt, agent, schedule } = (input ?? {});
|
|
40
|
+
if (!skill || !prompt || !agent) {
|
|
41
|
+
return [{ type: 'text', text: 'Error: schedule_task requires `skill`, `prompt`, and `agent`.' }];
|
|
42
|
+
}
|
|
43
|
+
if (!deps.skills.get(skill))
|
|
44
|
+
return [{ type: 'text', text: `Error: unknown skill "${skill}".` }];
|
|
45
|
+
const parsed = toSchedule(schedule);
|
|
46
|
+
if (!parsed)
|
|
47
|
+
return [{ type: 'text', text: 'Error: schedule needs one of `cron`, `everyMs`, or `at`.' }];
|
|
48
|
+
const task = await deps.store.create({ skill, prompt, agent, schedule: parsed });
|
|
49
|
+
await deps.onChange?.();
|
|
50
|
+
return [{ type: 'text', text: `Scheduled task ${task.id} (${parsed.kind}) running skill "${skill}".` }];
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
exports.createScheduleTaskTool = createScheduleTaskTool;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type Message, type Provider, type Tool } from 'mu-core';
|
|
2
|
+
import { type AgentSessionHooks } from '../hooks/index.js';
|
|
3
|
+
import { type Plugin } from '../plugin/index.js';
|
|
4
|
+
import type { AgentSession } from './types.js';
|
|
5
|
+
export interface AgentSessionConfig {
|
|
6
|
+
provider: Provider;
|
|
7
|
+
model: string;
|
|
8
|
+
tools?: Tool[];
|
|
9
|
+
hooks?: AgentSessionHooks;
|
|
10
|
+
plugins?: Plugin[];
|
|
11
|
+
system?: string;
|
|
12
|
+
id?: string;
|
|
13
|
+
messages?: Message[];
|
|
14
|
+
}
|
|
15
|
+
export declare const createAgentSession: (config: AgentSessionConfig) => AgentSession;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createAgentSession = void 0;
|
|
4
|
+
const mu_core_1 = require("mu-core");
|
|
5
|
+
const index_js_1 = require("../common/index.js");
|
|
6
|
+
const index_js_2 = require("../hooks/index.js");
|
|
7
|
+
const index_js_3 = require("../plugin/index.js");
|
|
8
|
+
const toMessage = (input) => ({
|
|
9
|
+
role: 'user',
|
|
10
|
+
content: typeof input === 'string' ? [{ type: 'text', text: input }] : input,
|
|
11
|
+
});
|
|
12
|
+
const systemMessage = (text) => ({ role: 'system', content: [{ type: 'text', text }] });
|
|
13
|
+
const textOf = (message) => message.content.map((part) => (part.type === 'text' ? part.text : '')).join('');
|
|
14
|
+
const createAgentSession = (config) => {
|
|
15
|
+
const { provider } = config;
|
|
16
|
+
const { tools, hooks } = (0, index_js_3.resolve)(config);
|
|
17
|
+
const decorated = tools.map((tool) => (0, index_js_2.withHooks)(tool, hooks));
|
|
18
|
+
const id = config.id ?? crypto.randomUUID();
|
|
19
|
+
const messages = config.messages
|
|
20
|
+
? [...config.messages]
|
|
21
|
+
: config.system
|
|
22
|
+
? [{ role: 'system', content: [{ type: 'text', text: config.system }] }]
|
|
23
|
+
: [];
|
|
24
|
+
const emitter = (0, index_js_1.createEmitter)();
|
|
25
|
+
let started = false;
|
|
26
|
+
let running = false;
|
|
27
|
+
let controller;
|
|
28
|
+
const send = async (input) => {
|
|
29
|
+
if (running)
|
|
30
|
+
throw new Error('AgentSession: busy (a turn is already running)');
|
|
31
|
+
running = true;
|
|
32
|
+
const ac = new AbortController();
|
|
33
|
+
controller = ac;
|
|
34
|
+
try {
|
|
35
|
+
if (!started) {
|
|
36
|
+
started = true;
|
|
37
|
+
await hooks.sessionStart?.();
|
|
38
|
+
}
|
|
39
|
+
const message = toMessage(input);
|
|
40
|
+
messages.push(message);
|
|
41
|
+
emitter.emit({ type: 'turn_start', input: message });
|
|
42
|
+
const hasSystem = messages[0]?.role === 'system';
|
|
43
|
+
const system = hasSystem ? textOf(messages[0]) : '';
|
|
44
|
+
const prepared = await hooks.prepareRequest?.({ system, tools: decorated });
|
|
45
|
+
const callTools = prepared?.tools ?? decorated;
|
|
46
|
+
const baseSystem = prepared?.system ?? system;
|
|
47
|
+
const toolBlock = callTools.map((tool) => tool.prompt?.trim()).filter(Boolean).join('\n');
|
|
48
|
+
const effectiveSystem = [baseSystem, toolBlock].filter(Boolean).join('\n\n');
|
|
49
|
+
const body = hasSystem ? messages.slice(1) : messages;
|
|
50
|
+
const callMessages = effectiveSystem ? [systemMessage(effectiveSystem), ...body] : body;
|
|
51
|
+
const events = (0, mu_core_1.run)({
|
|
52
|
+
provider,
|
|
53
|
+
model: config.model,
|
|
54
|
+
tools: callTools,
|
|
55
|
+
messages: callMessages,
|
|
56
|
+
signal: ac.signal,
|
|
57
|
+
});
|
|
58
|
+
for await (const event of events) {
|
|
59
|
+
if (event.type === 'message')
|
|
60
|
+
messages.push(event.message);
|
|
61
|
+
emitter.emit(event);
|
|
62
|
+
}
|
|
63
|
+
emitter.emit({ type: 'turn_end' });
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
if (ac.signal.aborted)
|
|
67
|
+
emitter.emit({ type: 'turn_end' });
|
|
68
|
+
else
|
|
69
|
+
emitter.emit({ type: 'error', error });
|
|
70
|
+
}
|
|
71
|
+
finally {
|
|
72
|
+
running = false;
|
|
73
|
+
controller = undefined;
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
return {
|
|
77
|
+
id,
|
|
78
|
+
get messages() {
|
|
79
|
+
return messages;
|
|
80
|
+
},
|
|
81
|
+
send,
|
|
82
|
+
abort: () => controller?.abort(),
|
|
83
|
+
subscribe: emitter.subscribe,
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
exports.createAgentSession = createAgentSession;
|