@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,494 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import fs from "node:fs";
|
|
3
|
-
import path from "node:path";
|
|
4
|
-
import { resolveOAuthDir } from "../config/paths.js";
|
|
5
|
-
import { googleCapabilitiesToScopes, googleScopesToCapabilities, normalizeGoogleCapabilities, unionGoogleCapabilities, } from "./google-scopes.js";
|
|
6
|
-
const GOOGLE_AUTHORIZATION_ENDPOINT = "https://accounts.google.com/o/oauth2/v2/auth";
|
|
7
|
-
const GOOGLE_TOKEN_ENDPOINT = "https://oauth2.googleapis.com/token";
|
|
8
|
-
const GOOGLE_USERINFO_ENDPOINT = "https://openidconnect.googleapis.com/v1/userinfo";
|
|
9
|
-
const GOOGLE_OAUTH_SESSION_TTL_MS = 10 * 60 * 1000;
|
|
10
|
-
const GOOGLE_ACCESS_TOKEN_REFRESH_BUFFER_MS = 5 * 60 * 1000;
|
|
11
|
-
const pendingGoogleOAuthSessions = new Map();
|
|
12
|
-
const DESKTOP_CLIENT_ID_KEYS = [
|
|
13
|
-
"ELIZA_GOOGLE_OAUTH_DESKTOP_CLIENT_ID",
|
|
14
|
-
"ELIZA_GOOGLE_OAUTH_DESKTOP_CLIENT_ID",
|
|
15
|
-
];
|
|
16
|
-
const DESKTOP_CLIENT_SECRET_KEYS = [
|
|
17
|
-
"ELIZA_GOOGLE_OAUTH_DESKTOP_CLIENT_SECRET",
|
|
18
|
-
"ELIZA_GOOGLE_OAUTH_DESKTOP_CLIENT_SECRET",
|
|
19
|
-
];
|
|
20
|
-
const WEB_CLIENT_ID_KEYS = [
|
|
21
|
-
"ELIZA_GOOGLE_OAUTH_WEB_CLIENT_ID",
|
|
22
|
-
"ELIZA_GOOGLE_OAUTH_WEB_CLIENT_ID",
|
|
23
|
-
];
|
|
24
|
-
const WEB_CLIENT_SECRET_KEYS = [
|
|
25
|
-
"ELIZA_GOOGLE_OAUTH_WEB_CLIENT_SECRET",
|
|
26
|
-
"ELIZA_GOOGLE_OAUTH_WEB_CLIENT_SECRET",
|
|
27
|
-
];
|
|
28
|
-
const PUBLIC_BASE_URL_KEYS = [
|
|
29
|
-
"ELIZA_GOOGLE_OAUTH_PUBLIC_BASE_URL",
|
|
30
|
-
"ELIZA_GOOGLE_OAUTH_PUBLIC_BASE_URL",
|
|
31
|
-
];
|
|
32
|
-
export class GoogleOAuthError extends Error {
|
|
33
|
-
status;
|
|
34
|
-
constructor(status, message) {
|
|
35
|
-
super(message);
|
|
36
|
-
this.status = status;
|
|
37
|
-
this.name = "GoogleOAuthError";
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
function readEnvOverride(env, keys) {
|
|
41
|
-
for (const key of keys) {
|
|
42
|
-
const value = env[key]?.trim();
|
|
43
|
-
if (value) {
|
|
44
|
-
return value;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return undefined;
|
|
48
|
-
}
|
|
49
|
-
function isLoopbackHostname(hostname) {
|
|
50
|
-
const normalized = hostname.trim().toLowerCase();
|
|
51
|
-
return (normalized === "localhost" ||
|
|
52
|
-
normalized === "127.0.0.1" ||
|
|
53
|
-
normalized === "::1" ||
|
|
54
|
-
normalized === "[::1]");
|
|
55
|
-
}
|
|
56
|
-
function normalizeBaseUrl(value) {
|
|
57
|
-
return value.endsWith("/") ? value.slice(0, -1) : value;
|
|
58
|
-
}
|
|
59
|
-
export function resolveConfiguredGoogleModes(env = process.env) {
|
|
60
|
-
const modes = [];
|
|
61
|
-
if (readEnvOverride(env, DESKTOP_CLIENT_ID_KEYS)) {
|
|
62
|
-
modes.push("local");
|
|
63
|
-
}
|
|
64
|
-
if (readEnvOverride(env, WEB_CLIENT_ID_KEYS) &&
|
|
65
|
-
readEnvOverride(env, WEB_CLIENT_SECRET_KEYS) &&
|
|
66
|
-
readEnvOverride(env, PUBLIC_BASE_URL_KEYS)) {
|
|
67
|
-
modes.push("remote");
|
|
68
|
-
}
|
|
69
|
-
return modes;
|
|
70
|
-
}
|
|
71
|
-
export function resolveGoogleDefaultMode(requestUrl, env = process.env) {
|
|
72
|
-
const configuredModes = resolveConfiguredGoogleModes(env);
|
|
73
|
-
const loopbackRequest = isLoopbackHostname(requestUrl.hostname);
|
|
74
|
-
if (loopbackRequest && configuredModes.includes("local")) {
|
|
75
|
-
return "local";
|
|
76
|
-
}
|
|
77
|
-
if (!loopbackRequest && configuredModes.includes("remote")) {
|
|
78
|
-
return "remote";
|
|
79
|
-
}
|
|
80
|
-
if (configuredModes.length > 0) {
|
|
81
|
-
return configuredModes[0] ?? "local";
|
|
82
|
-
}
|
|
83
|
-
return loopbackRequest ? "local" : "remote";
|
|
84
|
-
}
|
|
85
|
-
export function resolveGoogleOAuthConfig(requestUrl, requestedMode, env = process.env) {
|
|
86
|
-
const availableModes = resolveConfiguredGoogleModes(env);
|
|
87
|
-
const defaultMode = resolveGoogleDefaultMode(requestUrl, env);
|
|
88
|
-
const mode = requestedMode ?? defaultMode;
|
|
89
|
-
if (mode === "local") {
|
|
90
|
-
const clientId = readEnvOverride(env, DESKTOP_CLIENT_ID_KEYS) ?? null;
|
|
91
|
-
const clientSecret = readEnvOverride(env, DESKTOP_CLIENT_SECRET_KEYS) ?? null;
|
|
92
|
-
const port = requestUrl.port || (requestUrl.protocol === "https:" ? "443" : "80");
|
|
93
|
-
return {
|
|
94
|
-
mode,
|
|
95
|
-
defaultMode,
|
|
96
|
-
availableModes,
|
|
97
|
-
configured: clientId !== null,
|
|
98
|
-
clientId,
|
|
99
|
-
clientSecret,
|
|
100
|
-
redirectUri: `http://127.0.0.1:${port}/api/lifeops/connectors/google/callback`,
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
const clientId = readEnvOverride(env, WEB_CLIENT_ID_KEYS) ?? null;
|
|
104
|
-
const clientSecret = readEnvOverride(env, WEB_CLIENT_SECRET_KEYS) ?? null;
|
|
105
|
-
const publicBaseUrl = readEnvOverride(env, PUBLIC_BASE_URL_KEYS);
|
|
106
|
-
return {
|
|
107
|
-
mode,
|
|
108
|
-
defaultMode,
|
|
109
|
-
availableModes,
|
|
110
|
-
configured: Boolean(clientId && clientSecret && publicBaseUrl),
|
|
111
|
-
clientId,
|
|
112
|
-
clientSecret,
|
|
113
|
-
redirectUri: publicBaseUrl
|
|
114
|
-
? `${normalizeBaseUrl(publicBaseUrl)}/api/lifeops/connectors/google/callback`
|
|
115
|
-
: `${requestUrl.origin}/api/lifeops/connectors/google/callback`,
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
function requireGoogleOAuthConfig(config, requestUrl) {
|
|
119
|
-
if (config.mode === "local" && !isLoopbackHostname(requestUrl.hostname)) {
|
|
120
|
-
throw new GoogleOAuthError(400, "Local Google OAuth requires the API to be addressed over a loopback host.");
|
|
121
|
-
}
|
|
122
|
-
if (!config.configured || !config.clientId) {
|
|
123
|
-
throw new GoogleOAuthError(503, `Google OAuth ${config.mode} mode is not configured.`);
|
|
124
|
-
}
|
|
125
|
-
if (config.mode === "remote" && !config.clientSecret) {
|
|
126
|
-
throw new GoogleOAuthError(503, "Google OAuth remote mode is missing the web client secret.");
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
function createCodeVerifier() {
|
|
130
|
-
return crypto.randomBytes(64).toString("base64url");
|
|
131
|
-
}
|
|
132
|
-
function createCodeChallenge(codeVerifier) {
|
|
133
|
-
return crypto.createHash("sha256").update(codeVerifier).digest("base64url");
|
|
134
|
-
}
|
|
135
|
-
function createState() {
|
|
136
|
-
return crypto.randomBytes(32).toString("hex");
|
|
137
|
-
}
|
|
138
|
-
function cleanupExpiredGoogleOAuthSessions(now = Date.now()) {
|
|
139
|
-
for (const [state, session] of pendingGoogleOAuthSessions.entries()) {
|
|
140
|
-
if (now - session.createdAt > GOOGLE_OAUTH_SESSION_TTL_MS) {
|
|
141
|
-
pendingGoogleOAuthSessions.delete(state);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
function clearPendingSessionsForAgent(agentId, side, mode) {
|
|
146
|
-
for (const [state, session] of pendingGoogleOAuthSessions.entries()) {
|
|
147
|
-
if (session.agentId === agentId &&
|
|
148
|
-
session.side === side &&
|
|
149
|
-
session.mode === mode) {
|
|
150
|
-
pendingGoogleOAuthSessions.delete(state);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
function splitScopes(value) {
|
|
155
|
-
if (typeof value !== "string") {
|
|
156
|
-
return [];
|
|
157
|
-
}
|
|
158
|
-
return value
|
|
159
|
-
.split(/\s+/)
|
|
160
|
-
.map((scope) => scope.trim())
|
|
161
|
-
.filter((scope) => scope.length > 0);
|
|
162
|
-
}
|
|
163
|
-
async function readGoogleErrorMessage(response) {
|
|
164
|
-
const text = await response.text();
|
|
165
|
-
if (!text) {
|
|
166
|
-
return `Google request failed with ${response.status}`;
|
|
167
|
-
}
|
|
168
|
-
try {
|
|
169
|
-
const parsed = JSON.parse(text);
|
|
170
|
-
return (parsed.error_description ||
|
|
171
|
-
parsed.error_description_internal ||
|
|
172
|
-
parsed.error ||
|
|
173
|
-
text);
|
|
174
|
-
}
|
|
175
|
-
catch {
|
|
176
|
-
return text;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
function tokenStorageRoot(env = process.env) {
|
|
180
|
-
return path.join(resolveOAuthDir(env), "lifeops", "google");
|
|
181
|
-
}
|
|
182
|
-
function sanitizePathSegment(value) {
|
|
183
|
-
return value.replace(/[^a-zA-Z0-9._-]/g, "_");
|
|
184
|
-
}
|
|
185
|
-
function ensureTokenStorageDir(dir) {
|
|
186
|
-
fs.mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
187
|
-
}
|
|
188
|
-
function buildGoogleTokenRef(agentId, side, mode) {
|
|
189
|
-
return path.join(sanitizePathSegment(agentId), sanitizePathSegment(side), `${mode}.json`);
|
|
190
|
-
}
|
|
191
|
-
function resolveTokenPath(tokenRef, env = process.env) {
|
|
192
|
-
return path.join(tokenStorageRoot(env), tokenRef);
|
|
193
|
-
}
|
|
194
|
-
function readStoredGoogleTokenFile(tokenRef, env = process.env) {
|
|
195
|
-
const filePath = resolveTokenPath(tokenRef, env);
|
|
196
|
-
try {
|
|
197
|
-
const raw = fs.readFileSync(filePath, "utf-8");
|
|
198
|
-
const parsed = JSON.parse(raw);
|
|
199
|
-
if (!parsed || typeof parsed !== "object") {
|
|
200
|
-
return null;
|
|
201
|
-
}
|
|
202
|
-
return {
|
|
203
|
-
...parsed,
|
|
204
|
-
side: parsed.side === "agent" ? "agent" : "owner",
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
catch (error) {
|
|
208
|
-
if (error.code === "ENOENT") {
|
|
209
|
-
return null;
|
|
210
|
-
}
|
|
211
|
-
throw error;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
function writeStoredGoogleTokenFile(tokenRef, token, env = process.env) {
|
|
215
|
-
const filePath = resolveTokenPath(tokenRef, env);
|
|
216
|
-
ensureTokenStorageDir(path.dirname(filePath));
|
|
217
|
-
fs.writeFileSync(filePath, JSON.stringify(token, null, 2), {
|
|
218
|
-
encoding: "utf-8",
|
|
219
|
-
mode: 0o600,
|
|
220
|
-
});
|
|
221
|
-
try {
|
|
222
|
-
fs.chmodSync(filePath, 0o600);
|
|
223
|
-
}
|
|
224
|
-
catch {
|
|
225
|
-
// Non-fatal on platforms without chmod semantics.
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
export function deleteStoredGoogleToken(tokenRef, env = process.env) {
|
|
229
|
-
const filePath = resolveTokenPath(tokenRef, env);
|
|
230
|
-
try {
|
|
231
|
-
fs.unlinkSync(filePath);
|
|
232
|
-
}
|
|
233
|
-
catch (error) {
|
|
234
|
-
if (error.code !== "ENOENT") {
|
|
235
|
-
throw error;
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
export function readStoredGoogleToken(tokenRef, env = process.env) {
|
|
240
|
-
return readStoredGoogleTokenFile(tokenRef, env);
|
|
241
|
-
}
|
|
242
|
-
function parseIdTokenClaims(idToken) {
|
|
243
|
-
if (!idToken) {
|
|
244
|
-
return {};
|
|
245
|
-
}
|
|
246
|
-
const segments = idToken.split(".");
|
|
247
|
-
if (segments.length < 2) {
|
|
248
|
-
return {};
|
|
249
|
-
}
|
|
250
|
-
try {
|
|
251
|
-
const json = Buffer.from(segments[1] ?? "", "base64url").toString("utf-8");
|
|
252
|
-
const parsed = JSON.parse(json);
|
|
253
|
-
return parsed && typeof parsed === "object" && !Array.isArray(parsed)
|
|
254
|
-
? parsed
|
|
255
|
-
: {};
|
|
256
|
-
}
|
|
257
|
-
catch {
|
|
258
|
-
return {};
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
async function fetchGoogleUserInfo(accessToken) {
|
|
262
|
-
const response = await fetch(GOOGLE_USERINFO_ENDPOINT, {
|
|
263
|
-
headers: {
|
|
264
|
-
Authorization: `Bearer ${accessToken}`,
|
|
265
|
-
},
|
|
266
|
-
});
|
|
267
|
-
if (!response.ok) {
|
|
268
|
-
return {};
|
|
269
|
-
}
|
|
270
|
-
const parsed = (await response.json());
|
|
271
|
-
return parsed && typeof parsed === "object" && !Array.isArray(parsed)
|
|
272
|
-
? parsed
|
|
273
|
-
: {};
|
|
274
|
-
}
|
|
275
|
-
async function exchangeGoogleToken(params) {
|
|
276
|
-
const response = await fetch(GOOGLE_TOKEN_ENDPOINT, {
|
|
277
|
-
method: "POST",
|
|
278
|
-
headers: {
|
|
279
|
-
"Content-Type": "application/x-www-form-urlencoded",
|
|
280
|
-
},
|
|
281
|
-
body: params.toString(),
|
|
282
|
-
});
|
|
283
|
-
if (!response.ok) {
|
|
284
|
-
throw new GoogleOAuthError(502, await readGoogleErrorMessage(response));
|
|
285
|
-
}
|
|
286
|
-
const parsed = (await response.json());
|
|
287
|
-
if (!parsed.access_token || !Number.isFinite(parsed.expires_in)) {
|
|
288
|
-
throw new GoogleOAuthError(502, "Google token exchange returned an invalid payload.");
|
|
289
|
-
}
|
|
290
|
-
return parsed;
|
|
291
|
-
}
|
|
292
|
-
function buildStoredGoogleToken(session, token, grantedScopes, existing) {
|
|
293
|
-
const now = new Date();
|
|
294
|
-
const refreshTokenExpiresAt = typeof token.refresh_token_expires_in === "number" &&
|
|
295
|
-
Number.isFinite(token.refresh_token_expires_in)
|
|
296
|
-
? Date.now() + token.refresh_token_expires_in * 1000
|
|
297
|
-
: (existing?.refreshTokenExpiresAt ?? null);
|
|
298
|
-
return {
|
|
299
|
-
provider: "google",
|
|
300
|
-
agentId: session.agentId,
|
|
301
|
-
side: session.side,
|
|
302
|
-
mode: session.mode,
|
|
303
|
-
clientId: session.clientId,
|
|
304
|
-
redirectUri: session.redirectUri,
|
|
305
|
-
accessToken: token.access_token,
|
|
306
|
-
refreshToken: token.refresh_token ?? existing?.refreshToken ?? null,
|
|
307
|
-
tokenType: token.token_type || existing?.tokenType || "Bearer",
|
|
308
|
-
grantedScopes,
|
|
309
|
-
expiresAt: Date.now() + token.expires_in * 1000,
|
|
310
|
-
refreshTokenExpiresAt,
|
|
311
|
-
createdAt: existing?.createdAt ?? now.toISOString(),
|
|
312
|
-
updatedAt: now.toISOString(),
|
|
313
|
-
};
|
|
314
|
-
}
|
|
315
|
-
export function startGoogleConnectorOAuth(args) {
|
|
316
|
-
cleanupExpiredGoogleOAuthSessions();
|
|
317
|
-
const config = resolveGoogleOAuthConfig(args.requestUrl, args.mode, args.env);
|
|
318
|
-
requireGoogleOAuthConfig(config, args.requestUrl);
|
|
319
|
-
const side = args.side ?? "owner";
|
|
320
|
-
clearPendingSessionsForAgent(args.agentId, side, config.mode);
|
|
321
|
-
const requestedCapabilities = unionGoogleCapabilities(args.existingCapabilities, args.requestedCapabilities
|
|
322
|
-
? normalizeGoogleCapabilities(args.requestedCapabilities)
|
|
323
|
-
: undefined);
|
|
324
|
-
const scopes = googleCapabilitiesToScopes(requestedCapabilities);
|
|
325
|
-
const state = createState();
|
|
326
|
-
const codeVerifier = createCodeVerifier();
|
|
327
|
-
const codeChallenge = createCodeChallenge(codeVerifier);
|
|
328
|
-
pendingGoogleOAuthSessions.set(state, {
|
|
329
|
-
state,
|
|
330
|
-
agentId: args.agentId,
|
|
331
|
-
side,
|
|
332
|
-
mode: config.mode,
|
|
333
|
-
clientId: config.clientId,
|
|
334
|
-
clientSecret: config.clientSecret,
|
|
335
|
-
redirectUri: config.redirectUri,
|
|
336
|
-
requestedCapabilities,
|
|
337
|
-
codeVerifier,
|
|
338
|
-
createdAt: Date.now(),
|
|
339
|
-
});
|
|
340
|
-
const params = new URLSearchParams({
|
|
341
|
-
client_id: config.clientId,
|
|
342
|
-
redirect_uri: config.redirectUri,
|
|
343
|
-
response_type: "code",
|
|
344
|
-
scope: scopes.join(" "),
|
|
345
|
-
state,
|
|
346
|
-
access_type: "offline",
|
|
347
|
-
prompt: "consent",
|
|
348
|
-
code_challenge: codeChallenge,
|
|
349
|
-
code_challenge_method: "S256",
|
|
350
|
-
include_granted_scopes: "true",
|
|
351
|
-
});
|
|
352
|
-
return {
|
|
353
|
-
provider: "google",
|
|
354
|
-
side,
|
|
355
|
-
mode: config.mode,
|
|
356
|
-
requestedCapabilities,
|
|
357
|
-
redirectUri: config.redirectUri,
|
|
358
|
-
authUrl: `${GOOGLE_AUTHORIZATION_ENDPOINT}?${params.toString()}`,
|
|
359
|
-
};
|
|
360
|
-
}
|
|
361
|
-
export async function completeGoogleConnectorOAuth(args) {
|
|
362
|
-
cleanupExpiredGoogleOAuthSessions();
|
|
363
|
-
const state = args.callbackUrl.searchParams.get("state")?.trim();
|
|
364
|
-
if (!state) {
|
|
365
|
-
throw new GoogleOAuthError(400, "Google callback is missing state.");
|
|
366
|
-
}
|
|
367
|
-
const session = pendingGoogleOAuthSessions.get(state);
|
|
368
|
-
if (!session) {
|
|
369
|
-
throw new GoogleOAuthError(400, "Google callback does not match an active login session.");
|
|
370
|
-
}
|
|
371
|
-
pendingGoogleOAuthSessions.delete(state);
|
|
372
|
-
if (Date.now() - session.createdAt > GOOGLE_OAUTH_SESSION_TTL_MS) {
|
|
373
|
-
throw new GoogleOAuthError(410, "Google login session expired. Start the connection flow again.");
|
|
374
|
-
}
|
|
375
|
-
const upstreamError = args.callbackUrl.searchParams.get("error")?.trim();
|
|
376
|
-
if (upstreamError) {
|
|
377
|
-
const description = args.callbackUrl.searchParams.get("error_description")?.trim() ||
|
|
378
|
-
upstreamError;
|
|
379
|
-
throw new GoogleOAuthError(400, description);
|
|
380
|
-
}
|
|
381
|
-
const code = args.callbackUrl.searchParams.get("code")?.trim();
|
|
382
|
-
if (!code) {
|
|
383
|
-
throw new GoogleOAuthError(400, "Google callback is missing an authorization code.");
|
|
384
|
-
}
|
|
385
|
-
const params = new URLSearchParams({
|
|
386
|
-
client_id: session.clientId,
|
|
387
|
-
code,
|
|
388
|
-
code_verifier: session.codeVerifier,
|
|
389
|
-
grant_type: "authorization_code",
|
|
390
|
-
redirect_uri: session.redirectUri,
|
|
391
|
-
});
|
|
392
|
-
if (session.clientSecret) {
|
|
393
|
-
params.set("client_secret", session.clientSecret);
|
|
394
|
-
}
|
|
395
|
-
const token = await exchangeGoogleToken(params);
|
|
396
|
-
const grantedScopes = splitScopes(token.scope);
|
|
397
|
-
const normalizedScopes = grantedScopes.length > 0
|
|
398
|
-
? grantedScopes
|
|
399
|
-
: googleCapabilitiesToScopes(session.requestedCapabilities);
|
|
400
|
-
const grantedCapabilities = googleScopesToCapabilities(normalizedScopes).length > 0
|
|
401
|
-
? googleScopesToCapabilities(normalizedScopes)
|
|
402
|
-
: normalizeGoogleCapabilities(session.requestedCapabilities);
|
|
403
|
-
let identity = parseIdTokenClaims(token.id_token);
|
|
404
|
-
if (Object.keys(identity).length === 0) {
|
|
405
|
-
identity = await fetchGoogleUserInfo(token.access_token);
|
|
406
|
-
}
|
|
407
|
-
const tokenRef = buildGoogleTokenRef(session.agentId, session.side, session.mode);
|
|
408
|
-
const existing = readStoredGoogleTokenFile(tokenRef, args.env);
|
|
409
|
-
const storedToken = buildStoredGoogleToken(session, token, normalizedScopes, existing);
|
|
410
|
-
writeStoredGoogleTokenFile(tokenRef, storedToken, args.env);
|
|
411
|
-
return {
|
|
412
|
-
agentId: session.agentId,
|
|
413
|
-
side: session.side,
|
|
414
|
-
mode: session.mode,
|
|
415
|
-
tokenRef,
|
|
416
|
-
identity,
|
|
417
|
-
grantedCapabilities,
|
|
418
|
-
grantedScopes: normalizedScopes,
|
|
419
|
-
expiresAt: new Date(storedToken.expiresAt).toISOString(),
|
|
420
|
-
hasRefreshToken: Boolean(storedToken.refreshToken),
|
|
421
|
-
};
|
|
422
|
-
}
|
|
423
|
-
/**
|
|
424
|
-
* In-flight refresh promises keyed by tokenRef. Deduplicates concurrent
|
|
425
|
-
* callers so only one token exchange runs per tokenRef at a time — prevents
|
|
426
|
-
* the race where parallel refreshes overwrite each other's tokens on disk.
|
|
427
|
-
*/
|
|
428
|
-
const inflightRefreshes = new Map();
|
|
429
|
-
export async function ensureFreshGoogleAccessToken(tokenRef, env = process.env) {
|
|
430
|
-
const stored = readStoredGoogleTokenFile(tokenRef, env);
|
|
431
|
-
if (!stored) {
|
|
432
|
-
throw new GoogleOAuthError(404, "Google connector token is missing.");
|
|
433
|
-
}
|
|
434
|
-
if (stored.expiresAt > Date.now() + GOOGLE_ACCESS_TOKEN_REFRESH_BUFFER_MS) {
|
|
435
|
-
return stored;
|
|
436
|
-
}
|
|
437
|
-
if (!stored.refreshToken) {
|
|
438
|
-
throw new GoogleOAuthError(401, "Google connector needs re-authentication.");
|
|
439
|
-
}
|
|
440
|
-
// Deduplicate concurrent refreshes for the same tokenRef
|
|
441
|
-
const existing = inflightRefreshes.get(tokenRef);
|
|
442
|
-
if (existing) {
|
|
443
|
-
return existing;
|
|
444
|
-
}
|
|
445
|
-
const refreshPromise = refreshGoogleAccessTokenImpl(tokenRef, stored, env);
|
|
446
|
-
inflightRefreshes.set(tokenRef, refreshPromise);
|
|
447
|
-
try {
|
|
448
|
-
return await refreshPromise;
|
|
449
|
-
}
|
|
450
|
-
finally {
|
|
451
|
-
inflightRefreshes.delete(tokenRef);
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
async function refreshGoogleAccessTokenImpl(tokenRef, stored, env) {
|
|
455
|
-
if (!stored.refreshToken) {
|
|
456
|
-
throw new GoogleOAuthError(400, "Google OAuth token is missing a refresh token.");
|
|
457
|
-
}
|
|
458
|
-
const params = new URLSearchParams({
|
|
459
|
-
client_id: stored.clientId,
|
|
460
|
-
grant_type: "refresh_token",
|
|
461
|
-
refresh_token: stored.refreshToken,
|
|
462
|
-
});
|
|
463
|
-
if (stored.mode === "remote") {
|
|
464
|
-
const clientSecret = readEnvOverride(env, WEB_CLIENT_SECRET_KEYS);
|
|
465
|
-
if (!clientSecret) {
|
|
466
|
-
throw new GoogleOAuthError(503, "Google OAuth remote mode is missing the web client secret.");
|
|
467
|
-
}
|
|
468
|
-
params.set("client_secret", clientSecret);
|
|
469
|
-
}
|
|
470
|
-
else if (stored.mode === "local") {
|
|
471
|
-
const clientSecret = readEnvOverride(env, DESKTOP_CLIENT_SECRET_KEYS);
|
|
472
|
-
if (clientSecret) {
|
|
473
|
-
params.set("client_secret", clientSecret);
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
const token = await exchangeGoogleToken(params);
|
|
477
|
-
const grantedScopes = splitScopes(token.scope);
|
|
478
|
-
const storedToken = buildStoredGoogleToken({
|
|
479
|
-
state: "refresh",
|
|
480
|
-
agentId: stored.agentId,
|
|
481
|
-
side: stored.side,
|
|
482
|
-
mode: stored.mode,
|
|
483
|
-
clientId: stored.clientId,
|
|
484
|
-
clientSecret: stored.mode === "remote"
|
|
485
|
-
? (readEnvOverride(env, WEB_CLIENT_SECRET_KEYS) ?? null)
|
|
486
|
-
: null,
|
|
487
|
-
redirectUri: stored.redirectUri,
|
|
488
|
-
requestedCapabilities: googleScopesToCapabilities(stored.grantedScopes),
|
|
489
|
-
codeVerifier: "",
|
|
490
|
-
createdAt: Date.now(),
|
|
491
|
-
}, token, grantedScopes.length > 0 ? grantedScopes : stored.grantedScopes, stored);
|
|
492
|
-
writeStoredGoogleTokenFile(tokenRef, storedToken, env);
|
|
493
|
-
return storedToken;
|
|
494
|
-
}
|
|
1
|
+
export * from "@elizaos/app-lifeops/lifeops/google-oauth";
|
|
@@ -1,13 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const GOOGLE_OPENID_SCOPES: readonly ["openid", "email", "profile"];
|
|
3
|
-
export declare const GOOGLE_CALENDAR_READ_SCOPE = "https://www.googleapis.com/auth/calendar.readonly";
|
|
4
|
-
export declare const GOOGLE_CALENDAR_WRITE_SCOPE = "https://www.googleapis.com/auth/calendar.events";
|
|
5
|
-
export declare const GOOGLE_GMAIL_METADATA_SCOPE = "https://www.googleapis.com/auth/gmail.metadata";
|
|
6
|
-
export declare const GOOGLE_GMAIL_READ_SCOPE = "https://www.googleapis.com/auth/gmail.readonly";
|
|
7
|
-
export declare const GOOGLE_GMAIL_SEND_SCOPE = "https://www.googleapis.com/auth/gmail.send";
|
|
8
|
-
export declare const DEFAULT_GOOGLE_CONNECTOR_CAPABILITIES: LifeOpsGoogleCapability[];
|
|
9
|
-
export declare function normalizeGoogleCapabilities(value: Iterable<unknown> | undefined, defaultCapabilities?: readonly LifeOpsGoogleCapability[]): LifeOpsGoogleCapability[];
|
|
10
|
-
export declare function unionGoogleCapabilities(...capabilityLists: Array<readonly LifeOpsGoogleCapability[] | undefined>): LifeOpsGoogleCapability[];
|
|
11
|
-
export declare function googleCapabilitiesToScopes(capabilities: readonly LifeOpsGoogleCapability[]): string[];
|
|
12
|
-
export declare function googleScopesToCapabilities(scopes: readonly string[]): LifeOpsGoogleCapability[];
|
|
1
|
+
export * from "@elizaos/app-lifeops/lifeops/google-scopes";
|
|
13
2
|
//# sourceMappingURL=google-scopes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"google-scopes.d.ts","sourceRoot":"","sources":["../../../../../src/lifeops/google-scopes.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"google-scopes.d.ts","sourceRoot":"","sources":["../../../../../src/lifeops/google-scopes.ts"],"names":[],"mappings":"AAAA,cAAc,4CAA4C,CAAC"}
|
|
@@ -1,96 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export const GOOGLE_OPENID_SCOPES = ["openid", "email", "profile"];
|
|
3
|
-
export const GOOGLE_CALENDAR_READ_SCOPE = "https://www.googleapis.com/auth/calendar.readonly";
|
|
4
|
-
export const GOOGLE_CALENDAR_WRITE_SCOPE = "https://www.googleapis.com/auth/calendar.events";
|
|
5
|
-
export const GOOGLE_GMAIL_METADATA_SCOPE = "https://www.googleapis.com/auth/gmail.metadata";
|
|
6
|
-
export const GOOGLE_GMAIL_READ_SCOPE = "https://www.googleapis.com/auth/gmail.readonly";
|
|
7
|
-
export const GOOGLE_GMAIL_SEND_SCOPE = "https://www.googleapis.com/auth/gmail.send";
|
|
8
|
-
const GOOGLE_CAPABILITY_SCOPE_MAP = {
|
|
9
|
-
"google.basic_identity": [...GOOGLE_OPENID_SCOPES],
|
|
10
|
-
"google.calendar.read": [GOOGLE_CALENDAR_READ_SCOPE],
|
|
11
|
-
"google.calendar.write": [GOOGLE_CALENDAR_WRITE_SCOPE],
|
|
12
|
-
// Reading message bodies requires gmail.readonly rather than gmail.metadata.
|
|
13
|
-
"google.gmail.triage": [GOOGLE_GMAIL_READ_SCOPE],
|
|
14
|
-
"google.gmail.send": [GOOGLE_GMAIL_SEND_SCOPE],
|
|
15
|
-
};
|
|
16
|
-
export const DEFAULT_GOOGLE_CONNECTOR_CAPABILITIES = [...LIFEOPS_GOOGLE_CAPABILITIES];
|
|
17
|
-
export function normalizeGoogleCapabilities(value, defaultCapabilities = DEFAULT_GOOGLE_CONNECTOR_CAPABILITIES) {
|
|
18
|
-
const allowed = new Set(LIFEOPS_GOOGLE_CAPABILITIES);
|
|
19
|
-
const normalized = [];
|
|
20
|
-
const seen = new Set();
|
|
21
|
-
const source = value ? Array.from(value) : [...defaultCapabilities];
|
|
22
|
-
for (const candidate of source) {
|
|
23
|
-
if (typeof candidate !== "string") {
|
|
24
|
-
continue;
|
|
25
|
-
}
|
|
26
|
-
if (!allowed.has(candidate)) {
|
|
27
|
-
continue;
|
|
28
|
-
}
|
|
29
|
-
const capability = candidate;
|
|
30
|
-
if (seen.has(capability)) {
|
|
31
|
-
continue;
|
|
32
|
-
}
|
|
33
|
-
seen.add(capability);
|
|
34
|
-
normalized.push(capability);
|
|
35
|
-
}
|
|
36
|
-
if (!seen.has("google.basic_identity")) {
|
|
37
|
-
normalized.unshift("google.basic_identity");
|
|
38
|
-
}
|
|
39
|
-
return normalized;
|
|
40
|
-
}
|
|
41
|
-
export function unionGoogleCapabilities(...capabilityLists) {
|
|
42
|
-
const merged = [];
|
|
43
|
-
const seen = new Set();
|
|
44
|
-
for (const list of capabilityLists) {
|
|
45
|
-
if (!list) {
|
|
46
|
-
continue;
|
|
47
|
-
}
|
|
48
|
-
for (const capability of normalizeGoogleCapabilities(list)) {
|
|
49
|
-
if (seen.has(capability))
|
|
50
|
-
continue;
|
|
51
|
-
seen.add(capability);
|
|
52
|
-
merged.push(capability);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return merged.length > 0
|
|
56
|
-
? merged
|
|
57
|
-
: [...DEFAULT_GOOGLE_CONNECTOR_CAPABILITIES];
|
|
58
|
-
}
|
|
59
|
-
export function googleCapabilitiesToScopes(capabilities) {
|
|
60
|
-
const scopes = [];
|
|
61
|
-
const seen = new Set();
|
|
62
|
-
for (const capability of normalizeGoogleCapabilities(capabilities)) {
|
|
63
|
-
for (const scope of GOOGLE_CAPABILITY_SCOPE_MAP[capability]) {
|
|
64
|
-
if (seen.has(scope))
|
|
65
|
-
continue;
|
|
66
|
-
seen.add(scope);
|
|
67
|
-
scopes.push(scope);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return scopes;
|
|
71
|
-
}
|
|
72
|
-
export function googleScopesToCapabilities(scopes) {
|
|
73
|
-
const granted = new Set(scopes.map((scope) => scope.trim()).filter(Boolean));
|
|
74
|
-
const capabilities = [];
|
|
75
|
-
const hasIdentity = GOOGLE_OPENID_SCOPES.some((scope) => granted.has(scope));
|
|
76
|
-
if (hasIdentity) {
|
|
77
|
-
capabilities.push("google.basic_identity");
|
|
78
|
-
}
|
|
79
|
-
const hasCalendarRead = granted.has(GOOGLE_CALENDAR_READ_SCOPE) ||
|
|
80
|
-
granted.has(GOOGLE_CALENDAR_WRITE_SCOPE);
|
|
81
|
-
if (hasCalendarRead) {
|
|
82
|
-
capabilities.push("google.calendar.read");
|
|
83
|
-
}
|
|
84
|
-
if (granted.has(GOOGLE_CALENDAR_WRITE_SCOPE)) {
|
|
85
|
-
capabilities.push("google.calendar.write");
|
|
86
|
-
}
|
|
87
|
-
const hasGmailTriage = granted.has(GOOGLE_GMAIL_METADATA_SCOPE) ||
|
|
88
|
-
granted.has(GOOGLE_GMAIL_READ_SCOPE);
|
|
89
|
-
if (hasGmailTriage) {
|
|
90
|
-
capabilities.push("google.gmail.triage");
|
|
91
|
-
}
|
|
92
|
-
if (granted.has(GOOGLE_GMAIL_SEND_SCOPE)) {
|
|
93
|
-
capabilities.push("google.gmail.send");
|
|
94
|
-
}
|
|
95
|
-
return capabilities;
|
|
96
|
-
}
|
|
1
|
+
export * from "@elizaos/app-lifeops/lifeops/google-scopes";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lifeops/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/lifeops/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC"}
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export * from "
|
|
2
|
-
export * from "./service.js";
|
|
1
|
+
export * from "@elizaos/app-lifeops/lifeops";
|
|
@@ -1,15 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const OWNER_NAME_MAX_LENGTH = 60;
|
|
3
|
-
export declare const LIFEOPS_OWNER_PROFILE_FIELDS: readonly ["name", "relationshipStatus", "partnerName", "orientation", "gender", "age", "location"];
|
|
4
|
-
export type LifeOpsOwnerProfileField = (typeof LIFEOPS_OWNER_PROFILE_FIELDS)[number];
|
|
5
|
-
export type LifeOpsOwnerProfilePatch = Partial<Record<LifeOpsOwnerProfileField, string>>;
|
|
6
|
-
export type LifeOpsOwnerProfile = Record<LifeOpsOwnerProfileField, string> & {
|
|
7
|
-
updatedAt: string | null;
|
|
8
|
-
};
|
|
9
|
-
export declare function normalizeLifeOpsOwnerProfilePatch(patch: Record<string, unknown> | LifeOpsOwnerProfilePatch | null | undefined): LifeOpsOwnerProfilePatch;
|
|
10
|
-
export declare function fetchConfiguredOwnerName(): Promise<string | null>;
|
|
11
|
-
export declare function persistConfiguredOwnerName(name: string): Promise<boolean>;
|
|
12
|
-
export declare function resolveLifeOpsOwnerProfile(metadata: Record<string, unknown> | null | undefined, configuredName?: string | null): LifeOpsOwnerProfile;
|
|
13
|
-
export declare function readLifeOpsOwnerProfile(runtime: IAgentRuntime): Promise<LifeOpsOwnerProfile>;
|
|
14
|
-
export declare function updateLifeOpsOwnerProfile(runtime: IAgentRuntime, patch: LifeOpsOwnerProfilePatch | Record<string, unknown>): Promise<LifeOpsOwnerProfile | null>;
|
|
1
|
+
export * from "@elizaos/app-lifeops/lifeops/owner-profile";
|
|
15
2
|
//# sourceMappingURL=owner-profile.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"owner-profile.d.ts","sourceRoot":"","sources":["../../../../../src/lifeops/owner-profile.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"owner-profile.d.ts","sourceRoot":"","sources":["../../../../../src/lifeops/owner-profile.ts"],"names":[],"mappings":"AAAA,cAAc,4CAA4C,CAAC"}
|