@xopcai/xopc 0.0.162 → 0.0.164
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/README.md +4 -2
- package/README.zh-CN.md +4 -2
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-hpcNv9MZ.js → activity-store-DkALQFJT.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Zf9UQEmQ.js → agent-avatar-dicebear-RpxkQtQ3.js} +1 -1
- package/dist/gateway/static/root/assets/agents-CxpwxMPE.js +2 -0
- package/dist/gateway/static/root/assets/{api-Dnatri09.js → api-DPIXEcIq.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-BBTR9wJP.js → app-management-settings-panel-DLdjfMXB.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-C2zpLCHD.js → appearance-settings-C89-uxkq.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-k-tZbaRB.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-9eR_ODY1.js → archive-plugin-CqbH5geE.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-DPuWYUeX.js → attachment-load-CeU4Qiot.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-suggestion-card-Dw49OJRl.js → automation-suggestion-card-WiOuqXq9.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-Bdn3dgC_.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-BdkJpDFm.js → binary-plugins-C5TdzrhJ.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-CAi7SXYU.js → block-editor-BjvWhphG.js} +39 -39
- package/dist/gateway/static/root/assets/browser-settings-page-GsVTGfGs.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-Dx6wkGz1.js → browser-workflow-inputs-DXmzQ3nk.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-Skertc-A.js → browser-workflows-page-C1-ptRe4.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-6d4kVjzl.js +2 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-CNFl7dM3.js → capability-presets-api-C0pVlUyc.js} +1 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-DCxy5Ls_.js +2 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-DYQyGDw4.js → channel-recipient-api-B5rLegwk.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-Bg3P8k0f.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-DZZq0upi.js +1 -0
- package/dist/gateway/static/root/assets/{connector-logo-Bng6kxYF.js → connector-logo-CuI5w4qM.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-6UR7yhIZ.js +2 -0
- package/dist/gateway/static/root/assets/{desktop-pet-Bpf6oegd.js → desktop-pet-BvG8vDXZ.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-BVUyefSd.js → desktop-pet-settings-CR__kZ8C.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-DjSZAPz_.js → directory-picker-path-field-BblWMz3e.js} +1 -1
- package/dist/gateway/static/root/assets/{dreaming-settings-CAZk2AM4.js → dreaming-settings-DHMPugDE.js} +3 -3
- package/dist/gateway/static/root/assets/{extension-debug-page-C2F6vTTd.js → extension-debug-page-ByVY1gZg.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-AnIt4bn4.js → extension-page-DLCKKtbK.js} +1 -1
- package/dist/gateway/static/root/assets/extension-settings-page-M-rhlFBC.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-api-DLFyZv33.js → gateway-config-api-DZHqhbXH.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-DnQAA-qq.js → gateway-settings-CZswIehx.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-DbzLyJ3R.js → gateway-startup-retry-ulwTJovP.js} +1 -1
- package/dist/gateway/static/root/assets/goal-create-dialog-TbyRfDas.js +1 -0
- package/dist/gateway/static/root/assets/goal-detail-page-B-QBVOf2.js +4 -0
- package/dist/gateway/static/root/assets/{goals-config-api-REmr3QCr.js → goals-config-api-DMxG6f0N.js} +1 -1
- package/dist/gateway/static/root/assets/goals-page-BGxki8BR.js +2 -0
- package/dist/gateway/static/root/assets/{goals-settings-Dz0F3uRO.js → goals-settings-G-w1gCYD.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-CQFY5gYs.js → heartbeat-settings-Csb90R59.js} +1 -1
- package/dist/gateway/static/root/assets/index-BXtJvaQl.css +1 -0
- package/dist/gateway/static/root/assets/{index-C8JkTS6d.js → index-CGwuxvzr.js} +70 -70
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BnOQXU5k.js → keyboard-shortcuts-settings-C_Bl3YOr.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-BR2tBhO3.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-KsOtWOyM.js → local-apps-page-_8Rv-tSk.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-0lpYdNDr.js → locale-store-C_ax27uc.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-CwF0C_Z2.js +7 -0
- package/dist/gateway/static/root/assets/{markdown-split-D5GRg10r.js → markdown-split-CZnZS6gq.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-C1ryULGs.js → media-plugins-C2XLYC6G.js} +1 -1
- package/dist/gateway/static/root/assets/messages-C96Zjb0V.js +5 -0
- package/dist/gateway/static/root/assets/{notes-page-CIeZ1_DT.js → notes-page-BkuZxTFo.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-CD4FADi7.js +4 -0
- package/dist/gateway/static/root/assets/{page-tabs-Caj1-E_X.js → page-tabs-DR2FGC4E.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-DKwEce-9.js → preview-open-alternatives-B65O8wBL.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-B90ZskkN.js → product-open-page-Cag-utLH.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-COKtUblD.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-QYmqanBN.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-BU_gBU0f.js +1 -0
- package/dist/gateway/static/root/assets/{save-bar-controls-BDYt53uQ.js → save-bar-controls-DCWpFnPc.js} +1 -1
- package/dist/gateway/static/root/assets/schedule-field-ClacZdvE.js +1 -0
- package/dist/gateway/static/root/assets/{schema-form-D7oCARF7.js → schema-form-BVlbEipU.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-u-Pjbzfm.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-1Yck1PKq.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-CARTHCxH.js → settings-form-section-GSNlQWSW.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-DEwYqESe.js → settings-loading-skeleton-08Ae5sB_.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-B6vVdHeQ.js → settings-page-BseJD4I-.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-D3srt5Bi.js → settings-page-layout-bSliH-Y3.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-CGRhJVlt.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-Ck9SxiXw.js → share-preview-page-C114OpTx.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-BRFpWFgI.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-cVjU2GnN.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-CoMTjtRT.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-DLBUQSk2.js → system-settings-panel-El8cDcTY.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-C1oaqeD2.js → theme-store-D37XLD_C.js} +1 -1
- package/dist/gateway/static/root/assets/time-picker-CU7hhD8T.js +1 -0
- package/dist/gateway/static/root/assets/{typed-models-lib-Divbg_C4.js → typed-models-lib-kToxD7Rc.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-CP9a_rAf.js → use-channel-catalog-DBh0dOC9.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-C0xYCSXB.js +1 -0
- package/dist/gateway/static/root/assets/voice-api-key-field-DzEpwYaU.js +1 -0
- package/dist/gateway/static/root/assets/work-discovery-page-DakZqR85.js +1 -0
- package/dist/gateway/static/root/assets/work-item-detail-page-CswqPbTT.js +1 -0
- package/dist/gateway/static/root/assets/work-page-DYRXEk8m.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DbDPYQwB.js → workflow-run-setup-panel-BwSxyVMM.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-CiLSYGuN.js +11 -0
- package/dist/gateway/static/root/index.html +7 -7
- package/dist/package.js +1 -1
- package/dist/src/agent/client-error-format.d.ts +1 -1
- package/dist/src/agent/client-error-format.js +6 -2
- package/dist/src/agent/embedded/model-runtime.d.ts +4 -0
- package/dist/src/agent/embedded/model-runtime.js +49 -0
- package/dist/src/agent/embedded/run-for-session.js +38 -31
- package/dist/src/agent/embedded/session-runner.d.ts +1 -0
- package/dist/src/agent/embedded/session-runner.js +13 -5
- package/dist/src/agent/failover-error.d.ts +1 -1
- package/dist/src/agent/image/generation/openai-compatible-image-provider.d.ts +2 -6
- package/dist/src/agent/image/generation/openai-compatible-image-provider.js +1 -3
- package/dist/src/agent/image/generation/provider-registry.d.ts +5 -46
- package/dist/src/agent/image/generation/provider-registry.js +24 -73
- package/dist/{extensions/dashscope/src/image-generation-provider.d.ts → src/agent/image/generation/providers/dashscope.d.ts} +3 -6
- package/dist/{extensions/dashscope/src/image-generation-provider.js → src/agent/image/generation/providers/dashscope.js} +36 -59
- package/dist/{extensions/fal/src/image-generation-provider.d.ts → src/agent/image/generation/providers/fal.d.ts} +1 -1
- package/dist/{extensions/fal/src/image-generation-provider.js → src/agent/image/generation/providers/fal.js} +19 -29
- package/dist/{extensions/google/src/image-generation-provider.d.ts → src/agent/image/generation/providers/google.d.ts} +2 -2
- package/dist/{extensions/google/src/image-generation-provider.js → src/agent/image/generation/providers/google.js} +23 -30
- package/dist/{extensions/minimax/src/image-generation-provider.d.ts → src/agent/image/generation/providers/minimax.d.ts} +2 -5
- package/dist/{extensions/minimax/src/image-generation-provider.js → src/agent/image/generation/providers/minimax.js} +35 -51
- package/dist/{extensions/openai/src/image-generation-provider.d.ts → src/agent/image/generation/providers/openai.d.ts} +2 -2
- package/dist/{extensions/openai/src/image-generation-provider.js → src/agent/image/generation/providers/openai.js} +13 -38
- package/dist/src/agent/image/generation/runtime-types.d.ts +1 -0
- package/dist/src/agent/image/generation/runtime.d.ts +1 -3
- package/dist/src/agent/image/generation/runtime.js +6 -6
- package/dist/src/agent/image/generation/types.d.ts +23 -3
- package/dist/src/agent/image/index.d.ts +1 -1
- package/dist/src/agent/image/index.js +2 -2
- package/dist/src/agent/media-generation/runtime-shared.d.ts +2 -0
- package/dist/src/agent/media-generation/runtime-shared.js +1 -0
- package/dist/src/agent/tools/factory.js +4 -1
- package/dist/src/agent/tools/image-generate-tool.d.ts +2 -0
- package/dist/src/agent/tools/image-generate-tool.js +14 -7
- package/dist/src/auth/credentials.js +45 -2
- package/dist/src/auth/index.js +2 -1
- package/dist/src/auth/oauth/anthropic.js +27 -24
- package/dist/src/auth/oauth/github-copilot.js +20 -15
- package/dist/src/auth/oauth/google-antigravity.js +9 -2
- package/dist/src/auth/oauth/google-gemini-cli.js +9 -2
- package/dist/src/auth/oauth/google-oauth/google-antigravity.js +47 -40
- package/dist/src/auth/oauth/google-oauth/google-gemini-cli.js +48 -41
- package/dist/src/auth/oauth/google-oauth/oauth-page.js +7 -2
- package/dist/src/auth/oauth/google-oauth/pkce.js +4 -1
- package/dist/src/auth/oauth/index.d.ts +2 -0
- package/dist/src/auth/oauth/index.js +24 -10
- package/dist/src/auth/oauth/kimi-coding.js +76 -71
- package/dist/src/auth/oauth/minimax-cn.js +78 -73
- package/dist/src/auth/oauth/minimax.js +78 -73
- package/dist/src/auth/oauth/openai-codex.js +31 -25
- package/dist/src/auth/oauth/pkce.js +4 -1
- package/dist/src/auth/oauth/registry.d.ts +13 -0
- package/dist/src/auth/oauth/registry.js +65 -0
- package/dist/src/auth/oauth/xopc-cloud.d.ts +2 -0
- package/dist/src/auth/oauth/xopc-cloud.js +101 -0
- package/dist/src/auth/sync-provider-auth.d.ts +3 -0
- package/dist/src/auth/sync-provider-auth.js +17 -1
- package/dist/src/cli/commands/models.js +2 -5
- package/dist/src/cli/commands/onboard/model.js +3 -2
- package/dist/src/cli/commands/setup-shared/types.d.ts +1 -1
- package/dist/src/cli/utils/oauth-providers.d.ts +3 -26
- package/dist/src/cli/utils/oauth-providers.js +6 -80
- package/dist/src/config/index.js +2 -2
- package/dist/src/config/models-json.d.ts +6 -0
- package/dist/src/config/models-json.js +10 -6
- package/dist/src/config/schema.d.ts +26 -15
- package/dist/src/config/schema.js +23 -12
- package/dist/src/gateway/heartbeat/service.js +1 -1
- package/dist/src/gateway/hono/app.js +12 -6
- package/dist/src/gateway/hono/lib/safe-providers-config.d.ts +0 -3
- package/dist/src/gateway/hono/lib/safe-providers-config.js +1 -3
- package/dist/src/gateway/hono/middleware/strict-rate-limit.d.ts +4 -0
- package/dist/src/gateway/hono/middleware/strict-rate-limit.js +8 -1
- package/dist/src/gateway/hono/oauth-async.js +3 -19
- package/dist/src/gateway/hono/oauth.js +3 -19
- package/dist/src/gateway/hono/routes/config-patch/misc.js +2 -11
- package/dist/src/gateway/hono/routes/deps.d.ts +1 -0
- package/dist/src/gateway/hono/routes/lazy-bundles.js +9 -2
- package/dist/src/gateway/hono/routes/models.js +96 -128
- package/dist/src/gateway/image-generation-setup.d.ts +40 -0
- package/dist/src/gateway/image-generation-setup.js +130 -0
- package/dist/src/gateway/rate-limit/buckets.d.ts +3 -0
- package/dist/src/gateway/rate-limit/buckets.js +12 -0
- package/dist/src/gateway/service.d.ts +3 -0
- package/dist/src/gateway/service.js +10 -0
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/media-shared/http/private-network.d.ts +1 -1
- package/dist/src/media-shared/http/private-network.js +1 -1
- package/dist/src/providers/auth-runtime/resolve-api-key.d.ts +2 -4
- package/dist/src/providers/auth-runtime/resolve-api-key.js +2 -4
- package/dist/src/providers/auth-runtime/resolve-auth.d.ts +3 -4
- package/dist/src/providers/auth-runtime/resolve-auth.js +18 -18
- package/dist/src/providers/domestic-presets.d.ts +2 -0
- package/dist/src/providers/index.js +9 -0
- package/dist/src/providers/model-catalog-store.d.ts +33 -0
- package/dist/src/providers/model-catalog-store.js +63 -0
- package/dist/src/providers/model-catalog-sync-service.d.ts +40 -0
- package/dist/src/providers/model-catalog-sync-service.js +132 -0
- package/dist/src/providers/model-reference-auditor.d.ts +14 -0
- package/dist/src/providers/model-reference-auditor.js +71 -0
- package/dist/src/providers/model-registry.d.ts +4 -1
- package/dist/src/providers/model-registry.js +33 -2
- package/dist/src/providers/presentation.js +2 -0
- package/dist/src/providers/xopc-cloud-model-source.d.ts +30 -0
- package/dist/src/providers/xopc-cloud-model-source.js +68 -0
- package/dist/src/session/index.d.ts +1 -1
- package/dist/src/session/index.js +2 -2
- package/dist/src/session/session-title.d.ts +2 -0
- package/dist/src/session/session-title.js +24 -3
- package/dist/src/work-discovery/analyzer.js +27 -14
- package/package.json +5 -7
- package/dist/extensions/dashscope/src/index.d.ts +0 -4
- package/dist/extensions/dashscope/src/index.js +0 -2
- package/dist/extensions/dashscope/xopc.extension.json +0 -15
- package/dist/extensions/fal/src/index.d.ts +0 -4
- package/dist/extensions/fal/src/index.js +0 -2
- package/dist/extensions/fal/xopc.extension.json +0 -14
- package/dist/extensions/google/src/index.d.ts +0 -4
- package/dist/extensions/google/src/index.js +0 -2
- package/dist/extensions/google/xopc.extension.json +0 -14
- package/dist/extensions/minimax/src/index.d.ts +0 -4
- package/dist/extensions/minimax/src/index.js +0 -2
- package/dist/extensions/minimax/xopc.extension.json +0 -15
- package/dist/extensions/openai/src/index.d.ts +0 -4
- package/dist/extensions/openai/src/index.js +0 -2
- package/dist/extensions/openai/xopc.extension.json +0 -14
- package/dist/gateway/static/root/assets/agents-DfVkZlHc.js +0 -2
- package/dist/gateway/static/root/assets/apps-page-BMtAa4Ra.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-BiSAMYTr.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-DHmaEJS2.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-B5wSgf4f.js +0 -2
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-DyvFZwBj.js +0 -2
- package/dist/gateway/static/root/assets/channels-settings-BBKEqDZn.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-Drk110ve.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-HpgaUDQ1.js +0 -2
- package/dist/gateway/static/root/assets/extension-settings-page-CLSc6682.js +0 -1
- package/dist/gateway/static/root/assets/goal-create-dialog-DrnKFC6M.js +0 -1
- package/dist/gateway/static/root/assets/goal-detail-page-Cw1hpJkZ.js +0 -4
- package/dist/gateway/static/root/assets/goals-page-BDGkTVma.js +0 -2
- package/dist/gateway/static/root/assets/index-hmrG55qg.css +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-Bdef1b7F.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-CwLPgrWh.js +0 -7
- package/dist/gateway/static/root/assets/messages-BwQ3WssU.js +0 -5
- package/dist/gateway/static/root/assets/notes-workbench-Cf06q19x.js +0 -4
- package/dist/gateway/static/root/assets/project-detail-page-SHTurM4t.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-BcC2qUAw.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-6vGefBHv.js +0 -1
- package/dist/gateway/static/root/assets/schedule-field-Bcdni4Pj.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-C5014a53.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-CDY3ZI1K.js +0 -1
- package/dist/gateway/static/root/assets/settings-collapsible-section-6eNF8Jey.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-z-rF0Hdg.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-CHZFXE_d.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-B7p2QNXt.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-ncw3tX9P.js +0 -2
- package/dist/gateway/static/root/assets/user-context-page-iYfeSLKI.js +0 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-CrwkicvT.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page-BQWxyPg8.js +0 -1
- package/dist/gateway/static/root/assets/work-item-detail-page-50ZzGay5.js +0 -1
- package/dist/gateway/static/root/assets/work-page-DPqEahx7.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-C3eIC5HZ.js +0 -11
- package/dist/src/agent/embedded/xopc-auth-storage.d.ts +0 -19
- package/dist/src/agent/embedded/xopc-auth-storage.js +0 -40
- package/dist/src/agent/image/generation/bundled-registry.d.ts +0 -18
- package/dist/src/agent/image/generation/bundled-registry.js +0 -35
- package/dist/src/agent/image/generation/bundled.d.ts +0 -10
- package/dist/src/agent/image/generation/bundled.js +0 -15
- package/dist/src/agent/image/generation/image-provider-ui.d.ts +0 -20
- package/dist/src/agent/image/generation/image-provider-ui.js +0 -1
- package/dist/src/gateway/image-capabilities.d.ts +0 -28
- package/dist/src/gateway/image-capabilities.js +0 -78
- package/dist/src/generated/bundled-image-generation-providers.d.ts +0 -14
- package/dist/src/generated/bundled-image-generation-providers.js +0 -17
|
@@ -1,21 +1,17 @@
|
|
|
1
|
-
import { createLogger } from "
|
|
2
|
-
import { init_logger } from "
|
|
3
|
-
import { imageFileExtensionForMimeType } from "
|
|
4
|
-
import { pickTimeoutMsOrFallback } from "
|
|
5
|
-
import { privateNetworkPolicyToSsrfGuardOptions } from "
|
|
6
|
-
import { resolveProviderHttpRequestConfig } from "
|
|
7
|
-
import { postJsonRequest } from "
|
|
8
|
-
import "
|
|
9
|
-
import { resolveApiKeyForProvider } from "
|
|
10
|
-
import { isProviderApiKeyConfigured } from "
|
|
11
|
-
import "
|
|
12
|
-
//#region
|
|
1
|
+
import { createLogger } from "../../../../utils/logger/index.js";
|
|
2
|
+
import { init_logger } from "../../../../utils/logger.js";
|
|
3
|
+
import { imageFileExtensionForMimeType } from "../image-assets.js";
|
|
4
|
+
import { pickTimeoutMsOrFallback } from "../../../../media-shared/http/deadline.js";
|
|
5
|
+
import { privateNetworkPolicyToSsrfGuardOptions } from "../../../../media-shared/http/private-network.js";
|
|
6
|
+
import { resolveProviderHttpRequestConfig } from "../../../../media-shared/http/resolve-provider-http-request-config.js";
|
|
7
|
+
import { postJsonRequest } from "../../../../media-shared/http/provider-http.js";
|
|
8
|
+
import "../../../../media-shared/http/index.js";
|
|
9
|
+
import { resolveApiKeyForProvider } from "../../../../providers/auth-runtime/resolve-api-key.js";
|
|
10
|
+
import { isProviderApiKeyConfigured } from "../../../../providers/auth-runtime/is-configured.js";
|
|
11
|
+
import "../../../../providers/auth-runtime/index.js";
|
|
12
|
+
//#region src/agent/image/generation/providers/dashscope.ts
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* Migrated from src/agent/image/generation/dashscope-generate.ts. Logic stays
|
|
17
|
-
* identical; the only change is registration is now driven by the bundled
|
|
18
|
-
* provider generator.
|
|
14
|
+
* Built-in DashScope (Alibaba Model Studio) image-generation provider.
|
|
19
15
|
*/
|
|
20
16
|
init_logger();
|
|
21
17
|
const log = createLogger("ImageGen:DashScope");
|
|
@@ -67,23 +63,18 @@ const DASHSCOPE_IMAGE_ENDPOINTS = {
|
|
|
67
63
|
singapore: "https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation"
|
|
68
64
|
};
|
|
69
65
|
const DEFAULT_OUTPUT_MIME = "image/png";
|
|
70
|
-
function
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
function resolveDashScopeImageGenerationUrl(req, defaultRegion = "beijing") {
|
|
74
|
-
const id = providerConfigId(req);
|
|
75
|
-
const cfgImageBase = readDashScopeCfgString(req?.cfg, id, "imageBaseUrl");
|
|
76
|
-
if (cfgImageBase) return cfgImageBase.replace(/\/+$/, "");
|
|
77
|
-
const cfgBase = readDashScopeCfgString(req?.cfg, id, "baseUrl");
|
|
66
|
+
function resolveDashScopeImageGenerationUrl(req) {
|
|
67
|
+
const cfgBase = readDashScopeCfgString(req.cfg, "baseUrl");
|
|
78
68
|
if (cfgBase) return cfgBase.replace(/\/+$/, "");
|
|
79
|
-
const
|
|
80
|
-
if (
|
|
81
|
-
return DASHSCOPE_IMAGE_ENDPOINTS
|
|
69
|
+
const region = readDashScopeCfgString(req.cfg, "region");
|
|
70
|
+
if (region === "cn") return DASHSCOPE_IMAGE_ENDPOINTS.beijing;
|
|
71
|
+
if (region === "intl") return DASHSCOPE_IMAGE_ENDPOINTS.singapore;
|
|
72
|
+
throw new Error("DashScope image generation requires providers.dashscope.region (cn or intl)");
|
|
82
73
|
}
|
|
83
|
-
function readDashScopeCfgString(cfg,
|
|
74
|
+
function readDashScopeCfgString(cfg, key) {
|
|
84
75
|
const providers = cfg?.providers;
|
|
85
76
|
if (!providers || typeof providers !== "object") return void 0;
|
|
86
|
-
const entry = providers
|
|
77
|
+
const entry = providers.dashscope;
|
|
87
78
|
if (!entry || typeof entry !== "object") return void 0;
|
|
88
79
|
const v = entry[key];
|
|
89
80
|
return typeof v === "string" && v.trim() ? v.trim() : void 0;
|
|
@@ -150,7 +141,7 @@ async function fetchImageBuffers(urls, signal) {
|
|
|
150
141
|
}
|
|
151
142
|
async function generateDashScopeImages(params) {
|
|
152
143
|
const { req, apiKey } = params;
|
|
153
|
-
const providerId =
|
|
144
|
+
const providerId = "dashscope";
|
|
154
145
|
if (req.inputImages && req.inputImages.length > 0) throw new Error("Image-to-image is not supported for Qwen/DashScope in this build");
|
|
155
146
|
const n = Math.min(4, Math.max(1, req.count ?? 1));
|
|
156
147
|
const model = req.model?.trim() || DASHSCOPE_DEFAULT_IMAGE_MODEL;
|
|
@@ -174,7 +165,7 @@ async function generateDashScopeImages(params) {
|
|
|
174
165
|
}] },
|
|
175
166
|
parameters
|
|
176
167
|
};
|
|
177
|
-
const url = resolveDashScopeImageGenerationUrl(req
|
|
168
|
+
const url = resolveDashScopeImageGenerationUrl(req);
|
|
178
169
|
const httpDefaults = resolveProviderHttpRequestConfig({
|
|
179
170
|
providerId,
|
|
180
171
|
cfg: req.cfg,
|
|
@@ -216,45 +207,31 @@ async function generateDashScopeImages(params) {
|
|
|
216
207
|
model
|
|
217
208
|
};
|
|
218
209
|
}
|
|
219
|
-
function
|
|
210
|
+
function buildDashScopeImageGenerationProvider() {
|
|
220
211
|
return {
|
|
221
|
-
id:
|
|
222
|
-
label:
|
|
212
|
+
id: "dashscope",
|
|
213
|
+
label: "Alibaba Model Studio",
|
|
223
214
|
defaultModel: DASHSCOPE_DEFAULT_IMAGE_MODEL,
|
|
224
215
|
models: [...DASHSCOPE_IMAGE_MODELS],
|
|
225
216
|
capabilities: DASHSCOPE_CAPABILITIES,
|
|
226
217
|
isConfigured: (ctx) => isProviderApiKeyConfigured({
|
|
227
|
-
providerId:
|
|
228
|
-
cfg: ctx.cfg
|
|
229
|
-
|
|
218
|
+
providerId: "dashscope",
|
|
219
|
+
cfg: ctx.cfg,
|
|
220
|
+
agentId: ctx.agentId
|
|
221
|
+
}) && ["cn", "intl"].includes(readDashScopeCfgString(ctx.cfg, "region") ?? ""),
|
|
230
222
|
async generateImage(req) {
|
|
231
223
|
const apiKey = resolveApiKeyForProvider({
|
|
232
|
-
providerId:
|
|
233
|
-
cfg: req.cfg
|
|
224
|
+
providerId: "dashscope",
|
|
225
|
+
cfg: req.cfg,
|
|
226
|
+
agentId: req.agentId
|
|
234
227
|
});
|
|
235
|
-
if (!apiKey) throw new Error(
|
|
228
|
+
if (!apiKey) throw new Error("DashScope API key missing (set DASHSCOPE_API_KEY or save a credential)");
|
|
236
229
|
return generateDashScopeImages({
|
|
237
230
|
req,
|
|
238
|
-
apiKey
|
|
239
|
-
providerId: options.id,
|
|
240
|
-
defaultRegion: options.defaultRegion
|
|
231
|
+
apiKey
|
|
241
232
|
});
|
|
242
233
|
}
|
|
243
234
|
};
|
|
244
235
|
}
|
|
245
|
-
function buildDashScopeCnImageGenerationProvider() {
|
|
246
|
-
return createDashScopeImageGenerationProvider({
|
|
247
|
-
id: "dashscope-cn",
|
|
248
|
-
label: "DashScope (Alibaba · China)",
|
|
249
|
-
defaultRegion: "beijing"
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
function buildDashScopeIntlImageGenerationProvider() {
|
|
253
|
-
return createDashScopeImageGenerationProvider({
|
|
254
|
-
id: "dashscope-intl",
|
|
255
|
-
label: "DashScope (Alibaba · International)",
|
|
256
|
-
defaultRegion: "singapore"
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
236
|
//#endregion
|
|
260
|
-
export { DASHSCOPE_DEFAULT_IMAGE_MODEL, DASHSCOPE_IMAGE_ENDPOINTS, DASHSCOPE_IMAGE_MODELS,
|
|
237
|
+
export { DASHSCOPE_DEFAULT_IMAGE_MODEL, DASHSCOPE_IMAGE_ENDPOINTS, DASHSCOPE_IMAGE_MODELS, buildDashScopeImageGenerationProvider, generateDashScopeImages, isWan27ImageModel, mapSizeToDashScopeFormat, mapSizeToWan27Format, resolveDashScopeImageGenerationUrl };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ImageGenerationProvider, ImageGenerationRequest, ImageGenerationResult } from '
|
|
1
|
+
import type { ImageGenerationProvider, ImageGenerationRequest, ImageGenerationResult } from '../types.js';
|
|
2
2
|
export declare const FAL_DEFAULT_IMAGE_MODEL = "fal-ai/flux/schnell";
|
|
3
3
|
export declare const FAL_IMAGE_MODELS: readonly string[];
|
|
4
4
|
/**
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { createLogger } from "
|
|
2
|
-
import { init_logger } from "
|
|
3
|
-
import { imageFileExtensionForMimeType } from "
|
|
4
|
-
import { pickTimeoutMsOrFallback } from "
|
|
5
|
-
import { privateNetworkPolicyToSsrfGuardOptions } from "
|
|
6
|
-
import { resolveProviderHttpRequestConfig } from "
|
|
7
|
-
import { postJsonRequest } from "
|
|
8
|
-
import "
|
|
9
|
-
import { resolveApiKeyForProvider } from "
|
|
10
|
-
import { isProviderApiKeyConfigured } from "
|
|
11
|
-
import "
|
|
12
|
-
//#region
|
|
1
|
+
import { createLogger } from "../../../../utils/logger/index.js";
|
|
2
|
+
import { init_logger } from "../../../../utils/logger.js";
|
|
3
|
+
import { imageFileExtensionForMimeType } from "../image-assets.js";
|
|
4
|
+
import { pickTimeoutMsOrFallback } from "../../../../media-shared/http/deadline.js";
|
|
5
|
+
import { privateNetworkPolicyToSsrfGuardOptions } from "../../../../media-shared/http/private-network.js";
|
|
6
|
+
import { resolveProviderHttpRequestConfig } from "../../../../media-shared/http/resolve-provider-http-request-config.js";
|
|
7
|
+
import { postJsonRequest } from "../../../../media-shared/http/provider-http.js";
|
|
8
|
+
import "../../../../media-shared/http/index.js";
|
|
9
|
+
import { resolveApiKeyForProvider } from "../../../../providers/auth-runtime/resolve-api-key.js";
|
|
10
|
+
import { isProviderApiKeyConfigured } from "../../../../providers/auth-runtime/is-configured.js";
|
|
11
|
+
import "../../../../providers/auth-runtime/index.js";
|
|
12
|
+
//#region src/agent/image/generation/providers/fal.ts
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Built-in Fal.ai image-generation provider.
|
|
15
15
|
*
|
|
16
16
|
* Fal.ai is queue-based:
|
|
17
17
|
* 1. POST https://queue.fal.run/<model> → { request_id, status_url, response_url }
|
|
@@ -20,7 +20,7 @@ import "../../../src/providers/auth-runtime/index.js";
|
|
|
20
20
|
* 4. fetch each images[].url → bytes
|
|
21
21
|
*
|
|
22
22
|
* Auth: `Authorization: Key <FAL_KEY>` (Fal's REST convention).
|
|
23
|
-
* Configure via env `FAL_KEY` / `FAL_API_KEY` or
|
|
23
|
+
* Configure via env `FAL_KEY` / `FAL_API_KEY` or the local credential store.
|
|
24
24
|
*
|
|
25
25
|
* Polling stays inside `req.timeoutMs` (default 600s for queue + inference);
|
|
26
26
|
* exceeding it surfaces a clear error rather than hanging forever.
|
|
@@ -28,16 +28,6 @@ import "../../../src/providers/auth-runtime/index.js";
|
|
|
28
28
|
init_logger();
|
|
29
29
|
const log = createLogger("ImageGen:Fal");
|
|
30
30
|
const DEFAULT_FAL_QUEUE_BASE_URL = "https://queue.fal.run";
|
|
31
|
-
const FAL_IMAGE_UI = {
|
|
32
|
-
baseUrlPresets: [{
|
|
33
|
-
value: DEFAULT_FAL_QUEUE_BASE_URL,
|
|
34
|
-
label: "Fal queue (default)"
|
|
35
|
-
}, {
|
|
36
|
-
value: "https://fal.run",
|
|
37
|
-
label: "Fal direct (fal.run)"
|
|
38
|
-
}],
|
|
39
|
-
baseUrlPresetKind: "fal"
|
|
40
|
-
};
|
|
41
31
|
const FAL_DEFAULT_IMAGE_MODEL = "fal-ai/flux/schnell";
|
|
42
32
|
const DEFAULT_TIMEOUT_MS = 6e5;
|
|
43
33
|
const DEFAULT_POLL_INTERVAL_MS = 1500;
|
|
@@ -300,22 +290,22 @@ async function generateFalImages(params) {
|
|
|
300
290
|
function buildFalImageGenerationProvider() {
|
|
301
291
|
return {
|
|
302
292
|
id: "fal",
|
|
303
|
-
aliases: ["fal-ai"],
|
|
304
293
|
label: "Fal.ai",
|
|
305
294
|
defaultModel: FAL_DEFAULT_IMAGE_MODEL,
|
|
306
295
|
models: [...FAL_IMAGE_MODELS],
|
|
307
296
|
capabilities: FAL_CAPABILITIES,
|
|
308
|
-
ui: FAL_IMAGE_UI,
|
|
309
297
|
isConfigured: (ctx) => isProviderApiKeyConfigured({
|
|
310
298
|
providerId: "fal",
|
|
311
|
-
cfg: ctx.cfg
|
|
299
|
+
cfg: ctx.cfg,
|
|
300
|
+
agentId: ctx.agentId
|
|
312
301
|
}),
|
|
313
302
|
async generateImage(req) {
|
|
314
303
|
const apiKey = resolveApiKeyForProvider({
|
|
315
304
|
providerId: "fal",
|
|
316
|
-
cfg: req.cfg
|
|
305
|
+
cfg: req.cfg,
|
|
306
|
+
agentId: req.agentId
|
|
317
307
|
});
|
|
318
|
-
if (!apiKey) throw new Error("Fal.ai API key missing (set FAL_KEY / FAL_API_KEY or
|
|
308
|
+
if (!apiKey) throw new Error("Fal.ai API key missing (set FAL_KEY / FAL_API_KEY or save a credential)");
|
|
319
309
|
return generateFalImages({
|
|
320
310
|
req,
|
|
321
311
|
apiKey
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ImageGenerationProvider, ImageGenerationRequest, ImageGenerationResult } from '
|
|
2
|
-
/** Gemini image-capable model ids
|
|
1
|
+
import type { ImageGenerationProvider, ImageGenerationRequest, ImageGenerationResult } from '../types.js';
|
|
2
|
+
/** Gemini image-capable model ids exposed by xopc. */
|
|
3
3
|
export declare const GOOGLE_IMAGE_MODELS: readonly string[];
|
|
4
4
|
export declare const GOOGLE_DEFAULT_IMAGE_MODEL: string;
|
|
5
5
|
/**
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { createLogger } from "
|
|
2
|
-
import { init_logger } from "
|
|
3
|
-
import { imageFileExtensionForMimeType } from "
|
|
4
|
-
import { pickTimeoutMsOrFallback } from "
|
|
5
|
-
import { privateNetworkPolicyToSsrfGuardOptions } from "
|
|
6
|
-
import { resolveProviderHttpRequestConfig } from "
|
|
7
|
-
import { postJsonRequest } from "
|
|
8
|
-
import "
|
|
9
|
-
import { resolveApiKeyForProvider } from "
|
|
10
|
-
import { isProviderApiKeyConfigured } from "
|
|
11
|
-
import "
|
|
12
|
-
//#region
|
|
1
|
+
import { createLogger } from "../../../../utils/logger/index.js";
|
|
2
|
+
import { init_logger } from "../../../../utils/logger.js";
|
|
3
|
+
import { imageFileExtensionForMimeType } from "../image-assets.js";
|
|
4
|
+
import { pickTimeoutMsOrFallback } from "../../../../media-shared/http/deadline.js";
|
|
5
|
+
import { privateNetworkPolicyToSsrfGuardOptions } from "../../../../media-shared/http/private-network.js";
|
|
6
|
+
import { resolveProviderHttpRequestConfig } from "../../../../media-shared/http/resolve-provider-http-request-config.js";
|
|
7
|
+
import { postJsonRequest } from "../../../../media-shared/http/provider-http.js";
|
|
8
|
+
import "../../../../media-shared/http/index.js";
|
|
9
|
+
import { resolveApiKeyForProvider } from "../../../../providers/auth-runtime/resolve-api-key.js";
|
|
10
|
+
import { isProviderApiKeyConfigured } from "../../../../providers/auth-runtime/is-configured.js";
|
|
11
|
+
import "../../../../providers/auth-runtime/index.js";
|
|
12
|
+
//#region src/agent/image/generation/providers/google.ts
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Built-in Google Gemini image-generation provider.
|
|
15
15
|
*
|
|
16
16
|
* Uses the Gemini `generateContent` REST surface
|
|
17
17
|
* (`https://generativelanguage.googleapis.com/v1beta/models/<model>:generateContent`)
|
|
@@ -23,25 +23,18 @@ import "../../../src/providers/auth-runtime/index.js";
|
|
|
23
23
|
* falls back to `Authorization: Bearer` when the user explicitly configures an
|
|
24
24
|
* OAuth-style key. Configure via env `GOOGLE_API_KEY` /
|
|
25
25
|
* `GEMINI_API_KEY` / `GENERATIVE_LANGUAGE_API_KEY`, or via
|
|
26
|
-
*
|
|
26
|
+
* the local credential store.
|
|
27
27
|
*/
|
|
28
28
|
init_logger();
|
|
29
29
|
const log = createLogger("ImageGen:Google");
|
|
30
30
|
const DEFAULT_GEMINI_BASE_URL = "https://generativelanguage.googleapis.com";
|
|
31
|
-
const GOOGLE_IMAGE_UI = {
|
|
32
|
-
baseUrlPresets: [{
|
|
33
|
-
value: DEFAULT_GEMINI_BASE_URL,
|
|
34
|
-
label: "Google AI (default)"
|
|
35
|
-
}],
|
|
36
|
-
baseUrlPresetKind: "google"
|
|
37
|
-
};
|
|
38
31
|
const DEFAULT_GEMINI_API_VERSION = "v1beta";
|
|
39
32
|
const DEFAULT_TIMEOUT_MS = 18e4;
|
|
40
|
-
/** Gemini image-capable model ids
|
|
33
|
+
/** Gemini image-capable model ids exposed by xopc. */
|
|
41
34
|
const GOOGLE_IMAGE_MODELS = [
|
|
42
|
-
"gemini-
|
|
43
|
-
"gemini-3-
|
|
44
|
-
"gemini-3-
|
|
35
|
+
"gemini-3.1-flash-image",
|
|
36
|
+
"gemini-3.1-flash-lite-image",
|
|
37
|
+
"gemini-3-pro-image"
|
|
45
38
|
];
|
|
46
39
|
const GOOGLE_DEFAULT_IMAGE_MODEL = GOOGLE_IMAGE_MODELS[0];
|
|
47
40
|
const GOOGLE_CAPABILITIES = {
|
|
@@ -216,22 +209,22 @@ async function generateGoogleImages(params) {
|
|
|
216
209
|
function buildGoogleImageGenerationProvider() {
|
|
217
210
|
return {
|
|
218
211
|
id: "google",
|
|
219
|
-
aliases: ["gemini"],
|
|
220
212
|
label: "Google Gemini",
|
|
221
213
|
defaultModel: GOOGLE_DEFAULT_IMAGE_MODEL,
|
|
222
214
|
models: [...GOOGLE_IMAGE_MODELS],
|
|
223
215
|
capabilities: GOOGLE_CAPABILITIES,
|
|
224
|
-
ui: GOOGLE_IMAGE_UI,
|
|
225
216
|
isConfigured: (ctx) => isProviderApiKeyConfigured({
|
|
226
217
|
providerId: "google",
|
|
227
|
-
cfg: ctx.cfg
|
|
218
|
+
cfg: ctx.cfg,
|
|
219
|
+
agentId: ctx.agentId
|
|
228
220
|
}),
|
|
229
221
|
async generateImage(req) {
|
|
230
222
|
const apiKey = resolveApiKeyForProvider({
|
|
231
223
|
providerId: "google",
|
|
232
|
-
cfg: req.cfg
|
|
224
|
+
cfg: req.cfg,
|
|
225
|
+
agentId: req.agentId
|
|
233
226
|
});
|
|
234
|
-
if (!apiKey) throw new Error("Google Gemini API key missing (set GOOGLE_API_KEY / GEMINI_API_KEY or
|
|
227
|
+
if (!apiKey) throw new Error("Google Gemini API key missing (set GOOGLE_API_KEY / GEMINI_API_KEY or save a credential)");
|
|
235
228
|
return generateGoogleImages({
|
|
236
229
|
req,
|
|
237
230
|
apiKey
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ImageGenerationProvider, ImageGenerationRequest, ImageGenerationResult } from '
|
|
1
|
+
import type { ImageGenerationProvider, ImageGenerationRequest, ImageGenerationResult } from '../types.js';
|
|
2
2
|
/**
|
|
3
3
|
* MiniMax `POST /v1/image_generation` model names (vendor OpenAPI enum).
|
|
4
4
|
* Default: `image-01`. `image-01-live` is the alternate enum value on the same API.
|
|
@@ -12,15 +12,12 @@ export declare const MINIMAX_DEFAULT_IMAGE_MODEL: string;
|
|
|
12
12
|
* 2. MINIMAX_BASE_URL env
|
|
13
13
|
* 3. Provider default base URL
|
|
14
14
|
*/
|
|
15
|
-
export declare function resolveMinimaxBaseUrl(req: ImageGenerationRequest
|
|
15
|
+
export declare function resolveMinimaxBaseUrl(req: ImageGenerationRequest): string;
|
|
16
16
|
export type MinimaxAspectRatio = '1:1' | '16:9' | '9:16' | '4:3' | '3:4';
|
|
17
17
|
/** Map tool size (e.g. `1024x1024`) to the closest MiniMax-supported aspect ratio. */
|
|
18
18
|
export declare function mapSizeToMinimaxAspectRatio(size?: string): MinimaxAspectRatio;
|
|
19
19
|
export declare function generateMinimaxImages(params: {
|
|
20
20
|
req: ImageGenerationRequest;
|
|
21
21
|
apiKey: string;
|
|
22
|
-
providerId?: string;
|
|
23
|
-
defaultBaseUrl?: string;
|
|
24
22
|
}): Promise<ImageGenerationResult>;
|
|
25
|
-
export declare function buildMinimaxCnImageGenerationProvider(): ImageGenerationProvider;
|
|
26
23
|
export declare function buildMinimaxImageGenerationProvider(): ImageGenerationProvider;
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
import { createLogger } from "
|
|
2
|
-
import { init_logger } from "
|
|
3
|
-
import { pickTimeoutMsOrFallback } from "
|
|
4
|
-
import { privateNetworkPolicyToSsrfGuardOptions } from "
|
|
5
|
-
import { resolveProviderHttpRequestConfig } from "
|
|
6
|
-
import { postJsonRequest } from "
|
|
7
|
-
import "
|
|
8
|
-
import { resolveApiKeyForProvider } from "
|
|
9
|
-
import { isProviderApiKeyConfigured } from "
|
|
10
|
-
import "
|
|
11
|
-
//#region
|
|
1
|
+
import { createLogger } from "../../../../utils/logger/index.js";
|
|
2
|
+
import { init_logger } from "../../../../utils/logger.js";
|
|
3
|
+
import { pickTimeoutMsOrFallback } from "../../../../media-shared/http/deadline.js";
|
|
4
|
+
import { privateNetworkPolicyToSsrfGuardOptions } from "../../../../media-shared/http/private-network.js";
|
|
5
|
+
import { resolveProviderHttpRequestConfig } from "../../../../media-shared/http/resolve-provider-http-request-config.js";
|
|
6
|
+
import { postJsonRequest } from "../../../../media-shared/http/provider-http.js";
|
|
7
|
+
import "../../../../media-shared/http/index.js";
|
|
8
|
+
import { resolveApiKeyForProvider } from "../../../../providers/auth-runtime/resolve-api-key.js";
|
|
9
|
+
import { isProviderApiKeyConfigured } from "../../../../providers/auth-runtime/is-configured.js";
|
|
10
|
+
import "../../../../providers/auth-runtime/index.js";
|
|
11
|
+
//#region src/agent/image/generation/providers/minimax.ts
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* Migrated from src/agent/image/generation/minimax-generate.ts. Logic stays
|
|
16
|
-
* identical; only the registration pathway moves to the bundled generator.
|
|
13
|
+
* Built-in MiniMax image-generation provider.
|
|
17
14
|
*/
|
|
18
15
|
init_logger();
|
|
19
16
|
const log = createLogger("ImageGen:MiniMax");
|
|
@@ -59,17 +56,18 @@ function readMinimaxCfgString(cfg, providerId, key) {
|
|
|
59
56
|
* 2. MINIMAX_BASE_URL env
|
|
60
57
|
* 3. Provider default base URL
|
|
61
58
|
*/
|
|
62
|
-
function resolveMinimaxBaseUrl(req
|
|
63
|
-
const
|
|
64
|
-
const fromCfg = readMinimaxCfgString(req.cfg, providerId, "baseUrl");
|
|
59
|
+
function resolveMinimaxBaseUrl(req) {
|
|
60
|
+
const fromCfg = readMinimaxCfgString(req.cfg, "minimax", "baseUrl");
|
|
65
61
|
if (fromCfg) return fromCfg.replace(/\/+$/, "");
|
|
66
62
|
const fromEnv = process.env.MINIMAX_BASE_URL?.trim();
|
|
67
63
|
if (fromEnv) return fromEnv.replace(/\/+$/, "");
|
|
68
|
-
|
|
69
|
-
|
|
64
|
+
const region = readMinimaxCfgString(req.cfg, "minimax", "region");
|
|
65
|
+
if (region === "cn") return MINIMAX_CN_BASE_URL;
|
|
66
|
+
if (region === "intl") return MINIMAX_INTL_BASE_URL;
|
|
67
|
+
throw new Error("MiniMax image generation requires providers.minimax.region (cn or intl)");
|
|
70
68
|
}
|
|
71
|
-
function resolveMinimaxImageUrl(req
|
|
72
|
-
return `${resolveMinimaxBaseUrl(req
|
|
69
|
+
function resolveMinimaxImageUrl(req) {
|
|
70
|
+
return `${resolveMinimaxBaseUrl(req)}/v1/image_generation`;
|
|
73
71
|
}
|
|
74
72
|
/** Map tool size (e.g. `1024x1024`) to the closest MiniMax-supported aspect ratio. */
|
|
75
73
|
function mapSizeToMinimaxAspectRatio(size) {
|
|
@@ -115,11 +113,11 @@ function mapSizeToMinimaxAspectRatio(size) {
|
|
|
115
113
|
}
|
|
116
114
|
async function generateMinimaxImages(params) {
|
|
117
115
|
const { req, apiKey } = params;
|
|
118
|
-
const providerId =
|
|
116
|
+
const providerId = "minimax";
|
|
119
117
|
if (req.inputImages && req.inputImages.length > 0) throw new Error("Image-to-image is not supported for MiniMax in this build");
|
|
120
118
|
const model = req.model?.trim() || MINIMAX_DEFAULT_IMAGE_MODEL;
|
|
121
119
|
const aspectRatio = req.aspectRatio?.trim() || mapSizeToMinimaxAspectRatio(req.size);
|
|
122
|
-
const url = resolveMinimaxImageUrl(req
|
|
120
|
+
const url = resolveMinimaxImageUrl(req);
|
|
123
121
|
const httpDefaults = resolveProviderHttpRequestConfig({
|
|
124
122
|
providerId,
|
|
125
123
|
cfg: req.cfg,
|
|
@@ -167,45 +165,31 @@ async function generateMinimaxImages(params) {
|
|
|
167
165
|
model
|
|
168
166
|
};
|
|
169
167
|
}
|
|
170
|
-
function
|
|
168
|
+
function buildMinimaxImageGenerationProvider() {
|
|
171
169
|
return {
|
|
172
|
-
id:
|
|
173
|
-
label:
|
|
170
|
+
id: "minimax",
|
|
171
|
+
label: "MiniMax",
|
|
174
172
|
defaultModel: MINIMAX_DEFAULT_IMAGE_MODEL,
|
|
175
173
|
models: [...MINIMAX_IMAGE_MODELS],
|
|
176
174
|
capabilities: MINIMAX_CAPABILITIES,
|
|
177
175
|
isConfigured: (ctx) => isProviderApiKeyConfigured({
|
|
178
|
-
providerId:
|
|
179
|
-
cfg: ctx.cfg
|
|
180
|
-
|
|
176
|
+
providerId: "minimax",
|
|
177
|
+
cfg: ctx.cfg,
|
|
178
|
+
agentId: ctx.agentId
|
|
179
|
+
}) && ["cn", "intl"].includes(readMinimaxCfgString(ctx.cfg, "minimax", "region") ?? ""),
|
|
181
180
|
async generateImage(req) {
|
|
182
181
|
const apiKey = resolveApiKeyForProvider({
|
|
183
|
-
providerId:
|
|
184
|
-
cfg: req.cfg
|
|
182
|
+
providerId: "minimax",
|
|
183
|
+
cfg: req.cfg,
|
|
184
|
+
agentId: req.agentId
|
|
185
185
|
});
|
|
186
|
-
if (!apiKey) throw new Error(
|
|
186
|
+
if (!apiKey) throw new Error("MiniMax API key missing (set MINIMAX_API_KEY or save a credential)");
|
|
187
187
|
return generateMinimaxImages({
|
|
188
188
|
req,
|
|
189
|
-
apiKey
|
|
190
|
-
providerId: options.id,
|
|
191
|
-
defaultBaseUrl: options.defaultBaseUrl
|
|
189
|
+
apiKey
|
|
192
190
|
});
|
|
193
191
|
}
|
|
194
192
|
};
|
|
195
193
|
}
|
|
196
|
-
function buildMinimaxCnImageGenerationProvider() {
|
|
197
|
-
return createMinimaxImageGenerationProvider({
|
|
198
|
-
id: "minimax-cn",
|
|
199
|
-
label: "MiniMax CN",
|
|
200
|
-
defaultBaseUrl: MINIMAX_CN_BASE_URL
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
function buildMinimaxImageGenerationProvider() {
|
|
204
|
-
return createMinimaxImageGenerationProvider({
|
|
205
|
-
id: "minimax",
|
|
206
|
-
label: "MiniMax International",
|
|
207
|
-
defaultBaseUrl: MINIMAX_INTL_BASE_URL
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
194
|
//#endregion
|
|
211
|
-
export { MINIMAX_DEFAULT_IMAGE_MODEL, MINIMAX_IMAGE_MODELS,
|
|
195
|
+
export { MINIMAX_DEFAULT_IMAGE_MODEL, MINIMAX_IMAGE_MODELS, buildMinimaxImageGenerationProvider, generateMinimaxImages, mapSizeToMinimaxAspectRatio, resolveMinimaxBaseUrl };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ImageGenerationProvider } from '
|
|
2
|
-
/** Image models exposed by
|
|
1
|
+
import type { ImageGenerationProvider } from '../types.js';
|
|
2
|
+
/** Image models exposed by the OpenAI Images API. */
|
|
3
3
|
export declare const OPENAI_IMAGE_MODELS: readonly string[];
|
|
4
4
|
export declare const OPENAI_DEFAULT_IMAGE_MODEL: string;
|
|
5
5
|
export declare function buildOpenAIImageGenerationProvider(): ImageGenerationProvider;
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { resolveAuthProfileForProvider } from "
|
|
2
|
-
import { isProviderApiKeyConfigured } from "
|
|
3
|
-
import "
|
|
4
|
-
import { createOpenAiCompatibleImageProvider } from "
|
|
5
|
-
//#region
|
|
1
|
+
import { resolveAuthProfileForProvider } from "../../../../providers/auth-runtime/resolve-auth.js";
|
|
2
|
+
import { isProviderApiKeyConfigured } from "../../../../providers/auth-runtime/is-configured.js";
|
|
3
|
+
import "../../../../providers/auth-runtime/index.js";
|
|
4
|
+
import { createOpenAiCompatibleImageProvider } from "../openai-compatible-image-provider.js";
|
|
5
|
+
//#region src/agent/image/generation/providers/openai.ts
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Built-in OpenAI image-generation provider.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
* Step 3 plugin-isation. Step 4 adds:
|
|
9
|
+
* Supports:
|
|
11
10
|
* - **Azure OpenAI** routing (when `cfg.providers.openai.azure.{resource,
|
|
12
11
|
* deployment, apiVersion}` is set, or env `AZURE_OPENAI_*`): swaps base
|
|
13
12
|
* URL + uses `api-key` header instead of `Authorization: Bearer`.
|
|
@@ -17,20 +16,9 @@ import { createOpenAiCompatibleImageProvider } from "../../../src/agent/image/ge
|
|
|
17
16
|
* `refreshOAuthProfile` + `store.save` ahead of time.
|
|
18
17
|
*/
|
|
19
18
|
const OPENAI_DEFAULT_BASE_URL = "https://api.openai.com/v1";
|
|
20
|
-
/** Image models exposed by
|
|
21
|
-
const OPENAI_IMAGE_MODELS = [
|
|
22
|
-
"gpt-image-1",
|
|
23
|
-
"dall-e-3",
|
|
24
|
-
"dall-e-2"
|
|
25
|
-
];
|
|
19
|
+
/** Image models exposed by the OpenAI Images API. */
|
|
20
|
+
const OPENAI_IMAGE_MODELS = ["gpt-image-2", "gpt-image-1.5"];
|
|
26
21
|
const OPENAI_DEFAULT_IMAGE_MODEL = OPENAI_IMAGE_MODELS[0];
|
|
27
|
-
const OPENAI_IMAGE_UI = {
|
|
28
|
-
baseUrlPresets: [{
|
|
29
|
-
value: OPENAI_DEFAULT_BASE_URL,
|
|
30
|
-
label: "OpenAI API (default)"
|
|
31
|
-
}],
|
|
32
|
-
baseUrlPresetKind: "openai"
|
|
33
|
-
};
|
|
34
22
|
const OPENAI_CAPABILITIES = {
|
|
35
23
|
generate: {
|
|
36
24
|
maxCount: 4,
|
|
@@ -111,15 +99,16 @@ function buildOpenAIImageGenerationProvider() {
|
|
|
111
99
|
defaultModel: OPENAI_DEFAULT_IMAGE_MODEL,
|
|
112
100
|
models: [...OPENAI_IMAGE_MODELS],
|
|
113
101
|
capabilities: OPENAI_CAPABILITIES,
|
|
114
|
-
ui: OPENAI_IMAGE_UI,
|
|
115
102
|
isConfigured: (ctx) => isProviderApiKeyConfigured({
|
|
116
103
|
providerId: "openai",
|
|
117
|
-
cfg: ctx.cfg
|
|
104
|
+
cfg: ctx.cfg,
|
|
105
|
+
agentId: ctx.agentId
|
|
118
106
|
}),
|
|
119
107
|
resolveApiKey: (req) => {
|
|
120
108
|
return resolveAuthProfileForProvider({
|
|
121
109
|
providerId: "openai",
|
|
122
110
|
cfg: req.cfg,
|
|
111
|
+
agentId: req.agentId,
|
|
123
112
|
store: req.authStore
|
|
124
113
|
}).apiKey ?? null;
|
|
125
114
|
},
|
|
@@ -128,21 +117,7 @@ function buildOpenAIImageGenerationProvider() {
|
|
|
128
117
|
if (azure) return buildAzureEndpoint(azure);
|
|
129
118
|
return { baseUrl: resolveOpenAiBaseUrl(req) };
|
|
130
119
|
},
|
|
131
|
-
defaultTimeoutMs: 12e4
|
|
132
|
-
buildGenerateRequestBody: (req, base) => {
|
|
133
|
-
const m = (req.model || "").toLowerCase();
|
|
134
|
-
if (m === "dall-e-2" || m === "dall-e-3") {
|
|
135
|
-
const cleaned = { ...base };
|
|
136
|
-
delete cleaned.output_format;
|
|
137
|
-
delete cleaned.background;
|
|
138
|
-
delete cleaned.output_compression;
|
|
139
|
-
delete cleaned.moderation;
|
|
140
|
-
if (m === "dall-e-3" && (cleaned.n === void 0 || Number(cleaned.n) > 1)) cleaned.n = 1;
|
|
141
|
-
if (m === "dall-e-2" && cleaned.quality !== void 0) delete cleaned.quality;
|
|
142
|
-
return cleaned;
|
|
143
|
-
}
|
|
144
|
-
return base;
|
|
145
|
-
}
|
|
120
|
+
defaultTimeoutMs: 12e4
|
|
146
121
|
});
|
|
147
122
|
}
|
|
148
123
|
//#endregion
|
|
@@ -15,6 +15,7 @@ export interface GenerateImageParams {
|
|
|
15
15
|
/** Active xopc config. Optional in Step 2 to keep tool-level callers compatible. */
|
|
16
16
|
cfg?: Config;
|
|
17
17
|
prompt: string;
|
|
18
|
+
agentId?: string;
|
|
18
19
|
agentDir?: string;
|
|
19
20
|
authStore?: AuthProfileStore;
|
|
20
21
|
modelConfig?: ToolModelConfig;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import type { Config } from '../../../config/schema.js';
|
|
2
1
|
import { type ImageGenerationProviderSummary } from './provider-registry.js';
|
|
3
2
|
import type { ImageGenerationProviderCapabilities } from './types.js';
|
|
4
|
-
import './bundled.js';
|
|
5
3
|
export type { GenerateImageParams, GenerateImageRuntimeResult, ImageGenerationRuntimeDeps, } from './runtime-types.js';
|
|
6
4
|
import type { GenerateImageParams, GenerateImageRuntimeResult, ImageGenerationRuntimeDeps } from './runtime-types.js';
|
|
7
5
|
/**
|
|
@@ -9,6 +7,6 @@ import type { GenerateImageParams, GenerateImageRuntimeResult, ImageGenerationRu
|
|
|
9
7
|
* structured failover. See {@link GenerateImageParams} / {@link GenerateImageRuntimeResult}.
|
|
10
8
|
*/
|
|
11
9
|
export declare function generateImage(params: GenerateImageParams, deps?: ImageGenerationRuntimeDeps): Promise<GenerateImageRuntimeResult>;
|
|
12
|
-
export declare function listImageGenerationProvidersSummary(
|
|
10
|
+
export declare function listImageGenerationProvidersSummary(): ImageGenerationProviderSummary[];
|
|
13
11
|
export type { ImageGenerationProviderCapabilities };
|
|
14
12
|
export { getImageGenerationProvider, listImageGenerationProviders, } from './provider-registry.js';
|