@runcore-sh/runcore 0.1.2
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/LICENSE +21 -0
- package/README.md +353 -0
- package/dist/activity/log.d.ts +37 -0
- package/dist/activity/log.d.ts.map +1 -0
- package/dist/activity/log.js +259 -0
- package/dist/activity/log.js.map +1 -0
- package/dist/adapters/storage/gdrive-backup.d.ts +20 -0
- package/dist/adapters/storage/gdrive-backup.d.ts.map +1 -0
- package/dist/adapters/storage/gdrive-backup.js +244 -0
- package/dist/adapters/storage/gdrive-backup.js.map +1 -0
- package/dist/adapters/storage/local.d.ts +19 -0
- package/dist/adapters/storage/local.d.ts.map +1 -0
- package/dist/adapters/storage/local.js +101 -0
- package/dist/adapters/storage/local.js.map +1 -0
- package/dist/adapters/storage/types.d.ts +44 -0
- package/dist/adapters/storage/types.d.ts.map +1 -0
- package/dist/adapters/storage/types.js +6 -0
- package/dist/adapters/storage/types.js.map +1 -0
- package/dist/agents/autonomous.d.ts +67 -0
- package/dist/agents/autonomous.d.ts.map +1 -0
- package/dist/agents/autonomous.js +710 -0
- package/dist/agents/autonomous.js.map +1 -0
- package/dist/agents/commit.d.ts +22 -0
- package/dist/agents/commit.d.ts.map +1 -0
- package/dist/agents/commit.js +120 -0
- package/dist/agents/commit.js.map +1 -0
- package/dist/agents/continue.d.ts +19 -0
- package/dist/agents/continue.d.ts.map +1 -0
- package/dist/agents/continue.js +158 -0
- package/dist/agents/continue.js.map +1 -0
- package/dist/agents/cooldown.d.ts +127 -0
- package/dist/agents/cooldown.d.ts.map +1 -0
- package/dist/agents/cooldown.js +396 -0
- package/dist/agents/cooldown.js.map +1 -0
- package/dist/agents/dedup-guard.d.ts +15 -0
- package/dist/agents/dedup-guard.d.ts.map +1 -0
- package/dist/agents/dedup-guard.js +128 -0
- package/dist/agents/dedup-guard.js.map +1 -0
- package/dist/agents/index.d.ts +34 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +51 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/instance-manager.d.ts +262 -0
- package/dist/agents/instance-manager.d.ts.map +1 -0
- package/dist/agents/instance-manager.js +850 -0
- package/dist/agents/instance-manager.js.map +1 -0
- package/dist/agents/locks.d.ts +81 -0
- package/dist/agents/locks.d.ts.map +1 -0
- package/dist/agents/locks.js +234 -0
- package/dist/agents/locks.js.map +1 -0
- package/dist/agents/memory.d.ts +37 -0
- package/dist/agents/memory.d.ts.map +1 -0
- package/dist/agents/memory.js +92 -0
- package/dist/agents/memory.js.map +1 -0
- package/dist/agents/monitor.d.ts +16 -0
- package/dist/agents/monitor.d.ts.map +1 -0
- package/dist/agents/monitor.js +235 -0
- package/dist/agents/monitor.js.map +1 -0
- package/dist/agents/orchestration.d.ts +218 -0
- package/dist/agents/orchestration.d.ts.map +1 -0
- package/dist/agents/orchestration.js +715 -0
- package/dist/agents/orchestration.js.map +1 -0
- package/dist/agents/recover.d.ts +30 -0
- package/dist/agents/recover.d.ts.map +1 -0
- package/dist/agents/recover.js +166 -0
- package/dist/agents/recover.js.map +1 -0
- package/dist/agents/reflection.d.ts +36 -0
- package/dist/agents/reflection.d.ts.map +1 -0
- package/dist/agents/reflection.js +198 -0
- package/dist/agents/reflection.js.map +1 -0
- package/dist/agents/runtime/bus.d.ts +46 -0
- package/dist/agents/runtime/bus.d.ts.map +1 -0
- package/dist/agents/runtime/bus.js +174 -0
- package/dist/agents/runtime/bus.js.map +1 -0
- package/dist/agents/runtime/config.d.ts +14 -0
- package/dist/agents/runtime/config.d.ts.map +1 -0
- package/dist/agents/runtime/config.js +100 -0
- package/dist/agents/runtime/config.js.map +1 -0
- package/dist/agents/runtime/driver.d.ts +25 -0
- package/dist/agents/runtime/driver.d.ts.map +1 -0
- package/dist/agents/runtime/driver.js +215 -0
- package/dist/agents/runtime/driver.js.map +1 -0
- package/dist/agents/runtime/errors.d.ts +30 -0
- package/dist/agents/runtime/errors.d.ts.map +1 -0
- package/dist/agents/runtime/errors.js +40 -0
- package/dist/agents/runtime/errors.js.map +1 -0
- package/dist/agents/runtime/index.d.ts +29 -0
- package/dist/agents/runtime/index.d.ts.map +1 -0
- package/dist/agents/runtime/index.js +54 -0
- package/dist/agents/runtime/index.js.map +1 -0
- package/dist/agents/runtime/lifecycle.d.ts +46 -0
- package/dist/agents/runtime/lifecycle.d.ts.map +1 -0
- package/dist/agents/runtime/lifecycle.js +116 -0
- package/dist/agents/runtime/lifecycle.js.map +1 -0
- package/dist/agents/runtime/manager.d.ts +129 -0
- package/dist/agents/runtime/manager.d.ts.map +1 -0
- package/dist/agents/runtime/manager.js +947 -0
- package/dist/agents/runtime/manager.js.map +1 -0
- package/dist/agents/runtime/registry.d.ts +66 -0
- package/dist/agents/runtime/registry.d.ts.map +1 -0
- package/dist/agents/runtime/registry.js +195 -0
- package/dist/agents/runtime/registry.js.map +1 -0
- package/dist/agents/runtime/resources.d.ts +49 -0
- package/dist/agents/runtime/resources.d.ts.map +1 -0
- package/dist/agents/runtime/resources.js +146 -0
- package/dist/agents/runtime/resources.js.map +1 -0
- package/dist/agents/runtime/types.d.ts +168 -0
- package/dist/agents/runtime/types.d.ts.map +1 -0
- package/dist/agents/runtime/types.js +24 -0
- package/dist/agents/runtime/types.js.map +1 -0
- package/dist/agents/runtime.d.ts +240 -0
- package/dist/agents/runtime.d.ts.map +1 -0
- package/dist/agents/runtime.js +577 -0
- package/dist/agents/runtime.js.map +1 -0
- package/dist/agents/spawn.d.ts +49 -0
- package/dist/agents/spawn.d.ts.map +1 -0
- package/dist/agents/spawn.js +975 -0
- package/dist/agents/spawn.js.map +1 -0
- package/dist/agents/store.d.ts +29 -0
- package/dist/agents/store.d.ts.map +1 -0
- package/dist/agents/store.js +174 -0
- package/dist/agents/store.js.map +1 -0
- package/dist/agents/triage.d.ts +23 -0
- package/dist/agents/triage.d.ts.map +1 -0
- package/dist/agents/triage.js +81 -0
- package/dist/agents/triage.js.map +1 -0
- package/dist/agents/types.d.ts +37 -0
- package/dist/agents/types.d.ts.map +1 -0
- package/dist/agents/types.js +2 -0
- package/dist/agents/types.js.map +1 -0
- package/dist/agents/workflow.d.ts +137 -0
- package/dist/agents/workflow.d.ts.map +1 -0
- package/dist/agents/workflow.js +542 -0
- package/dist/agents/workflow.js.map +1 -0
- package/dist/auth/crypto.d.ts +22 -0
- package/dist/auth/crypto.d.ts.map +1 -0
- package/dist/auth/crypto.js +42 -0
- package/dist/auth/crypto.js.map +1 -0
- package/dist/auth/identity.d.ts +89 -0
- package/dist/auth/identity.d.ts.map +1 -0
- package/dist/auth/identity.js +264 -0
- package/dist/auth/identity.js.map +1 -0
- package/dist/avatar/client.d.ts +34 -0
- package/dist/avatar/client.d.ts.map +1 -0
- package/dist/avatar/client.js +172 -0
- package/dist/avatar/client.js.map +1 -0
- package/dist/avatar/sidecar.d.ts +16 -0
- package/dist/avatar/sidecar.d.ts.map +1 -0
- package/dist/avatar/sidecar.js +125 -0
- package/dist/avatar/sidecar.js.map +1 -0
- package/dist/board/provider.d.ts +13 -0
- package/dist/board/provider.d.ts.map +1 -0
- package/dist/board/provider.js +19 -0
- package/dist/board/provider.js.map +1 -0
- package/dist/board/types.d.ts +76 -0
- package/dist/board/types.d.ts.map +1 -0
- package/dist/board/types.js +7 -0
- package/dist/board/types.js.map +1 -0
- package/dist/brain/skills.d.ts +177 -0
- package/dist/brain/skills.d.ts.map +1 -0
- package/dist/brain/skills.js +452 -0
- package/dist/brain/skills.js.map +1 -0
- package/dist/brain.d.ts +42 -0
- package/dist/brain.d.ts.map +1 -0
- package/dist/brain.js +98 -0
- package/dist/brain.js.map +1 -0
- package/dist/browser/sessions.d.ts +23 -0
- package/dist/browser/sessions.d.ts.map +1 -0
- package/dist/browser/sessions.js +121 -0
- package/dist/browser/sessions.js.map +1 -0
- package/dist/cache/file.d.ts +56 -0
- package/dist/cache/file.d.ts.map +1 -0
- package/dist/cache/file.js +176 -0
- package/dist/cache/file.js.map +1 -0
- package/dist/cache/index.d.ts +64 -0
- package/dist/cache/index.d.ts.map +1 -0
- package/dist/cache/index.js +108 -0
- package/dist/cache/index.js.map +1 -0
- package/dist/cache/keys.d.ts +29 -0
- package/dist/cache/keys.d.ts.map +1 -0
- package/dist/cache/keys.js +52 -0
- package/dist/cache/keys.js.map +1 -0
- package/dist/cache/llm-cache.d.ts +70 -0
- package/dist/cache/llm-cache.d.ts.map +1 -0
- package/dist/cache/llm-cache.js +165 -0
- package/dist/cache/llm-cache.js.map +1 -0
- package/dist/cache/memory.d.ts +53 -0
- package/dist/cache/memory.d.ts.map +1 -0
- package/dist/cache/memory.js +114 -0
- package/dist/cache/memory.js.map +1 -0
- package/dist/calendar/google-adapter.d.ts +16 -0
- package/dist/calendar/google-adapter.d.ts.map +1 -0
- package/dist/calendar/google-adapter.js +163 -0
- package/dist/calendar/google-adapter.js.map +1 -0
- package/dist/calendar/index.d.ts +8 -0
- package/dist/calendar/index.d.ts.map +1 -0
- package/dist/calendar/index.js +7 -0
- package/dist/calendar/index.js.map +1 -0
- package/dist/calendar/routes.d.ts +7 -0
- package/dist/calendar/routes.d.ts.map +1 -0
- package/dist/calendar/routes.js +199 -0
- package/dist/calendar/routes.js.map +1 -0
- package/dist/calendar/store.d.ts +73 -0
- package/dist/calendar/store.d.ts.map +1 -0
- package/dist/calendar/store.js +373 -0
- package/dist/calendar/store.js.map +1 -0
- package/dist/calendar/types.d.ts +99 -0
- package/dist/calendar/types.d.ts.map +1 -0
- package/dist/calendar/types.js +7 -0
- package/dist/calendar/types.js.map +1 -0
- package/dist/capabilities/definitions/board.d.ts +7 -0
- package/dist/capabilities/definitions/board.d.ts.map +1 -0
- package/dist/capabilities/definitions/board.js +232 -0
- package/dist/capabilities/definitions/board.js.map +1 -0
- package/dist/capabilities/definitions/browser.d.ts +18 -0
- package/dist/capabilities/definitions/browser.d.ts.map +1 -0
- package/dist/capabilities/definitions/browser.js +242 -0
- package/dist/capabilities/definitions/browser.js.map +1 -0
- package/dist/capabilities/definitions/calendar-context.d.ts +8 -0
- package/dist/capabilities/definitions/calendar-context.d.ts.map +1 -0
- package/dist/capabilities/definitions/calendar-context.js +41 -0
- package/dist/capabilities/definitions/calendar-context.js.map +1 -0
- package/dist/capabilities/definitions/calendar.d.ts +7 -0
- package/dist/capabilities/definitions/calendar.d.ts.map +1 -0
- package/dist/capabilities/definitions/calendar.js +173 -0
- package/dist/capabilities/definitions/calendar.js.map +1 -0
- package/dist/capabilities/definitions/docs.d.ts +6 -0
- package/dist/capabilities/definitions/docs.d.ts.map +1 -0
- package/dist/capabilities/definitions/docs.js +62 -0
- package/dist/capabilities/definitions/docs.js.map +1 -0
- package/dist/capabilities/definitions/email-context.d.ts +7 -0
- package/dist/capabilities/definitions/email-context.d.ts.map +1 -0
- package/dist/capabilities/definitions/email-context.js +55 -0
- package/dist/capabilities/definitions/email-context.js.map +1 -0
- package/dist/capabilities/definitions/email.d.ts +7 -0
- package/dist/capabilities/definitions/email.d.ts.map +1 -0
- package/dist/capabilities/definitions/email.js +94 -0
- package/dist/capabilities/definitions/email.js.map +1 -0
- package/dist/capabilities/definitions/task-done.d.ts +10 -0
- package/dist/capabilities/definitions/task-done.d.ts.map +1 -0
- package/dist/capabilities/definitions/task-done.js +83 -0
- package/dist/capabilities/definitions/task-done.js.map +1 -0
- package/dist/capabilities/definitions/vault-context.d.ts +12 -0
- package/dist/capabilities/definitions/vault-context.d.ts.map +1 -0
- package/dist/capabilities/definitions/vault-context.js +62 -0
- package/dist/capabilities/definitions/vault-context.js.map +1 -0
- package/dist/capabilities/definitions/web-search-context.d.ts +22 -0
- package/dist/capabilities/definitions/web-search-context.d.ts.map +1 -0
- package/dist/capabilities/definitions/web-search-context.js +60 -0
- package/dist/capabilities/definitions/web-search-context.js.map +1 -0
- package/dist/capabilities/index.d.ts +18 -0
- package/dist/capabilities/index.d.ts.map +1 -0
- package/dist/capabilities/index.js +21 -0
- package/dist/capabilities/index.js.map +1 -0
- package/dist/capabilities/registry.d.ts +84 -0
- package/dist/capabilities/registry.d.ts.map +1 -0
- package/dist/capabilities/registry.js +248 -0
- package/dist/capabilities/registry.js.map +1 -0
- package/dist/capabilities/types.d.ts +157 -0
- package/dist/capabilities/types.d.ts.map +1 -0
- package/dist/capabilities/types.js +35 -0
- package/dist/capabilities/types.js.map +1 -0
- package/dist/channels/whatsapp.d.ts +88 -0
- package/dist/channels/whatsapp.d.ts.map +1 -0
- package/dist/channels/whatsapp.js +200 -0
- package/dist/channels/whatsapp.js.map +1 -0
- package/dist/cli/backup.d.ts +13 -0
- package/dist/cli/backup.d.ts.map +1 -0
- package/dist/cli/backup.js +176 -0
- package/dist/cli/backup.js.map +1 -0
- package/dist/cli.d.ts +12 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +231 -0
- package/dist/cli.js.map +1 -0
- package/dist/config/defaults.d.ts +45 -0
- package/dist/config/defaults.d.ts.map +1 -0
- package/dist/config/defaults.js +54 -0
- package/dist/config/defaults.js.map +1 -0
- package/dist/contacts/index.d.ts +3 -0
- package/dist/contacts/index.d.ts.map +1 -0
- package/dist/contacts/index.js +2 -0
- package/dist/contacts/index.js.map +1 -0
- package/dist/contacts/store.d.ts +58 -0
- package/dist/contacts/store.d.ts.map +1 -0
- package/dist/contacts/store.js +278 -0
- package/dist/contacts/store.js.map +1 -0
- package/dist/contacts/types.d.ts +47 -0
- package/dist/contacts/types.d.ts.map +1 -0
- package/dist/contacts/types.js +5 -0
- package/dist/contacts/types.js.map +1 -0
- package/dist/context/assembler.d.ts +26 -0
- package/dist/context/assembler.d.ts.map +1 -0
- package/dist/context/assembler.js +65 -0
- package/dist/context/assembler.js.map +1 -0
- package/dist/context/compaction.d.ts +34 -0
- package/dist/context/compaction.d.ts.map +1 -0
- package/dist/context/compaction.js +84 -0
- package/dist/context/compaction.js.map +1 -0
- package/dist/context/index.d.ts +3 -0
- package/dist/context/index.d.ts.map +1 -0
- package/dist/context/index.js +2 -0
- package/dist/context/index.js.map +1 -0
- package/dist/core/registry/index.d.ts +12 -0
- package/dist/core/registry/index.d.ts.map +1 -0
- package/dist/core/registry/index.js +14 -0
- package/dist/core/registry/index.js.map +1 -0
- package/dist/core/registry/publisher.d.ts +22 -0
- package/dist/core/registry/publisher.d.ts.map +1 -0
- package/dist/core/registry/publisher.js +195 -0
- package/dist/core/registry/publisher.js.map +1 -0
- package/dist/core/registry/registry.d.ts +92 -0
- package/dist/core/registry/registry.d.ts.map +1 -0
- package/dist/core/registry/registry.js +254 -0
- package/dist/core/registry/registry.js.map +1 -0
- package/dist/core/registry/search.d.ts +12 -0
- package/dist/core/registry/search.d.ts.map +1 -0
- package/dist/core/registry/search.js +132 -0
- package/dist/core/registry/search.js.map +1 -0
- package/dist/core/registry/store.d.ts +55 -0
- package/dist/core/registry/store.d.ts.map +1 -0
- package/dist/core/registry/store.js +185 -0
- package/dist/core/registry/store.js.map +1 -0
- package/dist/core/registry/types.d.ts +141 -0
- package/dist/core/registry/types.d.ts.map +1 -0
- package/dist/core/registry/types.js +30 -0
- package/dist/core/registry/types.js.map +1 -0
- package/dist/core/registry/versions.d.ts +56 -0
- package/dist/core/registry/versions.d.ts.map +1 -0
- package/dist/core/registry/versions.js +101 -0
- package/dist/core/registry/versions.js.map +1 -0
- package/dist/credentials/store.d.ts +59 -0
- package/dist/credentials/store.d.ts.map +1 -0
- package/dist/credentials/store.js +178 -0
- package/dist/credentials/store.js.map +1 -0
- package/dist/files/agent-api.d.ts +50 -0
- package/dist/files/agent-api.d.ts.map +1 -0
- package/dist/files/agent-api.js +126 -0
- package/dist/files/agent-api.js.map +1 -0
- package/dist/files/compress.d.ts +20 -0
- package/dist/files/compress.d.ts.map +1 -0
- package/dist/files/compress.js +83 -0
- package/dist/files/compress.js.map +1 -0
- package/dist/files/extract.d.ts +11 -0
- package/dist/files/extract.d.ts.map +1 -0
- package/dist/files/extract.js +33 -0
- package/dist/files/extract.js.map +1 -0
- package/dist/files/gdrive.d.ts +56 -0
- package/dist/files/gdrive.d.ts.map +1 -0
- package/dist/files/gdrive.js +246 -0
- package/dist/files/gdrive.js.map +1 -0
- package/dist/files/ingest-folder.d.ts +22 -0
- package/dist/files/ingest-folder.d.ts.map +1 -0
- package/dist/files/ingest-folder.js +71 -0
- package/dist/files/ingest-folder.js.map +1 -0
- package/dist/files/ingest.d.ts +13 -0
- package/dist/files/ingest.d.ts.map +1 -0
- package/dist/files/ingest.js +127 -0
- package/dist/files/ingest.js.map +1 -0
- package/dist/files/manager.d.ts +117 -0
- package/dist/files/manager.d.ts.map +1 -0
- package/dist/files/manager.js +306 -0
- package/dist/files/manager.js.map +1 -0
- package/dist/files/store.d.ts +41 -0
- package/dist/files/store.d.ts.map +1 -0
- package/dist/files/store.js +271 -0
- package/dist/files/store.js.map +1 -0
- package/dist/files/templates.d.ts +45 -0
- package/dist/files/templates.d.ts.map +1 -0
- package/dist/files/templates.js +179 -0
- package/dist/files/templates.js.map +1 -0
- package/dist/files/types.d.ts +115 -0
- package/dist/files/types.d.ts.map +1 -0
- package/dist/files/types.js +20 -0
- package/dist/files/types.js.map +1 -0
- package/dist/files/validate.d.ts +15 -0
- package/dist/files/validate.d.ts.map +1 -0
- package/dist/files/validate.js +213 -0
- package/dist/files/validate.js.map +1 -0
- package/dist/files/version.d.ts +31 -0
- package/dist/files/version.d.ts.map +1 -0
- package/dist/files/version.js +129 -0
- package/dist/files/version.js.map +1 -0
- package/dist/github/client.d.ts +83 -0
- package/dist/github/client.d.ts.map +1 -0
- package/dist/github/client.js +408 -0
- package/dist/github/client.js.map +1 -0
- package/dist/github/commit-analysis.d.ts +30 -0
- package/dist/github/commit-analysis.d.ts.map +1 -0
- package/dist/github/commit-analysis.js +276 -0
- package/dist/github/commit-analysis.js.map +1 -0
- package/dist/github/contributor-stats.d.ts +18 -0
- package/dist/github/contributor-stats.d.ts.map +1 -0
- package/dist/github/contributor-stats.js +119 -0
- package/dist/github/contributor-stats.js.map +1 -0
- package/dist/github/issue-sla.d.ts +25 -0
- package/dist/github/issue-sla.d.ts.map +1 -0
- package/dist/github/issue-sla.js +220 -0
- package/dist/github/issue-sla.js.map +1 -0
- package/dist/github/issue-triage.d.ts +49 -0
- package/dist/github/issue-triage.d.ts.map +1 -0
- package/dist/github/issue-triage.js +286 -0
- package/dist/github/issue-triage.js.map +1 -0
- package/dist/github/pr-readiness.d.ts +18 -0
- package/dist/github/pr-readiness.d.ts.map +1 -0
- package/dist/github/pr-readiness.js +197 -0
- package/dist/github/pr-readiness.js.map +1 -0
- package/dist/github/pr-review.d.ts +17 -0
- package/dist/github/pr-review.d.ts.map +1 -0
- package/dist/github/pr-review.js +410 -0
- package/dist/github/pr-review.js.map +1 -0
- package/dist/github/release-notes.d.ts +32 -0
- package/dist/github/release-notes.d.ts.map +1 -0
- package/dist/github/release-notes.js +227 -0
- package/dist/github/release-notes.js.map +1 -0
- package/dist/github/repo-health.d.ts +17 -0
- package/dist/github/repo-health.d.ts.map +1 -0
- package/dist/github/repo-health.js +303 -0
- package/dist/github/repo-health.js.map +1 -0
- package/dist/github/retry.d.ts +39 -0
- package/dist/github/retry.d.ts.map +1 -0
- package/dist/github/retry.js +117 -0
- package/dist/github/retry.js.map +1 -0
- package/dist/github/types.d.ts +527 -0
- package/dist/github/types.d.ts.map +1 -0
- package/dist/github/types.js +8 -0
- package/dist/github/types.js.map +1 -0
- package/dist/github/webhooks.d.ts +36 -0
- package/dist/github/webhooks.d.ts.map +1 -0
- package/dist/github/webhooks.js +153 -0
- package/dist/github/webhooks.js.map +1 -0
- package/dist/goals/loop.d.ts +27 -0
- package/dist/goals/loop.d.ts.map +1 -0
- package/dist/goals/loop.js +239 -0
- package/dist/goals/loop.js.map +1 -0
- package/dist/goals/notifications.d.ts +20 -0
- package/dist/goals/notifications.d.ts.map +1 -0
- package/dist/goals/notifications.js +101 -0
- package/dist/goals/notifications.js.map +1 -0
- package/dist/goals/timer.d.ts +21 -0
- package/dist/goals/timer.d.ts.map +1 -0
- package/dist/goals/timer.js +60 -0
- package/dist/goals/timer.js.map +1 -0
- package/dist/google/auth.d.ts +84 -0
- package/dist/google/auth.d.ts.map +1 -0
- package/dist/google/auth.js +323 -0
- package/dist/google/auth.js.map +1 -0
- package/dist/google/calendar-timer.d.ts +20 -0
- package/dist/google/calendar-timer.d.ts.map +1 -0
- package/dist/google/calendar-timer.js +91 -0
- package/dist/google/calendar-timer.js.map +1 -0
- package/dist/google/calendar.d.ts +126 -0
- package/dist/google/calendar.d.ts.map +1 -0
- package/dist/google/calendar.js +270 -0
- package/dist/google/calendar.js.map +1 -0
- package/dist/google/docs.d.ts +87 -0
- package/dist/google/docs.d.ts.map +1 -0
- package/dist/google/docs.js +309 -0
- package/dist/google/docs.js.map +1 -0
- package/dist/google/gmail-send.d.ts +58 -0
- package/dist/google/gmail-send.d.ts.map +1 -0
- package/dist/google/gmail-send.js +219 -0
- package/dist/google/gmail-send.js.map +1 -0
- package/dist/google/gmail-timer.d.ts +34 -0
- package/dist/google/gmail-timer.d.ts.map +1 -0
- package/dist/google/gmail-timer.js +223 -0
- package/dist/google/gmail-timer.js.map +1 -0
- package/dist/google/gmail.d.ts +172 -0
- package/dist/google/gmail.d.ts.map +1 -0
- package/dist/google/gmail.js +470 -0
- package/dist/google/gmail.js.map +1 -0
- package/dist/google/tasks-timer.d.ts +20 -0
- package/dist/google/tasks-timer.d.ts.map +1 -0
- package/dist/google/tasks-timer.js +107 -0
- package/dist/google/tasks-timer.js.map +1 -0
- package/dist/google/tasks.d.ts +167 -0
- package/dist/google/tasks.d.ts.map +1 -0
- package/dist/google/tasks.js +331 -0
- package/dist/google/tasks.js.map +1 -0
- package/dist/google/temporal.d.ts +76 -0
- package/dist/google/temporal.d.ts.map +1 -0
- package/dist/google/temporal.js +176 -0
- package/dist/google/temporal.js.map +1 -0
- package/dist/health/alert-defaults.d.ts +12 -0
- package/dist/health/alert-defaults.d.ts.map +1 -0
- package/dist/health/alert-defaults.js +88 -0
- package/dist/health/alert-defaults.js.map +1 -0
- package/dist/health/alert-types.d.ts +97 -0
- package/dist/health/alert-types.d.ts.map +1 -0
- package/dist/health/alert-types.js +8 -0
- package/dist/health/alert-types.js.map +1 -0
- package/dist/health/alerting.d.ts +66 -0
- package/dist/health/alerting.d.ts.map +1 -0
- package/dist/health/alerting.js +373 -0
- package/dist/health/alerting.js.map +1 -0
- package/dist/health/checker.d.ts +32 -0
- package/dist/health/checker.d.ts.map +1 -0
- package/dist/health/checker.js +138 -0
- package/dist/health/checker.js.map +1 -0
- package/dist/health/checks/openrouter.d.ts +29 -0
- package/dist/health/checks/openrouter.d.ts.map +1 -0
- package/dist/health/checks/openrouter.js +75 -0
- package/dist/health/checks/openrouter.js.map +1 -0
- package/dist/health/checks.d.ts +26 -0
- package/dist/health/checks.d.ts.map +1 -0
- package/dist/health/checks.js +122 -0
- package/dist/health/checks.js.map +1 -0
- package/dist/health/components.d.ts +38 -0
- package/dist/health/components.d.ts.map +1 -0
- package/dist/health/components.js +112 -0
- package/dist/health/components.js.map +1 -0
- package/dist/health/index.d.ts +19 -0
- package/dist/health/index.d.ts.map +1 -0
- package/dist/health/index.js +23 -0
- package/dist/health/index.js.map +1 -0
- package/dist/health/recovery.d.ts +42 -0
- package/dist/health/recovery.d.ts.map +1 -0
- package/dist/health/recovery.js +138 -0
- package/dist/health/recovery.js.map +1 -0
- package/dist/health/types.d.ts +68 -0
- package/dist/health/types.d.ts.map +1 -0
- package/dist/health/types.js +5 -0
- package/dist/health/types.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/instance.d.ts +24 -0
- package/dist/instance.d.ts.map +1 -0
- package/dist/instance.js +48 -0
- package/dist/instance.js.map +1 -0
- package/dist/integrations/github.d.ts +83 -0
- package/dist/integrations/github.d.ts.map +1 -0
- package/dist/integrations/github.js +331 -0
- package/dist/integrations/github.js.map +1 -0
- package/dist/integrations/google-tasks.d.ts +232 -0
- package/dist/integrations/google-tasks.d.ts.map +1 -0
- package/dist/integrations/google-tasks.js +432 -0
- package/dist/integrations/google-tasks.js.map +1 -0
- package/dist/learning/extractor.d.ts +28 -0
- package/dist/learning/extractor.d.ts.map +1 -0
- package/dist/learning/extractor.js +135 -0
- package/dist/learning/extractor.js.map +1 -0
- package/dist/lib/BasePlugin.d.ts +58 -0
- package/dist/lib/BasePlugin.d.ts.map +1 -0
- package/dist/lib/BasePlugin.js +181 -0
- package/dist/lib/BasePlugin.js.map +1 -0
- package/dist/lib/PluginRegistry.d.ts +56 -0
- package/dist/lib/PluginRegistry.d.ts.map +1 -0
- package/dist/lib/PluginRegistry.js +172 -0
- package/dist/lib/PluginRegistry.js.map +1 -0
- package/dist/lib/brain-io.d.ts +60 -0
- package/dist/lib/brain-io.d.ts.map +1 -0
- package/dist/lib/brain-io.js +180 -0
- package/dist/lib/brain-io.js.map +1 -0
- package/dist/lib/encryption-config.d.ts +16 -0
- package/dist/lib/encryption-config.d.ts.map +1 -0
- package/dist/lib/encryption-config.js +40 -0
- package/dist/lib/encryption-config.js.map +1 -0
- package/dist/lib/encryption.d.ts +19 -0
- package/dist/lib/encryption.d.ts.map +1 -0
- package/dist/lib/encryption.js +65 -0
- package/dist/lib/encryption.js.map +1 -0
- package/dist/lib/key-store.d.ts +24 -0
- package/dist/lib/key-store.d.ts.map +1 -0
- package/dist/lib/key-store.js +38 -0
- package/dist/lib/key-store.js.map +1 -0
- package/dist/lib/schema-migration.d.ts +34 -0
- package/dist/lib/schema-migration.d.ts.map +1 -0
- package/dist/lib/schema-migration.js +77 -0
- package/dist/lib/schema-migration.js.map +1 -0
- package/dist/library/brain-shadow.d.ts +10 -0
- package/dist/library/brain-shadow.d.ts.map +1 -0
- package/dist/library/brain-shadow.js +158 -0
- package/dist/library/brain-shadow.js.map +1 -0
- package/dist/library/index.d.ts +7 -0
- package/dist/library/index.d.ts.map +1 -0
- package/dist/library/index.js +6 -0
- package/dist/library/index.js.map +1 -0
- package/dist/library/routes.d.ts +7 -0
- package/dist/library/routes.d.ts.map +1 -0
- package/dist/library/routes.js +473 -0
- package/dist/library/routes.js.map +1 -0
- package/dist/library/store.d.ts +54 -0
- package/dist/library/store.d.ts.map +1 -0
- package/dist/library/store.js +403 -0
- package/dist/library/store.js.map +1 -0
- package/dist/library/types.d.ts +56 -0
- package/dist/library/types.d.ts.map +1 -0
- package/dist/library/types.js +12 -0
- package/dist/library/types.js.map +1 -0
- package/dist/llm/cache.d.ts +42 -0
- package/dist/llm/cache.d.ts.map +1 -0
- package/dist/llm/cache.js +104 -0
- package/dist/llm/cache.js.map +1 -0
- package/dist/llm/complete.d.ts +24 -0
- package/dist/llm/complete.d.ts.map +1 -0
- package/dist/llm/complete.js +56 -0
- package/dist/llm/complete.js.map +1 -0
- package/dist/llm/errors.d.ts +28 -0
- package/dist/llm/errors.d.ts.map +1 -0
- package/dist/llm/errors.js +82 -0
- package/dist/llm/errors.js.map +1 -0
- package/dist/llm/ollama.d.ts +21 -0
- package/dist/llm/ollama.d.ts.map +1 -0
- package/dist/llm/ollama.js +116 -0
- package/dist/llm/ollama.js.map +1 -0
- package/dist/llm/openrouter.d.ts +13 -0
- package/dist/llm/openrouter.d.ts.map +1 -0
- package/dist/llm/openrouter.js +105 -0
- package/dist/llm/openrouter.js.map +1 -0
- package/dist/llm/providers/anthropic.d.ts +8 -0
- package/dist/llm/providers/anthropic.d.ts.map +1 -0
- package/dist/llm/providers/anthropic.js +189 -0
- package/dist/llm/providers/anthropic.js.map +1 -0
- package/dist/llm/providers/index.d.ts +20 -0
- package/dist/llm/providers/index.d.ts.map +1 -0
- package/dist/llm/providers/index.js +47 -0
- package/dist/llm/providers/index.js.map +1 -0
- package/dist/llm/providers/ollama.d.ts +13 -0
- package/dist/llm/providers/ollama.d.ts.map +1 -0
- package/dist/llm/providers/ollama.js +188 -0
- package/dist/llm/providers/ollama.js.map +1 -0
- package/dist/llm/providers/openai.d.ts +8 -0
- package/dist/llm/providers/openai.d.ts.map +1 -0
- package/dist/llm/providers/openai.js +144 -0
- package/dist/llm/providers/openai.js.map +1 -0
- package/dist/llm/providers/openrouter.d.ts +7 -0
- package/dist/llm/providers/openrouter.d.ts.map +1 -0
- package/dist/llm/providers/openrouter.js +158 -0
- package/dist/llm/providers/openrouter.js.map +1 -0
- package/dist/llm/providers/types.d.ts +29 -0
- package/dist/llm/providers/types.d.ts.map +1 -0
- package/dist/llm/providers/types.js +6 -0
- package/dist/llm/providers/types.js.map +1 -0
- package/dist/llm/retry.d.ts +29 -0
- package/dist/llm/retry.d.ts.map +1 -0
- package/dist/llm/retry.js +139 -0
- package/dist/llm/retry.js.map +1 -0
- package/dist/memory/file-backed.d.ts +36 -0
- package/dist/memory/file-backed.d.ts.map +1 -0
- package/dist/memory/file-backed.js +178 -0
- package/dist/memory/file-backed.js.map +1 -0
- package/dist/memory/index.d.ts +7 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/index.js +6 -0
- package/dist/memory/index.js.map +1 -0
- package/dist/memory/long-term.d.ts +38 -0
- package/dist/memory/long-term.d.ts.map +1 -0
- package/dist/memory/long-term.js +58 -0
- package/dist/memory/long-term.js.map +1 -0
- package/dist/memory/vector-index.d.ts +55 -0
- package/dist/memory/vector-index.d.ts.map +1 -0
- package/dist/memory/vector-index.js +207 -0
- package/dist/memory/vector-index.js.map +1 -0
- package/dist/memory/visual.d.ts +53 -0
- package/dist/memory/visual.d.ts.map +1 -0
- package/dist/memory/visual.js +218 -0
- package/dist/memory/visual.js.map +1 -0
- package/dist/memory/working.d.ts +12 -0
- package/dist/memory/working.d.ts.map +1 -0
- package/dist/memory/working.js +34 -0
- package/dist/memory/working.js.map +1 -0
- package/dist/metrics/aggregator.d.ts +58 -0
- package/dist/metrics/aggregator.d.ts.map +1 -0
- package/dist/metrics/aggregator.js +253 -0
- package/dist/metrics/aggregator.js.map +1 -0
- package/dist/metrics/collector.d.ts +26 -0
- package/dist/metrics/collector.d.ts.map +1 -0
- package/dist/metrics/collector.js +346 -0
- package/dist/metrics/collector.js.map +1 -0
- package/dist/metrics/firewall-metrics.d.ts +95 -0
- package/dist/metrics/firewall-metrics.d.ts.map +1 -0
- package/dist/metrics/firewall-metrics.js +261 -0
- package/dist/metrics/firewall-metrics.js.map +1 -0
- package/dist/metrics/index.d.ts +20 -0
- package/dist/metrics/index.d.ts.map +1 -0
- package/dist/metrics/index.js +23 -0
- package/dist/metrics/index.js.map +1 -0
- package/dist/metrics/instruments.d.ts +89 -0
- package/dist/metrics/instruments.d.ts.map +1 -0
- package/dist/metrics/instruments.js +172 -0
- package/dist/metrics/instruments.js.map +1 -0
- package/dist/metrics/middleware.d.ts +12 -0
- package/dist/metrics/middleware.d.ts.map +1 -0
- package/dist/metrics/middleware.js +47 -0
- package/dist/metrics/middleware.js.map +1 -0
- package/dist/metrics/prometheus.d.ts +39 -0
- package/dist/metrics/prometheus.d.ts.map +1 -0
- package/dist/metrics/prometheus.js +115 -0
- package/dist/metrics/prometheus.js.map +1 -0
- package/dist/metrics/registry.d.ts +58 -0
- package/dist/metrics/registry.d.ts.map +1 -0
- package/dist/metrics/registry.js +145 -0
- package/dist/metrics/registry.js.map +1 -0
- package/dist/metrics/reporter.d.ts +21 -0
- package/dist/metrics/reporter.d.ts.map +1 -0
- package/dist/metrics/reporter.js +207 -0
- package/dist/metrics/reporter.js.map +1 -0
- package/dist/metrics/store.d.ts +47 -0
- package/dist/metrics/store.d.ts.map +1 -0
- package/dist/metrics/store.js +209 -0
- package/dist/metrics/store.js.map +1 -0
- package/dist/metrics/system.d.ts +20 -0
- package/dist/metrics/system.d.ts.map +1 -0
- package/dist/metrics/system.js +109 -0
- package/dist/metrics/system.js.map +1 -0
- package/dist/metrics/types.d.ts +101 -0
- package/dist/metrics/types.d.ts.map +1 -0
- package/dist/metrics/types.js +6 -0
- package/dist/metrics/types.js.map +1 -0
- package/dist/modules/index.d.ts +6 -0
- package/dist/modules/index.d.ts.map +1 -0
- package/dist/modules/index.js +6 -0
- package/dist/modules/index.js.map +1 -0
- package/dist/modules/registry.d.ts +36 -0
- package/dist/modules/registry.d.ts.map +1 -0
- package/dist/modules/registry.js +155 -0
- package/dist/modules/registry.js.map +1 -0
- package/dist/modules/types.d.ts +37 -0
- package/dist/modules/types.d.ts.map +1 -0
- package/dist/modules/types.js +9 -0
- package/dist/modules/types.js.map +1 -0
- package/dist/notifications/channel.d.ts +25 -0
- package/dist/notifications/channel.d.ts.map +1 -0
- package/dist/notifications/channel.js +83 -0
- package/dist/notifications/channel.js.map +1 -0
- package/dist/notifications/email.d.ts +27 -0
- package/dist/notifications/email.d.ts.map +1 -0
- package/dist/notifications/email.js +72 -0
- package/dist/notifications/email.js.map +1 -0
- package/dist/notifications/index.d.ts +16 -0
- package/dist/notifications/index.d.ts.map +1 -0
- package/dist/notifications/index.js +12 -0
- package/dist/notifications/index.js.map +1 -0
- package/dist/notifications/phone.d.ts +16 -0
- package/dist/notifications/phone.d.ts.map +1 -0
- package/dist/notifications/phone.js +48 -0
- package/dist/notifications/phone.js.map +1 -0
- package/dist/notifications/sms.d.ts +26 -0
- package/dist/notifications/sms.d.ts.map +1 -0
- package/dist/notifications/sms.js +65 -0
- package/dist/notifications/sms.js.map +1 -0
- package/dist/notifications/webhook.d.ts +28 -0
- package/dist/notifications/webhook.d.ts.map +1 -0
- package/dist/notifications/webhook.js +65 -0
- package/dist/notifications/webhook.js.map +1 -0
- package/dist/openloop/foldback.d.ts +24 -0
- package/dist/openloop/foldback.d.ts.map +1 -0
- package/dist/openloop/foldback.js +127 -0
- package/dist/openloop/foldback.js.map +1 -0
- package/dist/openloop/index.d.ts +11 -0
- package/dist/openloop/index.d.ts.map +1 -0
- package/dist/openloop/index.js +9 -0
- package/dist/openloop/index.js.map +1 -0
- package/dist/openloop/lifecycle.d.ts +16 -0
- package/dist/openloop/lifecycle.d.ts.map +1 -0
- package/dist/openloop/lifecycle.js +304 -0
- package/dist/openloop/lifecycle.js.map +1 -0
- package/dist/openloop/resolution-scanner.d.ts +17 -0
- package/dist/openloop/resolution-scanner.d.ts.map +1 -0
- package/dist/openloop/resolution-scanner.js +551 -0
- package/dist/openloop/resolution-scanner.js.map +1 -0
- package/dist/openloop/scanner.d.ts +28 -0
- package/dist/openloop/scanner.d.ts.map +1 -0
- package/dist/openloop/scanner.js +587 -0
- package/dist/openloop/scanner.js.map +1 -0
- package/dist/openloop/store.d.ts +41 -0
- package/dist/openloop/store.d.ts.map +1 -0
- package/dist/openloop/store.js +154 -0
- package/dist/openloop/store.js.map +1 -0
- package/dist/openloop/types.d.ts +94 -0
- package/dist/openloop/types.d.ts.map +1 -0
- package/dist/openloop/types.js +6 -0
- package/dist/openloop/types.js.map +1 -0
- package/dist/plugins/google-tasks/index.d.ts +55 -0
- package/dist/plugins/google-tasks/index.d.ts.map +1 -0
- package/dist/plugins/google-tasks/index.js +135 -0
- package/dist/plugins/google-tasks/index.js.map +1 -0
- package/dist/pulse/activation-event.d.ts +66 -0
- package/dist/pulse/activation-event.d.ts.map +1 -0
- package/dist/pulse/activation-event.js +139 -0
- package/dist/pulse/activation-event.js.map +1 -0
- package/dist/pulse/activation-log.d.ts +37 -0
- package/dist/pulse/activation-log.d.ts.map +1 -0
- package/dist/pulse/activation-log.js +101 -0
- package/dist/pulse/activation-log.js.map +1 -0
- package/dist/pulse/index.d.ts +11 -0
- package/dist/pulse/index.d.ts.map +1 -0
- package/dist/pulse/index.js +13 -0
- package/dist/pulse/index.js.map +1 -0
- package/dist/pulse/pressure.d.ts +69 -0
- package/dist/pulse/pressure.d.ts.map +1 -0
- package/dist/pulse/pressure.js +304 -0
- package/dist/pulse/pressure.js.map +1 -0
- package/dist/pulse/types.d.ts +89 -0
- package/dist/pulse/types.d.ts.map +1 -0
- package/dist/pulse/types.js +6 -0
- package/dist/pulse/types.js.map +1 -0
- package/dist/queue/grooming.d.ts +16 -0
- package/dist/queue/grooming.d.ts.map +1 -0
- package/dist/queue/grooming.js +269 -0
- package/dist/queue/grooming.js.map +1 -0
- package/dist/queue/provider.d.ts +50 -0
- package/dist/queue/provider.d.ts.map +1 -0
- package/dist/queue/provider.js +131 -0
- package/dist/queue/provider.js.map +1 -0
- package/dist/queue/store.d.ts +97 -0
- package/dist/queue/store.d.ts.map +1 -0
- package/dist/queue/store.js +448 -0
- package/dist/queue/store.js.map +1 -0
- package/dist/queue/types.d.ts +47 -0
- package/dist/queue/types.d.ts.map +1 -0
- package/dist/queue/types.js +22 -0
- package/dist/queue/types.js.map +1 -0
- package/dist/rate-limit.d.ts +26 -0
- package/dist/rate-limit.d.ts.map +1 -0
- package/dist/rate-limit.js +74 -0
- package/dist/rate-limit.js.map +1 -0
- package/dist/registry/discovery.d.ts +30 -0
- package/dist/registry/discovery.d.ts.map +1 -0
- package/dist/registry/discovery.js +171 -0
- package/dist/registry/discovery.js.map +1 -0
- package/dist/registry/index.d.ts +14 -0
- package/dist/registry/index.d.ts.map +1 -0
- package/dist/registry/index.js +18 -0
- package/dist/registry/index.js.map +1 -0
- package/dist/registry/installer.d.ts +45 -0
- package/dist/registry/installer.d.ts.map +1 -0
- package/dist/registry/installer.js +175 -0
- package/dist/registry/installer.js.map +1 -0
- package/dist/registry/registry.d.ts +70 -0
- package/dist/registry/registry.d.ts.map +1 -0
- package/dist/registry/registry.js +153 -0
- package/dist/registry/registry.js.map +1 -0
- package/dist/registry/store.d.ts +69 -0
- package/dist/registry/store.d.ts.map +1 -0
- package/dist/registry/store.js +242 -0
- package/dist/registry/store.js.map +1 -0
- package/dist/registry/types.d.ts +116 -0
- package/dist/registry/types.d.ts.map +1 -0
- package/dist/registry/types.js +9 -0
- package/dist/registry/types.js.map +1 -0
- package/dist/registry/validator.d.ts +24 -0
- package/dist/registry/validator.d.ts.map +1 -0
- package/dist/registry/validator.js +203 -0
- package/dist/registry/validator.js.map +1 -0
- package/dist/scheduling/index.d.ts +4 -0
- package/dist/scheduling/index.d.ts.map +1 -0
- package/dist/scheduling/index.js +3 -0
- package/dist/scheduling/index.js.map +1 -0
- package/dist/scheduling/store.d.ts +41 -0
- package/dist/scheduling/store.d.ts.map +1 -0
- package/dist/scheduling/store.js +237 -0
- package/dist/scheduling/store.js.map +1 -0
- package/dist/scheduling/timer.d.ts +25 -0
- package/dist/scheduling/timer.d.ts.map +1 -0
- package/dist/scheduling/timer.js +118 -0
- package/dist/scheduling/timer.js.map +1 -0
- package/dist/scheduling/types.d.ts +43 -0
- package/dist/scheduling/types.d.ts.map +1 -0
- package/dist/scheduling/types.js +5 -0
- package/dist/scheduling/types.js.map +1 -0
- package/dist/search/brain-docs.d.ts +20 -0
- package/dist/search/brain-docs.d.ts.map +1 -0
- package/dist/search/brain-docs.js +103 -0
- package/dist/search/brain-docs.js.map +1 -0
- package/dist/search/browse.d.ts +45 -0
- package/dist/search/browse.d.ts.map +1 -0
- package/dist/search/browse.js +225 -0
- package/dist/search/browse.js.map +1 -0
- package/dist/search/classify.d.ts +23 -0
- package/dist/search/classify.d.ts.map +1 -0
- package/dist/search/classify.js +132 -0
- package/dist/search/classify.js.map +1 -0
- package/dist/search/client.d.ts +32 -0
- package/dist/search/client.d.ts.map +1 -0
- package/dist/search/client.js +72 -0
- package/dist/search/client.js.map +1 -0
- package/dist/search/perplexity.d.ts +13 -0
- package/dist/search/perplexity.d.ts.map +1 -0
- package/dist/search/perplexity.js +41 -0
- package/dist/search/perplexity.js.map +1 -0
- package/dist/search/sidecar.d.ts +20 -0
- package/dist/search/sidecar.d.ts.map +1 -0
- package/dist/search/sidecar.js +103 -0
- package/dist/search/sidecar.js.map +1 -0
- package/dist/server.d.ts +8 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +4851 -0
- package/dist/server.js.map +1 -0
- package/dist/services/backlogReview.d.ts +66 -0
- package/dist/services/backlogReview.d.ts.map +1 -0
- package/dist/services/backlogReview.js +285 -0
- package/dist/services/backlogReview.js.map +1 -0
- package/dist/services/backup.d.ts +43 -0
- package/dist/services/backup.d.ts.map +1 -0
- package/dist/services/backup.js +334 -0
- package/dist/services/backup.js.map +1 -0
- package/dist/services/credit-monitor.d.ts +40 -0
- package/dist/services/credit-monitor.d.ts.map +1 -0
- package/dist/services/credit-monitor.js +147 -0
- package/dist/services/credit-monitor.js.map +1 -0
- package/dist/services/morningBriefing.d.ts +125 -0
- package/dist/services/morningBriefing.d.ts.map +1 -0
- package/dist/services/morningBriefing.js +660 -0
- package/dist/services/morningBriefing.js.map +1 -0
- package/dist/services/routine-patterns.d.ts +21 -0
- package/dist/services/routine-patterns.d.ts.map +1 -0
- package/dist/services/routine-patterns.js +46 -0
- package/dist/services/routine-patterns.js.map +1 -0
- package/dist/services/traceInsights.d.ts +53 -0
- package/dist/services/traceInsights.d.ts.map +1 -0
- package/dist/services/traceInsights.js +762 -0
- package/dist/services/traceInsights.js.map +1 -0
- package/dist/services/training.d.ts +63 -0
- package/dist/services/training.d.ts.map +1 -0
- package/dist/services/training.js +697 -0
- package/dist/services/training.js.map +1 -0
- package/dist/services/whatsapp.d.ts +45 -0
- package/dist/services/whatsapp.d.ts.map +1 -0
- package/dist/services/whatsapp.js +194 -0
- package/dist/services/whatsapp.js.map +1 -0
- package/dist/sessions/store.d.ts +21 -0
- package/dist/sessions/store.d.ts.map +1 -0
- package/dist/sessions/store.js +47 -0
- package/dist/sessions/store.js.map +1 -0
- package/dist/settings.d.ts +111 -0
- package/dist/settings.d.ts.map +1 -0
- package/dist/settings.js +256 -0
- package/dist/settings.js.map +1 -0
- package/dist/skills/index.d.ts +10 -0
- package/dist/skills/index.d.ts.map +1 -0
- package/dist/skills/index.js +11 -0
- package/dist/skills/index.js.map +1 -0
- package/dist/skills/loader.d.ts +22 -0
- package/dist/skills/loader.d.ts.map +1 -0
- package/dist/skills/loader.js +65 -0
- package/dist/skills/loader.js.map +1 -0
- package/dist/skills/registry.d.ts +161 -0
- package/dist/skills/registry.d.ts.map +1 -0
- package/dist/skills/registry.js +664 -0
- package/dist/skills/registry.js.map +1 -0
- package/dist/skills/types.d.ts +83 -0
- package/dist/skills/types.d.ts.map +1 -0
- package/dist/skills/types.js +31 -0
- package/dist/skills/types.js.map +1 -0
- package/dist/skills/validator.d.ts +36 -0
- package/dist/skills/validator.d.ts.map +1 -0
- package/dist/skills/validator.js +114 -0
- package/dist/skills/validator.js.map +1 -0
- package/dist/slack/channels.d.ts +102 -0
- package/dist/slack/channels.d.ts.map +1 -0
- package/dist/slack/channels.js +277 -0
- package/dist/slack/channels.js.map +1 -0
- package/dist/slack/client.d.ts +151 -0
- package/dist/slack/client.d.ts.map +1 -0
- package/dist/slack/client.js +468 -0
- package/dist/slack/client.js.map +1 -0
- package/dist/slack/retry.d.ts +36 -0
- package/dist/slack/retry.d.ts.map +1 -0
- package/dist/slack/retry.js +100 -0
- package/dist/slack/retry.js.map +1 -0
- package/dist/slack/types.d.ts +271 -0
- package/dist/slack/types.d.ts.map +1 -0
- package/dist/slack/types.js +52 -0
- package/dist/slack/types.js.map +1 -0
- package/dist/slack/webhooks.d.ts +55 -0
- package/dist/slack/webhooks.d.ts.map +1 -0
- package/dist/slack/webhooks.js +285 -0
- package/dist/slack/webhooks.js.map +1 -0
- package/dist/stt/client.d.ts +18 -0
- package/dist/stt/client.d.ts.map +1 -0
- package/dist/stt/client.js +66 -0
- package/dist/stt/client.js.map +1 -0
- package/dist/stt/sidecar.d.ts +16 -0
- package/dist/stt/sidecar.d.ts.map +1 -0
- package/dist/stt/sidecar.js +115 -0
- package/dist/stt/sidecar.js.map +1 -0
- package/dist/tracing/bridge.d.ts +14 -0
- package/dist/tracing/bridge.d.ts.map +1 -0
- package/dist/tracing/bridge.js +70 -0
- package/dist/tracing/bridge.js.map +1 -0
- package/dist/tracing/correlation.d.ts +34 -0
- package/dist/tracing/correlation.d.ts.map +1 -0
- package/dist/tracing/correlation.js +49 -0
- package/dist/tracing/correlation.js.map +1 -0
- package/dist/tracing/index.d.ts +15 -0
- package/dist/tracing/index.d.ts.map +1 -0
- package/dist/tracing/index.js +18 -0
- package/dist/tracing/index.js.map +1 -0
- package/dist/tracing/init.d.ts +42 -0
- package/dist/tracing/init.d.ts.map +1 -0
- package/dist/tracing/init.js +81 -0
- package/dist/tracing/init.js.map +1 -0
- package/dist/tracing/instrument.d.ts +39 -0
- package/dist/tracing/instrument.d.ts.map +1 -0
- package/dist/tracing/instrument.js +145 -0
- package/dist/tracing/instrument.js.map +1 -0
- package/dist/tracing/middleware.d.ts +18 -0
- package/dist/tracing/middleware.d.ts.map +1 -0
- package/dist/tracing/middleware.js +69 -0
- package/dist/tracing/middleware.js.map +1 -0
- package/dist/tracing/tracer.d.ts +105 -0
- package/dist/tracing/tracer.d.ts.map +1 -0
- package/dist/tracing/tracer.js +327 -0
- package/dist/tracing/tracer.js.map +1 -0
- package/dist/tts/client.d.ts +18 -0
- package/dist/tts/client.d.ts.map +1 -0
- package/dist/tts/client.js +48 -0
- package/dist/tts/client.js.map +1 -0
- package/dist/tts/sidecar.d.ts +16 -0
- package/dist/tts/sidecar.d.ts.map +1 -0
- package/dist/tts/sidecar.js +148 -0
- package/dist/tts/sidecar.js.map +1 -0
- package/dist/twilio/call.d.ts +22 -0
- package/dist/twilio/call.d.ts.map +1 -0
- package/dist/twilio/call.js +79 -0
- package/dist/twilio/call.js.map +1 -0
- package/dist/types/plugin.d.ts +342 -0
- package/dist/types/plugin.d.ts.map +1 -0
- package/dist/types/plugin.js +10 -0
- package/dist/types/plugin.js.map +1 -0
- package/dist/types.d.ts +97 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/logger.d.ts +53 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +169 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/vault/matcher.d.ts +39 -0
- package/dist/vault/matcher.d.ts.map +1 -0
- package/dist/vault/matcher.js +197 -0
- package/dist/vault/matcher.js.map +1 -0
- package/dist/vault/personal.d.ts +60 -0
- package/dist/vault/personal.d.ts.map +1 -0
- package/dist/vault/personal.js +162 -0
- package/dist/vault/personal.js.map +1 -0
- package/dist/vault/store.d.ts +39 -0
- package/dist/vault/store.d.ts.map +1 -0
- package/dist/vault/store.js +111 -0
- package/dist/vault/store.js.map +1 -0
- package/dist/webhooks/config.d.ts +64 -0
- package/dist/webhooks/config.d.ts.map +1 -0
- package/dist/webhooks/config.js +214 -0
- package/dist/webhooks/config.js.map +1 -0
- package/dist/webhooks/event-log.d.ts +90 -0
- package/dist/webhooks/event-log.d.ts.map +1 -0
- package/dist/webhooks/event-log.js +132 -0
- package/dist/webhooks/event-log.js.map +1 -0
- package/dist/webhooks/handler.d.ts +92 -0
- package/dist/webhooks/handler.d.ts.map +1 -0
- package/dist/webhooks/handler.js +103 -0
- package/dist/webhooks/handler.js.map +1 -0
- package/dist/webhooks/handlers.d.ts +100 -0
- package/dist/webhooks/handlers.d.ts.map +1 -0
- package/dist/webhooks/handlers.js +178 -0
- package/dist/webhooks/handlers.js.map +1 -0
- package/dist/webhooks/index.d.ts +29 -0
- package/dist/webhooks/index.d.ts.map +1 -0
- package/dist/webhooks/index.js +33 -0
- package/dist/webhooks/index.js.map +1 -0
- package/dist/webhooks/mount.d.ts +77 -0
- package/dist/webhooks/mount.d.ts.map +1 -0
- package/dist/webhooks/mount.js +400 -0
- package/dist/webhooks/mount.js.map +1 -0
- package/dist/webhooks/registry.d.ts +52 -0
- package/dist/webhooks/registry.d.ts.map +1 -0
- package/dist/webhooks/registry.js +143 -0
- package/dist/webhooks/registry.js.map +1 -0
- package/dist/webhooks/relay.d.ts +25 -0
- package/dist/webhooks/relay.d.ts.map +1 -0
- package/dist/webhooks/relay.js +53 -0
- package/dist/webhooks/relay.js.map +1 -0
- package/dist/webhooks/retry.d.ts +92 -0
- package/dist/webhooks/retry.d.ts.map +1 -0
- package/dist/webhooks/retry.js +270 -0
- package/dist/webhooks/retry.js.map +1 -0
- package/dist/webhooks/router.d.ts +94 -0
- package/dist/webhooks/router.d.ts.map +1 -0
- package/dist/webhooks/router.js +290 -0
- package/dist/webhooks/router.js.map +1 -0
- package/dist/webhooks/twilio.d.ts +63 -0
- package/dist/webhooks/twilio.d.ts.map +1 -0
- package/dist/webhooks/twilio.js +129 -0
- package/dist/webhooks/twilio.js.map +1 -0
- package/dist/webhooks/types.d.ts +142 -0
- package/dist/webhooks/types.d.ts.map +1 -0
- package/dist/webhooks/types.js +8 -0
- package/dist/webhooks/types.js.map +1 -0
- package/dist/webhooks/verify.d.ts +51 -0
- package/dist/webhooks/verify.d.ts.map +1 -0
- package/dist/webhooks/verify.js +98 -0
- package/dist/webhooks/verify.js.map +1 -0
- package/package.json +70 -0
- package/public/board.html +1316 -0
- package/public/browser.html +600 -0
- package/public/help.html +655 -0
- package/public/index.html +4689 -0
- package/public/library.html +3642 -0
- package/public/observatory.html +1693 -0
- package/public/ops.html +1129 -0
- package/public/share-modal.js +211 -0
- package/skills/README.md +34 -0
- package/skills/core-architecture.md +33 -0
- package/skills/form-fill.md +98 -0
- package/skills/form-review.md +110 -0
- package/skills/form-scout.md +94 -0
- package/skills/log-decision.md +27 -0
- package/skills/onboard.md +98 -0
- package/skills/voice-guide.md +22 -0
- package/skills/write-blog.md +43 -0
|
@@ -0,0 +1,710 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Autonomous work loop — the missing "first nudge" that makes the agent proactive.
|
|
3
|
+
*
|
|
4
|
+
* Two entry points:
|
|
5
|
+
* 1. Timer: fires 60s after boot, then every 15 min. Checks board, spawns agents.
|
|
6
|
+
* 2. continueAfterBatch(): called when a batch completes, decides what's next.
|
|
7
|
+
*
|
|
8
|
+
* Both use planAndSpawn() which:
|
|
9
|
+
* - Reads board state directly (no HTTP, no SSE, no session validation)
|
|
10
|
+
* - Asks the LLM to pick tasks and write agent prompts
|
|
11
|
+
* - Parses [AGENT_REQUEST] blocks from the response
|
|
12
|
+
* - Spawns agents via submitTask()
|
|
13
|
+
*/
|
|
14
|
+
import { getBoardProvider } from "../board/provider.js";
|
|
15
|
+
import { submitTask } from "./index.js";
|
|
16
|
+
import { activeAgentCount, generateBridgeReport } from "./spawn.js";
|
|
17
|
+
import { commitAgentBatch } from "./commit.js";
|
|
18
|
+
import { listTasks as listAgentTasks } from "./store.js";
|
|
19
|
+
import { logActivity } from "../activity/log.js";
|
|
20
|
+
import { pushNotification } from "../goals/notifications.js";
|
|
21
|
+
import { completeChat } from "../llm/complete.js";
|
|
22
|
+
import { LLMError } from "../llm/errors.js";
|
|
23
|
+
import { resolveProvider } from "../settings.js";
|
|
24
|
+
import { resolveEnv, getInstanceName, getInstanceNameLower } from "../instance.js";
|
|
25
|
+
import { createLogger } from "../utils/logger.js";
|
|
26
|
+
import { reflectOnSession } from "./reflection.js";
|
|
27
|
+
import { TaskCooldownManager } from "./cooldown.js";
|
|
28
|
+
import { checkDedup } from "./dedup-guard.js";
|
|
29
|
+
import { recordAutonomousAction, recordDedupBlock } from "../metrics/firewall-metrics.js";
|
|
30
|
+
import { getCapabilityRegistry } from "../capabilities/index.js";
|
|
31
|
+
import { getPressureIntegrator } from "../pulse/pressure.js";
|
|
32
|
+
const log = createLogger("autonomous");
|
|
33
|
+
// ─── Config ──────────────────────────────────────────────────────────────────
|
|
34
|
+
const AUTONOMOUS_INTERVAL_MS = 60 * 60 * 1000; // 60 min (coma failsafe — primary trigger is now tension-based)
|
|
35
|
+
const FIRST_CHECK_DELAY_MS = 60 * 1000; // 60s after boot
|
|
36
|
+
const MAX_CONTINUATION_ROUNDS = 5;
|
|
37
|
+
const MAX_AGENTS_PER_ROUND = 5;
|
|
38
|
+
/** Model for the planner LLM — needs to be capable enough for structured output. */
|
|
39
|
+
const PLANNER_MODEL = "anthropic/claude-sonnet-4";
|
|
40
|
+
// ─── State ───────────────────────────────────────────────────────────────────
|
|
41
|
+
let timer = null;
|
|
42
|
+
let firstCheckTimer = null;
|
|
43
|
+
const continuationRounds = new Map();
|
|
44
|
+
let autonomousSessionCounter = 0;
|
|
45
|
+
/** Guard against concurrent planAndSpawn calls (timer vs continuation race). */
|
|
46
|
+
let planningInProgress = false;
|
|
47
|
+
/**
|
|
48
|
+
* Per-session cumulative failure counter.
|
|
49
|
+
* If a session accumulates too many total failures across all continuation rounds,
|
|
50
|
+
* stop the session entirely. This prevents the scenario where mixed success/failure
|
|
51
|
+
* batches keep the session alive while repeatedly retrying the same failing tasks.
|
|
52
|
+
*/
|
|
53
|
+
const sessionCumulativeFailures = new Map();
|
|
54
|
+
const MAX_SESSION_CUMULATIVE_FAILURES = 8;
|
|
55
|
+
/** Persistent cooldown tracker — survives restarts, shared across modules. */
|
|
56
|
+
const cooldownManager = TaskCooldownManager.getInstance();
|
|
57
|
+
/**
|
|
58
|
+
* Planner skip cache — tracks items the LLM planner reviewed and decided
|
|
59
|
+
* weren't ready. Avoids re-calling the LLM (~2 min round-trip) for the same
|
|
60
|
+
* unchanged items. Items are re-evaluated if their `updatedAt` changes or
|
|
61
|
+
* after the cooldown expires.
|
|
62
|
+
*/
|
|
63
|
+
const plannerSkipCache = new Map();
|
|
64
|
+
const PLANNER_SKIP_COOLDOWN_MS = 2 * 60 * 60 * 1000; // 2 hours
|
|
65
|
+
/**
|
|
66
|
+
* Max agents the planner will allow before skipping a work check.
|
|
67
|
+
* The planner can still spawn 1-3 agents per round, so actual peak may
|
|
68
|
+
* briefly exceed this while a batch is starting up.
|
|
69
|
+
*/
|
|
70
|
+
const MAX_CONCURRENT_AGENTS = parseInt(resolveEnv("MAX_CONCURRENT_AGENTS") ?? "", 10) || 3;
|
|
71
|
+
/**
|
|
72
|
+
* Map agent label → board taskId, so we can mark the board task as failed
|
|
73
|
+
* when the agent fails and avoid immediately re-assigning it.
|
|
74
|
+
*/
|
|
75
|
+
const labelToBoardTaskId = new Map();
|
|
76
|
+
/**
|
|
77
|
+
* Circuit breaker for LLM credit exhaustion.
|
|
78
|
+
* When a credit error is detected, autonomous work pauses until the cooldown expires.
|
|
79
|
+
* This prevents burning through the 15-min cycle repeatedly hitting a dead API.
|
|
80
|
+
*/
|
|
81
|
+
let creditCircuitBreakerUntil = 0;
|
|
82
|
+
const CREDIT_CIRCUIT_BREAKER_MS = 30 * 60_000; // 30 minutes
|
|
83
|
+
// ─── Public API ──────────────────────────────────────────────────────────────
|
|
84
|
+
/**
|
|
85
|
+
* Start the autonomous work timer. Idempotent.
|
|
86
|
+
* First check fires 60s after boot (not immediately — gives system time to init).
|
|
87
|
+
* Then repeats every 15 min.
|
|
88
|
+
*/
|
|
89
|
+
export function startAutonomousTimer(intervalMs) {
|
|
90
|
+
if (timer)
|
|
91
|
+
return;
|
|
92
|
+
const interval = intervalMs ?? AUTONOMOUS_INTERVAL_MS;
|
|
93
|
+
// Initialize cooldown manager (loads persisted state from disk)
|
|
94
|
+
cooldownManager.init().catch((err) => {
|
|
95
|
+
log.warn(`Cooldown manager init failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
96
|
+
});
|
|
97
|
+
// Fire first check shortly after boot
|
|
98
|
+
firstCheckTimer = setTimeout(async () => {
|
|
99
|
+
firstCheckTimer = null;
|
|
100
|
+
log.info(` First work check starting...`);
|
|
101
|
+
try {
|
|
102
|
+
await checkForWork();
|
|
103
|
+
}
|
|
104
|
+
catch (err) {
|
|
105
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
106
|
+
log.error(` First check error: ${msg}`);
|
|
107
|
+
logActivity({ source: "autonomous", summary: `First check error: ${msg}`, actionLabel: "AUTONOMOUS", reason: "15-min autonomous planner cycle" });
|
|
108
|
+
}
|
|
109
|
+
}, FIRST_CHECK_DELAY_MS);
|
|
110
|
+
// Then repeat on interval
|
|
111
|
+
timer = setInterval(async () => {
|
|
112
|
+
try {
|
|
113
|
+
await checkForWork();
|
|
114
|
+
}
|
|
115
|
+
catch (err) {
|
|
116
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
117
|
+
log.error(` Work check error: ${msg}`);
|
|
118
|
+
logActivity({ source: "autonomous", summary: `Work check error: ${msg}`, actionLabel: "AUTONOMOUS", reason: "15-min autonomous planner cycle" });
|
|
119
|
+
}
|
|
120
|
+
}, interval);
|
|
121
|
+
const mins = Math.round(interval / 60_000);
|
|
122
|
+
log.info(`Autonomous work: first check in ${FIRST_CHECK_DELAY_MS / 1000}s, then every ${mins} min`);
|
|
123
|
+
}
|
|
124
|
+
/** Stop the autonomous timer. */
|
|
125
|
+
export function stopAutonomousTimer() {
|
|
126
|
+
if (firstCheckTimer) {
|
|
127
|
+
clearTimeout(firstCheckTimer);
|
|
128
|
+
firstCheckTimer = null;
|
|
129
|
+
}
|
|
130
|
+
if (timer) {
|
|
131
|
+
clearInterval(timer);
|
|
132
|
+
timer = null;
|
|
133
|
+
}
|
|
134
|
+
// Flush cooldown state to disk
|
|
135
|
+
cooldownManager.shutdown();
|
|
136
|
+
}
|
|
137
|
+
/** Is the autonomous timer running? */
|
|
138
|
+
export function isAutonomousTimerRunning() {
|
|
139
|
+
return timer !== null;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Called by PressureIntegrator when tension exceeds threshold.
|
|
143
|
+
* Wraps checkForWork() with the existing planningInProgress guard.
|
|
144
|
+
*/
|
|
145
|
+
export async function triggerPulse() {
|
|
146
|
+
if (planningInProgress) {
|
|
147
|
+
log.info(`Pulse trigger skipped: planning already in progress`);
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
if (activeAgentCount() >= MAX_CONCURRENT_AGENTS) {
|
|
151
|
+
log.info(`Pulse trigger skipped: at capacity (${activeAgentCount()}/${MAX_CONCURRENT_AGENTS})`);
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
log.info(`Pulse trigger: checking for work...`);
|
|
155
|
+
await checkForWork();
|
|
156
|
+
}
|
|
157
|
+
/** Get a snapshot of the autonomous work loop's current state. */
|
|
158
|
+
export function getAutonomousStatus() {
|
|
159
|
+
const activeSessions = [...continuationRounds.keys()];
|
|
160
|
+
const activeCooldowns = cooldownManager.listActiveCooldowns().map((c) => ({
|
|
161
|
+
taskId: c.taskId,
|
|
162
|
+
label: c.label,
|
|
163
|
+
failureCount: c.failureCount,
|
|
164
|
+
remainingMin: Math.round(c.remainingMs / 60_000),
|
|
165
|
+
}));
|
|
166
|
+
const cbRemain = Math.max(0, creditCircuitBreakerUntil - Date.now());
|
|
167
|
+
return {
|
|
168
|
+
timerRunning: timer !== null,
|
|
169
|
+
intervalMs: AUTONOMOUS_INTERVAL_MS,
|
|
170
|
+
firstCheckDelayMs: FIRST_CHECK_DELAY_MS,
|
|
171
|
+
creditCircuitBreakerActive: Date.now() < creditCircuitBreakerUntil,
|
|
172
|
+
creditCircuitBreakerRemainingMin: Math.ceil(cbRemain / 60_000),
|
|
173
|
+
planningInProgress,
|
|
174
|
+
activeAgents: activeAgentCount(),
|
|
175
|
+
maxConcurrentAgents: MAX_CONCURRENT_AGENTS,
|
|
176
|
+
activeSessions,
|
|
177
|
+
cooldowns: activeCooldowns,
|
|
178
|
+
plannerSkippedItems: plannerSkipCache.size,
|
|
179
|
+
pulse: getPressureIntegrator()?.getStatus() ?? null,
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Called by onBatchComplete when all agents in a session finish.
|
|
184
|
+
* Commits work, then checks if there's more to do.
|
|
185
|
+
*/
|
|
186
|
+
export async function continueAfterBatch(sessionId, results) {
|
|
187
|
+
// Commit agent work as a logical batch
|
|
188
|
+
const round = (continuationRounds.get(sessionId) ?? 0) + 1;
|
|
189
|
+
try {
|
|
190
|
+
const commitResult = await commitAgentBatch(results, round);
|
|
191
|
+
if (commitResult.ok && commitResult.message !== "No changes to commit" && commitResult.message !== "No staged changes to commit") {
|
|
192
|
+
logActivity({ source: "system", summary: commitResult.message });
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
catch (err) {
|
|
196
|
+
logActivity({ source: "autonomous", summary: `Commit error: ${err instanceof Error ? err.message : String(err)}`, actionLabel: "AUTONOMOUS", reason: "batch continuation commit" });
|
|
197
|
+
}
|
|
198
|
+
// Record failed agent labels → board task cooldown (escalating, persisted)
|
|
199
|
+
const batchFailedCount = results.filter((r) => r.status === "failed").length;
|
|
200
|
+
for (const r of results) {
|
|
201
|
+
if (r.status === "failed") {
|
|
202
|
+
const boardTaskId = labelToBoardTaskId.get(r.label);
|
|
203
|
+
if (boardTaskId) {
|
|
204
|
+
cooldownManager.recordFailure(boardTaskId, r.label);
|
|
205
|
+
const failureCount = cooldownManager.getFailureCount(boardTaskId);
|
|
206
|
+
if (failureCount >= 3) {
|
|
207
|
+
generateBridgeReport(boardTaskId, r.label, failureCount).catch(() => { });
|
|
208
|
+
}
|
|
209
|
+
labelToBoardTaskId.delete(r.label);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
// Track cumulative failures across all rounds for this session
|
|
214
|
+
if (batchFailedCount > 0) {
|
|
215
|
+
const prevCumulative = sessionCumulativeFailures.get(sessionId) ?? 0;
|
|
216
|
+
const newCumulative = prevCumulative + batchFailedCount;
|
|
217
|
+
sessionCumulativeFailures.set(sessionId, newCumulative);
|
|
218
|
+
if (newCumulative >= MAX_SESSION_CUMULATIVE_FAILURES) {
|
|
219
|
+
log.info(` Session ${sessionId} hit ${newCumulative} cumulative failures (limit ${MAX_SESSION_CUMULATIVE_FAILURES}) — stopping`);
|
|
220
|
+
logActivity({
|
|
221
|
+
source: "autonomous",
|
|
222
|
+
summary: `Session hit ${newCumulative} cumulative failures — stopping`,
|
|
223
|
+
actionLabel: "AUTONOMOUS",
|
|
224
|
+
reason: "cumulative failure limit reached",
|
|
225
|
+
});
|
|
226
|
+
continuationRounds.delete(sessionId);
|
|
227
|
+
sessionCumulativeFailures.delete(sessionId);
|
|
228
|
+
await reflectOnSession({ sessionId, round, results, isFinal: true }).catch(() => { });
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
// If all agents in the batch failed, stop continuation — don't keep trying
|
|
233
|
+
const allFailed = results.every((r) => r.status === "failed");
|
|
234
|
+
if (allFailed) {
|
|
235
|
+
log.info(` All ${results.length} agent(s) in batch failed — stopping continuation for session ${sessionId}`);
|
|
236
|
+
logActivity({ source: "autonomous", summary: `All agents in batch failed — stopping continuation`, actionLabel: "AUTONOMOUS", reason: "all-failure batch halt" });
|
|
237
|
+
continuationRounds.delete(sessionId);
|
|
238
|
+
sessionCumulativeFailures.delete(sessionId);
|
|
239
|
+
await reflectOnSession({ sessionId, round, results, isFinal: true }).catch(() => { });
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
// Check round limit
|
|
243
|
+
if (round > MAX_CONTINUATION_ROUNDS) {
|
|
244
|
+
log.info(` Hit ${MAX_CONTINUATION_ROUNDS}-round limit for session ${sessionId}, pausing`);
|
|
245
|
+
logActivity({ source: "autonomous", summary: `Hit ${MAX_CONTINUATION_ROUNDS}-round limit, pausing`, actionLabel: "AUTONOMOUS", reason: "round limit reached" });
|
|
246
|
+
continuationRounds.delete(sessionId);
|
|
247
|
+
sessionCumulativeFailures.delete(sessionId);
|
|
248
|
+
await reflectOnSession({ sessionId, round, results, isFinal: true }).catch(() => { });
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
continuationRounds.set(sessionId, round);
|
|
252
|
+
const batchSummary = results.map((r) => `${r.label}: ${r.status}`).join(", ");
|
|
253
|
+
// Fixed 2s pause between rounds — enough to prevent rapid cycling,
|
|
254
|
+
// short enough to keep the cluster responsive. Guards (dedup, cooldown,
|
|
255
|
+
// cumulative failure limit) handle runaway scenarios, not the delay.
|
|
256
|
+
const continuationDelayMs = 2000;
|
|
257
|
+
const msg = `Batch done (${batchSummary}). Checking for more work in ${Math.round(continuationDelayMs / 1000)}s (round ${round}/${MAX_CONTINUATION_ROUNDS})...`;
|
|
258
|
+
log.info(` ${msg}`);
|
|
259
|
+
logActivity({ source: "autonomous", summary: msg, actionLabel: "AUTONOMOUS", reason: `batch continuation round ${round}` });
|
|
260
|
+
pushNotification({ timestamp: new Date().toISOString(), source: "autonomous", message: msg });
|
|
261
|
+
// Build context from batch results
|
|
262
|
+
const resultSummary = results
|
|
263
|
+
.map((r) => `- ${r.label}: ${r.status}`)
|
|
264
|
+
.join("\n");
|
|
265
|
+
// Skip LLM-based reflection on intermediate rounds — saves 30-60s per round.
|
|
266
|
+
// Final reflections still run at the early-exit points above (all-failed, cumulative limit, round limit).
|
|
267
|
+
await new Promise((resolve) => setTimeout(resolve, continuationDelayMs));
|
|
268
|
+
const enhancedContext = `Just completed round ${round}:\n${resultSummary}`;
|
|
269
|
+
await planAndSpawn(sessionId, enhancedContext);
|
|
270
|
+
}
|
|
271
|
+
/** Reset continuation tracking for a session. */
|
|
272
|
+
export function resetContinuation(sessionId) {
|
|
273
|
+
continuationRounds.delete(sessionId);
|
|
274
|
+
sessionCumulativeFailures.delete(sessionId);
|
|
275
|
+
}
|
|
276
|
+
// ─── Core ────────────────────────────────────────────────────────────────────
|
|
277
|
+
/**
|
|
278
|
+
* Periodic check: if agents are idle and there's actionable work, spawn agents.
|
|
279
|
+
* Exported so PressureIntegrator can call it directly on pulse.
|
|
280
|
+
*/
|
|
281
|
+
export async function checkForWork() {
|
|
282
|
+
// Circuit breaker: skip if credits are exhausted (avoid hammering a dead API)
|
|
283
|
+
if (Date.now() < creditCircuitBreakerUntil) {
|
|
284
|
+
const remainMin = Math.ceil((creditCircuitBreakerUntil - Date.now()) / 60_000);
|
|
285
|
+
log.info(` Credit circuit breaker active — skipping work check (${remainMin}min remaining)`);
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
const currentAgents = activeAgentCount();
|
|
289
|
+
if (currentAgents >= MAX_CONCURRENT_AGENTS) {
|
|
290
|
+
log.info(` At capacity (${currentAgents}/${MAX_CONCURRENT_AGENTS} agents), skipping work check`);
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
if (planningInProgress) {
|
|
294
|
+
log.info(` Planning already in progress, skipping work check`);
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
const board = getBoardProvider();
|
|
298
|
+
if (!board?.isAvailable()) {
|
|
299
|
+
log.info(` No board provider available`);
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
const store = board.getStore?.();
|
|
303
|
+
if (!store) {
|
|
304
|
+
log.info(` No queue store available`);
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
const allTasks = await store.list();
|
|
308
|
+
const atCapacity = currentAgents >= MAX_CONCURRENT_AGENTS;
|
|
309
|
+
// Filter to tasks the planner can assign.
|
|
310
|
+
// "todo" tasks assigned to the agent are reclaimed if no agent is actively running —
|
|
311
|
+
// they're leftovers from a previous session that failed or was interrupted.
|
|
312
|
+
const agentAssignee = `${getInstanceNameLower()}-agent`;
|
|
313
|
+
const actionable = allTasks.filter((t) => {
|
|
314
|
+
if (t.state !== "todo")
|
|
315
|
+
return false;
|
|
316
|
+
if (t.assignee && !(t.assignee === agentAssignee && t.state === "todo" && !atCapacity))
|
|
317
|
+
return false;
|
|
318
|
+
if (cooldownManager.shouldSkip(t.id))
|
|
319
|
+
return false;
|
|
320
|
+
return true;
|
|
321
|
+
});
|
|
322
|
+
if (actionable.length === 0) {
|
|
323
|
+
log.info(` No actionable items on the board`);
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
// Filter out items the planner already reviewed and skipped (unless updated since)
|
|
327
|
+
const now = Date.now();
|
|
328
|
+
const needsReview = actionable.filter((t) => {
|
|
329
|
+
const cached = plannerSkipCache.get(t.id);
|
|
330
|
+
if (!cached)
|
|
331
|
+
return true;
|
|
332
|
+
// Re-evaluate if item was updated after the planner skipped it
|
|
333
|
+
if (t.updatedAt && t.updatedAt !== cached.itemUpdatedAt)
|
|
334
|
+
return true;
|
|
335
|
+
// Re-evaluate if the skip cooldown expired
|
|
336
|
+
if (now - cached.skippedAt >= PLANNER_SKIP_COOLDOWN_MS) {
|
|
337
|
+
plannerSkipCache.delete(t.id);
|
|
338
|
+
return true;
|
|
339
|
+
}
|
|
340
|
+
return false;
|
|
341
|
+
});
|
|
342
|
+
if (needsReview.length === 0) {
|
|
343
|
+
log.info(` ${actionable.length} actionable item(s) all recently reviewed by planner — skipping LLM call`);
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
log.info(` Found ${needsReview.length} actionable item(s) (${actionable.length - needsReview.length} cached skip), calling LLM planner...`);
|
|
347
|
+
// Create an internal session for batch tracking
|
|
348
|
+
autonomousSessionCounter++;
|
|
349
|
+
const sessionId = `auto-${Date.now()}-${autonomousSessionCounter}`;
|
|
350
|
+
await planAndSpawn(sessionId, null, needsReview);
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Ask the LLM what to work on, parse AGENT_REQUEST blocks, spawn agents.
|
|
354
|
+
*/
|
|
355
|
+
async function planAndSpawn(sessionId, priorContext, explicitItems) {
|
|
356
|
+
if (planningInProgress) {
|
|
357
|
+
log.info(` planAndSpawn already running, skipping duplicate call`);
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
planningInProgress = true;
|
|
361
|
+
try {
|
|
362
|
+
await planAndSpawnInner(sessionId, priorContext, explicitItems);
|
|
363
|
+
}
|
|
364
|
+
finally {
|
|
365
|
+
planningInProgress = false;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
async function planAndSpawnInner(sessionId, priorContext, explicitItems) {
|
|
369
|
+
// Get actionable board items (unless explicitly provided)
|
|
370
|
+
let actionable = explicitItems;
|
|
371
|
+
if (!actionable) {
|
|
372
|
+
const board = getBoardProvider();
|
|
373
|
+
if (!board?.isAvailable())
|
|
374
|
+
return;
|
|
375
|
+
const store = board.getStore?.();
|
|
376
|
+
if (!store)
|
|
377
|
+
return;
|
|
378
|
+
const allTasks = await store.list();
|
|
379
|
+
const atCap = activeAgentCount() >= MAX_CONCURRENT_AGENTS;
|
|
380
|
+
const agentAssigneeInner = `${getInstanceNameLower()}-agent`;
|
|
381
|
+
actionable = allTasks.filter((t) => {
|
|
382
|
+
if (t.state !== "todo")
|
|
383
|
+
return false;
|
|
384
|
+
if (t.assignee && !(t.assignee === agentAssigneeInner && t.state === "todo" && !atCap))
|
|
385
|
+
return false;
|
|
386
|
+
if (cooldownManager.shouldSkip(t.id))
|
|
387
|
+
return false;
|
|
388
|
+
return true;
|
|
389
|
+
});
|
|
390
|
+
if (actionable.length === 0) {
|
|
391
|
+
log.info(` No more actionable items — pausing`);
|
|
392
|
+
logActivity({ source: "autonomous", summary: "No more actionable items — pausing", actionLabel: "AUTONOMOUS", reason: "planner found no work" });
|
|
393
|
+
continuationRounds.delete(sessionId);
|
|
394
|
+
sessionCumulativeFailures.delete(sessionId);
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
// Build board context with descriptions and project names
|
|
399
|
+
const boardContext = actionable
|
|
400
|
+
.map((t) => {
|
|
401
|
+
const desc = t.description ? `\n ${t.description.slice(0, 1500)}` : "";
|
|
402
|
+
const proj = t.project ? ` {${t.project}}` : "";
|
|
403
|
+
return `- **${t.identifier}**: ${t.title} [${t.state}, P${t.priority ?? 4}]${proj} (id: ${t.id})${desc}`;
|
|
404
|
+
})
|
|
405
|
+
.join("\n");
|
|
406
|
+
// Build the planning prompt
|
|
407
|
+
const prompt = await buildPlannerPrompt(boardContext, priorContext);
|
|
408
|
+
const messages = [
|
|
409
|
+
{ role: "system", content: getPlannerSystemPrompt() },
|
|
410
|
+
{ role: "user", content: prompt },
|
|
411
|
+
];
|
|
412
|
+
try {
|
|
413
|
+
log.info(` Calling LLM planner (model: ${PLANNER_MODEL}, provider: ${resolveProvider()})...`);
|
|
414
|
+
const response = await completeChat({
|
|
415
|
+
messages,
|
|
416
|
+
model: PLANNER_MODEL,
|
|
417
|
+
provider: resolveProvider(),
|
|
418
|
+
});
|
|
419
|
+
log.info(` LLM response (${response.length} chars): ${response.slice(0, 200)}...`);
|
|
420
|
+
// Process action blocks + meta blocks (TASK_DONE, etc.) via capability registry
|
|
421
|
+
let actionsExecuted = 0;
|
|
422
|
+
{
|
|
423
|
+
const capReg = getCapabilityRegistry();
|
|
424
|
+
if (capReg) {
|
|
425
|
+
const { results, metaResults } = await capReg.processResponse(response, { origin: "autonomous" });
|
|
426
|
+
actionsExecuted += results.filter((r) => r.ok).length;
|
|
427
|
+
actionsExecuted += metaResults.reduce((n, m) => n + m.results.filter((r) => r.ok).length, 0);
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
// Parse AGENT_REQUEST blocks from LLM response
|
|
431
|
+
const blocks = [...response.matchAll(/\[AGENT_REQUEST\]\s*([\s\S]*?)\s*\[\/AGENT_REQUEST\]/g)];
|
|
432
|
+
if (blocks.length === 0 && actionsExecuted === 0) {
|
|
433
|
+
// Extract a brief reason from the LLM response (strip markdown noise)
|
|
434
|
+
const briefReason = response.replace(/[#*`\[\]]/g, "").trim().slice(0, 150);
|
|
435
|
+
log.info(` LLM decided no agents needed. Response: ${response.slice(0, 300)}`);
|
|
436
|
+
logActivity({
|
|
437
|
+
source: "autonomous",
|
|
438
|
+
summary: `Reviewed ${actionable.length} backlog item(s), none ready: ${briefReason}`,
|
|
439
|
+
actionLabel: "AUTONOMOUS",
|
|
440
|
+
reason: "planner decided no action needed",
|
|
441
|
+
});
|
|
442
|
+
// Cache these items so the next cycle skips the LLM call for unchanged items
|
|
443
|
+
const skipTime = Date.now();
|
|
444
|
+
for (const t of actionable) {
|
|
445
|
+
plannerSkipCache.set(t.id, { skippedAt: skipTime, itemUpdatedAt: t.updatedAt });
|
|
446
|
+
}
|
|
447
|
+
log.info(` Cached ${actionable.length} item(s) as planner-skipped for ${PLANNER_SKIP_COOLDOWN_MS / 60_000}min`);
|
|
448
|
+
continuationRounds.delete(sessionId);
|
|
449
|
+
sessionCumulativeFailures.delete(sessionId);
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
if (blocks.length === 0 && actionsExecuted > 0) {
|
|
453
|
+
log.info(` Executed ${actionsExecuted} action(s), no agents spawned`);
|
|
454
|
+
logActivity({
|
|
455
|
+
source: "autonomous",
|
|
456
|
+
summary: `Executed ${actionsExecuted} action(s) from ${actionable.length} backlog item(s)`,
|
|
457
|
+
actionLabel: "AUTONOMOUS",
|
|
458
|
+
reason: "planner executed actions directly",
|
|
459
|
+
});
|
|
460
|
+
continuationRounds.delete(sessionId);
|
|
461
|
+
sessionCumulativeFailures.delete(sessionId);
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
464
|
+
// Log the planning entry now that the LLM has actually decided to spawn
|
|
465
|
+
const planEntry = logActivity({
|
|
466
|
+
source: "autonomous",
|
|
467
|
+
summary: `Planning ${blocks.length} agent(s) from ${actionable.length} backlog item(s)`,
|
|
468
|
+
actionLabel: "AUTONOMOUS",
|
|
469
|
+
reason: "15-min autonomous planner cycle",
|
|
470
|
+
});
|
|
471
|
+
const planTraceId = planEntry.traceId;
|
|
472
|
+
log.info(` Found ${blocks.length} AGENT_REQUEST block(s)`);
|
|
473
|
+
let spawnCount = 0;
|
|
474
|
+
const spawnedLabels = [];
|
|
475
|
+
for (const block of blocks) {
|
|
476
|
+
if (spawnCount >= MAX_AGENTS_PER_ROUND)
|
|
477
|
+
break;
|
|
478
|
+
const rawContent = block[1].trim();
|
|
479
|
+
let jsonStr = rawContent
|
|
480
|
+
.replace(/^`{3,}(?:json)?\s*/i, "")
|
|
481
|
+
.replace(/\s*`{3,}$/i, "")
|
|
482
|
+
.replace(/^`+|`+$/g, "");
|
|
483
|
+
const jsonMatch = jsonStr.match(/\{[\s\S]*\}/);
|
|
484
|
+
if (!jsonMatch) {
|
|
485
|
+
log.warn(` No JSON in AGENT_REQUEST block: ${rawContent.slice(0, 200)}`);
|
|
486
|
+
logActivity({ source: "autonomous", summary: `No JSON in AGENT_REQUEST block`, actionLabel: "AUTONOMOUS", reason: "planner output parse issue" });
|
|
487
|
+
continue;
|
|
488
|
+
}
|
|
489
|
+
try {
|
|
490
|
+
const req = JSON.parse(jsonMatch[0]);
|
|
491
|
+
if (!req.prompt) {
|
|
492
|
+
log.warn(` AGENT_REQUEST missing "prompt" field`);
|
|
493
|
+
continue;
|
|
494
|
+
}
|
|
495
|
+
const label = req.label || req.prompt.slice(0, 60);
|
|
496
|
+
let finalPrompt = req.prompt;
|
|
497
|
+
// Guard: dedup — skip if same work is already in progress or recently done
|
|
498
|
+
const dedup = await checkDedup(label, finalPrompt);
|
|
499
|
+
if (dedup.blocked) {
|
|
500
|
+
log.info(` Dedup guard blocked: "${label}" — ${dedup.reason}`);
|
|
501
|
+
recordDedupBlock(dedup.reason ?? "unknown");
|
|
502
|
+
logActivity({
|
|
503
|
+
source: "autonomous",
|
|
504
|
+
summary: `Skipped "${label}": ${dedup.reason}`,
|
|
505
|
+
actionLabel: "AUTONOMOUS",
|
|
506
|
+
reason: "dedup guard",
|
|
507
|
+
});
|
|
508
|
+
continue;
|
|
509
|
+
}
|
|
510
|
+
// Guard: detect vague prompts
|
|
511
|
+
const hasFilePath = /(?:src\/|brain\/|public\/|\.ts|\.js|\.md|\.json|\.yaml|\.yml)/.test(finalPrompt);
|
|
512
|
+
const isVague = /\b(?:comprehensive|robust|production-ready|enterprise|scalable|world-class)\b/i.test(finalPrompt)
|
|
513
|
+
&& !hasFilePath;
|
|
514
|
+
if (isVague) {
|
|
515
|
+
finalPrompt = [
|
|
516
|
+
`IMPORTANT: The original request is vague. Do NOT try to build everything listed.`,
|
|
517
|
+
`Instead: 1) Read the existing codebase (start with src/ and package.json).`,
|
|
518
|
+
`2) Pick ONE small, concrete piece you can implement that connects to existing code.`,
|
|
519
|
+
`3) Build that one thing well.`,
|
|
520
|
+
`4) If nothing concrete can be built without more requirements, create a brief spec at brain/knowledge/notes/.`,
|
|
521
|
+
``,
|
|
522
|
+
`Original request:`,
|
|
523
|
+
finalPrompt,
|
|
524
|
+
].join("\n");
|
|
525
|
+
}
|
|
526
|
+
// Track label→boardTaskId so we can cooldown on failure
|
|
527
|
+
if (req.taskId) {
|
|
528
|
+
labelToBoardTaskId.set(label, req.taskId);
|
|
529
|
+
}
|
|
530
|
+
spawnCount++;
|
|
531
|
+
spawnedLabels.push(label);
|
|
532
|
+
recordAutonomousAction();
|
|
533
|
+
log.info(` Spawning agent: ${label}`);
|
|
534
|
+
logActivity({ source: "autonomous", summary: `Spawning: ${label}`, backref: planTraceId, actionLabel: "AUTONOMOUS", reason: "planner selected from backlog" });
|
|
535
|
+
await submitTask({
|
|
536
|
+
label,
|
|
537
|
+
prompt: finalPrompt,
|
|
538
|
+
origin: "ai",
|
|
539
|
+
sessionId,
|
|
540
|
+
boardTaskId: req.taskId,
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
catch (err) {
|
|
544
|
+
log.error(` AGENT_REQUEST parse error: ${err instanceof Error ? err.message : String(err)}`);
|
|
545
|
+
logActivity({
|
|
546
|
+
source: "autonomous",
|
|
547
|
+
summary: `AGENT_REQUEST parse error: ${err instanceof Error ? err.message : String(err)}`,
|
|
548
|
+
actionLabel: "AUTONOMOUS",
|
|
549
|
+
reason: "planner output parse error",
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
if (spawnCount > 0) {
|
|
554
|
+
const summary = `Working on ${spawnCount} task(s): ${spawnedLabels.join(", ")}`;
|
|
555
|
+
log.info(` ${summary}`);
|
|
556
|
+
logActivity({ source: "autonomous", summary, backref: planTraceId, actionLabel: "AUTONOMOUS", reason: "planner selected from backlog" });
|
|
557
|
+
pushNotification({
|
|
558
|
+
timestamp: new Date().toISOString(),
|
|
559
|
+
source: "autonomous",
|
|
560
|
+
message: summary,
|
|
561
|
+
});
|
|
562
|
+
}
|
|
563
|
+
else {
|
|
564
|
+
log.warn(` Found ${blocks.length} block(s) but spawned 0 agents`);
|
|
565
|
+
logActivity({ source: "autonomous", summary: "Parsed blocks but spawned 0 agents", actionLabel: "AUTONOMOUS", reason: "planner blocks had no valid agents" });
|
|
566
|
+
continuationRounds.delete(sessionId);
|
|
567
|
+
sessionCumulativeFailures.delete(sessionId);
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
catch (err) {
|
|
571
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
572
|
+
log.error(` LLM call failed: ${msg}`);
|
|
573
|
+
logActivity({ source: "autonomous", summary: `LLM call failed: ${msg}`, actionLabel: "AUTONOMOUS", reason: "15-min autonomous planner cycle" });
|
|
574
|
+
// Trip circuit breaker on credit/billing errors to stop hammering a dead API
|
|
575
|
+
const isCreditsIssue = (err instanceof LLMError && err.isCreditsError)
|
|
576
|
+
|| /402|credits|afford|payment.required|billing/i.test(msg);
|
|
577
|
+
if (isCreditsIssue) {
|
|
578
|
+
creditCircuitBreakerUntil = Date.now() + CREDIT_CIRCUIT_BREAKER_MS;
|
|
579
|
+
const breaker_msg = `API credits exhausted — autonomous work paused for ${CREDIT_CIRCUIT_BREAKER_MS / 60_000}min. Top up at openrouter.ai/settings/credits.`;
|
|
580
|
+
log.warn(breaker_msg);
|
|
581
|
+
logActivity({ source: "autonomous", summary: breaker_msg, actionLabel: "AUTONOMOUS", reason: "credit circuit breaker tripped" });
|
|
582
|
+
pushNotification({
|
|
583
|
+
timestamp: new Date().toISOString(),
|
|
584
|
+
source: "autonomous",
|
|
585
|
+
message: breaker_msg,
|
|
586
|
+
});
|
|
587
|
+
}
|
|
588
|
+
continuationRounds.delete(sessionId);
|
|
589
|
+
sessionCumulativeFailures.delete(sessionId);
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
// ─── Prompts ─────────────────────────────────────────────────────────────────
|
|
593
|
+
function getPlannerSystemPrompt() {
|
|
594
|
+
const capInstructions = getCapabilityRegistry()?.getPromptInstructions({ origin: "autonomous" }) ?? "";
|
|
595
|
+
return `You are ${getInstanceName()}'s autonomous work planner. Your job is to look at the backlog and decide what agents should work on next.
|
|
596
|
+
|
|
597
|
+
Rules:
|
|
598
|
+
- Pick 1-3 items from the backlog that are ready to implement NOW.
|
|
599
|
+
- Skip items that are vague specs or need human decisions — those need grooming first.
|
|
600
|
+
- Prefer items with clear titles and descriptions over ambiguous ones.
|
|
601
|
+
- Each agent gets ONE focused task. Don't bundle multiple items into one agent.
|
|
602
|
+
- Write clear, specific agent prompts with file paths when possible.
|
|
603
|
+
- If nothing is ready to implement, output NO [AGENT_REQUEST] blocks and explain why.
|
|
604
|
+
- DO NOT retry tasks that have already been attempted and failed. If the "Recent agent history" section shows a task was tried before, skip it unless you have a fundamentally different approach (not just "try again").
|
|
605
|
+
- If the same board item has failed multiple times, it probably needs human input or a spec change — skip it.
|
|
606
|
+
|
|
607
|
+
## Two types of actions
|
|
608
|
+
|
|
609
|
+
### 1. Code agents (for code/file tasks)
|
|
610
|
+
For tasks that require reading/writing code or files, output:
|
|
611
|
+
|
|
612
|
+
[AGENT_REQUEST]
|
|
613
|
+
{
|
|
614
|
+
"label": "Short descriptive name",
|
|
615
|
+
"prompt": "Detailed instructions for the agent. Reference specific files. Be concrete.",
|
|
616
|
+
"taskId": "the-task-id-from-the-board"
|
|
617
|
+
}
|
|
618
|
+
[/AGENT_REQUEST]
|
|
619
|
+
|
|
620
|
+
The agent runs \`claude --print --dangerously-skip-permissions\` in the project root.
|
|
621
|
+
It can read/write files, run npm commands, etc. Give it everything it needs to succeed independently.
|
|
622
|
+
After making changes, the agent should run \`npm run build\` to verify compilation.
|
|
623
|
+
|
|
624
|
+
### 2. Google Workspace actions (for calendar, email, docs tasks)
|
|
625
|
+
For tasks like scheduling meetings, sending emails, or creating documents, output action blocks directly — NO agent needed.
|
|
626
|
+
|
|
627
|
+
${capInstructions}
|
|
628
|
+
|
|
629
|
+
IMPORTANT: When a task says "schedule", "meeting", "calendar", "appointment" — use [CALENDAR_ACTION], not an agent.
|
|
630
|
+
When a task says "email", "send", "notify" — use [EMAIL_ACTION], not an agent.
|
|
631
|
+
After outputting the action block, also include the taskId so the task can be marked done:
|
|
632
|
+
[TASK_DONE]{"taskId": "the-task-id"}[/TASK_DONE]`;
|
|
633
|
+
}
|
|
634
|
+
async function buildPlannerPrompt(boardContext, priorContext) {
|
|
635
|
+
const parts = [];
|
|
636
|
+
parts.push(`Current time: ${new Date().toISOString()}`);
|
|
637
|
+
parts.push(``);
|
|
638
|
+
if (priorContext) {
|
|
639
|
+
parts.push(`## Previous batch results`);
|
|
640
|
+
parts.push(priorContext);
|
|
641
|
+
parts.push(``);
|
|
642
|
+
}
|
|
643
|
+
// Include recent agent history so the planner knows what's been tried
|
|
644
|
+
const historyContext = await buildAgentHistoryContext();
|
|
645
|
+
if (historyContext) {
|
|
646
|
+
parts.push(`## Recent agent history (last 24h)`);
|
|
647
|
+
parts.push(historyContext);
|
|
648
|
+
parts.push(``);
|
|
649
|
+
}
|
|
650
|
+
// Include currently cooling-down tasks
|
|
651
|
+
const cooldownContext = cooldownManager.getCooldownContext();
|
|
652
|
+
if (cooldownContext) {
|
|
653
|
+
parts.push(`## Tasks on cooldown (DO NOT assign these)`);
|
|
654
|
+
parts.push(cooldownContext);
|
|
655
|
+
parts.push(``);
|
|
656
|
+
}
|
|
657
|
+
parts.push(`## Actionable backlog items (unassigned, ready to work)`);
|
|
658
|
+
parts.push(boardContext);
|
|
659
|
+
parts.push(``);
|
|
660
|
+
parts.push(`Review these items and decide which ones to assign to agents. Output [AGENT_REQUEST] blocks for each.`);
|
|
661
|
+
parts.push(`If an item is too vague or needs human input, skip it and explain why.`);
|
|
662
|
+
return parts.join("\n");
|
|
663
|
+
}
|
|
664
|
+
/**
|
|
665
|
+
* Build a summary of recent agent task results so the planner can avoid
|
|
666
|
+
* re-attempting tasks that have already been tried and failed.
|
|
667
|
+
*
|
|
668
|
+
* Optimization: uses `since` filter to skip reading old task files from disk
|
|
669
|
+
* entirely (filename-embedded timestamps are checked before file read).
|
|
670
|
+
*/
|
|
671
|
+
async function buildAgentHistoryContext() {
|
|
672
|
+
try {
|
|
673
|
+
const cutoff = Date.now() - 24 * 60 * 60 * 1000; // last 24h
|
|
674
|
+
const tasks = await listAgentTasks({ since: cutoff });
|
|
675
|
+
const recent = tasks.filter((t) => {
|
|
676
|
+
const ts = t.finishedAt || t.createdAt;
|
|
677
|
+
return ts && new Date(ts).getTime() > cutoff;
|
|
678
|
+
});
|
|
679
|
+
if (recent.length === 0)
|
|
680
|
+
return null;
|
|
681
|
+
// Group by normalized label to show patterns
|
|
682
|
+
const byLabel = new Map();
|
|
683
|
+
for (const t of recent) {
|
|
684
|
+
const key = t.label.replace(/\d+/g, "N").slice(0, 60);
|
|
685
|
+
if (!byLabel.has(key))
|
|
686
|
+
byLabel.set(key, { completed: 0, failed: 0, labels: [] });
|
|
687
|
+
const entry = byLabel.get(key);
|
|
688
|
+
if (t.status === "completed")
|
|
689
|
+
entry.completed++;
|
|
690
|
+
else if (t.status === "failed")
|
|
691
|
+
entry.failed++;
|
|
692
|
+
if (!entry.labels.includes(t.label))
|
|
693
|
+
entry.labels.push(t.label);
|
|
694
|
+
}
|
|
695
|
+
const lines = [];
|
|
696
|
+
for (const [key, info] of byLabel) {
|
|
697
|
+
const status = [];
|
|
698
|
+
if (info.completed > 0)
|
|
699
|
+
status.push(`${info.completed} completed`);
|
|
700
|
+
if (info.failed > 0)
|
|
701
|
+
status.push(`${info.failed} FAILED`);
|
|
702
|
+
lines.push(`- "${info.labels[0]}": ${status.join(", ")}`);
|
|
703
|
+
}
|
|
704
|
+
return lines.join("\n");
|
|
705
|
+
}
|
|
706
|
+
catch {
|
|
707
|
+
return null;
|
|
708
|
+
}
|
|
709
|
+
}
|
|
710
|
+
//# sourceMappingURL=autonomous.js.map
|