@hold-rein/cli 0.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/dist/cli.js +3 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.js +139 -0
- package/dist/index.js.map +1 -0
- package/dist/runtime/api/app.d.ts +7 -0
- package/dist/runtime/api/app.d.ts.map +1 -0
- package/dist/runtime/api/app.js +41 -0
- package/dist/runtime/api/config/const.d.ts +8 -0
- package/dist/runtime/api/config/const.d.ts.map +1 -0
- package/dist/runtime/api/config/const.js +9 -0
- package/dist/runtime/api/config/env.d.ts +10 -0
- package/dist/runtime/api/config/env.d.ts.map +1 -0
- package/dist/runtime/api/config/env.js +32 -0
- package/dist/runtime/api/db/connection.d.ts +11 -0
- package/dist/runtime/api/db/connection.d.ts.map +1 -0
- package/dist/runtime/api/db/connection.js +21 -0
- package/dist/runtime/api/db/index.d.ts +4 -0
- package/dist/runtime/api/db/index.d.ts.map +1 -0
- package/dist/runtime/api/db/index.js +3 -0
- package/dist/runtime/api/db/migrate.d.ts +4 -0
- package/dist/runtime/api/db/migrate.d.ts.map +1 -0
- package/dist/runtime/api/db/migrate.js +308 -0
- package/dist/runtime/api/db/schema.d.ts +1610 -0
- package/dist/runtime/api/db/schema.d.ts.map +1 -0
- package/dist/runtime/api/db/schema.js +148 -0
- package/dist/runtime/api/middleware/error-middleware.d.ts +3 -0
- package/dist/runtime/api/middleware/error-middleware.d.ts.map +1 -0
- package/dist/runtime/api/middleware/error-middleware.js +5 -0
- package/dist/runtime/api/middleware/not-found-middleware.d.ts +3 -0
- package/dist/runtime/api/middleware/not-found-middleware.d.ts.map +1 -0
- package/dist/runtime/api/middleware/not-found-middleware.js +4 -0
- package/dist/runtime/api/modules/agents/active-task-run-registry.d.ts +10 -0
- package/dist/runtime/api/modules/agents/active-task-run-registry.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/active-task-run-registry.js +20 -0
- package/dist/runtime/api/modules/agents/agent-approval-store.d.ts +7 -0
- package/dist/runtime/api/modules/agents/agent-approval-store.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/agent-approval-store.js +23 -0
- package/dist/runtime/api/modules/agents/agent-event-bus.d.ts +8 -0
- package/dist/runtime/api/modules/agents/agent-event-bus.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/agent-event-bus.js +40 -0
- package/dist/runtime/api/modules/agents/agent-message-repository.d.ts +22 -0
- package/dist/runtime/api/modules/agents/agent-message-repository.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/agent-message-repository.js +60 -0
- package/dist/runtime/api/modules/agents/agent-message-storage.d.ts +4 -0
- package/dist/runtime/api/modules/agents/agent-message-storage.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/agent-message-storage.js +11 -0
- package/dist/runtime/api/modules/agents/agent-model-resolver.d.ts +4 -0
- package/dist/runtime/api/modules/agents/agent-model-resolver.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/agent-model-resolver.js +17 -0
- package/dist/runtime/api/modules/agents/agent-runtime-messages.d.ts +12 -0
- package/dist/runtime/api/modules/agents/agent-runtime-messages.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/agent-runtime-messages.js +19 -0
- package/dist/runtime/api/modules/agents/agent-runtime-support.d.ts +12 -0
- package/dist/runtime/api/modules/agents/agent-runtime-support.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/agent-runtime-support.js +38 -0
- package/dist/runtime/api/modules/agents/agent-runtime.d.ts +25 -0
- package/dist/runtime/api/modules/agents/agent-runtime.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/agent-runtime.js +371 -0
- package/dist/runtime/api/modules/agents/agent-subagents.d.ts +32 -0
- package/dist/runtime/api/modules/agents/agent-subagents.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/agent-subagents.js +65 -0
- package/dist/runtime/api/modules/agents/agent-task-actions.d.ts +9 -0
- package/dist/runtime/api/modules/agents/agent-task-actions.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/agent-task-actions.js +33 -0
- package/dist/runtime/api/modules/agents/agent-task-title-generator.d.ts +15 -0
- package/dist/runtime/api/modules/agents/agent-task-title-generator.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/agent-task-title-generator.js +61 -0
- package/dist/runtime/api/modules/agents/agent-tool-approval.d.ts +12 -0
- package/dist/runtime/api/modules/agents/agent-tool-approval.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/agent-tool-approval.js +40 -0
- package/dist/runtime/api/modules/agents/agent-types.d.ts +198 -0
- package/dist/runtime/api/modules/agents/agent-types.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/agent-types.js +1 -0
- package/dist/runtime/api/modules/agents/agents-router.d.ts +7 -0
- package/dist/runtime/api/modules/agents/agents-router.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/agents-router.js +210 -0
- package/dist/runtime/api/modules/agents/agents-service.d.ts +52 -0
- package/dist/runtime/api/modules/agents/agents-service.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/agents-service.js +282 -0
- package/dist/runtime/api/modules/agents/approval/store.d.ts +7 -0
- package/dist/runtime/api/modules/agents/approval/store.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/approval/store.js +23 -0
- package/dist/runtime/api/modules/agents/approval/tool-approval.d.ts +14 -0
- package/dist/runtime/api/modules/agents/approval/tool-approval.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/approval/tool-approval.js +43 -0
- package/dist/runtime/api/modules/agents/custom-agent-model.d.ts +16 -0
- package/dist/runtime/api/modules/agents/custom-agent-model.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/custom-agent-model.js +21 -0
- package/dist/runtime/api/modules/agents/default-agents-service.d.ts +3 -0
- package/dist/runtime/api/modules/agents/default-agents-service.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/default-agents-service.js +52 -0
- package/dist/runtime/api/modules/agents/event/event-bus.d.ts +8 -0
- package/dist/runtime/api/modules/agents/event/event-bus.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/event/event-bus.js +40 -0
- package/dist/runtime/api/modules/agents/index.d.ts +11 -0
- package/dist/runtime/api/modules/agents/index.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/index.js +9 -0
- package/dist/runtime/api/modules/agents/message/storage.d.ts +4 -0
- package/dist/runtime/api/modules/agents/message/storage.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/message/storage.js +11 -0
- package/dist/runtime/api/modules/agents/model/custom-model.d.ts +16 -0
- package/dist/runtime/api/modules/agents/model/custom-model.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/model/custom-model.js +21 -0
- package/dist/runtime/api/modules/agents/model/resolver.d.ts +4 -0
- package/dist/runtime/api/modules/agents/model/resolver.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/model/resolver.js +17 -0
- package/dist/runtime/api/modules/agents/router/browser-tool-result.d.ts +8 -0
- package/dist/runtime/api/modules/agents/router/browser-tool-result.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/router/browser-tool-result.js +35 -0
- package/dist/runtime/api/modules/agents/router/index.d.ts +10 -0
- package/dist/runtime/api/modules/agents/router/index.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/router/index.js +210 -0
- package/dist/runtime/api/modules/agents/router/request-parsing.d.ts +24 -0
- package/dist/runtime/api/modules/agents/router/request-parsing.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/router/request-parsing.js +78 -0
- package/dist/runtime/api/modules/agents/runtime/browser-runtime-contributions.d.ts +5 -0
- package/dist/runtime/api/modules/agents/runtime/browser-runtime-contributions.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/runtime/browser-runtime-contributions.js +115 -0
- package/dist/runtime/api/modules/agents/runtime/browser-runtime-tools.d.ts +13 -0
- package/dist/runtime/api/modules/agents/runtime/browser-runtime-tools.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/runtime/browser-runtime-tools.js +31 -0
- package/dist/runtime/api/modules/agents/runtime/browser-tool-call-store.d.ts +21 -0
- package/dist/runtime/api/modules/agents/runtime/browser-tool-call-store.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/runtime/browser-tool-call-store.js +69 -0
- package/dist/runtime/api/modules/agents/runtime/continuation-subagent.d.ts +26 -0
- package/dist/runtime/api/modules/agents/runtime/continuation-subagent.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/runtime/continuation-subagent.js +67 -0
- package/dist/runtime/api/modules/agents/runtime/index.d.ts +3 -0
- package/dist/runtime/api/modules/agents/runtime/index.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/runtime/index.js +432 -0
- package/dist/runtime/api/modules/agents/runtime/messages.d.ts +12 -0
- package/dist/runtime/api/modules/agents/runtime/messages.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/runtime/messages.js +19 -0
- package/dist/runtime/api/modules/agents/runtime/subagent-results.d.ts +22 -0
- package/dist/runtime/api/modules/agents/runtime/subagent-results.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/runtime/subagent-results.js +39 -0
- package/dist/runtime/api/modules/agents/runtime/subagent-tools.d.ts +49 -0
- package/dist/runtime/api/modules/agents/runtime/subagent-tools.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/runtime/subagent-tools.js +195 -0
- package/dist/runtime/api/modules/agents/runtime/support.d.ts +19 -0
- package/dist/runtime/api/modules/agents/runtime/support.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/runtime/support.js +106 -0
- package/dist/runtime/api/modules/agents/runtime/token-collection.d.ts +28 -0
- package/dist/runtime/api/modules/agents/runtime/token-collection.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/runtime/token-collection.js +131 -0
- package/dist/runtime/api/modules/agents/runtime/token-usage-sync.d.ts +15 -0
- package/dist/runtime/api/modules/agents/runtime/token-usage-sync.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/runtime/token-usage-sync.js +46 -0
- package/dist/runtime/api/modules/agents/runtime/type.d.ts +62 -0
- package/dist/runtime/api/modules/agents/runtime/type.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/runtime/type.js +1 -0
- package/dist/runtime/api/modules/agents/runtime/workspace-agent-instructions.d.ts +3 -0
- package/dist/runtime/api/modules/agents/runtime/workspace-agent-instructions.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/runtime/workspace-agent-instructions.js +31 -0
- package/dist/runtime/api/modules/agents/service/default.d.ts +3 -0
- package/dist/runtime/api/modules/agents/service/default.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/service/default.js +65 -0
- package/dist/runtime/api/modules/agents/service/index.d.ts +56 -0
- package/dist/runtime/api/modules/agents/service/index.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/service/index.js +296 -0
- package/dist/runtime/api/modules/agents/service/interrupt-task.d.ts +14 -0
- package/dist/runtime/api/modules/agents/service/interrupt-task.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/service/interrupt-task.js +34 -0
- package/dist/runtime/api/modules/agents/service/startup-recovery.d.ts +14 -0
- package/dist/runtime/api/modules/agents/service/startup-recovery.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/service/startup-recovery.js +15 -0
- package/dist/runtime/api/modules/agents/shell-command-risk.d.ts +3 -0
- package/dist/runtime/api/modules/agents/shell-command-risk.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/shell-command-risk.js +24 -0
- package/dist/runtime/api/modules/agents/shell-exec-tool.d.ts +4 -0
- package/dist/runtime/api/modules/agents/shell-exec-tool.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/shell-exec-tool.js +71 -0
- package/dist/runtime/api/modules/agents/subagent/index.d.ts +45 -0
- package/dist/runtime/api/modules/agents/subagent/index.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/subagent/index.js +143 -0
- package/dist/runtime/api/modules/agents/subagent/lifecycle.d.ts +13 -0
- package/dist/runtime/api/modules/agents/subagent/lifecycle.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/subagent/lifecycle.js +36 -0
- package/dist/runtime/api/modules/agents/subagent/repository.d.ts +12 -0
- package/dist/runtime/api/modules/agents/subagent/repository.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/subagent/repository.js +93 -0
- package/dist/runtime/api/modules/agents/subagent-repository.d.ts +11 -0
- package/dist/runtime/api/modules/agents/subagent-repository.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/subagent-repository.js +65 -0
- package/dist/runtime/api/modules/agents/task/actions.d.ts +10 -0
- package/dist/runtime/api/modules/agents/task/actions.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/task/actions.js +37 -0
- package/dist/runtime/api/modules/agents/task/active-run-registry.d.ts +10 -0
- package/dist/runtime/api/modules/agents/task/active-run-registry.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/task/active-run-registry.js +20 -0
- package/dist/runtime/api/modules/agents/task/run-monitor.d.ts +14 -0
- package/dist/runtime/api/modules/agents/task/run-monitor.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/task/run-monitor.js +42 -0
- package/dist/runtime/api/modules/agents/task/title-generator.d.ts +15 -0
- package/dist/runtime/api/modules/agents/task/title-generator.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/task/title-generator.js +61 -0
- package/dist/runtime/api/modules/agents/task-run-monitor.d.ts +14 -0
- package/dist/runtime/api/modules/agents/task-run-monitor.d.ts.map +1 -0
- package/dist/runtime/api/modules/agents/task-run-monitor.js +42 -0
- package/dist/runtime/api/modules/file-system/file-system-router.d.ts +6 -0
- package/dist/runtime/api/modules/file-system/file-system-router.d.ts.map +1 -0
- package/dist/runtime/api/modules/file-system/file-system-router.js +119 -0
- package/dist/runtime/api/modules/file-system/file-system-service.d.ts +30 -0
- package/dist/runtime/api/modules/file-system/file-system-service.d.ts.map +1 -0
- package/dist/runtime/api/modules/file-system/file-system-service.js +209 -0
- package/dist/runtime/api/modules/file-system/index.d.ts +4 -0
- package/dist/runtime/api/modules/file-system/index.d.ts.map +1 -0
- package/dist/runtime/api/modules/file-system/index.js +1 -0
- package/dist/runtime/api/modules/health/health-router.d.ts +3 -0
- package/dist/runtime/api/modules/health/health-router.d.ts.map +1 -0
- package/dist/runtime/api/modules/health/health-router.js +10 -0
- package/dist/runtime/api/modules/health/index.d.ts +2 -0
- package/dist/runtime/api/modules/health/index.d.ts.map +1 -0
- package/dist/runtime/api/modules/health/index.js +1 -0
- package/dist/runtime/api/modules/model-providers/default-model-provider-service.d.ts +3 -0
- package/dist/runtime/api/modules/model-providers/default-model-provider-service.d.ts.map +1 -0
- package/dist/runtime/api/modules/model-providers/default-model-provider-service.js +21 -0
- package/dist/runtime/api/modules/model-providers/index.d.ts +5 -0
- package/dist/runtime/api/modules/model-providers/index.d.ts.map +1 -0
- package/dist/runtime/api/modules/model-providers/index.js +4 -0
- package/dist/runtime/api/modules/model-providers/model-provider-api-key-crypto.d.ts +8 -0
- package/dist/runtime/api/modules/model-providers/model-provider-api-key-crypto.d.ts.map +1 -0
- package/dist/runtime/api/modules/model-providers/model-provider-api-key-crypto.js +35 -0
- package/dist/runtime/api/modules/model-providers/model-provider-repository.d.ts +51 -0
- package/dist/runtime/api/modules/model-providers/model-provider-repository.d.ts.map +1 -0
- package/dist/runtime/api/modules/model-providers/model-provider-repository.js +314 -0
- package/dist/runtime/api/modules/model-providers/model-providers-router.d.ts +9 -0
- package/dist/runtime/api/modules/model-providers/model-providers-router.d.ts.map +1 -0
- package/dist/runtime/api/modules/model-providers/model-providers-router.js +188 -0
- package/dist/runtime/api/modules/model-providers/model-providers-service.d.ts +52 -0
- package/dist/runtime/api/modules/model-providers/model-providers-service.d.ts.map +1 -0
- package/dist/runtime/api/modules/model-providers/model-providers-service.js +239 -0
- package/dist/runtime/api/modules/model-proxies/default-model-proxies-service.d.ts +3 -0
- package/dist/runtime/api/modules/model-proxies/default-model-proxies-service.d.ts.map +1 -0
- package/dist/runtime/api/modules/model-proxies/default-model-proxies-service.js +22 -0
- package/dist/runtime/api/modules/model-proxies/index.d.ts +5 -0
- package/dist/runtime/api/modules/model-proxies/index.d.ts.map +1 -0
- package/dist/runtime/api/modules/model-proxies/index.js +4 -0
- package/dist/runtime/api/modules/model-proxies/model-proxies-router.d.ts +7 -0
- package/dist/runtime/api/modules/model-proxies/model-proxies-router.d.ts.map +1 -0
- package/dist/runtime/api/modules/model-proxies/model-proxies-router.js +55 -0
- package/dist/runtime/api/modules/model-proxies/model-proxies-service.d.ts +26 -0
- package/dist/runtime/api/modules/model-proxies/model-proxies-service.d.ts.map +1 -0
- package/dist/runtime/api/modules/model-proxies/model-proxies-service.js +107 -0
- package/dist/runtime/api/modules/model-proxies/model-proxy-repository.d.ts +39 -0
- package/dist/runtime/api/modules/model-proxies/model-proxy-repository.d.ts.map +1 -0
- package/dist/runtime/api/modules/model-proxies/model-proxy-repository.js +146 -0
- package/dist/runtime/api/modules/model-proxies/model-proxy-runtime.d.ts +20 -0
- package/dist/runtime/api/modules/model-proxies/model-proxy-runtime.d.ts.map +1 -0
- package/dist/runtime/api/modules/model-proxies/model-proxy-runtime.js +45 -0
- package/dist/runtime/api/modules/plugins/plugins-router.d.ts +7 -0
- package/dist/runtime/api/modules/plugins/plugins-router.d.ts.map +1 -0
- package/dist/runtime/api/modules/plugins/plugins-router.js +11 -0
- package/dist/runtime/api/modules/skills/default-skills-service.d.ts +3 -0
- package/dist/runtime/api/modules/skills/default-skills-service.d.ts.map +1 -0
- package/dist/runtime/api/modules/skills/default-skills-service.js +9 -0
- package/dist/runtime/api/modules/skills/index.d.ts +5 -0
- package/dist/runtime/api/modules/skills/index.d.ts.map +1 -0
- package/dist/runtime/api/modules/skills/index.js +3 -0
- package/dist/runtime/api/modules/skills/skills-router.d.ts +7 -0
- package/dist/runtime/api/modules/skills/skills-router.d.ts.map +1 -0
- package/dist/runtime/api/modules/skills/skills-router.js +56 -0
- package/dist/runtime/api/modules/skills/skills-service.d.ts +7 -0
- package/dist/runtime/api/modules/skills/skills-service.d.ts.map +1 -0
- package/dist/runtime/api/modules/skills/skills-service.js +264 -0
- package/dist/runtime/api/modules/skills/skills-types.d.ts +22 -0
- package/dist/runtime/api/modules/skills/skills-types.d.ts.map +1 -0
- package/dist/runtime/api/modules/skills/skills-types.js +1 -0
- package/dist/runtime/api/modules/usage-stats/default-usage-stats-service.d.ts +3 -0
- package/dist/runtime/api/modules/usage-stats/default-usage-stats-service.d.ts.map +1 -0
- package/dist/runtime/api/modules/usage-stats/default-usage-stats-service.js +17 -0
- package/dist/runtime/api/modules/usage-stats/index.d.ts +4 -0
- package/dist/runtime/api/modules/usage-stats/index.d.ts.map +1 -0
- package/dist/runtime/api/modules/usage-stats/index.js +2 -0
- package/dist/runtime/api/modules/usage-stats/usage-stats-router.d.ts +7 -0
- package/dist/runtime/api/modules/usage-stats/usage-stats-router.d.ts.map +1 -0
- package/dist/runtime/api/modules/usage-stats/usage-stats-router.js +42 -0
- package/dist/runtime/api/modules/usage-stats/usage-stats-service.d.ts +40 -0
- package/dist/runtime/api/modules/usage-stats/usage-stats-service.d.ts.map +1 -0
- package/dist/runtime/api/modules/usage-stats/usage-stats-service.js +144 -0
- package/dist/runtime/api/modules/usage-stats/usage-stats-types.d.ts +39 -0
- package/dist/runtime/api/modules/usage-stats/usage-stats-types.d.ts.map +1 -0
- package/dist/runtime/api/modules/usage-stats/usage-stats-types.js +1 -0
- package/dist/runtime/api/modules/workspaces/default-workspaces-service.d.ts +3 -0
- package/dist/runtime/api/modules/workspaces/default-workspaces-service.d.ts.map +1 -0
- package/dist/runtime/api/modules/workspaces/default-workspaces-service.js +20 -0
- package/dist/runtime/api/modules/workspaces/index.d.ts +6 -0
- package/dist/runtime/api/modules/workspaces/index.d.ts.map +1 -0
- package/dist/runtime/api/modules/workspaces/index.js +5 -0
- package/dist/runtime/api/modules/workspaces/workspace-repository.d.ts +41 -0
- package/dist/runtime/api/modules/workspaces/workspace-repository.d.ts.map +1 -0
- package/dist/runtime/api/modules/workspaces/workspace-repository.js +326 -0
- package/dist/runtime/api/modules/workspaces/workspace-types.d.ts +33 -0
- package/dist/runtime/api/modules/workspaces/workspace-types.d.ts.map +1 -0
- package/dist/runtime/api/modules/workspaces/workspace-types.js +1 -0
- package/dist/runtime/api/modules/workspaces/workspaces-router.d.ts +7 -0
- package/dist/runtime/api/modules/workspaces/workspaces-router.d.ts.map +1 -0
- package/dist/runtime/api/modules/workspaces/workspaces-router.js +71 -0
- package/dist/runtime/api/modules/workspaces/workspaces-service.d.ts +24 -0
- package/dist/runtime/api/modules/workspaces/workspaces-service.d.ts.map +1 -0
- package/dist/runtime/api/modules/workspaces/workspaces-service.js +109 -0
- package/dist/runtime/api/plugin.d.ts +5 -0
- package/dist/runtime/api/plugin.d.ts.map +1 -0
- package/dist/runtime/api/plugin.js +48 -0
- package/dist/runtime/api/response/api-response.d.ts +11 -0
- package/dist/runtime/api/response/api-response.d.ts.map +1 -0
- package/dist/runtime/api/response/api-response.js +18 -0
- package/dist/runtime/api/response/index.d.ts +3 -0
- package/dist/runtime/api/response/index.d.ts.map +1 -0
- package/dist/runtime/api/response/index.js +2 -0
- package/dist/runtime/api/response/response-codes.d.ts +52 -0
- package/dist/runtime/api/response/response-codes.d.ts.map +1 -0
- package/dist/runtime/api/response/response-codes.js +44 -0
- package/dist/runtime/api/router/v1/index.d.ts +12 -0
- package/dist/runtime/api/router/v1/index.d.ts.map +1 -0
- package/dist/runtime/api/router/v1/index.js +26 -0
- package/dist/runtime/api/runtime.d.ts +15 -0
- package/dist/runtime/api/runtime.d.ts.map +1 -0
- package/dist/runtime/api/runtime.js +30 -0
- package/dist/runtime/api/server.d.ts +2 -0
- package/dist/runtime/api/server.d.ts.map +1 -0
- package/dist/runtime/api/server.js +14 -0
- package/dist/runtime/api/service/health-service.d.ts +7 -0
- package/dist/runtime/api/service/health-service.d.ts.map +1 -0
- package/dist/runtime/api/service/health-service.js +7 -0
- package/dist/runtime/web/assets/abap-DLDM7-KI.js +1 -0
- package/dist/runtime/web/assets/apex-DNDY2TF8.js +1 -0
- package/dist/runtime/web/assets/azcli-Y6nb8tq_.js +1 -0
- package/dist/runtime/web/assets/bat-BwHxbl9M.js +1 -0
- package/dist/runtime/web/assets/bicep-CFznDFnq.js +2 -0
- package/dist/runtime/web/assets/cameligo-Bf6VGUru.js +1 -0
- package/dist/runtime/web/assets/clojure-Dnu-v4kV.js +1 -0
- package/dist/runtime/web/assets/codicon-ngg6Pgfi.ttf +0 -0
- package/dist/runtime/web/assets/coffee-Bd8akH9Z.js +1 -0
- package/dist/runtime/web/assets/cpp-BbWJElDN.js +1 -0
- package/dist/runtime/web/assets/csharp-Co3qMtFm.js +1 -0
- package/dist/runtime/web/assets/csp-D-4FJmMZ.js +1 -0
- package/dist/runtime/web/assets/css-DdJfP1eB.js +3 -0
- package/dist/runtime/web/assets/css.worker-B4z49cGk.js +93 -0
- package/dist/runtime/web/assets/cssMode-w2xbbUEW.js +1 -0
- package/dist/runtime/web/assets/cypher-cTPe9QuQ.js +1 -0
- package/dist/runtime/web/assets/dart-BOtBlQCF.js +1 -0
- package/dist/runtime/web/assets/dockerfile-BG73LgW2.js +1 -0
- package/dist/runtime/web/assets/ecl-BEgZUVRK.js +1 -0
- package/dist/runtime/web/assets/elixir-BkW5O-1t.js +1 -0
- package/dist/runtime/web/assets/flow9-BeJ5waoc.js +1 -0
- package/dist/runtime/web/assets/freemarker2-mywz2bob.js +3 -0
- package/dist/runtime/web/assets/fsharp-PahG7c26.js +1 -0
- package/dist/runtime/web/assets/go-acbASCJo.js +1 -0
- package/dist/runtime/web/assets/graphql-BxJiqAUM.js +1 -0
- package/dist/runtime/web/assets/handlebars-Cy-2QN_R.js +1 -0
- package/dist/runtime/web/assets/hcl-DtV1sZF8.js +1 -0
- package/dist/runtime/web/assets/html-2WQMGvns.js +1 -0
- package/dist/runtime/web/assets/html.worker-DtiGdgqp.js +470 -0
- package/dist/runtime/web/assets/htmlMode-BznIdxOy.js +1 -0
- package/dist/runtime/web/assets/index-CQ_mZUpS.css +1 -0
- package/dist/runtime/web/assets/index-CtZcItCu.js +1512 -0
- package/dist/runtime/web/assets/ini-Kd9XrMLS.js +1 -0
- package/dist/runtime/web/assets/java-CXBNlu9o.js +1 -0
- package/dist/runtime/web/assets/javascript-BK6G_5BV.js +1 -0
- package/dist/runtime/web/assets/json.worker-leyajbqV.js +58 -0
- package/dist/runtime/web/assets/jsonMode-DI8_Cj0K.js +7 -0
- package/dist/runtime/web/assets/julia-cl7-CwDS.js +1 -0
- package/dist/runtime/web/assets/kotlin-s7OhZKlX.js +1 -0
- package/dist/runtime/web/assets/less-9HpZscsL.js +2 -0
- package/dist/runtime/web/assets/lexon-OrD6JF1K.js +1 -0
- package/dist/runtime/web/assets/liquid-CE7Qnc0w.js +1 -0
- package/dist/runtime/web/assets/lspLanguageFeatures-DKvGiYOU.js +4 -0
- package/dist/runtime/web/assets/lua-Cyyb5UIc.js +1 -0
- package/dist/runtime/web/assets/m3-B8OfTtLu.js +1 -0
- package/dist/runtime/web/assets/markdown-BFxVWTOG.js +1 -0
- package/dist/runtime/web/assets/mdx-Fk0ZjYeT.js +1 -0
- package/dist/runtime/web/assets/mips-CiqrrVzr.js +1 -0
- package/dist/runtime/web/assets/msdax-DmeGPVcC.js +1 -0
- package/dist/runtime/web/assets/mysql-C_tMU-Nz.js +1 -0
- package/dist/runtime/web/assets/objective-c-BDtDVThU.js +1 -0
- package/dist/runtime/web/assets/pascal-vHIfCaH5.js +1 -0
- package/dist/runtime/web/assets/pascaligo-DtZ0uQbO.js +1 -0
- package/dist/runtime/web/assets/perl-Ub6l9XKa.js +1 -0
- package/dist/runtime/web/assets/pgsql-BlNEE0v7.js +1 -0
- package/dist/runtime/web/assets/php-BBUBE1dy.js +1 -0
- package/dist/runtime/web/assets/pla-DSh2-awV.js +1 -0
- package/dist/runtime/web/assets/postiats-CocnycG-.js +1 -0
- package/dist/runtime/web/assets/powerquery-tScXyioY.js +1 -0
- package/dist/runtime/web/assets/powershell-COWaemsV.js +1 -0
- package/dist/runtime/web/assets/protobuf-Brw8urJB.js +2 -0
- package/dist/runtime/web/assets/pug-8SOpv6rk.js +1 -0
- package/dist/runtime/web/assets/python-xn7eKnQc.js +1 -0
- package/dist/runtime/web/assets/qsharp-Bw9ernYp.js +1 -0
- package/dist/runtime/web/assets/r-j7ic8hl3.js +1 -0
- package/dist/runtime/web/assets/razor-BjC5fot0.js +1 -0
- package/dist/runtime/web/assets/redis-Bu5POkcn.js +1 -0
- package/dist/runtime/web/assets/redshift-Bs9aos_-.js +1 -0
- package/dist/runtime/web/assets/restructuredtext-CqXO7rUv.js +1 -0
- package/dist/runtime/web/assets/ruby-zBfavPgS.js +1 -0
- package/dist/runtime/web/assets/rust-BzKRNQWT.js +1 -0
- package/dist/runtime/web/assets/sb-BBc9UKZt.js +1 -0
- package/dist/runtime/web/assets/scala-D9hQfWCl.js +1 -0
- package/dist/runtime/web/assets/scheme-BPhDTwHR.js +1 -0
- package/dist/runtime/web/assets/scss-CBJaRo0y.js +3 -0
- package/dist/runtime/web/assets/shell-DiJ1NA_G.js +1 -0
- package/dist/runtime/web/assets/solidity-Db0IVjzk.js +1 -0
- package/dist/runtime/web/assets/sophia-CnS9iZB_.js +1 -0
- package/dist/runtime/web/assets/sparql-CJmd_6j2.js +1 -0
- package/dist/runtime/web/assets/sql-ClhHkBeG.js +1 -0
- package/dist/runtime/web/assets/st-CHwy0fLd.js +1 -0
- package/dist/runtime/web/assets/swift-Bqt4WxQ4.js +3 -0
- package/dist/runtime/web/assets/systemverilog-Bs9z6M-B.js +1 -0
- package/dist/runtime/web/assets/tcl-Dm6ycUr_.js +1 -0
- package/dist/runtime/web/assets/ts.worker-59MjiAqk.js +67731 -0
- package/dist/runtime/web/assets/tsMode-8t6AIduV.js +11 -0
- package/dist/runtime/web/assets/twig-Csy3S7wG.js +1 -0
- package/dist/runtime/web/assets/typescript-DvPPogGC.js +1 -0
- package/dist/runtime/web/assets/typespec-Btyra-wh.js +1 -0
- package/dist/runtime/web/assets/vb-Db0cS2oM.js +1 -0
- package/dist/runtime/web/assets/wgsl-BTesnYfV.js +298 -0
- package/dist/runtime/web/assets/xml-CB8xdh8u.js +1 -0
- package/dist/runtime/web/assets/yaml-B4sXC4FA.js +1 -0
- package/dist/runtime/web/index.html +13 -0
- package/package.json +42 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const DANGEROUS_PATTERNS = [
|
|
2
|
+
/\brm\s+(-[^\s]*r[^\s]*f|-{1,2}recursive\b.*-{1,2}force\b)/u,
|
|
3
|
+
/\bgit\s+reset\s+--hard\b/u,
|
|
4
|
+
/\bsudo\b/u,
|
|
5
|
+
/\bchmod\s+777\b/u
|
|
6
|
+
];
|
|
7
|
+
const WRITE_PATTERNS = [
|
|
8
|
+
/>/u,
|
|
9
|
+
/\bmv\b/u,
|
|
10
|
+
/\bcp\b/u,
|
|
11
|
+
/\btouch\b/u,
|
|
12
|
+
/\bmkdir\b/u,
|
|
13
|
+
/\bgit\s+(add|commit|push|switch|checkout|branch)\b/u,
|
|
14
|
+
/\b(pnpm|npm|yarn)\s+(install|add|remove)\b/u
|
|
15
|
+
];
|
|
16
|
+
export function classifyShellCommandRisk(command) {
|
|
17
|
+
if (DANGEROUS_PATTERNS.some((pattern) => pattern.test(command))) {
|
|
18
|
+
return "dangerous";
|
|
19
|
+
}
|
|
20
|
+
if (WRITE_PATTERNS.some((pattern) => pattern.test(command))) {
|
|
21
|
+
return "writes";
|
|
22
|
+
}
|
|
23
|
+
return "safe";
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell-exec-tool.d.ts","sourceRoot":"","sources":["../../../src/modules/agents/shell-exec-tool.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAGlE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAgB/D,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,YAAY,GAAG,SAAS,CA8ChE"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Type } from "@earendil-works/pi-ai";
|
|
2
|
+
const MAX_OUTPUT_LENGTH = 20_000;
|
|
3
|
+
const shellExecParameters = Type.Object({
|
|
4
|
+
command: Type.String({ description: "Shell command to execute." }),
|
|
5
|
+
cwd: Type.Optional(Type.String({ description: "Working directory for the command." })),
|
|
6
|
+
timeoutSeconds: Type.Optional(Type.Number({ description: "Command timeout in seconds." }))
|
|
7
|
+
});
|
|
8
|
+
export function createShellExecTool(env) {
|
|
9
|
+
return {
|
|
10
|
+
name: "shell_exec",
|
|
11
|
+
label: "Shell Exec",
|
|
12
|
+
description: "Run a shell command in the configured workspace.",
|
|
13
|
+
parameters: shellExecParameters,
|
|
14
|
+
async execute(_toolCallId, rawParams, signal) {
|
|
15
|
+
const params = rawParams;
|
|
16
|
+
const cwd = params.cwd ?? env.cwd;
|
|
17
|
+
const execOptions = {
|
|
18
|
+
cwd,
|
|
19
|
+
timeout: params.timeoutSeconds ?? 60,
|
|
20
|
+
...(signal ? { abortSignal: signal } : {})
|
|
21
|
+
};
|
|
22
|
+
const result = await env.exec(params.command, {
|
|
23
|
+
...execOptions
|
|
24
|
+
});
|
|
25
|
+
if (!result.ok) {
|
|
26
|
+
throw result.error;
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
content: [
|
|
30
|
+
{
|
|
31
|
+
type: "text",
|
|
32
|
+
text: formatShellOutput({
|
|
33
|
+
command: params.command,
|
|
34
|
+
cwd,
|
|
35
|
+
exitCode: result.value.exitCode,
|
|
36
|
+
stderr: result.value.stderr,
|
|
37
|
+
stdout: result.value.stdout
|
|
38
|
+
})
|
|
39
|
+
}
|
|
40
|
+
],
|
|
41
|
+
details: {
|
|
42
|
+
command: params.command,
|
|
43
|
+
cwd,
|
|
44
|
+
exitCode: result.value.exitCode,
|
|
45
|
+
stderrLength: result.value.stderr.length,
|
|
46
|
+
stdoutLength: result.value.stdout.length
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
},
|
|
50
|
+
executionMode: "sequential"
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function formatShellOutput(input) {
|
|
54
|
+
return [
|
|
55
|
+
`cwd: ${input.cwd}`,
|
|
56
|
+
`command: ${input.command}`,
|
|
57
|
+
`exitCode: ${input.exitCode}`,
|
|
58
|
+
"",
|
|
59
|
+
"stdout:",
|
|
60
|
+
truncateOutput(input.stdout),
|
|
61
|
+
"",
|
|
62
|
+
"stderr:",
|
|
63
|
+
truncateOutput(input.stderr)
|
|
64
|
+
].join("\n");
|
|
65
|
+
}
|
|
66
|
+
function truncateOutput(output) {
|
|
67
|
+
if (output.length <= MAX_OUTPUT_LENGTH) {
|
|
68
|
+
return output;
|
|
69
|
+
}
|
|
70
|
+
return `${output.slice(0, MAX_OUTPUT_LENGTH)}\n[output truncated]`;
|
|
71
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { ServerPlugin } from "@hold-rein/plugin-server";
|
|
2
|
+
import type { AgentSessionMetadata } from "../agent-types";
|
|
3
|
+
export interface SubagentRun<ParentSession> {
|
|
4
|
+
agentId: string;
|
|
5
|
+
agentName: string;
|
|
6
|
+
agentSession: ParentSession;
|
|
7
|
+
consumed: boolean;
|
|
8
|
+
lastAssistantText: string;
|
|
9
|
+
parentAgentId: string;
|
|
10
|
+
parentAgentName?: string;
|
|
11
|
+
parentSession: ParentSession;
|
|
12
|
+
session: AgentSessionMetadata;
|
|
13
|
+
status: "running" | "completed";
|
|
14
|
+
}
|
|
15
|
+
export declare function createCallSubagentTool(input: {
|
|
16
|
+
startSubagent: (input: {
|
|
17
|
+
agentName: string;
|
|
18
|
+
prompt: string;
|
|
19
|
+
toolCallId: string;
|
|
20
|
+
}) => Promise<{
|
|
21
|
+
content: {
|
|
22
|
+
text: string;
|
|
23
|
+
type: "text";
|
|
24
|
+
}[];
|
|
25
|
+
details: unknown;
|
|
26
|
+
}>;
|
|
27
|
+
}): ServerPlugin.PluginTool;
|
|
28
|
+
export declare function createRevokeSubagentTool(input: {
|
|
29
|
+
continueSubagent: (input: {
|
|
30
|
+
agentId: string;
|
|
31
|
+
prompt: string;
|
|
32
|
+
toolCallId: string;
|
|
33
|
+
}) => Promise<{
|
|
34
|
+
content: {
|
|
35
|
+
text: string;
|
|
36
|
+
type: "text";
|
|
37
|
+
}[];
|
|
38
|
+
details: unknown;
|
|
39
|
+
}>;
|
|
40
|
+
}): ServerPlugin.PluginTool;
|
|
41
|
+
export declare function getNextCompletedSubagent<ParentSession>(subagents: Map<string, SubagentRun<ParentSession>>, parentAgentId: string): SubagentRun<ParentSession> | undefined;
|
|
42
|
+
export declare function hasRunningSubagent<ParentSession>(subagents: Map<string, SubagentRun<ParentSession>>, parentAgentId: string): boolean;
|
|
43
|
+
export declare function formatSubagentResult<ParentSession>(subagent: SubagentRun<ParentSession>): string;
|
|
44
|
+
export declare function extractAssistantText(message: unknown): string;
|
|
45
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/modules/agents/subagent/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAE7D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE3D,MAAM,WAAW,WAAW,CAAC,aAAa;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,aAAa,CAAC;IAC5B,QAAQ,EAAE,OAAO,CAAC;IAClB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,aAAa,CAAC;IAC7B,OAAO,EAAE,oBAAoB,CAAC;IAC9B,MAAM,EAAE,SAAS,GAAG,WAAW,CAAC;CACjC;AAkDD,wBAAgB,sBAAsB,CAAC,KAAK,EAAE;IAC5C,aAAa,EAAE,CAAC,KAAK,EAAE;QACrB,SAAS,EAAE,MAAM,CAAC;QAClB,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;KACpB,KAAK,OAAO,CAAC;QACZ,OAAO,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;QAC1C,OAAO,EAAE,OAAO,CAAC;KAClB,CAAC,CAAC;CACJ,GAAG,YAAY,CAAC,UAAU,CAsC1B;AAED,wBAAgB,wBAAwB,CAAC,KAAK,EAAE;IAC9C,gBAAgB,EAAE,CAAC,KAAK,EAAE;QACxB,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;KACpB,KAAK,OAAO,CAAC;QACZ,OAAO,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;QAC1C,OAAO,EAAE,OAAO,CAAC;KAClB,CAAC,CAAC;CACJ,GAAG,YAAY,CAAC,UAAU,CAe1B;AAqDD,wBAAgB,wBAAwB,CAAC,aAAa,EACpD,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,aAAa,CAAC,CAAC,EAClD,aAAa,EAAE,MAAM,GACpB,WAAW,CAAC,aAAa,CAAC,GAAG,SAAS,CAOxC;AAED,wBAAgB,kBAAkB,CAAC,aAAa,EAC9C,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,aAAa,CAAC,CAAC,EAClD,aAAa,EAAE,MAAM,GACpB,OAAO,CAKT;AAED,wBAAgB,oBAAoB,CAAC,aAAa,EAChD,QAAQ,EAAE,WAAW,CAAC,aAAa,CAAC,GACnC,MAAM,CAOR;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAmB7D"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { Type } from "@earendil-works/pi-ai";
|
|
2
|
+
const callSubagentParameters = Type.Object({
|
|
3
|
+
agentName: Type.Optional(Type.String({
|
|
4
|
+
description: "Short display name for the child agent."
|
|
5
|
+
})),
|
|
6
|
+
prompt: Type.Optional(Type.String({
|
|
7
|
+
description: "Task prompt for the child agent."
|
|
8
|
+
})),
|
|
9
|
+
subagents: Type.Optional(Type.Array(Type.Object({
|
|
10
|
+
agentName: Type.Optional(Type.String({
|
|
11
|
+
description: "Short display name for this child agent."
|
|
12
|
+
})),
|
|
13
|
+
prompt: Type.String({
|
|
14
|
+
description: "Task prompt for this child agent."
|
|
15
|
+
})
|
|
16
|
+
}), {
|
|
17
|
+
description: "Child agents to start in parallel."
|
|
18
|
+
}))
|
|
19
|
+
});
|
|
20
|
+
const revokeSubagentParameters = Type.Object({
|
|
21
|
+
agentId: Type.String({
|
|
22
|
+
description: "Existing completed child agent id to continue."
|
|
23
|
+
}),
|
|
24
|
+
prompt: Type.String({
|
|
25
|
+
description: "Follow-up prompt for the child agent."
|
|
26
|
+
})
|
|
27
|
+
});
|
|
28
|
+
export function createCallSubagentTool(input) {
|
|
29
|
+
return {
|
|
30
|
+
description: "Start a child agent to work on a delegated task.",
|
|
31
|
+
executionMode: "parallel",
|
|
32
|
+
label: "Call Subagent",
|
|
33
|
+
name: "call_subagent",
|
|
34
|
+
parameters: callSubagentParameters,
|
|
35
|
+
async execute(toolCallId, rawParams) {
|
|
36
|
+
const requests = parseCallSubagentRequests(rawParams);
|
|
37
|
+
const results = await Promise.all(requests.map(({ agentName, prompt }) => input.startSubagent({ agentName, prompt, toolCallId })));
|
|
38
|
+
if (results.length === 1) {
|
|
39
|
+
const result = results[0];
|
|
40
|
+
if (!result)
|
|
41
|
+
throw new Error("call_subagent failed to start");
|
|
42
|
+
return result;
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
content: [
|
|
46
|
+
{
|
|
47
|
+
text: results
|
|
48
|
+
.flatMap((result) => result.content.map((block) => block.text))
|
|
49
|
+
.join("\n"),
|
|
50
|
+
type: "text"
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
details: {
|
|
54
|
+
subagents: results.map((result) => result.details)
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
export function createRevokeSubagentTool(input) {
|
|
61
|
+
return {
|
|
62
|
+
description: "Continue an existing completed child agent with a follow-up prompt.",
|
|
63
|
+
executionMode: "parallel",
|
|
64
|
+
label: "Revoke Subagent",
|
|
65
|
+
name: "revoke_subagent",
|
|
66
|
+
parameters: revokeSubagentParameters,
|
|
67
|
+
async execute(toolCallId, rawParams) {
|
|
68
|
+
const { agentId, prompt } = parseRevokeSubagentRequest(rawParams);
|
|
69
|
+
return input.continueSubagent({ agentId, prompt, toolCallId });
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function parseCallSubagentRequests(params) {
|
|
74
|
+
const rawSubagents = Array.isArray(params.subagents) ? params.subagents : [];
|
|
75
|
+
const requests = rawSubagents.length
|
|
76
|
+
? rawSubagents.map((subagent) => ({
|
|
77
|
+
agentName: subagent.agentName,
|
|
78
|
+
prompt: subagent.prompt
|
|
79
|
+
}))
|
|
80
|
+
: [{ agentName: params.agentName, prompt: params.prompt }];
|
|
81
|
+
return requests.map((request) => {
|
|
82
|
+
const agentName = typeof request.agentName === "string" && request.agentName.trim()
|
|
83
|
+
? request.agentName.trim()
|
|
84
|
+
: "subagent";
|
|
85
|
+
const prompt = typeof request.prompt === "string" && request.prompt.trim()
|
|
86
|
+
? request.prompt.trim()
|
|
87
|
+
: "";
|
|
88
|
+
if (!prompt) {
|
|
89
|
+
throw new Error("call_subagent requires a prompt");
|
|
90
|
+
}
|
|
91
|
+
return { agentName, prompt };
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
function parseRevokeSubagentRequest(params) {
|
|
95
|
+
const agentId = typeof params.agentId === "string" && params.agentId.trim()
|
|
96
|
+
? params.agentId.trim()
|
|
97
|
+
: "";
|
|
98
|
+
const prompt = typeof params.prompt === "string" && params.prompt.trim()
|
|
99
|
+
? params.prompt.trim()
|
|
100
|
+
: "";
|
|
101
|
+
if (!agentId) {
|
|
102
|
+
throw new Error("revoke_subagent requires an agentId");
|
|
103
|
+
}
|
|
104
|
+
if (!prompt) {
|
|
105
|
+
throw new Error("revoke_subagent requires a prompt");
|
|
106
|
+
}
|
|
107
|
+
return { agentId, prompt };
|
|
108
|
+
}
|
|
109
|
+
export function getNextCompletedSubagent(subagents, parentAgentId) {
|
|
110
|
+
return Array.from(subagents.values()).find((subagent) => subagent.parentAgentId === parentAgentId &&
|
|
111
|
+
subagent.status === "completed" &&
|
|
112
|
+
!subagent.consumed);
|
|
113
|
+
}
|
|
114
|
+
export function hasRunningSubagent(subagents, parentAgentId) {
|
|
115
|
+
return Array.from(subagents.values()).some((subagent) => subagent.parentAgentId === parentAgentId && subagent.status === "running");
|
|
116
|
+
}
|
|
117
|
+
export function formatSubagentResult(subagent) {
|
|
118
|
+
return [
|
|
119
|
+
`Subagent "${subagent.agentName}" completed.`,
|
|
120
|
+
`agentId: ${subagent.agentId}`,
|
|
121
|
+
"",
|
|
122
|
+
subagent.lastAssistantText || "No assistant response was captured."
|
|
123
|
+
].join("\n");
|
|
124
|
+
}
|
|
125
|
+
export function extractAssistantText(message) {
|
|
126
|
+
if (!message || typeof message !== "object")
|
|
127
|
+
return "";
|
|
128
|
+
const record = message;
|
|
129
|
+
if (record.role !== "assistant" || !Array.isArray(record.content)) {
|
|
130
|
+
return "";
|
|
131
|
+
}
|
|
132
|
+
return record.content
|
|
133
|
+
.map((block) => {
|
|
134
|
+
if (!block || typeof block !== "object")
|
|
135
|
+
return "";
|
|
136
|
+
const content = block;
|
|
137
|
+
return content.type === "text" && typeof content.text === "string"
|
|
138
|
+
? content.text
|
|
139
|
+
: "";
|
|
140
|
+
})
|
|
141
|
+
.filter(Boolean)
|
|
142
|
+
.join("\n");
|
|
143
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { AgentRuntime } from "../runtime/type";
|
|
2
|
+
import type { SubagentRepository } from "./repository";
|
|
3
|
+
export declare function interruptRunningSubagents(input: {
|
|
4
|
+
now: string;
|
|
5
|
+
runtime: AgentRuntime;
|
|
6
|
+
subagentRepository: SubagentRepository;
|
|
7
|
+
taskId: string;
|
|
8
|
+
}): Promise<string[]>;
|
|
9
|
+
export declare function deleteSubagentsForTask(input: {
|
|
10
|
+
subagentRepository: SubagentRepository;
|
|
11
|
+
taskId: string;
|
|
12
|
+
}): Promise<void>;
|
|
13
|
+
//# sourceMappingURL=lifecycle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../../../src/modules/agents/subagent/lifecycle.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAEvD,wBAAsB,yBAAyB,CAAC,KAAK,EAAE;IACrD,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,YAAY,CAAC;IACtB,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAiBpB;AAED,wBAAsB,sBAAsB,CAAC,KAAK,EAAE;IAClD,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAAC,IAAI,CAAC,CAYhB"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { unlink } from "node:fs/promises";
|
|
2
|
+
export async function interruptRunningSubagents(input) {
|
|
3
|
+
const runningSubagents = input.subagentRepository
|
|
4
|
+
.findByTaskId(input.taskId)
|
|
5
|
+
.filter((subagent) => subagent.status === "running");
|
|
6
|
+
await Promise.all(runningSubagents.map(async (subagent) => {
|
|
7
|
+
await input.runtime.interrupt(subagent.agentId);
|
|
8
|
+
input.subagentRepository.updateStatus(subagent.agentId, "interrupted", input.now);
|
|
9
|
+
}));
|
|
10
|
+
return runningSubagents.map((subagent) => subagent.agentId);
|
|
11
|
+
}
|
|
12
|
+
export async function deleteSubagentsForTask(input) {
|
|
13
|
+
const subagents = input.subagentRepository.findByTaskId(input.taskId);
|
|
14
|
+
for (const subagent of subagents) {
|
|
15
|
+
if (subagent.sessionPath) {
|
|
16
|
+
await deleteSessionFile(subagent.sessionPath);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
for (const subagent of subagents) {
|
|
20
|
+
input.subagentRepository.delete(subagent.agentId);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
async function deleteSessionFile(sessionPath) {
|
|
24
|
+
try {
|
|
25
|
+
await unlink(sessionPath);
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
if (isMissingFileError(error)) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
throw error;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function isMissingFileError(error) {
|
|
35
|
+
return error instanceof Error && "code" in error && error.code === "ENOENT";
|
|
36
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type AppDatabase, type NewSubagentRow, type SubagentRow } from "../../../db";
|
|
2
|
+
export interface SubagentRepository {
|
|
3
|
+
create: (subagent: NewSubagentRow) => SubagentRow;
|
|
4
|
+
delete: (agentId: string) => void;
|
|
5
|
+
findByAgentId: (agentId: string) => SubagentRow | undefined;
|
|
6
|
+
findByTaskId: (taskId: string) => SubagentRow[];
|
|
7
|
+
interruptRunning: (updatedAt: string) => SubagentRow[];
|
|
8
|
+
updateStatus: (agentId: string, status: SubagentRow["status"], updatedAt: string) => SubagentRow | undefined;
|
|
9
|
+
}
|
|
10
|
+
export declare function createInMemorySubagentRepository(seed?: SubagentRow[]): SubagentRepository;
|
|
11
|
+
export declare function createSqliteSubagentRepository(database: AppDatabase): SubagentRepository;
|
|
12
|
+
//# sourceMappingURL=repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../../../src/modules/agents/subagent/repository.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,WAAW,EACjB,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,WAAW,CAAC;IAClD,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,WAAW,GAAG,SAAS,CAAC;IAC5D,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,WAAW,EAAE,CAAC;IAChD,gBAAgB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,WAAW,EAAE,CAAC;IACvD,YAAY,EAAE,CACZ,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAC,EAC7B,SAAS,EAAE,MAAM,KACd,WAAW,GAAG,SAAS,CAAC;CAC9B;AAED,wBAAgB,gCAAgC,CAC9C,IAAI,GAAE,WAAW,EAAO,GACvB,kBAAkB,CAsCpB;AAED,wBAAgB,8BAA8B,CAC5C,QAAQ,EAAE,WAAW,GACpB,kBAAkB,CAyDpB"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { eq } from "drizzle-orm";
|
|
2
|
+
import { subagents } from "../../../db/index.js";
|
|
3
|
+
export function createInMemorySubagentRepository(seed = []) {
|
|
4
|
+
const rows = new Map(seed.map((row) => [row.agentId, { ...row }]));
|
|
5
|
+
return {
|
|
6
|
+
create: (subagent) => {
|
|
7
|
+
if (rows.has(subagent.agentId)) {
|
|
8
|
+
throw new Error(`Subagent already exists: ${subagent.agentId}`);
|
|
9
|
+
}
|
|
10
|
+
const row = { ...subagent };
|
|
11
|
+
rows.set(row.agentId, row);
|
|
12
|
+
return row;
|
|
13
|
+
},
|
|
14
|
+
delete: (agentId) => {
|
|
15
|
+
rows.delete(agentId);
|
|
16
|
+
},
|
|
17
|
+
findByAgentId: (agentId) => rows.get(agentId),
|
|
18
|
+
findByTaskId: (taskId) => Array.from(rows.values()).filter((row) => row.taskId === taskId),
|
|
19
|
+
interruptRunning: (updatedAt) => Array.from(rows.values())
|
|
20
|
+
.filter((row) => row.status === "running")
|
|
21
|
+
.map((row) => {
|
|
22
|
+
const interruptedRow = {
|
|
23
|
+
...row,
|
|
24
|
+
status: "interrupted",
|
|
25
|
+
updatedAt
|
|
26
|
+
};
|
|
27
|
+
rows.set(row.agentId, interruptedRow);
|
|
28
|
+
return interruptedRow;
|
|
29
|
+
}),
|
|
30
|
+
updateStatus: (agentId, status, updatedAt) => {
|
|
31
|
+
const existing = rows.get(agentId);
|
|
32
|
+
if (!existing)
|
|
33
|
+
return undefined;
|
|
34
|
+
const row = { ...existing, status, updatedAt };
|
|
35
|
+
rows.set(agentId, row);
|
|
36
|
+
return row;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export function createSqliteSubagentRepository(database) {
|
|
41
|
+
return {
|
|
42
|
+
create: (subagent) => {
|
|
43
|
+
database.db.insert(subagents).values(subagent).run();
|
|
44
|
+
return database.db
|
|
45
|
+
.select()
|
|
46
|
+
.from(subagents)
|
|
47
|
+
.where(eq(subagents.agentId, subagent.agentId))
|
|
48
|
+
.get();
|
|
49
|
+
},
|
|
50
|
+
delete: (agentId) => {
|
|
51
|
+
database.db.delete(subagents).where(eq(subagents.agentId, agentId)).run();
|
|
52
|
+
},
|
|
53
|
+
findByAgentId: (agentId) => database.db
|
|
54
|
+
.select()
|
|
55
|
+
.from(subagents)
|
|
56
|
+
.where(eq(subagents.agentId, agentId))
|
|
57
|
+
.get(),
|
|
58
|
+
findByTaskId: (taskId) => database.db
|
|
59
|
+
.select()
|
|
60
|
+
.from(subagents)
|
|
61
|
+
.where(eq(subagents.taskId, taskId))
|
|
62
|
+
.all(),
|
|
63
|
+
interruptRunning: (updatedAt) => {
|
|
64
|
+
const runningSubagents = database.db
|
|
65
|
+
.select()
|
|
66
|
+
.from(subagents)
|
|
67
|
+
.where(eq(subagents.status, "running"))
|
|
68
|
+
.all();
|
|
69
|
+
database.db
|
|
70
|
+
.update(subagents)
|
|
71
|
+
.set({ status: "interrupted", updatedAt })
|
|
72
|
+
.where(eq(subagents.status, "running"))
|
|
73
|
+
.run();
|
|
74
|
+
return runningSubagents.map((row) => ({
|
|
75
|
+
...row,
|
|
76
|
+
status: "interrupted",
|
|
77
|
+
updatedAt
|
|
78
|
+
}));
|
|
79
|
+
},
|
|
80
|
+
updateStatus: (agentId, status, updatedAt) => {
|
|
81
|
+
database.db
|
|
82
|
+
.update(subagents)
|
|
83
|
+
.set({ status, updatedAt })
|
|
84
|
+
.where(eq(subagents.agentId, agentId))
|
|
85
|
+
.run();
|
|
86
|
+
return database.db
|
|
87
|
+
.select()
|
|
88
|
+
.from(subagents)
|
|
89
|
+
.where(eq(subagents.agentId, agentId))
|
|
90
|
+
.get();
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type AppDatabase, type NewSubagentRow, type SubagentRow } from "../../db";
|
|
2
|
+
export interface SubagentRepository {
|
|
3
|
+
create: (subagent: NewSubagentRow) => SubagentRow;
|
|
4
|
+
delete: (agentId: string) => void;
|
|
5
|
+
findByAgentId: (agentId: string) => SubagentRow | undefined;
|
|
6
|
+
findByTaskId: (taskId: string) => SubagentRow[];
|
|
7
|
+
updateStatus: (agentId: string, status: SubagentRow["status"], updatedAt: string) => SubagentRow | undefined;
|
|
8
|
+
}
|
|
9
|
+
export declare function createInMemorySubagentRepository(seed?: SubagentRow[]): SubagentRepository;
|
|
10
|
+
export declare function createSqliteSubagentRepository(database: AppDatabase): SubagentRepository;
|
|
11
|
+
//# sourceMappingURL=subagent-repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subagent-repository.d.ts","sourceRoot":"","sources":["../../../src/modules/agents/subagent-repository.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,WAAW,EACjB,MAAM,UAAU,CAAC;AAElB,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,CAAC,QAAQ,EAAE,cAAc,KAAK,WAAW,CAAC;IAClD,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,aAAa,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,WAAW,GAAG,SAAS,CAAC;IAC5D,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,WAAW,EAAE,CAAC;IAChD,YAAY,EAAE,CACZ,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAC,EAC7B,SAAS,EAAE,MAAM,KACd,WAAW,GAAG,SAAS,CAAC;CAC9B;AAED,wBAAgB,gCAAgC,CAC9C,IAAI,GAAE,WAAW,EAAO,GACvB,kBAAkB,CA0BpB;AAED,wBAAgB,8BAA8B,CAC5C,QAAQ,EAAE,WAAW,GACpB,kBAAkB,CAsCpB"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { eq } from "drizzle-orm";
|
|
2
|
+
import { subagents } from "../../db/index.js";
|
|
3
|
+
export function createInMemorySubagentRepository(seed = []) {
|
|
4
|
+
const rows = new Map(seed.map((row) => [row.agentId, { ...row }]));
|
|
5
|
+
return {
|
|
6
|
+
create: (subagent) => {
|
|
7
|
+
if (rows.has(subagent.agentId)) {
|
|
8
|
+
throw new Error(`Subagent already exists: ${subagent.agentId}`);
|
|
9
|
+
}
|
|
10
|
+
const row = { ...subagent };
|
|
11
|
+
rows.set(row.agentId, row);
|
|
12
|
+
return row;
|
|
13
|
+
},
|
|
14
|
+
delete: (agentId) => {
|
|
15
|
+
rows.delete(agentId);
|
|
16
|
+
},
|
|
17
|
+
findByAgentId: (agentId) => rows.get(agentId),
|
|
18
|
+
findByTaskId: (taskId) => Array.from(rows.values()).filter((row) => row.taskId === taskId),
|
|
19
|
+
updateStatus: (agentId, status, updatedAt) => {
|
|
20
|
+
const existing = rows.get(agentId);
|
|
21
|
+
if (!existing)
|
|
22
|
+
return undefined;
|
|
23
|
+
const row = { ...existing, status, updatedAt };
|
|
24
|
+
rows.set(agentId, row);
|
|
25
|
+
return row;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export function createSqliteSubagentRepository(database) {
|
|
30
|
+
return {
|
|
31
|
+
create: (subagent) => {
|
|
32
|
+
database.db.insert(subagents).values(subagent).run();
|
|
33
|
+
return database.db
|
|
34
|
+
.select()
|
|
35
|
+
.from(subagents)
|
|
36
|
+
.where(eq(subagents.agentId, subagent.agentId))
|
|
37
|
+
.get();
|
|
38
|
+
},
|
|
39
|
+
delete: (agentId) => {
|
|
40
|
+
database.db.delete(subagents).where(eq(subagents.agentId, agentId)).run();
|
|
41
|
+
},
|
|
42
|
+
findByAgentId: (agentId) => database.db
|
|
43
|
+
.select()
|
|
44
|
+
.from(subagents)
|
|
45
|
+
.where(eq(subagents.agentId, agentId))
|
|
46
|
+
.get(),
|
|
47
|
+
findByTaskId: (taskId) => database.db
|
|
48
|
+
.select()
|
|
49
|
+
.from(subagents)
|
|
50
|
+
.where(eq(subagents.taskId, taskId))
|
|
51
|
+
.all(),
|
|
52
|
+
updateStatus: (agentId, status, updatedAt) => {
|
|
53
|
+
database.db
|
|
54
|
+
.update(subagents)
|
|
55
|
+
.set({ status, updatedAt })
|
|
56
|
+
.where(eq(subagents.agentId, agentId))
|
|
57
|
+
.run();
|
|
58
|
+
return database.db
|
|
59
|
+
.select()
|
|
60
|
+
.from(subagents)
|
|
61
|
+
.where(eq(subagents.agentId, agentId))
|
|
62
|
+
.get();
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TaskTitleResult } from "../agent-types";
|
|
2
|
+
import type { SubagentRepository } from "../subagent/repository";
|
|
3
|
+
import type { WorkspaceRepository } from "../../workspaces/workspace-repository";
|
|
4
|
+
export interface DeleteTaskResult {
|
|
5
|
+
status: "deleted" | "not_found" | "running";
|
|
6
|
+
taskId: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function deleteTask(repository: WorkspaceRepository, taskId: string, subagentRepository?: SubagentRepository): Promise<DeleteTaskResult>;
|
|
9
|
+
export declare function renameTask(repository: WorkspaceRepository, taskId: string, title: string, updatedAt: string): TaskTitleResult | null;
|
|
10
|
+
//# sourceMappingURL=actions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../../src/modules/agents/task/actions.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAEjF,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,SAAS,CAAC;IAC5C,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wBAAsB,UAAU,CAC9B,UAAU,EAAE,mBAAmB,EAC/B,MAAM,EAAE,MAAM,EACd,kBAAkB,CAAC,EAAE,kBAAkB,GACtC,OAAO,CAAC,gBAAgB,CAAC,CAoB3B;AAED,wBAAgB,UAAU,CACxB,UAAU,EAAE,mBAAmB,EAC/B,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,GAChB,eAAe,GAAG,IAAI,CAIxB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { unlink } from "node:fs/promises";
|
|
2
|
+
import { deleteSubagentsForTask } from "../subagent/lifecycle.js";
|
|
3
|
+
export async function deleteTask(repository, taskId, subagentRepository) {
|
|
4
|
+
const task = repository.findTaskById(taskId);
|
|
5
|
+
if (!task) {
|
|
6
|
+
return { status: "not_found", taskId };
|
|
7
|
+
}
|
|
8
|
+
if (task.status === "running") {
|
|
9
|
+
return { status: "running", taskId };
|
|
10
|
+
}
|
|
11
|
+
if (task.sessionPath) {
|
|
12
|
+
await deleteSessionFile(task.sessionPath);
|
|
13
|
+
}
|
|
14
|
+
if (subagentRepository) {
|
|
15
|
+
await deleteSubagentsForTask({ subagentRepository, taskId });
|
|
16
|
+
}
|
|
17
|
+
repository.deleteTaskById(taskId);
|
|
18
|
+
return { status: "deleted", taskId };
|
|
19
|
+
}
|
|
20
|
+
export function renameTask(repository, taskId, title, updatedAt) {
|
|
21
|
+
const task = repository.updateTaskTitle(taskId, title, updatedAt);
|
|
22
|
+
return task ? { id: task.id, title: task.title } : null;
|
|
23
|
+
}
|
|
24
|
+
async function deleteSessionFile(sessionPath) {
|
|
25
|
+
try {
|
|
26
|
+
await unlink(sessionPath);
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
if (isMissingFileError(error)) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
throw error;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function isMissingFileError(error) {
|
|
36
|
+
return error instanceof Error && "code" in error && error.code === "ENOENT";
|
|
37
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface ActiveTaskRunRegistry {
|
|
2
|
+
getAgentId: (taskId: string) => string | undefined;
|
|
3
|
+
hasTask: (taskId: string) => boolean;
|
|
4
|
+
markStarting: (taskId: string) => void;
|
|
5
|
+
register: (taskId: string, agentId: string) => void;
|
|
6
|
+
remove: (taskId: string) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function createActiveTaskRunRegistry(): ActiveTaskRunRegistry;
|
|
9
|
+
export declare function getDefaultActiveTaskRunRegistry(): ActiveTaskRunRegistry;
|
|
10
|
+
//# sourceMappingURL=active-run-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"active-run-registry.d.ts","sourceRoot":"","sources":["../../../../src/modules/agents/task/active-run-registry.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IACnD,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC;IACrC,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACpD,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC;AAED,wBAAgB,2BAA2B,IAAI,qBAAqB,CAgBnE;AAID,wBAAgB,+BAA+B,IAAI,qBAAqB,CAEvE"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export function createActiveTaskRunRegistry() {
|
|
2
|
+
const agentIdsByTaskId = new Map();
|
|
3
|
+
return {
|
|
4
|
+
getAgentId: (taskId) => agentIdsByTaskId.get(taskId),
|
|
5
|
+
hasTask: (taskId) => agentIdsByTaskId.has(taskId),
|
|
6
|
+
markStarting: (taskId) => {
|
|
7
|
+
agentIdsByTaskId.set(taskId, undefined);
|
|
8
|
+
},
|
|
9
|
+
register: (taskId, agentId) => {
|
|
10
|
+
agentIdsByTaskId.set(taskId, agentId);
|
|
11
|
+
},
|
|
12
|
+
remove: (taskId) => {
|
|
13
|
+
agentIdsByTaskId.delete(taskId);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
const defaultActiveTaskRunRegistry = createActiveTaskRunRegistry();
|
|
18
|
+
export function getDefaultActiveTaskRunRegistry() {
|
|
19
|
+
return defaultActiveTaskRunRegistry;
|
|
20
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { WorkspaceRepository } from "../../workspaces/workspace-repository";
|
|
2
|
+
import type { ActiveTaskRunRegistry } from "./active-run-registry";
|
|
3
|
+
import type { AgentEventBus } from "../event/event-bus";
|
|
4
|
+
import type { AgentRuntime } from "../runtime/type";
|
|
5
|
+
export declare function startTaskRun(input: {
|
|
6
|
+
activeTaskRuns?: ActiveTaskRunRegistry;
|
|
7
|
+
eventBus: AgentEventBus;
|
|
8
|
+
now: () => Date;
|
|
9
|
+
repository: WorkspaceRepository;
|
|
10
|
+
runtime: AgentRuntime;
|
|
11
|
+
runtimeInput: Parameters<AgentRuntime["start"]>[0];
|
|
12
|
+
taskId: string;
|
|
13
|
+
}): Promise<import("../agent-types").AgentRunResult>;
|
|
14
|
+
//# sourceMappingURL=run-monitor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-monitor.d.ts","sourceRoot":"","sources":["../../../../src/modules/agents/task/run-monitor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AACjF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAGpD,wBAAsB,YAAY,CAAC,KAAK,EAAE;IACxC,cAAc,CAAC,EAAE,qBAAqB,CAAC;IACvC,QAAQ,EAAE,aAAa,CAAC;IACxB,GAAG,EAAE,MAAM,IAAI,CAAC;IAChB,UAAU,EAAE,mBAAmB,CAAC;IAChC,OAAO,EAAE,YAAY,CAAC;IACtB,YAAY,EAAE,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACnD,MAAM,EAAE,MAAM,CAAC;CAChB,oDA0BA"}
|