@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,1173 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { logger } from "@elizaos/core";
|
|
3
|
-
import { LIFEOPS_ACTIVITY_SIGNAL_STATES } from "../contracts/lifeops.js";
|
|
4
|
-
import { createIntegrationTelemetrySpan } from "../diagnostics/integration-observability.js";
|
|
5
|
-
import { loadLifeOpsAppState, saveLifeOpsAppState, } from "../lifeops/app-state.js";
|
|
6
|
-
import { LifeOpsService, LifeOpsServiceError } from "../lifeops/service.js";
|
|
7
|
-
import { isRetryableLifeOpsStorageError } from "../lifeops/sql.js";
|
|
8
|
-
import { buildLifeOpsBrowserCompanionPackage, getLifeOpsBrowserCompanionDownloadFile, getLifeOpsBrowserCompanionPackageStatus, } from "./lifeops-browser-packaging.js";
|
|
9
|
-
import { checkRateLimit } from "./rate-limiter.js";
|
|
10
|
-
function getService(ctx) {
|
|
11
|
-
if (!ctx.state.runtime) {
|
|
12
|
-
ctx.error(ctx.res, "Agent runtime is not available", 503);
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
return new LifeOpsService(ctx.state.runtime, {
|
|
16
|
-
ownerEntityId: ctx.state.adminEntityId,
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
function getBrowserCompanionAuth(ctx) {
|
|
20
|
-
const companionHeader = ctx.req.headers["x-eliza-browser-companion-id"];
|
|
21
|
-
const companionId = typeof companionHeader === "string" ? companionHeader.trim() : "";
|
|
22
|
-
if (!companionId) {
|
|
23
|
-
ctx.error(ctx.res, "Missing X-Eliza-Browser-Companion-Id header", 401);
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
const authHeader = typeof ctx.req.headers.authorization === "string"
|
|
27
|
-
? ctx.req.headers.authorization.trim()
|
|
28
|
-
: "";
|
|
29
|
-
const match = /^Bearer\s+(.+)$/i.exec(authHeader);
|
|
30
|
-
const pairingToken = match?.[1]?.trim() ?? "";
|
|
31
|
-
if (!pairingToken) {
|
|
32
|
-
ctx.error(ctx.res, "Missing browser companion bearer token", 401);
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
return {
|
|
36
|
-
companionId,
|
|
37
|
-
pairingToken,
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
// ---------------------------------------------------------------------------
|
|
41
|
-
// Rate limit configuration per operation.
|
|
42
|
-
// Keys are logical operation names; the "default" entry applies to any
|
|
43
|
-
// operation not explicitly listed.
|
|
44
|
-
// ---------------------------------------------------------------------------
|
|
45
|
-
const LIFEOPS_RATE_LIMITS = {
|
|
46
|
-
google_api_read: { maxRequests: 120, windowMs: 60_000 },
|
|
47
|
-
google_api_write: { maxRequests: 30, windowMs: 60_000 },
|
|
48
|
-
reminders_process: { maxRequests: 10, windowMs: 60_000 },
|
|
49
|
-
task_create: { maxRequests: 30, windowMs: 60_000 },
|
|
50
|
-
task_update: { maxRequests: 30, windowMs: 60_000 },
|
|
51
|
-
gmail_draft: { maxRequests: 20, windowMs: 60_000 },
|
|
52
|
-
gmail_send: { maxRequests: 5, windowMs: 60_000 },
|
|
53
|
-
calendar_create: { maxRequests: 20, windowMs: 60_000 },
|
|
54
|
-
default: { maxRequests: 60, windowMs: 60_000 },
|
|
55
|
-
};
|
|
56
|
-
/**
|
|
57
|
-
* Check rate limit for a LifeOps operation. If the limit is exceeded,
|
|
58
|
-
* sends a 429 response with Retry-After header and returns `true`.
|
|
59
|
-
* Returns `false` when the request is allowed to proceed.
|
|
60
|
-
*/
|
|
61
|
-
function rateLimitRequest(ctx, operation) {
|
|
62
|
-
const agentId = String(ctx.state.runtime?.agentId ?? "unknown");
|
|
63
|
-
const limitKey = `${agentId}:${operation}`;
|
|
64
|
-
const config = LIFEOPS_RATE_LIMITS[operation] ?? LIFEOPS_RATE_LIMITS.default;
|
|
65
|
-
const { allowed, retryAfterMs } = checkRateLimit(limitKey, config);
|
|
66
|
-
if (!allowed) {
|
|
67
|
-
ctx.res.writeHead(429, {
|
|
68
|
-
"Retry-After": String(Math.ceil(retryAfterMs / 1_000)),
|
|
69
|
-
});
|
|
70
|
-
ctx.res.end(JSON.stringify({ error: "Rate limit exceeded", retryAfterMs }));
|
|
71
|
-
return true;
|
|
72
|
-
}
|
|
73
|
-
return false;
|
|
74
|
-
}
|
|
75
|
-
function routeOperation(ctx) {
|
|
76
|
-
return `${ctx.method.toUpperCase()} ${ctx.pathname}`;
|
|
77
|
-
}
|
|
78
|
-
function errorMessage(error) {
|
|
79
|
-
return error instanceof Error ? error.message : String(error);
|
|
80
|
-
}
|
|
81
|
-
function parsePositiveIntegerQuery(value, field) {
|
|
82
|
-
if (!value) {
|
|
83
|
-
return null;
|
|
84
|
-
}
|
|
85
|
-
const parsed = Number.parseInt(value, 10);
|
|
86
|
-
if (!Number.isFinite(parsed) || parsed <= 0) {
|
|
87
|
-
throw new LifeOpsServiceError(400, `${field} must be a positive integer`);
|
|
88
|
-
}
|
|
89
|
-
return parsed;
|
|
90
|
-
}
|
|
91
|
-
function parseActivitySignalStates(url) {
|
|
92
|
-
const rawValues = [
|
|
93
|
-
...url.searchParams.getAll("state"),
|
|
94
|
-
...url.searchParams.getAll("states").flatMap((value) => value.split(",")),
|
|
95
|
-
]
|
|
96
|
-
.map((value) => value.trim())
|
|
97
|
-
.filter((value) => value.length > 0);
|
|
98
|
-
if (rawValues.length === 0) {
|
|
99
|
-
return null;
|
|
100
|
-
}
|
|
101
|
-
const invalid = rawValues.find((value) => !LIFEOPS_ACTIVITY_SIGNAL_STATES.includes(value));
|
|
102
|
-
if (invalid) {
|
|
103
|
-
throw new LifeOpsServiceError(400, `state must be one of: ${LIFEOPS_ACTIVITY_SIGNAL_STATES.join(", ")}`);
|
|
104
|
-
}
|
|
105
|
-
return rawValues;
|
|
106
|
-
}
|
|
107
|
-
async function runRoute(ctx, fn) {
|
|
108
|
-
const operation = routeOperation(ctx);
|
|
109
|
-
const span = createIntegrationTelemetrySpan({
|
|
110
|
-
boundary: "lifeops",
|
|
111
|
-
operation,
|
|
112
|
-
});
|
|
113
|
-
const service = getService(ctx);
|
|
114
|
-
if (!service) {
|
|
115
|
-
logger.info({
|
|
116
|
-
boundary: "lifeops",
|
|
117
|
-
operation,
|
|
118
|
-
statusCode: 503,
|
|
119
|
-
}, "[lifeops] Route rejected because agent runtime is unavailable");
|
|
120
|
-
span.failure({
|
|
121
|
-
statusCode: 503,
|
|
122
|
-
errorKind: "runtime_unavailable",
|
|
123
|
-
});
|
|
124
|
-
return true;
|
|
125
|
-
}
|
|
126
|
-
try {
|
|
127
|
-
await fn(service);
|
|
128
|
-
span.success({
|
|
129
|
-
statusCode: ctx.res.statusCode >= 400 ? ctx.res.statusCode : 200,
|
|
130
|
-
});
|
|
131
|
-
return true;
|
|
132
|
-
}
|
|
133
|
-
catch (error) {
|
|
134
|
-
if (error instanceof LifeOpsServiceError) {
|
|
135
|
-
const logFn = error.status === 401
|
|
136
|
-
? logger.debug.bind(logger)
|
|
137
|
-
: logger.warn.bind(logger);
|
|
138
|
-
logFn({
|
|
139
|
-
boundary: "lifeops",
|
|
140
|
-
operation,
|
|
141
|
-
statusCode: error.status,
|
|
142
|
-
}, `[lifeops] Route failed: ${error.message}`);
|
|
143
|
-
span.failure({
|
|
144
|
-
statusCode: error.status,
|
|
145
|
-
error,
|
|
146
|
-
errorKind: error.status === 401
|
|
147
|
-
? "lifeops_auth_invalid"
|
|
148
|
-
: "lifeops_service_error",
|
|
149
|
-
});
|
|
150
|
-
ctx.error(ctx.res, error.message, error.status);
|
|
151
|
-
return true;
|
|
152
|
-
}
|
|
153
|
-
if (isRetryableLifeOpsStorageError(error)) {
|
|
154
|
-
const message = "Life Ops storage is still initializing. Refresh in a moment.";
|
|
155
|
-
logger.info({
|
|
156
|
-
boundary: "lifeops",
|
|
157
|
-
operation,
|
|
158
|
-
statusCode: 503,
|
|
159
|
-
}, `[lifeops] Route unavailable: ${message}`);
|
|
160
|
-
span.failure({
|
|
161
|
-
statusCode: 503,
|
|
162
|
-
error,
|
|
163
|
-
errorKind: "lifeops_storage_unavailable",
|
|
164
|
-
});
|
|
165
|
-
ctx.error(ctx.res, message, 503);
|
|
166
|
-
return true;
|
|
167
|
-
}
|
|
168
|
-
logger.error({
|
|
169
|
-
boundary: "lifeops",
|
|
170
|
-
operation,
|
|
171
|
-
}, `[lifeops] Route crashed: ${errorMessage(error)}`);
|
|
172
|
-
span.failure({
|
|
173
|
-
error,
|
|
174
|
-
errorKind: "unhandled_error",
|
|
175
|
-
});
|
|
176
|
-
throw error;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
function escapeHtml(value) {
|
|
180
|
-
return value
|
|
181
|
-
.replace(/&/g, "&")
|
|
182
|
-
.replace(/</g, "<")
|
|
183
|
-
.replace(/>/g, ">")
|
|
184
|
-
.replace(/"/g, """)
|
|
185
|
-
.replace(/'/g, "'");
|
|
186
|
-
}
|
|
187
|
-
function serializeInlineScriptValue(value) {
|
|
188
|
-
return JSON.stringify(value).replace(/</g, "\\u003c");
|
|
189
|
-
}
|
|
190
|
-
function writeHtml(res, status, title, message, refreshDetail) {
|
|
191
|
-
const refreshScript = refreshDetail
|
|
192
|
-
? `
|
|
193
|
-
<script>
|
|
194
|
-
(() => {
|
|
195
|
-
const payload = ${serializeInlineScriptValue({
|
|
196
|
-
type: "lifeops-google-connector-refresh",
|
|
197
|
-
detail: {
|
|
198
|
-
...refreshDetail,
|
|
199
|
-
source: "callback",
|
|
200
|
-
},
|
|
201
|
-
})};
|
|
202
|
-
if (window.opener && typeof window.opener.postMessage === "function") {
|
|
203
|
-
window.opener.postMessage(payload, "*");
|
|
204
|
-
}
|
|
205
|
-
if (typeof BroadcastChannel === "function") {
|
|
206
|
-
const channel = new BroadcastChannel("eliza:lifeops:google-connector");
|
|
207
|
-
channel.postMessage(payload);
|
|
208
|
-
channel.close();
|
|
209
|
-
}
|
|
210
|
-
if (typeof localStorage !== "undefined") {
|
|
211
|
-
localStorage.setItem(
|
|
212
|
-
"eliza:lifeops:google-connector-refresh",
|
|
213
|
-
JSON.stringify({
|
|
214
|
-
...payload,
|
|
215
|
-
at: Date.now(),
|
|
216
|
-
}),
|
|
217
|
-
);
|
|
218
|
-
localStorage.removeItem("eliza:lifeops:google-connector-refresh");
|
|
219
|
-
}
|
|
220
|
-
})();
|
|
221
|
-
</script>`
|
|
222
|
-
: "";
|
|
223
|
-
res.statusCode = status;
|
|
224
|
-
res.setHeader("Content-Type", "text/html; charset=utf-8");
|
|
225
|
-
res.end(`<!doctype html>
|
|
226
|
-
<html lang="en">
|
|
227
|
-
<head>
|
|
228
|
-
<meta charset="utf-8" />
|
|
229
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
230
|
-
<title>${escapeHtml(title)}</title>
|
|
231
|
-
<style>
|
|
232
|
-
body {
|
|
233
|
-
margin: 0;
|
|
234
|
-
min-height: 100vh;
|
|
235
|
-
display: grid;
|
|
236
|
-
place-items: center;
|
|
237
|
-
background: #f5f1e8;
|
|
238
|
-
color: #18120d;
|
|
239
|
-
font-family: "IBM Plex Sans", "Helvetica Neue", sans-serif;
|
|
240
|
-
}
|
|
241
|
-
main {
|
|
242
|
-
width: min(32rem, calc(100vw - 2rem));
|
|
243
|
-
padding: 2rem;
|
|
244
|
-
border: 1px solid rgba(24, 18, 13, 0.12);
|
|
245
|
-
border-radius: 1.25rem;
|
|
246
|
-
background: rgba(255, 255, 255, 0.92);
|
|
247
|
-
box-shadow: 0 24px 80px rgba(24, 18, 13, 0.08);
|
|
248
|
-
}
|
|
249
|
-
h1 {
|
|
250
|
-
margin: 0 0 0.75rem;
|
|
251
|
-
font-size: 1.25rem;
|
|
252
|
-
}
|
|
253
|
-
p {
|
|
254
|
-
margin: 0;
|
|
255
|
-
line-height: 1.5;
|
|
256
|
-
color: rgba(24, 18, 13, 0.78);
|
|
257
|
-
}
|
|
258
|
-
</style>
|
|
259
|
-
</head>
|
|
260
|
-
<body>
|
|
261
|
-
<main>
|
|
262
|
-
<h1>${escapeHtml(title)}</h1>
|
|
263
|
-
<p>${escapeHtml(message)}</p>
|
|
264
|
-
</main>
|
|
265
|
-
${refreshScript}
|
|
266
|
-
<script>
|
|
267
|
-
window.setTimeout(() => {
|
|
268
|
-
try {
|
|
269
|
-
window.close();
|
|
270
|
-
} catch {}
|
|
271
|
-
}, 250);
|
|
272
|
-
</script>
|
|
273
|
-
</body>
|
|
274
|
-
</html>`);
|
|
275
|
-
}
|
|
276
|
-
export async function handleLifeOpsRoutes(ctx) {
|
|
277
|
-
const { req, res, method, pathname, url, json, readJsonBody, decodePathComponent, } = ctx;
|
|
278
|
-
if (method === "GET" && pathname === "/api/lifeops/app-state") {
|
|
279
|
-
if (!ctx.state.runtime) {
|
|
280
|
-
ctx.error(res, "Agent runtime is not available", 503);
|
|
281
|
-
return true;
|
|
282
|
-
}
|
|
283
|
-
json(res, await loadLifeOpsAppState(ctx.state.runtime));
|
|
284
|
-
return true;
|
|
285
|
-
}
|
|
286
|
-
if (method === "PUT" && pathname === "/api/lifeops/app-state") {
|
|
287
|
-
if (!ctx.state.runtime) {
|
|
288
|
-
ctx.error(res, "Agent runtime is not available", 503);
|
|
289
|
-
return true;
|
|
290
|
-
}
|
|
291
|
-
const body = await readJsonBody(req, res);
|
|
292
|
-
if (!body) {
|
|
293
|
-
return true;
|
|
294
|
-
}
|
|
295
|
-
if (typeof body.enabled !== "boolean") {
|
|
296
|
-
ctx.error(res, "enabled must be a boolean", 400);
|
|
297
|
-
return true;
|
|
298
|
-
}
|
|
299
|
-
json(res, await saveLifeOpsAppState(ctx.state.runtime, {
|
|
300
|
-
enabled: body.enabled,
|
|
301
|
-
}));
|
|
302
|
-
return true;
|
|
303
|
-
}
|
|
304
|
-
if (method === "GET" &&
|
|
305
|
-
pathname === "/api/lifeops/connectors/google/status") {
|
|
306
|
-
if (rateLimitRequest(ctx, "google_api_read"))
|
|
307
|
-
return true;
|
|
308
|
-
return runRoute(ctx, async (service) => {
|
|
309
|
-
const rawMode = url.searchParams.get("mode");
|
|
310
|
-
const rawSide = url.searchParams.get("side");
|
|
311
|
-
if (rawMode !== null &&
|
|
312
|
-
rawMode !== "local" &&
|
|
313
|
-
rawMode !== "remote" &&
|
|
314
|
-
rawMode !== "cloud_managed") {
|
|
315
|
-
throw new LifeOpsServiceError(400, "mode must be one of: local, remote, cloud_managed");
|
|
316
|
-
}
|
|
317
|
-
if (rawSide !== null && rawSide !== "owner" && rawSide !== "agent") {
|
|
318
|
-
throw new LifeOpsServiceError(400, "side must be one of: owner, agent");
|
|
319
|
-
}
|
|
320
|
-
json(res, await service.getGoogleConnectorStatus(url, (rawMode ?? undefined), (rawSide ?? undefined)));
|
|
321
|
-
});
|
|
322
|
-
}
|
|
323
|
-
if (method === "GET" && pathname === "/api/lifeops/calendar/feed") {
|
|
324
|
-
if (rateLimitRequest(ctx, "google_api_read"))
|
|
325
|
-
return true;
|
|
326
|
-
return runRoute(ctx, async (service) => {
|
|
327
|
-
const rawMode = url.searchParams.get("mode");
|
|
328
|
-
const rawSide = url.searchParams.get("side");
|
|
329
|
-
const rawForceSync = url.searchParams.get("forceSync");
|
|
330
|
-
if (rawMode !== null &&
|
|
331
|
-
rawMode !== "local" &&
|
|
332
|
-
rawMode !== "remote" &&
|
|
333
|
-
rawMode !== "cloud_managed") {
|
|
334
|
-
throw new LifeOpsServiceError(400, "mode must be one of: local, remote, cloud_managed");
|
|
335
|
-
}
|
|
336
|
-
if (rawSide !== null && rawSide !== "owner" && rawSide !== "agent") {
|
|
337
|
-
throw new LifeOpsServiceError(400, "side must be one of: owner, agent");
|
|
338
|
-
}
|
|
339
|
-
if (rawForceSync !== null &&
|
|
340
|
-
rawForceSync !== "true" &&
|
|
341
|
-
rawForceSync !== "false" &&
|
|
342
|
-
rawForceSync !== "1" &&
|
|
343
|
-
rawForceSync !== "0") {
|
|
344
|
-
throw new LifeOpsServiceError(400, "forceSync must be a boolean");
|
|
345
|
-
}
|
|
346
|
-
const request = {
|
|
347
|
-
mode: (rawMode ?? undefined),
|
|
348
|
-
side: (rawSide ?? undefined),
|
|
349
|
-
calendarId: url.searchParams.get("calendarId") ?? undefined,
|
|
350
|
-
timeMin: url.searchParams.get("timeMin") ?? undefined,
|
|
351
|
-
timeMax: url.searchParams.get("timeMax") ?? undefined,
|
|
352
|
-
timeZone: url.searchParams.get("timeZone") ?? undefined,
|
|
353
|
-
forceSync: rawForceSync === null
|
|
354
|
-
? undefined
|
|
355
|
-
: rawForceSync === "true" || rawForceSync === "1",
|
|
356
|
-
};
|
|
357
|
-
json(res, await service.getCalendarFeed(url, request));
|
|
358
|
-
});
|
|
359
|
-
}
|
|
360
|
-
if (method === "GET" && pathname === "/api/lifeops/calendar/next-context") {
|
|
361
|
-
if (rateLimitRequest(ctx, "google_api_read"))
|
|
362
|
-
return true;
|
|
363
|
-
return runRoute(ctx, async (service) => {
|
|
364
|
-
const rawMode = url.searchParams.get("mode");
|
|
365
|
-
const rawSide = url.searchParams.get("side");
|
|
366
|
-
if (rawMode !== null &&
|
|
367
|
-
rawMode !== "local" &&
|
|
368
|
-
rawMode !== "remote" &&
|
|
369
|
-
rawMode !== "cloud_managed") {
|
|
370
|
-
throw new LifeOpsServiceError(400, "mode must be one of: local, remote, cloud_managed");
|
|
371
|
-
}
|
|
372
|
-
if (rawSide !== null && rawSide !== "owner" && rawSide !== "agent") {
|
|
373
|
-
throw new LifeOpsServiceError(400, "side must be one of: owner, agent");
|
|
374
|
-
}
|
|
375
|
-
const request = {
|
|
376
|
-
mode: (rawMode ?? undefined),
|
|
377
|
-
side: (rawSide ?? undefined),
|
|
378
|
-
calendarId: url.searchParams.get("calendarId") ?? undefined,
|
|
379
|
-
timeMin: url.searchParams.get("timeMin") ?? undefined,
|
|
380
|
-
timeMax: url.searchParams.get("timeMax") ?? undefined,
|
|
381
|
-
timeZone: url.searchParams.get("timeZone") ?? undefined,
|
|
382
|
-
};
|
|
383
|
-
json(res, await service.getNextCalendarEventContext(url, request));
|
|
384
|
-
});
|
|
385
|
-
}
|
|
386
|
-
if (method === "GET" && pathname === "/api/lifeops/gmail/triage") {
|
|
387
|
-
if (rateLimitRequest(ctx, "google_api_read"))
|
|
388
|
-
return true;
|
|
389
|
-
return runRoute(ctx, async (service) => {
|
|
390
|
-
const rawMode = url.searchParams.get("mode");
|
|
391
|
-
const rawSide = url.searchParams.get("side");
|
|
392
|
-
const rawForceSync = url.searchParams.get("forceSync");
|
|
393
|
-
if (rawMode !== null &&
|
|
394
|
-
rawMode !== "local" &&
|
|
395
|
-
rawMode !== "remote" &&
|
|
396
|
-
rawMode !== "cloud_managed") {
|
|
397
|
-
throw new LifeOpsServiceError(400, "mode must be one of: local, remote, cloud_managed");
|
|
398
|
-
}
|
|
399
|
-
if (rawSide !== null && rawSide !== "owner" && rawSide !== "agent") {
|
|
400
|
-
throw new LifeOpsServiceError(400, "side must be one of: owner, agent");
|
|
401
|
-
}
|
|
402
|
-
if (rawForceSync !== null &&
|
|
403
|
-
rawForceSync !== "true" &&
|
|
404
|
-
rawForceSync !== "false" &&
|
|
405
|
-
rawForceSync !== "1" &&
|
|
406
|
-
rawForceSync !== "0") {
|
|
407
|
-
throw new LifeOpsServiceError(400, "forceSync must be a boolean");
|
|
408
|
-
}
|
|
409
|
-
const request = {
|
|
410
|
-
mode: (rawMode ?? undefined),
|
|
411
|
-
side: (rawSide ?? undefined),
|
|
412
|
-
forceSync: rawForceSync === null
|
|
413
|
-
? undefined
|
|
414
|
-
: rawForceSync === "true" || rawForceSync === "1",
|
|
415
|
-
maxResults: url.searchParams.get("maxResults") === null
|
|
416
|
-
? undefined
|
|
417
|
-
: Number(url.searchParams.get("maxResults")),
|
|
418
|
-
};
|
|
419
|
-
json(res, await service.getGmailTriage(url, request));
|
|
420
|
-
});
|
|
421
|
-
}
|
|
422
|
-
if (method === "GET" && pathname === "/api/lifeops/gmail/search") {
|
|
423
|
-
if (rateLimitRequest(ctx, "google_api_read"))
|
|
424
|
-
return true;
|
|
425
|
-
return runRoute(ctx, async (service) => {
|
|
426
|
-
const rawMode = url.searchParams.get("mode");
|
|
427
|
-
const rawSide = url.searchParams.get("side");
|
|
428
|
-
const rawForceSync = url.searchParams.get("forceSync");
|
|
429
|
-
const query = url.searchParams.get("query");
|
|
430
|
-
const rawReplyNeededOnly = url.searchParams.get("replyNeededOnly");
|
|
431
|
-
if (rawMode !== null &&
|
|
432
|
-
rawMode !== "local" &&
|
|
433
|
-
rawMode !== "remote" &&
|
|
434
|
-
rawMode !== "cloud_managed") {
|
|
435
|
-
throw new LifeOpsServiceError(400, "mode must be one of: local, remote, cloud_managed");
|
|
436
|
-
}
|
|
437
|
-
if (rawSide !== null && rawSide !== "owner" && rawSide !== "agent") {
|
|
438
|
-
throw new LifeOpsServiceError(400, "side must be one of: owner, agent");
|
|
439
|
-
}
|
|
440
|
-
if (rawForceSync !== null &&
|
|
441
|
-
rawForceSync !== "true" &&
|
|
442
|
-
rawForceSync !== "false" &&
|
|
443
|
-
rawForceSync !== "1" &&
|
|
444
|
-
rawForceSync !== "0") {
|
|
445
|
-
throw new LifeOpsServiceError(400, "forceSync must be a boolean");
|
|
446
|
-
}
|
|
447
|
-
if (rawReplyNeededOnly !== null &&
|
|
448
|
-
rawReplyNeededOnly !== "true" &&
|
|
449
|
-
rawReplyNeededOnly !== "false" &&
|
|
450
|
-
rawReplyNeededOnly !== "1" &&
|
|
451
|
-
rawReplyNeededOnly !== "0") {
|
|
452
|
-
throw new LifeOpsServiceError(400, "replyNeededOnly must be a boolean");
|
|
453
|
-
}
|
|
454
|
-
const request = {
|
|
455
|
-
mode: (rawMode ?? undefined),
|
|
456
|
-
side: (rawSide ?? undefined),
|
|
457
|
-
forceSync: rawForceSync === null
|
|
458
|
-
? undefined
|
|
459
|
-
: rawForceSync === "true" || rawForceSync === "1",
|
|
460
|
-
maxResults: url.searchParams.get("maxResults") === null
|
|
461
|
-
? undefined
|
|
462
|
-
: Number(url.searchParams.get("maxResults")),
|
|
463
|
-
query: query ?? "",
|
|
464
|
-
replyNeededOnly: rawReplyNeededOnly === null
|
|
465
|
-
? undefined
|
|
466
|
-
: rawReplyNeededOnly === "true" || rawReplyNeededOnly === "1",
|
|
467
|
-
};
|
|
468
|
-
json(res, await service.getGmailSearch(url, request));
|
|
469
|
-
});
|
|
470
|
-
}
|
|
471
|
-
if (method === "GET" && pathname === "/api/lifeops/gmail/needs-response") {
|
|
472
|
-
if (rateLimitRequest(ctx, "google_api_read"))
|
|
473
|
-
return true;
|
|
474
|
-
return runRoute(ctx, async (service) => {
|
|
475
|
-
const rawMode = url.searchParams.get("mode");
|
|
476
|
-
const rawSide = url.searchParams.get("side");
|
|
477
|
-
const rawForceSync = url.searchParams.get("forceSync");
|
|
478
|
-
if (rawMode !== null &&
|
|
479
|
-
rawMode !== "local" &&
|
|
480
|
-
rawMode !== "remote" &&
|
|
481
|
-
rawMode !== "cloud_managed") {
|
|
482
|
-
throw new LifeOpsServiceError(400, "mode must be one of: local, remote, cloud_managed");
|
|
483
|
-
}
|
|
484
|
-
if (rawSide !== null && rawSide !== "owner" && rawSide !== "agent") {
|
|
485
|
-
throw new LifeOpsServiceError(400, "side must be one of: owner, agent");
|
|
486
|
-
}
|
|
487
|
-
if (rawForceSync !== null &&
|
|
488
|
-
rawForceSync !== "true" &&
|
|
489
|
-
rawForceSync !== "false" &&
|
|
490
|
-
rawForceSync !== "1" &&
|
|
491
|
-
rawForceSync !== "0") {
|
|
492
|
-
throw new LifeOpsServiceError(400, "forceSync must be a boolean");
|
|
493
|
-
}
|
|
494
|
-
const request = {
|
|
495
|
-
mode: (rawMode ?? undefined),
|
|
496
|
-
side: (rawSide ?? undefined),
|
|
497
|
-
forceSync: rawForceSync === null
|
|
498
|
-
? undefined
|
|
499
|
-
: rawForceSync === "true" || rawForceSync === "1",
|
|
500
|
-
maxResults: url.searchParams.get("maxResults") === null
|
|
501
|
-
? undefined
|
|
502
|
-
: Number(url.searchParams.get("maxResults")),
|
|
503
|
-
};
|
|
504
|
-
json(res, await service.getGmailNeedsResponse(url, request));
|
|
505
|
-
});
|
|
506
|
-
}
|
|
507
|
-
if (method === "POST" && pathname === "/api/lifeops/calendar/events") {
|
|
508
|
-
if (rateLimitRequest(ctx, "calendar_create"))
|
|
509
|
-
return true;
|
|
510
|
-
const body = await readJsonBody(req, res);
|
|
511
|
-
if (!body)
|
|
512
|
-
return true;
|
|
513
|
-
return runRoute(ctx, async (service) => {
|
|
514
|
-
json(res, { event: await service.createCalendarEvent(url, body) }, 201);
|
|
515
|
-
});
|
|
516
|
-
}
|
|
517
|
-
if (method === "POST" && pathname === "/api/lifeops/gmail/reply-drafts") {
|
|
518
|
-
if (rateLimitRequest(ctx, "gmail_draft"))
|
|
519
|
-
return true;
|
|
520
|
-
const body = await readJsonBody(req, res);
|
|
521
|
-
if (!body)
|
|
522
|
-
return true;
|
|
523
|
-
return runRoute(ctx, async (service) => {
|
|
524
|
-
json(res, { draft: await service.createGmailReplyDraft(url, body) }, 201);
|
|
525
|
-
});
|
|
526
|
-
}
|
|
527
|
-
if (method === "POST" &&
|
|
528
|
-
pathname === "/api/lifeops/gmail/batch-reply-drafts") {
|
|
529
|
-
if (rateLimitRequest(ctx, "gmail_draft"))
|
|
530
|
-
return true;
|
|
531
|
-
const body = await readJsonBody(req, res);
|
|
532
|
-
if (!body)
|
|
533
|
-
return true;
|
|
534
|
-
return runRoute(ctx, async (service) => {
|
|
535
|
-
json(res, { batch: await service.createGmailBatchReplyDrafts(url, body) }, 201);
|
|
536
|
-
});
|
|
537
|
-
}
|
|
538
|
-
if (method === "POST" && pathname === "/api/lifeops/gmail/reply-send") {
|
|
539
|
-
if (rateLimitRequest(ctx, "gmail_send"))
|
|
540
|
-
return true;
|
|
541
|
-
const body = await readJsonBody(req, res);
|
|
542
|
-
if (!body)
|
|
543
|
-
return true;
|
|
544
|
-
return runRoute(ctx, async (service) => {
|
|
545
|
-
json(res, await service.sendGmailReply(url, body));
|
|
546
|
-
});
|
|
547
|
-
}
|
|
548
|
-
if (method === "POST" && pathname === "/api/lifeops/gmail/message-send") {
|
|
549
|
-
if (rateLimitRequest(ctx, "gmail_send"))
|
|
550
|
-
return true;
|
|
551
|
-
const body = await readJsonBody(req, res);
|
|
552
|
-
if (!body)
|
|
553
|
-
return true;
|
|
554
|
-
return runRoute(ctx, async (service) => {
|
|
555
|
-
json(res, await service.sendGmailMessage(url, body));
|
|
556
|
-
});
|
|
557
|
-
}
|
|
558
|
-
if (method === "POST" && pathname === "/api/lifeops/gmail/batch-reply-send") {
|
|
559
|
-
if (rateLimitRequest(ctx, "gmail_send"))
|
|
560
|
-
return true;
|
|
561
|
-
const body = await readJsonBody(req, res);
|
|
562
|
-
if (!body)
|
|
563
|
-
return true;
|
|
564
|
-
return runRoute(ctx, async (service) => {
|
|
565
|
-
json(res, await service.sendGmailReplies(url, body));
|
|
566
|
-
});
|
|
567
|
-
}
|
|
568
|
-
if (method === "POST" &&
|
|
569
|
-
pathname === "/api/lifeops/connectors/google/start") {
|
|
570
|
-
if (rateLimitRequest(ctx, "google_api_write"))
|
|
571
|
-
return true;
|
|
572
|
-
const body = await readJsonBody(req, res);
|
|
573
|
-
if (!body)
|
|
574
|
-
return true;
|
|
575
|
-
return runRoute(ctx, async (service) => {
|
|
576
|
-
json(res, await service.startGoogleConnector(body, url));
|
|
577
|
-
});
|
|
578
|
-
}
|
|
579
|
-
if (method === "POST" &&
|
|
580
|
-
pathname === "/api/lifeops/connectors/google/preference") {
|
|
581
|
-
if (rateLimitRequest(ctx, "google_api_write"))
|
|
582
|
-
return true;
|
|
583
|
-
const body = await readJsonBody(req, res);
|
|
584
|
-
if (!body)
|
|
585
|
-
return true;
|
|
586
|
-
return runRoute(ctx, async (service) => {
|
|
587
|
-
json(res, await service.selectGoogleConnectorMode(url, body.mode, body.side));
|
|
588
|
-
});
|
|
589
|
-
}
|
|
590
|
-
if (method === "GET" &&
|
|
591
|
-
pathname === "/api/lifeops/connectors/google/callback") {
|
|
592
|
-
const service = getService(ctx);
|
|
593
|
-
if (!service)
|
|
594
|
-
return true;
|
|
595
|
-
try {
|
|
596
|
-
const connectorStatus = await service.completeGoogleConnectorCallback(url);
|
|
597
|
-
writeHtml(res, 200, "Google Connected", "Google access is now available in Eliza. You can close this window.", {
|
|
598
|
-
side: connectorStatus.side,
|
|
599
|
-
mode: connectorStatus.mode,
|
|
600
|
-
});
|
|
601
|
-
return true;
|
|
602
|
-
}
|
|
603
|
-
catch (error) {
|
|
604
|
-
if (error instanceof LifeOpsServiceError) {
|
|
605
|
-
writeHtml(res, error.status, "Google Connection Failed", error.message);
|
|
606
|
-
return true;
|
|
607
|
-
}
|
|
608
|
-
throw error;
|
|
609
|
-
}
|
|
610
|
-
}
|
|
611
|
-
if (method === "GET" &&
|
|
612
|
-
pathname === "/api/lifeops/connectors/google/success") {
|
|
613
|
-
const rawSide = url.searchParams.get("side");
|
|
614
|
-
const rawMode = url.searchParams.get("mode");
|
|
615
|
-
if (rawSide !== null && rawSide !== "owner" && rawSide !== "agent") {
|
|
616
|
-
ctx.error(res, "side must be one of: owner, agent", 400);
|
|
617
|
-
return true;
|
|
618
|
-
}
|
|
619
|
-
if (rawMode !== null &&
|
|
620
|
-
rawMode !== "local" &&
|
|
621
|
-
rawMode !== "remote" &&
|
|
622
|
-
rawMode !== "cloud_managed") {
|
|
623
|
-
ctx.error(res, "mode must be one of: local, remote, cloud_managed", 400);
|
|
624
|
-
return true;
|
|
625
|
-
}
|
|
626
|
-
writeHtml(res, 200, "Google Connected", "Google access is now available in Eliza. You can close this window.", {
|
|
627
|
-
side: (rawSide ?? "owner"),
|
|
628
|
-
mode: (rawMode ?? "cloud_managed"),
|
|
629
|
-
});
|
|
630
|
-
return true;
|
|
631
|
-
}
|
|
632
|
-
if (method === "POST" &&
|
|
633
|
-
pathname === "/api/lifeops/connectors/google/disconnect") {
|
|
634
|
-
if (rateLimitRequest(ctx, "google_api_write"))
|
|
635
|
-
return true;
|
|
636
|
-
const body = await readJsonBody(req, res);
|
|
637
|
-
if (!body)
|
|
638
|
-
return true;
|
|
639
|
-
return runRoute(ctx, async (service) => {
|
|
640
|
-
json(res, await service.disconnectGoogleConnector(body, url));
|
|
641
|
-
});
|
|
642
|
-
}
|
|
643
|
-
if (method === "GET" && pathname === "/api/lifeops/connectors/x/status") {
|
|
644
|
-
return runRoute(ctx, async (service) => {
|
|
645
|
-
const rawMode = url.searchParams.get("mode");
|
|
646
|
-
if (rawMode !== null && rawMode !== "local" && rawMode !== "remote") {
|
|
647
|
-
throw new LifeOpsServiceError(400, "mode must be one of: local, remote");
|
|
648
|
-
}
|
|
649
|
-
json(res, await service.getXConnectorStatus((rawMode ?? undefined)));
|
|
650
|
-
});
|
|
651
|
-
}
|
|
652
|
-
if (method === "POST" && pathname === "/api/lifeops/connectors/x") {
|
|
653
|
-
const body = await readJsonBody(req, res);
|
|
654
|
-
if (!body)
|
|
655
|
-
return true;
|
|
656
|
-
return runRoute(ctx, async (service) => {
|
|
657
|
-
json(res, await service.upsertXConnector(body), 201);
|
|
658
|
-
});
|
|
659
|
-
}
|
|
660
|
-
if (method === "POST" && pathname === "/api/lifeops/x/posts") {
|
|
661
|
-
const body = await readJsonBody(req, res);
|
|
662
|
-
if (!body)
|
|
663
|
-
return true;
|
|
664
|
-
return runRoute(ctx, async (service) => {
|
|
665
|
-
json(res, await service.createXPost(body), 201);
|
|
666
|
-
});
|
|
667
|
-
}
|
|
668
|
-
if (method === "GET" && pathname === "/api/lifeops/channel-policies") {
|
|
669
|
-
return runRoute(ctx, async (service) => {
|
|
670
|
-
json(res, { policies: await service.listChannelPolicies() });
|
|
671
|
-
});
|
|
672
|
-
}
|
|
673
|
-
if (method === "POST" && pathname === "/api/lifeops/channel-policies") {
|
|
674
|
-
const body = await readJsonBody(req, res);
|
|
675
|
-
if (!body)
|
|
676
|
-
return true;
|
|
677
|
-
return runRoute(ctx, async (service) => {
|
|
678
|
-
json(res, { policy: await service.upsertChannelPolicy(body) }, 201);
|
|
679
|
-
});
|
|
680
|
-
}
|
|
681
|
-
if (method === "POST" && pathname === "/api/lifeops/channels/phone-consent") {
|
|
682
|
-
const body = await readJsonBody(req, res);
|
|
683
|
-
if (!body)
|
|
684
|
-
return true;
|
|
685
|
-
return runRoute(ctx, async (service) => {
|
|
686
|
-
json(res, await service.capturePhoneConsent(body), 201);
|
|
687
|
-
});
|
|
688
|
-
}
|
|
689
|
-
if (method === "GET" && pathname === "/api/lifeops/activity-signals") {
|
|
690
|
-
return runRoute(ctx, async (service) => {
|
|
691
|
-
json(res, {
|
|
692
|
-
signals: await service.listActivitySignals({
|
|
693
|
-
sinceAt: url.searchParams.get("sinceAt"),
|
|
694
|
-
limit: parsePositiveIntegerQuery(url.searchParams.get("limit"), "limit"),
|
|
695
|
-
states: parseActivitySignalStates(url),
|
|
696
|
-
}),
|
|
697
|
-
});
|
|
698
|
-
});
|
|
699
|
-
}
|
|
700
|
-
if (method === "POST" && pathname === "/api/lifeops/activity-signals") {
|
|
701
|
-
const body = await readJsonBody(req, res);
|
|
702
|
-
if (!body)
|
|
703
|
-
return true;
|
|
704
|
-
return runRoute(ctx, async (service) => {
|
|
705
|
-
json(res, { signal: await service.captureActivitySignal(body) }, 201);
|
|
706
|
-
});
|
|
707
|
-
}
|
|
708
|
-
if (method === "POST" && pathname === "/api/lifeops/reminders/process") {
|
|
709
|
-
if (rateLimitRequest(ctx, "reminders_process"))
|
|
710
|
-
return true;
|
|
711
|
-
const body = await readJsonBody(req, res);
|
|
712
|
-
if (!body)
|
|
713
|
-
return true;
|
|
714
|
-
return runRoute(ctx, async (service) => {
|
|
715
|
-
json(res, await service.processReminders(body));
|
|
716
|
-
});
|
|
717
|
-
}
|
|
718
|
-
if (method === "GET" && pathname === "/api/lifeops/reminder-preferences") {
|
|
719
|
-
return runRoute(ctx, async (service) => {
|
|
720
|
-
json(res, await service.getReminderPreference(url.searchParams.get("definitionId") ?? undefined));
|
|
721
|
-
});
|
|
722
|
-
}
|
|
723
|
-
if (method === "POST" && pathname === "/api/lifeops/reminder-preferences") {
|
|
724
|
-
const body = await readJsonBody(req, res);
|
|
725
|
-
if (!body)
|
|
726
|
-
return true;
|
|
727
|
-
return runRoute(ctx, async (service) => {
|
|
728
|
-
json(res, await service.setReminderPreference(body), 201);
|
|
729
|
-
});
|
|
730
|
-
}
|
|
731
|
-
if (method === "POST" && pathname === "/api/lifeops/reminders/acknowledge") {
|
|
732
|
-
const body = await readJsonBody(req, res);
|
|
733
|
-
if (!body)
|
|
734
|
-
return true;
|
|
735
|
-
return runRoute(ctx, async (service) => {
|
|
736
|
-
json(res, await service.acknowledgeReminder(body));
|
|
737
|
-
});
|
|
738
|
-
}
|
|
739
|
-
if (method === "POST" && pathname === "/api/lifeops/website-access/relock") {
|
|
740
|
-
const body = await readJsonBody(req, res);
|
|
741
|
-
if (!body)
|
|
742
|
-
return true;
|
|
743
|
-
return runRoute(ctx, async (service) => {
|
|
744
|
-
json(res, await service.relockWebsiteAccessGroup(body.groupKey));
|
|
745
|
-
});
|
|
746
|
-
}
|
|
747
|
-
const websiteAccessCallbackMatch = pathname.match(/^\/api\/lifeops\/website-access\/callbacks\/([^/]+)\/resolve$/);
|
|
748
|
-
if (method === "POST" && websiteAccessCallbackMatch) {
|
|
749
|
-
const callbackKey = decodePathComponent(websiteAccessCallbackMatch[1], res, "website access callback key");
|
|
750
|
-
if (!callbackKey)
|
|
751
|
-
return true;
|
|
752
|
-
const body = await readJsonBody(req, res);
|
|
753
|
-
if (body === null)
|
|
754
|
-
return true;
|
|
755
|
-
return runRoute(ctx, async (service) => {
|
|
756
|
-
json(res, await service.resolveWebsiteAccessCallback(body.callbackKey || callbackKey));
|
|
757
|
-
});
|
|
758
|
-
}
|
|
759
|
-
if (method === "GET" && pathname === "/api/lifeops/reminders/inspection") {
|
|
760
|
-
return runRoute(ctx, async (service) => {
|
|
761
|
-
const ownerType = url.searchParams.get("ownerType");
|
|
762
|
-
const ownerId = url.searchParams.get("ownerId");
|
|
763
|
-
if (ownerType !== "occurrence" && ownerType !== "calendar_event") {
|
|
764
|
-
throw new LifeOpsServiceError(400, "ownerType must be occurrence or calendar_event");
|
|
765
|
-
}
|
|
766
|
-
if (!ownerId) {
|
|
767
|
-
throw new LifeOpsServiceError(400, "ownerId is required");
|
|
768
|
-
}
|
|
769
|
-
json(res, await service.inspectReminder(ownerType, ownerId));
|
|
770
|
-
});
|
|
771
|
-
}
|
|
772
|
-
if (method === "GET" && pathname === "/api/lifeops/workflows") {
|
|
773
|
-
return runRoute(ctx, async (service) => {
|
|
774
|
-
json(res, { workflows: await service.listWorkflows() });
|
|
775
|
-
});
|
|
776
|
-
}
|
|
777
|
-
if (method === "POST" && pathname === "/api/lifeops/workflows") {
|
|
778
|
-
const body = await readJsonBody(req, res);
|
|
779
|
-
if (!body)
|
|
780
|
-
return true;
|
|
781
|
-
return runRoute(ctx, async (service) => {
|
|
782
|
-
json(res, await service.createWorkflow(body), 201);
|
|
783
|
-
});
|
|
784
|
-
}
|
|
785
|
-
if (method === "GET" && pathname === "/api/lifeops/browser/sessions") {
|
|
786
|
-
return runRoute(ctx, async (service) => {
|
|
787
|
-
json(res, { sessions: await service.listBrowserSessions() });
|
|
788
|
-
});
|
|
789
|
-
}
|
|
790
|
-
if (method === "GET" && pathname === "/api/lifeops/browser/settings") {
|
|
791
|
-
return runRoute(ctx, async (service) => {
|
|
792
|
-
json(res, { settings: await service.getBrowserSettings() });
|
|
793
|
-
});
|
|
794
|
-
}
|
|
795
|
-
if (method === "POST" && pathname === "/api/lifeops/browser/settings") {
|
|
796
|
-
const body = await readJsonBody(req, res);
|
|
797
|
-
if (!body)
|
|
798
|
-
return true;
|
|
799
|
-
return runRoute(ctx, async (service) => {
|
|
800
|
-
json(res, { settings: await service.updateBrowserSettings(body) });
|
|
801
|
-
});
|
|
802
|
-
}
|
|
803
|
-
if (method === "POST" &&
|
|
804
|
-
pathname === "/api/lifeops/browser/companions/pair") {
|
|
805
|
-
const body = await readJsonBody(req, res);
|
|
806
|
-
if (!body)
|
|
807
|
-
return true;
|
|
808
|
-
return runRoute(ctx, async (service) => {
|
|
809
|
-
json(res, await service.createBrowserCompanionPairing(body), 201);
|
|
810
|
-
});
|
|
811
|
-
}
|
|
812
|
-
if (method === "GET" && pathname === "/api/lifeops/browser/companions") {
|
|
813
|
-
return runRoute(ctx, async (service) => {
|
|
814
|
-
json(res, { companions: await service.listBrowserCompanions() });
|
|
815
|
-
});
|
|
816
|
-
}
|
|
817
|
-
if (method === "GET" && pathname === "/api/lifeops/browser/packages") {
|
|
818
|
-
return runRoute(ctx, async () => {
|
|
819
|
-
json(res, { status: getLifeOpsBrowserCompanionPackageStatus() });
|
|
820
|
-
});
|
|
821
|
-
}
|
|
822
|
-
if (method === "POST" &&
|
|
823
|
-
pathname === "/api/lifeops/browser/companions/sync") {
|
|
824
|
-
const body = await readJsonBody(req, res);
|
|
825
|
-
if (!body)
|
|
826
|
-
return true;
|
|
827
|
-
return runRoute(ctx, async (service) => {
|
|
828
|
-
const auth = getBrowserCompanionAuth(ctx);
|
|
829
|
-
if (!auth) {
|
|
830
|
-
return;
|
|
831
|
-
}
|
|
832
|
-
json(res, await service.syncBrowserCompanion(auth.companionId, auth.pairingToken, body));
|
|
833
|
-
});
|
|
834
|
-
}
|
|
835
|
-
if (method === "GET" && pathname === "/api/lifeops/browser/tabs") {
|
|
836
|
-
return runRoute(ctx, async (service) => {
|
|
837
|
-
json(res, { tabs: await service.listBrowserTabs() });
|
|
838
|
-
});
|
|
839
|
-
}
|
|
840
|
-
const browserPackageBuildMatch = pathname.match(/^\/api\/lifeops\/browser\/packages\/([^/]+)\/build$/);
|
|
841
|
-
if (method === "POST" && browserPackageBuildMatch) {
|
|
842
|
-
const browser = decodePathComponent(browserPackageBuildMatch[1], res, "browser package target");
|
|
843
|
-
if (!browser)
|
|
844
|
-
return true;
|
|
845
|
-
if (browser !== "chrome" && browser !== "safari") {
|
|
846
|
-
ctx.error(res, "browser must be chrome or safari", 400);
|
|
847
|
-
return true;
|
|
848
|
-
}
|
|
849
|
-
return runRoute(ctx, async () => {
|
|
850
|
-
json(res, {
|
|
851
|
-
status: await buildLifeOpsBrowserCompanionPackage(browser),
|
|
852
|
-
});
|
|
853
|
-
});
|
|
854
|
-
}
|
|
855
|
-
const browserPackageDownloadMatch = pathname.match(/^\/api\/lifeops\/browser\/packages\/([^/]+)\/download$/);
|
|
856
|
-
if (method === "GET" && browserPackageDownloadMatch) {
|
|
857
|
-
const browser = decodePathComponent(browserPackageDownloadMatch[1], res, "browser package target");
|
|
858
|
-
if (!browser)
|
|
859
|
-
return true;
|
|
860
|
-
if (browser !== "chrome" && browser !== "safari") {
|
|
861
|
-
ctx.error(res, "browser must be chrome or safari", 400);
|
|
862
|
-
return true;
|
|
863
|
-
}
|
|
864
|
-
return runRoute(ctx, async () => {
|
|
865
|
-
const artifact = getLifeOpsBrowserCompanionDownloadFile(browser);
|
|
866
|
-
res.statusCode = 200;
|
|
867
|
-
res.setHeader("Content-Type", artifact.contentType);
|
|
868
|
-
res.setHeader("Content-Disposition", `attachment; filename="${artifact.filename}"`);
|
|
869
|
-
await new Promise((resolve, reject) => {
|
|
870
|
-
const stream = fs.createReadStream(artifact.path);
|
|
871
|
-
stream.on("error", reject);
|
|
872
|
-
res.on("error", reject);
|
|
873
|
-
stream.on("end", resolve);
|
|
874
|
-
stream.pipe(res);
|
|
875
|
-
});
|
|
876
|
-
});
|
|
877
|
-
}
|
|
878
|
-
if (method === "GET" && pathname === "/api/lifeops/browser/current-page") {
|
|
879
|
-
return runRoute(ctx, async (service) => {
|
|
880
|
-
json(res, { page: await service.getCurrentBrowserPage() });
|
|
881
|
-
});
|
|
882
|
-
}
|
|
883
|
-
if (method === "POST" && pathname === "/api/lifeops/browser/sync") {
|
|
884
|
-
const body = await readJsonBody(req, res);
|
|
885
|
-
if (!body)
|
|
886
|
-
return true;
|
|
887
|
-
return runRoute(ctx, async (service) => {
|
|
888
|
-
json(res, await service.syncBrowserState(body));
|
|
889
|
-
});
|
|
890
|
-
}
|
|
891
|
-
if (method === "POST" && pathname === "/api/lifeops/browser/sessions") {
|
|
892
|
-
const body = await readJsonBody(req, res);
|
|
893
|
-
if (!body)
|
|
894
|
-
return true;
|
|
895
|
-
return runRoute(ctx, async (service) => {
|
|
896
|
-
json(res, { session: await service.createBrowserSession(body) }, 201);
|
|
897
|
-
});
|
|
898
|
-
}
|
|
899
|
-
if (method === "GET" && pathname === "/api/lifeops/overview") {
|
|
900
|
-
return runRoute(ctx, async (service) => {
|
|
901
|
-
json(res, await service.getOverview());
|
|
902
|
-
});
|
|
903
|
-
}
|
|
904
|
-
if (method === "GET" && pathname === "/api/lifeops/seed-templates") {
|
|
905
|
-
return runRoute(ctx, async (service) => {
|
|
906
|
-
json(res, await service.checkAndOfferSeeding());
|
|
907
|
-
});
|
|
908
|
-
}
|
|
909
|
-
if (method === "POST" && pathname === "/api/lifeops/seed") {
|
|
910
|
-
const body = await readJsonBody(req, res);
|
|
911
|
-
if (!body)
|
|
912
|
-
return true;
|
|
913
|
-
if (!Array.isArray(body.keys) || body.keys.length === 0) {
|
|
914
|
-
ctx.error(res, "keys must be a non-empty array of seed template keys", 400);
|
|
915
|
-
return true;
|
|
916
|
-
}
|
|
917
|
-
return runRoute(ctx, async (service) => {
|
|
918
|
-
const ids = await service.applySeedRoutines(body.keys, body.timezone);
|
|
919
|
-
json(res, { createdIds: ids }, 201);
|
|
920
|
-
});
|
|
921
|
-
}
|
|
922
|
-
if (method === "GET" && pathname === "/api/lifeops/definitions") {
|
|
923
|
-
return runRoute(ctx, async (service) => {
|
|
924
|
-
json(res, { definitions: await service.listDefinitions() });
|
|
925
|
-
});
|
|
926
|
-
}
|
|
927
|
-
if (method === "POST" && pathname === "/api/lifeops/definitions") {
|
|
928
|
-
if (rateLimitRequest(ctx, "task_create"))
|
|
929
|
-
return true;
|
|
930
|
-
const body = await readJsonBody(req, res);
|
|
931
|
-
if (!body)
|
|
932
|
-
return true;
|
|
933
|
-
return runRoute(ctx, async (service) => {
|
|
934
|
-
json(res, await service.createDefinition(body), 201);
|
|
935
|
-
});
|
|
936
|
-
}
|
|
937
|
-
const definitionMatch = pathname.match(/^\/api\/lifeops\/definitions\/([^/]+)$/);
|
|
938
|
-
if (definitionMatch) {
|
|
939
|
-
const definitionId = decodePathComponent(definitionMatch[1], res, "definition id");
|
|
940
|
-
if (!definitionId)
|
|
941
|
-
return true;
|
|
942
|
-
if (method === "GET") {
|
|
943
|
-
return runRoute(ctx, async (service) => {
|
|
944
|
-
json(res, await service.getDefinition(definitionId));
|
|
945
|
-
});
|
|
946
|
-
}
|
|
947
|
-
if (method === "PUT") {
|
|
948
|
-
if (rateLimitRequest(ctx, "task_update"))
|
|
949
|
-
return true;
|
|
950
|
-
const body = await readJsonBody(req, res);
|
|
951
|
-
if (!body)
|
|
952
|
-
return true;
|
|
953
|
-
return runRoute(ctx, async (service) => {
|
|
954
|
-
json(res, await service.updateDefinition(definitionId, body));
|
|
955
|
-
});
|
|
956
|
-
}
|
|
957
|
-
if (method === "DELETE") {
|
|
958
|
-
return runRoute(ctx, async (service) => {
|
|
959
|
-
await service.deleteDefinition(definitionId);
|
|
960
|
-
json(res, { deleted: true });
|
|
961
|
-
});
|
|
962
|
-
}
|
|
963
|
-
}
|
|
964
|
-
if (method === "GET" && pathname === "/api/lifeops/goals") {
|
|
965
|
-
return runRoute(ctx, async (service) => {
|
|
966
|
-
json(res, { goals: await service.listGoals() });
|
|
967
|
-
});
|
|
968
|
-
}
|
|
969
|
-
if (method === "POST" && pathname === "/api/lifeops/goals") {
|
|
970
|
-
if (rateLimitRequest(ctx, "task_create"))
|
|
971
|
-
return true;
|
|
972
|
-
const body = await readJsonBody(req, res);
|
|
973
|
-
if (!body)
|
|
974
|
-
return true;
|
|
975
|
-
return runRoute(ctx, async (service) => {
|
|
976
|
-
json(res, await service.createGoal(body), 201);
|
|
977
|
-
});
|
|
978
|
-
}
|
|
979
|
-
const goalMatch = pathname.match(/^\/api\/lifeops\/goals\/([^/]+)$/);
|
|
980
|
-
if (goalMatch) {
|
|
981
|
-
const goalId = decodePathComponent(goalMatch[1], res, "goal id");
|
|
982
|
-
if (!goalId)
|
|
983
|
-
return true;
|
|
984
|
-
if (method === "GET") {
|
|
985
|
-
return runRoute(ctx, async (service) => {
|
|
986
|
-
json(res, await service.getGoal(goalId));
|
|
987
|
-
});
|
|
988
|
-
}
|
|
989
|
-
if (method === "PUT") {
|
|
990
|
-
if (rateLimitRequest(ctx, "task_update"))
|
|
991
|
-
return true;
|
|
992
|
-
const body = await readJsonBody(req, res);
|
|
993
|
-
if (!body)
|
|
994
|
-
return true;
|
|
995
|
-
return runRoute(ctx, async (service) => {
|
|
996
|
-
json(res, await service.updateGoal(goalId, body));
|
|
997
|
-
});
|
|
998
|
-
}
|
|
999
|
-
if (method === "DELETE") {
|
|
1000
|
-
return runRoute(ctx, async (service) => {
|
|
1001
|
-
await service.deleteGoal(goalId);
|
|
1002
|
-
json(res, { deleted: true });
|
|
1003
|
-
});
|
|
1004
|
-
}
|
|
1005
|
-
}
|
|
1006
|
-
const goalReviewMatch = pathname.match(/^\/api\/lifeops\/goals\/([^/]+)\/review$/);
|
|
1007
|
-
if (goalReviewMatch && method === "GET") {
|
|
1008
|
-
const goalId = decodePathComponent(goalReviewMatch[1], res, "goal id");
|
|
1009
|
-
if (!goalId)
|
|
1010
|
-
return true;
|
|
1011
|
-
return runRoute(ctx, async (service) => {
|
|
1012
|
-
json(res, await service.reviewGoal(goalId));
|
|
1013
|
-
});
|
|
1014
|
-
}
|
|
1015
|
-
const workflowMatch = pathname.match(/^\/api\/lifeops\/workflows\/([^/]+)$/);
|
|
1016
|
-
if (workflowMatch) {
|
|
1017
|
-
const workflowId = decodePathComponent(workflowMatch[1], res, "workflow id");
|
|
1018
|
-
if (!workflowId)
|
|
1019
|
-
return true;
|
|
1020
|
-
if (method === "GET") {
|
|
1021
|
-
return runRoute(ctx, async (service) => {
|
|
1022
|
-
json(res, await service.getWorkflow(workflowId));
|
|
1023
|
-
});
|
|
1024
|
-
}
|
|
1025
|
-
if (method === "PUT") {
|
|
1026
|
-
const body = await readJsonBody(req, res);
|
|
1027
|
-
if (!body)
|
|
1028
|
-
return true;
|
|
1029
|
-
return runRoute(ctx, async (service) => {
|
|
1030
|
-
json(res, await service.updateWorkflow(workflowId, body));
|
|
1031
|
-
});
|
|
1032
|
-
}
|
|
1033
|
-
}
|
|
1034
|
-
const workflowRunMatch = pathname.match(/^\/api\/lifeops\/workflows\/([^/]+)\/run$/);
|
|
1035
|
-
if (method === "POST" && workflowRunMatch) {
|
|
1036
|
-
const workflowId = decodePathComponent(workflowRunMatch[1], res, "workflow id");
|
|
1037
|
-
if (!workflowId)
|
|
1038
|
-
return true;
|
|
1039
|
-
const body = await readJsonBody(req, res);
|
|
1040
|
-
if (!body)
|
|
1041
|
-
return true;
|
|
1042
|
-
return runRoute(ctx, async (service) => {
|
|
1043
|
-
json(res, { run: await service.runWorkflow(workflowId, body) }, 201);
|
|
1044
|
-
});
|
|
1045
|
-
}
|
|
1046
|
-
const browserSessionMatch = pathname.match(/^\/api\/lifeops\/browser\/sessions\/([^/]+)$/);
|
|
1047
|
-
if (browserSessionMatch) {
|
|
1048
|
-
const sessionId = decodePathComponent(browserSessionMatch[1], res, "browser session id");
|
|
1049
|
-
if (!sessionId)
|
|
1050
|
-
return true;
|
|
1051
|
-
if (method === "GET") {
|
|
1052
|
-
return runRoute(ctx, async (service) => {
|
|
1053
|
-
json(res, { session: await service.getBrowserSession(sessionId) });
|
|
1054
|
-
});
|
|
1055
|
-
}
|
|
1056
|
-
}
|
|
1057
|
-
const browserConfirmMatch = pathname.match(/^\/api\/lifeops\/browser\/sessions\/([^/]+)\/confirm$/);
|
|
1058
|
-
if (method === "POST" && browserConfirmMatch) {
|
|
1059
|
-
const sessionId = decodePathComponent(browserConfirmMatch[1], res, "browser session id");
|
|
1060
|
-
if (!sessionId)
|
|
1061
|
-
return true;
|
|
1062
|
-
const body = await readJsonBody(req, res);
|
|
1063
|
-
if (!body)
|
|
1064
|
-
return true;
|
|
1065
|
-
return runRoute(ctx, async (service) => {
|
|
1066
|
-
json(res, {
|
|
1067
|
-
session: await service.confirmBrowserSession(sessionId, body),
|
|
1068
|
-
});
|
|
1069
|
-
});
|
|
1070
|
-
}
|
|
1071
|
-
const browserCompleteMatch = pathname.match(/^\/api\/lifeops\/browser\/sessions\/([^/]+)\/complete$/);
|
|
1072
|
-
if (method === "POST" && browserCompleteMatch) {
|
|
1073
|
-
const sessionId = decodePathComponent(browserCompleteMatch[1], res, "browser session id");
|
|
1074
|
-
if (!sessionId)
|
|
1075
|
-
return true;
|
|
1076
|
-
const body = await readJsonBody(req, res);
|
|
1077
|
-
if (!body)
|
|
1078
|
-
return true;
|
|
1079
|
-
return runRoute(ctx, async (service) => {
|
|
1080
|
-
json(res, {
|
|
1081
|
-
session: await service.completeBrowserSession(sessionId, body),
|
|
1082
|
-
});
|
|
1083
|
-
});
|
|
1084
|
-
}
|
|
1085
|
-
const browserCompanionProgressMatch = pathname.match(/^\/api\/lifeops\/browser\/companions\/sessions\/([^/]+)\/progress$/);
|
|
1086
|
-
if (method === "POST" && browserCompanionProgressMatch) {
|
|
1087
|
-
const sessionId = decodePathComponent(browserCompanionProgressMatch[1], res, "browser session id");
|
|
1088
|
-
if (!sessionId)
|
|
1089
|
-
return true;
|
|
1090
|
-
const body = await readJsonBody(req, res);
|
|
1091
|
-
if (!body)
|
|
1092
|
-
return true;
|
|
1093
|
-
return runRoute(ctx, async (service) => {
|
|
1094
|
-
const auth = getBrowserCompanionAuth(ctx);
|
|
1095
|
-
if (!auth) {
|
|
1096
|
-
return;
|
|
1097
|
-
}
|
|
1098
|
-
json(res, {
|
|
1099
|
-
session: await service.updateBrowserSessionProgressFromCompanion(auth.companionId, auth.pairingToken, sessionId, body),
|
|
1100
|
-
});
|
|
1101
|
-
});
|
|
1102
|
-
}
|
|
1103
|
-
const browserCompanionCompleteMatch = pathname.match(/^\/api\/lifeops\/browser\/companions\/sessions\/([^/]+)\/complete$/);
|
|
1104
|
-
if (method === "POST" && browserCompanionCompleteMatch) {
|
|
1105
|
-
const sessionId = decodePathComponent(browserCompanionCompleteMatch[1], res, "browser session id");
|
|
1106
|
-
if (!sessionId)
|
|
1107
|
-
return true;
|
|
1108
|
-
const body = await readJsonBody(req, res);
|
|
1109
|
-
if (!body)
|
|
1110
|
-
return true;
|
|
1111
|
-
return runRoute(ctx, async (service) => {
|
|
1112
|
-
const auth = getBrowserCompanionAuth(ctx);
|
|
1113
|
-
if (!auth) {
|
|
1114
|
-
return;
|
|
1115
|
-
}
|
|
1116
|
-
json(res, {
|
|
1117
|
-
session: await service.completeBrowserSessionFromCompanion(auth.companionId, auth.pairingToken, sessionId, body),
|
|
1118
|
-
});
|
|
1119
|
-
});
|
|
1120
|
-
}
|
|
1121
|
-
const occurrenceExplanationMatch = pathname.match(/^\/api\/lifeops\/occurrences\/([^/]+)\/explanation$/);
|
|
1122
|
-
if (occurrenceExplanationMatch && method === "GET") {
|
|
1123
|
-
const occurrenceId = decodePathComponent(occurrenceExplanationMatch[1], res, "occurrence id");
|
|
1124
|
-
if (!occurrenceId)
|
|
1125
|
-
return true;
|
|
1126
|
-
return runRoute(ctx, async (service) => {
|
|
1127
|
-
json(res, await service.explainOccurrence(occurrenceId));
|
|
1128
|
-
});
|
|
1129
|
-
}
|
|
1130
|
-
const completeMatch = pathname.match(/^\/api\/lifeops\/occurrences\/([^/]+)\/complete$/);
|
|
1131
|
-
if (method === "POST" && completeMatch) {
|
|
1132
|
-
const occurrenceId = decodePathComponent(completeMatch[1], res, "occurrence id");
|
|
1133
|
-
if (!occurrenceId)
|
|
1134
|
-
return true;
|
|
1135
|
-
const body = await readJsonBody(req, res);
|
|
1136
|
-
if (!body)
|
|
1137
|
-
return true;
|
|
1138
|
-
return runRoute(ctx, async (service) => {
|
|
1139
|
-
json(res, {
|
|
1140
|
-
occurrence: await service.completeOccurrence(occurrenceId, body),
|
|
1141
|
-
});
|
|
1142
|
-
});
|
|
1143
|
-
}
|
|
1144
|
-
const skipMatch = pathname.match(/^\/api\/lifeops\/occurrences\/([^/]+)\/skip$/);
|
|
1145
|
-
if (method === "POST" && skipMatch) {
|
|
1146
|
-
const occurrenceId = decodePathComponent(skipMatch[1], res, "occurrence id");
|
|
1147
|
-
if (!occurrenceId)
|
|
1148
|
-
return true;
|
|
1149
|
-
const body = await readJsonBody(req, res);
|
|
1150
|
-
if (!body)
|
|
1151
|
-
return true;
|
|
1152
|
-
return runRoute(ctx, async (service) => {
|
|
1153
|
-
json(res, {
|
|
1154
|
-
occurrence: await service.skipOccurrence(occurrenceId),
|
|
1155
|
-
});
|
|
1156
|
-
});
|
|
1157
|
-
}
|
|
1158
|
-
const snoozeMatch = pathname.match(/^\/api\/lifeops\/occurrences\/([^/]+)\/snooze$/);
|
|
1159
|
-
if (method === "POST" && snoozeMatch) {
|
|
1160
|
-
const occurrenceId = decodePathComponent(snoozeMatch[1], res, "occurrence id");
|
|
1161
|
-
if (!occurrenceId)
|
|
1162
|
-
return true;
|
|
1163
|
-
const body = await readJsonBody(req, res);
|
|
1164
|
-
if (!body)
|
|
1165
|
-
return true;
|
|
1166
|
-
return runRoute(ctx, async (service) => {
|
|
1167
|
-
json(res, {
|
|
1168
|
-
occurrence: await service.snoozeOccurrence(occurrenceId, body),
|
|
1169
|
-
});
|
|
1170
|
-
});
|
|
1171
|
-
}
|
|
1172
|
-
return false;
|
|
1173
|
-
}
|
|
1
|
+
export * from "@elizaos/app-lifeops/routes/lifeops-routes";
|