@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
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png?v=20260713-1" />
|
|
12
12
|
<link rel="manifest" href="/site.webmanifest?v=20260713-1" />
|
|
13
13
|
<title>xopc</title>
|
|
14
|
-
<script type="module" crossorigin src="/assets/index-
|
|
14
|
+
<script type="module" crossorigin src="/assets/index-CGwuxvzr.js"></script>
|
|
15
15
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-aKtaBQYM.js">
|
|
16
16
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-zJ_50EbN.js">
|
|
17
17
|
<link rel="modulepreload" crossorigin href="/assets/vendor-react-BOUWij0V.js">
|
|
@@ -24,17 +24,17 @@
|
|
|
24
24
|
<link rel="modulepreload" crossorigin href="/assets/check-DUBLcKHA.js">
|
|
25
25
|
<link rel="modulepreload" crossorigin href="/assets/circle-alert-BEjgurr2.js">
|
|
26
26
|
<link rel="modulepreload" crossorigin href="/assets/middleware-Pd0e8Igk.js">
|
|
27
|
-
<link rel="modulepreload" crossorigin href="/assets/messages-
|
|
28
|
-
<link rel="modulepreload" crossorigin href="/assets/locale-store-
|
|
27
|
+
<link rel="modulepreload" crossorigin href="/assets/messages-C96Zjb0V.js">
|
|
28
|
+
<link rel="modulepreload" crossorigin href="/assets/locale-store-C_ax27uc.js">
|
|
29
29
|
<link rel="modulepreload" crossorigin href="/assets/cn-JdwAhgNB.js">
|
|
30
30
|
<link rel="modulepreload" crossorigin href="/assets/schemas-DgQq6Z5S.js">
|
|
31
31
|
<link rel="modulepreload" crossorigin href="/assets/product-delivery-BTRT9kCS.js">
|
|
32
32
|
<link rel="modulepreload" crossorigin href="/assets/config-reload-event-Bjh2zoKp.js">
|
|
33
33
|
<link rel="modulepreload" crossorigin href="/assets/copy-to-clipboard-HOJ79TWv.js">
|
|
34
|
-
<link rel="modulepreload" crossorigin href="/assets/gateway-startup-retry-
|
|
35
|
-
<link rel="modulepreload" crossorigin href="/assets/activity-store-
|
|
36
|
-
<link rel="modulepreload" crossorigin href="/assets/theme-store-
|
|
37
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
34
|
+
<link rel="modulepreload" crossorigin href="/assets/gateway-startup-retry-ulwTJovP.js">
|
|
35
|
+
<link rel="modulepreload" crossorigin href="/assets/activity-store-DkALQFJT.js">
|
|
36
|
+
<link rel="modulepreload" crossorigin href="/assets/theme-store-D37XLD_C.js">
|
|
37
|
+
<link rel="stylesheet" crossorigin href="/assets/index-BXtJvaQl.css">
|
|
38
38
|
</head>
|
|
39
39
|
<body>
|
|
40
40
|
<div id="root"></div>
|
package/dist/package.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type AgentRunErrorKind = 'provider_setup_required' | 'provider_auth_invalid' | 'rate_limit' | 'timeout' | 'billing' | 'unknown';
|
|
1
|
+
export type AgentRunErrorKind = 'provider_setup_required' | 'provider_auth_invalid' | 'rate_limit' | 'timeout' | 'billing' | 'xopc_quota_exhausted' | 'xopc_platform_limit' | 'unknown';
|
|
2
2
|
export type AgentRunErrorPayload = {
|
|
3
3
|
kind: AgentRunErrorKind;
|
|
4
4
|
code: string;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { classifyFailoverReason, isAuthErrorMessage } from "./fallback/reason.js";
|
|
2
2
|
//#region src/agent/client-error-format.ts
|
|
3
3
|
const API_KEY_MISSING_RE = /^No API key found for (\S+)/i;
|
|
4
|
+
const XOPC_QUOTA_RE = /model_quota_exhausted|model quota exhausted/i;
|
|
5
|
+
const XOPC_PLATFORM_LIMIT_RE = /platform_token_limit_exceeded|platform (?:hourly|daily) token limit reached/i;
|
|
4
6
|
function reasonToKind(reason) {
|
|
5
7
|
switch (reason) {
|
|
6
8
|
case "auth": return "provider_auth_invalid";
|
|
@@ -66,10 +68,12 @@ function formatAgentRunErrorForClient(rawError, context) {
|
|
|
66
68
|
});
|
|
67
69
|
}
|
|
68
70
|
const reason = classifyFailoverReason(trimmed);
|
|
69
|
-
const
|
|
71
|
+
const xopcPlatformLimit = context?.provider === "xopc-cloud" && XOPC_PLATFORM_LIMIT_RE.test(trimmed);
|
|
72
|
+
const xopcQuotaExhausted = context?.provider === "xopc-cloud" && (XOPC_QUOTA_RE.test(trimmed) || reason === "billing");
|
|
73
|
+
const kind = xopcPlatformLimit ? "xopc_platform_limit" : xopcQuotaExhausted ? "xopc_quota_exhausted" : reasonToKind(reason);
|
|
70
74
|
const payload = {
|
|
71
75
|
kind,
|
|
72
|
-
code: reasonToCode(reason),
|
|
76
|
+
code: xopcPlatformLimit ? "platform_token_limit_exceeded" : xopcQuotaExhausted ? "model_quota_exhausted" : reasonToCode(reason),
|
|
73
77
|
message: trimmed,
|
|
74
78
|
...context?.provider ? { provider: context.provider } : {},
|
|
75
79
|
...context?.modelRef ? { modelRef: context.modelRef } : {}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ModelRuntime } from '@earendil-works/pi-coding-agent';
|
|
2
|
+
export declare function resolveEmbeddedProviderApiKeySync(providerId: string): string | undefined;
|
|
3
|
+
export declare function createEmbeddedModelRuntime(): Promise<ModelRuntime>;
|
|
4
|
+
export declare function applyEmbeddedProviderCredential(modelRuntime: Pick<ModelRuntime, 'setRuntimeApiKey'>, providerId: string): Promise<void>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { init_paths, resolveModelsJsonPath } from "../../config/paths.js";
|
|
2
|
+
import { init_sync_provider_auth, resolveProviderApiKeySync } from "../../auth/sync-provider-auth.js";
|
|
3
|
+
import { getModelCatalogStore, init_model_catalog_store } from "../../providers/model-catalog-store.js";
|
|
4
|
+
import { CredentialResolver, init_credentials } from "../../auth/credentials.js";
|
|
5
|
+
import { getApiKeySync, init_providers } from "../../providers/index.js";
|
|
6
|
+
import { ModelRuntime } from "@earendil-works/pi-coding-agent";
|
|
7
|
+
import { InMemoryCredentialStore, InMemoryModelsStore } from "@earendil-works/pi-ai";
|
|
8
|
+
//#region src/agent/embedded/model-runtime.ts
|
|
9
|
+
init_credentials();
|
|
10
|
+
init_sync_provider_auth();
|
|
11
|
+
init_paths();
|
|
12
|
+
init_providers();
|
|
13
|
+
init_model_catalog_store();
|
|
14
|
+
function resolveEmbeddedProviderApiKeySync(providerId) {
|
|
15
|
+
return resolveProviderApiKeySync(providerId) ?? getApiKeySync(providerId);
|
|
16
|
+
}
|
|
17
|
+
async function createEmbeddedModelRuntime() {
|
|
18
|
+
const modelRuntime = await ModelRuntime.create({
|
|
19
|
+
credentials: new InMemoryCredentialStore(),
|
|
20
|
+
modelsPath: resolveModelsJsonPath(),
|
|
21
|
+
modelsStore: new InMemoryModelsStore()
|
|
22
|
+
});
|
|
23
|
+
for (const source of Object.values(getModelCatalogStore().load().sources)) modelRuntime.registerProvider(source.providerId, {
|
|
24
|
+
name: source.providerId,
|
|
25
|
+
baseUrl: source.baseUrl,
|
|
26
|
+
api: source.api,
|
|
27
|
+
models: source.models.filter((model) => model.availability === "available").map((model) => ({
|
|
28
|
+
id: model.id,
|
|
29
|
+
name: model.name,
|
|
30
|
+
reasoning: false,
|
|
31
|
+
input: ["text"],
|
|
32
|
+
cost: {
|
|
33
|
+
input: 0,
|
|
34
|
+
output: 0,
|
|
35
|
+
cacheRead: 0,
|
|
36
|
+
cacheWrite: 0
|
|
37
|
+
},
|
|
38
|
+
contextWindow: 128e3,
|
|
39
|
+
maxTokens: model.maxOutputTokens ?? 16384
|
|
40
|
+
}))
|
|
41
|
+
});
|
|
42
|
+
return modelRuntime;
|
|
43
|
+
}
|
|
44
|
+
async function applyEmbeddedProviderCredential(modelRuntime, providerId) {
|
|
45
|
+
const key = await new CredentialResolver().resolveApiKey(providerId) ?? getApiKeySync(providerId);
|
|
46
|
+
if (key && key !== "extension-managed") await modelRuntime.setRuntimeApiKey(providerId, key, { allowNetwork: false });
|
|
47
|
+
}
|
|
48
|
+
//#endregion
|
|
49
|
+
export { applyEmbeddedProviderCredential, createEmbeddedModelRuntime, resolveEmbeddedProviderApiKeySync };
|
|
@@ -16,10 +16,31 @@ async function runEmbeddedTurnForSession(params) {
|
|
|
16
16
|
await params.beforeTurn?.();
|
|
17
17
|
const agent = agentManager.getOrCreateAgent(sessionKey);
|
|
18
18
|
const mm = modelManager;
|
|
19
|
-
|
|
20
|
-
const
|
|
19
|
+
const configuredModelRef = String(mm.getModelForSession(sessionKey));
|
|
20
|
+
const candidates = typeof mm.getFallbackCandidatesForSession === "function" ? mm.getFallbackCandidatesForSession(sessionKey) : [];
|
|
21
|
+
const candidateModelRefs = candidates.length > 0 ? candidates.map((candidate) => `${candidate.provider}/${candidate.model}`) : [configuredModelRef];
|
|
22
|
+
const resolvedCandidates = [];
|
|
23
|
+
for (const [index, ref] of candidateModelRefs.entries()) try {
|
|
24
|
+
const resolved = index === 0 && typeof mm.getResolvedModelForSession === "function" ? mm.getResolvedModelForSession(sessionKey) : resolveModel(ref);
|
|
25
|
+
resolvedCandidates.push({
|
|
26
|
+
ref,
|
|
27
|
+
model: resolved
|
|
28
|
+
});
|
|
29
|
+
} catch (err) {
|
|
30
|
+
log.warn({
|
|
31
|
+
err,
|
|
32
|
+
sessionKey,
|
|
33
|
+
runId,
|
|
34
|
+
modelRef: ref
|
|
35
|
+
}, "Skipping unavailable model candidate");
|
|
36
|
+
}
|
|
37
|
+
const primary = resolvedCandidates[0];
|
|
38
|
+
if (!primary) throw new Error(`No available model candidates for '${configuredModelRef}'`);
|
|
39
|
+
const modelRef = primary.ref;
|
|
40
|
+
const model = primary.model;
|
|
41
|
+
if (typeof mm.applyResolvedModel === "function") mm.applyResolvedModel(agent, model, modelRef);
|
|
42
|
+
else await mm.applyModelForSession(agent, sessionKey);
|
|
21
43
|
agentManager.setModelForSession(sessionKey, modelRef);
|
|
22
|
-
const model = mm.getResolvedModelForSession(sessionKey);
|
|
23
44
|
const tools = agent.state.tools;
|
|
24
45
|
const systemPrompt = agent.state.systemPrompt ?? "";
|
|
25
46
|
const thinkingLevel = params.thinkingOverride ?? agent.state.thinkingLevel;
|
|
@@ -53,36 +74,22 @@ async function runEmbeddedTurnForSession(params) {
|
|
|
53
74
|
});
|
|
54
75
|
const turnTools = mergeTurnTools(tools, mcpResolved.tools);
|
|
55
76
|
try {
|
|
56
|
-
const candidates = typeof mm.getFallbackCandidatesForSession === "function" ? mm.getFallbackCandidatesForSession(sessionKey) : [];
|
|
57
|
-
const candidateModelRefs = candidates.length > 0 ? candidates.map((candidate) => `${candidate.provider}/${candidate.model}`) : [modelRef];
|
|
58
77
|
log.info({
|
|
59
78
|
sessionKey,
|
|
60
79
|
runId,
|
|
61
|
-
|
|
62
|
-
|
|
80
|
+
configuredModelRef,
|
|
81
|
+
primaryModelRef: modelRef,
|
|
82
|
+
candidateModelRefs: resolvedCandidates.map((candidate) => candidate.ref)
|
|
63
83
|
}, "Agent model fallback candidates resolved");
|
|
64
84
|
let lastResult;
|
|
65
85
|
let lastError;
|
|
66
|
-
const primaryModelRef =
|
|
86
|
+
const primaryModelRef = modelRef;
|
|
67
87
|
const beforeLen = Array.isArray(agent.state?.messages) ? agent.state.messages.length : void 0;
|
|
68
|
-
for (let i = 0; i <
|
|
69
|
-
const
|
|
88
|
+
for (let i = 0; i < resolvedCandidates.length; i++) {
|
|
89
|
+
const candidate = resolvedCandidates[i];
|
|
90
|
+
const candidateModelRef = candidate.ref;
|
|
70
91
|
const isFallbackAttempt = i > 0;
|
|
71
|
-
|
|
72
|
-
if (candidateModelRef !== modelRef) try {
|
|
73
|
-
candidateModel = resolveModel(candidateModelRef);
|
|
74
|
-
} catch (err) {
|
|
75
|
-
lastError = err;
|
|
76
|
-
log.warn({
|
|
77
|
-
err,
|
|
78
|
-
sessionKey,
|
|
79
|
-
runId,
|
|
80
|
-
modelRef: candidateModelRef,
|
|
81
|
-
attempt: i + 1,
|
|
82
|
-
total: candidateModelRefs.length
|
|
83
|
-
}, "Skipping model fallback candidate (resolve failed)");
|
|
84
|
-
continue;
|
|
85
|
-
}
|
|
92
|
+
const candidateModel = candidate.model;
|
|
86
93
|
if (typeof mm.applyResolvedModel === "function") mm.applyResolvedModel(agent, candidateModel, candidateModelRef);
|
|
87
94
|
agentManager.setModelForSession(sessionKey, candidateModelRef);
|
|
88
95
|
if (isFallbackAttempt) log.info({
|
|
@@ -91,7 +98,7 @@ async function runEmbeddedTurnForSession(params) {
|
|
|
91
98
|
primaryModelRef,
|
|
92
99
|
fallbackModelRef: candidateModelRef,
|
|
93
100
|
attempt: i + 1,
|
|
94
|
-
total:
|
|
101
|
+
total: resolvedCandidates.length
|
|
95
102
|
}, "Agent model fallback started");
|
|
96
103
|
try {
|
|
97
104
|
const turnResult = await runXopcEmbeddedTurn({
|
|
@@ -117,32 +124,32 @@ async function runEmbeddedTurnForSession(params) {
|
|
|
117
124
|
primaryModelRef,
|
|
118
125
|
fallbackModelRef: candidateModelRef,
|
|
119
126
|
attempt: i + 1,
|
|
120
|
-
total:
|
|
127
|
+
total: resolvedCandidates.length
|
|
121
128
|
}, "Agent model fallback succeeded");
|
|
122
129
|
return turnResult;
|
|
123
130
|
}
|
|
124
131
|
lastResult = turnResult;
|
|
125
|
-
const hasNextCandidate = i + 1 <
|
|
132
|
+
const hasNextCandidate = i + 1 < resolvedCandidates.length;
|
|
126
133
|
log.warn({
|
|
127
134
|
sessionKey,
|
|
128
135
|
runId,
|
|
129
136
|
modelRef: candidateModelRef,
|
|
130
137
|
attempt: i + 1,
|
|
131
|
-
total:
|
|
138
|
+
total: resolvedCandidates.length,
|
|
132
139
|
hasNextCandidate,
|
|
133
140
|
errorMessage: turnResult.errorMessage
|
|
134
141
|
}, hasNextCandidate ? "Agent model turn failed, trying fallback" : "Agent model turn failed, no fallback remains");
|
|
135
142
|
} catch (err) {
|
|
136
143
|
lastError = err;
|
|
137
144
|
if (err instanceof DOMException && err.name === "AbortError") throw err;
|
|
138
|
-
const hasNextCandidate = i + 1 <
|
|
145
|
+
const hasNextCandidate = i + 1 < resolvedCandidates.length;
|
|
139
146
|
log.warn({
|
|
140
147
|
err,
|
|
141
148
|
sessionKey,
|
|
142
149
|
runId,
|
|
143
150
|
modelRef: candidateModelRef,
|
|
144
151
|
attempt: i + 1,
|
|
145
|
-
total:
|
|
152
|
+
total: resolvedCandidates.length,
|
|
146
153
|
hasNextCandidate
|
|
147
154
|
}, hasNextCandidate ? "Agent model call threw, trying fallback" : "Agent model call threw, no fallback remains");
|
|
148
155
|
}
|
|
@@ -10,6 +10,7 @@ export type EmbeddedRunnerFingerprintInput = {
|
|
|
10
10
|
toolNames: readonly string[];
|
|
11
11
|
systemPrompt: string;
|
|
12
12
|
thinkingLevel: string;
|
|
13
|
+
credentialRevision: string;
|
|
13
14
|
};
|
|
14
15
|
export declare function buildEmbeddedRunnerFingerprint(input: EmbeddedRunnerFingerprintInput): string;
|
|
15
16
|
export type AcquireEmbeddedSessionRunnerParams = {
|
|
@@ -3,15 +3,20 @@ import { init_logger } from "../../utils/logger.js";
|
|
|
3
3
|
import { guardSessionManager } from "./session-tool-result-guard.js";
|
|
4
4
|
import { transformUserMessageForPersistence } from "../inbound/attachment-pipeline.js";
|
|
5
5
|
import { openSqliteHydratingSessionManager } from "./sqlite-hydrating-session-manager.js";
|
|
6
|
-
import {
|
|
6
|
+
import { applyEmbeddedProviderCredential, createEmbeddedModelRuntime, resolveEmbeddedProviderApiKeySync } from "./model-runtime.js";
|
|
7
7
|
import { wrapStreamFnForXopcExtensions } from "./xopc-stream-bridge.js";
|
|
8
8
|
import { xopcToolsToDefinitions } from "./xopc-tools-bridge.js";
|
|
9
9
|
import { applySystemPromptOverrideToSession } from "./system-prompt-override.js";
|
|
10
|
+
import { createHash } from "node:crypto";
|
|
10
11
|
import { DefaultResourceLoader, SettingsManager, createAgentSession, getAgentDir } from "@earendil-works/pi-coding-agent";
|
|
11
12
|
//#region src/agent/embedded/session-runner.ts
|
|
12
13
|
init_logger();
|
|
13
14
|
const log = createLogger("EmbeddedSessionRunner");
|
|
14
15
|
const DEFAULT_IDLE_TTL_MS = 5 * 6e4;
|
|
16
|
+
function providerCredentialRevision(providerId) {
|
|
17
|
+
const apiKey = resolveEmbeddedProviderApiKeySync(providerId);
|
|
18
|
+
return apiKey ? createHash("sha256").update(apiKey).digest("base64url") : "none";
|
|
19
|
+
}
|
|
15
20
|
function buildEmbeddedRunnerFingerprint(input) {
|
|
16
21
|
const tools = [...input.toolNames].sort().join("\0");
|
|
17
22
|
const promptMarker = `${input.systemPrompt.length}:${input.systemPrompt.slice(0, 128)}`;
|
|
@@ -21,7 +26,8 @@ function buildEmbeddedRunnerFingerprint(input) {
|
|
|
21
26
|
input.modelRef,
|
|
22
27
|
tools,
|
|
23
28
|
promptMarker,
|
|
24
|
-
input.thinkingLevel
|
|
29
|
+
input.thinkingLevel,
|
|
30
|
+
input.credentialRevision
|
|
25
31
|
].join("");
|
|
26
32
|
}
|
|
27
33
|
function isEmbeddedSessionRunnerEnabled() {
|
|
@@ -91,7 +97,8 @@ var EmbeddedSessionRunnerPool = class {
|
|
|
91
97
|
modelRef: params.modelRef,
|
|
92
98
|
toolNames: params.tools.map((t) => t.name),
|
|
93
99
|
systemPrompt: params.systemPrompt,
|
|
94
|
-
thinkingLevel: params.thinkingLevel ?? "medium"
|
|
100
|
+
thinkingLevel: params.thinkingLevel ?? "medium",
|
|
101
|
+
credentialRevision: providerCredentialRevision(params.model.provider)
|
|
95
102
|
});
|
|
96
103
|
const reuseEnabled = this.isEnabledFn();
|
|
97
104
|
const existing = this.pool.get(params.sessionKey);
|
|
@@ -168,7 +175,7 @@ var EmbeddedSessionRunnerPool = class {
|
|
|
168
175
|
const toolDefs = xopcToolsToDefinitions(tools);
|
|
169
176
|
const toolNames = tools.map((t) => t.name);
|
|
170
177
|
const modelRuntime = await createEmbeddedModelRuntime();
|
|
171
|
-
await
|
|
178
|
+
await applyEmbeddedProviderCredential(modelRuntime, model.provider);
|
|
172
179
|
const resourceLoader = new DefaultResourceLoader({
|
|
173
180
|
cwd: workspaceDir,
|
|
174
181
|
agentDir: getAgentDir(),
|
|
@@ -199,7 +206,8 @@ var EmbeddedSessionRunnerPool = class {
|
|
|
199
206
|
modelRef: params.modelRef,
|
|
200
207
|
toolNames,
|
|
201
208
|
systemPrompt,
|
|
202
|
-
thinkingLevel: thinkingLevel ?? "medium"
|
|
209
|
+
thinkingLevel: thinkingLevel ?? "medium",
|
|
210
|
+
credentialRevision: providerCredentialRevision(model.provider)
|
|
203
211
|
}),
|
|
204
212
|
session,
|
|
205
213
|
piSm,
|
|
@@ -19,7 +19,7 @@ export type FailoverReason = 'timeout' | 'aborted' | 'auth' | 'rate_limit' | 'ba
|
|
|
19
19
|
export interface FallbackAttempt {
|
|
20
20
|
/** Provider id, e.g. "openai". */
|
|
21
21
|
provider: string;
|
|
22
|
-
/** Model id, e.g. "gpt-image-
|
|
22
|
+
/** Model id, e.g. "gpt-image-2". */
|
|
23
23
|
model: string;
|
|
24
24
|
/** Short, human-readable failure summary. */
|
|
25
25
|
error: string;
|
|
@@ -5,13 +5,12 @@
|
|
|
5
5
|
* speak the same `/images/generations` and `/images/edits` REST shape.
|
|
6
6
|
* This factory wraps that wire format on top of shared provider HTTP, normalization,
|
|
7
7
|
* and auth-runtime so vendor modules only need to declare:
|
|
8
|
-
* - id /
|
|
8
|
+
* - id / models / capabilities
|
|
9
9
|
* - baseUrl resolution
|
|
10
10
|
* - apiKey resolution
|
|
11
11
|
* - optional request body / response transforms
|
|
12
12
|
*
|
|
13
13
|
*/
|
|
14
|
-
import type { ImageProviderUiMetadata } from './image-provider-ui.js';
|
|
15
14
|
import type { GeneratedImageAsset, ImageGenerationProvider, ImageGenerationProviderCapabilities, ImageGenerationProviderConfiguredContext, ImageGenerationRequest } from './types.js';
|
|
16
15
|
/** Subset of the official OpenAI image response we map. */
|
|
17
16
|
export interface OpenAiCompatibleImageResponse {
|
|
@@ -46,8 +45,7 @@ export interface OpenAiCompatibleEndpointResolution {
|
|
|
46
45
|
}
|
|
47
46
|
export interface OpenAiCompatibleImageProviderOptions {
|
|
48
47
|
id: string;
|
|
49
|
-
|
|
50
|
-
label?: string;
|
|
48
|
+
label: string;
|
|
51
49
|
defaultModel: string;
|
|
52
50
|
models: string[];
|
|
53
51
|
capabilities: ImageGenerationProviderCapabilities;
|
|
@@ -74,8 +72,6 @@ export interface OpenAiCompatibleImageProviderOptions {
|
|
|
74
72
|
/** Default count clamp. Provider may also enforce via `capabilities.generate.maxCount`. */
|
|
75
73
|
defaultCount?: number;
|
|
76
74
|
defaultSize?: string;
|
|
77
|
-
/** Gateway console presets for `cfg.providers.<id>.baseUrl`. */
|
|
78
|
-
ui?: ImageProviderUiMetadata;
|
|
79
75
|
}
|
|
80
76
|
export declare function createOpenAiCompatibleImageProvider(options: OpenAiCompatibleImageProviderOptions): ImageGenerationProvider;
|
|
81
77
|
export declare function mapDefaultOpenAiResponse(raw: unknown, req: ImageGenerationRequest): GeneratedImageAsset[];
|
|
@@ -17,13 +17,11 @@ function createOpenAiCompatibleImageProvider(options) {
|
|
|
17
17
|
const defaultSize = options.defaultSize ?? "1024x1024";
|
|
18
18
|
return {
|
|
19
19
|
id: options.id,
|
|
20
|
-
|
|
21
|
-
...options.label ? { label: options.label } : {},
|
|
20
|
+
label: options.label,
|
|
22
21
|
defaultModel: options.defaultModel,
|
|
23
22
|
models: options.models,
|
|
24
23
|
capabilities: options.capabilities,
|
|
25
24
|
isConfigured: options.isConfigured,
|
|
26
|
-
...options.ui ? { ui: options.ui } : {},
|
|
27
25
|
async generateImage(req) {
|
|
28
26
|
const apiKey = options.resolveApiKey(req) ?? null;
|
|
29
27
|
const endpoint = options.resolveEndpoint(req);
|
|
@@ -1,46 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export
|
|
6
|
-
cfg?: Config;
|
|
7
|
-
agentDir?: string;
|
|
8
|
-
}
|
|
9
|
-
export interface ImageGenerationProvider {
|
|
10
|
-
/** Lower-case provider id (registry key). */
|
|
11
|
-
id: string;
|
|
12
|
-
/** Optional aliases — alternate ids that resolve to this provider. */
|
|
13
|
-
aliases?: string[];
|
|
14
|
-
label?: string;
|
|
15
|
-
defaultModel?: string;
|
|
16
|
-
models?: string[];
|
|
17
|
-
/** Provider capability map. */
|
|
18
|
-
capabilities?: ImageGenerationProviderCapabilities;
|
|
19
|
-
/**
|
|
20
|
-
* Synchronous configuration check (Step 2 — was async in Step 1).
|
|
21
|
-
* MUST NOT touch keychain or trigger OS prompts.
|
|
22
|
-
*/
|
|
23
|
-
isConfigured?: (ctx: ImageGenerationProviderConfiguredContext) => boolean;
|
|
24
|
-
/** Gateway console presets (regions / base URLs); defined by each bundled extension. */
|
|
25
|
-
ui?: ImageProviderUiMetadata;
|
|
26
|
-
generateImage(req: ImageGenerationRequest): Promise<ImageGenerationResult>;
|
|
27
|
-
}
|
|
28
|
-
export declare function registerImageGenerationProvider(provider: ImageGenerationProvider): void;
|
|
29
|
-
/**
|
|
30
|
-
* Resolve a provider by id or alias.
|
|
31
|
-
*
|
|
32
|
-
* `cfg` is honoured to skip providers disabled via `cfg.extensions[<id>].enabled = false`.
|
|
33
|
-
*/
|
|
34
|
-
export declare function getImageGenerationProvider(providerId: string, cfg?: Config): ImageGenerationProvider | undefined;
|
|
35
|
-
export declare function listImageGenerationProviders(cfg?: Config): ImageGenerationProvider[];
|
|
36
|
-
export interface ImageGenerationProviderSummary {
|
|
37
|
-
id: string;
|
|
38
|
-
label?: string;
|
|
39
|
-
defaultModel?: string;
|
|
40
|
-
models: string[];
|
|
41
|
-
aliases?: string[];
|
|
42
|
-
capabilities?: ImageGenerationProviderCapabilities;
|
|
43
|
-
ui?: ImageProviderUiMetadata;
|
|
44
|
-
}
|
|
45
|
-
export declare function listImageGenerationProvidersSummary(cfg?: Config): ImageGenerationProviderSummary[];
|
|
46
|
-
export declare function clearImageGenerationRegistryForTests(): void;
|
|
1
|
+
import type { ImageGenerationProvider, ImageGenerationProviderSummary } from './types.js';
|
|
2
|
+
export declare function getImageGenerationProvider(providerId: string): ImageGenerationProvider | undefined;
|
|
3
|
+
export declare function listImageGenerationProviders(): ImageGenerationProvider[];
|
|
4
|
+
export declare function listImageGenerationProvidersSummary(): ImageGenerationProviderSummary[];
|
|
5
|
+
export type { ImageGenerationProvider, ImageGenerationProviderSummary } from './types.js';
|
|
@@ -1,80 +1,31 @@
|
|
|
1
|
+
import { buildDashScopeImageGenerationProvider } from "./providers/dashscope.js";
|
|
2
|
+
import { buildFalImageGenerationProvider } from "./providers/fal.js";
|
|
3
|
+
import { buildGoogleImageGenerationProvider } from "./providers/google.js";
|
|
4
|
+
import { buildMinimaxImageGenerationProvider } from "./providers/minimax.js";
|
|
5
|
+
import { buildOpenAIImageGenerationProvider } from "./providers/openai.js";
|
|
1
6
|
//#region src/agent/image/generation/provider-registry.ts
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const aliasIndex = /* @__PURE__ */ new Map();
|
|
13
|
-
function normalizeId(id) {
|
|
14
|
-
return id.trim().toLowerCase();
|
|
7
|
+
const providers = [
|
|
8
|
+
buildOpenAIImageGenerationProvider(),
|
|
9
|
+
buildDashScopeImageGenerationProvider(),
|
|
10
|
+
buildMinimaxImageGenerationProvider(),
|
|
11
|
+
buildGoogleImageGenerationProvider(),
|
|
12
|
+
buildFalImageGenerationProvider()
|
|
13
|
+
];
|
|
14
|
+
const providersById = new Map(providers.map((provider) => [provider.id, provider]));
|
|
15
|
+
function getImageGenerationProvider(providerId) {
|
|
16
|
+
return providersById.get(providerId);
|
|
15
17
|
}
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
const extensions = cfg?.extensions;
|
|
19
|
-
if (!extensions || typeof extensions !== "object") return false;
|
|
20
|
-
const entry = extensions[providerId];
|
|
21
|
-
if (!entry || typeof entry !== "object") return false;
|
|
22
|
-
return entry.enabled === false;
|
|
18
|
+
function listImageGenerationProviders() {
|
|
19
|
+
return [...providers];
|
|
23
20
|
}
|
|
24
|
-
function
|
|
25
|
-
|
|
26
|
-
const id = normalizeId(provider.id);
|
|
27
|
-
if (UNSAFE_PROVIDER_IDS.has(id)) throw new Error(`Image generation provider id is reserved: ${provider.id}`);
|
|
28
|
-
for (const [alias, target] of [...aliasIndex.entries()]) if (target === id) aliasIndex.delete(alias);
|
|
29
|
-
registry.set(id, provider);
|
|
30
|
-
for (const aliasRaw of provider.aliases ?? []) {
|
|
31
|
-
if (typeof aliasRaw !== "string") continue;
|
|
32
|
-
const alias = normalizeId(aliasRaw);
|
|
33
|
-
if (!alias || alias === id) continue;
|
|
34
|
-
if (UNSAFE_PROVIDER_IDS.has(alias)) continue;
|
|
35
|
-
if (registry.has(alias)) continue;
|
|
36
|
-
aliasIndex.set(alias, id);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Resolve a provider by id or alias.
|
|
41
|
-
*
|
|
42
|
-
* `cfg` is honoured to skip providers disabled via `cfg.extensions[<id>].enabled = false`.
|
|
43
|
-
*/
|
|
44
|
-
function getImageGenerationProvider(providerId, cfg) {
|
|
45
|
-
if (typeof providerId !== "string") return void 0;
|
|
46
|
-
const id = normalizeId(providerId);
|
|
47
|
-
if (!id) return void 0;
|
|
48
|
-
const direct = registry.get(id);
|
|
49
|
-
if (direct) return isExtensionDisabled(cfg, direct.id) ? void 0 : direct;
|
|
50
|
-
const aliasTarget = aliasIndex.get(id);
|
|
51
|
-
if (!aliasTarget) return void 0;
|
|
52
|
-
const aliased = registry.get(aliasTarget);
|
|
53
|
-
if (!aliased) return void 0;
|
|
54
|
-
return isExtensionDisabled(cfg, aliased.id) ? void 0 : aliased;
|
|
55
|
-
}
|
|
56
|
-
function listImageGenerationProviders(cfg) {
|
|
57
|
-
const out = [];
|
|
58
|
-
for (const provider of registry.values()) {
|
|
59
|
-
if (isExtensionDisabled(cfg, provider.id)) continue;
|
|
60
|
-
out.push(provider);
|
|
61
|
-
}
|
|
62
|
-
return out;
|
|
63
|
-
}
|
|
64
|
-
function listImageGenerationProvidersSummary(cfg) {
|
|
65
|
-
return listImageGenerationProviders(cfg).map((provider) => ({
|
|
21
|
+
function listImageGenerationProvidersSummary() {
|
|
22
|
+
return providers.map((provider) => ({
|
|
66
23
|
id: provider.id,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
models: provider.models
|
|
70
|
-
|
|
71
|
-
...provider.capabilities ? { capabilities: provider.capabilities } : {},
|
|
72
|
-
...provider.ui ? { ui: provider.ui } : {}
|
|
24
|
+
label: provider.label,
|
|
25
|
+
defaultModel: provider.defaultModel,
|
|
26
|
+
models: [...provider.models],
|
|
27
|
+
capabilities: provider.capabilities
|
|
73
28
|
}));
|
|
74
29
|
}
|
|
75
|
-
function clearImageGenerationRegistryForTests() {
|
|
76
|
-
registry.clear();
|
|
77
|
-
aliasIndex.clear();
|
|
78
|
-
}
|
|
79
30
|
//#endregion
|
|
80
|
-
export {
|
|
31
|
+
export { getImageGenerationProvider, listImageGenerationProviders, listImageGenerationProvidersSummary };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ImageGenerationProvider, ImageGenerationRequest, ImageGenerationResult } from '
|
|
1
|
+
import type { ImageGenerationProvider, ImageGenerationRequest, ImageGenerationResult } from '../types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Wan image model ids for **HTTP synchronous** `multimodal-generation/generation`.
|
|
4
4
|
* - **2.7** (`wan2.7-image-pro` / `wan2.7-image`): see Wan 2.7 image API (size presets 1K/2K/4K, `thinking_mode`, …).
|
|
@@ -19,7 +19,7 @@ export declare const DASHSCOPE_IMAGE_ENDPOINTS: {
|
|
|
19
19
|
readonly singapore: "https://dashscope-intl.aliyuncs.com/api/v1/services/aigc/multimodal-generation/generation";
|
|
20
20
|
};
|
|
21
21
|
export type DashScopeImageRegion = keyof typeof DASHSCOPE_IMAGE_ENDPOINTS;
|
|
22
|
-
export declare function resolveDashScopeImageGenerationUrl(req
|
|
22
|
+
export declare function resolveDashScopeImageGenerationUrl(req: ImageGenerationRequest): string;
|
|
23
23
|
/** Map tool size (e.g. `1024x1024`) to DashScope `宽*高` format. */
|
|
24
24
|
export declare function mapSizeToDashScopeFormat(size?: string): string;
|
|
25
25
|
export declare function isWan27ImageModel(model: string): boolean;
|
|
@@ -31,8 +31,5 @@ export declare function mapSizeToWan27Format(size: string | undefined, modelId:
|
|
|
31
31
|
export declare function generateDashScopeImages(params: {
|
|
32
32
|
req: ImageGenerationRequest;
|
|
33
33
|
apiKey: string;
|
|
34
|
-
providerId?: string;
|
|
35
|
-
defaultRegion?: DashScopeImageRegion;
|
|
36
34
|
}): Promise<ImageGenerationResult>;
|
|
37
|
-
export declare function
|
|
38
|
-
export declare function buildDashScopeIntlImageGenerationProvider(): ImageGenerationProvider;
|
|
35
|
+
export declare function buildDashScopeImageGenerationProvider(): ImageGenerationProvider;
|