@elizaos/agent 2.0.0-alpha.144 → 2.0.0-alpha.152
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
|
@@ -0,0 +1,856 @@
|
|
|
1
|
+
import { logger, ModelType } from "@elizaos/core";
|
|
2
|
+
import { textIncludesKeywordTerm } from "@elizaos/shared/validation-keywords";
|
|
3
|
+
import { loadInboxTriageConfig } from "../inbox/config.js";
|
|
4
|
+
import { fetchAllMessages } from "../inbox/message-fetcher.js";
|
|
5
|
+
import { looksLikeInboxConfirmation, reflectOnAutoReply, reflectOnSendConfirmation, } from "../inbox/reflection.js";
|
|
6
|
+
import { InboxTriageRepository } from "../inbox/repository.js";
|
|
7
|
+
import { applyTriageRules, classifyMessages, } from "../inbox/triage-classifier.js";
|
|
8
|
+
import { hasAdminAccess } from "@elizaos/agent/security/access";
|
|
9
|
+
import { resolveAdminEntityId } from "@elizaos/agent/actions/send-message";
|
|
10
|
+
import { INTERNAL_URL } from "./lifeops-google-helpers.js";
|
|
11
|
+
// ---------------------------------------------------------------------------
|
|
12
|
+
// Subaction inference
|
|
13
|
+
// ---------------------------------------------------------------------------
|
|
14
|
+
const TRIAGE_TERMS = [
|
|
15
|
+
"triage",
|
|
16
|
+
"check",
|
|
17
|
+
"scan",
|
|
18
|
+
"new messages",
|
|
19
|
+
"check inbox",
|
|
20
|
+
"检查",
|
|
21
|
+
"新消息",
|
|
22
|
+
"查看收件箱",
|
|
23
|
+
"확인",
|
|
24
|
+
"새 메시지",
|
|
25
|
+
"받은편지함",
|
|
26
|
+
"revisar",
|
|
27
|
+
"nuevos mensajes",
|
|
28
|
+
"bandeja de entrada",
|
|
29
|
+
"verificar",
|
|
30
|
+
"novas mensagens",
|
|
31
|
+
"caixa de entrada",
|
|
32
|
+
"kiểm tra",
|
|
33
|
+
"tin nhắn mới",
|
|
34
|
+
"hộp thư đến",
|
|
35
|
+
"tingnan",
|
|
36
|
+
"bagong mensahe",
|
|
37
|
+
];
|
|
38
|
+
const DIGEST_TERMS = [
|
|
39
|
+
"digest",
|
|
40
|
+
"summary",
|
|
41
|
+
"briefing",
|
|
42
|
+
"daily",
|
|
43
|
+
"overview",
|
|
44
|
+
"recap",
|
|
45
|
+
"report",
|
|
46
|
+
"摘要",
|
|
47
|
+
"简报",
|
|
48
|
+
"概览",
|
|
49
|
+
"总结",
|
|
50
|
+
"요약",
|
|
51
|
+
"브리핑",
|
|
52
|
+
"개요",
|
|
53
|
+
"resumen",
|
|
54
|
+
"informe",
|
|
55
|
+
"resúmen",
|
|
56
|
+
"resumo",
|
|
57
|
+
"relatório",
|
|
58
|
+
"relatorio",
|
|
59
|
+
"tóm tắt",
|
|
60
|
+
"báo cáo",
|
|
61
|
+
"tổng quan",
|
|
62
|
+
"buod",
|
|
63
|
+
"ulat",
|
|
64
|
+
];
|
|
65
|
+
const RESPOND_TERMS = [
|
|
66
|
+
"respond",
|
|
67
|
+
"reply",
|
|
68
|
+
"send",
|
|
69
|
+
"confirm",
|
|
70
|
+
"approve",
|
|
71
|
+
"回复",
|
|
72
|
+
"发送",
|
|
73
|
+
"确认",
|
|
74
|
+
"批准",
|
|
75
|
+
"답장",
|
|
76
|
+
"보내기",
|
|
77
|
+
"확인",
|
|
78
|
+
"승인",
|
|
79
|
+
"responder",
|
|
80
|
+
"enviar",
|
|
81
|
+
"confirmar",
|
|
82
|
+
"aprobar",
|
|
83
|
+
"responder",
|
|
84
|
+
"enviar",
|
|
85
|
+
"confirmar",
|
|
86
|
+
"aprovar",
|
|
87
|
+
"trả lời",
|
|
88
|
+
"gửi",
|
|
89
|
+
"xác nhận",
|
|
90
|
+
"phê duyệt",
|
|
91
|
+
"sumagot",
|
|
92
|
+
"ipadala",
|
|
93
|
+
"kumpirmahin",
|
|
94
|
+
"aprubahan",
|
|
95
|
+
];
|
|
96
|
+
function resolveSubaction(params, messageText, state) {
|
|
97
|
+
// 1. Explicit subaction param
|
|
98
|
+
if (params.subaction)
|
|
99
|
+
return params.subaction;
|
|
100
|
+
// 2. Infer from intent or message text
|
|
101
|
+
const text = params.intent ?? messageText;
|
|
102
|
+
if (TRIAGE_TERMS.some((t) => textIncludesKeywordTerm(text, t)))
|
|
103
|
+
return "triage";
|
|
104
|
+
if (DIGEST_TERMS.some((t) => textIncludesKeywordTerm(text, t)))
|
|
105
|
+
return "digest";
|
|
106
|
+
if (RESPOND_TERMS.some((t) => textIncludesKeywordTerm(text, t)))
|
|
107
|
+
return "respond";
|
|
108
|
+
// 3. If there's a pending draft in state, assume respond
|
|
109
|
+
if (latestPendingDraft(state))
|
|
110
|
+
return "respond";
|
|
111
|
+
// 4. Default: triage
|
|
112
|
+
return "triage";
|
|
113
|
+
}
|
|
114
|
+
// ---------------------------------------------------------------------------
|
|
115
|
+
// INBOX action
|
|
116
|
+
// ---------------------------------------------------------------------------
|
|
117
|
+
const ACTION_NAME = "INBOX";
|
|
118
|
+
export const inboxAction = {
|
|
119
|
+
name: ACTION_NAME,
|
|
120
|
+
similes: [
|
|
121
|
+
"CHECK_INBOX",
|
|
122
|
+
"INBOX_TRIAGE",
|
|
123
|
+
"INBOX_DIGEST",
|
|
124
|
+
"INBOX_RESPOND",
|
|
125
|
+
"TRIAGE_INBOX",
|
|
126
|
+
"SCAN_MESSAGES",
|
|
127
|
+
"CHECK_MESSAGES",
|
|
128
|
+
"DAILY_DIGEST",
|
|
129
|
+
"INBOX_SUMMARY",
|
|
130
|
+
"REPLY_INBOX",
|
|
131
|
+
"RESPOND_TO_MESSAGE",
|
|
132
|
+
],
|
|
133
|
+
description: "Unified inbox management: triage new messages across all channels, " +
|
|
134
|
+
"generate a daily digest summary, or draft/send a response to a triaged " +
|
|
135
|
+
"item. Subactions: triage, digest, respond. Admin/owner only.",
|
|
136
|
+
validate: async (runtime, message) => hasAdminAccess(runtime, message),
|
|
137
|
+
handler: async (runtime, message, state, options) => {
|
|
138
|
+
if (!(await hasAdminAccess(runtime, message))) {
|
|
139
|
+
return {
|
|
140
|
+
text: "Permission denied: only the owner or admin may use inbox actions.",
|
|
141
|
+
success: false,
|
|
142
|
+
values: { success: false, error: "PERMISSION_DENIED" },
|
|
143
|
+
data: { actionName: ACTION_NAME },
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
const params = (options?.parameters ??
|
|
147
|
+
{});
|
|
148
|
+
const userText = extractText(message);
|
|
149
|
+
const subaction = resolveSubaction(params, userText, state);
|
|
150
|
+
switch (subaction) {
|
|
151
|
+
case "triage":
|
|
152
|
+
return handleTriage(runtime, message, state, params);
|
|
153
|
+
case "digest":
|
|
154
|
+
return handleDigest(runtime, message, state, params);
|
|
155
|
+
case "respond":
|
|
156
|
+
return handleRespond(runtime, message, state, params);
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
parameters: [
|
|
160
|
+
{
|
|
161
|
+
name: "subaction",
|
|
162
|
+
description: "Inbox operation to run: triage (scan channels for new messages), " +
|
|
163
|
+
"digest (daily summary), or respond (draft/send a reply).",
|
|
164
|
+
required: false,
|
|
165
|
+
schema: {
|
|
166
|
+
type: "string",
|
|
167
|
+
enum: ["triage", "digest", "respond"],
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
name: "intent",
|
|
172
|
+
description: 'Natural language inbox request. Examples: "check my inbox for new messages", ' +
|
|
173
|
+
'"give me my daily summary", "respond to Alice\'s Discord message".',
|
|
174
|
+
required: false,
|
|
175
|
+
schema: { type: "string" },
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
name: "target",
|
|
179
|
+
description: "Who to respond to (for respond subaction). Can be a sender name, " +
|
|
180
|
+
"channel name, or source platform.",
|
|
181
|
+
required: false,
|
|
182
|
+
schema: { type: "string" },
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
name: "entryId",
|
|
186
|
+
description: "Specific triage entry ID to respond to.",
|
|
187
|
+
required: false,
|
|
188
|
+
schema: { type: "string" },
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
name: "messageText",
|
|
192
|
+
description: "Pre-composed message text for the response.",
|
|
193
|
+
required: false,
|
|
194
|
+
schema: { type: "string" },
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
name: "confirmed",
|
|
198
|
+
description: "Set to true when the user is confirming a previously drafted response.",
|
|
199
|
+
required: false,
|
|
200
|
+
schema: { type: "boolean" },
|
|
201
|
+
},
|
|
202
|
+
],
|
|
203
|
+
examples: [
|
|
204
|
+
[
|
|
205
|
+
{
|
|
206
|
+
name: "{{name1}}",
|
|
207
|
+
content: { text: "Check my inbox for new messages" },
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
name: "{{agentName}}",
|
|
211
|
+
content: {
|
|
212
|
+
text: "Triaged 15 new messages: 2 urgent (escalated), 5 need reply, 3 auto-replied, 5 ignored.",
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
],
|
|
216
|
+
[
|
|
217
|
+
{
|
|
218
|
+
name: "{{name1}}",
|
|
219
|
+
content: { text: "Give me my daily inbox summary" },
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
name: "{{agentName}}",
|
|
223
|
+
content: {
|
|
224
|
+
text: '# Daily Inbox Summary — Saturday, April 12, 2026\n\n## Urgent (2)\n- Discord DM from Alice: "Are we meeting tomorrow?"',
|
|
225
|
+
},
|
|
226
|
+
},
|
|
227
|
+
],
|
|
228
|
+
[
|
|
229
|
+
{
|
|
230
|
+
name: "{{name1}}",
|
|
231
|
+
content: { text: "Respond to Alice's Discord message" },
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
name: "{{agentName}}",
|
|
235
|
+
content: {
|
|
236
|
+
text: "I'll send this to Alice on Discord DM:\n\n> Hey Alice, yes we're still on for tomorrow!\n\nSay \"send it\" to confirm.",
|
|
237
|
+
},
|
|
238
|
+
},
|
|
239
|
+
],
|
|
240
|
+
],
|
|
241
|
+
};
|
|
242
|
+
// ===========================================================================
|
|
243
|
+
// Subaction: TRIAGE
|
|
244
|
+
// ===========================================================================
|
|
245
|
+
async function handleTriage(runtime, _message, _state, _params) {
|
|
246
|
+
const config = loadInboxTriageConfig();
|
|
247
|
+
const repo = new InboxTriageRepository(runtime);
|
|
248
|
+
// 1. "since" window: current time minus one hour (the triage interval).
|
|
249
|
+
// Previous implementation used the most-recent unresolved entry's
|
|
250
|
+
// createdAt, which could miss messages arriving after that entry.
|
|
251
|
+
const sinceIso = new Date(Date.now() - 60 * 60 * 1000).toISOString();
|
|
252
|
+
// 2. Fetch messages from all channels
|
|
253
|
+
const allMessages = await fetchAllMessages(runtime, {
|
|
254
|
+
sources: config.channels,
|
|
255
|
+
sinceIso,
|
|
256
|
+
limit: 200,
|
|
257
|
+
});
|
|
258
|
+
if (allMessages.length === 0) {
|
|
259
|
+
return {
|
|
260
|
+
text: "No new messages to triage.",
|
|
261
|
+
success: true,
|
|
262
|
+
values: { success: true, triaged: 0 },
|
|
263
|
+
data: { actionName: ACTION_NAME, subaction: "triage" },
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
// 3. Deduplicate against already-triaged messages
|
|
267
|
+
const newMessages = [];
|
|
268
|
+
for (const msg of allMessages) {
|
|
269
|
+
const existing = await repo.getBySourceMessageId(msg.id);
|
|
270
|
+
if (!existing) {
|
|
271
|
+
newMessages.push(msg);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
if (newMessages.length === 0) {
|
|
275
|
+
return {
|
|
276
|
+
text: "All recent messages have already been triaged.",
|
|
277
|
+
success: true,
|
|
278
|
+
values: {
|
|
279
|
+
success: true,
|
|
280
|
+
triaged: 0,
|
|
281
|
+
skippedDuplicates: allMessages.length,
|
|
282
|
+
},
|
|
283
|
+
data: { actionName: ACTION_NAME, subaction: "triage" },
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
// 4. Apply rule-based pre-classification
|
|
287
|
+
const needsLlm = [];
|
|
288
|
+
const ruleResults = new Map();
|
|
289
|
+
for (const msg of newMessages) {
|
|
290
|
+
const ruleClassification = applyTriageRules(msg, config.triageRules, config);
|
|
291
|
+
if (ruleClassification) {
|
|
292
|
+
ruleResults.set(msg.id, {
|
|
293
|
+
classification: ruleClassification,
|
|
294
|
+
urgency: ruleClassification === "urgent"
|
|
295
|
+
? "high"
|
|
296
|
+
: ruleClassification === "ignore"
|
|
297
|
+
? "low"
|
|
298
|
+
: "medium",
|
|
299
|
+
confidence: 0.95,
|
|
300
|
+
reasoning: `Rule-based classification: ${ruleClassification}`,
|
|
301
|
+
});
|
|
302
|
+
}
|
|
303
|
+
else {
|
|
304
|
+
needsLlm.push(msg);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
// 5. LLM classification for remaining messages
|
|
308
|
+
const examples = await repo.getExamples(5);
|
|
309
|
+
const llmResults = await classifyMessages(runtime, needsLlm, {
|
|
310
|
+
config,
|
|
311
|
+
examples,
|
|
312
|
+
});
|
|
313
|
+
// Build a Map for O(1) lookup instead of O(n) indexOf per message.
|
|
314
|
+
const llmResultMap = new Map();
|
|
315
|
+
for (let i = 0; i < needsLlm.length; i++) {
|
|
316
|
+
const result = llmResults[i];
|
|
317
|
+
if (result) {
|
|
318
|
+
llmResultMap.set(needsLlm[i].id, result);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
// 6. Merge results and store
|
|
322
|
+
let countUrgent = 0;
|
|
323
|
+
let countNeedsReply = 0;
|
|
324
|
+
let countAutoReplied = 0;
|
|
325
|
+
let countIgnored = 0;
|
|
326
|
+
let countStored = 0;
|
|
327
|
+
for (const msg of newMessages) {
|
|
328
|
+
const result = ruleResults.get(msg.id) ?? llmResultMap.get(msg.id) ?? null;
|
|
329
|
+
if (!result)
|
|
330
|
+
continue;
|
|
331
|
+
if (result.classification === "ignore") {
|
|
332
|
+
countIgnored++;
|
|
333
|
+
continue;
|
|
334
|
+
}
|
|
335
|
+
// Store the triage entry
|
|
336
|
+
const entry = await repo.storeTriage({
|
|
337
|
+
source: msg.source,
|
|
338
|
+
sourceRoomId: msg.roomId,
|
|
339
|
+
sourceEntityId: msg.entityId,
|
|
340
|
+
sourceMessageId: msg.id,
|
|
341
|
+
channelName: msg.channelName,
|
|
342
|
+
channelType: msg.channelType,
|
|
343
|
+
deepLink: msg.deepLink,
|
|
344
|
+
classification: result.classification,
|
|
345
|
+
urgency: result.urgency,
|
|
346
|
+
confidence: result.confidence,
|
|
347
|
+
snippet: msg.snippet,
|
|
348
|
+
senderName: msg.senderName,
|
|
349
|
+
threadContext: msg.threadMessages,
|
|
350
|
+
triageReasoning: result.reasoning,
|
|
351
|
+
suggestedResponse: result.suggestedResponse,
|
|
352
|
+
});
|
|
353
|
+
countStored++;
|
|
354
|
+
// Track counts
|
|
355
|
+
if (result.classification === "urgent")
|
|
356
|
+
countUrgent++;
|
|
357
|
+
if (result.classification === "needs_reply")
|
|
358
|
+
countNeedsReply++;
|
|
359
|
+
// 7. Escalate urgent items
|
|
360
|
+
if (result.classification === "urgent") {
|
|
361
|
+
try {
|
|
362
|
+
const { EscalationService } = await import("@elizaos/agent/services/escalation");
|
|
363
|
+
const linkText = msg.deepLink ? `\n${msg.deepLink}` : "";
|
|
364
|
+
await EscalationService.startEscalation(runtime, `Urgent message from ${msg.senderName} on ${msg.source}`, `[URGENT] ${msg.channelName}: "${msg.snippet}"${linkText}`);
|
|
365
|
+
}
|
|
366
|
+
catch (err) {
|
|
367
|
+
logger.warn("[INBOX] Escalation failed:", String(err));
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
// 8. Auto-reply check
|
|
371
|
+
if (result.classification === "needs_reply" &&
|
|
372
|
+
result.suggestedResponse &&
|
|
373
|
+
config.autoReply?.enabled) {
|
|
374
|
+
const autoReplyResult = await tryAutoReply(runtime, msg, result, entry.id, config, repo);
|
|
375
|
+
if (autoReplyResult)
|
|
376
|
+
countAutoReplied++;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
// 9. Cleanup old resolved entries
|
|
380
|
+
if (config.retentionDays) {
|
|
381
|
+
const cutoff = new Date(Date.now() - config.retentionDays * 24 * 60 * 60 * 1000).toISOString();
|
|
382
|
+
const cleaned = await repo.cleanupOlderThan(cutoff);
|
|
383
|
+
if (cleaned > 0) {
|
|
384
|
+
logger.info(`[INBOX] Cleaned up ${cleaned} old triage entries`);
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
const summary = [
|
|
388
|
+
`Triaged ${newMessages.length} new messages:`,
|
|
389
|
+
countUrgent > 0 ? `${countUrgent} urgent (escalated)` : null,
|
|
390
|
+
countNeedsReply > 0 ? `${countNeedsReply} need reply` : null,
|
|
391
|
+
countAutoReplied > 0 ? `${countAutoReplied} auto-replied` : null,
|
|
392
|
+
countIgnored > 0 ? `${countIgnored} ignored` : null,
|
|
393
|
+
`${countStored} stored for review`,
|
|
394
|
+
]
|
|
395
|
+
.filter(Boolean)
|
|
396
|
+
.join(", ");
|
|
397
|
+
return {
|
|
398
|
+
text: summary,
|
|
399
|
+
success: true,
|
|
400
|
+
values: {
|
|
401
|
+
success: true,
|
|
402
|
+
triaged: newMessages.length,
|
|
403
|
+
urgent: countUrgent,
|
|
404
|
+
needsReply: countNeedsReply,
|
|
405
|
+
autoReplied: countAutoReplied,
|
|
406
|
+
ignored: countIgnored,
|
|
407
|
+
},
|
|
408
|
+
data: { actionName: ACTION_NAME, subaction: "triage" },
|
|
409
|
+
};
|
|
410
|
+
}
|
|
411
|
+
// ===========================================================================
|
|
412
|
+
// Subaction: DIGEST
|
|
413
|
+
// ===========================================================================
|
|
414
|
+
async function handleDigest(runtime, message, _state, _params) {
|
|
415
|
+
const config = loadInboxTriageConfig();
|
|
416
|
+
const repo = new InboxTriageRepository(runtime);
|
|
417
|
+
// 1. Get entries from the last 24 hours
|
|
418
|
+
const sinceIso = new Date(Date.now() - 24 * 60 * 60 * 1000).toISOString();
|
|
419
|
+
const entries = await repo.getRecentForDigest(sinceIso);
|
|
420
|
+
if (entries.length === 0) {
|
|
421
|
+
return {
|
|
422
|
+
text: "No inbox activity in the last 24 hours. All clear.",
|
|
423
|
+
success: true,
|
|
424
|
+
values: { success: true, entryCount: 0 },
|
|
425
|
+
data: { actionName: ACTION_NAME, subaction: "digest" },
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
// 2. Group by classification
|
|
429
|
+
const urgent = entries.filter((e) => e.classification === "urgent");
|
|
430
|
+
const needsReply = entries.filter((e) => e.classification === "needs_reply" && !e.resolved);
|
|
431
|
+
const notify = entries.filter((e) => e.classification === "notify");
|
|
432
|
+
const info = entries.filter((e) => e.classification === "info");
|
|
433
|
+
const autoReplied = entries.filter((e) => e.autoReplied);
|
|
434
|
+
const resolved = entries.filter((e) => e.resolved && !e.autoReplied);
|
|
435
|
+
// 3. Build digest
|
|
436
|
+
const today = new Date().toLocaleDateString("en-US", {
|
|
437
|
+
weekday: "long",
|
|
438
|
+
year: "numeric",
|
|
439
|
+
month: "long",
|
|
440
|
+
day: "numeric",
|
|
441
|
+
});
|
|
442
|
+
const lines = [`# Daily Inbox Summary — ${today}`];
|
|
443
|
+
lines.push(`\n${entries.length} messages triaged across ${countSources(entries)} channels.`);
|
|
444
|
+
if (urgent.length > 0) {
|
|
445
|
+
lines.push(`\n## Urgent (${urgent.length})`);
|
|
446
|
+
for (const e of urgent) {
|
|
447
|
+
lines.push(formatEntryLine(e));
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
if (needsReply.length > 0) {
|
|
451
|
+
lines.push(`\n## Needs Reply (${needsReply.length})`);
|
|
452
|
+
for (const e of needsReply) {
|
|
453
|
+
lines.push(formatEntryLine(e));
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
if (notify.length > 0) {
|
|
457
|
+
lines.push(`\n## Notifications (${notify.length})`);
|
|
458
|
+
for (const e of notify.slice(0, 10)) {
|
|
459
|
+
lines.push(formatEntryLine(e));
|
|
460
|
+
}
|
|
461
|
+
if (notify.length > 10) {
|
|
462
|
+
lines.push(` ...and ${notify.length - 10} more`);
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
if (autoReplied.length > 0) {
|
|
466
|
+
lines.push(`\n## Auto-Replied (${autoReplied.length})`);
|
|
467
|
+
for (const e of autoReplied) {
|
|
468
|
+
const draft = e.draftResponse
|
|
469
|
+
? ` — replied: "${e.draftResponse.slice(0, 60)}..."`
|
|
470
|
+
: "";
|
|
471
|
+
lines.push(`- **${e.channelName}** (${e.source}): "${e.snippet.slice(0, 80)}"${draft}`);
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
if (resolved.length > 0) {
|
|
475
|
+
lines.push(`\n## Resolved (${resolved.length})`);
|
|
476
|
+
lines.push(` ${resolved.length} items were addressed during the day.`);
|
|
477
|
+
}
|
|
478
|
+
if (info.length > 0) {
|
|
479
|
+
lines.push(`\n## Informational (${info.length})`);
|
|
480
|
+
lines.push(` ${info.length} informational messages were logged.`);
|
|
481
|
+
}
|
|
482
|
+
const digestText = lines.join("\n");
|
|
483
|
+
// 4. Send digest to owner
|
|
484
|
+
const deliveryChannel = config.digestDeliveryChannel ?? "client_chat";
|
|
485
|
+
try {
|
|
486
|
+
const adminEntityId = await resolveAdminEntityId(runtime, message);
|
|
487
|
+
await runtime.sendMessageToTarget({
|
|
488
|
+
source: deliveryChannel,
|
|
489
|
+
entityId: adminEntityId,
|
|
490
|
+
}, {
|
|
491
|
+
text: digestText,
|
|
492
|
+
source: deliveryChannel,
|
|
493
|
+
metadata: { digestType: "inbox_daily" },
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
catch (err) {
|
|
497
|
+
logger.warn("[INBOX] Failed to deliver digest:", String(err));
|
|
498
|
+
}
|
|
499
|
+
return {
|
|
500
|
+
text: digestText,
|
|
501
|
+
success: true,
|
|
502
|
+
values: {
|
|
503
|
+
success: true,
|
|
504
|
+
entryCount: entries.length,
|
|
505
|
+
urgent: urgent.length,
|
|
506
|
+
needsReply: needsReply.length,
|
|
507
|
+
autoReplied: autoReplied.length,
|
|
508
|
+
},
|
|
509
|
+
data: { actionName: ACTION_NAME, subaction: "digest" },
|
|
510
|
+
};
|
|
511
|
+
}
|
|
512
|
+
// ===========================================================================
|
|
513
|
+
// Subaction: RESPOND
|
|
514
|
+
// ===========================================================================
|
|
515
|
+
async function handleRespond(runtime, message, state, params) {
|
|
516
|
+
const repo = new InboxTriageRepository(runtime);
|
|
517
|
+
const userText = extractText(message);
|
|
518
|
+
// -- Check for pending draft confirmation --------------------------------
|
|
519
|
+
const pendingDraft = latestPendingDraft(state);
|
|
520
|
+
if (pendingDraft &&
|
|
521
|
+
(params.confirmed || looksLikeInboxConfirmation(userText))) {
|
|
522
|
+
return handleConfirmation(runtime, message, pendingDraft, userText, repo);
|
|
523
|
+
}
|
|
524
|
+
// -- Find the triage entry to respond to ---------------------------------
|
|
525
|
+
let entry = null;
|
|
526
|
+
if (params.entryId) {
|
|
527
|
+
entry = await repo.getById(params.entryId);
|
|
528
|
+
}
|
|
529
|
+
if (!entry && params.target) {
|
|
530
|
+
const unresolved = await repo.getUnresolved({ limit: 50 });
|
|
531
|
+
entry = findBestMatch(unresolved, params.target);
|
|
532
|
+
}
|
|
533
|
+
if (!entry) {
|
|
534
|
+
// If no specific target, grab the most urgent unresolved item
|
|
535
|
+
const unresolved = await repo.getUnresolved({ limit: 5 });
|
|
536
|
+
const needsReply = unresolved.filter((e) => e.classification === "needs_reply" || e.classification === "urgent");
|
|
537
|
+
if (needsReply.length === 0) {
|
|
538
|
+
return {
|
|
539
|
+
text: "No pending inbox items need a reply right now. Use INBOX to triage for new messages.",
|
|
540
|
+
success: true,
|
|
541
|
+
values: { success: true },
|
|
542
|
+
data: { actionName: ACTION_NAME, subaction: "respond" },
|
|
543
|
+
};
|
|
544
|
+
}
|
|
545
|
+
if (needsReply.length === 1) {
|
|
546
|
+
entry = needsReply[0];
|
|
547
|
+
}
|
|
548
|
+
else {
|
|
549
|
+
const itemList = needsReply
|
|
550
|
+
.map((e) => `- **${e.channelName}** (${e.source}): "${e.snippet.slice(0, 60)}"`)
|
|
551
|
+
.join("\n");
|
|
552
|
+
return {
|
|
553
|
+
text: `Multiple items need a reply. Which one?\n\n${itemList}\n\nSay "respond to [name/channel]" to pick one.`,
|
|
554
|
+
success: true,
|
|
555
|
+
values: { success: true, pendingCount: needsReply.length },
|
|
556
|
+
data: { actionName: ACTION_NAME, subaction: "respond" },
|
|
557
|
+
};
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
if (!entry) {
|
|
561
|
+
return {
|
|
562
|
+
text: "Could not find the inbox item you want to respond to.",
|
|
563
|
+
success: false,
|
|
564
|
+
values: { success: false, error: "NOT_FOUND" },
|
|
565
|
+
data: { actionName: ACTION_NAME, subaction: "respond" },
|
|
566
|
+
};
|
|
567
|
+
}
|
|
568
|
+
// -- Draft a response ----------------------------------------------------
|
|
569
|
+
const draftText = params.messageText
|
|
570
|
+
? params.messageText
|
|
571
|
+
: await draftResponse(runtime, entry, userText);
|
|
572
|
+
const draft = {
|
|
573
|
+
triageEntryId: entry.id,
|
|
574
|
+
source: entry.source,
|
|
575
|
+
targetRoomId: entry.sourceRoomId ? entry.sourceRoomId : undefined,
|
|
576
|
+
targetEntityId: entry.sourceEntityId
|
|
577
|
+
? entry.sourceEntityId
|
|
578
|
+
: undefined,
|
|
579
|
+
gmailMessageId: entry.source === "gmail"
|
|
580
|
+
? (entry.sourceMessageId ?? undefined)
|
|
581
|
+
: undefined,
|
|
582
|
+
draftText,
|
|
583
|
+
deepLink: entry.deepLink,
|
|
584
|
+
channelName: entry.channelName,
|
|
585
|
+
senderName: entry.senderName ?? "Unknown",
|
|
586
|
+
};
|
|
587
|
+
return {
|
|
588
|
+
text: `I'll send this to **${draft.senderName}** on **${draft.channelName}** (${draft.source}):\n\n` +
|
|
589
|
+
`> ${draftText}\n\n` +
|
|
590
|
+
`Say **"send it"** to confirm, or tell me what to change.`,
|
|
591
|
+
success: true,
|
|
592
|
+
values: { success: true, awaitingConfirmation: true },
|
|
593
|
+
data: {
|
|
594
|
+
actionName: ACTION_NAME,
|
|
595
|
+
subaction: "respond",
|
|
596
|
+
inboxDraft: draft,
|
|
597
|
+
},
|
|
598
|
+
};
|
|
599
|
+
}
|
|
600
|
+
// ===========================================================================
|
|
601
|
+
// Shared helpers
|
|
602
|
+
// ===========================================================================
|
|
603
|
+
// -- Auto-reply (used by triage) -------------------------------------------
|
|
604
|
+
async function tryAutoReply(runtime, msg, result, entryId, config, repo) {
|
|
605
|
+
const autoConfig = config.autoReply;
|
|
606
|
+
if (!autoConfig?.enabled)
|
|
607
|
+
return false;
|
|
608
|
+
const suggestedResponse = result.suggestedResponse;
|
|
609
|
+
if (!suggestedResponse)
|
|
610
|
+
return false;
|
|
611
|
+
const threshold = autoConfig.confidenceThreshold ?? 0.85;
|
|
612
|
+
if (result.confidence < threshold)
|
|
613
|
+
return false;
|
|
614
|
+
// Sender whitelist check
|
|
615
|
+
if (autoConfig.senderWhitelist?.length) {
|
|
616
|
+
const senderId = msg.entityId ?? msg.senderName;
|
|
617
|
+
if (!autoConfig.senderWhitelist.some((s) => s.toLowerCase() === senderId.toLowerCase())) {
|
|
618
|
+
return false;
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
// Channel whitelist check
|
|
622
|
+
if (autoConfig.channelWhitelist?.length) {
|
|
623
|
+
if (!autoConfig.channelWhitelist.includes(msg.source)) {
|
|
624
|
+
return false;
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
// Rate limit check
|
|
628
|
+
const maxPerHour = autoConfig.maxAutoRepliesPerHour ?? 5;
|
|
629
|
+
const oneHourAgo = new Date(Date.now() - 60 * 60 * 1000).toISOString();
|
|
630
|
+
const recentAutoCount = await repo.countAutoRepliesSince(oneHourAgo);
|
|
631
|
+
if (recentAutoCount >= maxPerHour) {
|
|
632
|
+
logger.info("[INBOX] Auto-reply rate limit reached");
|
|
633
|
+
return false;
|
|
634
|
+
}
|
|
635
|
+
// Reflection safety check
|
|
636
|
+
const reflection = await reflectOnAutoReply(runtime, {
|
|
637
|
+
inboundText: msg.text,
|
|
638
|
+
replyText: suggestedResponse,
|
|
639
|
+
source: msg.source,
|
|
640
|
+
senderName: msg.senderName,
|
|
641
|
+
});
|
|
642
|
+
if (!reflection.approved) {
|
|
643
|
+
logger.info(`[INBOX] Auto-reply rejected by reflection: ${reflection.reasoning}`);
|
|
644
|
+
return false;
|
|
645
|
+
}
|
|
646
|
+
// Send the auto-reply
|
|
647
|
+
try {
|
|
648
|
+
if (msg.source === "gmail" && msg.gmailMessageId) {
|
|
649
|
+
const { LifeOpsService } = await import("../lifeops/service.js");
|
|
650
|
+
const service = new LifeOpsService(runtime);
|
|
651
|
+
await service.sendGmailReply(INTERNAL_URL, {
|
|
652
|
+
messageId: msg.gmailMessageId,
|
|
653
|
+
bodyText: suggestedResponse,
|
|
654
|
+
});
|
|
655
|
+
}
|
|
656
|
+
else if (msg.roomId) {
|
|
657
|
+
await runtime.sendMessageToTarget({
|
|
658
|
+
source: msg.source,
|
|
659
|
+
roomId: msg.roomId,
|
|
660
|
+
}, { text: suggestedResponse, source: msg.source });
|
|
661
|
+
}
|
|
662
|
+
else {
|
|
663
|
+
return false;
|
|
664
|
+
}
|
|
665
|
+
await repo.markResolved(entryId, {
|
|
666
|
+
draftResponse: suggestedResponse,
|
|
667
|
+
autoReplied: true,
|
|
668
|
+
});
|
|
669
|
+
logger.info(`[INBOX] Auto-replied to ${msg.senderName} on ${msg.source}`);
|
|
670
|
+
return true;
|
|
671
|
+
}
|
|
672
|
+
catch (err) {
|
|
673
|
+
logger.warn("[INBOX] Auto-reply send failed:", String(err));
|
|
674
|
+
return false;
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
// -- Draft generation (used by respond) ------------------------------------
|
|
678
|
+
async function draftResponse(runtime, entry, userHint) {
|
|
679
|
+
const seed = entry.suggestedResponse ?? "";
|
|
680
|
+
const contextLines = entry.threadContext
|
|
681
|
+
? entry.threadContext.join("\n")
|
|
682
|
+
: "";
|
|
683
|
+
const prompt = [
|
|
684
|
+
"Draft a brief, natural response to the following message.",
|
|
685
|
+
"Match the tone and formality of the conversation.",
|
|
686
|
+
"",
|
|
687
|
+
`From: ${entry.senderName ?? "Unknown"}`,
|
|
688
|
+
`Channel: ${entry.channelName} (${entry.source})`,
|
|
689
|
+
`Their message: "${entry.snippet}"`,
|
|
690
|
+
contextLines ? `Recent context:\n${contextLines}` : "",
|
|
691
|
+
seed ? `Suggested starting point: "${seed}"` : "",
|
|
692
|
+
userHint ? `Owner's guidance: "${userHint}"` : "",
|
|
693
|
+
"",
|
|
694
|
+
"Write ONLY the response text. Do not include any explanation or metadata.",
|
|
695
|
+
]
|
|
696
|
+
.filter(Boolean)
|
|
697
|
+
.join("\n");
|
|
698
|
+
try {
|
|
699
|
+
const result = await runtime.useModel(ModelType.TEXT_SMALL, { prompt });
|
|
700
|
+
const text = typeof result === "string" ? result.trim() : "";
|
|
701
|
+
return (text || seed || "Thanks for reaching out. I'll get back to you soon.");
|
|
702
|
+
}
|
|
703
|
+
catch {
|
|
704
|
+
return seed || "Thanks for reaching out. I'll get back to you soon.";
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
// -- Confirmation handling (used by respond) --------------------------------
|
|
708
|
+
async function handleConfirmation(runtime, _message, draft, userText, repo) {
|
|
709
|
+
// Reflection safety check
|
|
710
|
+
const reflection = await reflectOnSendConfirmation(runtime, {
|
|
711
|
+
userMessage: userText,
|
|
712
|
+
draftText: draft.draftText,
|
|
713
|
+
channelName: draft.channelName,
|
|
714
|
+
recipientName: draft.senderName,
|
|
715
|
+
});
|
|
716
|
+
if (!reflection.confirmed) {
|
|
717
|
+
return {
|
|
718
|
+
text: `I wasn't sure you confirmed — ${reflection.reasoning}. Please say **"yes, send it"** to confirm.`,
|
|
719
|
+
success: true,
|
|
720
|
+
values: { success: true, awaitingConfirmation: true },
|
|
721
|
+
data: {
|
|
722
|
+
actionName: ACTION_NAME,
|
|
723
|
+
subaction: "respond",
|
|
724
|
+
inboxDraft: draft,
|
|
725
|
+
},
|
|
726
|
+
};
|
|
727
|
+
}
|
|
728
|
+
// Send the message through the original channel
|
|
729
|
+
try {
|
|
730
|
+
if (draft.source === "gmail" && draft.gmailMessageId) {
|
|
731
|
+
const { LifeOpsService } = await import("../lifeops/service.js");
|
|
732
|
+
const service = new LifeOpsService(runtime);
|
|
733
|
+
await service.sendGmailReply(INTERNAL_URL, {
|
|
734
|
+
messageId: draft.gmailMessageId,
|
|
735
|
+
bodyText: draft.draftText,
|
|
736
|
+
});
|
|
737
|
+
}
|
|
738
|
+
else if (draft.targetRoomId) {
|
|
739
|
+
await runtime.sendMessageToTarget({
|
|
740
|
+
source: draft.source,
|
|
741
|
+
roomId: draft.targetRoomId,
|
|
742
|
+
}, { text: draft.draftText, source: draft.source });
|
|
743
|
+
}
|
|
744
|
+
else {
|
|
745
|
+
return {
|
|
746
|
+
text: "Cannot send: no target room or message ID available for this channel.",
|
|
747
|
+
success: false,
|
|
748
|
+
values: { success: false, error: "NO_TARGET" },
|
|
749
|
+
data: { actionName: ACTION_NAME, subaction: "respond" },
|
|
750
|
+
};
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
catch (err) {
|
|
754
|
+
return {
|
|
755
|
+
text: `Failed to send message: ${String(err)}`,
|
|
756
|
+
success: false,
|
|
757
|
+
values: { success: false, error: "SEND_FAILED" },
|
|
758
|
+
data: { actionName: ACTION_NAME, subaction: "respond" },
|
|
759
|
+
};
|
|
760
|
+
}
|
|
761
|
+
// Mark resolved and store as example
|
|
762
|
+
await repo.markResolved(draft.triageEntryId, {
|
|
763
|
+
draftResponse: draft.draftText,
|
|
764
|
+
});
|
|
765
|
+
const entry = await repo.getById(draft.triageEntryId);
|
|
766
|
+
if (entry) {
|
|
767
|
+
await repo.storeExample({
|
|
768
|
+
source: entry.source,
|
|
769
|
+
snippet: entry.snippet,
|
|
770
|
+
classification: entry.classification,
|
|
771
|
+
ownerAction: "confirmed",
|
|
772
|
+
contextJson: {
|
|
773
|
+
senderName: entry.senderName,
|
|
774
|
+
channelName: entry.channelName,
|
|
775
|
+
draftResponse: draft.draftText,
|
|
776
|
+
},
|
|
777
|
+
});
|
|
778
|
+
}
|
|
779
|
+
return {
|
|
780
|
+
text: `Message sent to **${draft.senderName}** on **${draft.channelName}**.`,
|
|
781
|
+
success: true,
|
|
782
|
+
values: { success: true, sent: true },
|
|
783
|
+
data: { actionName: ACTION_NAME, subaction: "respond", sent: true },
|
|
784
|
+
};
|
|
785
|
+
}
|
|
786
|
+
// -- Digest formatters -----------------------------------------------------
|
|
787
|
+
function formatEntryLine(entry) {
|
|
788
|
+
const resolvedTag = entry.resolved ? " [resolved]" : "";
|
|
789
|
+
const link = entry.deepLink ? `\n ${entry.deepLink}` : "";
|
|
790
|
+
return (`- **${entry.channelName}** (${entry.source}): "${entry.snippet.slice(0, 100)}"${resolvedTag}` +
|
|
791
|
+
link);
|
|
792
|
+
}
|
|
793
|
+
function countSources(entries) {
|
|
794
|
+
return new Set(entries.map((e) => e.source)).size;
|
|
795
|
+
}
|
|
796
|
+
// -- State/text helpers ----------------------------------------------------
|
|
797
|
+
function latestPendingDraft(state) {
|
|
798
|
+
if (!state || typeof state !== "object")
|
|
799
|
+
return null;
|
|
800
|
+
const stateRecord = state;
|
|
801
|
+
const data = stateRecord.data && typeof stateRecord.data === "object"
|
|
802
|
+
? stateRecord.data
|
|
803
|
+
: undefined;
|
|
804
|
+
const actionResults = Array.isArray(data?.actionResults)
|
|
805
|
+
? data.actionResults
|
|
806
|
+
: [];
|
|
807
|
+
// Check action results (newest first)
|
|
808
|
+
for (let i = actionResults.length - 1; i >= 0; i--) {
|
|
809
|
+
const draft = actionResults[i]?.data?.inboxDraft;
|
|
810
|
+
if (draft?.triageEntryId && draft?.draftText) {
|
|
811
|
+
return draft;
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
// Check recent messages
|
|
815
|
+
const recentMessagesData = stateRecord.recentMessagesData ?? stateRecord.recentMessages;
|
|
816
|
+
if (Array.isArray(recentMessagesData)) {
|
|
817
|
+
for (let i = recentMessagesData.length - 1; i >= 0; i--) {
|
|
818
|
+
const item = recentMessagesData[i];
|
|
819
|
+
if (!item)
|
|
820
|
+
continue;
|
|
821
|
+
const content = item.content;
|
|
822
|
+
if (!content)
|
|
823
|
+
continue;
|
|
824
|
+
const draft = content.inboxDraft ??
|
|
825
|
+
content.data?.inboxDraft;
|
|
826
|
+
if (draft?.triageEntryId && draft?.draftText) {
|
|
827
|
+
return draft;
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
return null;
|
|
832
|
+
}
|
|
833
|
+
function findBestMatch(entries, target) {
|
|
834
|
+
const lower = target.toLowerCase();
|
|
835
|
+
// Exact channel name match
|
|
836
|
+
const exact = entries.find((e) => e.channelName.toLowerCase() === lower);
|
|
837
|
+
if (exact)
|
|
838
|
+
return exact;
|
|
839
|
+
// Sender name match
|
|
840
|
+
const senderMatch = entries.find((e) => e.senderName?.toLowerCase().includes(lower));
|
|
841
|
+
if (senderMatch)
|
|
842
|
+
return senderMatch;
|
|
843
|
+
// Partial channel name match
|
|
844
|
+
const partial = entries.find((e) => e.channelName.toLowerCase().includes(lower));
|
|
845
|
+
if (partial)
|
|
846
|
+
return partial;
|
|
847
|
+
// Source match
|
|
848
|
+
const sourceMatch = entries.find((e) => e.source.toLowerCase() === lower);
|
|
849
|
+
if (sourceMatch)
|
|
850
|
+
return sourceMatch;
|
|
851
|
+
return null;
|
|
852
|
+
}
|
|
853
|
+
function extractText(message) {
|
|
854
|
+
const content = message.content;
|
|
855
|
+
return typeof content?.text === "string" ? content.text : "";
|
|
856
|
+
}
|