@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,69 @@
|
|
|
1
|
+
export function createBrowserToolCallStore(timeoutMs = 60_000) {
|
|
2
|
+
const pending = new Map();
|
|
3
|
+
return {
|
|
4
|
+
clearAgent(agentId) {
|
|
5
|
+
for (const [key, call] of pending) {
|
|
6
|
+
if (call.agentId !== agentId)
|
|
7
|
+
continue;
|
|
8
|
+
clearTimeout(call.timeout);
|
|
9
|
+
pending.delete(key);
|
|
10
|
+
call.resolve({
|
|
11
|
+
content: [
|
|
12
|
+
{ text: "Browser tool call was interrupted.", type: "text" }
|
|
13
|
+
],
|
|
14
|
+
details: { toolName: call.toolName },
|
|
15
|
+
isError: true
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
createCall(request) {
|
|
20
|
+
const key = createKey(request.agentId, request.toolCallId);
|
|
21
|
+
if (pending.has(key)) {
|
|
22
|
+
return Promise.resolve({
|
|
23
|
+
content: [
|
|
24
|
+
{ text: "Duplicate browser tool call id.", type: "text" }
|
|
25
|
+
],
|
|
26
|
+
details: { toolName: request.toolName },
|
|
27
|
+
isError: true
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
return new Promise((resolve) => {
|
|
31
|
+
const timeout = setTimeout(() => {
|
|
32
|
+
pending.delete(key);
|
|
33
|
+
resolve({
|
|
34
|
+
content: [
|
|
35
|
+
{ text: "Browser tool call timed out.", type: "text" }
|
|
36
|
+
],
|
|
37
|
+
details: { toolName: request.toolName },
|
|
38
|
+
isError: true
|
|
39
|
+
});
|
|
40
|
+
}, timeoutMs);
|
|
41
|
+
pending.set(key, {
|
|
42
|
+
agentId: request.agentId,
|
|
43
|
+
resolve,
|
|
44
|
+
timeout,
|
|
45
|
+
toolName: request.toolName
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
},
|
|
49
|
+
submitResult(input) {
|
|
50
|
+
const key = createKey(input.agentId, input.toolCallId);
|
|
51
|
+
const call = pending.get(key);
|
|
52
|
+
if (!call)
|
|
53
|
+
return false;
|
|
54
|
+
clearTimeout(call.timeout);
|
|
55
|
+
pending.delete(key);
|
|
56
|
+
call.resolve({
|
|
57
|
+
content: typeof input.content === "string"
|
|
58
|
+
? [{ text: input.content, type: "text" }]
|
|
59
|
+
: input.content,
|
|
60
|
+
details: { toolName: call.toolName },
|
|
61
|
+
isError: input.isError ?? false
|
|
62
|
+
});
|
|
63
|
+
return true;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function createKey(agentId, toolCallId) {
|
|
68
|
+
return `${agentId}\0${toolCallId}`;
|
|
69
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { AgentEventBus } from "../event/event-bus";
|
|
2
|
+
import type { HarnessSession, StartHarnessOptions, StartHarnessResult } from "./type";
|
|
3
|
+
import type { SubagentRun } from "../subagent";
|
|
4
|
+
import type { SubagentRepository } from "../subagent/repository";
|
|
5
|
+
type StartHarness = (promptText: string, harnessOptions: StartHarnessOptions) => Promise<StartHarnessResult>;
|
|
6
|
+
interface SessionRepo {
|
|
7
|
+
create: (input: {
|
|
8
|
+
cwd: string;
|
|
9
|
+
}) => Promise<HarnessSession>;
|
|
10
|
+
}
|
|
11
|
+
export declare function startContinuationSubagent(input: {
|
|
12
|
+
agentName?: string;
|
|
13
|
+
eventBus: AgentEventBus;
|
|
14
|
+
parentAgentId: string;
|
|
15
|
+
parentAgentName: string | undefined;
|
|
16
|
+
parentSession: HarnessSession;
|
|
17
|
+
prompt: string;
|
|
18
|
+
sessionRepo: SessionRepo;
|
|
19
|
+
startHarness: StartHarness;
|
|
20
|
+
subagentRepository: SubagentRepository;
|
|
21
|
+
subagents: Map<string, SubagentRun<HarnessSession>>;
|
|
22
|
+
taskId: string;
|
|
23
|
+
workspacePath: string;
|
|
24
|
+
}): Promise<void>;
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=continuation-subagent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"continuation-subagent.d.ts","sourceRoot":"","sources":["../../../../src/modules/agents/runtime/continuation-subagent.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGxD,OAAO,KAAK,EACV,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EACnB,MAAM,QAAQ,CAAC;AAChB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAKjE,KAAK,YAAY,GAAG,CAClB,UAAU,EAAE,MAAM,EAClB,cAAc,EAAE,mBAAmB,KAChC,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAEjC,UAAU,WAAW;IACnB,MAAM,EAAE,CAAC,KAAK,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;CAC7D;AAED,wBAAsB,yBAAyB,CAAC,KAAK,EAAE;IACrD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,aAAa,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,aAAa,EAAE,cAAc,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,WAAW,CAAC;IACzB,YAAY,EAAE,YAAY,CAAC;IAC3B,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,cAAc,CAAC,CAAC,CAAC;IACpD,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;CACvB,GAAG,OAAO,CAAC,IAAI,CAAC,CAgEhB"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { appendVisibleCustomMessage } from "./messages.js";
|
|
3
|
+
import { toAgentSessionMetadata } from "./support.js";
|
|
4
|
+
const CALL_SUBAGENT_CUSTOM_TYPE = "callsubagent";
|
|
5
|
+
const DEFAULT_SUBAGENT_NAME = "subagent";
|
|
6
|
+
export async function startContinuationSubagent(input) {
|
|
7
|
+
const agentName = input.agentName ?? DEFAULT_SUBAGENT_NAME;
|
|
8
|
+
const agentId = `agent_${randomUUID()}`;
|
|
9
|
+
const createdAt = new Date().toISOString();
|
|
10
|
+
const childSession = await input.sessionRepo.create({ cwd: input.workspacePath });
|
|
11
|
+
const childSessionMetadata = toAgentSessionMetadata(await childSession.getMetadata());
|
|
12
|
+
input.subagentRepository.create({
|
|
13
|
+
agentId,
|
|
14
|
+
agentName,
|
|
15
|
+
createdAt,
|
|
16
|
+
parentAgentId: input.parentAgentId,
|
|
17
|
+
sessionCreatedAt: childSessionMetadata.createdAt,
|
|
18
|
+
sessionId: childSessionMetadata.id,
|
|
19
|
+
sessionPath: childSessionMetadata.path,
|
|
20
|
+
status: "running",
|
|
21
|
+
taskId: input.taskId,
|
|
22
|
+
updatedAt: createdAt
|
|
23
|
+
});
|
|
24
|
+
let started;
|
|
25
|
+
try {
|
|
26
|
+
started = await input.startHarness(input.prompt, {
|
|
27
|
+
agentId,
|
|
28
|
+
agentName,
|
|
29
|
+
isContinue: false,
|
|
30
|
+
parentAgentId: input.parentAgentId,
|
|
31
|
+
pluginPrompt: input.prompt,
|
|
32
|
+
session: childSession
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
input.subagentRepository.delete(agentId);
|
|
37
|
+
throw error;
|
|
38
|
+
}
|
|
39
|
+
input.subagents.set(started.agentId, {
|
|
40
|
+
agentId: started.agentId,
|
|
41
|
+
agentName,
|
|
42
|
+
agentSession: started.harnessSession,
|
|
43
|
+
consumed: false,
|
|
44
|
+
lastAssistantText: "",
|
|
45
|
+
parentAgentId: input.parentAgentId,
|
|
46
|
+
...(input.parentAgentName === undefined
|
|
47
|
+
? {}
|
|
48
|
+
: { parentAgentName: input.parentAgentName }),
|
|
49
|
+
parentSession: input.parentSession,
|
|
50
|
+
session: started.session,
|
|
51
|
+
status: "running"
|
|
52
|
+
});
|
|
53
|
+
await appendVisibleCustomMessage({
|
|
54
|
+
agentId: input.parentAgentId,
|
|
55
|
+
content: `Subagent "${agentName}" is running.`,
|
|
56
|
+
customType: CALL_SUBAGENT_CUSTOM_TYPE,
|
|
57
|
+
details: {
|
|
58
|
+
agentId: started.agentId,
|
|
59
|
+
agentName,
|
|
60
|
+
parentAgentId: input.parentAgentId,
|
|
61
|
+
session: started.session,
|
|
62
|
+
taskId: input.taskId
|
|
63
|
+
},
|
|
64
|
+
eventBus: input.eventBus,
|
|
65
|
+
session: input.parentSession
|
|
66
|
+
});
|
|
67
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/modules/agents/runtime/index.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,YAAY,EAAE,yBAAyB,EAA4H,MAAM,QAAQ,CAAA;AAI/L,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,yBAAyB,GACjC,YAAY,CAodd"}
|
|
@@ -0,0 +1,432 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { AgentHarness, NodeExecutionEnv, formatSkillsForSystemPrompt, loadSkills } from "@earendil-works/pi-agent-core/node";
|
|
3
|
+
import { toStoredAgentMessage } from "../message/storage.js";
|
|
4
|
+
import { resolveAgentModel } from "../model/resolver.js";
|
|
5
|
+
import { appendVisibleCustomMessage } from "./messages.js";
|
|
6
|
+
import { addPendingSubagentResult, appendSubagentResult, flushPendingSubagentResults } from "./subagent-results.js";
|
|
7
|
+
import { createRuntimeRevokeSubagentTool, createRuntimeSubagentTools } from "./subagent-tools.js";
|
|
8
|
+
import { startContinuationSubagent } from "./continuation-subagent.js";
|
|
9
|
+
import { createSessionRepo, getEnvApiKey, getRuntimeSkillDirs, interruptHarness, toAgentSessionMetadata } from "./support.js";
|
|
10
|
+
import { createRuntimeTokenCollectionOptions, createTokenCollection } from "./token-collection.js";
|
|
11
|
+
import { runToolBeforeExecute } from "../approval/tool-approval.js";
|
|
12
|
+
import { extractAssistantText, getNextCompletedSubagent, hasRunningSubagent } from "../subagent/index.js";
|
|
13
|
+
import { pluginRegistry } from '../../../plugin.js';
|
|
14
|
+
import { formatWorkspaceAgentInstructionsForSystemPrompt, readWorkspaceAgentInstructions } from "./workspace-agent-instructions.js";
|
|
15
|
+
import { createModelProxyRuntimeController } from "../../model-proxies/model-proxy-runtime.js";
|
|
16
|
+
import { createBrowserToolCallStore } from "./browser-tool-call-store.js";
|
|
17
|
+
import { createBrowserRuntimeTools } from "./browser-runtime-tools.js";
|
|
18
|
+
import { toRuntimeSkills } from "./browser-runtime-contributions.js";
|
|
19
|
+
const AGENT_CONTINUATION_CUSTOM_TYPE = "agent_continuation";
|
|
20
|
+
const AGENT_CONTINUE_PROMPT = "";
|
|
21
|
+
export function createAgentRuntime(options) {
|
|
22
|
+
const runningAgents = new Map();
|
|
23
|
+
const sessionRepo = options.sessionRepo ?? createSessionRepo();
|
|
24
|
+
const subagentRepository = options.subagentRepository;
|
|
25
|
+
const subagents = new Map();
|
|
26
|
+
const harnessSessions = new Map();
|
|
27
|
+
const harnessTools = new Map();
|
|
28
|
+
const interruptedHarnesses = new WeakSet();
|
|
29
|
+
const tokenCollections = new Map();
|
|
30
|
+
const browserToolCalls = createBrowserToolCallStore(options.browserToolTimeoutMs);
|
|
31
|
+
return {
|
|
32
|
+
interrupt: async (agentId) => {
|
|
33
|
+
const runningAgent = runningAgents.get(agentId);
|
|
34
|
+
if (!runningAgent) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
interruptedHarnesses.add(runningAgent.harness);
|
|
38
|
+
browserToolCalls.clearAgent(agentId);
|
|
39
|
+
runningAgents.delete(agentId);
|
|
40
|
+
await interruptHarness(runningAgent.harness);
|
|
41
|
+
return true;
|
|
42
|
+
},
|
|
43
|
+
listMessages: async ({ session: metadata, workspacePath }) => {
|
|
44
|
+
const session = await sessionRepo.open({ ...metadata, cwd: workspacePath });
|
|
45
|
+
const context = await session.buildContext();
|
|
46
|
+
return context.messages.map((message) => toStoredAgentMessage(`message_${randomUUID()}`, message));
|
|
47
|
+
},
|
|
48
|
+
submitBrowserToolResult: async (input) => browserToolCalls.submitResult(input),
|
|
49
|
+
start: async (input) => {
|
|
50
|
+
const env = new NodeExecutionEnv({ cwd: input.workspacePath });
|
|
51
|
+
const proxyCandidate = input.provider === "local"
|
|
52
|
+
? options.modelProxiesService?.selectCandidate(input.modelId)
|
|
53
|
+
: undefined;
|
|
54
|
+
if (input.provider === "local" && !proxyCandidate) {
|
|
55
|
+
throw new Error(options.modelProxiesService ? "No available model for proxy" : "Unknown proxy model");
|
|
56
|
+
}
|
|
57
|
+
const initialProvider = proxyCandidate?.provider ?? input.provider;
|
|
58
|
+
const initialModelId = proxyCandidate?.modelId ?? input.modelId;
|
|
59
|
+
let model = await resolveAgentModel(initialProvider, initialModelId, options.getCustomModel);
|
|
60
|
+
if (!model) {
|
|
61
|
+
throw new Error("Unknown model");
|
|
62
|
+
}
|
|
63
|
+
const workspaceAgentInstructions = await readWorkspaceAgentInstructions(input.workspacePath);
|
|
64
|
+
const pendingSubagentResults = new Map();
|
|
65
|
+
const createHarness = async (harnessOptions) => {
|
|
66
|
+
let activeMessageId;
|
|
67
|
+
let activeModel = model;
|
|
68
|
+
let proxyController;
|
|
69
|
+
const pendingVisibleMessages = new Map();
|
|
70
|
+
const pluginContext = {
|
|
71
|
+
agentName: harnessOptions.agentName ?? "main",
|
|
72
|
+
env,
|
|
73
|
+
isContinue: harnessOptions.isContinue,
|
|
74
|
+
session: harnessOptions.session,
|
|
75
|
+
prompt: harnessOptions.pluginPrompt,
|
|
76
|
+
taskId: input.taskId,
|
|
77
|
+
thinkingLevel: input.thinkingLevel,
|
|
78
|
+
model: activeModel
|
|
79
|
+
};
|
|
80
|
+
const contribution = await pluginRegistry.resolveContributions(pluginContext);
|
|
81
|
+
const skillDirs = await getRuntimeSkillDirs(input.workspacePath, [...(options.skillDirs || []), ...(contribution.skillDirs || [])], options.skillsService);
|
|
82
|
+
const { skills: loadedSkills } = await loadSkills(env, skillDirs);
|
|
83
|
+
const skills = [
|
|
84
|
+
...loadedSkills,
|
|
85
|
+
...(contribution.skills || []),
|
|
86
|
+
...toRuntimeSkills(input.runtimeContributions?.skills)
|
|
87
|
+
];
|
|
88
|
+
const browserTools = createBrowserRuntimeTools({
|
|
89
|
+
agentId: harnessOptions.agentId, eventBus: options.eventBus,
|
|
90
|
+
store: browserToolCalls, tools: input.runtimeContributions?.tools
|
|
91
|
+
});
|
|
92
|
+
const tools = await createRuntimeSubagentTools({
|
|
93
|
+
contributionTools: [...(contribution.tools || []), ...browserTools],
|
|
94
|
+
eventBus: options.eventBus,
|
|
95
|
+
parentAgentId: harnessOptions.agentId,
|
|
96
|
+
...(harnessOptions.agentName === undefined
|
|
97
|
+
? {}
|
|
98
|
+
: { parentAgentName: harnessOptions.agentName }),
|
|
99
|
+
parentSession: harnessOptions.session,
|
|
100
|
+
pendingVisibleMessages,
|
|
101
|
+
sessionRepo,
|
|
102
|
+
startHarness,
|
|
103
|
+
persistedSubagentRepository: subagentRepository,
|
|
104
|
+
...(options.subagentDatabase === undefined ? {} : { subagentDatabase: options.subagentDatabase }),
|
|
105
|
+
subagents,
|
|
106
|
+
taskId: input.taskId,
|
|
107
|
+
workspacePath: input.workspacePath
|
|
108
|
+
});
|
|
109
|
+
harnessSessions.set(harnessOptions.agentId, harnessOptions.session);
|
|
110
|
+
harnessTools.set(harnessOptions.agentId, tools);
|
|
111
|
+
const harness = new AgentHarness({
|
|
112
|
+
activeToolNames: tools.map(tool => tool.name),
|
|
113
|
+
env,
|
|
114
|
+
getApiKeyAndHeaders: async (requestedModel) => {
|
|
115
|
+
const apiModel = requestedModel ?? proxyController?.getActiveModel() ?? activeModel;
|
|
116
|
+
const apiKey = (await options.getApiKey?.(apiModel.provider, apiModel.id)) ??
|
|
117
|
+
getEnvApiKey(apiModel.provider);
|
|
118
|
+
return apiKey ? { apiKey } : undefined;
|
|
119
|
+
},
|
|
120
|
+
model: contribution.model || activeModel,
|
|
121
|
+
resources: { skills },
|
|
122
|
+
session: harnessOptions.session,
|
|
123
|
+
systemPrompt: ({ resources }) => [
|
|
124
|
+
...(contribution.systemPrompts || []),
|
|
125
|
+
...(input.runtimeContributions?.systemPrompts || []),
|
|
126
|
+
`Workspace: ${input.workspacePath}`,
|
|
127
|
+
formatWorkspaceAgentInstructionsForSystemPrompt(workspaceAgentInstructions),
|
|
128
|
+
`Current time: ${new Date().toISOString()}`,
|
|
129
|
+
"Use shell_exec for workspace commands and skill scripts.",
|
|
130
|
+
"Resolve skill-relative references from each skill file directory.",
|
|
131
|
+
formatSkillsForSystemPrompt(resources.skills ?? [])
|
|
132
|
+
]
|
|
133
|
+
.filter(Boolean)
|
|
134
|
+
.join("\n\n"),
|
|
135
|
+
thinkingLevel: input.thinkingLevel,
|
|
136
|
+
tools
|
|
137
|
+
});
|
|
138
|
+
if (proxyCandidate && options.modelProxiesService) {
|
|
139
|
+
proxyController = createModelProxyRuntimeController({
|
|
140
|
+
activeCandidate: proxyCandidate,
|
|
141
|
+
activeModel,
|
|
142
|
+
proxyModelId: input.modelId,
|
|
143
|
+
resolveModel: (provider, modelId) => resolveAgentModel(provider, modelId, options.getCustomModel),
|
|
144
|
+
service: options.modelProxiesService,
|
|
145
|
+
setModel: async (nextModel) => {
|
|
146
|
+
model = nextModel;
|
|
147
|
+
activeModel = nextModel;
|
|
148
|
+
await harness.setModel(nextModel);
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
const tokenCollection = tokenCollections.get(input.taskId) ??
|
|
153
|
+
createTokenCollection(input.taskId, createRuntimeTokenCollectionOptions({
|
|
154
|
+
tokenFlushIntervalMs: options.tokenFlushIntervalMs,
|
|
155
|
+
tokenUsageStorageTarget: options.tokenUsageStorageTarget
|
|
156
|
+
}));
|
|
157
|
+
tokenCollections.set(input.taskId, tokenCollection);
|
|
158
|
+
tokenCollection.appendHarness(harness);
|
|
159
|
+
harness.subscribe(async (event) => {
|
|
160
|
+
try {
|
|
161
|
+
contribution.subscribe?.(event);
|
|
162
|
+
}
|
|
163
|
+
catch {
|
|
164
|
+
// Keep plugin subscriber failures from breaking agent event delivery.
|
|
165
|
+
}
|
|
166
|
+
if (event.type === "message_start") {
|
|
167
|
+
activeMessageId = `message_${randomUUID()}`;
|
|
168
|
+
options.eventBus.emit({
|
|
169
|
+
agentId: harnessOptions.agentId,
|
|
170
|
+
payload: { message: toStoredAgentMessage(activeMessageId, event.message) },
|
|
171
|
+
type: "message_start"
|
|
172
|
+
});
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
if (event.type === "message_update" && activeMessageId) {
|
|
176
|
+
options.eventBus.emit({
|
|
177
|
+
agentId: harnessOptions.agentId,
|
|
178
|
+
payload: {
|
|
179
|
+
delta: event.assistantMessageEvent,
|
|
180
|
+
messageId: activeMessageId
|
|
181
|
+
},
|
|
182
|
+
type: "message_delta"
|
|
183
|
+
});
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
if (event.type === "message_end") {
|
|
187
|
+
const messageId = activeMessageId ?? `message_${randomUUID()}`;
|
|
188
|
+
const message = toStoredAgentMessage(messageId, event.message);
|
|
189
|
+
const subagent = subagents.get(harnessOptions.agentId);
|
|
190
|
+
if (subagent) {
|
|
191
|
+
subagent.lastAssistantText = extractAssistantText(event.message);
|
|
192
|
+
}
|
|
193
|
+
options.eventBus.emit({
|
|
194
|
+
agentId: harnessOptions.agentId,
|
|
195
|
+
payload: { message },
|
|
196
|
+
type: "message_end"
|
|
197
|
+
});
|
|
198
|
+
activeMessageId = undefined;
|
|
199
|
+
if (proxyController && event.message.role === "assistant") {
|
|
200
|
+
try {
|
|
201
|
+
await proxyController.recordAssistantUsage({
|
|
202
|
+
inputToken: event.message.usage?.input ?? 0,
|
|
203
|
+
modelId: event.message.model,
|
|
204
|
+
outputToken: event.message.usage?.output ?? 0,
|
|
205
|
+
provider: event.message.provider
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
catch (error) {
|
|
209
|
+
options.eventBus.emit({
|
|
210
|
+
agentId: harnessOptions.agentId,
|
|
211
|
+
payload: {
|
|
212
|
+
message: error instanceof Error ? error.message : "Proxy fallback unavailable"
|
|
213
|
+
},
|
|
214
|
+
type: "agent_error"
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
if (event.message.role === "toolResult") {
|
|
219
|
+
const pendingMessages = pendingVisibleMessages.get(event.message.toolCallId);
|
|
220
|
+
if (pendingMessages) {
|
|
221
|
+
for (const pendingMessage of pendingMessages) {
|
|
222
|
+
await appendVisibleCustomMessage({
|
|
223
|
+
agentId: harnessOptions.agentId,
|
|
224
|
+
...pendingMessage,
|
|
225
|
+
eventBus: options.eventBus,
|
|
226
|
+
session: harnessOptions.session
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
pendingVisibleMessages.delete(event.message.toolCallId);
|
|
230
|
+
}
|
|
231
|
+
await flushPendingSubagentResults({
|
|
232
|
+
agentId: harnessOptions.agentId,
|
|
233
|
+
eventBus: options.eventBus,
|
|
234
|
+
pendingSubagentResults,
|
|
235
|
+
session: harnessOptions.session,
|
|
236
|
+
subagents
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
if (event.type === "agent_end") {
|
|
242
|
+
options.eventBus.emit({ agentId: harnessOptions.agentId, type: "agent_end" });
|
|
243
|
+
if (interruptedHarnesses.has(harness)) {
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
if (harnessOptions.parentAgentId) {
|
|
247
|
+
await finishSubagent(harnessOptions.agentId, contribution);
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
const continued = await continueOrEndTask(harnessOptions.agentId, harnessOptions.agentName, harnessOptions.session, contribution);
|
|
251
|
+
if (!continued) {
|
|
252
|
+
options.eventBus.emit({
|
|
253
|
+
agentId: harnessOptions.agentId,
|
|
254
|
+
type: "task_end"
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
harness.on("tool_call", async (event) => {
|
|
260
|
+
const tool = tools.find(tool => tool.name === event.toolName);
|
|
261
|
+
if (!tool)
|
|
262
|
+
return undefined;
|
|
263
|
+
return runToolBeforeExecute({
|
|
264
|
+
agentId: harnessOptions.agentId,
|
|
265
|
+
approvalStore: options.approvalStore,
|
|
266
|
+
event,
|
|
267
|
+
eventBus: options.eventBus,
|
|
268
|
+
approvalPolicy: input.approvalPolicy,
|
|
269
|
+
tool,
|
|
270
|
+
workspacePath: input.workspacePath
|
|
271
|
+
});
|
|
272
|
+
});
|
|
273
|
+
return harness;
|
|
274
|
+
};
|
|
275
|
+
const finishSubagent = async (agentId, contribution) => {
|
|
276
|
+
const subagent = subagents.get(agentId);
|
|
277
|
+
if (!subagent)
|
|
278
|
+
return;
|
|
279
|
+
const continued = await continueOrEndTask(subagent.agentId, subagent.agentName, subagent.agentSession, contribution);
|
|
280
|
+
if (continued)
|
|
281
|
+
return;
|
|
282
|
+
subagent.status = "completed";
|
|
283
|
+
subagentRepository.updateStatus(subagent.agentId, "completed", new Date().toISOString());
|
|
284
|
+
await addRevokeToolToHarness(subagent.parentAgentId);
|
|
285
|
+
await continueOrEndTask(subagent.parentAgentId, subagent.parentAgentName, subagent.parentSession, undefined, { deferIfRunning: true });
|
|
286
|
+
};
|
|
287
|
+
const addRevokeToolToHarness = async (agentId) => {
|
|
288
|
+
const tools = harnessTools.get(agentId);
|
|
289
|
+
const parentSession = harnessSessions.get(agentId);
|
|
290
|
+
if (!tools || !parentSession || tools.some((tool) => tool.name === "revoke_subagent")) {
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
const tool = createRuntimeRevokeSubagentTool({
|
|
294
|
+
eventBus: options.eventBus,
|
|
295
|
+
parentAgentId: agentId,
|
|
296
|
+
parentSession,
|
|
297
|
+
sessionRepo,
|
|
298
|
+
startHarness,
|
|
299
|
+
persistedSubagentRepository: subagentRepository,
|
|
300
|
+
...(options.subagentDatabase === undefined ? {} : { subagentDatabase: options.subagentDatabase }),
|
|
301
|
+
subagents,
|
|
302
|
+
taskId: input.taskId,
|
|
303
|
+
workspacePath: input.workspacePath
|
|
304
|
+
});
|
|
305
|
+
tools.push(tool);
|
|
306
|
+
await runningAgents.get(agentId)?.harness.setTools?.(tools, tools.map((item) => item.name));
|
|
307
|
+
};
|
|
308
|
+
const continueOrEndTask = async (harnessAgentId, harnessAgentName, harnessSession, contribution, continueOptions = {}) => {
|
|
309
|
+
const currentSubagent = subagents.get(harnessAgentId);
|
|
310
|
+
const completedSubagent = getNextCompletedSubagent(subagents, harnessAgentId);
|
|
311
|
+
if (completedSubagent) {
|
|
312
|
+
if (continueOptions.deferIfRunning && runningAgents.has(harnessAgentId)) {
|
|
313
|
+
addPendingSubagentResult(pendingSubagentResults, harnessAgentId, completedSubagent.agentId);
|
|
314
|
+
return true;
|
|
315
|
+
}
|
|
316
|
+
const prompt = await appendSubagentResult({
|
|
317
|
+
agentId: harnessAgentId,
|
|
318
|
+
eventBus: options.eventBus,
|
|
319
|
+
pendingSubagentResults,
|
|
320
|
+
session: harnessSession,
|
|
321
|
+
subagent: completedSubagent
|
|
322
|
+
});
|
|
323
|
+
await startHarness(AGENT_CONTINUE_PROMPT, {
|
|
324
|
+
agentId: harnessAgentId,
|
|
325
|
+
isContinue: true,
|
|
326
|
+
pluginPrompt: prompt,
|
|
327
|
+
session: harnessSession,
|
|
328
|
+
...(currentSubagent === undefined ? {} : { parentAgentId: currentSubagent.parentAgentId }),
|
|
329
|
+
...(harnessAgentName === undefined ? {} : { agentName: harnessAgentName })
|
|
330
|
+
});
|
|
331
|
+
return true;
|
|
332
|
+
}
|
|
333
|
+
if (hasRunningSubagent(subagents, harnessAgentId)) {
|
|
334
|
+
return true;
|
|
335
|
+
}
|
|
336
|
+
const currentSessionMetadata = toAgentSessionMetadata(await harnessSession.getMetadata());
|
|
337
|
+
const context = await harnessSession.buildContext();
|
|
338
|
+
const continuation = await contribution?.onAgentEnd?.({
|
|
339
|
+
messages: context.messages,
|
|
340
|
+
runInput: { ...input, session: currentSessionMetadata },
|
|
341
|
+
session: currentSessionMetadata
|
|
342
|
+
});
|
|
343
|
+
if (!continuation?.prompt) {
|
|
344
|
+
return false;
|
|
345
|
+
}
|
|
346
|
+
if (continuation.useSubagent === true) {
|
|
347
|
+
await startContinuationSubagent({
|
|
348
|
+
...(continuation.agentName === undefined
|
|
349
|
+
? {}
|
|
350
|
+
: { agentName: continuation.agentName }),
|
|
351
|
+
eventBus: options.eventBus,
|
|
352
|
+
parentAgentId: harnessAgentId,
|
|
353
|
+
parentAgentName: harnessAgentName,
|
|
354
|
+
parentSession: harnessSession,
|
|
355
|
+
prompt: continuation.prompt,
|
|
356
|
+
sessionRepo,
|
|
357
|
+
startHarness,
|
|
358
|
+
subagentRepository,
|
|
359
|
+
subagents,
|
|
360
|
+
taskId: input.taskId,
|
|
361
|
+
workspacePath: input.workspacePath
|
|
362
|
+
});
|
|
363
|
+
return true;
|
|
364
|
+
}
|
|
365
|
+
await appendVisibleCustomMessage({
|
|
366
|
+
agentId: harnessAgentId,
|
|
367
|
+
content: continuation.prompt,
|
|
368
|
+
customType: AGENT_CONTINUATION_CUSTOM_TYPE,
|
|
369
|
+
details: continuation.details,
|
|
370
|
+
eventBus: options.eventBus,
|
|
371
|
+
session: harnessSession
|
|
372
|
+
});
|
|
373
|
+
await startHarness(AGENT_CONTINUE_PROMPT, {
|
|
374
|
+
agentId: harnessAgentId,
|
|
375
|
+
isContinue: true,
|
|
376
|
+
pluginPrompt: continuation.prompt,
|
|
377
|
+
session: harnessSession,
|
|
378
|
+
...(currentSubagent === undefined ? {} : { parentAgentId: currentSubagent.parentAgentId }),
|
|
379
|
+
...(harnessAgentName === undefined ? {} : { agentName: harnessAgentName })
|
|
380
|
+
});
|
|
381
|
+
return true;
|
|
382
|
+
};
|
|
383
|
+
const startHarness = async (promptText, harnessOptions) => {
|
|
384
|
+
const harnessAgentId = harnessOptions.agentId ?? `agent_${randomUUID()}`;
|
|
385
|
+
const harnessSession = harnessOptions.session ?? (await sessionRepo.create({ cwd: input.workspacePath }));
|
|
386
|
+
const harnessSessionMetadata = toAgentSessionMetadata(await harnessSession.getMetadata());
|
|
387
|
+
const harness = await createHarness({
|
|
388
|
+
...harnessOptions,
|
|
389
|
+
agentId: harnessAgentId,
|
|
390
|
+
session: harnessSession
|
|
391
|
+
});
|
|
392
|
+
runningAgents.set(harnessAgentId, {
|
|
393
|
+
harness,
|
|
394
|
+
sessionId: harnessSessionMetadata.id
|
|
395
|
+
});
|
|
396
|
+
void harness.prompt(promptText)
|
|
397
|
+
.catch((error) => {
|
|
398
|
+
options.eventBus.emit({
|
|
399
|
+
agentId: harnessAgentId,
|
|
400
|
+
payload: {
|
|
401
|
+
message: error instanceof Error ? error.message : "Agent run failed"
|
|
402
|
+
},
|
|
403
|
+
type: "agent_error"
|
|
404
|
+
});
|
|
405
|
+
})
|
|
406
|
+
.finally(() => {
|
|
407
|
+
if (runningAgents.get(harnessAgentId)?.harness === harness) {
|
|
408
|
+
runningAgents.delete(harnessAgentId);
|
|
409
|
+
}
|
|
410
|
+
});
|
|
411
|
+
return {
|
|
412
|
+
agentId: harnessAgentId,
|
|
413
|
+
harnessSession,
|
|
414
|
+
session: harnessSessionMetadata
|
|
415
|
+
};
|
|
416
|
+
};
|
|
417
|
+
const inputSession = input.session
|
|
418
|
+
? await sessionRepo.open({ ...input.session, cwd: input.workspacePath })
|
|
419
|
+
: undefined;
|
|
420
|
+
const startedHarness = await startHarness(input.prompt, {
|
|
421
|
+
isContinue: false,
|
|
422
|
+
pluginPrompt: input.prompt,
|
|
423
|
+
...(inputSession ? { session: inputSession } : {})
|
|
424
|
+
});
|
|
425
|
+
return {
|
|
426
|
+
agentId: startedHarness.agentId,
|
|
427
|
+
session: startedHarness.session,
|
|
428
|
+
status: "running"
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
};
|
|
432
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { AgentEventBus } from "../event/event-bus";
|
|
2
|
+
export declare function appendVisibleCustomMessage(input: {
|
|
3
|
+
agentId: string;
|
|
4
|
+
content: string;
|
|
5
|
+
customType: string;
|
|
6
|
+
details?: unknown;
|
|
7
|
+
eventBus: AgentEventBus;
|
|
8
|
+
session: {
|
|
9
|
+
appendCustomMessageEntry: (customType: string, content: string, display: boolean, details?: unknown) => Promise<unknown>;
|
|
10
|
+
};
|
|
11
|
+
}): Promise<void>;
|
|
12
|
+
//# sourceMappingURL=messages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../../src/modules/agents/runtime/messages.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGxD,wBAAsB,0BAA0B,CAAC,KAAK,EAAE;IACtD,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,aAAa,CAAC;IACxB,OAAO,EAAE;QACP,wBAAwB,EAAE,CACxB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,OAAO,EAChB,OAAO,CAAC,EAAE,OAAO,KACd,OAAO,CAAC,OAAO,CAAC,CAAC;KACvB,CAAC;CACH,iBAsBA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
export async function appendVisibleCustomMessage(input) {
|
|
3
|
+
await input.session.appendCustomMessageEntry(input.customType, input.content, true, input.details);
|
|
4
|
+
input.eventBus.emit({
|
|
5
|
+
agentId: input.agentId,
|
|
6
|
+
payload: {
|
|
7
|
+
message: {
|
|
8
|
+
content: input.content,
|
|
9
|
+
customType: input.customType,
|
|
10
|
+
...(input.details === undefined ? {} : { details: input.details }),
|
|
11
|
+
display: true,
|
|
12
|
+
id: `message_${randomUUID()}`,
|
|
13
|
+
role: "custom",
|
|
14
|
+
timestamp: Date.now()
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
type: "message_start"
|
|
18
|
+
});
|
|
19
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { AgentEventBus } from "../event/event-bus";
|
|
2
|
+
import { type SubagentRun } from "../subagent";
|
|
3
|
+
interface VisibleCustomMessageSession {
|
|
4
|
+
appendCustomMessageEntry: (customType: string, content: string, display: boolean, details?: unknown) => Promise<unknown>;
|
|
5
|
+
}
|
|
6
|
+
export declare function addPendingSubagentResult(pendingSubagentResults: Map<string, Set<string>>, agentId: string, subagentId: string): void;
|
|
7
|
+
export declare function flushPendingSubagentResults<Session extends VisibleCustomMessageSession>(input: {
|
|
8
|
+
agentId: string;
|
|
9
|
+
eventBus: AgentEventBus;
|
|
10
|
+
pendingSubagentResults: Map<string, Set<string>>;
|
|
11
|
+
session: Session;
|
|
12
|
+
subagents: Map<string, SubagentRun<Session>>;
|
|
13
|
+
}): Promise<void>;
|
|
14
|
+
export declare function appendSubagentResult<Session extends VisibleCustomMessageSession>(input: {
|
|
15
|
+
agentId: string;
|
|
16
|
+
eventBus: AgentEventBus;
|
|
17
|
+
pendingSubagentResults: Map<string, Set<string>>;
|
|
18
|
+
session: Session;
|
|
19
|
+
subagent: SubagentRun<Session>;
|
|
20
|
+
}): Promise<string>;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=subagent-results.d.ts.map
|