@elizaos/agent 2.0.0-alpha.144 → 2.0.0-alpha.151
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/apps/app-lifeops/src/actions/inbox-digest.d.ts +2 -0
- package/apps/app-lifeops/src/actions/inbox-digest.d.ts.map +1 -0
- package/apps/app-lifeops/src/actions/inbox-digest.js +1 -0
- package/apps/app-lifeops/src/actions/inbox-respond.d.ts +2 -0
- package/apps/app-lifeops/src/actions/inbox-respond.d.ts.map +1 -0
- package/apps/app-lifeops/src/actions/inbox-respond.js +1 -0
- package/apps/app-lifeops/src/actions/inbox-triage.d.ts +2 -0
- package/apps/app-lifeops/src/actions/inbox-triage.d.ts.map +1 -0
- package/apps/app-lifeops/src/actions/inbox-triage.js +1 -0
- package/apps/app-lifeops/src/actions/inbox.d.ts +3 -0
- package/apps/app-lifeops/src/actions/inbox.d.ts.map +1 -0
- package/apps/app-lifeops/src/actions/inbox.js +856 -0
- package/apps/app-lifeops/src/actions/update-owner-profile.d.ts +3 -0
- package/apps/app-lifeops/src/actions/update-owner-profile.d.ts.map +1 -0
- package/apps/app-lifeops/src/actions/update-owner-profile.js +131 -0
- package/apps/app-lifeops/src/inbox/channel-deep-links.d.ts.map +1 -0
- package/apps/app-lifeops/src/inbox/config.d.ts.map +1 -0
- package/{packages/agent → apps/app-lifeops}/src/inbox/config.js +1 -1
- package/apps/app-lifeops/src/inbox/message-fetcher.d.ts.map +1 -0
- package/apps/app-lifeops/src/inbox/reflection.d.ts.map +1 -0
- package/apps/app-lifeops/src/inbox/repository.d.ts.map +1 -0
- package/apps/app-lifeops/src/inbox/triage-classifier.d.ts.map +1 -0
- package/apps/app-lifeops/src/inbox/types.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/index.d.ts +25 -0
- package/apps/app-lifeops/src/lifeops/index.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/index.js +24 -0
- package/apps/app-lifeops/src/lifeops/screen-context.d.ts +52 -0
- package/apps/app-lifeops/src/lifeops/screen-context.d.ts.map +1 -0
- package/apps/app-lifeops/src/lifeops/screen-context.js +332 -0
- package/apps/app-lifeops/src/plugin.d.ts +3 -0
- package/apps/app-lifeops/src/plugin.d.ts.map +1 -1
- package/apps/app-lifeops/src/plugin.js +16 -3
- package/apps/app-lifeops/src/providers/inbox-triage.d.ts +3 -0
- package/apps/app-lifeops/src/providers/inbox-triage.d.ts.map +1 -0
- package/apps/app-lifeops/src/providers/inbox-triage.js +89 -0
- package/package.json +6 -4
- package/packages/agent/src/actions/calendar.d.ts +1 -18
- package/packages/agent/src/actions/calendar.d.ts.map +1 -1
- package/packages/agent/src/actions/calendar.js +1 -3143
- package/packages/agent/src/actions/check-balance.d.ts +17 -0
- package/packages/agent/src/actions/check-balance.d.ts.map +1 -0
- package/packages/agent/src/actions/check-balance.js +167 -0
- package/packages/agent/src/actions/connector-resolver.d.ts +75 -0
- package/packages/agent/src/actions/connector-resolver.d.ts.map +1 -0
- package/packages/agent/src/actions/connector-resolver.js +245 -0
- package/packages/agent/src/actions/context-signal-lexicon.d.ts +1 -1
- package/packages/agent/src/actions/context-signal-lexicon.d.ts.map +1 -1
- package/packages/agent/src/actions/context-signal-lexicon.js +6 -0
- package/packages/agent/src/actions/eject-plugin.d.ts +3 -0
- package/packages/agent/src/actions/eject-plugin.d.ts.map +1 -0
- package/packages/agent/src/actions/eject-plugin.js +48 -0
- package/packages/agent/src/actions/execute-trade.d.ts +17 -0
- package/packages/agent/src/actions/execute-trade.d.ts.map +1 -0
- package/packages/agent/src/actions/execute-trade.js +299 -0
- package/packages/agent/src/actions/get-self-status.d.ts +13 -0
- package/packages/agent/src/actions/get-self-status.d.ts.map +1 -0
- package/packages/agent/src/actions/get-self-status.js +66 -0
- package/packages/agent/src/actions/gmail.d.ts +1 -32
- package/packages/agent/src/actions/gmail.d.ts.map +1 -1
- package/packages/agent/src/actions/gmail.js +1 -1734
- package/packages/agent/src/actions/inbox-digest.d.ts +1 -1
- package/packages/agent/src/actions/inbox-digest.d.ts.map +1 -1
- package/packages/agent/src/actions/inbox-digest.js +1 -1
- package/packages/agent/src/actions/inbox-respond.d.ts +1 -1
- package/packages/agent/src/actions/inbox-respond.d.ts.map +1 -1
- package/packages/agent/src/actions/inbox-respond.js +1 -1
- package/packages/agent/src/actions/inbox-triage.d.ts +1 -1
- package/packages/agent/src/actions/inbox-triage.d.ts.map +1 -1
- package/packages/agent/src/actions/inbox-triage.js +1 -1
- package/packages/agent/src/actions/inbox.d.ts +1 -2
- package/packages/agent/src/actions/inbox.d.ts.map +1 -1
- package/packages/agent/src/actions/inbox.js +1 -856
- package/packages/agent/src/actions/index.d.ts +13 -0
- package/packages/agent/src/actions/index.d.ts.map +1 -1
- package/packages/agent/src/actions/index.js +13 -0
- package/packages/agent/src/actions/install-plugin.d.ts +3 -0
- package/packages/agent/src/actions/install-plugin.d.ts.map +1 -0
- package/packages/agent/src/actions/install-plugin.js +65 -0
- package/packages/agent/src/actions/life-goal-extractor.d.ts +1 -68
- package/packages/agent/src/actions/life-goal-extractor.d.ts.map +1 -1
- package/packages/agent/src/actions/life-goal-extractor.js +1 -354
- package/packages/agent/src/actions/life-param-extractor.d.ts +1 -77
- package/packages/agent/src/actions/life-param-extractor.d.ts.map +1 -1
- package/packages/agent/src/actions/life-param-extractor.js +1 -423
- package/packages/agent/src/actions/life-recent-context.d.ts +1 -8
- package/packages/agent/src/actions/life-recent-context.d.ts.map +1 -1
- package/packages/agent/src/actions/life-recent-context.js +1 -84
- package/packages/agent/src/actions/life-update-extractor.d.ts +1 -26
- package/packages/agent/src/actions/life-update-extractor.d.ts.map +1 -1
- package/packages/agent/src/actions/life-update-extractor.js +1 -195
- package/packages/agent/src/actions/life.d.ts +1 -8
- package/packages/agent/src/actions/life.d.ts.map +1 -1
- package/packages/agent/src/actions/life.extractor.d.ts +1 -17
- package/packages/agent/src/actions/life.extractor.d.ts.map +1 -1
- package/packages/agent/src/actions/life.extractor.js +1 -264
- package/packages/agent/src/actions/life.js +1 -3379
- package/packages/agent/src/actions/lifeops-extraction-config.d.ts +1 -15
- package/packages/agent/src/actions/lifeops-extraction-config.d.ts.map +1 -1
- package/packages/agent/src/actions/lifeops-extraction-config.js +1 -25
- package/packages/agent/src/actions/lifeops-google-helpers.d.ts +1 -61
- package/packages/agent/src/actions/lifeops-google-helpers.d.ts.map +1 -1
- package/packages/agent/src/actions/lifeops-google-helpers.js +1 -607
- package/packages/agent/src/actions/list-ejected.d.ts +3 -0
- package/packages/agent/src/actions/list-ejected.d.ts.map +1 -0
- package/packages/agent/src/actions/list-ejected.js +35 -0
- package/packages/agent/src/actions/log-level.d.ts +3 -0
- package/packages/agent/src/actions/log-level.d.ts.map +1 -0
- package/packages/agent/src/actions/log-level.js +125 -0
- package/packages/agent/src/actions/manage-tasks.d.ts.map +1 -1
- package/packages/agent/src/actions/manage-tasks.js +51 -15
- package/packages/agent/src/actions/media.d.ts +21 -0
- package/packages/agent/src/actions/media.d.ts.map +1 -0
- package/packages/agent/src/actions/media.js +384 -0
- package/packages/agent/src/actions/read-messages.d.ts +14 -0
- package/packages/agent/src/actions/read-messages.d.ts.map +1 -0
- package/packages/agent/src/actions/read-messages.js +228 -0
- package/packages/agent/src/actions/reinject-plugin.d.ts +3 -0
- package/packages/agent/src/actions/reinject-plugin.d.ts.map +1 -0
- package/packages/agent/src/actions/reinject-plugin.js +47 -0
- package/packages/agent/src/actions/send-message.d.ts +0 -7
- package/packages/agent/src/actions/send-message.d.ts.map +1 -1
- package/packages/agent/src/actions/send-message.js +170 -49
- package/packages/agent/src/actions/sync-plugin.d.ts +3 -0
- package/packages/agent/src/actions/sync-plugin.d.ts.map +1 -0
- package/packages/agent/src/actions/sync-plugin.js +47 -0
- package/packages/agent/src/actions/timezone-normalization.d.ts +1 -2
- package/packages/agent/src/actions/timezone-normalization.d.ts.map +1 -1
- package/packages/agent/src/actions/timezone-normalization.js +1 -107
- package/packages/agent/src/actions/transfer-token.d.ts +17 -0
- package/packages/agent/src/actions/transfer-token.d.ts.map +1 -0
- package/packages/agent/src/actions/transfer-token.js +470 -0
- package/packages/agent/src/actions/update-owner-profile.d.ts +1 -2
- package/packages/agent/src/actions/update-owner-profile.d.ts.map +1 -1
- package/packages/agent/src/actions/update-owner-profile.js +1 -131
- package/packages/agent/src/actions/wallet-action-shared.d.ts +15 -0
- package/packages/agent/src/actions/wallet-action-shared.d.ts.map +1 -0
- package/packages/agent/src/actions/wallet-action-shared.js +24 -0
- package/packages/agent/src/api/agent-admin-routes.d.ts.map +1 -1
- package/packages/agent/src/api/agent-admin-routes.js +1 -1
- package/packages/agent/src/api/binance-skill-helpers.d.ts.map +1 -1
- package/packages/agent/src/api/binance-skill-helpers.js +8 -3
- package/packages/agent/src/api/chat-routes.d.ts.map +1 -1
- package/packages/agent/src/api/chat-routes.js +20 -5
- package/packages/agent/src/api/coding-agents-auth-sanitize.d.ts +1 -22
- package/packages/agent/src/api/coding-agents-auth-sanitize.d.ts.map +1 -1
- package/packages/agent/src/api/coding-agents-auth-sanitize.js +1 -39
- package/packages/agent/src/api/coding-agents-preflight-normalize.d.ts +1 -28
- package/packages/agent/src/api/coding-agents-preflight-normalize.d.ts.map +1 -1
- package/packages/agent/src/api/coding-agents-preflight-normalize.js +1 -45
- package/packages/agent/src/api/coordinator-types.d.ts +1 -46
- package/packages/agent/src/api/coordinator-types.d.ts.map +1 -1
- package/packages/agent/src/api/coordinator-types.js +1 -1
- package/packages/agent/src/api/coordinator-wiring.d.ts +1 -45
- package/packages/agent/src/api/coordinator-wiring.d.ts.map +1 -1
- package/packages/agent/src/api/coordinator-wiring.js +1 -108
- package/packages/agent/src/api/index.d.ts +1 -1
- package/packages/agent/src/api/index.d.ts.map +1 -1
- package/packages/agent/src/api/index.js +1 -1
- package/packages/agent/src/api/lifeops-browser-packaging.d.ts +1 -15
- package/packages/agent/src/api/lifeops-browser-packaging.d.ts.map +1 -1
- package/packages/agent/src/api/lifeops-browser-packaging.js +1 -305
- package/packages/agent/src/api/lifeops-routes.d.ts +1 -19
- package/packages/agent/src/api/lifeops-routes.d.ts.map +1 -1
- package/packages/agent/src/api/lifeops-routes.js +1 -1173
- package/packages/agent/src/api/server.d.ts.map +1 -1
- package/packages/agent/src/api/server.js +6 -6
- package/packages/agent/src/api/task-agent-message-routing.d.ts +1 -9
- package/packages/agent/src/api/task-agent-message-routing.d.ts.map +1 -1
- package/packages/agent/src/api/task-agent-message-routing.js +1 -62
- package/packages/agent/src/api/website-blocker-routes.d.ts +1 -6
- package/packages/agent/src/api/website-blocker-routes.d.ts.map +1 -1
- package/packages/agent/src/api/website-blocker-routes.js +1 -174
- package/packages/agent/src/config/types.agent-defaults.d.ts +1 -1
- package/packages/agent/src/config/types.agent-defaults.d.ts.map +1 -1
- package/packages/agent/src/evals/coordinator-eval-client.d.ts +1 -38
- package/packages/agent/src/evals/coordinator-eval-client.d.ts.map +1 -1
- package/packages/agent/src/evals/coordinator-eval-client.js +1 -138
- package/packages/agent/src/evals/coordinator-live-runner.d.ts +1 -56
- package/packages/agent/src/evals/coordinator-live-runner.d.ts.map +1 -1
- package/packages/agent/src/evals/coordinator-live-runner.js +1 -546
- package/packages/agent/src/evals/coordinator-preflight.d.ts +1 -31
- package/packages/agent/src/evals/coordinator-preflight.d.ts.map +1 -1
- package/packages/agent/src/evals/coordinator-preflight.js +1 -296
- package/packages/agent/src/evals/coordinator-scenarios.d.ts +1 -23
- package/packages/agent/src/evals/coordinator-scenarios.d.ts.map +1 -1
- package/packages/agent/src/evals/coordinator-scenarios.js +1 -1141
- package/packages/agent/src/lifeops/app-state.d.ts +1 -10
- package/packages/agent/src/lifeops/app-state.d.ts.map +1 -1
- package/packages/agent/src/lifeops/app-state.js +1 -32
- package/packages/agent/src/lifeops/apple-reminders.d.ts +1 -57
- package/packages/agent/src/lifeops/apple-reminders.d.ts.map +1 -1
- package/packages/agent/src/lifeops/apple-reminders.js +1 -325
- package/packages/agent/src/lifeops/defaults.d.ts +1 -23
- package/packages/agent/src/lifeops/defaults.d.ts.map +1 -1
- package/packages/agent/src/lifeops/defaults.js +1 -205
- package/packages/agent/src/lifeops/engine.d.ts +1 -7
- package/packages/agent/src/lifeops/engine.d.ts.map +1 -1
- package/packages/agent/src/lifeops/engine.js +1 -389
- package/packages/agent/src/lifeops/goal-grounding.d.ts +1 -53
- package/packages/agent/src/lifeops/goal-grounding.d.ts.map +1 -1
- package/packages/agent/src/lifeops/goal-grounding.js +1 -147
- package/packages/agent/src/lifeops/goal-semantic-evaluator.d.ts +1 -11
- package/packages/agent/src/lifeops/goal-semantic-evaluator.d.ts.map +1 -1
- package/packages/agent/src/lifeops/goal-semantic-evaluator.js +1 -154
- package/packages/agent/src/lifeops/google-api-error.d.ts +1 -6
- package/packages/agent/src/lifeops/google-api-error.d.ts.map +1 -1
- package/packages/agent/src/lifeops/google-api-error.js +1 -35
- package/packages/agent/src/lifeops/google-calendar.d.ts +1 -52
- package/packages/agent/src/lifeops/google-calendar.d.ts.map +1 -1
- package/packages/agent/src/lifeops/google-calendar.js +1 -268
- package/packages/agent/src/lifeops/google-connector-gateway.d.ts +1 -18
- package/packages/agent/src/lifeops/google-connector-gateway.d.ts.map +1 -1
- package/packages/agent/src/lifeops/google-connector-gateway.js +1 -65
- package/packages/agent/src/lifeops/google-fetch.d.ts +1 -10
- package/packages/agent/src/lifeops/google-fetch.d.ts.map +1 -1
- package/packages/agent/src/lifeops/google-fetch.js +1 -85
- package/packages/agent/src/lifeops/google-gmail.d.ts +1 -53
- package/packages/agent/src/lifeops/google-gmail.d.ts.map +1 -1
- package/packages/agent/src/lifeops/google-gmail.js +1 -471
- package/packages/agent/src/lifeops/google-managed-client.d.ts +1 -126
- package/packages/agent/src/lifeops/google-managed-client.d.ts.map +1 -1
- package/packages/agent/src/lifeops/google-managed-client.js +1 -294
- package/packages/agent/src/lifeops/google-oauth.d.ts +1 -60
- package/packages/agent/src/lifeops/google-oauth.d.ts.map +1 -1
- package/packages/agent/src/lifeops/google-oauth.js +1 -494
- package/packages/agent/src/lifeops/google-scopes.d.ts +1 -12
- package/packages/agent/src/lifeops/google-scopes.d.ts.map +1 -1
- package/packages/agent/src/lifeops/google-scopes.js +1 -96
- package/packages/agent/src/lifeops/index.d.ts +1 -2
- package/packages/agent/src/lifeops/index.d.ts.map +1 -1
- package/packages/agent/src/lifeops/index.js +1 -2
- package/packages/agent/src/lifeops/owner-profile.d.ts +1 -14
- package/packages/agent/src/lifeops/owner-profile.d.ts.map +1 -1
- package/packages/agent/src/lifeops/owner-profile.js +1 -194
- package/packages/agent/src/lifeops/repository.d.ts +1 -208
- package/packages/agent/src/lifeops/repository.d.ts.map +1 -1
- package/packages/agent/src/lifeops/repository.js +1 -3187
- package/packages/agent/src/lifeops/runtime.d.ts +1 -13
- package/packages/agent/src/lifeops/runtime.d.ts.map +1 -1
- package/packages/agent/src/lifeops/runtime.js +1 -120
- package/packages/agent/src/lifeops/screen-context.d.ts +1 -51
- package/packages/agent/src/lifeops/screen-context.d.ts.map +1 -1
- package/packages/agent/src/lifeops/screen-context.js +1 -332
- package/packages/agent/src/lifeops/seed-routines.d.ts +1 -19
- package/packages/agent/src/lifeops/seed-routines.d.ts.map +1 -1
- package/packages/agent/src/lifeops/seed-routines.js +1 -111
- package/packages/agent/src/lifeops/service.d.ts +1 -274
- package/packages/agent/src/lifeops/service.d.ts.map +1 -1
- package/packages/agent/src/lifeops/service.js +1 -9260
- package/packages/agent/src/lifeops/sql.d.ts +1 -30
- package/packages/agent/src/lifeops/sql.d.ts.map +1 -1
- package/packages/agent/src/lifeops/sql.js +1 -247
- package/packages/agent/src/lifeops/time.d.ts +1 -16
- package/packages/agent/src/lifeops/time.d.ts.map +1 -1
- package/packages/agent/src/lifeops/time.js +1 -132
- package/packages/agent/src/lifeops/twilio.d.ts +1 -24
- package/packages/agent/src/lifeops/twilio.d.ts.map +1 -1
- package/packages/agent/src/lifeops/twilio.js +1 -157
- package/packages/agent/src/lifeops/x-poster.d.ts +1 -18
- package/packages/agent/src/lifeops/x-poster.d.ts.map +1 -1
- package/packages/agent/src/lifeops/x-poster.js +1 -148
- package/packages/agent/src/providers/inbox-triage.d.ts +1 -2
- package/packages/agent/src/providers/inbox-triage.d.ts.map +1 -1
- package/packages/agent/src/providers/inbox-triage.js +1 -89
- package/packages/agent/src/providers/index.d.ts +4 -1
- package/packages/agent/src/providers/index.d.ts.map +1 -1
- package/packages/agent/src/providers/index.js +4 -1
- package/packages/agent/src/providers/lifeops.d.ts +1 -2
- package/packages/agent/src/providers/lifeops.d.ts.map +1 -1
- package/packages/agent/src/providers/lifeops.js +1 -157
- package/packages/agent/src/providers/local-models.d.ts +118 -0
- package/packages/agent/src/providers/local-models.d.ts.map +1 -0
- package/packages/agent/src/providers/local-models.js +427 -0
- package/packages/agent/src/providers/media-provider.d.ts +192 -0
- package/packages/agent/src/providers/media-provider.d.ts.map +1 -0
- package/packages/agent/src/providers/media-provider.js +1088 -0
- package/packages/agent/src/providers/self-status.d.ts +4 -0
- package/packages/agent/src/providers/self-status.d.ts.map +1 -0
- package/packages/agent/src/providers/self-status.js +12 -0
- package/packages/agent/src/providers/tasks.d.ts.map +1 -1
- package/packages/agent/src/providers/tasks.js +7 -7
- package/packages/agent/src/runtime/core-plugins.js +1 -1
- package/packages/agent/src/runtime/eliza-plugin.d.ts.map +1 -1
- package/packages/agent/src/runtime/eliza-plugin.js +1 -7
- package/packages/agent/src/runtime/eliza.js +2 -2
- package/packages/agent/src/runtime/plugin-collector.js +3 -3
- package/packages/agent/src/runtime/plugin-lifecycle.d.ts.map +1 -1
- package/packages/agent/src/runtime/plugin-lifecycle.js +3 -13
- package/packages/agent/src/runtime/trajectory-internals.d.ts.map +1 -1
- package/packages/agent/src/runtime/trajectory-internals.js +1 -3
- package/packages/agent/src/services/built-in-app-routes/hyperscape.d.ts.map +1 -1
- package/packages/agent/src/services/coding-task-executor.d.ts +3 -3
- package/packages/agent/src/services/coding-task-executor.js +3 -3
- package/packages/shared/src/awareness/index.d.ts +2 -0
- package/packages/shared/src/awareness/index.d.ts.map +1 -0
- package/packages/shared/src/awareness/index.js +1 -0
- package/packages/shared/src/awareness/registry.d.ts +27 -0
- package/packages/shared/src/awareness/registry.d.ts.map +1 -0
- package/packages/shared/src/awareness/registry.js +161 -0
- package/packages/shared/src/i18n/generated/validation-keyword-data.d.ts +24 -0
- package/packages/shared/src/i18n/generated/validation-keyword-data.d.ts.map +1 -1
- package/packages/shared/src/i18n/generated/validation-keyword-data.js +24 -0
- package/packages/shared/src/runtime-env.d.ts.map +1 -1
- package/packages/shared/src/runtime-env.js +5 -1
- package/packages/typescript/src/generated/action-docs.d.ts +135 -0
- package/packages/typescript/src/generated/action-docs.d.ts.map +1 -1
- package/packages/typescript/src/generated/action-docs.js +237 -0
- package/packages/typescript/src/i18n/generated/validation-keyword-data.d.ts +24 -0
- package/packages/typescript/src/i18n/generated/validation-keyword-data.d.ts.map +1 -1
- package/packages/typescript/src/i18n/generated/validation-keyword-data.js +24 -0
- package/packages/typescript/src/index.node.d.ts +2 -2
- package/packages/typescript/src/index.node.d.ts.map +1 -1
- package/packages/typescript/src/index.node.js +4 -3
- package/packages/typescript/src/plugin-lifecycle.d.ts.map +1 -1
- package/packages/typescript/src/plugin-lifecycle.js +42 -3
- package/packages/typescript/src/services/message.d.ts.map +1 -1
- package/packages/typescript/src/services/message.js +32 -0
- package/apps/app-training/src/core/cli.d.ts +0 -11
- package/apps/app-training/src/core/cli.d.ts.map +0 -1
- package/apps/app-training/src/core/cli.js +0 -302
- package/apps/app-training/src/core/context-audit.d.ts +0 -51
- package/apps/app-training/src/core/context-audit.d.ts.map +0 -1
- package/apps/app-training/src/core/context-audit.js +0 -141
- package/apps/app-training/src/core/context-catalog.d.ts +0 -47
- package/apps/app-training/src/core/context-catalog.d.ts.map +0 -1
- package/apps/app-training/src/core/context-catalog.js +0 -259
- package/apps/app-training/src/core/context-types.d.ts +0 -3
- package/apps/app-training/src/core/context-types.d.ts.map +0 -1
- package/apps/app-training/src/core/context-types.js +0 -11
- package/apps/app-training/src/core/dataset-generator.d.ts +0 -135
- package/apps/app-training/src/core/dataset-generator.d.ts.map +0 -1
- package/apps/app-training/src/core/dataset-generator.js +0 -703
- package/apps/app-training/src/core/replay-validator.d.ts +0 -96
- package/apps/app-training/src/core/replay-validator.d.ts.map +0 -1
- package/apps/app-training/src/core/replay-validator.js +0 -265
- package/apps/app-training/src/core/roleplay-executor.d.ts +0 -123
- package/apps/app-training/src/core/roleplay-executor.d.ts.map +0 -1
- package/apps/app-training/src/core/roleplay-executor.js +0 -645
- package/apps/app-training/src/core/roleplay-trajectories.d.ts +0 -54
- package/apps/app-training/src/core/roleplay-trajectories.d.ts.map +0 -1
- package/apps/app-training/src/core/roleplay-trajectories.js +0 -73
- package/apps/app-training/src/core/scenario-blueprints.d.ts +0 -62
- package/apps/app-training/src/core/scenario-blueprints.d.ts.map +0 -1
- package/apps/app-training/src/core/scenario-blueprints.js +0 -790
- package/apps/app-training/src/core/trajectory-task-datasets.d.ts +0 -38
- package/apps/app-training/src/core/trajectory-task-datasets.d.ts.map +0 -1
- package/apps/app-training/src/core/trajectory-task-datasets.js +0 -281
- package/apps/app-training/src/core/vertex-tuning.d.ts +0 -139
- package/apps/app-training/src/core/vertex-tuning.d.ts.map +0 -1
- package/apps/app-training/src/core/vertex-tuning.js +0 -234
- package/packages/agent/src/inbox/channel-deep-links.d.ts.map +0 -1
- package/packages/agent/src/inbox/config.d.ts.map +0 -1
- package/packages/agent/src/inbox/message-fetcher.d.ts.map +0 -1
- package/packages/agent/src/inbox/reflection.d.ts.map +0 -1
- package/packages/agent/src/inbox/repository.d.ts.map +0 -1
- package/packages/agent/src/inbox/triage-classifier.d.ts.map +0 -1
- package/packages/agent/src/inbox/types.d.ts.map +0 -1
- package/packages/agent/src/training/cli.d.ts +0 -2
- package/packages/agent/src/training/cli.d.ts.map +0 -1
- package/packages/agent/src/training/cli.js +0 -2
- package/packages/agent/src/training/context-audit.d.ts +0 -2
- package/packages/agent/src/training/context-audit.d.ts.map +0 -1
- package/packages/agent/src/training/context-audit.js +0 -2
- package/packages/agent/src/training/context-catalog.d.ts +0 -2
- package/packages/agent/src/training/context-catalog.d.ts.map +0 -1
- package/packages/agent/src/training/context-catalog.js +0 -2
- package/packages/agent/src/training/context-types.d.ts +0 -2
- package/packages/agent/src/training/context-types.d.ts.map +0 -1
- package/packages/agent/src/training/context-types.js +0 -2
- package/packages/agent/src/training/dataset-generator.d.ts +0 -2
- package/packages/agent/src/training/dataset-generator.d.ts.map +0 -1
- package/packages/agent/src/training/dataset-generator.js +0 -2
- package/packages/agent/src/training/replay-validator.d.ts +0 -2
- package/packages/agent/src/training/replay-validator.d.ts.map +0 -1
- package/packages/agent/src/training/replay-validator.js +0 -2
- package/packages/agent/src/training/roleplay-executor.d.ts +0 -2
- package/packages/agent/src/training/roleplay-executor.d.ts.map +0 -1
- package/packages/agent/src/training/roleplay-executor.js +0 -2
- package/packages/agent/src/training/roleplay-trajectories.d.ts +0 -2
- package/packages/agent/src/training/roleplay-trajectories.d.ts.map +0 -1
- package/packages/agent/src/training/roleplay-trajectories.js +0 -2
- package/packages/agent/src/training/scenario-blueprints.d.ts +0 -2
- package/packages/agent/src/training/scenario-blueprints.d.ts.map +0 -1
- package/packages/agent/src/training/scenario-blueprints.js +0 -2
- package/packages/agent/src/training/trajectory-task-datasets.d.ts +0 -2
- package/packages/agent/src/training/trajectory-task-datasets.d.ts.map +0 -1
- package/packages/agent/src/training/trajectory-task-datasets.js +0 -2
- package/packages/agent/src/training/vertex-tuning.d.ts +0 -2
- package/packages/agent/src/training/vertex-tuning.d.ts.map +0 -1
- package/packages/agent/src/training/vertex-tuning.js +0 -2
- package/packages/typescript/src/features/orchestrator/actions/coding-task-handlers.d.ts +0 -41
- package/packages/typescript/src/features/orchestrator/actions/coding-task-handlers.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/actions/coding-task-handlers.js +0 -443
- package/packages/typescript/src/features/orchestrator/actions/coding-task-helpers.d.ts +0 -34
- package/packages/typescript/src/features/orchestrator/actions/coding-task-helpers.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/actions/coding-task-helpers.js +0 -171
- package/packages/typescript/src/features/orchestrator/actions/eval-metadata.d.ts +0 -11
- package/packages/typescript/src/features/orchestrator/actions/eval-metadata.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/actions/eval-metadata.js +0 -55
- package/packages/typescript/src/features/orchestrator/actions/finalize-workspace.d.ts +0 -11
- package/packages/typescript/src/features/orchestrator/actions/finalize-workspace.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/actions/finalize-workspace.js +0 -214
- package/packages/typescript/src/features/orchestrator/actions/list-agents.d.ts +0 -13
- package/packages/typescript/src/features/orchestrator/actions/list-agents.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/actions/list-agents.js +0 -174
- package/packages/typescript/src/features/orchestrator/actions/manage-issues.d.ts +0 -11
- package/packages/typescript/src/features/orchestrator/actions/manage-issues.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/actions/manage-issues.js +0 -428
- package/packages/typescript/src/features/orchestrator/actions/provision-workspace.d.ts +0 -11
- package/packages/typescript/src/features/orchestrator/actions/provision-workspace.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/actions/provision-workspace.js +0 -189
- package/packages/typescript/src/features/orchestrator/actions/send-to-agent.d.ts +0 -12
- package/packages/typescript/src/features/orchestrator/actions/send-to-agent.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/actions/send-to-agent.js +0 -265
- package/packages/typescript/src/features/orchestrator/actions/spawn-agent.d.ts +0 -12
- package/packages/typescript/src/features/orchestrator/actions/spawn-agent.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/actions/spawn-agent.js +0 -356
- package/packages/typescript/src/features/orchestrator/actions/start-coding-task.d.ts +0 -22
- package/packages/typescript/src/features/orchestrator/actions/start-coding-task.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/actions/start-coding-task.js +0 -270
- package/packages/typescript/src/features/orchestrator/actions/stop-agent.d.ts +0 -12
- package/packages/typescript/src/features/orchestrator/actions/stop-agent.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/actions/stop-agent.js +0 -192
- package/packages/typescript/src/features/orchestrator/actions/task-control.d.ts +0 -3
- package/packages/typescript/src/features/orchestrator/actions/task-control.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/actions/task-control.js +0 -217
- package/packages/typescript/src/features/orchestrator/actions/task-history.d.ts +0 -3
- package/packages/typescript/src/features/orchestrator/actions/task-history.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/actions/task-history.js +0 -323
- package/packages/typescript/src/features/orchestrator/actions/task-share.d.ts +0 -3
- package/packages/typescript/src/features/orchestrator/actions/task-share.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/actions/task-share.js +0 -168
- package/packages/typescript/src/features/orchestrator/actions/task-thread-target.d.ts +0 -11
- package/packages/typescript/src/features/orchestrator/actions/task-thread-target.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/actions/task-thread-target.js +0 -68
- package/packages/typescript/src/features/orchestrator/api/agent-routes.d.ts +0 -18
- package/packages/typescript/src/features/orchestrator/api/agent-routes.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/api/agent-routes.js +0 -654
- package/packages/typescript/src/features/orchestrator/api/coordinator-routes.d.ts +0 -22
- package/packages/typescript/src/features/orchestrator/api/coordinator-routes.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/api/coordinator-routes.js +0 -403
- package/packages/typescript/src/features/orchestrator/api/hook-routes.d.ts +0 -18
- package/packages/typescript/src/features/orchestrator/api/hook-routes.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/api/hook-routes.js +0 -164
- package/packages/typescript/src/features/orchestrator/api/issue-routes.d.ts +0 -17
- package/packages/typescript/src/features/orchestrator/api/issue-routes.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/api/issue-routes.js +0 -132
- package/packages/typescript/src/features/orchestrator/api/routes.d.ts +0 -37
- package/packages/typescript/src/features/orchestrator/api/routes.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/api/routes.js +0 -96
- package/packages/typescript/src/features/orchestrator/api/workspace-routes.d.ts +0 -17
- package/packages/typescript/src/features/orchestrator/api/workspace-routes.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/api/workspace-routes.js +0 -149
- package/packages/typescript/src/features/orchestrator/base-plugin.d.ts +0 -19
- package/packages/typescript/src/features/orchestrator/base-plugin.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/base-plugin.js +0 -75
- package/packages/typescript/src/features/orchestrator/claude-jsonl-completion-watcher.d.ts +0 -101
- package/packages/typescript/src/features/orchestrator/claude-jsonl-completion-watcher.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/claude-jsonl-completion-watcher.js +0 -310
- package/packages/typescript/src/features/orchestrator/index.d.ts +0 -33
- package/packages/typescript/src/features/orchestrator/index.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/index.js +0 -30
- package/packages/typescript/src/features/orchestrator/patch-agent-orchestrator-plugin.d.ts +0 -15
- package/packages/typescript/src/features/orchestrator/patch-agent-orchestrator-plugin.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/patch-agent-orchestrator-plugin.js +0 -1449
- package/packages/typescript/src/features/orchestrator/providers/action-examples.d.ts +0 -14
- package/packages/typescript/src/features/orchestrator/providers/action-examples.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/providers/action-examples.js +0 -151
- package/packages/typescript/src/features/orchestrator/providers/active-workspace-context.d.ts +0 -13
- package/packages/typescript/src/features/orchestrator/providers/active-workspace-context.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/providers/active-workspace-context.js +0 -142
- package/packages/typescript/src/features/orchestrator/services/agent-credentials.d.ts +0 -6
- package/packages/typescript/src/features/orchestrator/services/agent-credentials.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/services/agent-credentials.js +0 -91
- package/packages/typescript/src/features/orchestrator/services/agent-metrics.d.ts +0 -30
- package/packages/typescript/src/features/orchestrator/services/agent-metrics.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/services/agent-metrics.js +0 -54
- package/packages/typescript/src/features/orchestrator/services/agent-selection.d.ts +0 -53
- package/packages/typescript/src/features/orchestrator/services/agent-selection.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/services/agent-selection.js +0 -70
- package/packages/typescript/src/features/orchestrator/services/ansi-utils.d.ts +0 -61
- package/packages/typescript/src/features/orchestrator/services/ansi-utils.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/services/ansi-utils.js +0 -252
- package/packages/typescript/src/features/orchestrator/services/config-env.d.ts +0 -13
- package/packages/typescript/src/features/orchestrator/services/config-env.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/services/config-env.js +0 -37
- package/packages/typescript/src/features/orchestrator/services/coordinator-event-normalizer.d.ts +0 -50
- package/packages/typescript/src/features/orchestrator/services/coordinator-event-normalizer.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/services/coordinator-event-normalizer.js +0 -184
- package/packages/typescript/src/features/orchestrator/services/debug-capture.d.ts +0 -38
- package/packages/typescript/src/features/orchestrator/services/debug-capture.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/services/debug-capture.js +0 -113
- package/packages/typescript/src/features/orchestrator/services/pty-auto-response.d.ts +0 -30
- package/packages/typescript/src/features/orchestrator/services/pty-auto-response.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/services/pty-auto-response.js +0 -146
- package/packages/typescript/src/features/orchestrator/services/pty-init.d.ts +0 -54
- package/packages/typescript/src/features/orchestrator/services/pty-init.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/services/pty-init.js +0 -315
- package/packages/typescript/src/features/orchestrator/services/pty-service.d.ts +0 -175
- package/packages/typescript/src/features/orchestrator/services/pty-service.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/services/pty-service.js +0 -1469
- package/packages/typescript/src/features/orchestrator/services/pty-session-io.d.ts +0 -49
- package/packages/typescript/src/features/orchestrator/services/pty-session-io.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/services/pty-session-io.js +0 -180
- package/packages/typescript/src/features/orchestrator/services/pty-spawn.d.ts +0 -53
- package/packages/typescript/src/features/orchestrator/services/pty-spawn.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/services/pty-spawn.js +0 -280
- package/packages/typescript/src/features/orchestrator/services/pty-types.d.ts +0 -80
- package/packages/typescript/src/features/orchestrator/services/pty-types.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/services/pty-types.js +0 -51
- package/packages/typescript/src/features/orchestrator/services/repo-input.d.ts +0 -16
- package/packages/typescript/src/features/orchestrator/services/repo-input.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/services/repo-input.js +0 -88
- package/packages/typescript/src/features/orchestrator/services/stall-classifier.d.ts +0 -69
- package/packages/typescript/src/features/orchestrator/services/stall-classifier.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/services/stall-classifier.js +0 -446
- package/packages/typescript/src/features/orchestrator/services/swarm-coordinator-prompts.d.ts +0 -97
- package/packages/typescript/src/features/orchestrator/services/swarm-coordinator-prompts.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/services/swarm-coordinator-prompts.js +0 -342
- package/packages/typescript/src/features/orchestrator/services/swarm-coordinator.d.ts +0 -421
- package/packages/typescript/src/features/orchestrator/services/swarm-coordinator.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/services/swarm-coordinator.js +0 -2356
- package/packages/typescript/src/features/orchestrator/services/swarm-decision-loop.d.ts +0 -52
- package/packages/typescript/src/features/orchestrator/services/swarm-decision-loop.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/services/swarm-decision-loop.js +0 -1538
- package/packages/typescript/src/features/orchestrator/services/swarm-event-triage.d.ts +0 -49
- package/packages/typescript/src/features/orchestrator/services/swarm-event-triage.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/services/swarm-event-triage.js +0 -171
- package/packages/typescript/src/features/orchestrator/services/swarm-history.d.ts +0 -27
- package/packages/typescript/src/features/orchestrator/services/swarm-history.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/services/swarm-history.js +0 -148
- package/packages/typescript/src/features/orchestrator/services/swarm-idle-watchdog.d.ts +0 -22
- package/packages/typescript/src/features/orchestrator/services/swarm-idle-watchdog.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/services/swarm-idle-watchdog.js +0 -265
- package/packages/typescript/src/features/orchestrator/services/task-acceptance.d.ts +0 -8
- package/packages/typescript/src/features/orchestrator/services/task-acceptance.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/services/task-acceptance.js +0 -114
- package/packages/typescript/src/features/orchestrator/services/task-agent-auth.d.ts +0 -68
- package/packages/typescript/src/features/orchestrator/services/task-agent-auth.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/services/task-agent-auth.js +0 -559
- package/packages/typescript/src/features/orchestrator/services/task-agent-frameworks.d.ts +0 -82
- package/packages/typescript/src/features/orchestrator/services/task-agent-frameworks.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/services/task-agent-frameworks.js +0 -738
- package/packages/typescript/src/features/orchestrator/services/task-kind.d.ts +0 -3
- package/packages/typescript/src/features/orchestrator/services/task-kind.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/services/task-kind.js +0 -40
- package/packages/typescript/src/features/orchestrator/services/task-policy.d.ts +0 -17
- package/packages/typescript/src/features/orchestrator/services/task-policy.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/services/task-policy.js +0 -226
- package/packages/typescript/src/features/orchestrator/services/task-registry.d.ts +0 -550
- package/packages/typescript/src/features/orchestrator/services/task-registry.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/services/task-registry.js +0 -2182
- package/packages/typescript/src/features/orchestrator/services/task-share.d.ts +0 -18
- package/packages/typescript/src/features/orchestrator/services/task-share.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/services/task-share.js +0 -159
- package/packages/typescript/src/features/orchestrator/services/task-validation.d.ts +0 -69
- package/packages/typescript/src/features/orchestrator/services/task-validation.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/services/task-validation.js +0 -587
- package/packages/typescript/src/features/orchestrator/services/task-verifier-runner.d.ts +0 -5
- package/packages/typescript/src/features/orchestrator/services/task-verifier-runner.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/services/task-verifier-runner.js +0 -372
- package/packages/typescript/src/features/orchestrator/services/trajectory-context.d.ts +0 -73
- package/packages/typescript/src/features/orchestrator/services/trajectory-context.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/services/trajectory-context.js +0 -64
- package/packages/typescript/src/features/orchestrator/services/trajectory-feedback.d.ts +0 -53
- package/packages/typescript/src/features/orchestrator/services/trajectory-feedback.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/services/trajectory-feedback.js +0 -260
- package/packages/typescript/src/features/orchestrator/services/workspace-git-ops.d.ts +0 -28
- package/packages/typescript/src/features/orchestrator/services/workspace-git-ops.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/services/workspace-git-ops.js +0 -105
- package/packages/typescript/src/features/orchestrator/services/workspace-github.d.ts +0 -58
- package/packages/typescript/src/features/orchestrator/services/workspace-github.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/services/workspace-github.js +0 -139
- package/packages/typescript/src/features/orchestrator/services/workspace-lifecycle.d.ts +0 -18
- package/packages/typescript/src/features/orchestrator/services/workspace-lifecycle.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/services/workspace-lifecycle.js +0 -86
- package/packages/typescript/src/features/orchestrator/services/workspace-service.d.ts +0 -118
- package/packages/typescript/src/features/orchestrator/services/workspace-service.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/services/workspace-service.js +0 -533
- package/packages/typescript/src/features/orchestrator/services/workspace-types.d.ts +0 -81
- package/packages/typescript/src/features/orchestrator/services/workspace-types.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/services/workspace-types.js +0 -8
- package/packages/typescript/src/features/orchestrator/task-progress-streamer.d.ts +0 -38
- package/packages/typescript/src/features/orchestrator/task-progress-streamer.d.ts.map +0 -1
- package/packages/typescript/src/features/orchestrator/task-progress-streamer.js +0 -293
- /package/{packages/agent → apps/app-lifeops}/src/inbox/channel-deep-links.d.ts +0 -0
- /package/{packages/agent → apps/app-lifeops}/src/inbox/channel-deep-links.js +0 -0
- /package/{packages/agent → apps/app-lifeops}/src/inbox/config.d.ts +0 -0
- /package/{packages/agent → apps/app-lifeops}/src/inbox/message-fetcher.d.ts +0 -0
- /package/{packages/agent → apps/app-lifeops}/src/inbox/message-fetcher.js +0 -0
- /package/{packages/agent → apps/app-lifeops}/src/inbox/reflection.d.ts +0 -0
- /package/{packages/agent → apps/app-lifeops}/src/inbox/reflection.js +0 -0
- /package/{packages/agent → apps/app-lifeops}/src/inbox/repository.d.ts +0 -0
- /package/{packages/agent → apps/app-lifeops}/src/inbox/repository.js +0 -0
- /package/{packages/agent → apps/app-lifeops}/src/inbox/triage-classifier.d.ts +0 -0
- /package/{packages/agent → apps/app-lifeops}/src/inbox/triage-classifier.js +0 -0
- /package/{packages/agent → apps/app-lifeops}/src/inbox/types.d.ts +0 -0
- /package/{packages/agent → apps/app-lifeops}/src/inbox/types.js +0 -0
|
@@ -1,1449 +0,0 @@
|
|
|
1
|
-
import { execFileSync } from "node:child_process";
|
|
2
|
-
import fs from "node:fs";
|
|
3
|
-
import os from "node:os";
|
|
4
|
-
import path from "node:path";
|
|
5
|
-
import { createCodingAgentRouteHandler as baseCreateCodingAgentRouteHandler } from "./api/routes.js";
|
|
6
|
-
import { taskAgentPluginBase } from "./base-plugin.js";
|
|
7
|
-
import { installClaudeJsonlCompletionWatcher } from "./claude-jsonl-completion-watcher.js";
|
|
8
|
-
import { getCoordinator as getCoordinatorFromPty, PTYService, } from "./services/pty-service.js";
|
|
9
|
-
import { CodingWorkspaceService } from "./services/workspace-service.js";
|
|
10
|
-
import { installTaskProgressStreamer } from "./task-progress-streamer.js";
|
|
11
|
-
const basePlugin = taskAgentPluginBase;
|
|
12
|
-
const baseProviderMap = new Map((basePlugin.providers ?? []).map((provider) => [provider.name, provider]));
|
|
13
|
-
const baseActionMap = new Map((basePlugin.actions ?? []).map((action) => [action.name, action]));
|
|
14
|
-
const FRAMEWORK_LABELS = {
|
|
15
|
-
claude: "Claude Code",
|
|
16
|
-
codex: "Codex",
|
|
17
|
-
gemini: "Gemini CLI",
|
|
18
|
-
aider: "Aider",
|
|
19
|
-
pi: "Pi",
|
|
20
|
-
};
|
|
21
|
-
const STANDARD_FRAMEWORKS = ["claude", "codex", "gemini", "aider"];
|
|
22
|
-
const TASK_AGENT_STRONG_HINT_RE = /\b(repo|repository|codebase|coding|debug|fix|implement|refactor|workspace|parallel|delegate|subtask|sub-agent|subagent|agent|orchestrate|coordinate|pull request|pr\b|branch|commit|background task)\b/i;
|
|
23
|
-
const TASK_AGENT_WEAK_HINT_RE = /\b(investigate|research|analyze|analysis|summarize|summary|write|draft|document|plan|workflow|automation|compare|test|tests)\b/i;
|
|
24
|
-
const NON_TASK_ASSISTANT_QUERY_RE = /\b(calendar|schedule|event|events|meeting|meetings|appointment|appointments|gmail|email|emails|inbox|lifeops|flight|flights|travel|trip|today|tomorrow|tonight|this week|next week|remind|reminder|task|habit)\b/i;
|
|
25
|
-
let frameworkStateCache;
|
|
26
|
-
let patched = false;
|
|
27
|
-
function uniqueStrings(values) {
|
|
28
|
-
const seen = new Set();
|
|
29
|
-
const result = [];
|
|
30
|
-
for (const value of values) {
|
|
31
|
-
const trimmed = value?.trim();
|
|
32
|
-
if (!trimmed || seen.has(trimmed))
|
|
33
|
-
continue;
|
|
34
|
-
seen.add(trimmed);
|
|
35
|
-
result.push(trimmed);
|
|
36
|
-
}
|
|
37
|
-
return result;
|
|
38
|
-
}
|
|
39
|
-
function readJsonFile(filePath) {
|
|
40
|
-
try {
|
|
41
|
-
return JSON.parse(fs.readFileSync(filePath, "utf8"));
|
|
42
|
-
}
|
|
43
|
-
catch {
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
function extractOauthAccessToken(value) {
|
|
48
|
-
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
49
|
-
return;
|
|
50
|
-
const record = value;
|
|
51
|
-
const direct = record.accessToken ?? record.access_token;
|
|
52
|
-
if (typeof direct === "string" && direct.trim()) {
|
|
53
|
-
return direct.trim();
|
|
54
|
-
}
|
|
55
|
-
for (const nested of Object.values(record)) {
|
|
56
|
-
const token = extractOauthAccessToken(nested);
|
|
57
|
-
if (token)
|
|
58
|
-
return token;
|
|
59
|
-
}
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
function resolveElizaConfigPath() {
|
|
63
|
-
const explicit = process.env.ELIZA_CONFIG_PATH?.trim();
|
|
64
|
-
if (explicit)
|
|
65
|
-
return explicit;
|
|
66
|
-
const stateDir = process.env.ELIZA_STATE_DIR?.trim() || path.join(os.homedir(), ".eliza");
|
|
67
|
-
const namespace = process.env.ELIZA_NAMESPACE?.trim();
|
|
68
|
-
const filename = namespace ? `${namespace}.json` : "eliza.json";
|
|
69
|
-
return path.join(stateDir, filename);
|
|
70
|
-
}
|
|
71
|
-
function readConfiguredSubscriptionProvider() {
|
|
72
|
-
const config = readJsonFile(resolveElizaConfigPath());
|
|
73
|
-
if (!config || typeof config !== "object" || Array.isArray(config))
|
|
74
|
-
return;
|
|
75
|
-
const agents = config.agents;
|
|
76
|
-
if (!agents || typeof agents !== "object" || Array.isArray(agents))
|
|
77
|
-
return;
|
|
78
|
-
const defaults = agents.defaults;
|
|
79
|
-
if (!defaults || typeof defaults !== "object" || Array.isArray(defaults))
|
|
80
|
-
return;
|
|
81
|
-
const provider = defaults.subscriptionProvider;
|
|
82
|
-
return typeof provider === "string" && provider.trim()
|
|
83
|
-
? provider.trim()
|
|
84
|
-
: undefined;
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Read a key from the env section of the eliza config file. The settings UI writes here,
|
|
88
|
-
* and we want changes to take effect without restart, so we read the file
|
|
89
|
-
* directly instead of relying on the runtime's in-memory character settings.
|
|
90
|
-
*/
|
|
91
|
-
function readElizaEnvKey(key) {
|
|
92
|
-
const config = readJsonFile(resolveElizaConfigPath());
|
|
93
|
-
if (!config || typeof config !== "object" || Array.isArray(config))
|
|
94
|
-
return;
|
|
95
|
-
const env = config.env;
|
|
96
|
-
if (!env || typeof env !== "object" || Array.isArray(env))
|
|
97
|
-
return;
|
|
98
|
-
const value = env[key];
|
|
99
|
-
return typeof value === "string" && value.trim() ? value.trim() : undefined;
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Read the cloud.apiKey from the eliza config file. Used to detect when Eliza Cloud is
|
|
103
|
-
* paired so cloud-mode auth can mark Anthropic/OpenAI agents as ready.
|
|
104
|
-
*/
|
|
105
|
-
function readElizaCloudApiKey() {
|
|
106
|
-
const config = readJsonFile(resolveElizaConfigPath());
|
|
107
|
-
if (!config || typeof config !== "object" || Array.isArray(config))
|
|
108
|
-
return;
|
|
109
|
-
const cloud = config.cloud;
|
|
110
|
-
if (!cloud || typeof cloud !== "object" || Array.isArray(cloud))
|
|
111
|
-
return;
|
|
112
|
-
const apiKey = cloud.apiKey;
|
|
113
|
-
return typeof apiKey === "string" && apiKey.trim()
|
|
114
|
-
? apiKey.trim()
|
|
115
|
-
: undefined;
|
|
116
|
-
}
|
|
117
|
-
function hasClaudeSubscriptionAuth() {
|
|
118
|
-
const config = readJsonFile(resolveElizaConfigPath());
|
|
119
|
-
if (config && typeof config === "object" && !Array.isArray(config)) {
|
|
120
|
-
const env = config.env;
|
|
121
|
-
if (env && typeof env === "object" && !Array.isArray(env)) {
|
|
122
|
-
const setupToken = env
|
|
123
|
-
.__anthropicSubscriptionToken;
|
|
124
|
-
if (typeof setupToken === "string" && setupToken.trim()) {
|
|
125
|
-
return true;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
const storedPath = path.join(process.env.ELIZA_HOME || path.join(os.homedir(), ".eliza"), "auth", "anthropic-subscription.json");
|
|
130
|
-
const stored = readJsonFile(storedPath);
|
|
131
|
-
if (stored && typeof stored === "object" && !Array.isArray(stored)) {
|
|
132
|
-
const credentials = stored.credentials;
|
|
133
|
-
if (credentials &&
|
|
134
|
-
typeof credentials === "object" &&
|
|
135
|
-
!Array.isArray(credentials)) {
|
|
136
|
-
const expires = credentials.expires;
|
|
137
|
-
if (typeof expires === "number" && expires > Date.now()) {
|
|
138
|
-
return true;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
const credentialsPath = path.join(os.homedir(), ".claude", ".credentials.json");
|
|
143
|
-
const fileToken = extractOauthAccessToken(readJsonFile(credentialsPath));
|
|
144
|
-
if (fileToken)
|
|
145
|
-
return true;
|
|
146
|
-
if (process.platform !== "darwin")
|
|
147
|
-
return false;
|
|
148
|
-
try {
|
|
149
|
-
const raw = execFileSync("security", ["find-generic-password", "-s", "Claude Code-credentials", "-w"], { encoding: "utf8", timeout: 3000, stdio: ["ignore", "pipe", "ignore"] }).trim();
|
|
150
|
-
if (!raw)
|
|
151
|
-
return false;
|
|
152
|
-
return Boolean(extractOauthAccessToken(JSON.parse(raw)));
|
|
153
|
-
}
|
|
154
|
-
catch {
|
|
155
|
-
return false;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
function hasCodexSubscriptionAuth() {
|
|
159
|
-
const storedPath = path.join(process.env.ELIZA_HOME || path.join(os.homedir(), ".eliza"), "auth", "openai-codex.json");
|
|
160
|
-
const stored = readJsonFile(storedPath);
|
|
161
|
-
if (stored && typeof stored === "object" && !Array.isArray(stored)) {
|
|
162
|
-
const credentials = stored.credentials;
|
|
163
|
-
if (credentials &&
|
|
164
|
-
typeof credentials === "object" &&
|
|
165
|
-
!Array.isArray(credentials)) {
|
|
166
|
-
const expires = credentials.expires;
|
|
167
|
-
if (typeof expires === "number" && expires > Date.now()) {
|
|
168
|
-
return true;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
const authPath = path.join(os.homedir(), ".codex", "auth.json");
|
|
173
|
-
const auth = readJsonFile(authPath);
|
|
174
|
-
if (!auth || typeof auth !== "object" || Array.isArray(auth))
|
|
175
|
-
return false;
|
|
176
|
-
const key = auth.OPENAI_API_KEY;
|
|
177
|
-
const authMode = auth.auth_mode;
|
|
178
|
-
return (typeof key === "string" &&
|
|
179
|
-
key.trim().length > 0 &&
|
|
180
|
-
typeof authMode === "string" &&
|
|
181
|
-
authMode.trim().toLowerCase() !== "api-key");
|
|
182
|
-
}
|
|
183
|
-
function hasAnthropicApiCredential() {
|
|
184
|
-
return Boolean(process.env.ANTHROPIC_API_KEY?.trim());
|
|
185
|
-
}
|
|
186
|
-
function hasOpenAIApiCredential() {
|
|
187
|
-
return Boolean(process.env.OPENAI_API_KEY?.trim());
|
|
188
|
-
}
|
|
189
|
-
function hasGeminiCredential() {
|
|
190
|
-
return Boolean(process.env.GOOGLE_GENERATIVE_AI_API_KEY?.trim() ||
|
|
191
|
-
process.env.GOOGLE_API_KEY?.trim());
|
|
192
|
-
}
|
|
193
|
-
function hasPiBinary() {
|
|
194
|
-
const command = process.platform === "win32" ? "where" : "which";
|
|
195
|
-
const args = process.platform === "win32" ? ["pi.exe"] : ["pi"];
|
|
196
|
-
try {
|
|
197
|
-
execFileSync(command, args, {
|
|
198
|
-
encoding: "utf8",
|
|
199
|
-
timeout: 1500,
|
|
200
|
-
stdio: ["ignore", "pipe", "ignore"],
|
|
201
|
-
});
|
|
202
|
-
return true;
|
|
203
|
-
}
|
|
204
|
-
catch {
|
|
205
|
-
return false;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
function normalizePreflightAdapterId(value) {
|
|
209
|
-
if (typeof value !== "string")
|
|
210
|
-
return undefined;
|
|
211
|
-
const normalized = value.trim().toLowerCase();
|
|
212
|
-
switch (normalized) {
|
|
213
|
-
case "claude":
|
|
214
|
-
case "claude code":
|
|
215
|
-
return "claude";
|
|
216
|
-
case "codex":
|
|
217
|
-
case "openai codex":
|
|
218
|
-
return "codex";
|
|
219
|
-
case "gemini":
|
|
220
|
-
case "google gemini":
|
|
221
|
-
return "gemini";
|
|
222
|
-
case "aider":
|
|
223
|
-
return "aider";
|
|
224
|
-
default:
|
|
225
|
-
return undefined;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
async function computeFrameworkState(runtime, ptyService) {
|
|
229
|
-
const configuredSubscriptionProvider = readConfiguredSubscriptionProvider();
|
|
230
|
-
const preflightRecords = new Map();
|
|
231
|
-
if (ptyService) {
|
|
232
|
-
try {
|
|
233
|
-
const results = await ptyService.checkAvailableAgents([
|
|
234
|
-
"claude",
|
|
235
|
-
"codex",
|
|
236
|
-
"gemini",
|
|
237
|
-
"aider",
|
|
238
|
-
]);
|
|
239
|
-
// checkAvailableAgents returns `result.adapter` as the human-readable
|
|
240
|
-
// display name (e.g. "Claude Code", "OpenAI Codex"), not the lowercase
|
|
241
|
-
// ID. Map back to the canonical framework ID via case-insensitive
|
|
242
|
-
// substring match so the framework state correctly reports installed.
|
|
243
|
-
for (const result of results) {
|
|
244
|
-
const adapter = normalizePreflightAdapterId(result.adapter);
|
|
245
|
-
if (adapter) {
|
|
246
|
-
preflightRecords.set(adapter, result);
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
catch {
|
|
251
|
-
// Keep the provider/status surface alive even if preflight is temporarily unavailable.
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
// When the user has selected Eliza Cloud as the LLM provider and has a
|
|
255
|
-
// paired cloud.apiKey, treat Claude as fully auth-ready — it will route
|
|
256
|
-
// through the cloud proxy at spawn time. Eliza Cloud does NOT proxy
|
|
257
|
-
// Gemini, so cloud mode does not affect Gemini's auth state.
|
|
258
|
-
//
|
|
259
|
-
// Codex-through-Eliza-Cloud is intentionally NOT gated on `cloudReady`:
|
|
260
|
-
// the upstream responses-stream reconciliation (elizaOS/cloud#427) has
|
|
261
|
-
// not deployed yet, so marking Codex ready in cloud mode would mislead
|
|
262
|
-
// users into starting a session that hits a runtime failure with no
|
|
263
|
-
// explanation. Restore `cloudReady ||` on the codexReady line once
|
|
264
|
-
// cloud#427 + cloud#428 have shipped.
|
|
265
|
-
const llmProvider = readElizaEnvKey("PARALLAX_LLM_PROVIDER") || "subscription";
|
|
266
|
-
const cloudReady = llmProvider === "cloud" && Boolean(readElizaCloudApiKey());
|
|
267
|
-
const claudeSubscriptionReady = hasClaudeSubscriptionAuth();
|
|
268
|
-
const codexSubscriptionReady = hasCodexSubscriptionAuth();
|
|
269
|
-
const claudeReady = cloudReady || claudeSubscriptionReady || hasAnthropicApiCredential();
|
|
270
|
-
const codexReady = codexSubscriptionReady || hasOpenAIApiCredential();
|
|
271
|
-
const geminiReady = hasGeminiCredential();
|
|
272
|
-
const piReady = hasPiBinary();
|
|
273
|
-
const providerPrefersClaude = configuredSubscriptionProvider === "anthropic-subscription";
|
|
274
|
-
const providerPrefersCodex = configuredSubscriptionProvider === "openai-codex" ||
|
|
275
|
-
configuredSubscriptionProvider === "openai-subscription";
|
|
276
|
-
const frameworks = STANDARD_FRAMEWORKS.map((id) => {
|
|
277
|
-
const preflight = preflightRecords.get(id);
|
|
278
|
-
const installed = preflight?.installed === true;
|
|
279
|
-
const subscriptionReady = id === "claude"
|
|
280
|
-
? claudeSubscriptionReady
|
|
281
|
-
: id === "codex"
|
|
282
|
-
? codexSubscriptionReady
|
|
283
|
-
: false;
|
|
284
|
-
const authReady = id === "claude"
|
|
285
|
-
? claudeReady
|
|
286
|
-
: id === "codex"
|
|
287
|
-
? codexReady
|
|
288
|
-
: id === "gemini"
|
|
289
|
-
? geminiReady
|
|
290
|
-
: claudeSubscriptionReady ||
|
|
291
|
-
codexSubscriptionReady ||
|
|
292
|
-
hasAnthropicApiCredential() ||
|
|
293
|
-
hasOpenAIApiCredential() ||
|
|
294
|
-
geminiReady;
|
|
295
|
-
const reason = id === "claude" && subscriptionReady
|
|
296
|
-
? "ready to use the user's Claude subscription"
|
|
297
|
-
: id === "codex" && subscriptionReady
|
|
298
|
-
? "ready to use the user's OpenAI subscription"
|
|
299
|
-
: installed
|
|
300
|
-
? authReady
|
|
301
|
-
? "installed with credentials available"
|
|
302
|
-
: "installed but credentials were not detected"
|
|
303
|
-
: "CLI not detected";
|
|
304
|
-
return {
|
|
305
|
-
id,
|
|
306
|
-
label: FRAMEWORK_LABELS[id],
|
|
307
|
-
installed,
|
|
308
|
-
authReady,
|
|
309
|
-
subscriptionReady,
|
|
310
|
-
recommended: false,
|
|
311
|
-
reason,
|
|
312
|
-
installCommand: preflight?.installCommand,
|
|
313
|
-
docsUrl: preflight?.docsUrl,
|
|
314
|
-
};
|
|
315
|
-
});
|
|
316
|
-
frameworks.push({
|
|
317
|
-
id: "pi",
|
|
318
|
-
label: FRAMEWORK_LABELS.pi,
|
|
319
|
-
installed: piReady,
|
|
320
|
-
authReady: piReady,
|
|
321
|
-
subscriptionReady: false,
|
|
322
|
-
recommended: false,
|
|
323
|
-
reason: piReady ? "CLI detected" : "CLI not detected",
|
|
324
|
-
});
|
|
325
|
-
// Read PARALLAX_DEFAULT_AGENT_TYPE from the eliza config file first (the settings UI
|
|
326
|
-
// writes here, takes effect without restart) and fall back to runtime/env.
|
|
327
|
-
const explicitDefault = (readElizaEnvKey("PARALLAX_DEFAULT_AGENT_TYPE") ??
|
|
328
|
-
runtime.getSetting("PARALLAX_DEFAULT_AGENT_TYPE"))
|
|
329
|
-
?.trim()
|
|
330
|
-
.toLowerCase() ?? "";
|
|
331
|
-
let preferred;
|
|
332
|
-
const byId = new Map(frameworks.map((framework) => [framework.id, framework]));
|
|
333
|
-
if ((explicitDefault === "claude" ||
|
|
334
|
-
explicitDefault === "codex" ||
|
|
335
|
-
explicitDefault === "gemini" ||
|
|
336
|
-
explicitDefault === "aider" ||
|
|
337
|
-
explicitDefault === "pi") &&
|
|
338
|
-
byId.get(explicitDefault)?.installed) {
|
|
339
|
-
preferred = {
|
|
340
|
-
id: explicitDefault,
|
|
341
|
-
reason: "explicit PARALLAX_DEFAULT_AGENT_TYPE override",
|
|
342
|
-
};
|
|
343
|
-
}
|
|
344
|
-
else if (providerPrefersClaude &&
|
|
345
|
-
byId.get("claude")?.installed &&
|
|
346
|
-
claudeReady) {
|
|
347
|
-
preferred = {
|
|
348
|
-
id: "claude",
|
|
349
|
-
reason: "configured Claude subscription should drive Claude Code first",
|
|
350
|
-
};
|
|
351
|
-
}
|
|
352
|
-
else if (providerPrefersCodex &&
|
|
353
|
-
byId.get("codex")?.installed &&
|
|
354
|
-
codexReady) {
|
|
355
|
-
preferred = {
|
|
356
|
-
id: "codex",
|
|
357
|
-
reason: "configured OpenAI subscription should drive Codex first",
|
|
358
|
-
};
|
|
359
|
-
}
|
|
360
|
-
else if (byId.get("claude")?.installed && claudeReady) {
|
|
361
|
-
preferred = {
|
|
362
|
-
id: "claude",
|
|
363
|
-
reason: "Claude Code is installed and a Claude credential is available",
|
|
364
|
-
};
|
|
365
|
-
}
|
|
366
|
-
else if (byId.get("codex")?.installed && codexReady) {
|
|
367
|
-
preferred = {
|
|
368
|
-
id: "codex",
|
|
369
|
-
reason: "Codex is installed and an OpenAI credential is available",
|
|
370
|
-
};
|
|
371
|
-
}
|
|
372
|
-
else if (byId.get("gemini")?.installed && geminiReady) {
|
|
373
|
-
preferred = {
|
|
374
|
-
id: "gemini",
|
|
375
|
-
reason: "Gemini CLI is installed and a Google credential is available",
|
|
376
|
-
};
|
|
377
|
-
}
|
|
378
|
-
else {
|
|
379
|
-
const fallback = frameworks.find((framework) => framework.installed) ?? frameworks[0];
|
|
380
|
-
preferred = {
|
|
381
|
-
id: fallback.id,
|
|
382
|
-
reason: fallback.installed
|
|
383
|
-
? "best available installed framework"
|
|
384
|
-
: "default fallback while no task-agent CLI is installed",
|
|
385
|
-
};
|
|
386
|
-
}
|
|
387
|
-
for (const framework of frameworks) {
|
|
388
|
-
framework.recommended = framework.id === preferred.id;
|
|
389
|
-
}
|
|
390
|
-
return {
|
|
391
|
-
configuredSubscriptionProvider,
|
|
392
|
-
frameworks,
|
|
393
|
-
preferred,
|
|
394
|
-
};
|
|
395
|
-
}
|
|
396
|
-
async function getFrameworkState(runtime, ptyService) {
|
|
397
|
-
if (frameworkStateCache && frameworkStateCache.expiresAt > Date.now()) {
|
|
398
|
-
return frameworkStateCache.value;
|
|
399
|
-
}
|
|
400
|
-
const value = await computeFrameworkState(runtime, ptyService);
|
|
401
|
-
frameworkStateCache = {
|
|
402
|
-
expiresAt: Date.now() + 15_000,
|
|
403
|
-
value,
|
|
404
|
-
};
|
|
405
|
-
return value;
|
|
406
|
-
}
|
|
407
|
-
function formatFrameworkLine(framework) {
|
|
408
|
-
const parts = [
|
|
409
|
-
framework.installed ? "installed" : "not installed",
|
|
410
|
-
framework.authReady ? "credentials ready" : "credentials missing",
|
|
411
|
-
];
|
|
412
|
-
if (framework.subscriptionReady) {
|
|
413
|
-
parts.push("uses the user's subscription");
|
|
414
|
-
}
|
|
415
|
-
if (framework.recommended) {
|
|
416
|
-
parts.push("recommended");
|
|
417
|
-
}
|
|
418
|
-
return `- ${framework.label}: ${parts.join(", ")}. ${framework.reason}.`;
|
|
419
|
-
}
|
|
420
|
-
function looksLikeTaskRequest(text) {
|
|
421
|
-
if (NON_TASK_ASSISTANT_QUERY_RE.test(text)) {
|
|
422
|
-
return false;
|
|
423
|
-
}
|
|
424
|
-
return (TASK_AGENT_STRONG_HINT_RE.test(text) ||
|
|
425
|
-
(TASK_AGENT_WEAK_HINT_RE.test(text) &&
|
|
426
|
-
/\b(repo|repository|workspace|code|coding|sub-agent|subagent|agent|parallel|delegate|background)\b/i.test(text)));
|
|
427
|
-
}
|
|
428
|
-
function formatStatus(status) {
|
|
429
|
-
switch (status) {
|
|
430
|
-
case "ready":
|
|
431
|
-
return "idle";
|
|
432
|
-
case "busy":
|
|
433
|
-
return "working";
|
|
434
|
-
case "starting":
|
|
435
|
-
return "starting";
|
|
436
|
-
case "authenticating":
|
|
437
|
-
return "authenticating";
|
|
438
|
-
default:
|
|
439
|
-
return status;
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
function truncateText(text, max = 120) {
|
|
443
|
-
const trimmed = text.trim().replace(/\s+/g, " ");
|
|
444
|
-
return trimmed.length > max ? `${trimmed.slice(0, max - 1)}…` : trimmed;
|
|
445
|
-
}
|
|
446
|
-
function resolveCoordinator(runtime) {
|
|
447
|
-
const fromRuntime = runtime.getService("SWARM_COORDINATOR");
|
|
448
|
-
if (fromRuntime)
|
|
449
|
-
return fromRuntime;
|
|
450
|
-
const ptyService = runtime.getService("PTY_SERVICE");
|
|
451
|
-
if (ptyService?.coordinator) {
|
|
452
|
-
return ptyService.coordinator;
|
|
453
|
-
}
|
|
454
|
-
return getCoordinatorFromPty(runtime);
|
|
455
|
-
}
|
|
456
|
-
function getPtyService(runtime) {
|
|
457
|
-
const service = runtime.getService("PTY_SERVICE");
|
|
458
|
-
return service;
|
|
459
|
-
}
|
|
460
|
-
function getWorkspaceService(runtime) {
|
|
461
|
-
const service = runtime.getService("CODING_WORKSPACE_SERVICE");
|
|
462
|
-
return service;
|
|
463
|
-
}
|
|
464
|
-
function createTaskAgentExamplesProvider() {
|
|
465
|
-
const baseProvider = baseProviderMap.get("CODING_AGENT_EXAMPLES");
|
|
466
|
-
return {
|
|
467
|
-
name: "TASK_AGENT_EXAMPLES",
|
|
468
|
-
description: "Structured examples showing how to use open-ended task-agent actions, framework availability, and subscription-aware defaults",
|
|
469
|
-
position: baseProvider?.position ?? -1,
|
|
470
|
-
get: async (runtime, message, _state) => {
|
|
471
|
-
const userText = (typeof message.content === "string"
|
|
472
|
-
? message.content
|
|
473
|
-
: message.content?.text) ?? "";
|
|
474
|
-
const ptyService = getPtyService(runtime);
|
|
475
|
-
const frameworkState = await getFrameworkState(runtime, ptyService);
|
|
476
|
-
const frameworkLines = frameworkState.frameworks.map(formatFrameworkLine);
|
|
477
|
-
const taskLikeRequest = looksLikeTaskRequest(userText);
|
|
478
|
-
const compactText = [
|
|
479
|
-
"# Task Agent Availability",
|
|
480
|
-
"Task agents are for repo, workspace, coding, and other long-running background work.",
|
|
481
|
-
"Do not use CREATE_TASK, SPAWN_AGENT, or SEND_TO_AGENT for normal LifeOps, calendar, Gmail, scheduling, or other questions the main agent can answer directly.",
|
|
482
|
-
"",
|
|
483
|
-
`Recommended default right now: ${FRAMEWORK_LABELS[frameworkState.preferred.id]} (${frameworkState.preferred.reason}).`,
|
|
484
|
-
...(frameworkState.configuredSubscriptionProvider
|
|
485
|
-
? [
|
|
486
|
-
`Configured Eliza subscription provider: ${frameworkState.configuredSubscriptionProvider}. Prefer the matching user-backed CLI first so Eliza does not waste cloud chat capacity.`,
|
|
487
|
-
]
|
|
488
|
-
: []),
|
|
489
|
-
"",
|
|
490
|
-
"Current task-agent frameworks:",
|
|
491
|
-
...frameworkLines,
|
|
492
|
-
"",
|
|
493
|
-
"Canonical actions:",
|
|
494
|
-
"- CREATE_TASK: launch one or more background task agents against a repo, workspace, or explicit multi-step background task.",
|
|
495
|
-
"- SPAWN_AGENT: start a specific task agent in an existing workspace when you need direct control.",
|
|
496
|
-
"- SEND_TO_AGENT: reply to a running task agent or send keys to unblock it.",
|
|
497
|
-
"- LIST_AGENTS / STOP_AGENT: inspect or stop active task agents.",
|
|
498
|
-
].join("\n");
|
|
499
|
-
if (!taskLikeRequest) {
|
|
500
|
-
return {
|
|
501
|
-
data: {
|
|
502
|
-
preferredTaskAgent: frameworkState.preferred.id,
|
|
503
|
-
frameworks: frameworkState.frameworks,
|
|
504
|
-
},
|
|
505
|
-
values: { taskAgentExamples: compactText },
|
|
506
|
-
text: compactText,
|
|
507
|
-
};
|
|
508
|
-
}
|
|
509
|
-
const detailedText = [
|
|
510
|
-
compactText,
|
|
511
|
-
"",
|
|
512
|
-
"Examples:",
|
|
513
|
-
'User: "Investigate why the production login flow started returning 401s in https://github.com/acme/app and fix it."',
|
|
514
|
-
"Assistant:",
|
|
515
|
-
"<actions>",
|
|
516
|
-
" <action>REPLY</action>",
|
|
517
|
-
" <action>CREATE_TASK</action>",
|
|
518
|
-
"</actions>",
|
|
519
|
-
"<params>",
|
|
520
|
-
" <CREATE_TASK>",
|
|
521
|
-
" <repo>https://github.com/acme/app</repo>",
|
|
522
|
-
" <task>Investigate the production login 401s, implement the fix, run the relevant tests, and summarize the root cause.</task>",
|
|
523
|
-
" </CREATE_TASK>",
|
|
524
|
-
"</params>",
|
|
525
|
-
"",
|
|
526
|
-
'User: "Spin up a few sub-agents to research the current browser automation options, compare them, and draft a recommendation doc."',
|
|
527
|
-
"Assistant:",
|
|
528
|
-
"<actions>",
|
|
529
|
-
" <action>REPLY</action>",
|
|
530
|
-
" <action>CREATE_TASK</action>",
|
|
531
|
-
"</actions>",
|
|
532
|
-
"<params>",
|
|
533
|
-
" <CREATE_TASK>",
|
|
534
|
-
' <agents>Research Playwright tradeoffs and browser sandboxing. Your identifier is "research". | Compare Stagehand, Playwright, and browser-use for Eliza. Your identifier is "comparison". | Draft a recommendation memo in TASK_AGENTS.md using the findings. Your identifier is "writer".</agents>',
|
|
535
|
-
" </CREATE_TASK>",
|
|
536
|
-
"</params>",
|
|
537
|
-
"",
|
|
538
|
-
'User: "Tell the running sub-agent to accept that prompt and continue."',
|
|
539
|
-
"Assistant:",
|
|
540
|
-
"<actions>",
|
|
541
|
-
" <action>REPLY</action>",
|
|
542
|
-
" <action>SEND_TO_AGENT</action>",
|
|
543
|
-
"</actions>",
|
|
544
|
-
"<params>",
|
|
545
|
-
" <SEND_TO_AGENT>",
|
|
546
|
-
" <input>Yes, accept it and continue.</input>",
|
|
547
|
-
" </SEND_TO_AGENT>",
|
|
548
|
-
"</params>",
|
|
549
|
-
"",
|
|
550
|
-
"Guidance:",
|
|
551
|
-
"- Do not use task agents when the main agent can answer directly with built-in LifeOps, calendar, Gmail, or other connector actions.",
|
|
552
|
-
"- Prefer CREATE_TASK whenever the work is open-ended, multi-step, or can continue asynchronously.",
|
|
553
|
-
"- If the task references a real repository or prior workspace, include the repo/workspace context instead of dropping the agent into scratch space.",
|
|
554
|
-
"- Use multiple agents only when the subtasks are clearly separable and benefit from parallelism.",
|
|
555
|
-
].join("\n");
|
|
556
|
-
return {
|
|
557
|
-
data: {
|
|
558
|
-
preferredTaskAgent: frameworkState.preferred.id,
|
|
559
|
-
frameworks: frameworkState.frameworks,
|
|
560
|
-
},
|
|
561
|
-
values: { taskAgentExamples: detailedText },
|
|
562
|
-
text: detailedText,
|
|
563
|
-
};
|
|
564
|
-
},
|
|
565
|
-
};
|
|
566
|
-
}
|
|
567
|
-
function createActiveWorkspaceContextProvider() {
|
|
568
|
-
const baseProvider = baseProviderMap.get("ACTIVE_WORKSPACE_CONTEXT");
|
|
569
|
-
return {
|
|
570
|
-
name: "ACTIVE_WORKSPACE_CONTEXT",
|
|
571
|
-
description: "Live status of active workspaces, task-agent sessions, and current task progress",
|
|
572
|
-
position: baseProvider?.position ?? 1,
|
|
573
|
-
get: async (runtime, _message, _state) => {
|
|
574
|
-
const ptyService = getPtyService(runtime);
|
|
575
|
-
const workspaceService = getWorkspaceService(runtime);
|
|
576
|
-
const coordinator = resolveCoordinator(runtime);
|
|
577
|
-
const frameworkState = await getFrameworkState(runtime, ptyService);
|
|
578
|
-
const userText = (typeof _message.content === "string"
|
|
579
|
-
? _message.content
|
|
580
|
-
: _message.content?.text) ?? "";
|
|
581
|
-
const taskLikeRequest = looksLikeTaskRequest(userText);
|
|
582
|
-
const sessions = ptyService
|
|
583
|
-
? await Promise.race([
|
|
584
|
-
ptyService.listSessions(),
|
|
585
|
-
new Promise((resolve) => setTimeout(() => resolve([]), 2000)),
|
|
586
|
-
])
|
|
587
|
-
: [];
|
|
588
|
-
const workspaces = workspaceService?.listWorkspaces() ?? [];
|
|
589
|
-
const tasks = uniqueTaskList(coordinator?.getAllTaskContexts?.() ?? []);
|
|
590
|
-
const lines = ["# Active Workspaces & Task Agents"];
|
|
591
|
-
lines.push(`Preferred framework: ${FRAMEWORK_LABELS[frameworkState.preferred.id]} (${frameworkState.preferred.reason}).`);
|
|
592
|
-
if (workspaces.length === 0 &&
|
|
593
|
-
sessions.length === 0 &&
|
|
594
|
-
tasks.length === 0) {
|
|
595
|
-
lines.push("No active workspaces or task-agent sessions.");
|
|
596
|
-
if (taskLikeRequest) {
|
|
597
|
-
lines.push("Use CREATE_TASK when the user needs substantial repo or background work.");
|
|
598
|
-
}
|
|
599
|
-
else {
|
|
600
|
-
lines.push("Ignore this provider for direct calendar, Gmail, LifeOps, or other normal assistant questions.");
|
|
601
|
-
}
|
|
602
|
-
}
|
|
603
|
-
else {
|
|
604
|
-
if (workspaces.length > 0) {
|
|
605
|
-
lines.push("");
|
|
606
|
-
lines.push(`## Workspaces (${workspaces.length})`);
|
|
607
|
-
for (const workspace of workspaces) {
|
|
608
|
-
const workspaceSessions = sessions.filter((session) => session.workdir === workspace.path);
|
|
609
|
-
const agentSummary = workspaceSessions.length > 0
|
|
610
|
-
? workspaceSessions
|
|
611
|
-
.map((session) => `${session.agentType}:${formatStatus(session.status)}`)
|
|
612
|
-
.join(", ")
|
|
613
|
-
: "no task agents";
|
|
614
|
-
lines.push(`- "${workspace.label ?? workspace.id.slice(0, 8)}" -> ${workspace.repo ?? "scratch"} (${workspace.branch ?? "no branch"}, ${agentSummary})`);
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
const trackedPaths = new Set(workspaces.map((workspace) => workspace.path));
|
|
618
|
-
const standaloneSessions = sessions.filter((session) => !trackedPaths.has(session.workdir));
|
|
619
|
-
if (standaloneSessions.length > 0) {
|
|
620
|
-
lines.push("");
|
|
621
|
-
lines.push(`## Standalone Sessions (${standaloneSessions.length})`);
|
|
622
|
-
for (const session of standaloneSessions) {
|
|
623
|
-
const label = typeof session.metadata?.label === "string"
|
|
624
|
-
? session.metadata.label
|
|
625
|
-
: session.name;
|
|
626
|
-
lines.push(`- "${label}" (${session.agentType}, ${formatStatus(session.status)}) [session: ${session.id}]`);
|
|
627
|
-
}
|
|
628
|
-
}
|
|
629
|
-
if (tasks.length > 0) {
|
|
630
|
-
lines.push("");
|
|
631
|
-
lines.push(`## Current Task Status (${tasks.length})`);
|
|
632
|
-
for (const task of tasks
|
|
633
|
-
.slice()
|
|
634
|
-
.sort((left, right) => right.registeredAt - left.registeredAt)) {
|
|
635
|
-
const latestDecision = task.decisions.at(-1);
|
|
636
|
-
const detail = task.completionSummary ||
|
|
637
|
-
latestDecision?.reasoning ||
|
|
638
|
-
truncateText(task.originalTask, 110);
|
|
639
|
-
lines.push(`- [${task.status}] "${task.label}" (${task.agentType}) -> ${detail}`);
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
const pending = coordinator?.getPendingConfirmations?.() ?? [];
|
|
643
|
-
if (pending.length > 0) {
|
|
644
|
-
lines.push("");
|
|
645
|
-
lines.push(`## Pending Confirmations (${pending.length}) — supervision: ${coordinator?.getSupervisionLevel?.() ?? "unknown"}`);
|
|
646
|
-
for (const confirmation of pending) {
|
|
647
|
-
lines.push(`- "${confirmation.taskContext.label}" blocked on "${truncateText(confirmation.promptText, 140)}" -> suggested: ${confirmation.llmDecision.action ?? "review"}`);
|
|
648
|
-
}
|
|
649
|
-
}
|
|
650
|
-
}
|
|
651
|
-
if (sessions.length > 0 || tasks.length > 0) {
|
|
652
|
-
lines.push("");
|
|
653
|
-
lines.push("Use SEND_TO_AGENT to unblock a running agent, LIST_AGENTS to inspect progress, STOP_AGENT to cancel, and FINALIZE_WORKSPACE when the work should be published or wrapped up.");
|
|
654
|
-
}
|
|
655
|
-
const text = lines.join("\n");
|
|
656
|
-
return {
|
|
657
|
-
data: {
|
|
658
|
-
activeWorkspaces: workspaces,
|
|
659
|
-
activeSessions: sessions,
|
|
660
|
-
currentTasks: tasks,
|
|
661
|
-
preferredTaskAgent: frameworkState.preferred,
|
|
662
|
-
frameworks: frameworkState.frameworks,
|
|
663
|
-
},
|
|
664
|
-
values: { activeWorkspaceContext: text },
|
|
665
|
-
text,
|
|
666
|
-
};
|
|
667
|
-
},
|
|
668
|
-
};
|
|
669
|
-
}
|
|
670
|
-
function uniqueTaskList(tasks) {
|
|
671
|
-
const seen = new Set();
|
|
672
|
-
const result = [];
|
|
673
|
-
for (const task of tasks) {
|
|
674
|
-
if (seen.has(task.sessionId))
|
|
675
|
-
continue;
|
|
676
|
-
seen.add(task.sessionId);
|
|
677
|
-
result.push(task);
|
|
678
|
-
}
|
|
679
|
-
return result;
|
|
680
|
-
}
|
|
681
|
-
function patchAction(currentName, nextName, description, examples, extraSimiles = []) {
|
|
682
|
-
const action = baseActionMap.get(currentName);
|
|
683
|
-
if (!action)
|
|
684
|
-
return;
|
|
685
|
-
action.name = nextName;
|
|
686
|
-
action.description = description;
|
|
687
|
-
action.examples = examples;
|
|
688
|
-
action.similes = uniqueStrings([
|
|
689
|
-
currentName,
|
|
690
|
-
nextName,
|
|
691
|
-
...(action.similes ?? []),
|
|
692
|
-
...extraSimiles,
|
|
693
|
-
]);
|
|
694
|
-
baseActionMap.set(nextName, action);
|
|
695
|
-
}
|
|
696
|
-
function createActionExamples(userText, assistantText, actionName) {
|
|
697
|
-
return [
|
|
698
|
-
[
|
|
699
|
-
{
|
|
700
|
-
name: "{{user1}}",
|
|
701
|
-
content: {
|
|
702
|
-
text: userText,
|
|
703
|
-
},
|
|
704
|
-
},
|
|
705
|
-
{
|
|
706
|
-
name: "{{agentName}}",
|
|
707
|
-
content: {
|
|
708
|
-
text: assistantText,
|
|
709
|
-
action: actionName,
|
|
710
|
-
},
|
|
711
|
-
},
|
|
712
|
-
],
|
|
713
|
-
];
|
|
714
|
-
}
|
|
715
|
-
function wrapActionHandler(action, rewrite) {
|
|
716
|
-
if (!action?.handler)
|
|
717
|
-
return;
|
|
718
|
-
const originalHandler = action.handler.bind(action);
|
|
719
|
-
action.handler = async (runtime, message, state, options, callback) => originalHandler(runtime, message, state, options, callback
|
|
720
|
-
? async (content) => {
|
|
721
|
-
const nextContent = content && typeof content === "object" && "text" in content
|
|
722
|
-
? {
|
|
723
|
-
...content,
|
|
724
|
-
text: typeof content.text === "string"
|
|
725
|
-
? rewrite(content.text)
|
|
726
|
-
: content.text,
|
|
727
|
-
}
|
|
728
|
-
: content;
|
|
729
|
-
return callback(nextContent);
|
|
730
|
-
}
|
|
731
|
-
: undefined);
|
|
732
|
-
}
|
|
733
|
-
function renameTaskAgentText(text) {
|
|
734
|
-
return text
|
|
735
|
-
.replace(/\bcoding agents\b/gi, "task agents")
|
|
736
|
-
.replace(/\bcoding agent\b/gi, "task agent")
|
|
737
|
-
.replace(/\bcoding sessions\b/gi, "task-agent sessions")
|
|
738
|
-
.replace(/\bcoding session\b/gi, "task-agent session");
|
|
739
|
-
}
|
|
740
|
-
function injectPreferredAgentType(action) {
|
|
741
|
-
if (!action?.handler)
|
|
742
|
-
return;
|
|
743
|
-
const originalHandler = action.handler.bind(action);
|
|
744
|
-
action.handler = async (runtime, message, state, options, callback) => {
|
|
745
|
-
const parameters = options?.parameters ?? {};
|
|
746
|
-
const content = message.content && typeof message.content === "object"
|
|
747
|
-
? message.content
|
|
748
|
-
: {};
|
|
749
|
-
const explicitAgentType = typeof parameters.agentType === "string"
|
|
750
|
-
? parameters.agentType
|
|
751
|
-
: typeof content.agentType === "string"
|
|
752
|
-
? content.agentType
|
|
753
|
-
: undefined;
|
|
754
|
-
if (explicitAgentType) {
|
|
755
|
-
return originalHandler(runtime, message, state, options, callback);
|
|
756
|
-
}
|
|
757
|
-
const ptyService = getPtyService(runtime);
|
|
758
|
-
const frameworkState = await getFrameworkState(runtime, ptyService);
|
|
759
|
-
const preferredAgentType = frameworkState.preferred.id === "pi" ? "pi" : frameworkState.preferred.id;
|
|
760
|
-
const nextMessage = {
|
|
761
|
-
...message,
|
|
762
|
-
content: {
|
|
763
|
-
...content,
|
|
764
|
-
agentType: preferredAgentType,
|
|
765
|
-
},
|
|
766
|
-
};
|
|
767
|
-
const nextOptions = {
|
|
768
|
-
...(options ?? {}),
|
|
769
|
-
parameters: {
|
|
770
|
-
...parameters,
|
|
771
|
-
agentType: preferredAgentType,
|
|
772
|
-
},
|
|
773
|
-
};
|
|
774
|
-
return originalHandler(runtime, nextMessage, state, nextOptions, callback);
|
|
775
|
-
};
|
|
776
|
-
}
|
|
777
|
-
/**
|
|
778
|
-
* Deployment-specific task-agent memory, loaded from an external file.
|
|
779
|
-
*
|
|
780
|
-
* The compat layer itself is generic — it ships with no hardcoded deployment
|
|
781
|
-
* content. Operators point `TASK_AGENT_MEMORY_FILE` (env var or eliza config
|
|
782
|
-
* env section) at a markdown file containing the instructions spawned task
|
|
783
|
-
* agents should read on startup (project paths, deployment conventions, hard
|
|
784
|
-
* rules, etc).
|
|
785
|
-
*
|
|
786
|
-
* If the env var is unset or the file can't be read, no memory content is
|
|
787
|
-
* injected — task agents run with stock orchestrator defaults. That keeps
|
|
788
|
-
* this source file reusable across deployments that have nothing in common
|
|
789
|
-
* beyond the eliza runtime.
|
|
790
|
-
*
|
|
791
|
-
* Lazy + cached: the file is read once on the first action invocation per
|
|
792
|
-
* process lifetime and the content is reused for every subsequent spawn.
|
|
793
|
-
*/
|
|
794
|
-
let cachedTaskAgentMemory = null;
|
|
795
|
-
let taskAgentMemoryLoaded = false;
|
|
796
|
-
function loadTaskAgentMemory() {
|
|
797
|
-
if (taskAgentMemoryLoaded)
|
|
798
|
-
return cachedTaskAgentMemory ?? "";
|
|
799
|
-
taskAgentMemoryLoaded = true;
|
|
800
|
-
const filePath = process.env.TASK_AGENT_MEMORY_FILE;
|
|
801
|
-
if (!filePath)
|
|
802
|
-
return "";
|
|
803
|
-
try {
|
|
804
|
-
const resolved = filePath.startsWith("~")
|
|
805
|
-
? path.join(os.homedir(), filePath.slice(1))
|
|
806
|
-
: filePath;
|
|
807
|
-
cachedTaskAgentMemory = fs.readFileSync(resolved, "utf-8");
|
|
808
|
-
return cachedTaskAgentMemory;
|
|
809
|
-
}
|
|
810
|
-
catch {
|
|
811
|
-
return "";
|
|
812
|
-
}
|
|
813
|
-
}
|
|
814
|
-
/**
|
|
815
|
-
* Wraps an orchestrator action so every invocation carries Eliza's default
|
|
816
|
-
* task-agent memory content. Existing caller-supplied memoryContent is
|
|
817
|
-
* preserved and appended after the defaults.
|
|
818
|
-
*/
|
|
819
|
-
function injectDefaultMemoryContent(action) {
|
|
820
|
-
if (!action?.handler)
|
|
821
|
-
return;
|
|
822
|
-
const originalHandler = action.handler.bind(action);
|
|
823
|
-
action.handler = async (runtime, message, state, options, callback) => {
|
|
824
|
-
// Lazy install: the streamer + jsonl watcher both need a live runtime
|
|
825
|
-
// and ptyService to wire up callbacks, neither of which exist at
|
|
826
|
-
// module load time. First task spawn is the earliest both are
|
|
827
|
-
// guaranteed. Both installers are idempotent per runtime.
|
|
828
|
-
const pty = getPtyService(runtime);
|
|
829
|
-
installTaskProgressStreamer(runtime, pty);
|
|
830
|
-
installClaudeJsonlCompletionWatcher(runtime, pty);
|
|
831
|
-
const parameters = options?.parameters ?? {};
|
|
832
|
-
const existing = typeof parameters.memoryContent === "string"
|
|
833
|
-
? parameters.memoryContent
|
|
834
|
-
: undefined;
|
|
835
|
-
const deploymentMemory = loadTaskAgentMemory();
|
|
836
|
-
let memoryContent;
|
|
837
|
-
if (deploymentMemory && existing) {
|
|
838
|
-
memoryContent = `${deploymentMemory}\n---\n\n${existing}`;
|
|
839
|
-
}
|
|
840
|
-
else if (deploymentMemory) {
|
|
841
|
-
memoryContent = deploymentMemory;
|
|
842
|
-
}
|
|
843
|
-
else if (existing) {
|
|
844
|
-
memoryContent = existing;
|
|
845
|
-
}
|
|
846
|
-
// Force autonomous approval for every eliza task agent. The LLM that
|
|
847
|
-
// builds CREATE_TASK action params will sometimes pick "standard" or
|
|
848
|
-
// "readonly" for tasks that it classifies as "research" or "non-coding",
|
|
849
|
-
// which strips Write/Edit/Bash/WebSearch from the subagent's allow-list
|
|
850
|
-
// and leaves it unable to actually do anything. On this deployment the
|
|
851
|
-
// bot runs on a single-tenant VPS, hooked into agent-home, and is
|
|
852
|
-
// intended to be fully autonomous — there is no scenario where a
|
|
853
|
-
// restricted preset is the right call. Overriding here (rather than
|
|
854
|
-
// server-wide via PTY_SERVICE_CONFIG.defaultApprovalPreset) keeps the
|
|
855
|
-
// orchestrator plugin's default intact for other deployments.
|
|
856
|
-
const nextOptions = {
|
|
857
|
-
...(options ?? {}),
|
|
858
|
-
parameters: {
|
|
859
|
-
...parameters,
|
|
860
|
-
...(memoryContent !== undefined ? { memoryContent } : {}),
|
|
861
|
-
approvalPreset: "autonomous",
|
|
862
|
-
},
|
|
863
|
-
};
|
|
864
|
-
return originalHandler(runtime, message, state, nextOptions, callback);
|
|
865
|
-
};
|
|
866
|
-
}
|
|
867
|
-
function installListAgentsHandler(action) {
|
|
868
|
-
if (!action)
|
|
869
|
-
return;
|
|
870
|
-
action.handler = async (runtime, _message, _state, _options, callback) => {
|
|
871
|
-
// Only respond to explicit slash commands. The runtime can pick this
|
|
872
|
-
// action via fuzzy matching during action loops or coordinator events
|
|
873
|
-
// even when the user never asked for status. Without this guard, the
|
|
874
|
-
// bot spams the channel with "Active task agents" updates.
|
|
875
|
-
const userText = (_message?.content?.text ?? "").trim();
|
|
876
|
-
if (!userText.startsWith("/subagents") &&
|
|
877
|
-
!userText.startsWith("/sub") &&
|
|
878
|
-
!userText.startsWith("/agents") &&
|
|
879
|
-
!userText.startsWith("/sessions")) {
|
|
880
|
-
return { success: false, text: "" };
|
|
881
|
-
}
|
|
882
|
-
const ptyService = getPtyService(runtime);
|
|
883
|
-
if (!ptyService) {
|
|
884
|
-
if (callback) {
|
|
885
|
-
await callback({ text: "PTY Service is not available." });
|
|
886
|
-
}
|
|
887
|
-
return { success: false, error: "SERVICE_UNAVAILABLE" };
|
|
888
|
-
}
|
|
889
|
-
const sessions = await ptyService.listSessions();
|
|
890
|
-
const coordinator = resolveCoordinator(runtime);
|
|
891
|
-
const tasks = uniqueTaskList(coordinator?.getAllTaskContexts?.() ?? []);
|
|
892
|
-
const frameworkState = await getFrameworkState(runtime, ptyService);
|
|
893
|
-
if (sessions.length === 0 && tasks.length === 0) {
|
|
894
|
-
const text = "No active task agents.";
|
|
895
|
-
if (callback) {
|
|
896
|
-
await callback({ text });
|
|
897
|
-
}
|
|
898
|
-
return {
|
|
899
|
-
success: true,
|
|
900
|
-
text,
|
|
901
|
-
data: {
|
|
902
|
-
sessions: [],
|
|
903
|
-
tasks: [],
|
|
904
|
-
preferredTaskAgent: frameworkState.preferred,
|
|
905
|
-
},
|
|
906
|
-
};
|
|
907
|
-
}
|
|
908
|
-
const lines = [];
|
|
909
|
-
if (sessions.length > 0) {
|
|
910
|
-
lines.push(`Active task agents (${sessions.length}):`);
|
|
911
|
-
for (const session of sessions) {
|
|
912
|
-
const label = typeof session.metadata?.label === "string"
|
|
913
|
-
? session.metadata.label
|
|
914
|
-
: session.name;
|
|
915
|
-
lines.push(`- "${label}" (${session.agentType}, ${formatStatus(session.status)}) [session: ${session.id}]`);
|
|
916
|
-
}
|
|
917
|
-
}
|
|
918
|
-
if (tasks.length > 0) {
|
|
919
|
-
if (lines.length > 0)
|
|
920
|
-
lines.push("");
|
|
921
|
-
lines.push(`Current task status (${tasks.length}):`);
|
|
922
|
-
for (const task of tasks
|
|
923
|
-
.slice()
|
|
924
|
-
.sort((left, right) => right.registeredAt - left.registeredAt)) {
|
|
925
|
-
const detail = task.completionSummary ||
|
|
926
|
-
task.decisions.at(-1)?.reasoning ||
|
|
927
|
-
truncateText(task.originalTask, 110);
|
|
928
|
-
lines.push(`- [${task.status}] "${task.label}" (${task.agentType}) -> ${detail}`);
|
|
929
|
-
}
|
|
930
|
-
}
|
|
931
|
-
const pending = coordinator?.getPendingConfirmations?.() ?? [];
|
|
932
|
-
if (pending.length > 0) {
|
|
933
|
-
lines.push("");
|
|
934
|
-
lines.push(`Pending confirmations: ${pending.length} (${coordinator?.getSupervisionLevel?.() ?? "unknown"} supervision).`);
|
|
935
|
-
}
|
|
936
|
-
const text = lines.join("\n");
|
|
937
|
-
if (callback) {
|
|
938
|
-
await callback({ text });
|
|
939
|
-
}
|
|
940
|
-
return {
|
|
941
|
-
success: true,
|
|
942
|
-
text,
|
|
943
|
-
data: {
|
|
944
|
-
sessions: sessions.map((session) => ({
|
|
945
|
-
id: session.id,
|
|
946
|
-
agentType: session.agentType,
|
|
947
|
-
status: session.status,
|
|
948
|
-
workdir: session.workdir,
|
|
949
|
-
createdAt: session.createdAt.toISOString(),
|
|
950
|
-
lastActivity: session.lastActivityAt.toISOString(),
|
|
951
|
-
label: typeof session.metadata?.label === "string"
|
|
952
|
-
? session.metadata.label
|
|
953
|
-
: session.name,
|
|
954
|
-
})),
|
|
955
|
-
tasks: tasks.map((task) => ({
|
|
956
|
-
sessionId: task.sessionId,
|
|
957
|
-
agentType: task.agentType,
|
|
958
|
-
label: task.label,
|
|
959
|
-
status: task.status,
|
|
960
|
-
originalTask: task.originalTask,
|
|
961
|
-
completionSummary: task.completionSummary,
|
|
962
|
-
})),
|
|
963
|
-
pendingConfirmations: pending.length,
|
|
964
|
-
preferredTaskAgent: frameworkState.preferred,
|
|
965
|
-
},
|
|
966
|
-
};
|
|
967
|
-
};
|
|
968
|
-
}
|
|
969
|
-
function patchPluginSurface() {
|
|
970
|
-
if (patched)
|
|
971
|
-
return;
|
|
972
|
-
patched = true;
|
|
973
|
-
basePlugin.description =
|
|
974
|
-
"Orchestrate open-ended task agents (Claude Code, Codex, Gemini CLI, Aider, Pi, etc.) via PTY sessions, " +
|
|
975
|
-
"manage workspaces, track current task status, and keep background work moving while the main agent stays in conversation.";
|
|
976
|
-
patchAction("START_CODING_TASK", "CREATE_TASK", "Create one or more asynchronous task agents for any open-ended multi-step job. " +
|
|
977
|
-
"Use this whenever the user needs work that should continue in the background: coding, debugging, research, writing, analysis, planning, documentation, or automation. " +
|
|
978
|
-
"If a repo URL is provided it provisions the workspace automatically; otherwise the agent can run in scratch space.", [
|
|
979
|
-
...createActionExamples("Take a complicated pass on https://github.com/acme/app: debug the failing login flow, fix it, run the tests, and summarize what changed.", "I'll create a background task agent for that repo, keep track of its status, and report back as it progresses.", "CREATE_TASK"),
|
|
980
|
-
...createActionExamples("Spin up a couple of sub-agents to research browser automation frameworks, compare them, and draft a recommendation.", "I'll coordinate a few task agents in parallel and keep the summary grounded in their findings.", "CREATE_TASK"),
|
|
981
|
-
], ["START_AGENT_TASK", "LAUNCH_TASK", "CREATE_SUBTASK"]);
|
|
982
|
-
patchAction("SPAWN_CODING_AGENT", "SPAWN_AGENT", "Spawn a specific task agent inside an existing workspace when you need direct control. " +
|
|
983
|
-
"These agents are intentionally open-ended and can handle far more than code: investigation, writing, planning, testing, synthesis, and repo work.", [
|
|
984
|
-
...createActionExamples("Start a Codex task agent in that workspace and have it continue the investigation.", "I'll spawn a task agent in the current workspace and hand it the next chunk of work.", "SPAWN_AGENT"),
|
|
985
|
-
], ["SPAWN_SUB_AGENT", "START_TASK_AGENT", "CREATE_AGENT"]);
|
|
986
|
-
patchAction("SEND_TO_CODING_AGENT", "SEND_TO_AGENT", "Send text or key presses to a running task agent. Use this when a sub-agent asks a question, needs approval, or should keep going with new instructions.", [
|
|
987
|
-
...createActionExamples("Tell the running sub-agent to accept the change and keep going.", "I'll send that instruction to the running task agent.", "SEND_TO_AGENT"),
|
|
988
|
-
], ["MESSAGE_AGENT", "RESPOND_TO_AGENT", "TELL_TASK_AGENT"]);
|
|
989
|
-
patchAction("STOP_CODING_AGENT", "STOP_AGENT", "Stop a running task agent or cancel all currently active task-agent sessions.", [
|
|
990
|
-
...createActionExamples("Stop that task agent before it does more work.", "I'll stop the running task agent.", "STOP_AGENT"),
|
|
991
|
-
], ["CANCEL_TASK_AGENT", "TERMINATE_AGENT", "STOP_SUB_AGENT"]);
|
|
992
|
-
patchAction("LIST_CODING_AGENTS", "LIST_AGENTS", "List active task agents together with current task progress so the main agent can keep the user updated while work continues asynchronously.", [
|
|
993
|
-
...createActionExamples("What task agents are running right now and what are they doing?", "I'll pull the current task-agent status.", "LIST_AGENTS"),
|
|
994
|
-
], ["SHOW_TASK_AGENTS", "LIST_SUB_AGENTS", "SHOW_TASK_STATUS"]);
|
|
995
|
-
const provisionWorkspaceAction = baseActionMap.get("PROVISION_WORKSPACE");
|
|
996
|
-
if (provisionWorkspaceAction) {
|
|
997
|
-
provisionWorkspaceAction.description = renameTaskAgentText(provisionWorkspaceAction.description ?? "");
|
|
998
|
-
}
|
|
999
|
-
const finalizeWorkspaceAction = baseActionMap.get("FINALIZE_WORKSPACE");
|
|
1000
|
-
if (finalizeWorkspaceAction) {
|
|
1001
|
-
finalizeWorkspaceAction.description = renameTaskAgentText(finalizeWorkspaceAction.description ?? "");
|
|
1002
|
-
}
|
|
1003
|
-
for (const actionName of [
|
|
1004
|
-
"CREATE_TASK",
|
|
1005
|
-
"SPAWN_AGENT",
|
|
1006
|
-
"SEND_TO_AGENT",
|
|
1007
|
-
"STOP_AGENT",
|
|
1008
|
-
]) {
|
|
1009
|
-
wrapActionHandler(baseActionMap.get(actionName), renameTaskAgentText);
|
|
1010
|
-
}
|
|
1011
|
-
injectPreferredAgentType(baseActionMap.get("SPAWN_AGENT"));
|
|
1012
|
-
injectDefaultMemoryContent(baseActionMap.get("CREATE_TASK"));
|
|
1013
|
-
injectDefaultMemoryContent(baseActionMap.get("SPAWN_AGENT"));
|
|
1014
|
-
installListAgentsHandler(baseActionMap.get("LIST_AGENTS"));
|
|
1015
|
-
basePlugin.providers = [
|
|
1016
|
-
createActiveWorkspaceContextProvider(),
|
|
1017
|
-
createTaskAgentExamplesProvider(),
|
|
1018
|
-
];
|
|
1019
|
-
}
|
|
1020
|
-
function sendJson(res, body, status = 200) {
|
|
1021
|
-
res.statusCode = status;
|
|
1022
|
-
res.setHeader("Content-Type", "application/json");
|
|
1023
|
-
res.end(JSON.stringify(body));
|
|
1024
|
-
}
|
|
1025
|
-
function sendError(res, message, status = 400) {
|
|
1026
|
-
sendJson(res, { error: message }, status);
|
|
1027
|
-
}
|
|
1028
|
-
async function parseJsonBody(req) {
|
|
1029
|
-
const chunks = [];
|
|
1030
|
-
for await (const chunk of req) {
|
|
1031
|
-
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
1032
|
-
}
|
|
1033
|
-
const raw = Buffer.concat(chunks).toString("utf8").trim();
|
|
1034
|
-
if (!raw)
|
|
1035
|
-
return {};
|
|
1036
|
-
const parsed = JSON.parse(raw);
|
|
1037
|
-
return parsed && typeof parsed === "object" && !Array.isArray(parsed)
|
|
1038
|
-
? parsed
|
|
1039
|
-
: {};
|
|
1040
|
-
}
|
|
1041
|
-
function parseThreadListOptions(rawUrl) {
|
|
1042
|
-
const url = new URL(rawUrl ?? "http://localhost/api/coding-agents/coordinator/threads", "http://localhost");
|
|
1043
|
-
const status = url.searchParams.get("status") ?? undefined;
|
|
1044
|
-
const statusesRaw = url.searchParams.get("statuses");
|
|
1045
|
-
const statuses = statusesRaw
|
|
1046
|
-
?.split(",")
|
|
1047
|
-
.map((value) => value.trim())
|
|
1048
|
-
.filter(Boolean);
|
|
1049
|
-
const latestActivityAfterRaw = url.searchParams.get("latestActivityAfter");
|
|
1050
|
-
const latestActivityBeforeRaw = url.searchParams.get("latestActivityBefore");
|
|
1051
|
-
const hasActiveSessionRaw = url.searchParams.get("hasActiveSession");
|
|
1052
|
-
const limitRaw = url.searchParams.get("limit");
|
|
1053
|
-
return {
|
|
1054
|
-
includeArchived: url.searchParams.get("includeArchived") === "true",
|
|
1055
|
-
status: status ?? undefined,
|
|
1056
|
-
statuses,
|
|
1057
|
-
kind: url.searchParams.get("kind") ?? undefined,
|
|
1058
|
-
roomId: url.searchParams.get("roomId") ?? undefined,
|
|
1059
|
-
worldId: url.searchParams.get("worldId") ?? undefined,
|
|
1060
|
-
ownerUserId: url.searchParams.get("ownerUserId") ?? undefined,
|
|
1061
|
-
scenarioId: url.searchParams.get("scenarioId") ?? undefined,
|
|
1062
|
-
batchId: url.searchParams.get("batchId") ?? undefined,
|
|
1063
|
-
createdAfter: url.searchParams.get("createdAfter") ?? undefined,
|
|
1064
|
-
createdBefore: url.searchParams.get("createdBefore") ?? undefined,
|
|
1065
|
-
updatedAfter: url.searchParams.get("updatedAfter") ?? undefined,
|
|
1066
|
-
updatedBefore: url.searchParams.get("updatedBefore") ?? undefined,
|
|
1067
|
-
latestActivityAfter: latestActivityAfterRaw && Number.isFinite(Number(latestActivityAfterRaw))
|
|
1068
|
-
? Number(latestActivityAfterRaw)
|
|
1069
|
-
: undefined,
|
|
1070
|
-
latestActivityBefore: latestActivityBeforeRaw &&
|
|
1071
|
-
Number.isFinite(Number(latestActivityBeforeRaw))
|
|
1072
|
-
? Number(latestActivityBeforeRaw)
|
|
1073
|
-
: undefined,
|
|
1074
|
-
hasActiveSession: hasActiveSessionRaw === null ? undefined : hasActiveSessionRaw === "true",
|
|
1075
|
-
search: url.searchParams.get("search") ?? undefined,
|
|
1076
|
-
limit: limitRaw && Number.isFinite(Number(limitRaw))
|
|
1077
|
-
? Number(limitRaw)
|
|
1078
|
-
: undefined,
|
|
1079
|
-
};
|
|
1080
|
-
}
|
|
1081
|
-
const URL_RE = /\bhttps?:\/\/[^\s<>"'`]+/gi;
|
|
1082
|
-
function detectShareCapabilities() {
|
|
1083
|
-
const config = readJsonFile(resolveElizaConfigPath());
|
|
1084
|
-
if (!config || typeof config !== "object" || Array.isArray(config)) {
|
|
1085
|
-
return [];
|
|
1086
|
-
}
|
|
1087
|
-
const gateway = typeof config.gateway === "object" &&
|
|
1088
|
-
config.gateway
|
|
1089
|
-
? config.gateway
|
|
1090
|
-
: null;
|
|
1091
|
-
const gatewayTailscale = gateway && typeof gateway.tailscale === "object" && gateway.tailscale
|
|
1092
|
-
? gateway.tailscale
|
|
1093
|
-
: null;
|
|
1094
|
-
const gatewayRemote = gateway && typeof gateway.remote === "object" && gateway.remote
|
|
1095
|
-
? gateway.remote
|
|
1096
|
-
: null;
|
|
1097
|
-
const capabilities = [];
|
|
1098
|
-
const tailscaleMode = typeof gatewayTailscale?.mode === "string" ? gatewayTailscale.mode : null;
|
|
1099
|
-
if (tailscaleMode && tailscaleMode !== "off") {
|
|
1100
|
-
capabilities.push(`tailscale:${tailscaleMode}`);
|
|
1101
|
-
}
|
|
1102
|
-
if (typeof gatewayRemote?.url === "string" && gatewayRemote.url.trim()) {
|
|
1103
|
-
capabilities.push("gateway-remote-url");
|
|
1104
|
-
}
|
|
1105
|
-
if (typeof gatewayRemote?.sshTarget === "string" &&
|
|
1106
|
-
gatewayRemote.sshTarget.trim()) {
|
|
1107
|
-
capabilities.push("gateway-remote-ssh");
|
|
1108
|
-
}
|
|
1109
|
-
return capabilities;
|
|
1110
|
-
}
|
|
1111
|
-
function isRemoteAccessibleUrl(value) {
|
|
1112
|
-
try {
|
|
1113
|
-
const parsed = new URL(value);
|
|
1114
|
-
const host = parsed.hostname.trim().toLowerCase();
|
|
1115
|
-
return !["localhost", "127.0.0.1", "0.0.0.0"].includes(host);
|
|
1116
|
-
}
|
|
1117
|
-
catch {
|
|
1118
|
-
return false;
|
|
1119
|
-
}
|
|
1120
|
-
}
|
|
1121
|
-
function discoverTaskShareOptions(thread) {
|
|
1122
|
-
const targets = [];
|
|
1123
|
-
const seen = new Set();
|
|
1124
|
-
const pushTarget = (target) => {
|
|
1125
|
-
const type = typeof target.type === "string" ? target.type : "unknown";
|
|
1126
|
-
const value = typeof target.value === "string"
|
|
1127
|
-
? target.value
|
|
1128
|
-
: JSON.stringify(target.value);
|
|
1129
|
-
const key = `${type}:${value}`;
|
|
1130
|
-
if (seen.has(key))
|
|
1131
|
-
return;
|
|
1132
|
-
seen.add(key);
|
|
1133
|
-
targets.push(target);
|
|
1134
|
-
};
|
|
1135
|
-
for (const artifact of thread.artifacts ?? []) {
|
|
1136
|
-
if (artifact.uri?.trim()) {
|
|
1137
|
-
pushTarget({
|
|
1138
|
-
type: "artifact_uri",
|
|
1139
|
-
label: artifact.title,
|
|
1140
|
-
value: artifact.uri,
|
|
1141
|
-
source: `artifact:${artifact.artifactType ?? "unknown"}`,
|
|
1142
|
-
remoteAccessible: isRemoteAccessibleUrl(artifact.uri),
|
|
1143
|
-
});
|
|
1144
|
-
}
|
|
1145
|
-
if (artifact.path?.trim()) {
|
|
1146
|
-
pushTarget({
|
|
1147
|
-
type: "artifact_path",
|
|
1148
|
-
label: artifact.title,
|
|
1149
|
-
value: artifact.path,
|
|
1150
|
-
source: `artifact:${artifact.artifactType ?? "unknown"}`,
|
|
1151
|
-
remoteAccessible: false,
|
|
1152
|
-
});
|
|
1153
|
-
}
|
|
1154
|
-
}
|
|
1155
|
-
const recentTranscript = (thread.transcripts ?? [])
|
|
1156
|
-
.slice(-100)
|
|
1157
|
-
.map((entry) => entry.content)
|
|
1158
|
-
.join("\n");
|
|
1159
|
-
const transcriptUrls = recentTranscript.match(URL_RE) ?? [];
|
|
1160
|
-
for (const value of transcriptUrls) {
|
|
1161
|
-
pushTarget({
|
|
1162
|
-
type: "preview_url",
|
|
1163
|
-
label: "Discovered URL",
|
|
1164
|
-
value,
|
|
1165
|
-
source: "transcript:url",
|
|
1166
|
-
remoteAccessible: isRemoteAccessibleUrl(value),
|
|
1167
|
-
});
|
|
1168
|
-
}
|
|
1169
|
-
if (thread.latestWorkdir?.trim()) {
|
|
1170
|
-
pushTarget({
|
|
1171
|
-
type: "workspace",
|
|
1172
|
-
label: "Workspace",
|
|
1173
|
-
value: thread.latestWorkdir,
|
|
1174
|
-
source: "thread:latest-workdir",
|
|
1175
|
-
remoteAccessible: false,
|
|
1176
|
-
});
|
|
1177
|
-
}
|
|
1178
|
-
const preferredTarget = targets.find((target) => target.remoteAccessible === true) ??
|
|
1179
|
-
targets.find((target) => target.type === "preview_url") ??
|
|
1180
|
-
targets[0] ??
|
|
1181
|
-
null;
|
|
1182
|
-
return {
|
|
1183
|
-
threadId: thread.id,
|
|
1184
|
-
title: thread.title,
|
|
1185
|
-
shareCapabilities: detectShareCapabilities(),
|
|
1186
|
-
preferredTarget,
|
|
1187
|
-
targets,
|
|
1188
|
-
};
|
|
1189
|
-
}
|
|
1190
|
-
async function handleSettingsRoute(runtime, res) {
|
|
1191
|
-
const ptyService = getPtyService(runtime);
|
|
1192
|
-
const frameworkState = await getFrameworkState(runtime, ptyService);
|
|
1193
|
-
sendJson(res, {
|
|
1194
|
-
defaultApprovalPreset: ptyService?.defaultApprovalPreset ?? "permissive",
|
|
1195
|
-
agentSelectionStrategy: ptyService?.agentSelectionStrategy ?? "fixed",
|
|
1196
|
-
defaultAgentType: frameworkState.preferred.id,
|
|
1197
|
-
preferredAgentType: frameworkState.preferred.id,
|
|
1198
|
-
preferredAgentReason: frameworkState.preferred.reason,
|
|
1199
|
-
configuredSubscriptionProvider: frameworkState.configuredSubscriptionProvider,
|
|
1200
|
-
frameworks: frameworkState.frameworks,
|
|
1201
|
-
});
|
|
1202
|
-
return true;
|
|
1203
|
-
}
|
|
1204
|
-
async function handleCoordinatorStatusRoute(runtime, res) {
|
|
1205
|
-
const coordinator = resolveCoordinator(runtime);
|
|
1206
|
-
if (!coordinator)
|
|
1207
|
-
return false;
|
|
1208
|
-
const ptyService = getPtyService(runtime);
|
|
1209
|
-
const frameworkState = await getFrameworkState(runtime, ptyService);
|
|
1210
|
-
const allTasks = uniqueTaskList(coordinator.getAllTaskContexts?.() ?? []);
|
|
1211
|
-
const persistedThreads = coordinator.listTaskThreads
|
|
1212
|
-
? await coordinator.listTaskThreads({
|
|
1213
|
-
includeArchived: false,
|
|
1214
|
-
limit: 50,
|
|
1215
|
-
})
|
|
1216
|
-
: [];
|
|
1217
|
-
const activeTasks = allTasks.filter((task) => task.status !== "completed" &&
|
|
1218
|
-
task.status !== "stopped" &&
|
|
1219
|
-
task.status !== "error");
|
|
1220
|
-
const recentTasks = allTasks
|
|
1221
|
-
.slice()
|
|
1222
|
-
.sort((left, right) => right.registeredAt - left.registeredAt)
|
|
1223
|
-
.slice(0, 10);
|
|
1224
|
-
sendJson(res, {
|
|
1225
|
-
supervisionLevel: coordinator.getSupervisionLevel?.() ?? "autonomous",
|
|
1226
|
-
taskCount: activeTasks.length,
|
|
1227
|
-
tasks: activeTasks.map((task) => ({
|
|
1228
|
-
threadId: task.threadId,
|
|
1229
|
-
sessionId: task.sessionId,
|
|
1230
|
-
agentType: task.agentType,
|
|
1231
|
-
label: task.label,
|
|
1232
|
-
originalTask: task.originalTask,
|
|
1233
|
-
workdir: task.workdir,
|
|
1234
|
-
status: task.status,
|
|
1235
|
-
decisionCount: task.decisions.length,
|
|
1236
|
-
autoResolvedCount: task.autoResolvedCount,
|
|
1237
|
-
completionSummary: task.completionSummary,
|
|
1238
|
-
lastActivityAt: task.lastActivityAt,
|
|
1239
|
-
})),
|
|
1240
|
-
recentTasks: recentTasks.map((task) => ({
|
|
1241
|
-
threadId: task.threadId,
|
|
1242
|
-
sessionId: task.sessionId,
|
|
1243
|
-
agentType: task.agentType,
|
|
1244
|
-
label: task.label,
|
|
1245
|
-
status: task.status,
|
|
1246
|
-
originalTask: task.originalTask,
|
|
1247
|
-
completionSummary: task.completionSummary,
|
|
1248
|
-
registeredAt: task.registeredAt,
|
|
1249
|
-
lastActivityAt: task.lastActivityAt,
|
|
1250
|
-
})),
|
|
1251
|
-
taskThreadCount: persistedThreads.length,
|
|
1252
|
-
taskThreads: persistedThreads.map((thread) => ({
|
|
1253
|
-
id: thread.id,
|
|
1254
|
-
title: thread.title,
|
|
1255
|
-
kind: thread.kind,
|
|
1256
|
-
status: thread.status,
|
|
1257
|
-
scenarioId: thread.scenarioId,
|
|
1258
|
-
batchId: thread.batchId,
|
|
1259
|
-
originalRequest: thread.originalRequest,
|
|
1260
|
-
summary: thread.summary,
|
|
1261
|
-
sessionCount: thread.sessionCount,
|
|
1262
|
-
activeSessionCount: thread.activeSessionCount,
|
|
1263
|
-
latestSessionId: thread.latestSessionId,
|
|
1264
|
-
latestSessionLabel: thread.latestSessionLabel,
|
|
1265
|
-
latestWorkdir: thread.latestWorkdir,
|
|
1266
|
-
latestRepo: thread.latestRepo,
|
|
1267
|
-
latestActivityAt: thread.latestActivityAt,
|
|
1268
|
-
decisionCount: thread.decisionCount,
|
|
1269
|
-
createdAt: thread.createdAt,
|
|
1270
|
-
updatedAt: thread.updatedAt,
|
|
1271
|
-
closedAt: thread.closedAt,
|
|
1272
|
-
archivedAt: thread.archivedAt,
|
|
1273
|
-
})),
|
|
1274
|
-
pendingConfirmations: coordinator.getPendingConfirmations?.().length ?? 0,
|
|
1275
|
-
preferredAgentType: frameworkState.preferred.id,
|
|
1276
|
-
preferredAgentReason: frameworkState.preferred.reason,
|
|
1277
|
-
frameworks: frameworkState.frameworks,
|
|
1278
|
-
});
|
|
1279
|
-
return true;
|
|
1280
|
-
}
|
|
1281
|
-
function patchPtyServiceClass() {
|
|
1282
|
-
const ptyServiceClass = PTYService;
|
|
1283
|
-
if (!ptyServiceClass || typeof ptyServiceClass !== "function")
|
|
1284
|
-
return;
|
|
1285
|
-
const prototype = ptyServiceClass.prototype;
|
|
1286
|
-
const originalResolveAgentType = prototype.resolveAgentType;
|
|
1287
|
-
if (typeof originalResolveAgentType === "function") {
|
|
1288
|
-
prototype.resolveAgentType = async function () {
|
|
1289
|
-
const runtime = this.runtime;
|
|
1290
|
-
if (!runtime) {
|
|
1291
|
-
return originalResolveAgentType.call(this);
|
|
1292
|
-
}
|
|
1293
|
-
const frameworkState = await getFrameworkState(runtime, this);
|
|
1294
|
-
return frameworkState.preferred.id;
|
|
1295
|
-
};
|
|
1296
|
-
}
|
|
1297
|
-
const originalStart = ptyServiceClass.start;
|
|
1298
|
-
if (typeof originalStart === "function") {
|
|
1299
|
-
ptyServiceClass.start = async (runtime) => {
|
|
1300
|
-
const service = await originalStart(runtime);
|
|
1301
|
-
if (service && typeof service === "object") {
|
|
1302
|
-
service.capabilityDescription =
|
|
1303
|
-
"Manages asynchronous PTY task-agent sessions for open-ended background work";
|
|
1304
|
-
}
|
|
1305
|
-
return service;
|
|
1306
|
-
};
|
|
1307
|
-
}
|
|
1308
|
-
}
|
|
1309
|
-
patchPluginSurface();
|
|
1310
|
-
patchPtyServiceClass();
|
|
1311
|
-
/** @public Shipped plugin instance (includes action aliases, route extensions, and PTY patches). */
|
|
1312
|
-
export function createAgentOrchestratorPlugin() {
|
|
1313
|
-
return basePlugin;
|
|
1314
|
-
}
|
|
1315
|
-
export function createCodingAgentRouteHandler(runtime, coordinator) {
|
|
1316
|
-
const baseHandler = baseCreateCodingAgentRouteHandler(runtime, coordinator);
|
|
1317
|
-
return async (req, res, pathname, method = req.method ?? "GET") => {
|
|
1318
|
-
if (method === "GET" && pathname === "/api/coding-agents/settings") {
|
|
1319
|
-
return handleSettingsRoute(runtime, res);
|
|
1320
|
-
}
|
|
1321
|
-
if (method === "GET" &&
|
|
1322
|
-
pathname === "/api/coding-agents/coordinator/status") {
|
|
1323
|
-
return handleCoordinatorStatusRoute(runtime, res);
|
|
1324
|
-
}
|
|
1325
|
-
if (method === "GET" &&
|
|
1326
|
-
pathname === "/api/coding-agents/coordinator/threads") {
|
|
1327
|
-
const resolvedCoordinator = resolveCoordinator(runtime);
|
|
1328
|
-
if (!resolvedCoordinator?.listTaskThreads)
|
|
1329
|
-
return false;
|
|
1330
|
-
sendJson(res, await resolvedCoordinator.listTaskThreads(parseThreadListOptions(req.url)));
|
|
1331
|
-
return true;
|
|
1332
|
-
}
|
|
1333
|
-
if (method === "GET" &&
|
|
1334
|
-
pathname === "/api/coding-agents/coordinator/threads/count") {
|
|
1335
|
-
const resolvedCoordinator = resolveCoordinator(runtime);
|
|
1336
|
-
if (!resolvedCoordinator?.countTaskThreads)
|
|
1337
|
-
return false;
|
|
1338
|
-
const options = parseThreadListOptions(req.url);
|
|
1339
|
-
const { limit: _limit, ...countOptions } = options;
|
|
1340
|
-
sendJson(res, {
|
|
1341
|
-
total: await resolvedCoordinator.countTaskThreads(countOptions),
|
|
1342
|
-
});
|
|
1343
|
-
return true;
|
|
1344
|
-
}
|
|
1345
|
-
const threadMatch = pathname.match(/^\/api\/coding-agents\/coordinator\/threads\/([^/]+)$/);
|
|
1346
|
-
if (method === "GET" && threadMatch) {
|
|
1347
|
-
const resolvedCoordinator = resolveCoordinator(runtime);
|
|
1348
|
-
if (!resolvedCoordinator?.getTaskThread)
|
|
1349
|
-
return false;
|
|
1350
|
-
const thread = await resolvedCoordinator.getTaskThread(threadMatch[1]);
|
|
1351
|
-
if (!thread) {
|
|
1352
|
-
sendError(res, "Task thread not found", 404);
|
|
1353
|
-
return true;
|
|
1354
|
-
}
|
|
1355
|
-
sendJson(res, thread);
|
|
1356
|
-
return true;
|
|
1357
|
-
}
|
|
1358
|
-
const shareMatch = pathname.match(/^\/api\/coding-agents\/coordinator\/threads\/([^/]+)\/share$/);
|
|
1359
|
-
if (method === "GET" && shareMatch) {
|
|
1360
|
-
const resolvedCoordinator = resolveCoordinator(runtime);
|
|
1361
|
-
if (!resolvedCoordinator?.getTaskThread)
|
|
1362
|
-
return false;
|
|
1363
|
-
const thread = await resolvedCoordinator.getTaskThread(shareMatch[1]);
|
|
1364
|
-
if (!thread) {
|
|
1365
|
-
sendError(res, "Task thread not found", 404);
|
|
1366
|
-
return true;
|
|
1367
|
-
}
|
|
1368
|
-
sendJson(res, discoverTaskShareOptions(thread));
|
|
1369
|
-
return true;
|
|
1370
|
-
}
|
|
1371
|
-
const archiveMatch = pathname.match(/^\/api\/coding-agents\/coordinator\/threads\/([^/]+)\/archive$/);
|
|
1372
|
-
if (method === "POST" && archiveMatch) {
|
|
1373
|
-
const resolvedCoordinator = resolveCoordinator(runtime);
|
|
1374
|
-
if (!resolvedCoordinator?.archiveTaskThread)
|
|
1375
|
-
return false;
|
|
1376
|
-
await resolvedCoordinator.archiveTaskThread(archiveMatch[1]);
|
|
1377
|
-
sendJson(res, {
|
|
1378
|
-
success: true,
|
|
1379
|
-
threadId: archiveMatch[1],
|
|
1380
|
-
status: "archived",
|
|
1381
|
-
});
|
|
1382
|
-
return true;
|
|
1383
|
-
}
|
|
1384
|
-
const reopenMatch = pathname.match(/^\/api\/coding-agents\/coordinator\/threads\/([^/]+)\/reopen$/);
|
|
1385
|
-
if (method === "POST" && reopenMatch) {
|
|
1386
|
-
const resolvedCoordinator = resolveCoordinator(runtime);
|
|
1387
|
-
if (!resolvedCoordinator?.reopenTaskThread)
|
|
1388
|
-
return false;
|
|
1389
|
-
await resolvedCoordinator.reopenTaskThread(reopenMatch[1]);
|
|
1390
|
-
sendJson(res, {
|
|
1391
|
-
success: true,
|
|
1392
|
-
threadId: reopenMatch[1],
|
|
1393
|
-
status: "open",
|
|
1394
|
-
});
|
|
1395
|
-
return true;
|
|
1396
|
-
}
|
|
1397
|
-
const controlMatch = pathname.match(/^\/api\/coding-agents\/coordinator\/threads\/([^/]+)\/control$/);
|
|
1398
|
-
if (method === "POST" && controlMatch) {
|
|
1399
|
-
const resolvedCoordinator = resolveCoordinator(runtime);
|
|
1400
|
-
if (!resolvedCoordinator)
|
|
1401
|
-
return false;
|
|
1402
|
-
const body = await parseJsonBody(req);
|
|
1403
|
-
const action = typeof body.action === "string" ? body.action.trim() : "";
|
|
1404
|
-
const note = typeof body.note === "string" ? body.note : undefined;
|
|
1405
|
-
const instruction = typeof body.instruction === "string" ? body.instruction : undefined;
|
|
1406
|
-
const agentType = typeof body.agentType === "string" ? body.agentType : undefined;
|
|
1407
|
-
if (action === "pause" && resolvedCoordinator.pauseTaskThread) {
|
|
1408
|
-
sendJson(res, {
|
|
1409
|
-
success: true,
|
|
1410
|
-
action,
|
|
1411
|
-
...(await resolvedCoordinator.pauseTaskThread(controlMatch[1], note)),
|
|
1412
|
-
});
|
|
1413
|
-
return true;
|
|
1414
|
-
}
|
|
1415
|
-
if (action === "stop" && resolvedCoordinator.stopTaskThread) {
|
|
1416
|
-
sendJson(res, {
|
|
1417
|
-
success: true,
|
|
1418
|
-
action,
|
|
1419
|
-
...(await resolvedCoordinator.stopTaskThread(controlMatch[1], note)),
|
|
1420
|
-
});
|
|
1421
|
-
return true;
|
|
1422
|
-
}
|
|
1423
|
-
if (action === "resume" && resolvedCoordinator.resumeTaskThread) {
|
|
1424
|
-
sendJson(res, {
|
|
1425
|
-
success: true,
|
|
1426
|
-
action,
|
|
1427
|
-
...(await resolvedCoordinator.resumeTaskThread(controlMatch[1], instruction, agentType)),
|
|
1428
|
-
});
|
|
1429
|
-
return true;
|
|
1430
|
-
}
|
|
1431
|
-
if (action === "continue" && resolvedCoordinator.continueTaskThread) {
|
|
1432
|
-
sendJson(res, {
|
|
1433
|
-
success: true,
|
|
1434
|
-
action,
|
|
1435
|
-
...(await resolvedCoordinator.continueTaskThread(controlMatch[1], instruction ?? `Continue task thread ${controlMatch[1]}.`, agentType)),
|
|
1436
|
-
});
|
|
1437
|
-
return true;
|
|
1438
|
-
}
|
|
1439
|
-
sendError(res, 'Invalid control action. Must be "pause", "stop", "resume", or "continue".', 400);
|
|
1440
|
-
return true;
|
|
1441
|
-
}
|
|
1442
|
-
return baseHandler ? baseHandler(req, res, pathname) : false;
|
|
1443
|
-
};
|
|
1444
|
-
}
|
|
1445
|
-
export { CodingWorkspaceService, PTYService };
|
|
1446
|
-
export const getCoordinator = (runtime) => resolveCoordinator(runtime);
|
|
1447
|
-
export const taskAgentPlugin = basePlugin;
|
|
1448
|
-
export const codingAgentPlugin = basePlugin;
|
|
1449
|
-
export default basePlugin;
|