@oni.bot/core 0.8.0 → 1.0.0
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/CHANGELOG.md +15 -0
- package/README.md +59 -373
- package/dist/checkpointers/sqlite.d.ts.map +1 -1
- package/dist/checkpointers/sqlite.js +23 -8
- package/dist/checkpointers/sqlite.js.map +1 -1
- package/dist/cli/build.d.ts +11 -0
- package/dist/cli/build.d.ts.map +1 -0
- package/dist/cli/build.js +61 -0
- package/dist/cli/build.js.map +1 -0
- package/dist/cli/dev.d.ts +5 -0
- package/dist/cli/dev.d.ts.map +1 -0
- package/dist/cli/dev.js +54 -0
- package/dist/cli/dev.js.map +1 -0
- package/dist/cli/index.js +16 -27
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/init.d.ts +2 -0
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +18 -1
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/inspect.d.ts +5 -0
- package/dist/cli/inspect.d.ts.map +1 -0
- package/dist/cli/inspect.js +85 -0
- package/dist/cli/inspect.js.map +1 -0
- package/dist/cli/router.d.ts +14 -0
- package/dist/cli/router.d.ts.map +1 -0
- package/dist/cli/router.js +107 -0
- package/dist/cli/router.js.map +1 -0
- package/dist/cli/run.d.ts +5 -0
- package/dist/cli/run.d.ts.map +1 -0
- package/dist/cli/run.js +53 -0
- package/dist/cli/run.js.map +1 -0
- package/dist/cli/templates.d.ts +1 -0
- package/dist/cli/templates.d.ts.map +1 -1
- package/dist/cli/templates.js +106 -66
- package/dist/cli/templates.js.map +1 -1
- package/dist/cli/test.d.ts +3 -0
- package/dist/cli/test.d.ts.map +1 -0
- package/dist/cli/test.js +29 -0
- package/dist/cli/test.js.map +1 -0
- package/dist/config/index.d.ts +3 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +3 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/loader.d.ts +37 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +180 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/types.d.ts +74 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +5 -0
- package/dist/config/types.js.map +1 -0
- package/dist/coordination/pubsub.d.ts +4 -0
- package/dist/coordination/pubsub.d.ts.map +1 -1
- package/dist/coordination/pubsub.js +8 -0
- package/dist/coordination/pubsub.js.map +1 -1
- package/dist/coordination/request-reply.d.ts +3 -1
- package/dist/coordination/request-reply.d.ts.map +1 -1
- package/dist/coordination/request-reply.js +11 -2
- package/dist/coordination/request-reply.js.map +1 -1
- package/dist/errors.d.ts +7 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +18 -3
- package/dist/errors.js.map +1 -1
- package/dist/events/bridge.d.ts +17 -0
- package/dist/events/bridge.d.ts.map +1 -0
- package/dist/events/bridge.js +67 -0
- package/dist/events/bridge.js.map +1 -0
- package/dist/events/bus.d.ts +9 -0
- package/dist/events/bus.d.ts.map +1 -1
- package/dist/events/bus.js +39 -4
- package/dist/events/bus.js.map +1 -1
- package/dist/events/index.d.ts +2 -1
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js +2 -0
- package/dist/events/index.js.map +1 -1
- package/dist/events/types.d.ts +123 -1
- package/dist/events/types.d.ts.map +1 -1
- package/dist/graph.d.ts.map +1 -1
- package/dist/graph.js +16 -8
- package/dist/graph.js.map +1 -1
- package/dist/guardrails/types.d.ts +1 -1
- package/dist/guardrails/types.d.ts.map +1 -1
- package/dist/harness/agent-loop.d.ts.map +1 -1
- package/dist/harness/agent-loop.js +226 -29
- package/dist/harness/agent-loop.js.map +1 -1
- package/dist/harness/context-compactor.d.ts +21 -2
- package/dist/harness/context-compactor.d.ts.map +1 -1
- package/dist/harness/context-compactor.js +45 -6
- package/dist/harness/context-compactor.js.map +1 -1
- package/dist/harness/hooks-engine.d.ts +7 -1
- package/dist/harness/hooks-engine.d.ts.map +1 -1
- package/dist/harness/hooks-engine.js.map +1 -1
- package/dist/harness/index.d.ts +3 -2
- package/dist/harness/index.d.ts.map +1 -1
- package/dist/harness/index.js +2 -0
- package/dist/harness/index.js.map +1 -1
- package/dist/harness/skill-loader.d.ts +14 -1
- package/dist/harness/skill-loader.d.ts.map +1 -1
- package/dist/harness/skill-loader.js +33 -3
- package/dist/harness/skill-loader.js.map +1 -1
- package/dist/harness/types.d.ts +24 -2
- package/dist/harness/types.d.ts.map +1 -1
- package/dist/harness/types.js.map +1 -1
- package/dist/harness/validate-args.d.ts +16 -0
- package/dist/harness/validate-args.d.ts.map +1 -0
- package/dist/harness/validate-args.js +132 -0
- package/dist/harness/validate-args.js.map +1 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -12
- package/dist/index.js.map +1 -1
- package/dist/internal/timeout.d.ts +2 -0
- package/dist/internal/timeout.d.ts.map +1 -0
- package/dist/internal/timeout.js +16 -0
- package/dist/internal/timeout.js.map +1 -0
- package/dist/lsp/client.d.ts +70 -0
- package/dist/lsp/client.d.ts.map +1 -0
- package/dist/lsp/client.js +421 -0
- package/dist/lsp/client.js.map +1 -0
- package/dist/lsp/index.d.ts +77 -0
- package/dist/lsp/index.d.ts.map +1 -0
- package/dist/lsp/index.js +183 -0
- package/dist/lsp/index.js.map +1 -0
- package/dist/lsp/servers.d.ts +48 -0
- package/dist/lsp/servers.d.ts.map +1 -0
- package/dist/lsp/servers.js +108 -0
- package/dist/lsp/servers.js.map +1 -0
- package/dist/lsp/types.d.ts +142 -0
- package/dist/lsp/types.d.ts.map +1 -0
- package/dist/lsp/types.js +16 -0
- package/dist/lsp/types.js.map +1 -0
- package/dist/mcp/client.d.ts +56 -0
- package/dist/mcp/client.d.ts.map +1 -0
- package/dist/mcp/client.js +170 -0
- package/dist/mcp/client.js.map +1 -0
- package/dist/mcp/convert.d.ts +26 -0
- package/dist/mcp/convert.d.ts.map +1 -0
- package/dist/mcp/convert.js +56 -0
- package/dist/mcp/convert.js.map +1 -0
- package/dist/mcp/index.d.ts +21 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +19 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/transport.d.ts +56 -0
- package/dist/mcp/transport.d.ts.map +1 -0
- package/dist/mcp/transport.js +204 -0
- package/dist/mcp/transport.js.map +1 -0
- package/dist/mcp/types.d.ts +96 -0
- package/dist/mcp/types.d.ts.map +1 -0
- package/dist/mcp/types.js +11 -0
- package/dist/mcp/types.js.map +1 -0
- package/dist/models/anthropic.d.ts.map +1 -1
- package/dist/models/anthropic.js +78 -41
- package/dist/models/anthropic.js.map +1 -1
- package/dist/models/google.d.ts.map +1 -1
- package/dist/models/google.js +47 -46
- package/dist/models/google.js.map +1 -1
- package/dist/models/http-error.d.ts +16 -0
- package/dist/models/http-error.d.ts.map +1 -0
- package/dist/models/http-error.js +67 -0
- package/dist/models/http-error.js.map +1 -0
- package/dist/models/index.d.ts +3 -0
- package/dist/models/index.d.ts.map +1 -1
- package/dist/models/index.js +2 -0
- package/dist/models/index.js.map +1 -1
- package/dist/models/ollama.d.ts.map +1 -1
- package/dist/models/ollama.js +4 -3
- package/dist/models/ollama.js.map +1 -1
- package/dist/models/openai.d.ts.map +1 -1
- package/dist/models/openai.js +36 -44
- package/dist/models/openai.js.map +1 -1
- package/dist/models/openrouter.d.ts +13 -0
- package/dist/models/openrouter.d.ts.map +1 -1
- package/dist/models/openrouter.js +86 -47
- package/dist/models/openrouter.js.map +1 -1
- package/dist/models/sse.d.ts +9 -0
- package/dist/models/sse.d.ts.map +1 -0
- package/dist/models/sse.js +45 -0
- package/dist/models/sse.js.map +1 -0
- package/dist/models/types.d.ts +10 -0
- package/dist/models/types.d.ts.map +1 -1
- package/dist/oni-code/agent-registry.d.ts +73 -0
- package/dist/oni-code/agent-registry.d.ts.map +1 -0
- package/dist/oni-code/agent-registry.js +151 -0
- package/dist/oni-code/agent-registry.js.map +1 -0
- package/dist/oni-code/bin.d.ts +18 -0
- package/dist/oni-code/bin.d.ts.map +1 -0
- package/dist/oni-code/bin.js +78 -0
- package/dist/oni-code/bin.js.map +1 -0
- package/dist/oni-code/change-tracking.d.ts +28 -0
- package/dist/oni-code/change-tracking.d.ts.map +1 -0
- package/dist/oni-code/change-tracking.js +77 -0
- package/dist/oni-code/change-tracking.js.map +1 -0
- package/dist/oni-code/cli.d.ts +6 -0
- package/dist/oni-code/cli.d.ts.map +1 -0
- package/dist/oni-code/cli.js +30 -0
- package/dist/oni-code/cli.js.map +1 -0
- package/dist/oni-code/conductor.d.ts +203 -0
- package/dist/oni-code/conductor.d.ts.map +1 -0
- package/dist/oni-code/conductor.js +1547 -0
- package/dist/oni-code/conductor.js.map +1 -0
- package/dist/oni-code/config.d.ts +130 -0
- package/dist/oni-code/config.d.ts.map +1 -0
- package/dist/oni-code/config.js +264 -0
- package/dist/oni-code/config.js.map +1 -0
- package/dist/oni-code/context-files.d.ts +22 -0
- package/dist/oni-code/context-files.d.ts.map +1 -0
- package/dist/oni-code/context-files.js +156 -0
- package/dist/oni-code/context-files.js.map +1 -0
- package/dist/oni-code/cron/humanize.d.ts +26 -0
- package/dist/oni-code/cron/humanize.d.ts.map +1 -0
- package/dist/oni-code/cron/humanize.js +83 -0
- package/dist/oni-code/cron/humanize.js.map +1 -0
- package/dist/oni-code/cron/index.d.ts +10 -0
- package/dist/oni-code/cron/index.d.ts.map +1 -0
- package/dist/oni-code/cron/index.js +7 -0
- package/dist/oni-code/cron/index.js.map +1 -0
- package/dist/oni-code/cron/matcher.d.ts +29 -0
- package/dist/oni-code/cron/matcher.d.ts.map +1 -0
- package/dist/oni-code/cron/matcher.js +73 -0
- package/dist/oni-code/cron/matcher.js.map +1 -0
- package/dist/oni-code/cron/parser.d.ts +27 -0
- package/dist/oni-code/cron/parser.d.ts.map +1 -0
- package/dist/oni-code/cron/parser.js +149 -0
- package/dist/oni-code/cron/parser.js.map +1 -0
- package/dist/oni-code/cron/persistence.d.ts +21 -0
- package/dist/oni-code/cron/persistence.d.ts.map +1 -0
- package/dist/oni-code/cron/persistence.js +58 -0
- package/dist/oni-code/cron/persistence.js.map +1 -0
- package/dist/oni-code/cron/scheduler.d.ts +64 -0
- package/dist/oni-code/cron/scheduler.d.ts.map +1 -0
- package/dist/oni-code/cron/scheduler.js +188 -0
- package/dist/oni-code/cron/scheduler.js.map +1 -0
- package/dist/oni-code/cron/store.d.ts +46 -0
- package/dist/oni-code/cron/store.d.ts.map +1 -0
- package/dist/oni-code/cron/store.js +68 -0
- package/dist/oni-code/cron/store.js.map +1 -0
- package/dist/oni-code/env.d.ts +17 -0
- package/dist/oni-code/env.d.ts.map +1 -0
- package/dist/oni-code/env.js +51 -0
- package/dist/oni-code/env.js.map +1 -0
- package/dist/oni-code/file-reader.d.ts +28 -0
- package/dist/oni-code/file-reader.d.ts.map +1 -0
- package/dist/oni-code/file-reader.js +368 -0
- package/dist/oni-code/file-reader.js.map +1 -0
- package/dist/oni-code/file-watcher.d.ts +66 -0
- package/dist/oni-code/file-watcher.d.ts.map +1 -0
- package/dist/oni-code/file-watcher.js +167 -0
- package/dist/oni-code/file-watcher.js.map +1 -0
- package/dist/oni-code/loop-detector.d.ts +64 -0
- package/dist/oni-code/loop-detector.d.ts.map +1 -0
- package/dist/oni-code/loop-detector.js +163 -0
- package/dist/oni-code/loop-detector.js.map +1 -0
- package/dist/oni-code/permissions.d.ts +43 -0
- package/dist/oni-code/permissions.d.ts.map +1 -0
- package/dist/oni-code/permissions.js +98 -0
- package/dist/oni-code/permissions.js.map +1 -0
- package/dist/oni-code/planner.d.ts +26 -0
- package/dist/oni-code/planner.d.ts.map +1 -0
- package/dist/oni-code/planner.js +86 -0
- package/dist/oni-code/planner.js.map +1 -0
- package/dist/oni-code/plugin-loader.d.ts +103 -0
- package/dist/oni-code/plugin-loader.d.ts.map +1 -0
- package/dist/oni-code/plugin-loader.js +171 -0
- package/dist/oni-code/plugin-loader.js.map +1 -0
- package/dist/oni-code/process-tree.d.ts +44 -0
- package/dist/oni-code/process-tree.d.ts.map +1 -0
- package/dist/oni-code/process-tree.js +107 -0
- package/dist/oni-code/process-tree.js.map +1 -0
- package/dist/oni-code/progress-tracker.d.ts +40 -0
- package/dist/oni-code/progress-tracker.d.ts.map +1 -0
- package/dist/oni-code/progress-tracker.js +375 -0
- package/dist/oni-code/progress-tracker.js.map +1 -0
- package/dist/oni-code/scheduler.d.ts +56 -0
- package/dist/oni-code/scheduler.d.ts.map +1 -0
- package/dist/oni-code/scheduler.js +105 -0
- package/dist/oni-code/scheduler.js.map +1 -0
- package/dist/oni-code/session-fork.d.ts +146 -0
- package/dist/oni-code/session-fork.d.ts.map +1 -0
- package/dist/oni-code/session-fork.js +238 -0
- package/dist/oni-code/session-fork.js.map +1 -0
- package/dist/oni-code/session-stats.d.ts +72 -0
- package/dist/oni-code/session-stats.d.ts.map +1 -0
- package/dist/oni-code/session-stats.js +141 -0
- package/dist/oni-code/session-stats.js.map +1 -0
- package/dist/oni-code/session-title.d.ts +25 -0
- package/dist/oni-code/session-title.d.ts.map +1 -0
- package/dist/oni-code/session-title.js +67 -0
- package/dist/oni-code/session-title.js.map +1 -0
- package/dist/oni-code/shell-parser.d.ts +112 -0
- package/dist/oni-code/shell-parser.d.ts.map +1 -0
- package/dist/oni-code/shell-parser.js +657 -0
- package/dist/oni-code/shell-parser.js.map +1 -0
- package/dist/oni-code/summarizer.d.ts +27 -0
- package/dist/oni-code/summarizer.d.ts.map +1 -0
- package/dist/oni-code/summarizer.js +70 -0
- package/dist/oni-code/summarizer.js.map +1 -0
- package/dist/oni-code/swarm-checkpoint.d.ts +52 -0
- package/dist/oni-code/swarm-checkpoint.d.ts.map +1 -0
- package/dist/oni-code/swarm-checkpoint.js +71 -0
- package/dist/oni-code/swarm-checkpoint.js.map +1 -0
- package/dist/oni-code/swarm-runner.d.ts +173 -0
- package/dist/oni-code/swarm-runner.d.ts.map +1 -0
- package/dist/oni-code/swarm-runner.js +873 -0
- package/dist/oni-code/swarm-runner.js.map +1 -0
- package/dist/oni-code/system-prompt.d.ts +13 -0
- package/dist/oni-code/system-prompt.d.ts.map +1 -0
- package/dist/oni-code/system-prompt.js +64 -0
- package/dist/oni-code/system-prompt.js.map +1 -0
- package/dist/oni-code/task-evaluator.d.ts +73 -0
- package/dist/oni-code/task-evaluator.d.ts.map +1 -0
- package/dist/oni-code/task-evaluator.js +172 -0
- package/dist/oni-code/task-evaluator.js.map +1 -0
- package/dist/oni-code/tools/batch.d.ts +12 -0
- package/dist/oni-code/tools/batch.d.ts.map +1 -0
- package/dist/oni-code/tools/batch.js +116 -0
- package/dist/oni-code/tools/batch.js.map +1 -0
- package/dist/oni-code/tools/coding.d.ts +10 -0
- package/dist/oni-code/tools/coding.d.ts.map +1 -0
- package/dist/oni-code/tools/coding.js +557 -0
- package/dist/oni-code/tools/coding.js.map +1 -0
- package/dist/oni-code/tools/cron.d.ts +4 -0
- package/dist/oni-code/tools/cron.d.ts.map +1 -0
- package/dist/oni-code/tools/cron.js +120 -0
- package/dist/oni-code/tools/cron.js.map +1 -0
- package/dist/oni-code/tools/custom.d.ts +43 -0
- package/dist/oni-code/tools/custom.d.ts.map +1 -0
- package/dist/oni-code/tools/custom.js +115 -0
- package/dist/oni-code/tools/custom.js.map +1 -0
- package/dist/oni-code/tools/patch.d.ts +58 -0
- package/dist/oni-code/tools/patch.d.ts.map +1 -0
- package/dist/oni-code/tools/patch.js +247 -0
- package/dist/oni-code/tools/patch.js.map +1 -0
- package/dist/oni-code/tools/plan.d.ts +17 -0
- package/dist/oni-code/tools/plan.d.ts.map +1 -0
- package/dist/oni-code/tools/plan.js +48 -0
- package/dist/oni-code/tools/plan.js.map +1 -0
- package/dist/oni-code/tools/question.d.ts +17 -0
- package/dist/oni-code/tools/question.d.ts.map +1 -0
- package/dist/oni-code/tools/question.js +46 -0
- package/dist/oni-code/tools/question.js.map +1 -0
- package/dist/oni-code/tools/skill.d.ts +36 -0
- package/dist/oni-code/tools/skill.d.ts.map +1 -0
- package/dist/oni-code/tools/skill.js +132 -0
- package/dist/oni-code/tools/skill.js.map +1 -0
- package/dist/oni-code/tools/spawn-agents.d.ts +37 -0
- package/dist/oni-code/tools/spawn-agents.d.ts.map +1 -0
- package/dist/oni-code/tools/spawn-agents.js +91 -0
- package/dist/oni-code/tools/spawn-agents.js.map +1 -0
- package/dist/oni-code/tools/spawn-swarm.d.ts +70 -0
- package/dist/oni-code/tools/spawn-swarm.d.ts.map +1 -0
- package/dist/oni-code/tools/spawn-swarm.js +129 -0
- package/dist/oni-code/tools/spawn-swarm.js.map +1 -0
- package/dist/oni-code/tools/web.d.ts +11 -0
- package/dist/oni-code/tools/web.d.ts.map +1 -0
- package/dist/oni-code/tools/web.js +375 -0
- package/dist/oni-code/tools/web.js.map +1 -0
- package/dist/oni-code/topology-agent-builder.d.ts +22 -0
- package/dist/oni-code/topology-agent-builder.d.ts.map +1 -0
- package/dist/oni-code/topology-agent-builder.js +220 -0
- package/dist/oni-code/topology-agent-builder.js.map +1 -0
- package/dist/oni-code/topology-selector.d.ts +85 -0
- package/dist/oni-code/topology-selector.d.ts.map +1 -0
- package/dist/oni-code/topology-selector.js +338 -0
- package/dist/oni-code/topology-selector.js.map +1 -0
- package/dist/oni-code/ui/App.d.ts +10 -0
- package/dist/oni-code/ui/App.d.ts.map +1 -0
- package/dist/oni-code/ui/App.js +395 -0
- package/dist/oni-code/ui/App.js.map +1 -0
- package/dist/oni-code/ui/FooterPanel.d.ts +16 -0
- package/dist/oni-code/ui/FooterPanel.d.ts.map +1 -0
- package/dist/oni-code/ui/FooterPanel.js +56 -0
- package/dist/oni-code/ui/FooterPanel.js.map +1 -0
- package/dist/oni-code/ui/Header.d.ts +21 -0
- package/dist/oni-code/ui/Header.d.ts.map +1 -0
- package/dist/oni-code/ui/Header.js +105 -0
- package/dist/oni-code/ui/Header.js.map +1 -0
- package/dist/oni-code/ui/InputArea.d.ts +11 -0
- package/dist/oni-code/ui/InputArea.d.ts.map +1 -0
- package/dist/oni-code/ui/InputArea.js +82 -0
- package/dist/oni-code/ui/InputArea.js.map +1 -0
- package/dist/oni-code/ui/MessageBlock.d.ts +11 -0
- package/dist/oni-code/ui/MessageBlock.d.ts.map +1 -0
- package/dist/oni-code/ui/MessageBlock.js +103 -0
- package/dist/oni-code/ui/MessageBlock.js.map +1 -0
- package/dist/oni-code/ui/OutputPane.d.ts +12 -0
- package/dist/oni-code/ui/OutputPane.d.ts.map +1 -0
- package/dist/oni-code/ui/OutputPane.js +8 -0
- package/dist/oni-code/ui/OutputPane.js.map +1 -0
- package/dist/oni-code/ui/PermissionPrompt.d.ts +11 -0
- package/dist/oni-code/ui/PermissionPrompt.d.ts.map +1 -0
- package/dist/oni-code/ui/PermissionPrompt.js +48 -0
- package/dist/oni-code/ui/PermissionPrompt.js.map +1 -0
- package/dist/oni-code/ui/QuestionPrompt.d.ts +8 -0
- package/dist/oni-code/ui/QuestionPrompt.d.ts.map +1 -0
- package/dist/oni-code/ui/QuestionPrompt.js +9 -0
- package/dist/oni-code/ui/QuestionPrompt.js.map +1 -0
- package/dist/oni-code/ui/StatusLine.d.ts +14 -0
- package/dist/oni-code/ui/StatusLine.d.ts.map +1 -0
- package/dist/oni-code/ui/StatusLine.js +23 -0
- package/dist/oni-code/ui/StatusLine.js.map +1 -0
- package/dist/oni-code/ui/SwarmPanel.d.ts +9 -0
- package/dist/oni-code/ui/SwarmPanel.d.ts.map +1 -0
- package/dist/oni-code/ui/SwarmPanel.js +52 -0
- package/dist/oni-code/ui/SwarmPanel.js.map +1 -0
- package/dist/oni-code/ui/ToolCallBlock.d.ts +10 -0
- package/dist/oni-code/ui/ToolCallBlock.d.ts.map +1 -0
- package/dist/oni-code/ui/ToolCallBlock.js +21 -0
- package/dist/oni-code/ui/ToolCallBlock.js.map +1 -0
- package/dist/oni-code/ui/Toolbar.d.ts +8 -0
- package/dist/oni-code/ui/Toolbar.d.ts.map +1 -0
- package/dist/oni-code/ui/Toolbar.js +11 -0
- package/dist/oni-code/ui/Toolbar.js.map +1 -0
- package/dist/oni-code/ui/WelcomeBanner.d.ts +12 -0
- package/dist/oni-code/ui/WelcomeBanner.d.ts.map +1 -0
- package/dist/oni-code/ui/WelcomeBanner.js +24 -0
- package/dist/oni-code/ui/WelcomeBanner.js.map +1 -0
- package/dist/oni-code/ui/activity.d.ts +15 -0
- package/dist/oni-code/ui/activity.d.ts.map +1 -0
- package/dist/oni-code/ui/activity.js +252 -0
- package/dist/oni-code/ui/activity.js.map +1 -0
- package/dist/oni-code/ui/banner.d.ts +16 -0
- package/dist/oni-code/ui/banner.d.ts.map +1 -0
- package/dist/oni-code/ui/banner.js +132 -0
- package/dist/oni-code/ui/banner.js.map +1 -0
- package/dist/oni-code/ui/command-menu.d.ts +7 -0
- package/dist/oni-code/ui/command-menu.d.ts.map +1 -0
- package/dist/oni-code/ui/command-menu.js +20 -0
- package/dist/oni-code/ui/command-menu.js.map +1 -0
- package/dist/oni-code/ui/diff.d.ts +17 -0
- package/dist/oni-code/ui/diff.d.ts.map +1 -0
- package/dist/oni-code/ui/diff.js +37 -0
- package/dist/oni-code/ui/diff.js.map +1 -0
- package/dist/oni-code/ui/format.d.ts +41 -0
- package/dist/oni-code/ui/format.d.ts.map +1 -0
- package/dist/oni-code/ui/format.js +223 -0
- package/dist/oni-code/ui/format.js.map +1 -0
- package/dist/oni-code/ui/input.d.ts +28 -0
- package/dist/oni-code/ui/input.d.ts.map +1 -0
- package/dist/oni-code/ui/input.js +216 -0
- package/dist/oni-code/ui/input.js.map +1 -0
- package/dist/oni-code/ui/insights.d.ts +39 -0
- package/dist/oni-code/ui/insights.d.ts.map +1 -0
- package/dist/oni-code/ui/insights.js +193 -0
- package/dist/oni-code/ui/insights.js.map +1 -0
- package/dist/oni-code/ui/markdown.d.ts +9 -0
- package/dist/oni-code/ui/markdown.d.ts.map +1 -0
- package/dist/oni-code/ui/markdown.js +44 -0
- package/dist/oni-code/ui/markdown.js.map +1 -0
- package/dist/oni-code/ui/panels.d.ts +39 -0
- package/dist/oni-code/ui/panels.d.ts.map +1 -0
- package/dist/oni-code/ui/panels.js +209 -0
- package/dist/oni-code/ui/panels.js.map +1 -0
- package/dist/oni-code/ui/paste.d.ts +17 -0
- package/dist/oni-code/ui/paste.d.ts.map +1 -0
- package/dist/oni-code/ui/paste.js +45 -0
- package/dist/oni-code/ui/paste.js.map +1 -0
- package/dist/oni-code/ui/raw-spinner.d.ts +37 -0
- package/dist/oni-code/ui/raw-spinner.d.ts.map +1 -0
- package/dist/oni-code/ui/raw-spinner.js +121 -0
- package/dist/oni-code/ui/raw-spinner.js.map +1 -0
- package/dist/oni-code/ui/session.d.ts +44 -0
- package/dist/oni-code/ui/session.d.ts.map +1 -0
- package/dist/oni-code/ui/session.js +93 -0
- package/dist/oni-code/ui/session.js.map +1 -0
- package/dist/oni-code/ui/spinner.d.ts +7 -0
- package/dist/oni-code/ui/spinner.d.ts.map +1 -0
- package/dist/oni-code/ui/spinner.js +20 -0
- package/dist/oni-code/ui/spinner.js.map +1 -0
- package/dist/oni-code/ui/swarm-activity.d.ts +50 -0
- package/dist/oni-code/ui/swarm-activity.d.ts.map +1 -0
- package/dist/oni-code/ui/swarm-activity.js +233 -0
- package/dist/oni-code/ui/swarm-activity.js.map +1 -0
- package/dist/oni-code/ui/terminal-size.d.ts +18 -0
- package/dist/oni-code/ui/terminal-size.d.ts.map +1 -0
- package/dist/oni-code/ui/terminal-size.js +45 -0
- package/dist/oni-code/ui/terminal-size.js.map +1 -0
- package/dist/oni-code/ui/theme.d.ts +82 -0
- package/dist/oni-code/ui/theme.d.ts.map +1 -0
- package/dist/oni-code/ui/theme.js +101 -0
- package/dist/oni-code/ui/theme.js.map +1 -0
- package/dist/oni-code/ui/tool-utils.d.ts +10 -0
- package/dist/oni-code/ui/tool-utils.d.ts.map +1 -0
- package/dist/oni-code/ui/tool-utils.js +82 -0
- package/dist/oni-code/ui/tool-utils.js.map +1 -0
- package/dist/oni-code/ui/useTerminalSize.d.ts +3 -0
- package/dist/oni-code/ui/useTerminalSize.d.ts.map +1 -0
- package/dist/oni-code/ui/useTerminalSize.js +16 -0
- package/dist/oni-code/ui/useTerminalSize.js.map +1 -0
- package/dist/oni-code/workspace/change-tracker.d.ts +18 -0
- package/dist/oni-code/workspace/change-tracker.d.ts.map +1 -0
- package/dist/oni-code/workspace/change-tracker.js +67 -0
- package/dist/oni-code/workspace/change-tracker.js.map +1 -0
- package/dist/oni-code/workspace/conflict-detector.d.ts +12 -0
- package/dist/oni-code/workspace/conflict-detector.d.ts.map +1 -0
- package/dist/oni-code/workspace/conflict-detector.js +24 -0
- package/dist/oni-code/workspace/conflict-detector.js.map +1 -0
- package/dist/oni-code/workspace/file-snapshots.d.ts +39 -0
- package/dist/oni-code/workspace/file-snapshots.d.ts.map +1 -0
- package/dist/oni-code/workspace/file-snapshots.js +77 -0
- package/dist/oni-code/workspace/file-snapshots.js.map +1 -0
- package/dist/oni-code/workspace/index.d.ts +5 -0
- package/dist/oni-code/workspace/index.d.ts.map +1 -0
- package/dist/oni-code/workspace/index.js +5 -0
- package/dist/oni-code/workspace/index.js.map +1 -0
- package/dist/oni-code/workspace/project-map.d.ts +14 -0
- package/dist/oni-code/workspace/project-map.d.ts.map +1 -0
- package/dist/oni-code/workspace/project-map.js +91 -0
- package/dist/oni-code/workspace/project-map.js.map +1 -0
- package/dist/pregel.d.ts +4 -0
- package/dist/pregel.d.ts.map +1 -1
- package/dist/pregel.js +121 -54
- package/dist/pregel.js.map +1 -1
- package/dist/retry.d.ts.map +1 -1
- package/dist/retry.js +10 -3
- package/dist/retry.js.map +1 -1
- package/dist/sentinel/config/index.d.ts +2 -0
- package/dist/sentinel/config/index.d.ts.map +1 -0
- package/dist/sentinel/config/index.js +2 -0
- package/dist/sentinel/config/index.js.map +1 -0
- package/dist/sentinel/config/schema.d.ts +4 -0
- package/dist/sentinel/config/schema.d.ts.map +1 -0
- package/dist/sentinel/config/schema.js +42 -0
- package/dist/sentinel/config/schema.js.map +1 -0
- package/dist/sentinel/debate/index.d.ts +6 -0
- package/dist/sentinel/debate/index.d.ts.map +1 -0
- package/dist/sentinel/debate/index.js +64 -0
- package/dist/sentinel/debate/index.js.map +1 -0
- package/dist/sentinel/debate/prompts.d.ts +4 -0
- package/dist/sentinel/debate/prompts.d.ts.map +1 -0
- package/dist/sentinel/debate/prompts.js +13 -0
- package/dist/sentinel/debate/prompts.js.map +1 -0
- package/dist/sentinel/fix/index.d.ts +6 -0
- package/dist/sentinel/fix/index.d.ts.map +1 -0
- package/dist/sentinel/fix/index.js +27 -0
- package/dist/sentinel/fix/index.js.map +1 -0
- package/dist/sentinel/fix/strategies.d.ts +9 -0
- package/dist/sentinel/fix/strategies.d.ts.map +1 -0
- package/dist/sentinel/fix/strategies.js +40 -0
- package/dist/sentinel/fix/strategies.js.map +1 -0
- package/dist/sentinel/index.d.ts +14 -0
- package/dist/sentinel/index.d.ts.map +1 -0
- package/dist/sentinel/index.js +22 -0
- package/dist/sentinel/index.js.map +1 -0
- package/dist/sentinel/integrations/cli.d.ts +10 -0
- package/dist/sentinel/integrations/cli.d.ts.map +1 -0
- package/dist/sentinel/integrations/cli.js +24 -0
- package/dist/sentinel/integrations/cli.js.map +1 -0
- package/dist/sentinel/integrations/index.d.ts +2 -0
- package/dist/sentinel/integrations/index.d.ts.map +1 -0
- package/dist/sentinel/integrations/index.js +2 -0
- package/dist/sentinel/integrations/index.js.map +1 -0
- package/dist/sentinel/memory/index.d.ts +16 -0
- package/dist/sentinel/memory/index.d.ts.map +1 -0
- package/dist/sentinel/memory/index.js +60 -0
- package/dist/sentinel/memory/index.js.map +1 -0
- package/dist/sentinel/report/console.d.ts +3 -0
- package/dist/sentinel/report/console.d.ts.map +1 -0
- package/dist/sentinel/report/console.js +27 -0
- package/dist/sentinel/report/console.js.map +1 -0
- package/dist/sentinel/report/github.d.ts +3 -0
- package/dist/sentinel/report/github.d.ts.map +1 -0
- package/dist/sentinel/report/github.js +36 -0
- package/dist/sentinel/report/github.js.map +1 -0
- package/dist/sentinel/report/index.d.ts +6 -0
- package/dist/sentinel/report/index.d.ts.map +1 -0
- package/dist/sentinel/report/index.js +15 -0
- package/dist/sentinel/report/index.js.map +1 -0
- package/dist/sentinel/report/sarif.d.ts +3 -0
- package/dist/sentinel/report/sarif.d.ts.map +1 -0
- package/dist/sentinel/report/sarif.js +29 -0
- package/dist/sentinel/report/sarif.js.map +1 -0
- package/dist/sentinel/sentinel.d.ts +17 -0
- package/dist/sentinel/sentinel.d.ts.map +1 -0
- package/dist/sentinel/sentinel.js +111 -0
- package/dist/sentinel/sentinel.js.map +1 -0
- package/dist/sentinel/swarm/agents.d.ts +6 -0
- package/dist/sentinel/swarm/agents.d.ts.map +1 -0
- package/dist/sentinel/swarm/agents.js +36 -0
- package/dist/sentinel/swarm/agents.js.map +1 -0
- package/dist/sentinel/swarm/index.d.ts +8 -0
- package/dist/sentinel/swarm/index.d.ts.map +1 -0
- package/dist/sentinel/swarm/index.js +74 -0
- package/dist/sentinel/swarm/index.js.map +1 -0
- package/dist/sentinel/swarm/prompts.d.ts +2 -0
- package/dist/sentinel/swarm/prompts.d.ts.map +1 -0
- package/dist/sentinel/swarm/prompts.js +24 -0
- package/dist/sentinel/swarm/prompts.js.map +1 -0
- package/dist/sentinel/swarm/topology.d.ts +10 -0
- package/dist/sentinel/swarm/topology.d.ts.map +1 -0
- package/dist/sentinel/swarm/topology.js +38 -0
- package/dist/sentinel/swarm/topology.js.map +1 -0
- package/dist/sentinel/triage/analyzers/complexity-analyzer.d.ts +7 -0
- package/dist/sentinel/triage/analyzers/complexity-analyzer.d.ts.map +1 -0
- package/dist/sentinel/triage/analyzers/complexity-analyzer.js +94 -0
- package/dist/sentinel/triage/analyzers/complexity-analyzer.js.map +1 -0
- package/dist/sentinel/triage/analyzers/custom-analyzer.d.ts +19 -0
- package/dist/sentinel/triage/analyzers/custom-analyzer.d.ts.map +1 -0
- package/dist/sentinel/triage/analyzers/custom-analyzer.js +268 -0
- package/dist/sentinel/triage/analyzers/custom-analyzer.js.map +1 -0
- package/dist/sentinel/triage/analyzers/dependency-analyzer.d.ts +26 -0
- package/dist/sentinel/triage/analyzers/dependency-analyzer.d.ts.map +1 -0
- package/dist/sentinel/triage/analyzers/dependency-analyzer.js +220 -0
- package/dist/sentinel/triage/analyzers/dependency-analyzer.js.map +1 -0
- package/dist/sentinel/triage/analyzers/diff-analyzer.d.ts +12 -0
- package/dist/sentinel/triage/analyzers/diff-analyzer.d.ts.map +1 -0
- package/dist/sentinel/triage/analyzers/diff-analyzer.js +19 -0
- package/dist/sentinel/triage/analyzers/diff-analyzer.js.map +1 -0
- package/dist/sentinel/triage/analyzers/index.d.ts +14 -0
- package/dist/sentinel/triage/analyzers/index.d.ts.map +1 -0
- package/dist/sentinel/triage/analyzers/index.js +25 -0
- package/dist/sentinel/triage/analyzers/index.js.map +1 -0
- package/dist/sentinel/triage/analyzers/pattern-analyzer.d.ts +7 -0
- package/dist/sentinel/triage/analyzers/pattern-analyzer.d.ts.map +1 -0
- package/dist/sentinel/triage/analyzers/pattern-analyzer.js +180 -0
- package/dist/sentinel/triage/analyzers/pattern-analyzer.js.map +1 -0
- package/dist/sentinel/triage/analyzers/security-analyzer.d.ts +7 -0
- package/dist/sentinel/triage/analyzers/security-analyzer.d.ts.map +1 -0
- package/dist/sentinel/triage/analyzers/security-analyzer.js +96 -0
- package/dist/sentinel/triage/analyzers/security-analyzer.js.map +1 -0
- package/dist/sentinel/triage/analyzers/ts-parser.d.ts +71 -0
- package/dist/sentinel/triage/analyzers/ts-parser.d.ts.map +1 -0
- package/dist/sentinel/triage/analyzers/ts-parser.js +323 -0
- package/dist/sentinel/triage/analyzers/ts-parser.js.map +1 -0
- package/dist/sentinel/triage/analyzers/typescript-analyzer.d.ts +7 -0
- package/dist/sentinel/triage/analyzers/typescript-analyzer.d.ts.map +1 -0
- package/dist/sentinel/triage/analyzers/typescript-analyzer.js +68 -0
- package/dist/sentinel/triage/analyzers/typescript-analyzer.js.map +1 -0
- package/dist/sentinel/triage/index.d.ts +10 -0
- package/dist/sentinel/triage/index.d.ts.map +1 -0
- package/dist/sentinel/triage/index.js +39 -0
- package/dist/sentinel/triage/index.js.map +1 -0
- package/dist/sentinel/triage/scorer.d.ts +9 -0
- package/dist/sentinel/triage/scorer.d.ts.map +1 -0
- package/dist/sentinel/triage/scorer.js +28 -0
- package/dist/sentinel/triage/scorer.js.map +1 -0
- package/dist/sentinel/types.d.ts +125 -0
- package/dist/sentinel/types.d.ts.map +1 -0
- package/dist/sentinel/types.js +6 -0
- package/dist/sentinel/types.js.map +1 -0
- package/dist/store/index.d.ts +3 -0
- package/dist/store/index.d.ts.map +1 -1
- package/dist/store/index.js +17 -0
- package/dist/store/index.js.map +1 -1
- package/dist/streaming.d.ts +4 -1
- package/dist/streaming.d.ts.map +1 -1
- package/dist/streaming.js +21 -7
- package/dist/streaming.js.map +1 -1
- package/dist/swarm/graph.d.ts +81 -2
- package/dist/swarm/graph.d.ts.map +1 -1
- package/dist/swarm/graph.js +517 -32
- package/dist/swarm/graph.js.map +1 -1
- package/dist/swarm/index.d.ts +10 -2
- package/dist/swarm/index.d.ts.map +1 -1
- package/dist/swarm/index.js +6 -1
- package/dist/swarm/index.js.map +1 -1
- package/dist/swarm/mermaid.d.ts +10 -0
- package/dist/swarm/mermaid.d.ts.map +1 -0
- package/dist/swarm/mermaid.js +64 -0
- package/dist/swarm/mermaid.js.map +1 -0
- package/dist/swarm/pool.d.ts +9 -1
- package/dist/swarm/pool.d.ts.map +1 -1
- package/dist/swarm/pool.js +58 -10
- package/dist/swarm/pool.js.map +1 -1
- package/dist/swarm/registry.d.ts +11 -1
- package/dist/swarm/registry.d.ts.map +1 -1
- package/dist/swarm/registry.js +17 -3
- package/dist/swarm/registry.js.map +1 -1
- package/dist/swarm/scaling.d.ts +95 -0
- package/dist/swarm/scaling.d.ts.map +1 -0
- package/dist/swarm/scaling.js +214 -0
- package/dist/swarm/scaling.js.map +1 -0
- package/dist/swarm/snapshot.d.ts +51 -0
- package/dist/swarm/snapshot.d.ts.map +1 -0
- package/dist/swarm/snapshot.js +115 -0
- package/dist/swarm/snapshot.js.map +1 -0
- package/dist/swarm/supervisor.d.ts.map +1 -1
- package/dist/swarm/supervisor.js +82 -0
- package/dist/swarm/supervisor.js.map +1 -1
- package/dist/swarm/tracer.d.ts +57 -0
- package/dist/swarm/tracer.d.ts.map +1 -0
- package/dist/swarm/tracer.js +138 -0
- package/dist/swarm/tracer.js.map +1 -0
- package/dist/swarm/types.d.ts +23 -1
- package/dist/swarm/types.d.ts.map +1 -1
- package/dist/swarm/types.js.map +1 -1
- package/dist/tools/types.d.ts +2 -0
- package/dist/tools/types.d.ts.map +1 -1
- package/package.json +160 -141
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Plan Mode Tools — switch between build (full access) and plan (read-only) agents.
|
|
3
|
+
*
|
|
4
|
+
* plan_enter: Switch to plan mode for read-only exploration and planning.
|
|
5
|
+
* plan_exit: Switch back to build mode for implementation.
|
|
6
|
+
*
|
|
7
|
+
* The switch takes effect on the next chat() invocation. The current turn
|
|
8
|
+
* completes normally, and subsequent turns use the new agent's system prompt
|
|
9
|
+
* and tool scoping. Write tools are also blocked in plan mode via the
|
|
10
|
+
* Conductor's PreToolUse hook for double enforcement.
|
|
11
|
+
*/
|
|
12
|
+
import { defineTool } from "../../tools/define.js";
|
|
13
|
+
export function makePlanTools(host) {
|
|
14
|
+
const planEnter = defineTool({
|
|
15
|
+
name: "plan_enter",
|
|
16
|
+
description: "Switch to plan mode — read-only exploration and planning. Use when you need to analyze the codebase and create a structured plan before implementing. Write tools are disabled in plan mode.",
|
|
17
|
+
schema: {
|
|
18
|
+
type: "object",
|
|
19
|
+
properties: {},
|
|
20
|
+
},
|
|
21
|
+
execute: () => {
|
|
22
|
+
host.switchAgent("plan");
|
|
23
|
+
return {
|
|
24
|
+
switched: true,
|
|
25
|
+
agent: "plan",
|
|
26
|
+
message: "Switched to plan mode. You can read files, search code, and browse directories, but cannot write, edit, or run destructive commands. Use plan_exit when planning is complete.",
|
|
27
|
+
};
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
const planExit = defineTool({
|
|
31
|
+
name: "plan_exit",
|
|
32
|
+
description: "Exit plan mode and switch back to build mode for implementation. Use when your plan is complete and ready for implementation.",
|
|
33
|
+
schema: {
|
|
34
|
+
type: "object",
|
|
35
|
+
properties: {},
|
|
36
|
+
},
|
|
37
|
+
execute: () => {
|
|
38
|
+
host.switchAgent("build");
|
|
39
|
+
return {
|
|
40
|
+
switched: true,
|
|
41
|
+
agent: "build",
|
|
42
|
+
message: "Switched to build mode. Full tool access restored — you can now implement the plan.",
|
|
43
|
+
};
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
return [planEnter, planExit];
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=plan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan.js","sourceRoot":"","sources":["../../../src/oni-code/tools/plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAOnD,MAAM,UAAU,aAAa,CAAC,IAAkB;IAC9C,MAAM,SAAS,GAAG,UAAU,CAAC;QAC3B,IAAI,EAAE,YAAY;QAClB,WAAW,EACT,8LAA8L;QAChM,MAAM,EAAE;YACN,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,EAAE;SACf;QACD,OAAO,EAAE,GAAG,EAAE;YACZ,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;YACzB,OAAO;gBACL,QAAQ,EAAE,IAAI;gBACd,KAAK,EAAE,MAAM;gBACb,OAAO,EACL,+KAA+K;aAClL,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG,UAAU,CAAC;QAC1B,IAAI,EAAE,WAAW;QACjB,WAAW,EACT,+HAA+H;QACjI,MAAM,EAAE;YACN,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,EAAE;SACf;QACD,OAAO,EAAE,GAAG,EAAE;YACZ,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;YAC1B,OAAO;gBACL,QAAQ,EAAE,IAAI;gBACd,KAAK,EAAE,OAAO;gBACd,OAAO,EACL,qFAAqF;aACxF,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Question Tool — pause agent execution to ask the user a question.
|
|
3
|
+
*
|
|
4
|
+
* Uses the Promise-based pause/resume pattern: the tool calls ctx.askUser(),
|
|
5
|
+
* which blocks until the UI resolves with the user's answer.
|
|
6
|
+
*
|
|
7
|
+
* The Conductor wires a questionListener that:
|
|
8
|
+
* 1. Yields a "question" LoopMessage for the UI to render
|
|
9
|
+
* 2. Waits for the user's response
|
|
10
|
+
* 3. Resolves the Promise, resuming tool execution
|
|
11
|
+
*
|
|
12
|
+
* If no questionListener is configured (auto mode, subagents), the tool
|
|
13
|
+
* returns a message indicating the question was skipped.
|
|
14
|
+
*/
|
|
15
|
+
import type { ToolDefinition } from "../../tools/types.js";
|
|
16
|
+
export declare function makeQuestionTool(): ToolDefinition;
|
|
17
|
+
//# sourceMappingURL=question.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question.d.ts","sourceRoot":"","sources":["../../../src/oni-code/tools/question.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAe,MAAM,sBAAsB,CAAC;AAGxE,wBAAgB,gBAAgB,IAAI,cAAc,CAoCjD"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Question Tool — pause agent execution to ask the user a question.
|
|
3
|
+
*
|
|
4
|
+
* Uses the Promise-based pause/resume pattern: the tool calls ctx.askUser(),
|
|
5
|
+
* which blocks until the UI resolves with the user's answer.
|
|
6
|
+
*
|
|
7
|
+
* The Conductor wires a questionListener that:
|
|
8
|
+
* 1. Yields a "question" LoopMessage for the UI to render
|
|
9
|
+
* 2. Waits for the user's response
|
|
10
|
+
* 3. Resolves the Promise, resuming tool execution
|
|
11
|
+
*
|
|
12
|
+
* If no questionListener is configured (auto mode, subagents), the tool
|
|
13
|
+
* returns a message indicating the question was skipped.
|
|
14
|
+
*/
|
|
15
|
+
import { defineTool } from "../../tools/define.js";
|
|
16
|
+
export function makeQuestionTool() {
|
|
17
|
+
return defineTool({
|
|
18
|
+
name: "question",
|
|
19
|
+
description: "Ask the user a question and wait for their answer. Use when you need clarification, confirmation, or user input to proceed. The agent pauses until the user responds.",
|
|
20
|
+
schema: {
|
|
21
|
+
type: "object",
|
|
22
|
+
properties: {
|
|
23
|
+
question: {
|
|
24
|
+
type: "string",
|
|
25
|
+
description: "The question to ask the user",
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
required: ["question"],
|
|
29
|
+
},
|
|
30
|
+
execute: async (input, ctx) => {
|
|
31
|
+
const harnessCtx = ctx;
|
|
32
|
+
if (typeof harnessCtx.askUser !== "function") {
|
|
33
|
+
return {
|
|
34
|
+
answer: null,
|
|
35
|
+
answered: false,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
const answer = await harnessCtx.askUser(input.question);
|
|
39
|
+
return {
|
|
40
|
+
answer,
|
|
41
|
+
answered: answer !== null,
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=question.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"question.js","sourceRoot":"","sources":["../../../src/oni-code/tools/question.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAInD,MAAM,UAAU,gBAAgB;IAC9B,OAAO,UAAU,CAAC;QAChB,IAAI,EAAE,UAAU;QAChB,WAAW,EACT,uKAAuK;QACzK,MAAM,EAAE;YACN,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,QAAQ,EAAE;oBACR,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,8BAA8B;iBAC5C;aACF;YACD,QAAQ,EAAE,CAAC,UAAU,CAAC;SACvB;QACD,OAAO,EAAE,KAAK,EACZ,KAA2B,EAC3B,GAAgB,EACuC,EAAE;YACzD,MAAM,UAAU,GAAG,GAAyB,CAAC;YAE7C,IAAI,OAAO,UAAU,CAAC,OAAO,KAAK,UAAU,EAAE,CAAC;gBAC7C,OAAO;oBACL,MAAM,EAAE,IAAI;oBACZ,QAAQ,EAAE,KAAK;iBAChB,CAAC;YACJ,CAAC;YAED,MAAM,MAAM,GAAG,MAAM,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;YAExD,OAAO;gBACL,MAAM;gBACN,QAAQ,EAAE,MAAM,KAAK,IAAI;aAC1B,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skill Creation Tool — allows the agent to create new SKILL.md files at runtime.
|
|
3
|
+
*
|
|
4
|
+
* Writes to ~/.oni/skills/<name>/SKILL.md so skills persist across sessions.
|
|
5
|
+
* After writing, hot-reloads the SkillLoader so the new skill is immediately available.
|
|
6
|
+
*
|
|
7
|
+
* Validation (moderate):
|
|
8
|
+
* - Name must be kebab-case (lowercase alphanumeric + hyphens)
|
|
9
|
+
* - Description required, <= 1024 chars
|
|
10
|
+
* - Duplicate name detection across all loaded skills
|
|
11
|
+
* - Warning (non-blocking) if body has no ## headings
|
|
12
|
+
*/
|
|
13
|
+
import type { ToolDefinition } from "../../tools/types.js";
|
|
14
|
+
import type { SkillLoader } from "../../harness/skill-loader.js";
|
|
15
|
+
export interface CreateSkillInput {
|
|
16
|
+
name: string;
|
|
17
|
+
description: string;
|
|
18
|
+
content: string;
|
|
19
|
+
allowedTools?: string;
|
|
20
|
+
argumentHint?: string;
|
|
21
|
+
disableModelInvocation?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface CreateSkillResult {
|
|
24
|
+
status: "created";
|
|
25
|
+
path: string;
|
|
26
|
+
name: string;
|
|
27
|
+
warnings?: string[];
|
|
28
|
+
}
|
|
29
|
+
export interface CreateSkillToolOptions {
|
|
30
|
+
/** Override base directory for skill storage (default: ~/.oni/skills) */
|
|
31
|
+
baseDir?: string;
|
|
32
|
+
}
|
|
33
|
+
export declare function makeCreateSkillTool(skillLoader: SkillLoader, options?: CreateSkillToolOptions): ToolDefinition<CreateSkillInput, CreateSkillResult | {
|
|
34
|
+
error: string;
|
|
35
|
+
}>;
|
|
36
|
+
//# sourceMappingURL=skill.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill.d.ts","sourceRoot":"","sources":["../../../src/oni-code/tools/skill.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAUjE,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,SAAS,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB;AAyCD,MAAM,WAAW,sBAAsB;IACrC,yEAAyE;IACzE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,WAAW,EACxB,OAAO,CAAC,EAAE,sBAAsB,GAC/B,cAAc,CAAC,gBAAgB,EAAE,iBAAiB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CA+FzE"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skill Creation Tool — allows the agent to create new SKILL.md files at runtime.
|
|
3
|
+
*
|
|
4
|
+
* Writes to ~/.oni/skills/<name>/SKILL.md so skills persist across sessions.
|
|
5
|
+
* After writing, hot-reloads the SkillLoader so the new skill is immediately available.
|
|
6
|
+
*
|
|
7
|
+
* Validation (moderate):
|
|
8
|
+
* - Name must be kebab-case (lowercase alphanumeric + hyphens)
|
|
9
|
+
* - Description required, <= 1024 chars
|
|
10
|
+
* - Duplicate name detection across all loaded skills
|
|
11
|
+
* - Warning (non-blocking) if body has no ## headings
|
|
12
|
+
*/
|
|
13
|
+
import { defineTool } from "../../tools/define.js";
|
|
14
|
+
import { mkdirSync, writeFileSync } from "node:fs";
|
|
15
|
+
import { join } from "node:path";
|
|
16
|
+
import { homedir } from "node:os";
|
|
17
|
+
// ── Validation ─────────────────────────────────────────────────────────
|
|
18
|
+
const KEBAB_CASE = /^[a-z0-9]+(-[a-z0-9]+)*$/;
|
|
19
|
+
const MAX_DESCRIPTION_LENGTH = 1024;
|
|
20
|
+
function validateName(name) {
|
|
21
|
+
if (!name)
|
|
22
|
+
return "name is required";
|
|
23
|
+
if (!KEBAB_CASE.test(name)) {
|
|
24
|
+
return `name must be kebab-case (lowercase letters, numbers, hyphens). Got: "${name}"`;
|
|
25
|
+
}
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
function validateDescription(description) {
|
|
29
|
+
if (!description)
|
|
30
|
+
return "description is required";
|
|
31
|
+
if (description.length > MAX_DESCRIPTION_LENGTH) {
|
|
32
|
+
return `description must be <= ${MAX_DESCRIPTION_LENGTH} characters. Got: ${description.length}`;
|
|
33
|
+
}
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
// ── Frontmatter Builder ────────────────────────────────────────────────
|
|
37
|
+
function buildFrontmatter(input) {
|
|
38
|
+
const lines = ["---"];
|
|
39
|
+
lines.push(`name: ${input.name}`);
|
|
40
|
+
lines.push(`description: ${input.description}`);
|
|
41
|
+
if (input.allowedTools) {
|
|
42
|
+
lines.push(`allowed-tools: ${input.allowedTools}`);
|
|
43
|
+
}
|
|
44
|
+
if (input.argumentHint) {
|
|
45
|
+
lines.push(`argument-hint: ${input.argumentHint}`);
|
|
46
|
+
}
|
|
47
|
+
if (input.disableModelInvocation) {
|
|
48
|
+
lines.push(`disable-model-invocation: true`);
|
|
49
|
+
}
|
|
50
|
+
lines.push("---");
|
|
51
|
+
return lines.join("\n");
|
|
52
|
+
}
|
|
53
|
+
export function makeCreateSkillTool(skillLoader, options) {
|
|
54
|
+
const baseDir = options?.baseDir ?? join(homedir(), ".oni", "skills");
|
|
55
|
+
return defineTool({
|
|
56
|
+
name: "create_skill",
|
|
57
|
+
description: "Create a new reusable SKILL.md file that persists across sessions. " +
|
|
58
|
+
"Skills are saved to ~/.oni/skills/<name>/SKILL.md and become immediately available. " +
|
|
59
|
+
"Use when the user asks to save a technique, pattern, or workflow as a skill.",
|
|
60
|
+
schema: {
|
|
61
|
+
type: "object",
|
|
62
|
+
properties: {
|
|
63
|
+
name: {
|
|
64
|
+
type: "string",
|
|
65
|
+
description: "Skill identifier in kebab-case (e.g. 'code-review', 'deploy-staging')",
|
|
66
|
+
},
|
|
67
|
+
description: {
|
|
68
|
+
type: "string",
|
|
69
|
+
description: 'One-line description starting with "Use when..." — triggers for when this skill should be invoked',
|
|
70
|
+
},
|
|
71
|
+
content: {
|
|
72
|
+
type: "string",
|
|
73
|
+
description: "Markdown body of the skill (everything after the frontmatter). Should include ## Overview, instructions, examples, etc.",
|
|
74
|
+
},
|
|
75
|
+
allowedTools: {
|
|
76
|
+
type: "string",
|
|
77
|
+
description: 'Optional comma-separated tool patterns pre-approved during skill execution (e.g. "Bash(git *), Read")',
|
|
78
|
+
},
|
|
79
|
+
argumentHint: {
|
|
80
|
+
type: "string",
|
|
81
|
+
description: 'Optional hint for arguments (e.g. "[file-path]", "[environment]")',
|
|
82
|
+
},
|
|
83
|
+
disableModelInvocation: {
|
|
84
|
+
type: "boolean",
|
|
85
|
+
description: "If true, agent cannot auto-invoke this skill — user only via /name",
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
required: ["name", "description", "content"],
|
|
89
|
+
additionalProperties: false,
|
|
90
|
+
},
|
|
91
|
+
execute: async (input) => {
|
|
92
|
+
// ── Validate ──
|
|
93
|
+
const nameErr = validateName(input.name);
|
|
94
|
+
if (nameErr)
|
|
95
|
+
return { error: nameErr };
|
|
96
|
+
const descErr = validateDescription(input.description);
|
|
97
|
+
if (descErr)
|
|
98
|
+
return { error: descErr };
|
|
99
|
+
// Duplicate check
|
|
100
|
+
const existing = skillLoader.get(input.name);
|
|
101
|
+
if (existing) {
|
|
102
|
+
return {
|
|
103
|
+
error: `Skill "${input.name}" already exists at ${existing.sourcePath}. Choose a different name or edit the existing skill.`,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
// ── Build SKILL.md content ──
|
|
107
|
+
const frontmatter = buildFrontmatter(input);
|
|
108
|
+
const fullContent = `${frontmatter}\n\n${input.content}\n`;
|
|
109
|
+
// ── Write to disk ──
|
|
110
|
+
const skillDir = join(baseDir, input.name);
|
|
111
|
+
const skillPath = join(skillDir, "SKILL.md");
|
|
112
|
+
mkdirSync(skillDir, { recursive: true });
|
|
113
|
+
writeFileSync(skillPath, fullContent, "utf-8");
|
|
114
|
+
// ── Hot-reload ──
|
|
115
|
+
skillLoader.loadSkillFromFile(skillPath);
|
|
116
|
+
// ── Warnings ──
|
|
117
|
+
const warnings = [];
|
|
118
|
+
if (!input.content.includes("## ")) {
|
|
119
|
+
warnings.push("Skill body has no ## headings. Consider adding ## Overview, ## When to Use, etc.");
|
|
120
|
+
}
|
|
121
|
+
const result = {
|
|
122
|
+
status: "created",
|
|
123
|
+
path: skillPath,
|
|
124
|
+
name: input.name,
|
|
125
|
+
};
|
|
126
|
+
if (warnings.length > 0)
|
|
127
|
+
result.warnings = warnings;
|
|
128
|
+
return result;
|
|
129
|
+
},
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=skill.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill.js","sourceRoot":"","sources":["../../../src/oni-code/tools/skill.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* spawn_agents — Dispatch parallel (or sequential) subagents for independent
|
|
3
|
+
* tasks. Each agent runs in its own context and results are compressed into
|
|
4
|
+
* summaries via the output summarizer.
|
|
5
|
+
*/
|
|
6
|
+
import type { ToolDefinition } from "../../tools/types.js";
|
|
7
|
+
export interface AgentTask {
|
|
8
|
+
task: string;
|
|
9
|
+
tools?: string[];
|
|
10
|
+
}
|
|
11
|
+
interface AgentRunResult {
|
|
12
|
+
result: string;
|
|
13
|
+
filesModified: string[];
|
|
14
|
+
errors: string[];
|
|
15
|
+
}
|
|
16
|
+
export interface SpawnAgentsConfig {
|
|
17
|
+
runAgent: (task: string, index: number, agentName?: string) => Promise<AgentRunResult>;
|
|
18
|
+
}
|
|
19
|
+
interface SpawnAgentsInput {
|
|
20
|
+
agents: AgentTask[];
|
|
21
|
+
mode?: "parallel" | "sequential";
|
|
22
|
+
}
|
|
23
|
+
interface AgentResultEntry {
|
|
24
|
+
task: string;
|
|
25
|
+
summary: string;
|
|
26
|
+
filesModified: string[];
|
|
27
|
+
error?: string;
|
|
28
|
+
}
|
|
29
|
+
interface SpawnAgentsOutput {
|
|
30
|
+
agentCount: number;
|
|
31
|
+
mode: "parallel" | "sequential";
|
|
32
|
+
results: AgentResultEntry[];
|
|
33
|
+
totalDuration: number;
|
|
34
|
+
}
|
|
35
|
+
export declare function makeSpawnAgentsTool(config: SpawnAgentsConfig): ToolDefinition<SpawnAgentsInput, SpawnAgentsOutput>;
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=spawn-agents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spawn-agents.d.ts","sourceRoot":"","sources":["../../../src/oni-code/tools/spawn-agents.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAK3D,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,UAAU,cAAc;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;CACxF;AAID,UAAU,gBAAgB;IACxB,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,IAAI,CAAC,EAAE,UAAU,GAAG,YAAY,CAAC;CAClC;AAED,UAAU,gBAAgB;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,iBAAiB;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,UAAU,GAAG,YAAY,CAAC;IAChC,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,aAAa,EAAE,MAAM,CAAC;CACvB;AAID,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,iBAAiB,GACxB,cAAc,CAAC,gBAAgB,EAAE,iBAAiB,CAAC,CA2FrD"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* spawn_agents — Dispatch parallel (or sequential) subagents for independent
|
|
3
|
+
* tasks. Each agent runs in its own context and results are compressed into
|
|
4
|
+
* summaries via the output summarizer.
|
|
5
|
+
*/
|
|
6
|
+
import { defineTool } from "../../tools/define.js";
|
|
7
|
+
import { summarizeAgentResult } from "../summarizer.js";
|
|
8
|
+
// ── Factory ─────────────────────────────────────────────────
|
|
9
|
+
export function makeSpawnAgentsTool(config) {
|
|
10
|
+
async function runOne(agent, index, startTime) {
|
|
11
|
+
try {
|
|
12
|
+
const res = await config.runAgent(agent.task, index);
|
|
13
|
+
const duration = (Date.now() - startTime) / 1000;
|
|
14
|
+
const summary = summarizeAgentResult({
|
|
15
|
+
task: agent.task,
|
|
16
|
+
result: res.result,
|
|
17
|
+
filesModified: res.filesModified,
|
|
18
|
+
errors: res.errors,
|
|
19
|
+
duration,
|
|
20
|
+
});
|
|
21
|
+
return {
|
|
22
|
+
task: agent.task,
|
|
23
|
+
summary,
|
|
24
|
+
filesModified: res.filesModified,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
catch (err) {
|
|
28
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
29
|
+
return {
|
|
30
|
+
task: agent.task,
|
|
31
|
+
summary: "",
|
|
32
|
+
filesModified: [],
|
|
33
|
+
error: message,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return defineTool({
|
|
38
|
+
name: "spawn_agents",
|
|
39
|
+
description: "Dispatch parallel subagents for independent tasks. Each agent runs in its own context. Returns summaries.",
|
|
40
|
+
schema: {
|
|
41
|
+
type: "object",
|
|
42
|
+
properties: {
|
|
43
|
+
agents: {
|
|
44
|
+
type: "array",
|
|
45
|
+
items: {
|
|
46
|
+
type: "object",
|
|
47
|
+
properties: {
|
|
48
|
+
task: { type: "string", description: "Task description for the subagent" },
|
|
49
|
+
tools: {
|
|
50
|
+
type: "array",
|
|
51
|
+
items: { type: "string" },
|
|
52
|
+
description: "Optional list of tool names available to the agent",
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
required: ["task"],
|
|
56
|
+
},
|
|
57
|
+
description: "Array of agent tasks to dispatch",
|
|
58
|
+
},
|
|
59
|
+
mode: {
|
|
60
|
+
type: "string",
|
|
61
|
+
enum: ["parallel", "sequential"],
|
|
62
|
+
description: "Execution mode (default: parallel)",
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
required: ["agents"],
|
|
66
|
+
},
|
|
67
|
+
execute: async (input) => {
|
|
68
|
+
const mode = input.mode ?? "parallel";
|
|
69
|
+
const startTime = Date.now();
|
|
70
|
+
let results;
|
|
71
|
+
if (mode === "sequential") {
|
|
72
|
+
results = [];
|
|
73
|
+
for (let i = 0; i < input.agents.length; i++) {
|
|
74
|
+
const entry = await runOne(input.agents[i], i, startTime);
|
|
75
|
+
results.push(entry);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
results = await Promise.all(input.agents.map((agent, i) => runOne(agent, i, startTime)));
|
|
80
|
+
}
|
|
81
|
+
const totalDuration = (Date.now() - startTime) / 1000;
|
|
82
|
+
return {
|
|
83
|
+
agentCount: input.agents.length,
|
|
84
|
+
mode,
|
|
85
|
+
results,
|
|
86
|
+
totalDuration,
|
|
87
|
+
};
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=spawn-agents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spawn-agents.js","sourceRoot":"","sources":["../../../src/oni-code/tools/spawn-agents.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* spawn_swarm tool — dispatches topology-aware swarms.
|
|
3
|
+
*
|
|
4
|
+
* Supports all 7 ONI swarm topologies: debate, fanOut, pipeline,
|
|
5
|
+
* mapReduce, hierarchical, peerNetwork, hierarchicalMesh.
|
|
6
|
+
*/
|
|
7
|
+
import type { ToolDefinition } from "../../tools/types.js";
|
|
8
|
+
export declare const TOPOLOGY_DESCRIPTIONS: Record<string, string>;
|
|
9
|
+
export type Topology = keyof typeof TOPOLOGY_DESCRIPTIONS;
|
|
10
|
+
export interface SwarmAgentInput {
|
|
11
|
+
id: string;
|
|
12
|
+
role: string;
|
|
13
|
+
model?: string;
|
|
14
|
+
systemPrompt: string;
|
|
15
|
+
tools?: string[];
|
|
16
|
+
}
|
|
17
|
+
export interface SpawnSwarmInput {
|
|
18
|
+
topology: Topology;
|
|
19
|
+
task: string;
|
|
20
|
+
agents: SwarmAgentInput[];
|
|
21
|
+
judge?: {
|
|
22
|
+
model?: string;
|
|
23
|
+
maxRounds?: number;
|
|
24
|
+
consensusKeyword?: string;
|
|
25
|
+
};
|
|
26
|
+
tools?: string[];
|
|
27
|
+
maxTurns?: number;
|
|
28
|
+
mode?: "interactive" | "auto";
|
|
29
|
+
}
|
|
30
|
+
export interface SwarmConfig {
|
|
31
|
+
topology: Topology;
|
|
32
|
+
task: string;
|
|
33
|
+
agents: SwarmAgentInput[];
|
|
34
|
+
judge?: {
|
|
35
|
+
model?: string;
|
|
36
|
+
maxRounds?: number;
|
|
37
|
+
consensusKeyword?: string;
|
|
38
|
+
};
|
|
39
|
+
tools: string[];
|
|
40
|
+
maxTurns: number;
|
|
41
|
+
}
|
|
42
|
+
export interface SwarmRunner {
|
|
43
|
+
run: (config: SwarmConfig, perCallProgress?: SwarmProgressCallback, opts?: SwarmRunnerOpts) => Promise<{
|
|
44
|
+
outcome: string;
|
|
45
|
+
agentSummaries: Array<{
|
|
46
|
+
id: string;
|
|
47
|
+
summary: string;
|
|
48
|
+
}>;
|
|
49
|
+
filesModified: string[];
|
|
50
|
+
duration: number;
|
|
51
|
+
}>;
|
|
52
|
+
}
|
|
53
|
+
/** Callback for swarm progress reporting. */
|
|
54
|
+
export type SwarmProgressCallback = (event: {
|
|
55
|
+
type: string;
|
|
56
|
+
agentId?: string;
|
|
57
|
+
message?: string;
|
|
58
|
+
timestamp: number;
|
|
59
|
+
}) => void;
|
|
60
|
+
/** Options for a swarm run call. */
|
|
61
|
+
export interface SwarmRunnerOpts {
|
|
62
|
+
signal?: AbortSignal;
|
|
63
|
+
model?: import("../../models/types.js").ONIModel;
|
|
64
|
+
rootDir?: string;
|
|
65
|
+
tools?: import("../../tools/types.js").ToolDefinition[];
|
|
66
|
+
onProgress?: SwarmProgressCallback;
|
|
67
|
+
}
|
|
68
|
+
export declare function buildSwarmConfig(input: SpawnSwarmInput): SwarmConfig;
|
|
69
|
+
export declare function makeSpawnSwarmTool(runner: SwarmRunner): ToolDefinition;
|
|
70
|
+
//# sourceMappingURL=spawn-swarm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spawn-swarm.d.ts","sourceRoot":"","sources":["../../../src/oni-code/tools/spawn-swarm.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAK3D,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAexD,CAAC;AAIF,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,qBAAqB,CAAC;AAE1D,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,KAAK,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1E,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,aAAa,GAAG,MAAM,CAAC;CAC/B;AAED,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,KAAK,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1E,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,eAAe,CAAC,EAAE,qBAAqB,EAAE,IAAI,CAAC,EAAE,eAAe,KAAK,OAAO,CAAC;QACrG,OAAO,EAAE,MAAM,CAAC;QAChB,cAAc,EAAE,KAAK,CAAC;YAAE,EAAE,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QACvD,aAAa,EAAE,MAAM,EAAE,CAAC;QACxB,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC,CAAC;CACJ;AAED,6CAA6C;AAC7C,MAAM,MAAM,qBAAqB,GAAG,CAAC,KAAK,EAAE;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB,KAAK,IAAI,CAAC;AAEX,oCAAoC;AACpC,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,KAAK,CAAC,EAAE,OAAO,uBAAuB,EAAE,QAAQ,CAAC;IACjD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,sBAAsB,EAAE,cAAc,EAAE,CAAC;IACxD,UAAU,CAAC,EAAE,qBAAqB,CAAC;CACpC;AAkBD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,eAAe,GAAG,WAAW,CASpE;AAWD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,WAAW,GAAG,cAAc,CAoFtE"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* spawn_swarm tool — dispatches topology-aware swarms.
|
|
3
|
+
*
|
|
4
|
+
* Supports all 7 ONI swarm topologies: debate, fanOut, pipeline,
|
|
5
|
+
* mapReduce, hierarchical, peerNetwork, hierarchicalMesh.
|
|
6
|
+
*/
|
|
7
|
+
import { defineTool } from "../../tools/define.js";
|
|
8
|
+
import { summarizeSwarmResult } from "../summarizer.js";
|
|
9
|
+
// ── Topology Descriptions ─────────────────────────────────────
|
|
10
|
+
export const TOPOLOGY_DESCRIPTIONS = {
|
|
11
|
+
debate: "Multi-round debate with judge — for architecture decisions, trade-off analysis, code review with multiple perspectives",
|
|
12
|
+
fanOut: "Parallel independent agents with synthesis — for parallel independent work that gets combined",
|
|
13
|
+
pipeline: "Sequential multi-stage — for sequential work where each stage feeds the next",
|
|
14
|
+
mapReduce: "Analyze many inputs then synthesize — for analyzing many files or inputs and producing a combined conclusion",
|
|
15
|
+
hierarchical: "Manager delegates to specialists — for complex tasks needing a manager who delegates to specialist agents",
|
|
16
|
+
peerNetwork: "Agents collaborate and hand off freely — for open-ended collaboration where agents decide who works next",
|
|
17
|
+
hierarchicalMesh: "Multi-team with sub-topologies — for multi-team projects where each team has its own internal topology",
|
|
18
|
+
};
|
|
19
|
+
// ── Defaults ──────────────────────────────────────────────────
|
|
20
|
+
const DEFAULT_TOOLS = [
|
|
21
|
+
"read_file",
|
|
22
|
+
"edit_file",
|
|
23
|
+
"write_file",
|
|
24
|
+
"bash",
|
|
25
|
+
"grep",
|
|
26
|
+
"glob",
|
|
27
|
+
"git",
|
|
28
|
+
];
|
|
29
|
+
const DEFAULT_MAX_TURNS = 30;
|
|
30
|
+
// ── buildSwarmConfig ──────────────────────────────────────────
|
|
31
|
+
export function buildSwarmConfig(input) {
|
|
32
|
+
return {
|
|
33
|
+
topology: input.topology,
|
|
34
|
+
task: input.task,
|
|
35
|
+
agents: input.agents,
|
|
36
|
+
...(input.judge !== undefined ? { judge: input.judge } : {}),
|
|
37
|
+
tools: input.tools ?? DEFAULT_TOOLS,
|
|
38
|
+
maxTurns: input.maxTurns ?? DEFAULT_MAX_TURNS,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
// ── makeSpawnSwarmTool ────────────────────────────────────────
|
|
42
|
+
function buildTopologyEnumDescription() {
|
|
43
|
+
const lines = Object.entries(TOPOLOGY_DESCRIPTIONS).map(([key, desc]) => ` - ${key}: ${desc}`);
|
|
44
|
+
return lines.join("\n");
|
|
45
|
+
}
|
|
46
|
+
export function makeSpawnSwarmTool(runner) {
|
|
47
|
+
return defineTool({
|
|
48
|
+
name: "spawn_swarm",
|
|
49
|
+
description: [
|
|
50
|
+
"Spawn a multi-agent swarm with a specific topology.",
|
|
51
|
+
"",
|
|
52
|
+
"Available topologies:",
|
|
53
|
+
buildTopologyEnumDescription(),
|
|
54
|
+
].join("\n"),
|
|
55
|
+
schema: {
|
|
56
|
+
type: "object",
|
|
57
|
+
properties: {
|
|
58
|
+
topology: {
|
|
59
|
+
type: "string",
|
|
60
|
+
enum: Object.keys(TOPOLOGY_DESCRIPTIONS),
|
|
61
|
+
description: "The swarm topology to use",
|
|
62
|
+
},
|
|
63
|
+
task: {
|
|
64
|
+
type: "string",
|
|
65
|
+
description: "The task for the swarm to accomplish",
|
|
66
|
+
},
|
|
67
|
+
agents: {
|
|
68
|
+
type: "array",
|
|
69
|
+
items: {
|
|
70
|
+
type: "object",
|
|
71
|
+
properties: {
|
|
72
|
+
id: { type: "string", description: "Unique agent identifier" },
|
|
73
|
+
role: { type: "string", description: "Agent role description" },
|
|
74
|
+
model: { type: "string", description: "Model to use (optional)" },
|
|
75
|
+
systemPrompt: { type: "string", description: "System prompt for the agent" },
|
|
76
|
+
},
|
|
77
|
+
required: ["id", "role", "systemPrompt"],
|
|
78
|
+
},
|
|
79
|
+
description: "Array of agent definitions",
|
|
80
|
+
},
|
|
81
|
+
judge: {
|
|
82
|
+
type: "object",
|
|
83
|
+
properties: {
|
|
84
|
+
model: { type: "string", description: "Model for the judge (optional)" },
|
|
85
|
+
maxRounds: { type: "number", description: "Max debate rounds (optional)" },
|
|
86
|
+
consensusKeyword: { type: "string", description: "Keyword to signal consensus (optional)" },
|
|
87
|
+
},
|
|
88
|
+
description: "Judge configuration (for debate topology)",
|
|
89
|
+
},
|
|
90
|
+
tools: {
|
|
91
|
+
type: "array",
|
|
92
|
+
items: { type: "string" },
|
|
93
|
+
description: "Tool names available to agents (defaults to standard coding tools)",
|
|
94
|
+
},
|
|
95
|
+
maxTurns: {
|
|
96
|
+
type: "number",
|
|
97
|
+
description: "Maximum turns for the swarm (default 30)",
|
|
98
|
+
},
|
|
99
|
+
mode: {
|
|
100
|
+
type: "string",
|
|
101
|
+
enum: ["interactive", "auto"],
|
|
102
|
+
description: "Execution mode (default auto)",
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
required: ["topology", "task", "agents"],
|
|
106
|
+
},
|
|
107
|
+
execute: async (input, ctx) => {
|
|
108
|
+
const config = buildSwarmConfig(input);
|
|
109
|
+
const signal = "signal" in ctx ? ctx.signal : undefined;
|
|
110
|
+
const result = await runner.run(config, undefined, { signal });
|
|
111
|
+
const summary = summarizeSwarmResult({
|
|
112
|
+
topology: config.topology,
|
|
113
|
+
task: config.task,
|
|
114
|
+
outcome: result.outcome,
|
|
115
|
+
agentSummaries: result.agentSummaries,
|
|
116
|
+
filesModified: result.filesModified,
|
|
117
|
+
duration: result.duration,
|
|
118
|
+
});
|
|
119
|
+
return {
|
|
120
|
+
outcome: result.outcome,
|
|
121
|
+
agentSummaries: result.agentSummaries,
|
|
122
|
+
filesModified: result.filesModified,
|
|
123
|
+
duration: result.duration,
|
|
124
|
+
summary,
|
|
125
|
+
};
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=spawn-swarm.js.map
|