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,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 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export const createTasksCommand = (tasks) => ({
|
|
2
|
+
name: 'tasks',
|
|
3
|
+
description: 'List scheduled tasks',
|
|
4
|
+
run: async () => {
|
|
5
|
+
const list = await tasks.list();
|
|
6
|
+
if (list.length === 0)
|
|
7
|
+
return { ok: true, output: 'No tasks scheduled.' };
|
|
8
|
+
const describe = (t) => {
|
|
9
|
+
const when = t.schedule.kind === 'cron'
|
|
10
|
+
? t.schedule.expr
|
|
11
|
+
: t.schedule.kind === 'interval'
|
|
12
|
+
? `every ${t.schedule.ms}ms`
|
|
13
|
+
: 'once';
|
|
14
|
+
const state = t.enabled ? when : `${when} (disabled)`;
|
|
15
|
+
return `- ${t.id} — ${t.skill} [${state}]`;
|
|
16
|
+
};
|
|
17
|
+
return { ok: true, output: list.map(describe).join('\n') };
|
|
18
|
+
},
|
|
19
|
+
});
|
|
@@ -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,65 @@
|
|
|
1
|
+
import { Cron } from 'croner';
|
|
2
|
+
export const createScheduler = (deps) => {
|
|
3
|
+
const { store, run } = deps;
|
|
4
|
+
const crons = new Map();
|
|
5
|
+
const timers = new Map();
|
|
6
|
+
let started = false;
|
|
7
|
+
const fire = async (id) => {
|
|
8
|
+
const task = await store.get(id);
|
|
9
|
+
if (!task || !task.enabled)
|
|
10
|
+
return;
|
|
11
|
+
try {
|
|
12
|
+
const result = await run(task);
|
|
13
|
+
await store.update(id, { lastRun: Date.now(), lastResult: result });
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
deps.onError?.(error, task);
|
|
17
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
18
|
+
await store.update(id, { lastRun: Date.now(), lastResult: { ok: false, error: message } });
|
|
19
|
+
}
|
|
20
|
+
if (task.schedule.kind === 'once')
|
|
21
|
+
await store.update(id, { enabled: false });
|
|
22
|
+
};
|
|
23
|
+
const clear = () => {
|
|
24
|
+
for (const cron of crons.values())
|
|
25
|
+
cron.stop();
|
|
26
|
+
for (const timer of timers.values())
|
|
27
|
+
clearTimeout(timer);
|
|
28
|
+
crons.clear();
|
|
29
|
+
timers.clear();
|
|
30
|
+
};
|
|
31
|
+
const schedule = (task) => {
|
|
32
|
+
if (!task.enabled)
|
|
33
|
+
return;
|
|
34
|
+
const s = task.schedule;
|
|
35
|
+
if (s.kind === 'cron') {
|
|
36
|
+
crons.set(task.id, new Cron(s.expr, () => void fire(task.id)));
|
|
37
|
+
}
|
|
38
|
+
else if (s.kind === 'interval') {
|
|
39
|
+
timers.set(task.id, setInterval(() => void fire(task.id), s.ms));
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
const delay = s.at ? Math.max(0, s.at - Date.now()) : 0;
|
|
43
|
+
timers.set(task.id, setTimeout(() => void fire(task.id), delay));
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
const reload = async () => {
|
|
47
|
+
clear();
|
|
48
|
+
if (!started)
|
|
49
|
+
return;
|
|
50
|
+
for (const task of await store.list())
|
|
51
|
+
schedule(task);
|
|
52
|
+
};
|
|
53
|
+
return {
|
|
54
|
+
start: async () => {
|
|
55
|
+
started = true;
|
|
56
|
+
await reload();
|
|
57
|
+
},
|
|
58
|
+
stop: () => {
|
|
59
|
+
started = false;
|
|
60
|
+
clear();
|
|
61
|
+
},
|
|
62
|
+
reload,
|
|
63
|
+
runNow: (id) => fire(id),
|
|
64
|
+
};
|
|
65
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { mkdir, readdir, readFile, rm, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
export const createTaskStore = (options) => {
|
|
4
|
+
const { dir } = options;
|
|
5
|
+
const file = (id) => join(dir, `${id}.json`);
|
|
6
|
+
const read = async (id) => {
|
|
7
|
+
try {
|
|
8
|
+
return JSON.parse(await readFile(file(id), 'utf-8'));
|
|
9
|
+
}
|
|
10
|
+
catch {
|
|
11
|
+
return undefined;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
const write = async (task) => {
|
|
15
|
+
await mkdir(dir, { recursive: true });
|
|
16
|
+
await writeFile(file(task.id), JSON.stringify(task, null, 2), 'utf-8');
|
|
17
|
+
};
|
|
18
|
+
return {
|
|
19
|
+
list: async () => {
|
|
20
|
+
let entries;
|
|
21
|
+
try {
|
|
22
|
+
entries = await readdir(dir);
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
27
|
+
const tasks = [];
|
|
28
|
+
for (const name of entries.sort()) {
|
|
29
|
+
if (!name.endsWith('.json'))
|
|
30
|
+
continue;
|
|
31
|
+
const task = await read(name.slice(0, -'.json'.length));
|
|
32
|
+
if (task)
|
|
33
|
+
tasks.push(task);
|
|
34
|
+
}
|
|
35
|
+
return tasks;
|
|
36
|
+
},
|
|
37
|
+
get: read,
|
|
38
|
+
create: async (input) => {
|
|
39
|
+
const task = { ...input, id: crypto.randomUUID(), enabled: input.enabled ?? true, createdAt: Date.now() };
|
|
40
|
+
await write(task);
|
|
41
|
+
return task;
|
|
42
|
+
},
|
|
43
|
+
update: async (id, patch) => {
|
|
44
|
+
const task = await read(id);
|
|
45
|
+
if (!task)
|
|
46
|
+
return undefined;
|
|
47
|
+
const next = { ...task, ...patch, id: task.id };
|
|
48
|
+
await write(next);
|
|
49
|
+
return next;
|
|
50
|
+
},
|
|
51
|
+
remove: async (id) => {
|
|
52
|
+
await rm(file(id), { force: true });
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
};
|
|
@@ -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 @@
|
|
|
1
|
+
export {};
|
|
@@ -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,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,49 @@
|
|
|
1
|
+
const toSchedule = (raw) => {
|
|
2
|
+
const { cron, everyMs, at } = (raw ?? {});
|
|
3
|
+
if (typeof cron === 'string' && cron.trim())
|
|
4
|
+
return { kind: 'cron', expr: cron.trim() };
|
|
5
|
+
if (typeof everyMs === 'number' && everyMs > 0)
|
|
6
|
+
return { kind: 'interval', ms: everyMs };
|
|
7
|
+
if (typeof at === 'number')
|
|
8
|
+
return { kind: 'once', at };
|
|
9
|
+
return undefined;
|
|
10
|
+
};
|
|
11
|
+
export const createScheduleTaskTool = (deps) => ({
|
|
12
|
+
name: 'schedule_task',
|
|
13
|
+
description: 'Persist a recurring (cron / heartbeat) or one-shot task that runs a sub-agent under a skill on a given prompt.',
|
|
14
|
+
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`.',
|
|
15
|
+
parameters: {
|
|
16
|
+
type: 'object',
|
|
17
|
+
properties: {
|
|
18
|
+
skill: { type: 'string', description: 'Skill name to run.' },
|
|
19
|
+
prompt: { type: 'string', description: 'The task prompt handed to the agent on each run.' },
|
|
20
|
+
agent: { type: 'string', description: 'Agent persona to run the skill as (defines its tools).' },
|
|
21
|
+
schedule: {
|
|
22
|
+
type: 'object',
|
|
23
|
+
description: 'Exactly one of: cron, everyMs, at.',
|
|
24
|
+
properties: {
|
|
25
|
+
cron: { type: 'string', description: 'Cron expression, e.g. "0 9 * * *".' },
|
|
26
|
+
everyMs: { type: 'number', description: 'Heartbeat interval in milliseconds.' },
|
|
27
|
+
at: { type: 'number', description: 'One-shot epoch-ms timestamp (omit to run as soon as scheduled).' },
|
|
28
|
+
},
|
|
29
|
+
additionalProperties: false,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
required: ['skill', 'prompt', 'agent', 'schedule'],
|
|
33
|
+
additionalProperties: false,
|
|
34
|
+
},
|
|
35
|
+
run: async (input) => {
|
|
36
|
+
const { skill, prompt, agent, schedule } = (input ?? {});
|
|
37
|
+
if (!skill || !prompt || !agent) {
|
|
38
|
+
return [{ type: 'text', text: 'Error: schedule_task requires `skill`, `prompt`, and `agent`.' }];
|
|
39
|
+
}
|
|
40
|
+
if (!deps.skills.get(skill))
|
|
41
|
+
return [{ type: 'text', text: `Error: unknown skill "${skill}".` }];
|
|
42
|
+
const parsed = toSchedule(schedule);
|
|
43
|
+
if (!parsed)
|
|
44
|
+
return [{ type: 'text', text: 'Error: schedule needs one of `cron`, `everyMs`, or `at`.' }];
|
|
45
|
+
const task = await deps.store.create({ skill, prompt, agent, schedule: parsed });
|
|
46
|
+
await deps.onChange?.();
|
|
47
|
+
return [{ type: 'text', text: `Scheduled task ${task.id} (${parsed.kind}) running skill "${skill}".` }];
|
|
48
|
+
},
|
|
49
|
+
});
|
|
@@ -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,82 @@
|
|
|
1
|
+
import { run } from 'mu-core';
|
|
2
|
+
import { createEmitter } from '../common/index.js';
|
|
3
|
+
import { withHooks } from '../hooks/index.js';
|
|
4
|
+
import { resolve } from '../plugin/index.js';
|
|
5
|
+
const toMessage = (input) => ({
|
|
6
|
+
role: 'user',
|
|
7
|
+
content: typeof input === 'string' ? [{ type: 'text', text: input }] : input,
|
|
8
|
+
});
|
|
9
|
+
const systemMessage = (text) => ({ role: 'system', content: [{ type: 'text', text }] });
|
|
10
|
+
const textOf = (message) => message.content.map((part) => (part.type === 'text' ? part.text : '')).join('');
|
|
11
|
+
export const createAgentSession = (config) => {
|
|
12
|
+
const { provider } = config;
|
|
13
|
+
const { tools, hooks } = resolve(config);
|
|
14
|
+
const decorated = tools.map((tool) => withHooks(tool, hooks));
|
|
15
|
+
const id = config.id ?? crypto.randomUUID();
|
|
16
|
+
const messages = config.messages
|
|
17
|
+
? [...config.messages]
|
|
18
|
+
: config.system
|
|
19
|
+
? [{ role: 'system', content: [{ type: 'text', text: config.system }] }]
|
|
20
|
+
: [];
|
|
21
|
+
const emitter = createEmitter();
|
|
22
|
+
let started = false;
|
|
23
|
+
let running = false;
|
|
24
|
+
let controller;
|
|
25
|
+
const send = async (input) => {
|
|
26
|
+
if (running)
|
|
27
|
+
throw new Error('AgentSession: busy (a turn is already running)');
|
|
28
|
+
running = true;
|
|
29
|
+
const ac = new AbortController();
|
|
30
|
+
controller = ac;
|
|
31
|
+
try {
|
|
32
|
+
if (!started) {
|
|
33
|
+
started = true;
|
|
34
|
+
await hooks.sessionStart?.();
|
|
35
|
+
}
|
|
36
|
+
const message = toMessage(input);
|
|
37
|
+
messages.push(message);
|
|
38
|
+
emitter.emit({ type: 'turn_start', input: message });
|
|
39
|
+
const hasSystem = messages[0]?.role === 'system';
|
|
40
|
+
const system = hasSystem ? textOf(messages[0]) : '';
|
|
41
|
+
const prepared = await hooks.prepareRequest?.({ system, tools: decorated });
|
|
42
|
+
const callTools = prepared?.tools ?? decorated;
|
|
43
|
+
const baseSystem = prepared?.system ?? system;
|
|
44
|
+
const toolBlock = callTools.map((tool) => tool.prompt?.trim()).filter(Boolean).join('\n');
|
|
45
|
+
const effectiveSystem = [baseSystem, toolBlock].filter(Boolean).join('\n\n');
|
|
46
|
+
const body = hasSystem ? messages.slice(1) : messages;
|
|
47
|
+
const callMessages = effectiveSystem ? [systemMessage(effectiveSystem), ...body] : body;
|
|
48
|
+
const events = run({
|
|
49
|
+
provider,
|
|
50
|
+
model: config.model,
|
|
51
|
+
tools: callTools,
|
|
52
|
+
messages: callMessages,
|
|
53
|
+
signal: ac.signal,
|
|
54
|
+
});
|
|
55
|
+
for await (const event of events) {
|
|
56
|
+
if (event.type === 'message')
|
|
57
|
+
messages.push(event.message);
|
|
58
|
+
emitter.emit(event);
|
|
59
|
+
}
|
|
60
|
+
emitter.emit({ type: 'turn_end' });
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
if (ac.signal.aborted)
|
|
64
|
+
emitter.emit({ type: 'turn_end' });
|
|
65
|
+
else
|
|
66
|
+
emitter.emit({ type: 'error', error });
|
|
67
|
+
}
|
|
68
|
+
finally {
|
|
69
|
+
running = false;
|
|
70
|
+
controller = undefined;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
return {
|
|
74
|
+
id,
|
|
75
|
+
get messages() {
|
|
76
|
+
return messages;
|
|
77
|
+
},
|
|
78
|
+
send,
|
|
79
|
+
abort: () => controller?.abort(),
|
|
80
|
+
subscribe: emitter.subscribe,
|
|
81
|
+
};
|
|
82
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface SessionRecord {
|
|
2
|
+
id: string;
|
|
3
|
+
title?: string;
|
|
4
|
+
cwd?: string;
|
|
5
|
+
parentId?: string;
|
|
6
|
+
createdAt: number;
|
|
7
|
+
}
|
|
8
|
+
export interface SessionCatalog {
|
|
9
|
+
record(id: string, info: {
|
|
10
|
+
cwd?: string;
|
|
11
|
+
parentId?: string;
|
|
12
|
+
}): void;
|
|
13
|
+
setTitle(id: string, title: string): void;
|
|
14
|
+
get(id: string): SessionRecord | undefined;
|
|
15
|
+
list(filter?: {
|
|
16
|
+
cwd?: string;
|
|
17
|
+
parentId?: string;
|
|
18
|
+
}): SessionRecord[];
|
|
19
|
+
delete(id: string): void;
|
|
20
|
+
close(): void;
|
|
21
|
+
}
|
|
22
|
+
export declare const createSessionCatalog: ({ file }: {
|
|
23
|
+
file: string;
|
|
24
|
+
}) => SessionCatalog;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { mkdirSync } from 'node:fs';
|
|
2
|
+
import { dirname } from 'node:path';
|
|
3
|
+
import { DatabaseSync } from 'node:sqlite';
|
|
4
|
+
const toRecord = (row) => ({
|
|
5
|
+
id: row.id,
|
|
6
|
+
title: row.title ?? undefined,
|
|
7
|
+
cwd: row.cwd ?? undefined,
|
|
8
|
+
parentId: row.parent_id ?? undefined,
|
|
9
|
+
createdAt: row.created_at,
|
|
10
|
+
});
|
|
11
|
+
export const createSessionCatalog = ({ file }) => {
|
|
12
|
+
mkdirSync(dirname(file), { recursive: true });
|
|
13
|
+
const db = new DatabaseSync(file);
|
|
14
|
+
db.exec('CREATE TABLE IF NOT EXISTS sessions (id TEXT PRIMARY KEY, title TEXT, cwd TEXT, parent_id TEXT, created_at INTEGER NOT NULL)');
|
|
15
|
+
try {
|
|
16
|
+
db.exec('ALTER TABLE sessions ADD COLUMN parent_id TEXT');
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
void 0;
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
record: (id, info) => {
|
|
23
|
+
db.prepare('INSERT OR IGNORE INTO sessions (id, cwd, parent_id, created_at) VALUES (?, ?, ?, ?)').run(id, info.cwd ?? null, info.parentId ?? null, Date.now());
|
|
24
|
+
},
|
|
25
|
+
setTitle: (id, title) => {
|
|
26
|
+
db.prepare('UPDATE sessions SET title = ? WHERE id = ?').run(title, id);
|
|
27
|
+
},
|
|
28
|
+
get: (id) => {
|
|
29
|
+
const row = db.prepare('SELECT * FROM sessions WHERE id = ?').get(id);
|
|
30
|
+
return row ? toRecord(row) : undefined;
|
|
31
|
+
},
|
|
32
|
+
list: (filter) => {
|
|
33
|
+
let sql = 'SELECT * FROM sessions';
|
|
34
|
+
const params = [];
|
|
35
|
+
if (filter?.parentId !== undefined) {
|
|
36
|
+
sql += ' WHERE parent_id = ?';
|
|
37
|
+
params.push(filter.parentId);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
sql += ' WHERE parent_id IS NULL';
|
|
41
|
+
if (filter?.cwd !== undefined) {
|
|
42
|
+
sql += ' AND cwd = ?';
|
|
43
|
+
params.push(filter.cwd);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
sql += ' ORDER BY created_at DESC';
|
|
47
|
+
const rows = db.prepare(sql).all(...params);
|
|
48
|
+
return rows.map(toRecord);
|
|
49
|
+
},
|
|
50
|
+
delete: (id) => {
|
|
51
|
+
db.prepare('DELETE FROM sessions WHERE id = ?').run(id);
|
|
52
|
+
},
|
|
53
|
+
close: () => db.close(),
|
|
54
|
+
};
|
|
55
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type { AgentSession, AgentSessionEvent } from './types.js';
|
|
2
|
+
export { type AgentSessionConfig, createAgentSession } from './agent-session.js';
|
|
3
|
+
export { createSessionStore, type SessionStore, type StoredSession } from './store.js';
|
|
4
|
+
export { createSessionCatalog, type SessionCatalog, type SessionRecord } from './catalog.js';
|
|
5
|
+
export { persistTo } from './persist.js';
|
|
6
|
+
export { createSessionManager, type ReviveInput, type SessionManager, type SessionManagerOptions } from './manager.js';
|
|
7
|
+
export { cleanTitle, runTitler, type RunTitlerOptions, titleFallback } from './title.js';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { createAgentSession } from './agent-session.js';
|
|
2
|
+
export { createSessionStore } from './store.js';
|
|
3
|
+
export { createSessionCatalog } from './catalog.js';
|
|
4
|
+
export { persistTo } from './persist.js';
|
|
5
|
+
export { createSessionManager } from './manager.js';
|
|
6
|
+
export { cleanTitle, runTitler, titleFallback } from './title.js';
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { Message } from 'mu-core';
|
|
2
|
+
import type { SessionCatalog, SessionRecord } from './catalog.js';
|
|
3
|
+
import type { SessionStore, StoredSession } from './store.js';
|
|
4
|
+
import type { AgentSession } from './types.js';
|
|
5
|
+
export interface ReviveInput {
|
|
6
|
+
id: string;
|
|
7
|
+
model?: string;
|
|
8
|
+
messages?: Message[];
|
|
9
|
+
}
|
|
10
|
+
export interface SessionManagerOptions {
|
|
11
|
+
store: SessionStore;
|
|
12
|
+
catalog: SessionCatalog;
|
|
13
|
+
revive(input: ReviveInput): AgentSession;
|
|
14
|
+
newId(): string;
|
|
15
|
+
cwd?: string;
|
|
16
|
+
title?(input: {
|
|
17
|
+
id: string;
|
|
18
|
+
text: string;
|
|
19
|
+
}): void;
|
|
20
|
+
}
|
|
21
|
+
export interface SessionManager {
|
|
22
|
+
create(options?: {
|
|
23
|
+
id?: string;
|
|
24
|
+
model?: string;
|
|
25
|
+
cwd?: string;
|
|
26
|
+
}): AgentSession;
|
|
27
|
+
open(id: string): Promise<AgentSession>;
|
|
28
|
+
fork(id: string, upToIndex: number): Promise<AgentSession>;
|
|
29
|
+
list(filter?: {
|
|
30
|
+
cwd?: string;
|
|
31
|
+
parentId?: string;
|
|
32
|
+
}): Promise<SessionRecord[]>;
|
|
33
|
+
get(id: string): Promise<SessionRecord | undefined>;
|
|
34
|
+
/** Read a session's stored messages by id without instantiating a live session. */
|
|
35
|
+
read(id: string): Promise<StoredSession | undefined>;
|
|
36
|
+
rename(id: string, title: string): void;
|
|
37
|
+
delete(id: string): Promise<void>;
|
|
38
|
+
}
|
|
39
|
+
export declare const createSessionManager: ({ store, catalog, revive, newId, cwd, title }: SessionManagerOptions) => SessionManager;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { persistTo } from './persist.js';
|
|
2
|
+
const inputText = (input) => typeof input === 'string' ? input : input.map((part) => (part.type === 'text' ? part.text : '')).join('');
|
|
3
|
+
const onFirstMessage = (session, fire) => {
|
|
4
|
+
let pending = !session.messages.some((message) => message.role === 'user');
|
|
5
|
+
return {
|
|
6
|
+
get id() {
|
|
7
|
+
return session.id;
|
|
8
|
+
},
|
|
9
|
+
get messages() {
|
|
10
|
+
return session.messages;
|
|
11
|
+
},
|
|
12
|
+
send: async (input) => {
|
|
13
|
+
if (pending) {
|
|
14
|
+
pending = false;
|
|
15
|
+
fire({ id: session.id, text: inputText(input) });
|
|
16
|
+
}
|
|
17
|
+
await session.send(input);
|
|
18
|
+
},
|
|
19
|
+
abort: session.abort,
|
|
20
|
+
subscribe: session.subscribe,
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export const createSessionManager = ({ store, catalog, revive, newId, cwd, title }) => ({
|
|
24
|
+
create: (options) => {
|
|
25
|
+
const id = options?.id ?? newId();
|
|
26
|
+
catalog.record(id, { cwd: options?.cwd ?? cwd });
|
|
27
|
+
const session = persistTo(store, revive({ id, model: options?.model }));
|
|
28
|
+
return title ? onFirstMessage(session, title) : session;
|
|
29
|
+
},
|
|
30
|
+
open: async (id) => {
|
|
31
|
+
const stored = await store.load(id);
|
|
32
|
+
return persistTo(store, revive({ id: stored.id, messages: stored.messages }), stored.messages.length);
|
|
33
|
+
},
|
|
34
|
+
fork: async (id, upToIndex) => {
|
|
35
|
+
const stored = await store.load(id);
|
|
36
|
+
const messages = stored.messages.slice(0, upToIndex + 1);
|
|
37
|
+
const forkId = newId();
|
|
38
|
+
catalog.record(forkId, { cwd: catalog.get(id)?.cwd ?? cwd });
|
|
39
|
+
const session = revive({ id: forkId, messages });
|
|
40
|
+
await store.append(forkId, messages);
|
|
41
|
+
return persistTo(store, session, messages.length);
|
|
42
|
+
},
|
|
43
|
+
list: async (filter) => catalog.list(filter),
|
|
44
|
+
get: async (id) => catalog.get(id),
|
|
45
|
+
read: async (id) => {
|
|
46
|
+
try {
|
|
47
|
+
return await store.load(id);
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
rename: (id, title) => catalog.setTitle(id, title),
|
|
54
|
+
delete: async (id) => {
|
|
55
|
+
for (const child of catalog.list({ parentId: id })) {
|
|
56
|
+
await store.delete(child.id);
|
|
57
|
+
catalog.delete(child.id);
|
|
58
|
+
}
|
|
59
|
+
await store.delete(id);
|
|
60
|
+
catalog.delete(id);
|
|
61
|
+
},
|
|
62
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export const persistTo = (store, session, persisted = 0) => {
|
|
2
|
+
let count = persisted;
|
|
3
|
+
return {
|
|
4
|
+
get id() {
|
|
5
|
+
return session.id;
|
|
6
|
+
},
|
|
7
|
+
get messages() {
|
|
8
|
+
return session.messages;
|
|
9
|
+
},
|
|
10
|
+
send: async (input) => {
|
|
11
|
+
await session.send(input);
|
|
12
|
+
const all = session.messages;
|
|
13
|
+
if (all.length > count) {
|
|
14
|
+
await store.append(session.id, all.slice(count));
|
|
15
|
+
count = all.length;
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
abort: session.abort,
|
|
19
|
+
subscribe: session.subscribe,
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Message } from 'mu-core';
|
|
2
|
+
export interface StoredSession {
|
|
3
|
+
id: string;
|
|
4
|
+
messages: Message[];
|
|
5
|
+
}
|
|
6
|
+
export interface SessionStore {
|
|
7
|
+
load(id: string): Promise<StoredSession>;
|
|
8
|
+
append(id: string, messages: Message[]): Promise<void>;
|
|
9
|
+
delete(id: string): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export declare const createSessionStore: ({ dir }: {
|
|
12
|
+
dir: string;
|
|
13
|
+
}) => SessionStore;
|