@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
|
@@ -0,0 +1,1088 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Media Provider Abstraction Layer
|
|
3
|
+
*
|
|
4
|
+
* Provides a unified interface for media generation across multiple providers:
|
|
5
|
+
* - Image Generation: FAL.ai, OpenAI (DALL-E), Google (Imagen), xAI, Eliza Cloud
|
|
6
|
+
* - Video Generation: FAL.ai, OpenAI (Sora), Google (Veo), Eliza Cloud
|
|
7
|
+
* - Audio Generation: Suno, ElevenLabs (SFX), Eliza Cloud
|
|
8
|
+
* - Vision (Analysis): OpenAI, Google, Anthropic, xAI, Eliza Cloud
|
|
9
|
+
*
|
|
10
|
+
* Follows the same pattern as TTS provider selection:
|
|
11
|
+
* - "cloud" mode uses Eliza Cloud (no API key needed)
|
|
12
|
+
* - "own-key" mode uses the user's own API keys
|
|
13
|
+
*/
|
|
14
|
+
// ============================================================================
|
|
15
|
+
// Fetch Utilities
|
|
16
|
+
// ============================================================================
|
|
17
|
+
/** Fetch with an AbortController-based timeout (default 30s). */
|
|
18
|
+
export function fetchWithTimeout(url, init, timeoutMs = 30_000) {
|
|
19
|
+
const controller = new AbortController();
|
|
20
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
21
|
+
return fetch(url, { ...init, signal: controller.signal }).finally(() => clearTimeout(timer));
|
|
22
|
+
}
|
|
23
|
+
async function withProviderErrorBoundary(providerName, run) {
|
|
24
|
+
try {
|
|
25
|
+
return await run();
|
|
26
|
+
}
|
|
27
|
+
catch (err) {
|
|
28
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
29
|
+
return {
|
|
30
|
+
success: false,
|
|
31
|
+
error: `[${providerName}] Network error: ${message}`,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
// ============================================================================
|
|
36
|
+
// Eliza Cloud Provider Implementations
|
|
37
|
+
// ============================================================================
|
|
38
|
+
class ElizaCloudImageProvider {
|
|
39
|
+
name = "eliza-cloud";
|
|
40
|
+
baseUrl;
|
|
41
|
+
apiKey;
|
|
42
|
+
constructor(baseUrl, apiKey) {
|
|
43
|
+
this.baseUrl = baseUrl;
|
|
44
|
+
this.apiKey = apiKey;
|
|
45
|
+
}
|
|
46
|
+
async generate(options) {
|
|
47
|
+
const response = await fetchWithTimeout(`${this.baseUrl}/media/image/generate`, {
|
|
48
|
+
method: "POST",
|
|
49
|
+
headers: {
|
|
50
|
+
"Content-Type": "application/json",
|
|
51
|
+
...(this.apiKey ? { Authorization: `Bearer ${this.apiKey}` } : {}),
|
|
52
|
+
},
|
|
53
|
+
body: JSON.stringify({
|
|
54
|
+
prompt: options.prompt,
|
|
55
|
+
size: options.size,
|
|
56
|
+
quality: options.quality,
|
|
57
|
+
style: options.style,
|
|
58
|
+
}),
|
|
59
|
+
});
|
|
60
|
+
if (!response.ok) {
|
|
61
|
+
const text = await response.text();
|
|
62
|
+
return { success: false, error: `Eliza Cloud error: ${text}` };
|
|
63
|
+
}
|
|
64
|
+
const data = (await response.json());
|
|
65
|
+
return {
|
|
66
|
+
success: true,
|
|
67
|
+
data: {
|
|
68
|
+
imageUrl: data.imageUrl,
|
|
69
|
+
imageBase64: data.imageBase64,
|
|
70
|
+
revisedPrompt: data.revisedPrompt,
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
class ElizaCloudVideoProvider {
|
|
76
|
+
name = "eliza-cloud";
|
|
77
|
+
baseUrl;
|
|
78
|
+
apiKey;
|
|
79
|
+
constructor(baseUrl, apiKey) {
|
|
80
|
+
this.baseUrl = baseUrl;
|
|
81
|
+
this.apiKey = apiKey;
|
|
82
|
+
}
|
|
83
|
+
async generate(options) {
|
|
84
|
+
const response = await fetchWithTimeout(`${this.baseUrl}/media/video/generate`, {
|
|
85
|
+
method: "POST",
|
|
86
|
+
headers: {
|
|
87
|
+
"Content-Type": "application/json",
|
|
88
|
+
...(this.apiKey ? { Authorization: `Bearer ${this.apiKey}` } : {}),
|
|
89
|
+
},
|
|
90
|
+
body: JSON.stringify({
|
|
91
|
+
prompt: options.prompt,
|
|
92
|
+
duration: options.duration,
|
|
93
|
+
aspectRatio: options.aspectRatio,
|
|
94
|
+
imageUrl: options.imageUrl,
|
|
95
|
+
}),
|
|
96
|
+
});
|
|
97
|
+
if (!response.ok) {
|
|
98
|
+
const text = await response.text();
|
|
99
|
+
return { success: false, error: `Eliza Cloud error: ${text}` };
|
|
100
|
+
}
|
|
101
|
+
const data = (await response.json());
|
|
102
|
+
return {
|
|
103
|
+
success: true,
|
|
104
|
+
data: {
|
|
105
|
+
videoUrl: data.videoUrl,
|
|
106
|
+
thumbnailUrl: data.thumbnailUrl,
|
|
107
|
+
duration: data.duration,
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
class ElizaCloudAudioProvider {
|
|
113
|
+
name = "eliza-cloud";
|
|
114
|
+
baseUrl;
|
|
115
|
+
apiKey;
|
|
116
|
+
constructor(baseUrl, apiKey) {
|
|
117
|
+
this.baseUrl = baseUrl;
|
|
118
|
+
this.apiKey = apiKey;
|
|
119
|
+
}
|
|
120
|
+
async generate(options) {
|
|
121
|
+
const response = await fetchWithTimeout(`${this.baseUrl}/media/audio/generate`, {
|
|
122
|
+
method: "POST",
|
|
123
|
+
headers: {
|
|
124
|
+
"Content-Type": "application/json",
|
|
125
|
+
...(this.apiKey ? { Authorization: `Bearer ${this.apiKey}` } : {}),
|
|
126
|
+
},
|
|
127
|
+
body: JSON.stringify({
|
|
128
|
+
prompt: options.prompt,
|
|
129
|
+
duration: options.duration,
|
|
130
|
+
instrumental: options.instrumental,
|
|
131
|
+
genre: options.genre,
|
|
132
|
+
}),
|
|
133
|
+
});
|
|
134
|
+
if (!response.ok) {
|
|
135
|
+
const text = await response.text();
|
|
136
|
+
return { success: false, error: `Eliza Cloud error: ${text}` };
|
|
137
|
+
}
|
|
138
|
+
const data = (await response.json());
|
|
139
|
+
return {
|
|
140
|
+
success: true,
|
|
141
|
+
data: {
|
|
142
|
+
audioUrl: data.audioUrl,
|
|
143
|
+
title: data.title,
|
|
144
|
+
duration: data.duration,
|
|
145
|
+
},
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
class ElizaCloudVisionProvider {
|
|
150
|
+
name = "eliza-cloud";
|
|
151
|
+
baseUrl;
|
|
152
|
+
apiKey;
|
|
153
|
+
constructor(baseUrl, apiKey) {
|
|
154
|
+
this.baseUrl = baseUrl;
|
|
155
|
+
this.apiKey = apiKey;
|
|
156
|
+
}
|
|
157
|
+
async analyze(options) {
|
|
158
|
+
const response = await fetchWithTimeout(`${this.baseUrl}/media/vision/analyze`, {
|
|
159
|
+
method: "POST",
|
|
160
|
+
headers: {
|
|
161
|
+
"Content-Type": "application/json",
|
|
162
|
+
...(this.apiKey ? { Authorization: `Bearer ${this.apiKey}` } : {}),
|
|
163
|
+
},
|
|
164
|
+
body: JSON.stringify({
|
|
165
|
+
imageUrl: options.imageUrl,
|
|
166
|
+
imageBase64: options.imageBase64,
|
|
167
|
+
prompt: options.prompt,
|
|
168
|
+
maxTokens: options.maxTokens,
|
|
169
|
+
}),
|
|
170
|
+
});
|
|
171
|
+
if (!response.ok) {
|
|
172
|
+
const text = await response.text();
|
|
173
|
+
return { success: false, error: `Eliza Cloud error: ${text}` };
|
|
174
|
+
}
|
|
175
|
+
const data = (await response.json());
|
|
176
|
+
return {
|
|
177
|
+
success: true,
|
|
178
|
+
data: {
|
|
179
|
+
description: data.description,
|
|
180
|
+
labels: data.labels,
|
|
181
|
+
confidence: data.confidence,
|
|
182
|
+
},
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
// ============================================================================
|
|
187
|
+
// FAL.ai Provider Implementations
|
|
188
|
+
// ============================================================================
|
|
189
|
+
export class FalImageProvider {
|
|
190
|
+
name = "fal";
|
|
191
|
+
apiKey;
|
|
192
|
+
model;
|
|
193
|
+
baseUrl;
|
|
194
|
+
constructor(config) {
|
|
195
|
+
if (!config.apiKey) {
|
|
196
|
+
throw new Error(`${this.name} API key is required`);
|
|
197
|
+
}
|
|
198
|
+
this.apiKey = config.apiKey;
|
|
199
|
+
this.model = config.model ?? "fal-ai/flux-pro";
|
|
200
|
+
this.baseUrl = config.baseUrl ?? "https://fal.run";
|
|
201
|
+
}
|
|
202
|
+
async generate(options) {
|
|
203
|
+
return withProviderErrorBoundary(this.name, async () => {
|
|
204
|
+
const response = await fetchWithTimeout(`${this.baseUrl}/${this.model}`, {
|
|
205
|
+
method: "POST",
|
|
206
|
+
headers: {
|
|
207
|
+
"Content-Type": "application/json",
|
|
208
|
+
Authorization: `Key ${this.apiKey}`,
|
|
209
|
+
},
|
|
210
|
+
body: JSON.stringify({
|
|
211
|
+
prompt: options.prompt,
|
|
212
|
+
image_size: options.size ?? "landscape_4_3",
|
|
213
|
+
num_images: 1,
|
|
214
|
+
...(options.negativePrompt
|
|
215
|
+
? { negative_prompt: options.negativePrompt }
|
|
216
|
+
: {}),
|
|
217
|
+
...(options.seed ? { seed: options.seed } : {}),
|
|
218
|
+
}),
|
|
219
|
+
});
|
|
220
|
+
if (!response.ok) {
|
|
221
|
+
const text = await response.text();
|
|
222
|
+
return { success: false, error: `FAL error: ${text}` };
|
|
223
|
+
}
|
|
224
|
+
const data = (await response.json());
|
|
225
|
+
const imageUrl = data.images?.[0]?.url;
|
|
226
|
+
if (!imageUrl) {
|
|
227
|
+
return { success: false, error: "No image returned from FAL" };
|
|
228
|
+
}
|
|
229
|
+
return {
|
|
230
|
+
success: true,
|
|
231
|
+
data: { imageUrl },
|
|
232
|
+
};
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
export class FalVideoProvider {
|
|
237
|
+
name = "fal";
|
|
238
|
+
apiKey;
|
|
239
|
+
model;
|
|
240
|
+
baseUrl;
|
|
241
|
+
constructor(config) {
|
|
242
|
+
if (!config.apiKey) {
|
|
243
|
+
throw new Error(`${this.name} API key is required`);
|
|
244
|
+
}
|
|
245
|
+
this.apiKey = config.apiKey;
|
|
246
|
+
this.model = config.model ?? "fal-ai/minimax-video";
|
|
247
|
+
this.baseUrl = config.baseUrl ?? "https://fal.run";
|
|
248
|
+
}
|
|
249
|
+
async generate(options) {
|
|
250
|
+
return withProviderErrorBoundary(this.name, async () => {
|
|
251
|
+
const response = await fetchWithTimeout(`${this.baseUrl}/${this.model}`, {
|
|
252
|
+
method: "POST",
|
|
253
|
+
headers: {
|
|
254
|
+
"Content-Type": "application/json",
|
|
255
|
+
Authorization: `Key ${this.apiKey}`,
|
|
256
|
+
},
|
|
257
|
+
body: JSON.stringify({
|
|
258
|
+
prompt: options.prompt,
|
|
259
|
+
...(options.duration ? { duration: options.duration } : {}),
|
|
260
|
+
...(options.aspectRatio ? { aspect_ratio: options.aspectRatio } : {}),
|
|
261
|
+
...(options.imageUrl ? { image_url: options.imageUrl } : {}),
|
|
262
|
+
}),
|
|
263
|
+
});
|
|
264
|
+
if (!response.ok) {
|
|
265
|
+
const text = await response.text();
|
|
266
|
+
return { success: false, error: `FAL error: ${text}` };
|
|
267
|
+
}
|
|
268
|
+
const data = (await response.json());
|
|
269
|
+
return {
|
|
270
|
+
success: true,
|
|
271
|
+
data: {
|
|
272
|
+
videoUrl: data.video?.url,
|
|
273
|
+
thumbnailUrl: data.thumbnail?.url,
|
|
274
|
+
duration: data.duration,
|
|
275
|
+
},
|
|
276
|
+
};
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
// ============================================================================
|
|
281
|
+
// OpenAI Provider Implementations
|
|
282
|
+
// ============================================================================
|
|
283
|
+
export class OpenAIImageProvider {
|
|
284
|
+
name = "openai";
|
|
285
|
+
apiKey;
|
|
286
|
+
model;
|
|
287
|
+
quality;
|
|
288
|
+
style;
|
|
289
|
+
constructor(config) {
|
|
290
|
+
if (!config.apiKey) {
|
|
291
|
+
throw new Error(`${this.name} API key is required`);
|
|
292
|
+
}
|
|
293
|
+
this.apiKey = config.apiKey;
|
|
294
|
+
this.model = config.model ?? "dall-e-3";
|
|
295
|
+
this.quality = config.quality ?? "standard";
|
|
296
|
+
this.style = config.style ?? "vivid";
|
|
297
|
+
}
|
|
298
|
+
async generate(options) {
|
|
299
|
+
return withProviderErrorBoundary(this.name, async () => {
|
|
300
|
+
const response = await fetchWithTimeout("https://api.openai.com/v1/images/generations", {
|
|
301
|
+
method: "POST",
|
|
302
|
+
headers: {
|
|
303
|
+
"Content-Type": "application/json",
|
|
304
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
305
|
+
},
|
|
306
|
+
body: JSON.stringify({
|
|
307
|
+
model: this.model,
|
|
308
|
+
prompt: options.prompt,
|
|
309
|
+
n: 1,
|
|
310
|
+
size: options.size ?? "1024x1024",
|
|
311
|
+
quality: options.quality ?? this.quality,
|
|
312
|
+
style: options.style ?? this.style,
|
|
313
|
+
}),
|
|
314
|
+
});
|
|
315
|
+
if (!response.ok) {
|
|
316
|
+
const text = await response.text();
|
|
317
|
+
return { success: false, error: `OpenAI error: ${text}` };
|
|
318
|
+
}
|
|
319
|
+
const data = (await response.json());
|
|
320
|
+
const image = data.data?.[0];
|
|
321
|
+
if (!image?.url) {
|
|
322
|
+
return { success: false, error: "No image returned from OpenAI" };
|
|
323
|
+
}
|
|
324
|
+
return {
|
|
325
|
+
success: true,
|
|
326
|
+
data: {
|
|
327
|
+
imageUrl: image.url,
|
|
328
|
+
revisedPrompt: image.revised_prompt,
|
|
329
|
+
},
|
|
330
|
+
};
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
export class OpenAIVideoProvider {
|
|
335
|
+
name = "openai";
|
|
336
|
+
apiKey;
|
|
337
|
+
model;
|
|
338
|
+
constructor(config) {
|
|
339
|
+
if (!config.apiKey) {
|
|
340
|
+
throw new Error(`${this.name} API key is required`);
|
|
341
|
+
}
|
|
342
|
+
this.apiKey = config.apiKey;
|
|
343
|
+
this.model = config.model ?? "sora-1.0-turbo";
|
|
344
|
+
}
|
|
345
|
+
async generate(options) {
|
|
346
|
+
return withProviderErrorBoundary(this.name, async () => {
|
|
347
|
+
// OpenAI Sora API (video generation)
|
|
348
|
+
const response = await fetchWithTimeout("https://api.openai.com/v1/videos/generations", {
|
|
349
|
+
method: "POST",
|
|
350
|
+
headers: {
|
|
351
|
+
"Content-Type": "application/json",
|
|
352
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
353
|
+
},
|
|
354
|
+
body: JSON.stringify({
|
|
355
|
+
model: this.model,
|
|
356
|
+
prompt: options.prompt,
|
|
357
|
+
n: 1,
|
|
358
|
+
duration: options.duration ?? 5,
|
|
359
|
+
aspect_ratio: options.aspectRatio ?? "16:9",
|
|
360
|
+
...(options.imageUrl ? { image: options.imageUrl } : {}),
|
|
361
|
+
}),
|
|
362
|
+
});
|
|
363
|
+
if (!response.ok) {
|
|
364
|
+
const text = await response.text();
|
|
365
|
+
return { success: false, error: `OpenAI Sora error: ${text}` };
|
|
366
|
+
}
|
|
367
|
+
const data = (await response.json());
|
|
368
|
+
const video = data.data?.[0];
|
|
369
|
+
if (!video?.url) {
|
|
370
|
+
return { success: false, error: "No video returned from OpenAI Sora" };
|
|
371
|
+
}
|
|
372
|
+
return {
|
|
373
|
+
success: true,
|
|
374
|
+
data: {
|
|
375
|
+
videoUrl: video.url,
|
|
376
|
+
duration: video.duration,
|
|
377
|
+
},
|
|
378
|
+
};
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
export class OpenAIVisionProvider {
|
|
383
|
+
name = "openai";
|
|
384
|
+
apiKey;
|
|
385
|
+
model;
|
|
386
|
+
maxTokens;
|
|
387
|
+
constructor(config) {
|
|
388
|
+
if (!config.apiKey) {
|
|
389
|
+
throw new Error(`${this.name} API key is required`);
|
|
390
|
+
}
|
|
391
|
+
this.apiKey = config.apiKey;
|
|
392
|
+
this.model = config.model ?? "gpt-4o";
|
|
393
|
+
this.maxTokens = config.maxTokens ?? 1024;
|
|
394
|
+
}
|
|
395
|
+
async analyze(options) {
|
|
396
|
+
const imageContent = options.imageBase64
|
|
397
|
+
? {
|
|
398
|
+
type: "image_url",
|
|
399
|
+
image_url: { url: `data:image/jpeg;base64,${options.imageBase64}` },
|
|
400
|
+
}
|
|
401
|
+
: {
|
|
402
|
+
type: "image_url",
|
|
403
|
+
image_url: { url: options.imageUrl ?? "" },
|
|
404
|
+
};
|
|
405
|
+
return withProviderErrorBoundary(this.name, async () => {
|
|
406
|
+
const response = await fetchWithTimeout("https://api.openai.com/v1/chat/completions", {
|
|
407
|
+
method: "POST",
|
|
408
|
+
headers: {
|
|
409
|
+
"Content-Type": "application/json",
|
|
410
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
411
|
+
},
|
|
412
|
+
body: JSON.stringify({
|
|
413
|
+
model: this.model,
|
|
414
|
+
max_tokens: options.maxTokens ?? this.maxTokens,
|
|
415
|
+
messages: [
|
|
416
|
+
{
|
|
417
|
+
role: "user",
|
|
418
|
+
content: [
|
|
419
|
+
{
|
|
420
|
+
type: "text",
|
|
421
|
+
text: options.prompt ?? "Describe this image in detail.",
|
|
422
|
+
},
|
|
423
|
+
imageContent,
|
|
424
|
+
],
|
|
425
|
+
},
|
|
426
|
+
],
|
|
427
|
+
}),
|
|
428
|
+
});
|
|
429
|
+
if (!response.ok) {
|
|
430
|
+
const text = await response.text();
|
|
431
|
+
return { success: false, error: `OpenAI error: ${text}` };
|
|
432
|
+
}
|
|
433
|
+
const data = (await response.json());
|
|
434
|
+
const description = data.choices?.[0]?.message?.content;
|
|
435
|
+
if (!description) {
|
|
436
|
+
return {
|
|
437
|
+
success: false,
|
|
438
|
+
error: "No description returned from OpenAI",
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
return {
|
|
442
|
+
success: true,
|
|
443
|
+
data: { description },
|
|
444
|
+
};
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
// ============================================================================
|
|
449
|
+
// Google Provider Implementations
|
|
450
|
+
// ============================================================================
|
|
451
|
+
export class GoogleImageProvider {
|
|
452
|
+
name = "google";
|
|
453
|
+
apiKey;
|
|
454
|
+
model;
|
|
455
|
+
aspectRatio;
|
|
456
|
+
constructor(config) {
|
|
457
|
+
if (!config.apiKey) {
|
|
458
|
+
throw new Error(`${this.name} API key is required`);
|
|
459
|
+
}
|
|
460
|
+
this.apiKey = config.apiKey;
|
|
461
|
+
this.model = config.model ?? "imagen-3.0-generate-002";
|
|
462
|
+
this.aspectRatio = config.aspectRatio ?? "1:1";
|
|
463
|
+
}
|
|
464
|
+
async generate(options) {
|
|
465
|
+
return withProviderErrorBoundary(this.name, async () => {
|
|
466
|
+
const response = await fetchWithTimeout(`https://generativelanguage.googleapis.com/v1beta/models/${this.model}:predict`, {
|
|
467
|
+
method: "POST",
|
|
468
|
+
headers: {
|
|
469
|
+
"Content-Type": "application/json",
|
|
470
|
+
"x-goog-api-key": this.apiKey,
|
|
471
|
+
},
|
|
472
|
+
body: JSON.stringify({
|
|
473
|
+
instances: [{ prompt: options.prompt }],
|
|
474
|
+
parameters: {
|
|
475
|
+
sampleCount: 1,
|
|
476
|
+
aspectRatio: options.size ?? this.aspectRatio,
|
|
477
|
+
personGeneration: "allow_adult",
|
|
478
|
+
safetyFilterLevel: "block_few",
|
|
479
|
+
},
|
|
480
|
+
}),
|
|
481
|
+
});
|
|
482
|
+
if (!response.ok) {
|
|
483
|
+
const text = await response.text();
|
|
484
|
+
return { success: false, error: `Google Imagen error: ${text}` };
|
|
485
|
+
}
|
|
486
|
+
const data = (await response.json());
|
|
487
|
+
const imageData = data.predictions?.[0]?.bytesBase64Encoded;
|
|
488
|
+
if (!imageData) {
|
|
489
|
+
return {
|
|
490
|
+
success: false,
|
|
491
|
+
error: "No image returned from Google Imagen",
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
return {
|
|
495
|
+
success: true,
|
|
496
|
+
data: {
|
|
497
|
+
imageBase64: imageData,
|
|
498
|
+
},
|
|
499
|
+
};
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
export class GoogleVideoProvider {
|
|
504
|
+
name = "google";
|
|
505
|
+
apiKey;
|
|
506
|
+
model;
|
|
507
|
+
constructor(config) {
|
|
508
|
+
if (!config.apiKey) {
|
|
509
|
+
throw new Error(`${this.name} API key is required`);
|
|
510
|
+
}
|
|
511
|
+
this.apiKey = config.apiKey;
|
|
512
|
+
this.model = config.model ?? "veo-2.0-generate-001";
|
|
513
|
+
}
|
|
514
|
+
async generate(options) {
|
|
515
|
+
return withProviderErrorBoundary(this.name, async () => {
|
|
516
|
+
// Google Veo uses a different endpoint structure
|
|
517
|
+
const response = await fetchWithTimeout(`https://generativelanguage.googleapis.com/v1beta/models/${this.model}:predictLongRunning`, {
|
|
518
|
+
method: "POST",
|
|
519
|
+
headers: {
|
|
520
|
+
"Content-Type": "application/json",
|
|
521
|
+
"x-goog-api-key": this.apiKey,
|
|
522
|
+
},
|
|
523
|
+
body: JSON.stringify({
|
|
524
|
+
instances: [
|
|
525
|
+
{
|
|
526
|
+
prompt: options.prompt,
|
|
527
|
+
...(options.imageUrl
|
|
528
|
+
? { image: { gcsUri: options.imageUrl } }
|
|
529
|
+
: {}),
|
|
530
|
+
},
|
|
531
|
+
],
|
|
532
|
+
parameters: {
|
|
533
|
+
aspectRatio: options.aspectRatio ?? "16:9",
|
|
534
|
+
durationSeconds: options.duration ?? 5,
|
|
535
|
+
personGeneration: "allow_adult",
|
|
536
|
+
},
|
|
537
|
+
}),
|
|
538
|
+
});
|
|
539
|
+
if (!response.ok) {
|
|
540
|
+
const text = await response.text();
|
|
541
|
+
return { success: false, error: `Google Veo error: ${text}` };
|
|
542
|
+
}
|
|
543
|
+
// Veo returns a long-running operation - for now we return the operation name
|
|
544
|
+
// In production, you'd poll the operation until it completes
|
|
545
|
+
const data = (await response.json());
|
|
546
|
+
if (data.done && data.response?.predictions?.[0]?.videoUri) {
|
|
547
|
+
return {
|
|
548
|
+
success: true,
|
|
549
|
+
data: {
|
|
550
|
+
videoUrl: data.response.predictions[0].videoUri,
|
|
551
|
+
},
|
|
552
|
+
};
|
|
553
|
+
}
|
|
554
|
+
// Operation started but not complete - return operation reference
|
|
555
|
+
// Client should poll the operation endpoint
|
|
556
|
+
return {
|
|
557
|
+
success: true,
|
|
558
|
+
data: {
|
|
559
|
+
videoUrl: `pending:${data.name}`,
|
|
560
|
+
},
|
|
561
|
+
};
|
|
562
|
+
});
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
export class GoogleVisionProvider {
|
|
566
|
+
name = "google";
|
|
567
|
+
apiKey;
|
|
568
|
+
model;
|
|
569
|
+
constructor(config) {
|
|
570
|
+
if (!config.apiKey) {
|
|
571
|
+
throw new Error(`${this.name} API key is required`);
|
|
572
|
+
}
|
|
573
|
+
this.apiKey = config.apiKey;
|
|
574
|
+
this.model = config.model ?? "gemini-2.0-flash";
|
|
575
|
+
}
|
|
576
|
+
async analyze(options) {
|
|
577
|
+
const imagePart = options.imageBase64
|
|
578
|
+
? { inline_data: { mime_type: "image/jpeg", data: options.imageBase64 } }
|
|
579
|
+
: { file_data: { file_uri: options.imageUrl, mime_type: "image/jpeg" } };
|
|
580
|
+
return withProviderErrorBoundary(this.name, async () => {
|
|
581
|
+
const response = await fetchWithTimeout(`https://generativelanguage.googleapis.com/v1beta/models/${this.model}:generateContent`, {
|
|
582
|
+
method: "POST",
|
|
583
|
+
headers: {
|
|
584
|
+
"Content-Type": "application/json",
|
|
585
|
+
"x-goog-api-key": this.apiKey,
|
|
586
|
+
},
|
|
587
|
+
body: JSON.stringify({
|
|
588
|
+
contents: [
|
|
589
|
+
{
|
|
590
|
+
parts: [
|
|
591
|
+
{ text: options.prompt ?? "Describe this image in detail." },
|
|
592
|
+
imagePart,
|
|
593
|
+
],
|
|
594
|
+
},
|
|
595
|
+
],
|
|
596
|
+
}),
|
|
597
|
+
});
|
|
598
|
+
if (!response.ok) {
|
|
599
|
+
const text = await response.text();
|
|
600
|
+
return { success: false, error: `Google error: ${text}` };
|
|
601
|
+
}
|
|
602
|
+
const data = (await response.json());
|
|
603
|
+
const description = data.candidates?.[0]?.content?.parts?.[0]?.text;
|
|
604
|
+
if (!description) {
|
|
605
|
+
return {
|
|
606
|
+
success: false,
|
|
607
|
+
error: "No description returned from Google",
|
|
608
|
+
};
|
|
609
|
+
}
|
|
610
|
+
return {
|
|
611
|
+
success: true,
|
|
612
|
+
data: { description },
|
|
613
|
+
};
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
// ============================================================================
|
|
618
|
+
// xAI Provider Implementations
|
|
619
|
+
// ============================================================================
|
|
620
|
+
export class XAIImageProvider {
|
|
621
|
+
name = "xai";
|
|
622
|
+
apiKey;
|
|
623
|
+
model;
|
|
624
|
+
constructor(config) {
|
|
625
|
+
if (!config.apiKey) {
|
|
626
|
+
throw new Error(`${this.name} API key is required`);
|
|
627
|
+
}
|
|
628
|
+
this.apiKey = config.apiKey;
|
|
629
|
+
this.model = config.model ?? "grok-2-image";
|
|
630
|
+
}
|
|
631
|
+
async generate(options) {
|
|
632
|
+
return withProviderErrorBoundary(this.name, async () => {
|
|
633
|
+
// xAI uses OpenAI-compatible API format for image generation
|
|
634
|
+
const response = await fetchWithTimeout("https://api.x.ai/v1/images/generations", {
|
|
635
|
+
method: "POST",
|
|
636
|
+
headers: {
|
|
637
|
+
"Content-Type": "application/json",
|
|
638
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
639
|
+
},
|
|
640
|
+
body: JSON.stringify({
|
|
641
|
+
model: this.model,
|
|
642
|
+
prompt: options.prompt,
|
|
643
|
+
n: 1,
|
|
644
|
+
size: options.size ?? "1024x1024",
|
|
645
|
+
response_format: "url",
|
|
646
|
+
}),
|
|
647
|
+
});
|
|
648
|
+
if (!response.ok) {
|
|
649
|
+
const text = await response.text();
|
|
650
|
+
return { success: false, error: `xAI error: ${text}` };
|
|
651
|
+
}
|
|
652
|
+
const data = (await response.json());
|
|
653
|
+
const image = data.data?.[0];
|
|
654
|
+
if (!image?.url) {
|
|
655
|
+
return { success: false, error: "No image returned from xAI" };
|
|
656
|
+
}
|
|
657
|
+
return {
|
|
658
|
+
success: true,
|
|
659
|
+
data: {
|
|
660
|
+
imageUrl: image.url,
|
|
661
|
+
revisedPrompt: image.revised_prompt,
|
|
662
|
+
},
|
|
663
|
+
};
|
|
664
|
+
});
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
export class XAIVisionProvider {
|
|
668
|
+
name = "xai";
|
|
669
|
+
apiKey;
|
|
670
|
+
model;
|
|
671
|
+
constructor(config) {
|
|
672
|
+
if (!config.apiKey) {
|
|
673
|
+
throw new Error(`${this.name} API key is required`);
|
|
674
|
+
}
|
|
675
|
+
this.apiKey = config.apiKey;
|
|
676
|
+
this.model = config.model ?? "grok-2-vision-1212";
|
|
677
|
+
}
|
|
678
|
+
async analyze(options) {
|
|
679
|
+
// xAI uses OpenAI-compatible API format
|
|
680
|
+
const imageContent = options.imageBase64
|
|
681
|
+
? {
|
|
682
|
+
type: "image_url",
|
|
683
|
+
image_url: { url: `data:image/jpeg;base64,${options.imageBase64}` },
|
|
684
|
+
}
|
|
685
|
+
: {
|
|
686
|
+
type: "image_url",
|
|
687
|
+
image_url: { url: options.imageUrl ?? "" },
|
|
688
|
+
};
|
|
689
|
+
return withProviderErrorBoundary(this.name, async () => {
|
|
690
|
+
const response = await fetchWithTimeout("https://api.x.ai/v1/chat/completions", {
|
|
691
|
+
method: "POST",
|
|
692
|
+
headers: {
|
|
693
|
+
"Content-Type": "application/json",
|
|
694
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
695
|
+
},
|
|
696
|
+
body: JSON.stringify({
|
|
697
|
+
model: this.model,
|
|
698
|
+
max_tokens: options.maxTokens ?? 1024,
|
|
699
|
+
messages: [
|
|
700
|
+
{
|
|
701
|
+
role: "user",
|
|
702
|
+
content: [
|
|
703
|
+
{
|
|
704
|
+
type: "text",
|
|
705
|
+
text: options.prompt ?? "Describe this image in detail.",
|
|
706
|
+
},
|
|
707
|
+
imageContent,
|
|
708
|
+
],
|
|
709
|
+
},
|
|
710
|
+
],
|
|
711
|
+
}),
|
|
712
|
+
});
|
|
713
|
+
if (!response.ok) {
|
|
714
|
+
const text = await response.text();
|
|
715
|
+
return { success: false, error: `xAI error: ${text}` };
|
|
716
|
+
}
|
|
717
|
+
const data = (await response.json());
|
|
718
|
+
const description = data.choices?.[0]?.message?.content;
|
|
719
|
+
if (!description) {
|
|
720
|
+
return { success: false, error: "No description returned from xAI" };
|
|
721
|
+
}
|
|
722
|
+
return {
|
|
723
|
+
success: true,
|
|
724
|
+
data: { description },
|
|
725
|
+
};
|
|
726
|
+
});
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
// ============================================================================
|
|
730
|
+
// Anthropic Provider Implementation
|
|
731
|
+
// ============================================================================
|
|
732
|
+
// ============================================================================
|
|
733
|
+
// Ollama Provider Implementation (Local Vision)
|
|
734
|
+
// ============================================================================
|
|
735
|
+
class OllamaVisionProvider {
|
|
736
|
+
name = "ollama";
|
|
737
|
+
baseUrl;
|
|
738
|
+
model;
|
|
739
|
+
maxTokens;
|
|
740
|
+
autoDownload;
|
|
741
|
+
modelChecked = false;
|
|
742
|
+
constructor(config) {
|
|
743
|
+
this.baseUrl = config.baseUrl ?? "http://localhost:11434";
|
|
744
|
+
this.model = config.model ?? "llava";
|
|
745
|
+
this.maxTokens = config.maxTokens ?? 1024;
|
|
746
|
+
this.autoDownload = config.autoDownload ?? true;
|
|
747
|
+
}
|
|
748
|
+
async ensureModelAvailable() {
|
|
749
|
+
if (this.modelChecked)
|
|
750
|
+
return;
|
|
751
|
+
try {
|
|
752
|
+
// Check if model exists
|
|
753
|
+
const response = await fetchWithTimeout(`${this.baseUrl}/api/tags`, {}, 120_000);
|
|
754
|
+
if (!response.ok) {
|
|
755
|
+
throw new Error(`Ollama server not reachable: ${response.statusText}`);
|
|
756
|
+
}
|
|
757
|
+
const data = (await response.json());
|
|
758
|
+
const models = data.models ?? [];
|
|
759
|
+
const hasModel = models.some((m) => m.name === this.model || m.name.startsWith(`${this.model}:`));
|
|
760
|
+
if (!hasModel && this.autoDownload) {
|
|
761
|
+
console.log(`[ollama-vision] Model ${this.model} not found, downloading...`);
|
|
762
|
+
await this.downloadModel();
|
|
763
|
+
}
|
|
764
|
+
else if (!hasModel) {
|
|
765
|
+
throw new Error(`Ollama model ${this.model} not found. Run 'ollama pull ${this.model}' or enable autoDownload.`);
|
|
766
|
+
}
|
|
767
|
+
this.modelChecked = true;
|
|
768
|
+
}
|
|
769
|
+
catch (err) {
|
|
770
|
+
if (err instanceof Error &&
|
|
771
|
+
err.message.includes("Ollama server not reachable")) {
|
|
772
|
+
throw err;
|
|
773
|
+
}
|
|
774
|
+
throw new Error(`Failed to check Ollama models: ${err instanceof Error ? err.message : String(err)}`);
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
async downloadModel() {
|
|
778
|
+
const response = await fetchWithTimeout(`${this.baseUrl}/api/pull`, {
|
|
779
|
+
method: "POST",
|
|
780
|
+
headers: { "Content-Type": "application/json" },
|
|
781
|
+
body: JSON.stringify({ name: this.model, stream: false }),
|
|
782
|
+
}, 300_000);
|
|
783
|
+
if (!response.ok) {
|
|
784
|
+
const text = await response.text();
|
|
785
|
+
throw new Error(`Failed to download model ${this.model}: ${text}`);
|
|
786
|
+
}
|
|
787
|
+
// Wait for download to complete (non-streaming mode)
|
|
788
|
+
await response.json();
|
|
789
|
+
console.log(`[ollama-vision] Model ${this.model} downloaded successfully`);
|
|
790
|
+
}
|
|
791
|
+
async analyze(options) {
|
|
792
|
+
try {
|
|
793
|
+
await this.ensureModelAvailable();
|
|
794
|
+
}
|
|
795
|
+
catch (err) {
|
|
796
|
+
return {
|
|
797
|
+
success: false,
|
|
798
|
+
error: `Ollama setup failed: ${err instanceof Error ? err.message : String(err)}`,
|
|
799
|
+
};
|
|
800
|
+
}
|
|
801
|
+
// Ollama uses a different format for vision - images must be base64
|
|
802
|
+
let imageData = options.imageBase64;
|
|
803
|
+
if (!imageData && options.imageUrl) {
|
|
804
|
+
// Fetch the image and convert to base64
|
|
805
|
+
try {
|
|
806
|
+
const imageResponse = await fetchWithTimeout(options.imageUrl, {}, 120_000);
|
|
807
|
+
if (!imageResponse.ok) {
|
|
808
|
+
return {
|
|
809
|
+
success: false,
|
|
810
|
+
error: `Failed to fetch image: ${imageResponse.statusText}`,
|
|
811
|
+
};
|
|
812
|
+
}
|
|
813
|
+
const buffer = await imageResponse.arrayBuffer();
|
|
814
|
+
imageData = Buffer.from(buffer).toString("base64");
|
|
815
|
+
}
|
|
816
|
+
catch (err) {
|
|
817
|
+
return {
|
|
818
|
+
success: false,
|
|
819
|
+
error: `Failed to fetch image: ${err instanceof Error ? err.message : String(err)}`,
|
|
820
|
+
};
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
if (!imageData) {
|
|
824
|
+
return {
|
|
825
|
+
success: false,
|
|
826
|
+
error: "No image provided (imageUrl or imageBase64 required)",
|
|
827
|
+
};
|
|
828
|
+
}
|
|
829
|
+
return withProviderErrorBoundary(this.name, async () => {
|
|
830
|
+
const response = await fetchWithTimeout(`${this.baseUrl}/api/chat`, {
|
|
831
|
+
method: "POST",
|
|
832
|
+
headers: { "Content-Type": "application/json" },
|
|
833
|
+
body: JSON.stringify({
|
|
834
|
+
model: this.model,
|
|
835
|
+
messages: [
|
|
836
|
+
{
|
|
837
|
+
role: "user",
|
|
838
|
+
content: options.prompt ?? "Describe this image in detail.",
|
|
839
|
+
images: [imageData],
|
|
840
|
+
},
|
|
841
|
+
],
|
|
842
|
+
stream: false,
|
|
843
|
+
options: {
|
|
844
|
+
num_predict: this.maxTokens,
|
|
845
|
+
},
|
|
846
|
+
}),
|
|
847
|
+
}, 120_000);
|
|
848
|
+
if (!response.ok) {
|
|
849
|
+
const text = await response.text();
|
|
850
|
+
return { success: false, error: `Ollama error: ${text}` };
|
|
851
|
+
}
|
|
852
|
+
const data = (await response.json());
|
|
853
|
+
const description = data.message?.content;
|
|
854
|
+
if (!description) {
|
|
855
|
+
return { success: false, error: "No description returned from Ollama" };
|
|
856
|
+
}
|
|
857
|
+
return {
|
|
858
|
+
success: true,
|
|
859
|
+
data: { description },
|
|
860
|
+
};
|
|
861
|
+
});
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
// ============================================================================
|
|
865
|
+
// Anthropic Provider Implementation
|
|
866
|
+
// ============================================================================
|
|
867
|
+
export class AnthropicVisionProvider {
|
|
868
|
+
name = "anthropic";
|
|
869
|
+
apiKey;
|
|
870
|
+
model;
|
|
871
|
+
constructor(config) {
|
|
872
|
+
if (!config.apiKey) {
|
|
873
|
+
throw new Error(`${this.name} API key is required`);
|
|
874
|
+
}
|
|
875
|
+
this.apiKey = config.apiKey;
|
|
876
|
+
this.model = config.model ?? "claude-sonnet-4-20250514";
|
|
877
|
+
}
|
|
878
|
+
async analyze(options) {
|
|
879
|
+
const imageSource = options.imageBase64
|
|
880
|
+
? {
|
|
881
|
+
type: "base64",
|
|
882
|
+
media_type: "image/jpeg",
|
|
883
|
+
data: options.imageBase64,
|
|
884
|
+
}
|
|
885
|
+
: { type: "url", url: options.imageUrl ?? "" };
|
|
886
|
+
return withProviderErrorBoundary(this.name, async () => {
|
|
887
|
+
const response = await fetchWithTimeout("https://api.anthropic.com/v1/messages", {
|
|
888
|
+
method: "POST",
|
|
889
|
+
headers: {
|
|
890
|
+
"Content-Type": "application/json",
|
|
891
|
+
"x-api-key": this.apiKey,
|
|
892
|
+
"anthropic-version": "2023-06-01",
|
|
893
|
+
},
|
|
894
|
+
body: JSON.stringify({
|
|
895
|
+
model: this.model,
|
|
896
|
+
max_tokens: options.maxTokens ?? 1024,
|
|
897
|
+
messages: [
|
|
898
|
+
{
|
|
899
|
+
role: "user",
|
|
900
|
+
content: [
|
|
901
|
+
{ type: "image", source: imageSource },
|
|
902
|
+
{
|
|
903
|
+
type: "text",
|
|
904
|
+
text: options.prompt ?? "Describe this image in detail.",
|
|
905
|
+
},
|
|
906
|
+
],
|
|
907
|
+
},
|
|
908
|
+
],
|
|
909
|
+
}),
|
|
910
|
+
});
|
|
911
|
+
if (!response.ok) {
|
|
912
|
+
const text = await response.text();
|
|
913
|
+
return { success: false, error: `Anthropic error: ${text}` };
|
|
914
|
+
}
|
|
915
|
+
const data = (await response.json());
|
|
916
|
+
const textBlock = data.content?.find((c) => c.type === "text");
|
|
917
|
+
if (!textBlock?.text) {
|
|
918
|
+
return {
|
|
919
|
+
success: false,
|
|
920
|
+
error: "No description returned from Anthropic",
|
|
921
|
+
};
|
|
922
|
+
}
|
|
923
|
+
return {
|
|
924
|
+
success: true,
|
|
925
|
+
data: { description: textBlock.text },
|
|
926
|
+
};
|
|
927
|
+
});
|
|
928
|
+
}
|
|
929
|
+
}
|
|
930
|
+
// ============================================================================
|
|
931
|
+
// Suno Provider Implementation
|
|
932
|
+
// ============================================================================
|
|
933
|
+
export class SunoAudioProvider {
|
|
934
|
+
name = "suno";
|
|
935
|
+
apiKey;
|
|
936
|
+
model;
|
|
937
|
+
baseUrl;
|
|
938
|
+
constructor(config) {
|
|
939
|
+
if (!config.apiKey) {
|
|
940
|
+
throw new Error(`${this.name} API key is required`);
|
|
941
|
+
}
|
|
942
|
+
this.apiKey = config.apiKey;
|
|
943
|
+
this.model = config.model ?? "chirp-v3.5";
|
|
944
|
+
this.baseUrl = config.baseUrl ?? "https://api.suno.ai/v1";
|
|
945
|
+
}
|
|
946
|
+
async generate(options) {
|
|
947
|
+
return withProviderErrorBoundary(this.name, async () => {
|
|
948
|
+
const response = await fetchWithTimeout(`${this.baseUrl}/generate`, {
|
|
949
|
+
method: "POST",
|
|
950
|
+
headers: {
|
|
951
|
+
"Content-Type": "application/json",
|
|
952
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
953
|
+
},
|
|
954
|
+
body: JSON.stringify({
|
|
955
|
+
prompt: options.prompt,
|
|
956
|
+
model: this.model,
|
|
957
|
+
duration: options.duration,
|
|
958
|
+
instrumental: options.instrumental,
|
|
959
|
+
genre: options.genre,
|
|
960
|
+
}),
|
|
961
|
+
});
|
|
962
|
+
if (!response.ok) {
|
|
963
|
+
const text = await response.text();
|
|
964
|
+
return { success: false, error: `Suno error: ${text}` };
|
|
965
|
+
}
|
|
966
|
+
const data = (await response.json());
|
|
967
|
+
return {
|
|
968
|
+
success: true,
|
|
969
|
+
data: {
|
|
970
|
+
audioUrl: data.audio_url,
|
|
971
|
+
title: data.title,
|
|
972
|
+
duration: data.duration,
|
|
973
|
+
},
|
|
974
|
+
};
|
|
975
|
+
});
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
export function createImageProvider(config, options) {
|
|
979
|
+
const mode = config?.mode ?? (options.cloudMediaDisabled ? "local" : "cloud");
|
|
980
|
+
const provider = mode === "cloud" ? "cloud" : (config?.provider ?? "cloud");
|
|
981
|
+
switch (provider) {
|
|
982
|
+
case "fal":
|
|
983
|
+
if (config?.fal?.apiKey) {
|
|
984
|
+
return new FalImageProvider(config.fal);
|
|
985
|
+
}
|
|
986
|
+
break;
|
|
987
|
+
case "openai":
|
|
988
|
+
if (config?.openai?.apiKey) {
|
|
989
|
+
return new OpenAIImageProvider(config.openai);
|
|
990
|
+
}
|
|
991
|
+
break;
|
|
992
|
+
case "google":
|
|
993
|
+
if (config?.google?.apiKey) {
|
|
994
|
+
return new GoogleImageProvider(config.google);
|
|
995
|
+
}
|
|
996
|
+
break;
|
|
997
|
+
case "xai":
|
|
998
|
+
if (config?.xai?.apiKey) {
|
|
999
|
+
return new XAIImageProvider(config.xai);
|
|
1000
|
+
}
|
|
1001
|
+
break;
|
|
1002
|
+
}
|
|
1003
|
+
if (options.cloudMediaDisabled) {
|
|
1004
|
+
throw new Error("No image provider configured and cloud media is disabled. " +
|
|
1005
|
+
"Configure a direct provider (fal, openai, google, xai) or enable cloud media.");
|
|
1006
|
+
}
|
|
1007
|
+
return new ElizaCloudImageProvider(options.elizaCloudBaseUrl ?? "https://elizacloud.ai/api/v1", options.elizaCloudApiKey);
|
|
1008
|
+
}
|
|
1009
|
+
export function createVideoProvider(config, options) {
|
|
1010
|
+
const mode = config?.mode ?? (options.cloudMediaDisabled ? "local" : "cloud");
|
|
1011
|
+
const provider = mode === "cloud" ? "cloud" : (config?.provider ?? "cloud");
|
|
1012
|
+
switch (provider) {
|
|
1013
|
+
case "fal":
|
|
1014
|
+
if (config?.fal?.apiKey) {
|
|
1015
|
+
return new FalVideoProvider(config.fal);
|
|
1016
|
+
}
|
|
1017
|
+
break;
|
|
1018
|
+
case "openai":
|
|
1019
|
+
if (config?.openai?.apiKey) {
|
|
1020
|
+
return new OpenAIVideoProvider(config.openai);
|
|
1021
|
+
}
|
|
1022
|
+
break;
|
|
1023
|
+
case "google":
|
|
1024
|
+
if (config?.google?.apiKey) {
|
|
1025
|
+
return new GoogleVideoProvider(config.google);
|
|
1026
|
+
}
|
|
1027
|
+
break;
|
|
1028
|
+
}
|
|
1029
|
+
if (options.cloudMediaDisabled) {
|
|
1030
|
+
throw new Error("No video provider configured and cloud media is disabled. " +
|
|
1031
|
+
"Configure a direct provider (fal, openai, google) or enable cloud media.");
|
|
1032
|
+
}
|
|
1033
|
+
return new ElizaCloudVideoProvider(options.elizaCloudBaseUrl ?? "https://elizacloud.ai/api/v1", options.elizaCloudApiKey);
|
|
1034
|
+
}
|
|
1035
|
+
export function createAudioProvider(config, options) {
|
|
1036
|
+
const mode = config?.mode ?? (options.cloudMediaDisabled ? "local" : "cloud");
|
|
1037
|
+
const provider = mode === "cloud" ? "cloud" : (config?.provider ?? "cloud");
|
|
1038
|
+
if (provider === "suno" && config?.suno?.apiKey) {
|
|
1039
|
+
return new SunoAudioProvider(config.suno);
|
|
1040
|
+
}
|
|
1041
|
+
if (options.cloudMediaDisabled) {
|
|
1042
|
+
throw new Error("No audio provider configured and cloud media is disabled. " +
|
|
1043
|
+
"Configure a direct provider (suno) or enable cloud media.");
|
|
1044
|
+
}
|
|
1045
|
+
return new ElizaCloudAudioProvider(options.elizaCloudBaseUrl ?? "https://elizacloud.ai/api/v1", options.elizaCloudApiKey);
|
|
1046
|
+
}
|
|
1047
|
+
export function createVisionProvider(config, options) {
|
|
1048
|
+
const mode = config?.mode ?? (options.cloudMediaDisabled ? "local" : "cloud");
|
|
1049
|
+
const provider = mode === "cloud" ? "cloud" : (config?.provider ?? "cloud");
|
|
1050
|
+
switch (provider) {
|
|
1051
|
+
case "openai":
|
|
1052
|
+
if (config?.openai?.apiKey) {
|
|
1053
|
+
return new OpenAIVisionProvider(config.openai);
|
|
1054
|
+
}
|
|
1055
|
+
break;
|
|
1056
|
+
case "google":
|
|
1057
|
+
if (config?.google?.apiKey) {
|
|
1058
|
+
return new GoogleVisionProvider(config.google);
|
|
1059
|
+
}
|
|
1060
|
+
break;
|
|
1061
|
+
case "anthropic":
|
|
1062
|
+
if (config?.anthropic?.apiKey) {
|
|
1063
|
+
return new AnthropicVisionProvider(config.anthropic);
|
|
1064
|
+
}
|
|
1065
|
+
break;
|
|
1066
|
+
case "xai":
|
|
1067
|
+
if (config?.xai?.apiKey) {
|
|
1068
|
+
return new XAIVisionProvider(config.xai);
|
|
1069
|
+
}
|
|
1070
|
+
break;
|
|
1071
|
+
case "ollama":
|
|
1072
|
+
// Ollama doesn't require an API key, just a base URL
|
|
1073
|
+
return new OllamaVisionProvider(config?.ollama ?? {});
|
|
1074
|
+
}
|
|
1075
|
+
if (options.cloudMediaDisabled) {
|
|
1076
|
+
throw new Error("No vision provider configured and cloud media is disabled. " +
|
|
1077
|
+
"Configure a direct provider (openai, google, anthropic, xai, ollama) or enable cloud media.");
|
|
1078
|
+
}
|
|
1079
|
+
return new ElizaCloudVisionProvider(options.elizaCloudBaseUrl ?? "https://elizacloud.ai/api/v1", options.elizaCloudApiKey);
|
|
1080
|
+
}
|
|
1081
|
+
export function createMediaProviders(config, options) {
|
|
1082
|
+
return {
|
|
1083
|
+
image: createImageProvider(config?.image, options),
|
|
1084
|
+
video: createVideoProvider(config?.video, options),
|
|
1085
|
+
audio: createAudioProvider(config?.audio, options),
|
|
1086
|
+
vision: createVisionProvider(config?.vision, options),
|
|
1087
|
+
};
|
|
1088
|
+
}
|