@xopcai/xopc 0.0.162 → 0.0.163
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-Xj95LzTv.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Zf9UQEmQ.js → agent-avatar-dicebear-C-QeUFwU.js} +1 -1
- package/dist/gateway/static/root/assets/agents-DVKlWKJE.js +2 -0
- package/dist/gateway/static/root/assets/{api-Dnatri09.js → api-BTLmAm1_.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-BBTR9wJP.js → app-management-settings-panel-zc6Gf-S5.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-C2zpLCHD.js → appearance-settings-0fMLnOWn.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-BZXEJDIV.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-9eR_ODY1.js → archive-plugin-DOiR_E21.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-DPuWYUeX.js → attachment-load-BxmYl1D1.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-suggestion-card-Dw49OJRl.js → automation-suggestion-card-BhZOirad.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-B8CnkoXv.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-BdkJpDFm.js → binary-plugins-DTTKsvgk.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-CAi7SXYU.js → block-editor-C7se7iqg.js} +31 -31
- package/dist/gateway/static/root/assets/browser-settings-page-BCPWKI9V.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-Dx6wkGz1.js → browser-workflow-inputs-kxmStCcv.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-Skertc-A.js → browser-workflows-page-CwYf9OM_.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-C7lr_mX2.js +2 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-CNFl7dM3.js → capability-presets-api-BZKh2cWX.js} +1 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-Ble9kHRu.js +2 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-DYQyGDw4.js → channel-recipient-api-r7tdbnJE.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-CtQQQHrv.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-_VirfMKW.js +1 -0
- package/dist/gateway/static/root/assets/{connector-logo-Bng6kxYF.js → connector-logo-BpnQYAxA.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-BXWJSJeY.js +2 -0
- package/dist/gateway/static/root/assets/desktop-pet-B86W4a5c.js +1 -0
- package/dist/gateway/static/root/assets/{desktop-pet-settings-BVUyefSd.js → desktop-pet-settings-uv8Grtgk.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-DjSZAPz_.js → directory-picker-path-field-C4TTvf7p.js} +1 -1
- package/dist/gateway/static/root/assets/{dreaming-settings-CAZk2AM4.js → dreaming-settings-CzJAUPvM.js} +2 -2
- package/dist/gateway/static/root/assets/{extension-debug-page-C2F6vTTd.js → extension-debug-page-Ci2mOYUt.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-AnIt4bn4.js → extension-page-DeXdmhXQ.js} +1 -1
- package/dist/gateway/static/root/assets/extension-settings-page-C93vaOsU.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-api-DLFyZv33.js → gateway-config-api-C31Hlblp.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-DnQAA-qq.js → gateway-settings-D3zS6RZh.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-DbzLyJ3R.js → gateway-startup-retry-CSRvCqxh.js} +1 -1
- package/dist/gateway/static/root/assets/{goal-create-dialog-DrnKFC6M.js → goal-create-dialog-CWp2b7__.js} +1 -1
- package/dist/gateway/static/root/assets/goal-detail-page-Dtm29FxD.js +4 -0
- package/dist/gateway/static/root/assets/{goals-config-api-REmr3QCr.js → goals-config-api-D4wYNRrf.js} +1 -1
- package/dist/gateway/static/root/assets/goals-page-jMzBJs6e.js +2 -0
- package/dist/gateway/static/root/assets/{goals-settings-Dz0F3uRO.js → goals-settings-Bx2jVvhQ.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-CQFY5gYs.js → heartbeat-settings-BEIF1eXy.js} +1 -1
- package/dist/gateway/static/root/assets/index-BXtJvaQl.css +1 -0
- package/dist/gateway/static/root/assets/{index-C8JkTS6d.js → index-HZdBKfk_.js} +70 -70
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BnOQXU5k.js → keyboard-shortcuts-settings-DOEDpvTM.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-CseW9jD3.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-KsOtWOyM.js → local-apps-page-B0OpGpxv.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-0lpYdNDr.js → locale-store-Ys6RP7Be.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-DVqPbth5.js +7 -0
- package/dist/gateway/static/root/assets/{markdown-split-D5GRg10r.js → markdown-split-CEZwysCH.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-C1ryULGs.js → media-plugins-CpGKE7B0.js} +1 -1
- package/dist/gateway/static/root/assets/messages-BzI9Wx30.js +5 -0
- package/dist/gateway/static/root/assets/{notes-page-CIeZ1_DT.js → notes-page-CdiuDZ5a.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-mrc3xtpn.js +4 -0
- package/dist/gateway/static/root/assets/{page-tabs-Caj1-E_X.js → page-tabs-BkH5AVV2.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-DKwEce-9.js → preview-open-alternatives-CQai8f9D.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-B90ZskkN.js → product-open-page-B2kSdB2b.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-CfhPJLkH.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-BfMoKjdm.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-CrDtcsZ9.js +1 -0
- package/dist/gateway/static/root/assets/{save-bar-controls-BDYt53uQ.js → save-bar-controls-NGYnO7n7.js} +1 -1
- package/dist/gateway/static/root/assets/schedule-field-nLOphnv3.js +1 -0
- package/dist/gateway/static/root/assets/{schema-form-D7oCARF7.js → schema-form-D0e90ndE.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-D3DbF3dV.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-BZp0O2dH.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-CARTHCxH.js → settings-form-section-X2Sl-EAk.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-DEwYqESe.js → settings-loading-skeleton-DOnUabm7.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-B6vVdHeQ.js → settings-page-C4UUNi1n.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-D3srt5Bi.js → settings-page-layout-C1yYqbT6.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-84iao4DZ.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-Ck9SxiXw.js → share-preview-page-Cfy_pH7V.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-DtcwQvRG.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-L7j5Gc8Z.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-1Ps8PjsP.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-DLBUQSk2.js → system-settings-panel-Da81RJ6G.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-C1oaqeD2.js → theme-store-DflSp9o4.js} +1 -1
- package/dist/gateway/static/root/assets/time-picker-BIkOW-2L.js +1 -0
- package/dist/gateway/static/root/assets/{typed-models-lib-Divbg_C4.js → typed-models-lib--HptwFcD.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-CP9a_rAf.js → use-channel-catalog-CMHY4ZfW.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-BYAAs2iW.js +1 -0
- package/dist/gateway/static/root/assets/voice-api-key-field-nvIZerol.js +1 -0
- package/dist/gateway/static/root/assets/work-discovery-page-J35JkJ7_.js +1 -0
- package/dist/gateway/static/root/assets/work-item-detail-page-C4wYDYqV.js +1 -0
- package/dist/gateway/static/root/assets/work-page-DMvitV6c.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DbDPYQwB.js → workflow-run-setup-panel-D96MHABy.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-JMN0nMbM.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/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 +12 -4
- 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/sync-provider-auth.d.ts +3 -0
- package/dist/src/auth/sync-provider-auth.js +12 -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/config/index.js +2 -2
- package/dist/src/config/models-json.d.ts +6 -0
- package/dist/src/config/models-json.js +2 -6
- package/dist/src/config/schema.d.ts +26 -15
- package/dist/src/config/schema.js +23 -12
- 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/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 +151 -129
- 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/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 +22 -0
- package/dist/src/providers/domestic-presets.js +25 -0
- package/dist/src/providers/model-catalog-store.d.ts +71 -0
- package/dist/src/providers/model-catalog-store.js +102 -0
- package/dist/src/providers/model-catalog-sync-service.d.ts +41 -0
- package/dist/src/providers/model-catalog-sync-service.js +142 -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 +35 -2
- package/dist/src/providers/presentation.js +2 -0
- package/dist/src/providers/xopc-cloud-connection.d.ts +51 -0
- package/dist/src/providers/xopc-cloud-connection.js +196 -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/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/desktop-pet-Bpf6oegd.js +0 -1
- package/dist/gateway/static/root/assets/extension-settings-page-CLSc6682.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/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-HZdBKfk_.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-BzI9Wx30.js">
|
|
28
|
+
<link rel="modulepreload" crossorigin href="/assets/locale-store-Ys6RP7Be.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-CSRvCqxh.js">
|
|
35
|
+
<link rel="modulepreload" crossorigin href="/assets/activity-store-Xj95LzTv.js">
|
|
36
|
+
<link rel="modulepreload" crossorigin href="/assets/theme-store-DflSp9o4.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 } : {}
|
|
@@ -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 { applyXopcProviderApiKey, createEmbeddedModelRuntime } from "./xopc-auth-storage.js";
|
|
6
|
+
import { applyXopcProviderApiKey, createEmbeddedModelRuntime, resolveXopcProviderApiKey } from "./xopc-auth-storage.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 = resolveXopcProviderApiKey(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);
|
|
@@ -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;
|
|
@@ -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 };
|