@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,85 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { GoogleApiError } from "./google-api-error.js";
|
|
3
|
-
const MAX_RETRIES = 2;
|
|
4
|
-
const BASE_DELAY_MS = 1_000;
|
|
5
|
-
const TIMEOUT_MS = 10_000;
|
|
6
|
-
/**
|
|
7
|
-
* Returns `true` for HTTP statuses that are worth retrying (5xx, 429).
|
|
8
|
-
* 4xx errors (other than 429) are permanent — auth failures, bad requests, etc.
|
|
9
|
-
*/
|
|
10
|
-
function isTransientStatus(status) {
|
|
11
|
-
if (status === 429)
|
|
12
|
-
return true;
|
|
13
|
-
return status >= 500;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Fetch wrapper for Google APIs with retry, timeout, and structured logging.
|
|
17
|
-
*
|
|
18
|
-
* - 10-second `AbortSignal.timeout` per attempt
|
|
19
|
-
* - Up to 2 retries with exponential backoff (1s, 2s) on transient failures
|
|
20
|
-
* - Fails fast on 4xx (except 429)
|
|
21
|
-
* - Returns the successful `Response` for caller to parse
|
|
22
|
-
* - Throws `GoogleApiError` on permanent failure or exhausted retries
|
|
23
|
-
*/
|
|
24
|
-
export async function googleApiFetch(url, init) {
|
|
25
|
-
const method = init?.method ?? "GET";
|
|
26
|
-
let lastError = null;
|
|
27
|
-
for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {
|
|
28
|
-
if (attempt > 0) {
|
|
29
|
-
const delayMs = BASE_DELAY_MS * 2 ** (attempt - 1);
|
|
30
|
-
logger.warn({
|
|
31
|
-
boundary: "lifeops",
|
|
32
|
-
integration: "google",
|
|
33
|
-
method,
|
|
34
|
-
attempt,
|
|
35
|
-
delayMs,
|
|
36
|
-
}, `[lifeops] Google API retry ${attempt}/${MAX_RETRIES} after ${delayMs}ms`);
|
|
37
|
-
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
38
|
-
}
|
|
39
|
-
try {
|
|
40
|
-
const response = await fetch(url, {
|
|
41
|
-
...init,
|
|
42
|
-
signal: AbortSignal.timeout(TIMEOUT_MS),
|
|
43
|
-
});
|
|
44
|
-
if (response.ok) {
|
|
45
|
-
return response;
|
|
46
|
-
}
|
|
47
|
-
// Read the error body for context
|
|
48
|
-
const errorText = await response.text().catch(() => "");
|
|
49
|
-
let errorMessage;
|
|
50
|
-
try {
|
|
51
|
-
const parsed = JSON.parse(errorText);
|
|
52
|
-
errorMessage =
|
|
53
|
-
parsed.error?.message || errorText || `HTTP ${response.status}`;
|
|
54
|
-
}
|
|
55
|
-
catch {
|
|
56
|
-
errorMessage = errorText || `HTTP ${response.status}`;
|
|
57
|
-
}
|
|
58
|
-
lastError = new GoogleApiError(response.status, errorMessage);
|
|
59
|
-
if (!isTransientStatus(response.status)) {
|
|
60
|
-
throw lastError;
|
|
61
|
-
}
|
|
62
|
-
logger.warn({
|
|
63
|
-
boundary: "lifeops",
|
|
64
|
-
integration: "google",
|
|
65
|
-
method,
|
|
66
|
-
statusCode: response.status,
|
|
67
|
-
attempt,
|
|
68
|
-
}, `[lifeops] Google API transient error: ${errorMessage}`);
|
|
69
|
-
}
|
|
70
|
-
catch (error) {
|
|
71
|
-
if (error instanceof GoogleApiError) {
|
|
72
|
-
throw error;
|
|
73
|
-
}
|
|
74
|
-
const errorMsg = error instanceof Error ? error.message : String(error);
|
|
75
|
-
logger.warn({
|
|
76
|
-
boundary: "lifeops",
|
|
77
|
-
integration: "google",
|
|
78
|
-
method,
|
|
79
|
-
attempt,
|
|
80
|
-
}, `[lifeops] Google API network error: ${errorMsg}`);
|
|
81
|
-
lastError = new GoogleApiError(0, errorMsg);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
throw lastError ?? new GoogleApiError(0, "Google API request failed");
|
|
85
|
-
}
|
|
1
|
+
export * from "@elizaos/app-lifeops/lifeops/google-fetch";
|
|
@@ -1,54 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export interface SyncedGoogleGmailMessageSummary extends Omit<LifeOpsGmailMessageSummary, "id" | "agentId" | "provider" | "side" | "syncedAt" | "updatedAt"> {
|
|
3
|
-
}
|
|
4
|
-
export interface SyncedGoogleGmailMessageDetail {
|
|
5
|
-
message: SyncedGoogleGmailMessageSummary;
|
|
6
|
-
bodyText: string;
|
|
7
|
-
}
|
|
8
|
-
export declare function fetchGoogleGmailTriageMessages(args: {
|
|
9
|
-
accessToken: string;
|
|
10
|
-
selfEmail?: string | null;
|
|
11
|
-
maxResults?: number;
|
|
12
|
-
}): Promise<SyncedGoogleGmailMessageSummary[]>;
|
|
13
|
-
export declare function fetchGoogleGmailSearchMessages(args: {
|
|
14
|
-
accessToken: string;
|
|
15
|
-
selfEmail?: string | null;
|
|
16
|
-
maxResults?: number;
|
|
17
|
-
query: string;
|
|
18
|
-
}): Promise<SyncedGoogleGmailMessageSummary[]>;
|
|
19
|
-
export declare function fetchGoogleGmailMessage(args: {
|
|
20
|
-
accessToken: string;
|
|
21
|
-
selfEmail?: string | null;
|
|
22
|
-
messageId: string;
|
|
23
|
-
}): Promise<SyncedGoogleGmailMessageSummary | null>;
|
|
24
|
-
export declare function fetchGoogleGmailMessageDetail(args: {
|
|
25
|
-
accessToken: string;
|
|
26
|
-
selfEmail?: string | null;
|
|
27
|
-
messageId: string;
|
|
28
|
-
}): Promise<SyncedGoogleGmailMessageDetail | null>;
|
|
29
|
-
export interface GmailSendResult {
|
|
30
|
-
/** Gmail message ID returned by the API (e.g. "18f3a..."). */
|
|
31
|
-
messageId: string | null;
|
|
32
|
-
/** Gmail thread ID. */
|
|
33
|
-
threadId: string | null;
|
|
34
|
-
/** Label IDs assigned by Gmail. */
|
|
35
|
-
labelIds: string[];
|
|
36
|
-
}
|
|
37
|
-
export declare function sendGoogleGmailReply(args: {
|
|
38
|
-
accessToken: string;
|
|
39
|
-
to: string[];
|
|
40
|
-
cc?: string[];
|
|
41
|
-
subject: string;
|
|
42
|
-
bodyText: string;
|
|
43
|
-
inReplyTo?: string | null;
|
|
44
|
-
references?: string | null;
|
|
45
|
-
}): Promise<GmailSendResult>;
|
|
46
|
-
export declare function sendGoogleGmailMessage(args: {
|
|
47
|
-
accessToken: string;
|
|
48
|
-
to: string[];
|
|
49
|
-
cc?: string[];
|
|
50
|
-
bcc?: string[];
|
|
51
|
-
subject: string;
|
|
52
|
-
bodyText: string;
|
|
53
|
-
}): Promise<GmailSendResult>;
|
|
1
|
+
export * from "@elizaos/app-lifeops/lifeops/google-gmail";
|
|
54
2
|
//# sourceMappingURL=google-gmail.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"google-gmail.d.ts","sourceRoot":"","sources":["../../../../../src/lifeops/google-gmail.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"google-gmail.d.ts","sourceRoot":"","sources":["../../../../../src/lifeops/google-gmail.ts"],"names":[],"mappings":"AAAA,cAAc,2CAA2C,CAAC"}
|
|
@@ -1,471 +1 @@
|
|
|
1
|
-
|
|
2
|
-
const GOOGLE_GMAIL_MESSAGES_ENDPOINT = "https://gmail.googleapis.com/gmail/v1/users/me/messages";
|
|
3
|
-
const GMAIL_METADATA_HEADERS = [
|
|
4
|
-
"Subject",
|
|
5
|
-
"From",
|
|
6
|
-
"To",
|
|
7
|
-
"Cc",
|
|
8
|
-
"Date",
|
|
9
|
-
"Reply-To",
|
|
10
|
-
"Message-Id",
|
|
11
|
-
"References",
|
|
12
|
-
"List-Id",
|
|
13
|
-
"Precedence",
|
|
14
|
-
"Auto-Submitted",
|
|
15
|
-
];
|
|
16
|
-
function readGoogleGmailErrorPrefix(status) {
|
|
17
|
-
return `Google Gmail request failed with ${status}`;
|
|
18
|
-
}
|
|
19
|
-
async function _readGoogleGmailError(response) {
|
|
20
|
-
const text = await response.text();
|
|
21
|
-
if (!text) {
|
|
22
|
-
return readGoogleGmailErrorPrefix(response.status);
|
|
23
|
-
}
|
|
24
|
-
try {
|
|
25
|
-
const parsed = JSON.parse(text);
|
|
26
|
-
return parsed.error?.message || text;
|
|
27
|
-
}
|
|
28
|
-
catch {
|
|
29
|
-
return text;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
function splitMailboxHeader(value) {
|
|
33
|
-
const parts = [];
|
|
34
|
-
let current = "";
|
|
35
|
-
let inQuotes = false;
|
|
36
|
-
let angleDepth = 0;
|
|
37
|
-
for (const char of value) {
|
|
38
|
-
if (char === '"') {
|
|
39
|
-
inQuotes = !inQuotes;
|
|
40
|
-
current += char;
|
|
41
|
-
continue;
|
|
42
|
-
}
|
|
43
|
-
if (!inQuotes && char === "<") {
|
|
44
|
-
angleDepth += 1;
|
|
45
|
-
current += char;
|
|
46
|
-
continue;
|
|
47
|
-
}
|
|
48
|
-
if (!inQuotes && char === ">") {
|
|
49
|
-
angleDepth = Math.max(0, angleDepth - 1);
|
|
50
|
-
current += char;
|
|
51
|
-
continue;
|
|
52
|
-
}
|
|
53
|
-
if (!inQuotes && angleDepth === 0 && char === ",") {
|
|
54
|
-
const trimmed = current.trim();
|
|
55
|
-
if (trimmed.length > 0) {
|
|
56
|
-
parts.push(trimmed);
|
|
57
|
-
}
|
|
58
|
-
current = "";
|
|
59
|
-
continue;
|
|
60
|
-
}
|
|
61
|
-
current += char;
|
|
62
|
-
}
|
|
63
|
-
const trimmed = current.trim();
|
|
64
|
-
if (trimmed.length > 0) {
|
|
65
|
-
parts.push(trimmed);
|
|
66
|
-
}
|
|
67
|
-
return parts;
|
|
68
|
-
}
|
|
69
|
-
function stripQuotedDisplayName(value) {
|
|
70
|
-
const trimmed = value.trim();
|
|
71
|
-
if (trimmed.startsWith('"') && trimmed.endsWith('"') && trimmed.length >= 2) {
|
|
72
|
-
return trimmed.slice(1, -1).trim();
|
|
73
|
-
}
|
|
74
|
-
return trimmed;
|
|
75
|
-
}
|
|
76
|
-
function parseMailbox(value) {
|
|
77
|
-
const trimmed = value.trim();
|
|
78
|
-
const match = trimmed.match(/^(.*?)(?:<([^>]+)>)$/);
|
|
79
|
-
if (match) {
|
|
80
|
-
const display = stripQuotedDisplayName(match[1] ?? "").trim();
|
|
81
|
-
const email = (match[2] ?? "").trim().toLowerCase();
|
|
82
|
-
return {
|
|
83
|
-
display: display || email,
|
|
84
|
-
email: email.length > 0 ? email : null,
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
const normalized = stripQuotedDisplayName(trimmed);
|
|
88
|
-
if (/^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(normalized)) {
|
|
89
|
-
return {
|
|
90
|
-
display: normalized,
|
|
91
|
-
email: normalized.toLowerCase(),
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
return {
|
|
95
|
-
display: normalized,
|
|
96
|
-
email: null,
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
function parseMailboxList(value) {
|
|
100
|
-
if (!value) {
|
|
101
|
-
return [];
|
|
102
|
-
}
|
|
103
|
-
return splitMailboxHeader(value)
|
|
104
|
-
.map((entry) => parseMailbox(entry))
|
|
105
|
-
.filter((entry) => entry.display.length > 0 || entry.email !== null);
|
|
106
|
-
}
|
|
107
|
-
function readHeaderValue(headers, name) {
|
|
108
|
-
const lowerName = name.toLowerCase();
|
|
109
|
-
const header = headers?.find((candidate) => candidate.name?.trim().toLowerCase() === lowerName);
|
|
110
|
-
const value = header?.value?.trim();
|
|
111
|
-
return value && value.length > 0 ? value : undefined;
|
|
112
|
-
}
|
|
113
|
-
function normalizeReplySubject(subject) {
|
|
114
|
-
const trimmed = subject.trim();
|
|
115
|
-
if (trimmed.length === 0) {
|
|
116
|
-
return "Re: your message";
|
|
117
|
-
}
|
|
118
|
-
return /^re:/i.test(trimmed) ? trimmed : `Re: ${trimmed}`;
|
|
119
|
-
}
|
|
120
|
-
function normalizeSnippet(value) {
|
|
121
|
-
if (!value) {
|
|
122
|
-
return "";
|
|
123
|
-
}
|
|
124
|
-
// Gmail's snippet field arrives with raw HTML entities ("It's", "Tom
|
|
125
|
-
// & Jerry", " "). Decode them so the discord/UI render is plain
|
|
126
|
-
// text instead of leaking entity codes to the user.
|
|
127
|
-
return decodeHtmlEntities(value).replace(/\s+/g, " ").trim();
|
|
128
|
-
}
|
|
129
|
-
function decodeGmailBodyData(value) {
|
|
130
|
-
const normalized = value.replace(/-/g, "+").replace(/_/g, "/");
|
|
131
|
-
const paddingLength = (4 - (normalized.length % 4)) % 4;
|
|
132
|
-
const padded = normalized + "=".repeat(paddingLength);
|
|
133
|
-
return Buffer.from(padded, "base64").toString("utf-8");
|
|
134
|
-
}
|
|
135
|
-
function decodeHtmlEntities(value) {
|
|
136
|
-
return value
|
|
137
|
-
.replace(/ /gi, " ")
|
|
138
|
-
.replace(/&/gi, "&")
|
|
139
|
-
.replace(/</gi, "<")
|
|
140
|
-
.replace(/>/gi, ">")
|
|
141
|
-
.replace(/"/gi, '"')
|
|
142
|
-
.replace(/'/gi, "'");
|
|
143
|
-
}
|
|
144
|
-
function htmlToPlainText(value) {
|
|
145
|
-
return decodeHtmlEntities(value
|
|
146
|
-
.replace(/<style[\s\S]*?<\/style>/gi, " ")
|
|
147
|
-
.replace(/<script[\s\S]*?<\/script>/gi, " ")
|
|
148
|
-
.replace(/<br\s*\/?>/gi, "\n")
|
|
149
|
-
.replace(/<\/(?:p|div|section|article|li|tr|table|h[1-6])>/gi, "\n")
|
|
150
|
-
.replace(/<(?:li)[^>]*>/gi, "- ")
|
|
151
|
-
.replace(/<[^>]+>/g, " "))
|
|
152
|
-
.replace(/\r/g, "")
|
|
153
|
-
.replace(/[ \t]+\n/g, "\n")
|
|
154
|
-
.replace(/\n{3,}/g, "\n\n")
|
|
155
|
-
.replace(/[ \t]{2,}/g, " ")
|
|
156
|
-
.trim();
|
|
157
|
-
}
|
|
158
|
-
function extractGoogleGmailBodyByMime(payload, mimeType) {
|
|
159
|
-
if (!payload) {
|
|
160
|
-
return "";
|
|
161
|
-
}
|
|
162
|
-
const directBody = payload.body?.data;
|
|
163
|
-
if (payload.mimeType === mimeType && typeof directBody === "string") {
|
|
164
|
-
const decoded = decodeGmailBodyData(directBody);
|
|
165
|
-
return mimeType === "text/html" ? htmlToPlainText(decoded) : decoded.trim();
|
|
166
|
-
}
|
|
167
|
-
for (const part of payload.parts ?? []) {
|
|
168
|
-
const nested = extractGoogleGmailBodyByMime(part, mimeType);
|
|
169
|
-
if (nested) {
|
|
170
|
-
return nested;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
return "";
|
|
174
|
-
}
|
|
175
|
-
function extractGoogleGmailBody(payload) {
|
|
176
|
-
const plainText = extractGoogleGmailBodyByMime(payload, "text/plain");
|
|
177
|
-
if (plainText) {
|
|
178
|
-
return plainText;
|
|
179
|
-
}
|
|
180
|
-
const htmlText = extractGoogleGmailBodyByMime(payload, "text/html");
|
|
181
|
-
if (htmlText) {
|
|
182
|
-
return htmlText;
|
|
183
|
-
}
|
|
184
|
-
const directBody = payload?.body?.data;
|
|
185
|
-
if (typeof directBody === "string") {
|
|
186
|
-
const decoded = decodeGmailBodyData(directBody);
|
|
187
|
-
return payload?.mimeType === "text/html"
|
|
188
|
-
? htmlToPlainText(decoded)
|
|
189
|
-
: decoded.trim();
|
|
190
|
-
}
|
|
191
|
-
return "";
|
|
192
|
-
}
|
|
193
|
-
function deriveHtmlLink(threadId) {
|
|
194
|
-
return `https://mail.google.com/mail/u/0/#all/${encodeURIComponent(threadId)}`;
|
|
195
|
-
}
|
|
196
|
-
function classifyReplyNeed(args) {
|
|
197
|
-
const labels = new Set(args.labels.map((label) => label.trim().toUpperCase()));
|
|
198
|
-
const isUnread = labels.has("UNREAD");
|
|
199
|
-
const explicitlyImportant = labels.has("IMPORTANT");
|
|
200
|
-
const selfEmail = args.selfEmail?.trim().toLowerCase() || null;
|
|
201
|
-
const fromEmail = args.fromEmail?.trim().toLowerCase() || null;
|
|
202
|
-
const directRecipients = [...args.to, ...args.cc].map((entry) => entry.trim().toLowerCase());
|
|
203
|
-
const directlyAddressed = selfEmail
|
|
204
|
-
? directRecipients.includes(selfEmail)
|
|
205
|
-
: false;
|
|
206
|
-
const fromSelf = Boolean(selfEmail && fromEmail && selfEmail === fromEmail);
|
|
207
|
-
const precedence = args.precedence?.trim().toLowerCase();
|
|
208
|
-
const autoSubmitted = args.autoSubmitted?.trim().toLowerCase();
|
|
209
|
-
const automated = Boolean(fromEmail &&
|
|
210
|
-
/(?:^|\b)(?:no-?reply|noreply-|donotreply|do-not-reply|notifications?|alerts?|mailer-daemon|postmaster|bounce|system|auto|daemon|news|updates?)(?:\b|[.@-])/i.test(fromEmail)) ||
|
|
211
|
-
Boolean(args.listId) ||
|
|
212
|
-
precedence === "bulk" ||
|
|
213
|
-
precedence === "list" ||
|
|
214
|
-
precedence === "junk" ||
|
|
215
|
-
precedence === "auto-reply" ||
|
|
216
|
-
(autoSubmitted !== undefined && autoSubmitted !== "no");
|
|
217
|
-
let triageScore = 0;
|
|
218
|
-
const reasons = [];
|
|
219
|
-
if (isUnread) {
|
|
220
|
-
triageScore += 30;
|
|
221
|
-
reasons.push("unread");
|
|
222
|
-
}
|
|
223
|
-
if (explicitlyImportant) {
|
|
224
|
-
triageScore += 35;
|
|
225
|
-
reasons.push("important label");
|
|
226
|
-
}
|
|
227
|
-
if (directlyAddressed) {
|
|
228
|
-
triageScore += 25;
|
|
229
|
-
reasons.push("directly addressed");
|
|
230
|
-
}
|
|
231
|
-
if (!automated && !fromSelf && isUnread && directlyAddressed) {
|
|
232
|
-
triageScore += 30;
|
|
233
|
-
reasons.push("likely needs reply");
|
|
234
|
-
}
|
|
235
|
-
if (automated) {
|
|
236
|
-
triageScore -= 25;
|
|
237
|
-
reasons.push("automated sender");
|
|
238
|
-
}
|
|
239
|
-
if (fromSelf) {
|
|
240
|
-
triageScore -= 60;
|
|
241
|
-
reasons.push("sent by self");
|
|
242
|
-
}
|
|
243
|
-
const likelyReplyNeeded = !automated && !fromSelf && isUnread && directlyAddressed;
|
|
244
|
-
const isImportant = explicitlyImportant || likelyReplyNeeded;
|
|
245
|
-
const triageReason = reasons.join(", ") || "recent inbox message";
|
|
246
|
-
return {
|
|
247
|
-
likelyReplyNeeded,
|
|
248
|
-
isImportant,
|
|
249
|
-
triageScore: Math.max(0, triageScore),
|
|
250
|
-
triageReason,
|
|
251
|
-
};
|
|
252
|
-
}
|
|
253
|
-
function normalizeGoogleGmailMessage(message, selfEmail) {
|
|
254
|
-
const externalId = message.id?.trim();
|
|
255
|
-
const threadId = message.threadId?.trim();
|
|
256
|
-
if (!externalId || !threadId) {
|
|
257
|
-
return null;
|
|
258
|
-
}
|
|
259
|
-
const headers = message.payload?.headers ?? [];
|
|
260
|
-
// Gmail subject headers can carry html entities (e.g. "Tom & Jerry").
|
|
261
|
-
// Decode them so the rendered subject reads naturally in discord/UI.
|
|
262
|
-
const subject = decodeHtmlEntities(readHeaderValue(headers, "Subject") || "") ||
|
|
263
|
-
"(no subject)";
|
|
264
|
-
const fromHeader = readHeaderValue(headers, "From") || "Unknown sender";
|
|
265
|
-
const fromMailbox = parseMailbox(fromHeader);
|
|
266
|
-
const replyToHeader = readHeaderValue(headers, "Reply-To");
|
|
267
|
-
const replyToMailbox = replyToHeader ? parseMailbox(replyToHeader) : null;
|
|
268
|
-
const to = parseMailboxList(readHeaderValue(headers, "To")).map((entry) => entry.email || entry.display);
|
|
269
|
-
const cc = parseMailboxList(readHeaderValue(headers, "Cc")).map((entry) => entry.email || entry.display);
|
|
270
|
-
const labels = (message.labelIds ?? [])
|
|
271
|
-
.map((label) => label.trim())
|
|
272
|
-
.filter(Boolean);
|
|
273
|
-
const receivedAtMs = Number(message.internalDate);
|
|
274
|
-
const receivedAt = Number.isFinite(receivedAtMs)
|
|
275
|
-
? new Date(receivedAtMs).toISOString()
|
|
276
|
-
: new Date().toISOString();
|
|
277
|
-
const precedence = readHeaderValue(headers, "Precedence");
|
|
278
|
-
const listId = readHeaderValue(headers, "List-Id");
|
|
279
|
-
const autoSubmitted = readHeaderValue(headers, "Auto-Submitted");
|
|
280
|
-
const triage = classifyReplyNeed({
|
|
281
|
-
labels,
|
|
282
|
-
fromEmail: fromMailbox.email,
|
|
283
|
-
to,
|
|
284
|
-
cc,
|
|
285
|
-
selfEmail,
|
|
286
|
-
precedence,
|
|
287
|
-
listId,
|
|
288
|
-
autoSubmitted,
|
|
289
|
-
});
|
|
290
|
-
return {
|
|
291
|
-
externalId,
|
|
292
|
-
threadId,
|
|
293
|
-
subject,
|
|
294
|
-
from: fromMailbox.display,
|
|
295
|
-
fromEmail: fromMailbox.email,
|
|
296
|
-
replyTo: replyToMailbox?.email || replyToMailbox?.display || null,
|
|
297
|
-
to,
|
|
298
|
-
cc,
|
|
299
|
-
snippet: normalizeSnippet(message.snippet),
|
|
300
|
-
receivedAt,
|
|
301
|
-
isUnread: labels.includes("UNREAD"),
|
|
302
|
-
isImportant: triage.isImportant,
|
|
303
|
-
likelyReplyNeeded: triage.likelyReplyNeeded,
|
|
304
|
-
triageScore: triage.triageScore,
|
|
305
|
-
triageReason: triage.triageReason,
|
|
306
|
-
labels,
|
|
307
|
-
htmlLink: deriveHtmlLink(threadId),
|
|
308
|
-
metadata: {
|
|
309
|
-
historyId: message.historyId?.trim() || null,
|
|
310
|
-
sizeEstimate: typeof message.sizeEstimate === "number" ? message.sizeEstimate : null,
|
|
311
|
-
dateHeader: readHeaderValue(headers, "Date") || null,
|
|
312
|
-
messageIdHeader: readHeaderValue(headers, "Message-Id") || null,
|
|
313
|
-
referencesHeader: readHeaderValue(headers, "References") || null,
|
|
314
|
-
listId: listId || null,
|
|
315
|
-
precedence: precedence || null,
|
|
316
|
-
autoSubmitted: autoSubmitted || null,
|
|
317
|
-
},
|
|
318
|
-
};
|
|
319
|
-
}
|
|
320
|
-
export async function fetchGoogleGmailTriageMessages(args) {
|
|
321
|
-
return fetchGoogleGmailMessages({
|
|
322
|
-
accessToken: args.accessToken,
|
|
323
|
-
selfEmail: args.selfEmail ?? null,
|
|
324
|
-
maxResults: args.maxResults,
|
|
325
|
-
labelIds: ["INBOX"],
|
|
326
|
-
});
|
|
327
|
-
}
|
|
328
|
-
export async function fetchGoogleGmailSearchMessages(args) {
|
|
329
|
-
return fetchGoogleGmailMessages({
|
|
330
|
-
accessToken: args.accessToken,
|
|
331
|
-
selfEmail: args.selfEmail ?? null,
|
|
332
|
-
maxResults: args.maxResults,
|
|
333
|
-
query: args.query,
|
|
334
|
-
});
|
|
335
|
-
}
|
|
336
|
-
export async function fetchGoogleGmailMessage(args) {
|
|
337
|
-
const params = new URLSearchParams({
|
|
338
|
-
format: "metadata",
|
|
339
|
-
});
|
|
340
|
-
for (const header of GMAIL_METADATA_HEADERS) {
|
|
341
|
-
params.append("metadataHeaders", header);
|
|
342
|
-
}
|
|
343
|
-
const response = await googleApiFetch(`${GOOGLE_GMAIL_MESSAGES_ENDPOINT}/${encodeURIComponent(args.messageId)}?${params.toString()}`, {
|
|
344
|
-
headers: {
|
|
345
|
-
Authorization: `Bearer ${args.accessToken}`,
|
|
346
|
-
},
|
|
347
|
-
});
|
|
348
|
-
const parsed = (await response.json());
|
|
349
|
-
return normalizeGoogleGmailMessage(parsed, args.selfEmail ?? null);
|
|
350
|
-
}
|
|
351
|
-
export async function fetchGoogleGmailMessageDetail(args) {
|
|
352
|
-
const params = new URLSearchParams({
|
|
353
|
-
format: "full",
|
|
354
|
-
});
|
|
355
|
-
const response = await googleApiFetch(`${GOOGLE_GMAIL_MESSAGES_ENDPOINT}/${encodeURIComponent(args.messageId)}?${params.toString()}`, {
|
|
356
|
-
headers: {
|
|
357
|
-
Authorization: `Bearer ${args.accessToken}`,
|
|
358
|
-
},
|
|
359
|
-
});
|
|
360
|
-
const parsed = (await response.json());
|
|
361
|
-
const message = normalizeGoogleGmailMessage(parsed, args.selfEmail ?? null);
|
|
362
|
-
if (!message) {
|
|
363
|
-
return null;
|
|
364
|
-
}
|
|
365
|
-
return {
|
|
366
|
-
message,
|
|
367
|
-
bodyText: extractGoogleGmailBody(parsed.payload).trim() || message.snippet,
|
|
368
|
-
};
|
|
369
|
-
}
|
|
370
|
-
async function fetchGoogleGmailMessages(args) {
|
|
371
|
-
const maxResults = args.maxResults && args.maxResults > 0 ? Math.min(args.maxResults, 50) : 20;
|
|
372
|
-
const listParams = new URLSearchParams({
|
|
373
|
-
maxResults: String(maxResults),
|
|
374
|
-
includeSpamTrash: "false",
|
|
375
|
-
});
|
|
376
|
-
for (const labelId of args.labelIds ?? []) {
|
|
377
|
-
listParams.append("labelIds", labelId);
|
|
378
|
-
}
|
|
379
|
-
if (args.query?.trim()) {
|
|
380
|
-
listParams.set("q", args.query.trim());
|
|
381
|
-
}
|
|
382
|
-
const listResponse = await googleApiFetch(`${GOOGLE_GMAIL_MESSAGES_ENDPOINT}?${listParams.toString()}`, {
|
|
383
|
-
headers: {
|
|
384
|
-
Authorization: `Bearer ${args.accessToken}`,
|
|
385
|
-
},
|
|
386
|
-
});
|
|
387
|
-
const listed = (await listResponse.json());
|
|
388
|
-
const messages = await Promise.all((listed.messages ?? []).map(async (messageRef) => {
|
|
389
|
-
const messageId = messageRef.id?.trim();
|
|
390
|
-
if (!messageId) {
|
|
391
|
-
return null;
|
|
392
|
-
}
|
|
393
|
-
const params = new URLSearchParams({
|
|
394
|
-
format: "metadata",
|
|
395
|
-
});
|
|
396
|
-
for (const header of GMAIL_METADATA_HEADERS) {
|
|
397
|
-
params.append("metadataHeaders", header);
|
|
398
|
-
}
|
|
399
|
-
const response = await googleApiFetch(`${GOOGLE_GMAIL_MESSAGES_ENDPOINT}/${encodeURIComponent(messageId)}?${params.toString()}`, {
|
|
400
|
-
headers: {
|
|
401
|
-
Authorization: `Bearer ${args.accessToken}`,
|
|
402
|
-
},
|
|
403
|
-
});
|
|
404
|
-
const parsed = (await response.json());
|
|
405
|
-
return normalizeGoogleGmailMessage(parsed, args.selfEmail ?? null);
|
|
406
|
-
}));
|
|
407
|
-
return messages
|
|
408
|
-
.filter((message) => message !== null)
|
|
409
|
-
.sort((left, right) => {
|
|
410
|
-
const scoreDelta = right.triageScore - left.triageScore;
|
|
411
|
-
if (scoreDelta !== 0) {
|
|
412
|
-
return scoreDelta;
|
|
413
|
-
}
|
|
414
|
-
return Date.parse(right.receivedAt) - Date.parse(left.receivedAt);
|
|
415
|
-
});
|
|
416
|
-
}
|
|
417
|
-
async function postGoogleGmailRaw(accessToken, rawMessage) {
|
|
418
|
-
const response = await googleApiFetch(`${GOOGLE_GMAIL_MESSAGES_ENDPOINT}/send`, {
|
|
419
|
-
method: "POST",
|
|
420
|
-
headers: {
|
|
421
|
-
Authorization: `Bearer ${accessToken}`,
|
|
422
|
-
"Content-Type": "application/json",
|
|
423
|
-
},
|
|
424
|
-
body: JSON.stringify({ raw: rawMessage }),
|
|
425
|
-
});
|
|
426
|
-
// The Gmail API returns the sent message metadata on success.
|
|
427
|
-
// Parse it so callers can verify the send and store the message ID.
|
|
428
|
-
try {
|
|
429
|
-
const data = (await response.json());
|
|
430
|
-
return {
|
|
431
|
-
messageId: typeof data.id === "string" ? data.id : null,
|
|
432
|
-
threadId: typeof data.threadId === "string" ? data.threadId : null,
|
|
433
|
-
labelIds: Array.isArray(data.labelIds) ? data.labelIds : [],
|
|
434
|
-
};
|
|
435
|
-
}
|
|
436
|
-
catch {
|
|
437
|
-
// Response was 2xx but body wasn't valid JSON — unusual but not fatal.
|
|
438
|
-
return { messageId: null, threadId: null, labelIds: [] };
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
function encodeGmailRfc822(lines) {
|
|
442
|
-
return Buffer.from(lines.join("\r\n"), "utf-8").toString("base64url");
|
|
443
|
-
}
|
|
444
|
-
export async function sendGoogleGmailReply(args) {
|
|
445
|
-
const lines = [
|
|
446
|
-
`To: ${args.to.join(", ")}`,
|
|
447
|
-
...(args.cc && args.cc.length > 0 ? [`Cc: ${args.cc.join(", ")}`] : []),
|
|
448
|
-
`Subject: ${normalizeReplySubject(args.subject)}`,
|
|
449
|
-
"MIME-Version: 1.0",
|
|
450
|
-
"Content-Type: text/plain; charset=UTF-8",
|
|
451
|
-
...(args.inReplyTo ? [`In-Reply-To: ${args.inReplyTo}`] : []),
|
|
452
|
-
...(args.references ? [`References: ${args.references}`] : []),
|
|
453
|
-
"",
|
|
454
|
-
args.bodyText.replace(/\r?\n/g, "\r\n"),
|
|
455
|
-
];
|
|
456
|
-
return postGoogleGmailRaw(args.accessToken, encodeGmailRfc822(lines));
|
|
457
|
-
}
|
|
458
|
-
export async function sendGoogleGmailMessage(args) {
|
|
459
|
-
const subject = args.subject.trim() || "(no subject)";
|
|
460
|
-
const lines = [
|
|
461
|
-
`To: ${args.to.join(", ")}`,
|
|
462
|
-
...(args.cc && args.cc.length > 0 ? [`Cc: ${args.cc.join(", ")}`] : []),
|
|
463
|
-
...(args.bcc && args.bcc.length > 0 ? [`Bcc: ${args.bcc.join(", ")}`] : []),
|
|
464
|
-
`Subject: ${subject}`,
|
|
465
|
-
"MIME-Version: 1.0",
|
|
466
|
-
"Content-Type: text/plain; charset=UTF-8",
|
|
467
|
-
"",
|
|
468
|
-
args.bodyText.replace(/\r?\n/g, "\r\n"),
|
|
469
|
-
];
|
|
470
|
-
return postGoogleGmailRaw(args.accessToken, encodeGmailRfc822(lines));
|
|
471
|
-
}
|
|
1
|
+
export * from "@elizaos/app-lifeops/lifeops/google-gmail";
|