mu-harness 0.16.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/core/src/agent.d.ts +39 -0
- package/esm/core/src/agent.js +96 -0
- package/esm/core/src/index.d.ts +4 -0
- package/esm/core/src/index.js +2 -0
- package/esm/core/src/types.d.ts +59 -0
- package/esm/core/src/types.js +3 -0
- package/esm/harness/npm/src/_dnt.polyfills.d.ts +11 -0
- package/esm/harness/npm/src/_dnt.polyfills.js +15 -0
- package/esm/harness/npm/src/agents/index.d.ts +4 -0
- package/esm/harness/npm/src/agents/index.js +3 -0
- package/esm/harness/npm/src/agents/loader.d.ts +2 -0
- package/esm/harness/npm/src/agents/loader.js +24 -0
- package/esm/harness/npm/src/agents/parser.d.ts +2 -0
- package/esm/harness/npm/src/agents/parser.js +20 -0
- package/esm/harness/npm/src/agents/registry.d.ts +6 -0
- package/esm/harness/npm/src/agents/registry.js +31 -0
- package/esm/harness/npm/src/agents/types.d.ts +8 -0
- package/esm/harness/npm/src/agents/types.js +1 -0
- package/esm/harness/npm/src/channels/channel.d.ts +7 -0
- package/esm/harness/npm/src/channels/channel.js +25 -0
- package/esm/harness/npm/src/channels/index.d.ts +3 -0
- package/esm/harness/npm/src/channels/index.js +2 -0
- package/esm/harness/npm/src/channels/manager.d.ts +6 -0
- package/esm/harness/npm/src/channels/manager.js +28 -0
- package/esm/harness/npm/src/channels/types.d.ts +30 -0
- package/esm/harness/npm/src/channels/types.js +1 -0
- package/esm/harness/npm/src/commands/defaults.d.ts +9 -0
- package/esm/harness/npm/src/commands/defaults.js +53 -0
- package/esm/harness/npm/src/commands/index.d.ts +3 -0
- package/esm/harness/npm/src/commands/index.js +2 -0
- package/esm/harness/npm/src/commands/registry.d.ts +2 -0
- package/esm/harness/npm/src/commands/registry.js +59 -0
- package/esm/harness/npm/src/commands/types.d.ts +23 -0
- package/esm/harness/npm/src/commands/types.js +1 -0
- package/esm/harness/npm/src/common/frontmatter.d.ts +6 -0
- package/esm/harness/npm/src/common/frontmatter.js +18 -0
- package/esm/harness/npm/src/common/index.d.ts +2 -0
- package/esm/harness/npm/src/common/index.js +2 -0
- package/esm/harness/npm/src/common/utils.d.ts +5 -0
- package/esm/harness/npm/src/common/utils.js +13 -0
- package/esm/harness/npm/src/config/index.d.ts +2 -0
- package/esm/harness/npm/src/config/index.js +1 -0
- package/esm/harness/npm/src/config/resolve.d.ts +2 -0
- package/esm/harness/npm/src/config/resolve.js +10 -0
- package/esm/harness/npm/src/config/types.d.ts +15 -0
- package/esm/harness/npm/src/config/types.js +1 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_chars.d.ts +32 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_chars.js +48 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_dumper_state.d.ts +105 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_dumper_state.js +638 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_loader_state.d.ts +63 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_loader_state.js +1371 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_schema.d.ts +43 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_schema.js +117 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/binary.d.ts +2 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/binary.js +103 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/bool.d.ts +2 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/bool.js +32 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/float.d.ts +2 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/float.js +96 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/int.d.ts +2 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/int.js +159 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/map.d.ts +2 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/map.js +14 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/merge.d.ts +2 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/merge.js +10 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/nil.d.ts +2 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/nil.js +22 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/omap.d.ts +2 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/omap.js +29 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/pairs.d.ts +2 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/pairs.js +19 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/regexp.d.ts +2 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/regexp.js +30 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/seq.d.ts +2 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/seq.js +10 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/set.d.ts +2 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/set.js +14 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/str.d.ts +2 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/str.js +9 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/timestamp.d.ts +2 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/timestamp.js +81 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/undefined.d.ts +2 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/undefined.js +20 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type.d.ts +31 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type.js +6 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_utils.d.ts +3 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_utils.js +13 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/mod.d.ts +49 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/mod.js +52 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/parse.d.ts +75 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/parse.js +91 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/stringify.d.ts +99 -0
- package/esm/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/stringify.js +33 -0
- package/esm/harness/npm/src/harness/create.d.ts +2 -0
- package/esm/harness/npm/src/harness/create.js +139 -0
- package/esm/harness/npm/src/harness/index.d.ts +3 -0
- package/esm/harness/npm/src/harness/index.js +2 -0
- package/esm/harness/npm/src/harness/models.d.ts +16 -0
- package/esm/harness/npm/src/harness/models.js +30 -0
- package/esm/harness/npm/src/harness/types.d.ts +35 -0
- package/esm/harness/npm/src/harness/types.js +1 -0
- package/esm/harness/npm/src/hooks/index.d.ts +3 -0
- package/esm/harness/npm/src/hooks/index.js +2 -0
- package/esm/harness/npm/src/hooks/merge-hooks.d.ts +2 -0
- package/esm/harness/npm/src/hooks/merge-hooks.js +42 -0
- package/esm/harness/npm/src/hooks/types.d.ts +20 -0
- package/esm/harness/npm/src/hooks/types.js +1 -0
- package/esm/harness/npm/src/hooks/with-hooks.d.ts +3 -0
- package/esm/harness/npm/src/hooks/with-hooks.js +12 -0
- package/esm/harness/npm/src/index.d.ts +15 -0
- package/esm/harness/npm/src/index.js +15 -0
- package/esm/harness/npm/src/permissions/allow-list.d.ts +4 -0
- package/esm/harness/npm/src/permissions/allow-list.js +8 -0
- package/esm/harness/npm/src/permissions/approval.d.ts +17 -0
- package/esm/harness/npm/src/permissions/approval.js +13 -0
- package/esm/harness/npm/src/permissions/glob.d.ts +1 -0
- package/esm/harness/npm/src/permissions/glob.js +2 -0
- package/esm/harness/npm/src/permissions/index.d.ts +3 -0
- package/esm/harness/npm/src/permissions/index.js +3 -0
- package/esm/harness/npm/src/plugin/define.d.ts +2 -0
- package/esm/harness/npm/src/plugin/define.js +1 -0
- package/esm/harness/npm/src/plugin/import-ts.d.ts +1 -0
- package/esm/harness/npm/src/plugin/import-ts.js +85 -0
- package/esm/harness/npm/src/plugin/index.d.ts +5 -0
- package/esm/harness/npm/src/plugin/index.js +4 -0
- package/esm/harness/npm/src/plugin/resolve.d.ts +13 -0
- package/esm/harness/npm/src/plugin/resolve.js +17 -0
- package/esm/harness/npm/src/plugin/store.d.ts +8 -0
- package/esm/harness/npm/src/plugin/store.js +26 -0
- package/esm/harness/npm/src/plugin/types.d.ts +11 -0
- package/esm/harness/npm/src/plugin/types.js +1 -0
- package/esm/harness/npm/src/scheduler/command.d.ts +3 -0
- package/esm/harness/npm/src/scheduler/command.js +19 -0
- package/esm/harness/npm/src/scheduler/engine/index.d.ts +3 -0
- package/esm/harness/npm/src/scheduler/engine/index.js +2 -0
- package/esm/harness/npm/src/scheduler/engine/scheduler.d.ts +12 -0
- package/esm/harness/npm/src/scheduler/engine/scheduler.js +65 -0
- package/esm/harness/npm/src/scheduler/engine/store.d.ts +4 -0
- package/esm/harness/npm/src/scheduler/engine/store.js +55 -0
- package/esm/harness/npm/src/scheduler/engine/types.d.ts +37 -0
- package/esm/harness/npm/src/scheduler/engine/types.js +1 -0
- package/esm/harness/npm/src/scheduler/index.d.ts +4 -0
- package/esm/harness/npm/src/scheduler/index.js +3 -0
- package/esm/harness/npm/src/scheduler/tool.d.ts +8 -0
- package/esm/harness/npm/src/scheduler/tool.js +49 -0
- package/esm/harness/npm/src/session/agent-session.d.ts +15 -0
- package/esm/harness/npm/src/session/agent-session.js +82 -0
- package/esm/harness/npm/src/session/catalog.d.ts +24 -0
- package/esm/harness/npm/src/session/catalog.js +55 -0
- package/esm/harness/npm/src/session/index.d.ts +7 -0
- package/esm/harness/npm/src/session/index.js +6 -0
- package/esm/harness/npm/src/session/manager.d.ts +39 -0
- package/esm/harness/npm/src/session/manager.js +62 -0
- package/esm/harness/npm/src/session/persist.d.ts +3 -0
- package/esm/harness/npm/src/session/persist.js +21 -0
- package/esm/harness/npm/src/session/store.d.ts +13 -0
- package/esm/harness/npm/src/session/store.js +24 -0
- package/esm/harness/npm/src/session/title.d.ts +9 -0
- package/esm/harness/npm/src/session/title.js +24 -0
- package/esm/harness/npm/src/session/types.d.ts +17 -0
- package/esm/harness/npm/src/session/types.js +1 -0
- package/esm/harness/npm/src/skills/index.d.ts +7 -0
- package/esm/harness/npm/src/skills/index.js +6 -0
- package/esm/harness/npm/src/skills/loader.d.ts +2 -0
- package/esm/harness/npm/src/skills/loader.js +26 -0
- package/esm/harness/npm/src/skills/parser.d.ts +2 -0
- package/esm/harness/npm/src/skills/parser.js +10 -0
- package/esm/harness/npm/src/skills/registry.d.ts +8 -0
- package/esm/harness/npm/src/skills/registry.js +16 -0
- package/esm/harness/npm/src/skills/run.d.ts +14 -0
- package/esm/harness/npm/src/skills/run.js +45 -0
- package/esm/harness/npm/src/skills/tool.d.ts +3 -0
- package/esm/harness/npm/src/skills/tool.js +31 -0
- package/esm/harness/npm/src/skills/types.d.ts +6 -0
- package/esm/harness/npm/src/skills/types.js +1 -0
- package/esm/harness/npm/src/skills/writer.d.ts +7 -0
- package/esm/harness/npm/src/skills/writer.js +43 -0
- package/esm/harness/npm/src/subAgents/index.d.ts +4 -0
- package/esm/harness/npm/src/subAgents/index.js +3 -0
- package/esm/harness/npm/src/subAgents/registry.d.ts +2 -0
- package/esm/harness/npm/src/subAgents/registry.js +18 -0
- package/esm/harness/npm/src/subAgents/runner.d.ts +15 -0
- package/esm/harness/npm/src/subAgents/runner.js +33 -0
- package/esm/harness/npm/src/subAgents/tool.d.ts +6 -0
- package/esm/harness/npm/src/subAgents/tool.js +30 -0
- package/esm/harness/npm/src/subAgents/types.d.ts +18 -0
- package/esm/harness/npm/src/subAgents/types.js +1 -0
- package/esm/harness/npm/src/tui/channel.d.ts +3 -0
- package/esm/harness/npm/src/tui/channel.js +53 -0
- package/esm/harness/npm/src/tui/components/composer.d.ts +3 -0
- package/esm/harness/npm/src/tui/components/composer.js +13 -0
- package/esm/harness/npm/src/tui/components/header.d.ts +3 -0
- package/esm/harness/npm/src/tui/components/header.js +1 -0
- package/esm/harness/npm/src/tui/components/index.d.ts +5 -0
- package/esm/harness/npm/src/tui/components/index.js +5 -0
- package/esm/harness/npm/src/tui/components/message.d.ts +6 -0
- package/esm/harness/npm/src/tui/components/message.js +26 -0
- package/esm/harness/npm/src/tui/components/status.d.ts +3 -0
- package/esm/harness/npm/src/tui/components/status.js +8 -0
- package/esm/harness/npm/src/tui/components/transcript.d.ts +4 -0
- package/esm/harness/npm/src/tui/components/transcript.js +4 -0
- package/esm/harness/npm/src/tui/index.d.ts +7 -0
- package/esm/harness/npm/src/tui/index.js +10 -0
- package/esm/harness/npm/src/tui/kit.d.ts +15 -0
- package/esm/harness/npm/src/tui/kit.js +7 -0
- package/esm/harness/npm/src/tui/types.d.ts +38 -0
- package/esm/harness/npm/src/tui/types.js +1 -0
- package/esm/package.json +3 -0
- package/esm/tui/src/capabilities.d.ts +72 -0
- package/esm/tui/src/capabilities.js +90 -0
- package/esm/tui/src/components/command-palette.d.ts +24 -0
- package/esm/tui/src/components/command-palette.js +60 -0
- package/esm/tui/src/components/editor.d.ts +26 -0
- package/esm/tui/src/components/editor.js +111 -0
- package/esm/tui/src/components/scroll-view.d.ts +14 -0
- package/esm/tui/src/components/scroll-view.js +45 -0
- package/esm/tui/src/components/select-list.d.ts +24 -0
- package/esm/tui/src/components/select-list.js +69 -0
- package/esm/tui/src/events.d.ts +56 -0
- package/esm/tui/src/events.js +6 -0
- package/esm/tui/src/index.d.ts +17 -0
- package/esm/tui/src/index.js +13 -0
- package/esm/tui/src/inputRouter.d.ts +28 -0
- package/esm/tui/src/inputRouter.js +122 -0
- package/esm/tui/src/keybinds.d.ts +13 -0
- package/esm/tui/src/keybinds.js +15 -0
- package/esm/tui/src/keyboard.d.ts +2 -0
- package/esm/tui/src/keyboard.js +305 -0
- package/esm/tui/src/layout/ansi.d.ts +3 -0
- package/esm/tui/src/layout/ansi.js +323 -0
- package/esm/tui/src/layout/cell.d.ts +24 -0
- package/esm/tui/src/layout/cell.js +46 -0
- package/esm/tui/src/layout/cellbuffer.d.ts +29 -0
- package/esm/tui/src/layout/cellbuffer.js +306 -0
- package/esm/tui/src/layout/color.d.ts +22 -0
- package/esm/tui/src/layout/color.js +163 -0
- package/esm/tui/src/layout/insets.d.ts +8 -0
- package/esm/tui/src/layout/insets.js +55 -0
- package/esm/tui/src/layout/types.d.ts +33 -0
- package/esm/tui/src/layout/types.js +8 -0
- package/esm/tui/src/parser.d.ts +18 -0
- package/esm/tui/src/parser.js +136 -0
- package/esm/tui/src/renderer.d.ts +32 -0
- package/esm/tui/src/renderer.js +168 -0
- package/esm/tui/src/surface.d.ts +27 -0
- package/esm/tui/src/surface.js +110 -0
- package/esm/tui/src/terminal.d.ts +48 -0
- package/esm/tui/src/terminal.js +255 -0
- package/esm/tui/src/tui.d.ts +60 -0
- package/esm/tui/src/tui.js +194 -0
- package/esm/tui/src/types/terminal.d.ts +20 -0
- package/esm/tui/src/types/terminal.js +1 -0
- package/esm/tui/src/utils.d.ts +6 -0
- package/esm/tui/src/utils.js +292 -0
- package/esm/tui/src/views.d.ts +35 -0
- package/esm/tui/src/views.js +112 -0
- package/package.json +23 -0
- package/script/core/src/agent.d.ts +39 -0
- package/script/core/src/agent.js +101 -0
- package/script/core/src/index.d.ts +4 -0
- package/script/core/src/index.js +10 -0
- package/script/core/src/types.d.ts +59 -0
- package/script/core/src/types.js +9 -0
- package/script/harness/npm/src/_dnt.polyfills.d.ts +11 -0
- package/script/harness/npm/src/_dnt.polyfills.js +16 -0
- package/script/harness/npm/src/agents/index.d.ts +4 -0
- package/script/harness/npm/src/agents/index.js +9 -0
- package/script/harness/npm/src/agents/loader.d.ts +2 -0
- package/script/harness/npm/src/agents/loader.js +28 -0
- package/script/harness/npm/src/agents/parser.d.ts +2 -0
- package/script/harness/npm/src/agents/parser.js +24 -0
- package/script/harness/npm/src/agents/registry.d.ts +6 -0
- package/script/harness/npm/src/agents/registry.js +35 -0
- package/script/harness/npm/src/agents/types.d.ts +8 -0
- package/script/harness/npm/src/agents/types.js +2 -0
- package/script/harness/npm/src/channels/channel.d.ts +7 -0
- package/script/harness/npm/src/channels/channel.js +29 -0
- package/script/harness/npm/src/channels/index.d.ts +3 -0
- package/script/harness/npm/src/channels/index.js +7 -0
- package/script/harness/npm/src/channels/manager.d.ts +6 -0
- package/script/harness/npm/src/channels/manager.js +32 -0
- package/script/harness/npm/src/channels/types.d.ts +30 -0
- package/script/harness/npm/src/channels/types.js +2 -0
- package/script/harness/npm/src/commands/defaults.d.ts +9 -0
- package/script/harness/npm/src/commands/defaults.js +61 -0
- package/script/harness/npm/src/commands/index.d.ts +3 -0
- package/script/harness/npm/src/commands/index.js +11 -0
- package/script/harness/npm/src/commands/registry.d.ts +2 -0
- package/script/harness/npm/src/commands/registry.js +63 -0
- package/script/harness/npm/src/commands/types.d.ts +23 -0
- package/script/harness/npm/src/commands/types.js +2 -0
- package/script/harness/npm/src/common/frontmatter.d.ts +6 -0
- package/script/harness/npm/src/common/frontmatter.js +23 -0
- package/script/harness/npm/src/common/index.d.ts +2 -0
- package/script/harness/npm/src/common/index.js +8 -0
- package/script/harness/npm/src/common/utils.d.ts +5 -0
- package/script/harness/npm/src/common/utils.js +17 -0
- package/script/harness/npm/src/config/index.d.ts +2 -0
- package/script/harness/npm/src/config/index.js +5 -0
- package/script/harness/npm/src/config/resolve.d.ts +2 -0
- package/script/harness/npm/src/config/resolve.js +14 -0
- package/script/harness/npm/src/config/types.d.ts +15 -0
- package/script/harness/npm/src/config/types.js +2 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_chars.d.ts +32 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_chars.js +55 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_dumper_state.d.ts +105 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_dumper_state.js +642 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_loader_state.d.ts +63 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_loader_state.js +1375 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_schema.d.ts +43 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_schema.js +121 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/binary.d.ts +2 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/binary.js +106 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/bool.d.ts +2 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/bool.js +35 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/float.d.ts +2 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/float.js +99 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/int.d.ts +2 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/int.js +162 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/map.d.ts +2 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/map.js +17 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/merge.d.ts +2 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/merge.js +13 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/nil.d.ts +2 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/nil.js +25 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/omap.d.ts +2 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/omap.js +32 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/pairs.d.ts +2 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/pairs.js +22 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/regexp.d.ts +2 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/regexp.js +33 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/seq.d.ts +2 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/seq.js +13 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/set.d.ts +2 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/set.js +17 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/str.d.ts +2 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/str.js +12 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/timestamp.d.ts +2 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/timestamp.js +84 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/undefined.d.ts +2 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type/undefined.js +23 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type.d.ts +31 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_type.js +7 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_utils.d.ts +3 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/_utils.js +18 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/mod.d.ts +49 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/mod.js +68 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/parse.d.ts +75 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/parse.js +95 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/stringify.d.ts +99 -0
- package/script/harness/npm/src/deps/jsr.io/@std/yaml/1.1.0/stringify.js +36 -0
- package/script/harness/npm/src/harness/create.d.ts +2 -0
- package/script/harness/npm/src/harness/create.js +146 -0
- package/script/harness/npm/src/harness/index.d.ts +3 -0
- package/script/harness/npm/src/harness/index.js +7 -0
- package/script/harness/npm/src/harness/models.d.ts +16 -0
- package/script/harness/npm/src/harness/models.js +34 -0
- package/script/harness/npm/src/harness/types.d.ts +35 -0
- package/script/harness/npm/src/harness/types.js +2 -0
- package/script/harness/npm/src/hooks/index.d.ts +3 -0
- package/script/harness/npm/src/hooks/index.js +7 -0
- package/script/harness/npm/src/hooks/merge-hooks.d.ts +2 -0
- package/script/harness/npm/src/hooks/merge-hooks.js +46 -0
- package/script/harness/npm/src/hooks/types.d.ts +20 -0
- package/script/harness/npm/src/hooks/types.js +2 -0
- package/script/harness/npm/src/hooks/with-hooks.d.ts +3 -0
- package/script/harness/npm/src/hooks/with-hooks.js +16 -0
- package/script/harness/npm/src/index.d.ts +15 -0
- package/script/harness/npm/src/index.js +31 -0
- package/script/harness/npm/src/permissions/allow-list.d.ts +4 -0
- package/script/harness/npm/src/permissions/allow-list.js +13 -0
- package/script/harness/npm/src/permissions/approval.d.ts +17 -0
- package/script/harness/npm/src/permissions/approval.js +17 -0
- package/script/harness/npm/src/permissions/glob.d.ts +1 -0
- package/script/harness/npm/src/permissions/glob.js +6 -0
- package/script/harness/npm/src/permissions/index.d.ts +3 -0
- package/script/harness/npm/src/permissions/index.js +10 -0
- package/script/harness/npm/src/plugin/define.d.ts +2 -0
- package/script/harness/npm/src/plugin/define.js +5 -0
- package/script/harness/npm/src/plugin/import-ts.d.ts +1 -0
- package/script/harness/npm/src/plugin/import-ts.js +122 -0
- package/script/harness/npm/src/plugin/index.d.ts +5 -0
- package/script/harness/npm/src/plugin/index.js +11 -0
- package/script/harness/npm/src/plugin/resolve.d.ts +13 -0
- package/script/harness/npm/src/plugin/resolve.js +21 -0
- package/script/harness/npm/src/plugin/store.d.ts +8 -0
- package/script/harness/npm/src/plugin/store.js +30 -0
- package/script/harness/npm/src/plugin/types.d.ts +11 -0
- package/script/harness/npm/src/plugin/types.js +2 -0
- package/script/harness/npm/src/scheduler/command.d.ts +3 -0
- package/script/harness/npm/src/scheduler/command.js +23 -0
- package/script/harness/npm/src/scheduler/engine/index.d.ts +3 -0
- package/script/harness/npm/src/scheduler/engine/index.js +7 -0
- package/script/harness/npm/src/scheduler/engine/scheduler.d.ts +12 -0
- package/script/harness/npm/src/scheduler/engine/scheduler.js +69 -0
- package/script/harness/npm/src/scheduler/engine/store.d.ts +4 -0
- package/script/harness/npm/src/scheduler/engine/store.js +59 -0
- package/script/harness/npm/src/scheduler/engine/types.d.ts +37 -0
- package/script/harness/npm/src/scheduler/engine/types.js +2 -0
- package/script/harness/npm/src/scheduler/index.d.ts +4 -0
- package/script/harness/npm/src/scheduler/index.js +10 -0
- package/script/harness/npm/src/scheduler/tool.d.ts +8 -0
- package/script/harness/npm/src/scheduler/tool.js +53 -0
- package/script/harness/npm/src/session/agent-session.d.ts +15 -0
- package/script/harness/npm/src/session/agent-session.js +86 -0
- package/script/harness/npm/src/session/catalog.d.ts +24 -0
- package/script/harness/npm/src/session/catalog.js +59 -0
- package/script/harness/npm/src/session/index.d.ts +7 -0
- package/script/harness/npm/src/session/index.js +17 -0
- package/script/harness/npm/src/session/manager.d.ts +39 -0
- package/script/harness/npm/src/session/manager.js +66 -0
- package/script/harness/npm/src/session/persist.d.ts +3 -0
- package/script/harness/npm/src/session/persist.js +25 -0
- package/script/harness/npm/src/session/store.d.ts +13 -0
- package/script/harness/npm/src/session/store.js +28 -0
- package/script/harness/npm/src/session/title.d.ts +9 -0
- package/script/harness/npm/src/session/title.js +30 -0
- package/script/harness/npm/src/session/types.d.ts +17 -0
- package/script/harness/npm/src/session/types.js +2 -0
- package/script/harness/npm/src/skills/index.d.ts +7 -0
- package/script/harness/npm/src/skills/index.js +16 -0
- package/script/harness/npm/src/skills/loader.d.ts +2 -0
- package/script/harness/npm/src/skills/loader.js +30 -0
- package/script/harness/npm/src/skills/parser.d.ts +2 -0
- package/script/harness/npm/src/skills/parser.js +14 -0
- package/script/harness/npm/src/skills/registry.d.ts +8 -0
- package/script/harness/npm/src/skills/registry.js +20 -0
- package/script/harness/npm/src/skills/run.d.ts +14 -0
- package/script/harness/npm/src/skills/run.js +50 -0
- package/script/harness/npm/src/skills/tool.d.ts +3 -0
- package/script/harness/npm/src/skills/tool.js +35 -0
- package/script/harness/npm/src/skills/types.d.ts +6 -0
- package/script/harness/npm/src/skills/types.js +2 -0
- package/script/harness/npm/src/skills/writer.d.ts +7 -0
- package/script/harness/npm/src/skills/writer.js +47 -0
- package/script/harness/npm/src/subAgents/index.d.ts +4 -0
- package/script/harness/npm/src/subAgents/index.js +9 -0
- package/script/harness/npm/src/subAgents/registry.d.ts +2 -0
- package/script/harness/npm/src/subAgents/registry.js +22 -0
- package/script/harness/npm/src/subAgents/runner.d.ts +15 -0
- package/script/harness/npm/src/subAgents/runner.js +37 -0
- package/script/harness/npm/src/subAgents/tool.d.ts +6 -0
- package/script/harness/npm/src/subAgents/tool.js +34 -0
- package/script/harness/npm/src/subAgents/types.d.ts +18 -0
- package/script/harness/npm/src/subAgents/types.js +2 -0
- package/script/harness/npm/src/tui/channel.d.ts +3 -0
- package/script/harness/npm/src/tui/channel.js +57 -0
- package/script/harness/npm/src/tui/components/composer.d.ts +3 -0
- package/script/harness/npm/src/tui/components/composer.js +17 -0
- package/script/harness/npm/src/tui/components/header.d.ts +3 -0
- package/script/harness/npm/src/tui/components/header.js +5 -0
- package/script/harness/npm/src/tui/components/index.d.ts +5 -0
- package/script/harness/npm/src/tui/components/index.js +16 -0
- package/script/harness/npm/src/tui/components/message.d.ts +6 -0
- package/script/harness/npm/src/tui/components/message.js +32 -0
- package/script/harness/npm/src/tui/components/status.d.ts +3 -0
- package/script/harness/npm/src/tui/components/status.js +12 -0
- package/script/harness/npm/src/tui/components/transcript.d.ts +4 -0
- package/script/harness/npm/src/tui/components/transcript.js +9 -0
- package/script/harness/npm/src/tui/index.d.ts +7 -0
- package/script/harness/npm/src/tui/index.js +29 -0
- package/script/harness/npm/src/tui/kit.d.ts +15 -0
- package/script/harness/npm/src/tui/kit.js +10 -0
- package/script/harness/npm/src/tui/types.d.ts +38 -0
- package/script/harness/npm/src/tui/types.js +2 -0
- package/script/package.json +3 -0
- package/script/tui/src/capabilities.d.ts +72 -0
- package/script/tui/src/capabilities.js +98 -0
- package/script/tui/src/components/command-palette.d.ts +24 -0
- package/script/tui/src/components/command-palette.js +65 -0
- package/script/tui/src/components/editor.d.ts +26 -0
- package/script/tui/src/components/editor.js +116 -0
- package/script/tui/src/components/scroll-view.d.ts +14 -0
- package/script/tui/src/components/scroll-view.js +50 -0
- package/script/tui/src/components/select-list.d.ts +24 -0
- package/script/tui/src/components/select-list.js +74 -0
- package/script/tui/src/events.d.ts +56 -0
- package/script/tui/src/events.js +9 -0
- package/script/tui/src/index.d.ts +17 -0
- package/script/tui/src/index.js +46 -0
- package/script/tui/src/inputRouter.d.ts +28 -0
- package/script/tui/src/inputRouter.js +126 -0
- package/script/tui/src/keybinds.d.ts +13 -0
- package/script/tui/src/keybinds.js +18 -0
- package/script/tui/src/keyboard.d.ts +2 -0
- package/script/tui/src/keyboard.js +308 -0
- package/script/tui/src/layout/ansi.d.ts +3 -0
- package/script/tui/src/layout/ansi.js +327 -0
- package/script/tui/src/layout/cell.d.ts +24 -0
- package/script/tui/src/layout/cell.js +54 -0
- package/script/tui/src/layout/cellbuffer.d.ts +29 -0
- package/script/tui/src/layout/cellbuffer.js +321 -0
- package/script/tui/src/layout/color.d.ts +22 -0
- package/script/tui/src/layout/color.js +174 -0
- package/script/tui/src/layout/insets.d.ts +8 -0
- package/script/tui/src/layout/insets.js +64 -0
- package/script/tui/src/layout/types.d.ts +33 -0
- package/script/tui/src/layout/types.js +11 -0
- package/script/tui/src/parser.d.ts +18 -0
- package/script/tui/src/parser.js +140 -0
- package/script/tui/src/renderer.d.ts +32 -0
- package/script/tui/src/renderer.js +175 -0
- package/script/tui/src/surface.d.ts +27 -0
- package/script/tui/src/surface.js +115 -0
- package/script/tui/src/terminal.d.ts +48 -0
- package/script/tui/src/terminal.js +262 -0
- package/script/tui/src/tui.d.ts +60 -0
- package/script/tui/src/tui.js +198 -0
- package/script/tui/src/types/terminal.d.ts +20 -0
- package/script/tui/src/types/terminal.js +2 -0
- package/script/tui/src/utils.d.ts +6 -0
- package/script/tui/src/utils.js +300 -0
- package/script/tui/src/views.d.ts +35 -0
- package/script/tui/src/views.js +123 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
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,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createSessionCatalog = void 0;
|
|
4
|
+
const node_fs_1 = require("node:fs");
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
|
+
const node_sqlite_1 = require("node:sqlite");
|
|
7
|
+
const toRecord = (row) => ({
|
|
8
|
+
id: row.id,
|
|
9
|
+
title: row.title ?? undefined,
|
|
10
|
+
cwd: row.cwd ?? undefined,
|
|
11
|
+
parentId: row.parent_id ?? undefined,
|
|
12
|
+
createdAt: row.created_at,
|
|
13
|
+
});
|
|
14
|
+
const createSessionCatalog = ({ file }) => {
|
|
15
|
+
(0, node_fs_1.mkdirSync)((0, node_path_1.dirname)(file), { recursive: true });
|
|
16
|
+
const db = new node_sqlite_1.DatabaseSync(file);
|
|
17
|
+
db.exec('CREATE TABLE IF NOT EXISTS sessions (id TEXT PRIMARY KEY, title TEXT, cwd TEXT, parent_id TEXT, created_at INTEGER NOT NULL)');
|
|
18
|
+
try {
|
|
19
|
+
db.exec('ALTER TABLE sessions ADD COLUMN parent_id TEXT');
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
void 0;
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
record: (id, info) => {
|
|
26
|
+
db.prepare('INSERT OR IGNORE INTO sessions (id, cwd, parent_id, created_at) VALUES (?, ?, ?, ?)').run(id, info.cwd ?? null, info.parentId ?? null, Date.now());
|
|
27
|
+
},
|
|
28
|
+
setTitle: (id, title) => {
|
|
29
|
+
db.prepare('UPDATE sessions SET title = ? WHERE id = ?').run(title, id);
|
|
30
|
+
},
|
|
31
|
+
get: (id) => {
|
|
32
|
+
const row = db.prepare('SELECT * FROM sessions WHERE id = ?').get(id);
|
|
33
|
+
return row ? toRecord(row) : undefined;
|
|
34
|
+
},
|
|
35
|
+
list: (filter) => {
|
|
36
|
+
let sql = 'SELECT * FROM sessions';
|
|
37
|
+
const params = [];
|
|
38
|
+
if (filter?.parentId !== undefined) {
|
|
39
|
+
sql += ' WHERE parent_id = ?';
|
|
40
|
+
params.push(filter.parentId);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
sql += ' WHERE parent_id IS NULL';
|
|
44
|
+
if (filter?.cwd !== undefined) {
|
|
45
|
+
sql += ' AND cwd = ?';
|
|
46
|
+
params.push(filter.cwd);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
sql += ' ORDER BY created_at DESC';
|
|
50
|
+
const rows = db.prepare(sql).all(...params);
|
|
51
|
+
return rows.map(toRecord);
|
|
52
|
+
},
|
|
53
|
+
delete: (id) => {
|
|
54
|
+
db.prepare('DELETE FROM sessions WHERE id = ?').run(id);
|
|
55
|
+
},
|
|
56
|
+
close: () => db.close(),
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
exports.createSessionCatalog = createSessionCatalog;
|
|
@@ -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,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.titleFallback = exports.runTitler = exports.cleanTitle = exports.createSessionManager = exports.persistTo = exports.createSessionCatalog = exports.createSessionStore = exports.createAgentSession = void 0;
|
|
4
|
+
var agent_session_js_1 = require("./agent-session.js");
|
|
5
|
+
Object.defineProperty(exports, "createAgentSession", { enumerable: true, get: function () { return agent_session_js_1.createAgentSession; } });
|
|
6
|
+
var store_js_1 = require("./store.js");
|
|
7
|
+
Object.defineProperty(exports, "createSessionStore", { enumerable: true, get: function () { return store_js_1.createSessionStore; } });
|
|
8
|
+
var catalog_js_1 = require("./catalog.js");
|
|
9
|
+
Object.defineProperty(exports, "createSessionCatalog", { enumerable: true, get: function () { return catalog_js_1.createSessionCatalog; } });
|
|
10
|
+
var persist_js_1 = require("./persist.js");
|
|
11
|
+
Object.defineProperty(exports, "persistTo", { enumerable: true, get: function () { return persist_js_1.persistTo; } });
|
|
12
|
+
var manager_js_1 = require("./manager.js");
|
|
13
|
+
Object.defineProperty(exports, "createSessionManager", { enumerable: true, get: function () { return manager_js_1.createSessionManager; } });
|
|
14
|
+
var title_js_1 = require("./title.js");
|
|
15
|
+
Object.defineProperty(exports, "cleanTitle", { enumerable: true, get: function () { return title_js_1.cleanTitle; } });
|
|
16
|
+
Object.defineProperty(exports, "runTitler", { enumerable: true, get: function () { return title_js_1.runTitler; } });
|
|
17
|
+
Object.defineProperty(exports, "titleFallback", { enumerable: true, get: function () { return title_js_1.titleFallback; } });
|
|
@@ -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,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createSessionManager = void 0;
|
|
4
|
+
const persist_js_1 = require("./persist.js");
|
|
5
|
+
const inputText = (input) => typeof input === 'string' ? input : input.map((part) => (part.type === 'text' ? part.text : '')).join('');
|
|
6
|
+
const onFirstMessage = (session, fire) => {
|
|
7
|
+
let pending = !session.messages.some((message) => message.role === 'user');
|
|
8
|
+
return {
|
|
9
|
+
get id() {
|
|
10
|
+
return session.id;
|
|
11
|
+
},
|
|
12
|
+
get messages() {
|
|
13
|
+
return session.messages;
|
|
14
|
+
},
|
|
15
|
+
send: async (input) => {
|
|
16
|
+
if (pending) {
|
|
17
|
+
pending = false;
|
|
18
|
+
fire({ id: session.id, text: inputText(input) });
|
|
19
|
+
}
|
|
20
|
+
await session.send(input);
|
|
21
|
+
},
|
|
22
|
+
abort: session.abort,
|
|
23
|
+
subscribe: session.subscribe,
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
const createSessionManager = ({ store, catalog, revive, newId, cwd, title }) => ({
|
|
27
|
+
create: (options) => {
|
|
28
|
+
const id = options?.id ?? newId();
|
|
29
|
+
catalog.record(id, { cwd: options?.cwd ?? cwd });
|
|
30
|
+
const session = (0, persist_js_1.persistTo)(store, revive({ id, model: options?.model }));
|
|
31
|
+
return title ? onFirstMessage(session, title) : session;
|
|
32
|
+
},
|
|
33
|
+
open: async (id) => {
|
|
34
|
+
const stored = await store.load(id);
|
|
35
|
+
return (0, persist_js_1.persistTo)(store, revive({ id: stored.id, messages: stored.messages }), stored.messages.length);
|
|
36
|
+
},
|
|
37
|
+
fork: async (id, upToIndex) => {
|
|
38
|
+
const stored = await store.load(id);
|
|
39
|
+
const messages = stored.messages.slice(0, upToIndex + 1);
|
|
40
|
+
const forkId = newId();
|
|
41
|
+
catalog.record(forkId, { cwd: catalog.get(id)?.cwd ?? cwd });
|
|
42
|
+
const session = revive({ id: forkId, messages });
|
|
43
|
+
await store.append(forkId, messages);
|
|
44
|
+
return (0, persist_js_1.persistTo)(store, session, messages.length);
|
|
45
|
+
},
|
|
46
|
+
list: async (filter) => catalog.list(filter),
|
|
47
|
+
get: async (id) => catalog.get(id),
|
|
48
|
+
read: async (id) => {
|
|
49
|
+
try {
|
|
50
|
+
return await store.load(id);
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
rename: (id, title) => catalog.setTitle(id, title),
|
|
57
|
+
delete: async (id) => {
|
|
58
|
+
for (const child of catalog.list({ parentId: id })) {
|
|
59
|
+
await store.delete(child.id);
|
|
60
|
+
catalog.delete(child.id);
|
|
61
|
+
}
|
|
62
|
+
await store.delete(id);
|
|
63
|
+
catalog.delete(id);
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
exports.createSessionManager = createSessionManager;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.persistTo = void 0;
|
|
4
|
+
const persistTo = (store, session, persisted = 0) => {
|
|
5
|
+
let count = persisted;
|
|
6
|
+
return {
|
|
7
|
+
get id() {
|
|
8
|
+
return session.id;
|
|
9
|
+
},
|
|
10
|
+
get messages() {
|
|
11
|
+
return session.messages;
|
|
12
|
+
},
|
|
13
|
+
send: async (input) => {
|
|
14
|
+
await session.send(input);
|
|
15
|
+
const all = session.messages;
|
|
16
|
+
if (all.length > count) {
|
|
17
|
+
await store.append(session.id, all.slice(count));
|
|
18
|
+
count = all.length;
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
abort: session.abort,
|
|
22
|
+
subscribe: session.subscribe,
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
exports.persistTo = persistTo;
|
|
@@ -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;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createSessionStore = void 0;
|
|
4
|
+
const promises_1 = require("node:fs/promises");
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
|
+
const EXT = '.jsonl';
|
|
7
|
+
const fileFor = (dir, id) => {
|
|
8
|
+
if (!/^[\w-]+$/.test(id))
|
|
9
|
+
throw new Error(`SessionStore: invalid session id "${id}"`);
|
|
10
|
+
return (0, node_path_1.join)(dir, `${id}${EXT}`);
|
|
11
|
+
};
|
|
12
|
+
const createSessionStore = ({ dir }) => ({
|
|
13
|
+
load: async (id) => {
|
|
14
|
+
const raw = await (0, promises_1.readFile)(fileFor(dir, id), 'utf-8');
|
|
15
|
+
const messages = raw.split('\n').filter(Boolean).map((line) => JSON.parse(line));
|
|
16
|
+
return { id, messages };
|
|
17
|
+
},
|
|
18
|
+
append: async (id, messages) => {
|
|
19
|
+
if (messages.length === 0)
|
|
20
|
+
return;
|
|
21
|
+
await (0, promises_1.mkdir)(dir, { recursive: true });
|
|
22
|
+
await (0, promises_1.appendFile)(fileFor(dir, id), messages.map((message) => `${JSON.stringify(message)}\n`).join(''));
|
|
23
|
+
},
|
|
24
|
+
delete: async (id) => {
|
|
25
|
+
await (0, promises_1.rm)(fileFor(dir, id), { force: true });
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
exports.createSessionStore = createSessionStore;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const titleFallback: (text: string, max?: number) => string;
|
|
2
|
+
export declare const cleanTitle: (raw: string, max?: number) => string;
|
|
3
|
+
export interface RunTitlerOptions {
|
|
4
|
+
id: string;
|
|
5
|
+
text: string;
|
|
6
|
+
setTitle(id: string, title: string): void | Promise<void>;
|
|
7
|
+
generate(text: string): Promise<string>;
|
|
8
|
+
}
|
|
9
|
+
export declare const runTitler: (options: RunTitlerOptions) => Promise<void>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runTitler = exports.cleanTitle = exports.titleFallback = void 0;
|
|
4
|
+
const titleFallback = (text, max = 50) => {
|
|
5
|
+
const clean = text.replace(/\s+/g, ' ').trim();
|
|
6
|
+
return clean.length > max ? `${clean.slice(0, max - 1)}…` : clean;
|
|
7
|
+
};
|
|
8
|
+
exports.titleFallback = titleFallback;
|
|
9
|
+
const cleanTitle = (raw, max = 60) => {
|
|
10
|
+
const line = raw
|
|
11
|
+
.replace(/<think>[\s\S]*?<\/think>/g, '')
|
|
12
|
+
.split('\n')
|
|
13
|
+
.map((entry) => entry.trim())
|
|
14
|
+
.find((entry) => entry.length > 0) ?? '';
|
|
15
|
+
const unquoted = line.replace(/^["'`]+|["'`]+$/g, '').trim();
|
|
16
|
+
return unquoted.length > max ? `${unquoted.slice(0, max - 1)}…` : unquoted;
|
|
17
|
+
};
|
|
18
|
+
exports.cleanTitle = cleanTitle;
|
|
19
|
+
const runTitler = async (options) => {
|
|
20
|
+
await options.setTitle(options.id, (0, exports.titleFallback)(options.text));
|
|
21
|
+
try {
|
|
22
|
+
const title = (0, exports.cleanTitle)(await options.generate(options.text));
|
|
23
|
+
if (title)
|
|
24
|
+
await options.setTitle(options.id, title);
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
// keep the fallback
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
exports.runTitler = runTitler;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ContentPart, LoopEvent, Message } from 'mu-core';
|
|
2
|
+
export type AgentSessionEvent = {
|
|
3
|
+
type: 'turn_start';
|
|
4
|
+
input: Message;
|
|
5
|
+
} | LoopEvent | {
|
|
6
|
+
type: 'turn_end';
|
|
7
|
+
} | {
|
|
8
|
+
type: 'error';
|
|
9
|
+
error: unknown;
|
|
10
|
+
};
|
|
11
|
+
export interface AgentSession {
|
|
12
|
+
readonly id: string;
|
|
13
|
+
readonly messages: readonly Message[];
|
|
14
|
+
send(input: string | ContentPart[]): Promise<void>;
|
|
15
|
+
abort(): void;
|
|
16
|
+
subscribe(listener: (event: AgentSessionEvent) => void): () => void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type { Skill } from './types.js';
|
|
2
|
+
export { createSkillRegistry, type SkillRegistry } from './registry.js';
|
|
3
|
+
export { parseSkill } from './parser.js';
|
|
4
|
+
export { loadSkills } from './loader.js';
|
|
5
|
+
export { createSkillTool } from './tool.js';
|
|
6
|
+
export { createSkillWriterTool } from './writer.js';
|
|
7
|
+
export { createRunSkillTool, runSkill, type RunSkillDeps } from './run.js';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runSkill = exports.createRunSkillTool = exports.createSkillWriterTool = exports.createSkillTool = exports.loadSkills = exports.parseSkill = exports.createSkillRegistry = void 0;
|
|
4
|
+
var registry_js_1 = require("./registry.js");
|
|
5
|
+
Object.defineProperty(exports, "createSkillRegistry", { enumerable: true, get: function () { return registry_js_1.createSkillRegistry; } });
|
|
6
|
+
var parser_js_1 = require("./parser.js");
|
|
7
|
+
Object.defineProperty(exports, "parseSkill", { enumerable: true, get: function () { return parser_js_1.parseSkill; } });
|
|
8
|
+
var loader_js_1 = require("./loader.js");
|
|
9
|
+
Object.defineProperty(exports, "loadSkills", { enumerable: true, get: function () { return loader_js_1.loadSkills; } });
|
|
10
|
+
var tool_js_1 = require("./tool.js");
|
|
11
|
+
Object.defineProperty(exports, "createSkillTool", { enumerable: true, get: function () { return tool_js_1.createSkillTool; } });
|
|
12
|
+
var writer_js_1 = require("./writer.js");
|
|
13
|
+
Object.defineProperty(exports, "createSkillWriterTool", { enumerable: true, get: function () { return writer_js_1.createSkillWriterTool; } });
|
|
14
|
+
var run_js_1 = require("./run.js");
|
|
15
|
+
Object.defineProperty(exports, "createRunSkillTool", { enumerable: true, get: function () { return run_js_1.createRunSkillTool; } });
|
|
16
|
+
Object.defineProperty(exports, "runSkill", { enumerable: true, get: function () { return run_js_1.runSkill; } });
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.loadSkills = void 0;
|
|
4
|
+
const promises_1 = require("node:fs/promises");
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
|
+
const parser_js_1 = require("./parser.js");
|
|
7
|
+
const loadSkills = async (dir) => {
|
|
8
|
+
let entries;
|
|
9
|
+
try {
|
|
10
|
+
entries = await (0, promises_1.readdir)(dir);
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
return [];
|
|
14
|
+
}
|
|
15
|
+
const skills = [];
|
|
16
|
+
for (const entry of entries.sort()) {
|
|
17
|
+
const skillDir = (0, node_path_1.join)(dir, entry);
|
|
18
|
+
try {
|
|
19
|
+
if (!(await (0, promises_1.stat)(skillDir)).isDirectory())
|
|
20
|
+
continue;
|
|
21
|
+
const source = await (0, promises_1.readFile)((0, node_path_1.join)(skillDir, 'SKILL.md'), 'utf-8');
|
|
22
|
+
skills.push((0, parser_js_1.parseSkill)(source, entry, skillDir));
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return skills;
|
|
29
|
+
};
|
|
30
|
+
exports.loadSkills = loadSkills;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseSkill = void 0;
|
|
4
|
+
const index_js_1 = require("../common/index.js");
|
|
5
|
+
const parseSkill = (source, fallbackName, dir) => {
|
|
6
|
+
const { fields, body } = (0, index_js_1.parseFrontmatter)(source);
|
|
7
|
+
return {
|
|
8
|
+
name: (0, index_js_1.str)(fields.name) ?? fallbackName,
|
|
9
|
+
description: (0, index_js_1.str)(fields.description) ?? '',
|
|
10
|
+
prompt: body,
|
|
11
|
+
dir,
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
exports.parseSkill = parseSkill;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Skill } from './types.js';
|
|
2
|
+
export interface SkillRegistry {
|
|
3
|
+
list(): Skill[];
|
|
4
|
+
get(name: string): Skill | undefined;
|
|
5
|
+
add(skill: Skill): void;
|
|
6
|
+
select(names: string[]): SkillRegistry;
|
|
7
|
+
}
|
|
8
|
+
export declare const createSkillRegistry: (skills?: Skill[]) => SkillRegistry;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createSkillRegistry = void 0;
|
|
4
|
+
const createSkillRegistry = (skills = []) => {
|
|
5
|
+
const byName = new Map();
|
|
6
|
+
for (const skill of skills)
|
|
7
|
+
if (!byName.has(skill.name))
|
|
8
|
+
byName.set(skill.name, skill);
|
|
9
|
+
const view = (allow) => ({
|
|
10
|
+
list: () => [...byName.values()].filter((skill) => !allow || allow.has(skill.name)),
|
|
11
|
+
get: (name) => (!allow || allow.has(name) ? byName.get(name) : undefined),
|
|
12
|
+
add: (skill) => {
|
|
13
|
+
byName.set(skill.name, skill);
|
|
14
|
+
allow?.add(skill.name);
|
|
15
|
+
},
|
|
16
|
+
select: (names) => view(new Set(allow ? names.filter((name) => allow.has(name)) : names)),
|
|
17
|
+
});
|
|
18
|
+
return view();
|
|
19
|
+
};
|
|
20
|
+
exports.createSkillRegistry = createSkillRegistry;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Tool } from 'mu-core';
|
|
2
|
+
import type { AgentRegistry } from '../agents/index.js';
|
|
3
|
+
import { type RunSubAgentDeps } from '../subAgents/index.js';
|
|
4
|
+
import type { SkillRegistry } from './registry.js';
|
|
5
|
+
export interface RunSkillDeps extends RunSubAgentDeps {
|
|
6
|
+
skills: SkillRegistry;
|
|
7
|
+
agents?: AgentRegistry;
|
|
8
|
+
}
|
|
9
|
+
export declare const runSkill: (deps: RunSkillDeps, args: {
|
|
10
|
+
skill: string;
|
|
11
|
+
task: string;
|
|
12
|
+
agent: string;
|
|
13
|
+
}) => Promise<string>;
|
|
14
|
+
export declare const createRunSkillTool: (deps: RunSkillDeps) => Tool;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createRunSkillTool = exports.runSkill = void 0;
|
|
4
|
+
const index_js_1 = require("../subAgents/index.js");
|
|
5
|
+
const runSkill = async (deps, args) => {
|
|
6
|
+
const skill = deps.skills.get(args.skill);
|
|
7
|
+
if (!skill)
|
|
8
|
+
throw new Error(`unknown skill "${args.skill}"`);
|
|
9
|
+
const base = deps.agents?.get(args.agent);
|
|
10
|
+
if (!base)
|
|
11
|
+
throw new Error(`unknown agent "${args.agent}"`);
|
|
12
|
+
const agent = {
|
|
13
|
+
name: base.name,
|
|
14
|
+
description: skill.description,
|
|
15
|
+
prompt: [base.prompt, skill.prompt].filter(Boolean).join('\n\n'),
|
|
16
|
+
tools: base.tools,
|
|
17
|
+
model: base.model,
|
|
18
|
+
};
|
|
19
|
+
const result = await (0, index_js_1.runSubAgent)(agent, args.task, deps);
|
|
20
|
+
return result.text;
|
|
21
|
+
};
|
|
22
|
+
exports.runSkill = runSkill;
|
|
23
|
+
const createRunSkillTool = (deps) => ({
|
|
24
|
+
name: 'run_skill',
|
|
25
|
+
description: 'Invoke a sub-agent equipped with a named skill to carry out a specific task. Returns its final answer.',
|
|
26
|
+
prompt: 'To carry out a self-contained task under a skill, call `run_skill` with the skill name, the task, and the agent persona to run it as.',
|
|
27
|
+
parameters: {
|
|
28
|
+
type: 'object',
|
|
29
|
+
properties: {
|
|
30
|
+
skill: { type: 'string', description: 'Skill name to equip the agent with.' },
|
|
31
|
+
task: { type: 'string', description: 'The precise task to carry out.' },
|
|
32
|
+
agent: { type: 'string', description: 'Agent persona to run the skill as (defines its tools).' },
|
|
33
|
+
},
|
|
34
|
+
required: ['skill', 'task', 'agent'],
|
|
35
|
+
additionalProperties: false,
|
|
36
|
+
},
|
|
37
|
+
run: async (input) => {
|
|
38
|
+
const { skill, task, agent } = (input ?? {});
|
|
39
|
+
if (!skill || !task || !agent) {
|
|
40
|
+
return [{ type: 'text', text: 'Error: run_skill requires `skill`, `task`, and `agent`.' }];
|
|
41
|
+
}
|
|
42
|
+
try {
|
|
43
|
+
return [{ type: 'text', text: await (0, exports.runSkill)(deps, { skill, task, agent }) }];
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
return [{ type: 'text', text: `Error: ${error instanceof Error ? error.message : String(error)}` }];
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
exports.createRunSkillTool = createRunSkillTool;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createSkillTool = void 0;
|
|
4
|
+
const createSkillTool = (registry) => ({
|
|
5
|
+
name: 'skill',
|
|
6
|
+
description: "Load a named skill's instructions into the conversation, then follow them.",
|
|
7
|
+
get prompt() {
|
|
8
|
+
const list = registry.list();
|
|
9
|
+
if (!list.length)
|
|
10
|
+
return undefined;
|
|
11
|
+
const catalog = list.map((skill) => `- ${skill.name}${skill.description ? `: ${skill.description}` : ''}`).join('\n');
|
|
12
|
+
return `When a request matches one of these skills, call \`skill\` with its name BEFORE acting, then follow the returned instructions:\n${catalog}`;
|
|
13
|
+
},
|
|
14
|
+
parameters: {
|
|
15
|
+
type: 'object',
|
|
16
|
+
properties: {
|
|
17
|
+
name: { type: 'string', description: 'Skill name.' },
|
|
18
|
+
},
|
|
19
|
+
required: ['name'],
|
|
20
|
+
additionalProperties: false,
|
|
21
|
+
},
|
|
22
|
+
run: async (input) => {
|
|
23
|
+
const { name } = (input ?? {});
|
|
24
|
+
if (!name)
|
|
25
|
+
return [{ type: 'text', text: 'Error: skill requires `name`.' }];
|
|
26
|
+
const skill = registry.get(name);
|
|
27
|
+
if (!skill)
|
|
28
|
+
return [{ type: 'text', text: `Error: unknown skill "${name}".` }];
|
|
29
|
+
const header = skill.dir
|
|
30
|
+
? `Skill "${skill.name}" (bundled files live under ${skill.dir}):\n\n`
|
|
31
|
+
: `Skill "${skill.name}":\n\n`;
|
|
32
|
+
return [{ type: 'text', text: header + skill.prompt }];
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
exports.createSkillTool = createSkillTool;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Tool } from 'mu-core';
|
|
2
|
+
import type { SkillRegistry } from './registry.js';
|
|
3
|
+
export type SkillScope = 'local' | 'config';
|
|
4
|
+
export declare const createSkillWriterTool: (deps: {
|
|
5
|
+
dirs: Record<SkillScope, string>;
|
|
6
|
+
registry: SkillRegistry;
|
|
7
|
+
}) => Tool;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createSkillWriterTool = void 0;
|
|
4
|
+
const promises_1 = require("node:fs/promises");
|
|
5
|
+
const node_path_1 = require("node:path");
|
|
6
|
+
const parser_js_1 = require("./parser.js");
|
|
7
|
+
const slug = (name) => name.trim().toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '');
|
|
8
|
+
const createSkillWriterTool = (deps) => ({
|
|
9
|
+
name: 'create_skill',
|
|
10
|
+
description: 'Create a reusable skill: a named set of instructions the agent can load on demand later.',
|
|
11
|
+
prompt: 'When you discover a reusable workflow worth keeping, capture it with `create_skill` (name, description, instructions). Use `scope: "local"` for a skill specific to this project, or `scope: "config"` to make it available across all projects. It can then be loaded via `skill`.',
|
|
12
|
+
parameters: {
|
|
13
|
+
type: 'object',
|
|
14
|
+
properties: {
|
|
15
|
+
name: { type: 'string', description: 'Short skill name (kebab-case).' },
|
|
16
|
+
description: { type: 'string', description: 'One line describing when this skill should be used.' },
|
|
17
|
+
instructions: { type: 'string', description: 'The skill body: the instructions to follow when it is invoked.' },
|
|
18
|
+
scope: {
|
|
19
|
+
type: 'string',
|
|
20
|
+
enum: ['local', 'config'],
|
|
21
|
+
description: 'Where to save it: "local" = this project (<cwd>/skills), "config" = global config dir. Defaults to "local".',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
required: ['name', 'description', 'instructions'],
|
|
25
|
+
additionalProperties: false,
|
|
26
|
+
},
|
|
27
|
+
run: async (input) => {
|
|
28
|
+
const { name, description, instructions, scope } = (input ?? {});
|
|
29
|
+
if (!name || !description || !instructions) {
|
|
30
|
+
return [{ type: 'text', text: 'Error: create_skill requires `name`, `description`, and `instructions`.' }];
|
|
31
|
+
}
|
|
32
|
+
const base = deps.dirs[scope ?? 'local'];
|
|
33
|
+
if (!base)
|
|
34
|
+
return [{ type: 'text', text: `Error: unknown scope "${scope}".` }];
|
|
35
|
+
const id = slug(name);
|
|
36
|
+
if (!id)
|
|
37
|
+
return [{ type: 'text', text: `Error: invalid skill name "${name}".` }];
|
|
38
|
+
const skillDir = (0, node_path_1.join)(base, id);
|
|
39
|
+
const file = (0, node_path_1.join)(skillDir, 'SKILL.md');
|
|
40
|
+
const source = `---\nname: ${id}\ndescription: ${JSON.stringify(description)}\n---\n\n${instructions.trim()}\n`;
|
|
41
|
+
await (0, promises_1.mkdir)(skillDir, { recursive: true });
|
|
42
|
+
await (0, promises_1.writeFile)(file, source, 'utf-8');
|
|
43
|
+
deps.registry.add((0, parser_js_1.parseSkill)(source, id, skillDir));
|
|
44
|
+
return [{ type: 'text', text: `Created skill "${id}" at ${file}. It is now available via the \`skill\` tool.` }];
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
exports.createSkillWriterTool = createSkillWriterTool;
|