@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
|
@@ -5,8 +5,10 @@ import type { ToolModelConfig } from '../image/tool-model-config.js';
|
|
|
5
5
|
export { parseImageDataUrl };
|
|
6
6
|
export declare function resolveImageGenerationModelConfigForTool(params: {
|
|
7
7
|
cfg?: Config;
|
|
8
|
+
agentId: string;
|
|
8
9
|
}): ToolModelConfig | null;
|
|
9
10
|
export declare function createImageGenerateTool(options: {
|
|
10
11
|
config?: Config;
|
|
11
12
|
workspace: string;
|
|
13
|
+
agentId: string;
|
|
12
14
|
}): AgentTool<any, Record<string, unknown>> | null;
|
|
@@ -37,7 +37,7 @@ const ALLOWED_RESOLUTIONS = [
|
|
|
37
37
|
const ImageGenerateToolSchema = Type.Object({
|
|
38
38
|
action: Type.Optional(Type.String({ description: "Optional: \"generate\" (default) or \"list\" available image-generation providers." })),
|
|
39
39
|
prompt: Type.Optional(Type.String({ description: "Image generation prompt." })),
|
|
40
|
-
model: Type.Optional(Type.String({ description: "Optional provider/model override, e.g. openai/gpt-image-
|
|
40
|
+
model: Type.Optional(Type.String({ description: "Optional provider/model override, e.g. openai/gpt-image-2 / dashscope/wan2.7-image-pro / minimax/image-01." })),
|
|
41
41
|
filename: Type.Optional(Type.String({ description: "Optional basename hint for saved files." })),
|
|
42
42
|
size: Type.Optional(Type.String({ description: "Optional pixel size, e.g. 1024x1024." })),
|
|
43
43
|
aspectRatio: Type.Optional(Type.String({ description: "Optional aspect ratio, e.g. 16:9 / 9:16 / 1:1." })),
|
|
@@ -126,20 +126,23 @@ async function loadInputImages(params) {
|
|
|
126
126
|
return out;
|
|
127
127
|
}
|
|
128
128
|
function resolveImageGenerationModelConfigForTool(params) {
|
|
129
|
-
const explicit = params.cfg ? getAgentDefaultImageGenerationModelConfig(params.cfg) : void 0;
|
|
129
|
+
const explicit = params.cfg ? getAgentDefaultImageGenerationModelConfig(params.cfg, params.agentId) : void 0;
|
|
130
130
|
if (explicit?.primary?.trim()) return {
|
|
131
131
|
primary: explicit.primary.trim(),
|
|
132
132
|
...explicit.fallbacks?.length ? { fallbacks: explicit.fallbacks } : {},
|
|
133
133
|
...explicit.timeoutMs ? { timeoutMs: explicit.timeoutMs } : {},
|
|
134
134
|
...explicit.autoProviderFallback ? { autoProviderFallback: true } : {}
|
|
135
135
|
};
|
|
136
|
-
const providers = listImageGenerationProvidersSummary(
|
|
136
|
+
const providers = listImageGenerationProvidersSummary();
|
|
137
137
|
const candidates = [];
|
|
138
138
|
for (const providerSummary of providers) {
|
|
139
|
-
const provider = getImageGenerationProvider(providerSummary.id
|
|
139
|
+
const provider = getImageGenerationProvider(providerSummary.id);
|
|
140
140
|
let configured = false;
|
|
141
141
|
try {
|
|
142
|
-
configured = provider?.isConfigured?.({
|
|
142
|
+
configured = provider?.isConfigured?.({
|
|
143
|
+
cfg: params.cfg,
|
|
144
|
+
agentId: params.agentId
|
|
145
|
+
}) ?? false;
|
|
143
146
|
} catch {
|
|
144
147
|
configured = false;
|
|
145
148
|
}
|
|
@@ -169,7 +172,10 @@ async function saveGeneratedImages(params) {
|
|
|
169
172
|
return out;
|
|
170
173
|
}
|
|
171
174
|
function createImageGenerateTool(options) {
|
|
172
|
-
const imageGenerationModelConfig = resolveImageGenerationModelConfigForTool({
|
|
175
|
+
const imageGenerationModelConfig = resolveImageGenerationModelConfigForTool({
|
|
176
|
+
cfg: options.config,
|
|
177
|
+
agentId: options.agentId
|
|
178
|
+
});
|
|
173
179
|
if (!imageGenerationModelConfig) return null;
|
|
174
180
|
const effectiveCfg = applyImageGenerationModelConfigDefaults(options.config, imageGenerationModelConfig) ?? options.config;
|
|
175
181
|
return {
|
|
@@ -181,7 +187,7 @@ function createImageGenerateTool(options) {
|
|
|
181
187
|
const params = args;
|
|
182
188
|
const action = (readStringParam(params, "action") || "generate").toLowerCase();
|
|
183
189
|
if (action === "list") {
|
|
184
|
-
const providers = listImageGenerationProvidersSummary(
|
|
190
|
+
const providers = listImageGenerationProvidersSummary();
|
|
185
191
|
return {
|
|
186
192
|
content: [{
|
|
187
193
|
type: "text",
|
|
@@ -234,6 +240,7 @@ function createImageGenerateTool(options) {
|
|
|
234
240
|
try {
|
|
235
241
|
const result = await generateImage({
|
|
236
242
|
cfg: effectiveCfg,
|
|
243
|
+
agentId: options.agentId,
|
|
237
244
|
modelConfig: imageGenerationModelConfig,
|
|
238
245
|
prompt,
|
|
239
246
|
...modelOverride ? { modelOverride } : {},
|
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
* Synchronous checks that mirror CredentialResolver.resolveApiKey sources
|
|
3
3
|
* used by isProviderConfiguredSync (fallback candidate filtering).
|
|
4
4
|
*/
|
|
5
|
+
import type { Config } from '../config/schema.js';
|
|
5
6
|
/**
|
|
6
7
|
* Synchronous API key / OAuth access for {@link Agent} `getApiKey` (pi-agent requires sync).
|
|
7
8
|
* Order: default agent auth-profiles → global auth-profiles → OAuth token file.
|
|
8
9
|
* Does not read standard env vars or models.json registry — callers chain `getApiKeySync` after this.
|
|
9
10
|
*/
|
|
10
11
|
export declare function resolveProviderApiKeySync(provider: string): string | undefined;
|
|
12
|
+
/** Resolve one agent's private credential, then the shared credential and OAuth token. */
|
|
13
|
+
export declare function resolveProviderApiKeyForAgentSync(provider: string, agentId?: string, config?: Config): string | undefined;
|
|
11
14
|
/**
|
|
12
15
|
* True if credentials exist in auth profiles (global or agent) or OAuth store,
|
|
13
16
|
* matching async CredentialResolver resolution (excluding env — callers check env separately).
|
|
@@ -88,6 +88,17 @@ function resolveProviderApiKeySync(provider) {
|
|
|
88
88
|
if (fromGlobal) return fromGlobal;
|
|
89
89
|
return readOAuthAccessTokenSync(normalized);
|
|
90
90
|
}
|
|
91
|
+
/** Resolve one agent's private credential, then the shared credential and OAuth token. */
|
|
92
|
+
function resolveProviderApiKeyForAgentSync(provider, agentId, config) {
|
|
93
|
+
const normalized = provider.toLowerCase();
|
|
94
|
+
if (agentId?.trim()) {
|
|
95
|
+
const fromAgent = readApiKeyFromProfilesFile(resolveAgentAuthProfilesPath(config ?? loadConfig(), agentId.trim()), normalized);
|
|
96
|
+
if (fromAgent) return fromAgent;
|
|
97
|
+
}
|
|
98
|
+
const fromGlobal = readApiKeyFromProfilesFile(resolveAuthProfilesPath(), normalized);
|
|
99
|
+
if (fromGlobal) return fromGlobal;
|
|
100
|
+
return readOAuthAccessTokenSync(normalized);
|
|
101
|
+
}
|
|
91
102
|
/**
|
|
92
103
|
* True if credentials exist in auth profiles (global or agent) or OAuth store,
|
|
93
104
|
* matching async CredentialResolver resolution (excluding env — callers check env separately).
|
|
@@ -106,4 +117,4 @@ var init_sync_provider_auth = __esmMin((() => {
|
|
|
106
117
|
}));
|
|
107
118
|
//#endregion
|
|
108
119
|
init_sync_provider_auth();
|
|
109
|
-
export { hasProviderAuthOnDiskSync, init_sync_provider_auth, resolveProviderApiKeySync };
|
|
120
|
+
export { hasProviderAuthOnDiskSync, init_sync_provider_auth, resolveProviderApiKeyForAgentSync, resolveProviderApiKeySync };
|
|
@@ -15,14 +15,11 @@ init_credentials();
|
|
|
15
15
|
init_schema();
|
|
16
16
|
init_providers();
|
|
17
17
|
const IMAGE_GENERATION_IDS = new Set([
|
|
18
|
-
"gpt-image-
|
|
19
|
-
"
|
|
20
|
-
"dall-e-2",
|
|
18
|
+
"gpt-image-2",
|
|
19
|
+
"gpt-image-1.5",
|
|
21
20
|
"wan2.6-t2i",
|
|
22
21
|
"wan2.7-image-pro",
|
|
23
22
|
"wan2.7-image",
|
|
24
|
-
"wan2.1-t2i-turbo",
|
|
25
|
-
"wan2.1-t2i-plus",
|
|
26
23
|
"image-01",
|
|
27
24
|
"image-01-live"
|
|
28
25
|
]);
|
|
@@ -301,7 +301,7 @@ function resolvePresetEnvCredential(preset) {
|
|
|
301
301
|
}
|
|
302
302
|
}
|
|
303
303
|
async function setupDomesticPreset(config, ctx, preset) {
|
|
304
|
-
console.log(`\n🇨🇳 ${preset.displayName}\n`);
|
|
304
|
+
console.log(`\n${preset.onboardingIcon ?? "🇨🇳"} ${preset.displayName}\n`);
|
|
305
305
|
console.log(preset.description);
|
|
306
306
|
if (preset.quirks?.length) for (const quirk of preset.quirks) console.log(colors.gray(`Note: ${quirk}`));
|
|
307
307
|
const baseUrlChoice = await select({
|
|
@@ -336,13 +336,14 @@ async function setupDomesticPreset(config, ctx, preset) {
|
|
|
336
336
|
headers: preset.headers
|
|
337
337
|
});
|
|
338
338
|
const modelChoices = discoveredChoices.length > 0 ? discoveredChoices : getModelsForProvider(preset.id);
|
|
339
|
+
if (preset.requiresModelDiscovery && modelChoices.length === 0) throw new Error(`No models are available from ${preset.displayName}. Ask an administrator to publish a model, then retry.`);
|
|
339
340
|
const modelRef = await select({
|
|
340
341
|
message: "Model:",
|
|
341
342
|
choices: modelChoices.map((choice) => ({
|
|
342
343
|
...choice,
|
|
343
344
|
name: modelChoiceName(choice)
|
|
344
345
|
})),
|
|
345
|
-
default: `${preset.id}/${preset.defaultModel}`
|
|
346
|
+
default: preset.defaultModel ? `${preset.id}/${preset.defaultModel}` : modelChoices[0]?.value
|
|
346
347
|
});
|
|
347
348
|
const modelId = modelRef.split("/").slice(1).join("/");
|
|
348
349
|
if (await confirm({
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export type SetupAction = 'add' | 'set' | 'remove' | 'noop';
|
|
9
9
|
export interface SetupError {
|
|
10
|
-
/** Dot path of the offending field, when known (e.g. `providers.openai.
|
|
10
|
+
/** Dot path of the offending field, when known (e.g. `providers.openai.baseUrl`). */
|
|
11
11
|
path?: string;
|
|
12
12
|
message: string;
|
|
13
13
|
}
|
package/dist/src/config/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ENV_VARS, XOPC_DB_FILENAME, resolveHomeDir, resolveStateDir, resolveXopcDatabasePath } from "./paths-state.js";
|
|
2
2
|
import { TelegramAccountConfigSchema, TelegramConfigSchema, TelegramGroupConfigSchema, TelegramTopicConfigSchema } from "../../extensions/telegram/src/config-schema.js";
|
|
3
3
|
import { WeixinAccountConfigSchema, WeixinConfigSchema } from "../../extensions/weixin/src/config-schema.js";
|
|
4
|
-
import { AgentImageGenerationModelSchema, AgentModelRefSchema, AgentModelsSchema, AgentTypedModelRoleSchema, AgentsConfigSchema, BindingMatchSchema, BindingRuleSchema, BindingsConfigSchema, BrowserConfigSchema, ChannelsConfigSchema, CodeIntelligenceConfigSchema, CommandsConfigSchema, ConfigSchema, ConnectorsConfigSchema, ExperimentalConfigSchema, ExtensionSecurityConfigSchema, ExtensionSlotsConfigSchema, ExtensionsConfigSchema, GatewayAuthRateLimitSchema, GatewayAuthSchema, GatewayBindModeSchema, GatewayChannelConnectDeferModeSchema, GatewayConfigSchema, GatewayModeSchema, GatewayRemoteSchema, GatewaySecuritySchema, GatewayTailscaleConsentSchema, GatewayTailscaleSchema, GatewayTlsSchema, GatewayTrustedProxySchema, GoalNotificationEventSchema, GoalNotificationTargetSchema, GoalNotificationsConfigSchema, GoalsConfigSchema, HeartbeatConfigSchema, McpConfigSchema, McpServerSchema, MediaUnderstandingCapabilitiesSchema, MediaUnderstandingModelSchema, MessagesConfigSchema, ModelsDevConfigSchema, ProviderAuthConfigSchema, ProviderAzureConfigSchema, ProviderRequestOverridesSchema, ProvidersConfigSchema, STTConfigSchema, STTFallbackConfigSchema, STTProviderConfigSchema, SearchProviderEntrySchema, SessionConfigSchema, SessionDmScopeSchema, SessionResetByTypeSchema, SessionResetConfigSchema, SessionResetModeSchema, SessionScopeSchema, SessionStorageConfigSchema, TTSConfigSchema, TTSEdgeConfigSchema, TTSFallbackConfigSchema, TTSModelOverridesConfigSchema, TTSProviderConfigSchema, TTSSummarizationConfigSchema, ToolsConfigSchema, ToolsMediaAudioConfigSchema, ToolsMediaConfigSchema, TuiConfigSchema, TunnelConfigSchema, TunnelConsentSchema, UpdateAutoConfigSchema, UpdateConfigSchema, VoiceConfigSchema, VoiceRefinementConfigSchema, WebSearchConfigSchema, WebToolsConfigSchema, WebsiteBlocklistSchema, WorkspaceConfigSchema, WorkspaceImportConfigSchema, getAgentDefaultImageGenerationModelConfig, getAgentDefaultImageModelConfig, getAgentDefaultModelRef, init_schema, parseModelRef } from "./schema.js";
|
|
4
|
+
import { AgentImageGenerationModelSchema, AgentModelRefSchema, AgentModelsSchema, AgentTypedModelRoleSchema, AgentsConfigSchema, BindingMatchSchema, BindingRuleSchema, BindingsConfigSchema, BrowserConfigSchema, ChannelsConfigSchema, CodeIntelligenceConfigSchema, CommandsConfigSchema, ConfigSchema, ConnectorsConfigSchema, ExperimentalConfigSchema, ExtensionSecurityConfigSchema, ExtensionSlotsConfigSchema, ExtensionsConfigSchema, GatewayAuthRateLimitSchema, GatewayAuthSchema, GatewayBindModeSchema, GatewayChannelConnectDeferModeSchema, GatewayConfigSchema, GatewayModeSchema, GatewayRemoteSchema, GatewaySecuritySchema, GatewayTailscaleConsentSchema, GatewayTailscaleSchema, GatewayTlsSchema, GatewayTrustedProxySchema, GoalNotificationEventSchema, GoalNotificationTargetSchema, GoalNotificationsConfigSchema, GoalsConfigSchema, HeartbeatConfigSchema, McpConfigSchema, McpServerSchema, MediaUnderstandingCapabilitiesSchema, MediaUnderstandingModelSchema, MessagesConfigSchema, ModelCatalogConfigSchema, ModelsDevConfigSchema, ProviderAuthConfigSchema, ProviderAzureConfigSchema, ProviderRequestOverridesSchema, ProvidersConfigSchema, STTConfigSchema, STTFallbackConfigSchema, STTProviderConfigSchema, SearchProviderEntrySchema, SessionConfigSchema, SessionDmScopeSchema, SessionResetByTypeSchema, SessionResetConfigSchema, SessionResetModeSchema, SessionScopeSchema, SessionStorageConfigSchema, TTSConfigSchema, TTSEdgeConfigSchema, TTSFallbackConfigSchema, TTSModelOverridesConfigSchema, TTSProviderConfigSchema, TTSSummarizationConfigSchema, ToolsConfigSchema, ToolsMediaAudioConfigSchema, ToolsMediaConfigSchema, TuiConfigSchema, TunnelConfigSchema, TunnelConsentSchema, UpdateAutoConfigSchema, UpdateConfigSchema, VoiceConfigSchema, VoiceRefinementConfigSchema, WebSearchConfigSchema, WebToolsConfigSchema, WebsiteBlocklistSchema, WorkspaceConfigSchema, WorkspaceImportConfigSchema, getAgentDefaultImageGenerationModelConfig, getAgentDefaultImageModelConfig, getAgentDefaultModelRef, init_schema, parseModelRef } from "./schema.js";
|
|
5
5
|
import { applyConfigOverrides, getConfigOverrides, resetConfigOverrides, setConfigOverride, unsetConfigOverride } from "./runtime-overrides.js";
|
|
6
6
|
import { expandWorkspacePathString, init_workspace_path, normalizeWorkspaceDir, resolveWorkspaceRoot } from "./workspace-path.js";
|
|
7
7
|
import { resolveDefaultAgentWorkspaceDir } from "./workspace-defaults.js";
|
|
@@ -27,4 +27,4 @@ init_workspace_path();
|
|
|
27
27
|
init_models_json();
|
|
28
28
|
init_resolve_config_value();
|
|
29
29
|
//#endregion
|
|
30
|
-
export { AgentImageGenerationModelSchema, AgentModelRefSchema, AgentModelsSchema, AgentTypedModelRoleSchema, AgentsConfigSchema, BASE_RELOAD_RULES, BindingMatchSchema, BindingRuleSchema, BindingsConfigSchema, BrowserConfigSchema, ChannelsConfigSchema, CodeIntelligenceConfigSchema, CommandsConfigSchema, ConfigHotReloader, ConfigSchema, ConnectorsConfigSchema, CustomModelSchema, ENV_VARS, ExperimentalConfigSchema, ExtensionSecurityConfigSchema, ExtensionSlotsConfigSchema, ExtensionsConfigSchema, FILENAMES, GatewayAuthRateLimitSchema, GatewayAuthSchema, GatewayBindModeSchema, GatewayChannelConnectDeferModeSchema, GatewayConfigSchema, GatewayModeSchema, GatewayRemoteSchema, GatewaySecuritySchema, GatewayTailscaleConsentSchema, GatewayTailscaleSchema, GatewayTlsSchema, GatewayTrustedProxySchema, GoalNotificationEventSchema, GoalNotificationTargetSchema, GoalNotificationsConfigSchema, GoalsConfigSchema, HeartbeatConfigSchema, McpConfigSchema, McpServerSchema, MediaUnderstandingCapabilitiesSchema, MediaUnderstandingModelSchema, MessagesConfigSchema, ModelOverrideSchema, ModelsDevConfigSchema, ModelsJsonSchema, OpenAICompatSchema, OpenAICompletionsCompatSchema, OpenAIResponsesCompatSchema, OpenRouterRoutingSchema, ProfileManager, ProviderAuthConfigSchema, ProviderAzureConfigSchema, ProviderConfigSchema, ProviderRequestOverridesSchema, ProvidersConfigSchema, STTConfigSchema, STTFallbackConfigSchema, STTProviderConfigSchema, SearchProviderEntrySchema, SessionConfigSchema, SessionDmScopeSchema, SessionResetByTypeSchema, SessionResetConfigSchema, SessionResetModeSchema, SessionScopeSchema, SessionStorageConfigSchema, TTSConfigSchema, TTSEdgeConfigSchema, TTSFallbackConfigSchema, TTSModelOverridesConfigSchema, TTSProviderConfigSchema, TTSSummarizationConfigSchema, TelegramAccountConfigSchema, TelegramConfigSchema, TelegramGroupConfigSchema, TelegramTopicConfigSchema, ToolsConfigSchema, ToolsMediaAudioConfigSchema, ToolsMediaConfigSchema, TuiConfigSchema, TunnelConfigSchema, TunnelConsentSchema, USER_MEMORY_FILENAME, USER_PROFILE_FILENAME, UpdateAutoConfigSchema, UpdateConfigSchema, VercelGatewayRoutingSchema, VoiceConfigSchema, VoiceRefinementConfigSchema, WORKSPACE_FILES, WebSearchConfigSchema, WebToolsConfigSchema, WebsiteBlocklistSchema, WeixinAccountConfigSchema, WeixinConfigSchema, WorkspaceConfigSchema, WorkspaceImportConfigSchema, XOPC_DB_FILENAME, applyConfigOverrides, buildReloadPlan, canonicalizeConfiguredMcpServer, clearConfigValueCache, createProfile, deleteProfile, diffConfigPaths, existsSync, expandWorkspacePathString, extractProfileAgentId, formatThinkingLevels, getAgentDefaultImageGenerationModelConfig, getAgentDefaultImageModelConfig, getAgentDefaultModelRef, getAllowedCommands, getCacheStats, getConfigOverrides, getCurrentProfile, getDefaultModelValues, resolveModelsJsonPath as getModelsJsonPath, getProfileManager, getProfileNameFromDir, getSwitchCommand, getWorkspacePath, hasBundledExtensionManifest, isKnownCliMcpTypeAlias, listAgentProfileMarkdownDirs, listAgentWorkspaceDirs, listProfiles, listThinkingLevels, loadConfig, loadModelsJson, matchReloadRule, modelsJsonExists, normalizeConfiguredMcpServers, normalizeElevatedMode, normalizeReasoningLevel, normalizeThinkLevel, normalizeVerboseLevel, normalizeWorkspaceDir, parseModelRef, resetConfigOverrides, resolveAgentAuthProfilesPath, resolveAgentDir, resolveAgentDir$1 as resolveAgentDirFromConfig, resolveAgentHomeDir, resolveAgentHomeDir$1 as resolveAgentHomeDirFromConfig, resolveAgentProfileDir, resolveAgentProfileMarkdownPath, resolveAgentWorkspaceDir, resolveAuthProfilesPath, resolveBinDir, resolveBundledExtensionsDir, resolveBundledSkillsDir, resolveConfigPath, resolveConfigValue, resolveCredentialsDir, resolveDefaultAgentWorkspaceDir, resolveEffectiveAgentManifestForAgent, resolveEffectiveAgentManifestForSession, resolveEffectiveAgentProfile, resolveEffectiveAgentProfileForSession, resolveExtensionSdkPath, resolveExtensionsDir, resolveExtensionsLockPath, resolveHeaders, resolveHomeDir, resolveInboxDir, resolveInboxMessagePath, resolveInboxPendingDir, resolveInboxProcessedDir, resolveLogPath, resolveLogsDir, resolveModelsJsonPath, resolveNodeBinDir, resolveNodeBinPath, resolveNodeToolsDir, resolveNpmBinPath, resolveOAuthPath, resolvePidPath, resolveProfileStateDir, resolveSkillPath, resolveSkillsCachePath, resolveSkillsDir, resolveSkillsLockPath, resolveSocketPath, resolveStateDir, resolveStatusPath, resolveToolsDir, resolveUserDir, resolveUserMemoryPath, resolveUserProfilePath, resolveWorkspaceExtensionsDir, resolveWorkspaceFile, resolveWorkspaceRoot, resolveWorkspaceStateDir, resolveWorkspaceStatePath, resolveXopcBinPath, resolveXopcDatabasePath, resolveXopcMcpTransportAlias, saveConfig, saveModelsJson, setConfigOverride, testApiKeyResolution, thinkLevelToNumber, unsetConfigOverride, validateModelsConfig };
|
|
30
|
+
export { AgentImageGenerationModelSchema, AgentModelRefSchema, AgentModelsSchema, AgentTypedModelRoleSchema, AgentsConfigSchema, BASE_RELOAD_RULES, BindingMatchSchema, BindingRuleSchema, BindingsConfigSchema, BrowserConfigSchema, ChannelsConfigSchema, CodeIntelligenceConfigSchema, CommandsConfigSchema, ConfigHotReloader, ConfigSchema, ConnectorsConfigSchema, CustomModelSchema, ENV_VARS, ExperimentalConfigSchema, ExtensionSecurityConfigSchema, ExtensionSlotsConfigSchema, ExtensionsConfigSchema, FILENAMES, GatewayAuthRateLimitSchema, GatewayAuthSchema, GatewayBindModeSchema, GatewayChannelConnectDeferModeSchema, GatewayConfigSchema, GatewayModeSchema, GatewayRemoteSchema, GatewaySecuritySchema, GatewayTailscaleConsentSchema, GatewayTailscaleSchema, GatewayTlsSchema, GatewayTrustedProxySchema, GoalNotificationEventSchema, GoalNotificationTargetSchema, GoalNotificationsConfigSchema, GoalsConfigSchema, HeartbeatConfigSchema, McpConfigSchema, McpServerSchema, MediaUnderstandingCapabilitiesSchema, MediaUnderstandingModelSchema, MessagesConfigSchema, ModelCatalogConfigSchema, ModelOverrideSchema, ModelsDevConfigSchema, ModelsJsonSchema, OpenAICompatSchema, OpenAICompletionsCompatSchema, OpenAIResponsesCompatSchema, OpenRouterRoutingSchema, ProfileManager, ProviderAuthConfigSchema, ProviderAzureConfigSchema, ProviderConfigSchema, ProviderRequestOverridesSchema, ProvidersConfigSchema, STTConfigSchema, STTFallbackConfigSchema, STTProviderConfigSchema, SearchProviderEntrySchema, SessionConfigSchema, SessionDmScopeSchema, SessionResetByTypeSchema, SessionResetConfigSchema, SessionResetModeSchema, SessionScopeSchema, SessionStorageConfigSchema, TTSConfigSchema, TTSEdgeConfigSchema, TTSFallbackConfigSchema, TTSModelOverridesConfigSchema, TTSProviderConfigSchema, TTSSummarizationConfigSchema, TelegramAccountConfigSchema, TelegramConfigSchema, TelegramGroupConfigSchema, TelegramTopicConfigSchema, ToolsConfigSchema, ToolsMediaAudioConfigSchema, ToolsMediaConfigSchema, TuiConfigSchema, TunnelConfigSchema, TunnelConsentSchema, USER_MEMORY_FILENAME, USER_PROFILE_FILENAME, UpdateAutoConfigSchema, UpdateConfigSchema, VercelGatewayRoutingSchema, VoiceConfigSchema, VoiceRefinementConfigSchema, WORKSPACE_FILES, WebSearchConfigSchema, WebToolsConfigSchema, WebsiteBlocklistSchema, WeixinAccountConfigSchema, WeixinConfigSchema, WorkspaceConfigSchema, WorkspaceImportConfigSchema, XOPC_DB_FILENAME, applyConfigOverrides, buildReloadPlan, canonicalizeConfiguredMcpServer, clearConfigValueCache, createProfile, deleteProfile, diffConfigPaths, existsSync, expandWorkspacePathString, extractProfileAgentId, formatThinkingLevels, getAgentDefaultImageGenerationModelConfig, getAgentDefaultImageModelConfig, getAgentDefaultModelRef, getAllowedCommands, getCacheStats, getConfigOverrides, getCurrentProfile, getDefaultModelValues, resolveModelsJsonPath as getModelsJsonPath, getProfileManager, getProfileNameFromDir, getSwitchCommand, getWorkspacePath, hasBundledExtensionManifest, isKnownCliMcpTypeAlias, listAgentProfileMarkdownDirs, listAgentWorkspaceDirs, listProfiles, listThinkingLevels, loadConfig, loadModelsJson, matchReloadRule, modelsJsonExists, normalizeConfiguredMcpServers, normalizeElevatedMode, normalizeReasoningLevel, normalizeThinkLevel, normalizeVerboseLevel, normalizeWorkspaceDir, parseModelRef, resetConfigOverrides, resolveAgentAuthProfilesPath, resolveAgentDir, resolveAgentDir$1 as resolveAgentDirFromConfig, resolveAgentHomeDir, resolveAgentHomeDir$1 as resolveAgentHomeDirFromConfig, resolveAgentProfileDir, resolveAgentProfileMarkdownPath, resolveAgentWorkspaceDir, resolveAuthProfilesPath, resolveBinDir, resolveBundledExtensionsDir, resolveBundledSkillsDir, resolveConfigPath, resolveConfigValue, resolveCredentialsDir, resolveDefaultAgentWorkspaceDir, resolveEffectiveAgentManifestForAgent, resolveEffectiveAgentManifestForSession, resolveEffectiveAgentProfile, resolveEffectiveAgentProfileForSession, resolveExtensionSdkPath, resolveExtensionsDir, resolveExtensionsLockPath, resolveHeaders, resolveHomeDir, resolveInboxDir, resolveInboxMessagePath, resolveInboxPendingDir, resolveInboxProcessedDir, resolveLogPath, resolveLogsDir, resolveModelsJsonPath, resolveNodeBinDir, resolveNodeBinPath, resolveNodeToolsDir, resolveNpmBinPath, resolveOAuthPath, resolvePidPath, resolveProfileStateDir, resolveSkillPath, resolveSkillsCachePath, resolveSkillsDir, resolveSkillsLockPath, resolveSocketPath, resolveStateDir, resolveStatusPath, resolveToolsDir, resolveUserDir, resolveUserMemoryPath, resolveUserProfilePath, resolveWorkspaceExtensionsDir, resolveWorkspaceFile, resolveWorkspaceRoot, resolveWorkspaceStateDir, resolveWorkspaceStatePath, resolveXopcBinPath, resolveXopcDatabasePath, resolveXopcMcpTransportAlias, saveConfig, saveModelsJson, setConfigOverride, testApiKeyResolution, thinkLevelToNumber, unsetConfigOverride, validateModelsConfig };
|
|
@@ -292,6 +292,9 @@ export declare const ProviderConfigSchema: z.ZodObject<{
|
|
|
292
292
|
supportsStrictMode: z.ZodOptional<z.ZodBoolean>;
|
|
293
293
|
}, z.core.$strip>, z.ZodObject<{}, z.core.$strip>]>>;
|
|
294
294
|
}, z.core.$strip>>>;
|
|
295
|
+
modelDiscovery: z.ZodOptional<z.ZodObject<{
|
|
296
|
+
enabled: z.ZodBoolean;
|
|
297
|
+
}, z.core.$strict>>;
|
|
295
298
|
}, z.core.$strip>;
|
|
296
299
|
export declare const ModelsJsonSchema: z.ZodObject<{
|
|
297
300
|
providers: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
@@ -412,6 +415,9 @@ export declare const ModelsJsonSchema: z.ZodObject<{
|
|
|
412
415
|
supportsStrictMode: z.ZodOptional<z.ZodBoolean>;
|
|
413
416
|
}, z.core.$strip>, z.ZodObject<{}, z.core.$strip>]>>;
|
|
414
417
|
}, z.core.$strip>>>;
|
|
418
|
+
modelDiscovery: z.ZodOptional<z.ZodObject<{
|
|
419
|
+
enabled: z.ZodBoolean;
|
|
420
|
+
}, z.core.$strict>>;
|
|
415
421
|
}, z.core.$strip>>;
|
|
416
422
|
}, z.core.$strip>;
|
|
417
423
|
export type OpenRouterRouting = z.infer<typeof OpenRouterRoutingSchema>;
|
|
@@ -46,11 +46,6 @@ function validateModelsConfig(config) {
|
|
|
46
46
|
message: "baseUrl is required when defining custom models",
|
|
47
47
|
severity: "error"
|
|
48
48
|
});
|
|
49
|
-
if (!providerConfig.apiKey) errors.push({
|
|
50
|
-
path: `providers.${providerName}.apiKey`,
|
|
51
|
-
message: "apiKey is required when defining custom models",
|
|
52
|
-
severity: "error"
|
|
53
|
-
});
|
|
54
49
|
}
|
|
55
50
|
if (!hasModels && !hasBaseUrl && !hasModelOverrides && !providerConfig.apiKey) errors.push({
|
|
56
51
|
path: `providers.${providerName}`,
|
|
@@ -247,7 +242,8 @@ var init_models_json = __esmMin((() => {
|
|
|
247
242
|
headers: z.record(z.string(), z.string()).optional(),
|
|
248
243
|
authHeader: z.boolean().optional(),
|
|
249
244
|
models: z.array(CustomModelSchema).optional(),
|
|
250
|
-
modelOverrides: z.record(z.string(), ModelOverrideSchema).optional()
|
|
245
|
+
modelOverrides: z.record(z.string(), ModelOverrideSchema).optional(),
|
|
246
|
+
modelDiscovery: z.object({ enabled: z.boolean() }).strict().optional()
|
|
251
247
|
});
|
|
252
248
|
ModelsJsonSchema = z.object({ providers: z.record(z.string(), ProviderConfigSchema) });
|
|
253
249
|
PROVIDER_ID_REGEX = /^[a-z0-9]([a-z0-9-_]*[a-z0-9])?$/;
|
|
@@ -934,6 +934,11 @@ export declare const GatewayConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
934
934
|
export declare const ModelsDevConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
935
935
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
936
936
|
}, z.core.$strip>>;
|
|
937
|
+
export declare const ModelCatalogConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
938
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
939
|
+
refreshOnStartup: z.ZodDefault<z.ZodBoolean>;
|
|
940
|
+
intervalHours: z.ZodDefault<z.ZodNumber>;
|
|
941
|
+
}, z.core.$strict>>;
|
|
937
942
|
export declare const STTProviderConfigSchema: z.ZodObject<{
|
|
938
943
|
apiKey: z.ZodOptional<z.ZodString>;
|
|
939
944
|
model: z.ZodOptional<z.ZodString>;
|
|
@@ -1247,15 +1252,14 @@ export declare const ProviderRequestOverridesSchema: z.ZodObject<{
|
|
|
1247
1252
|
}, z.core.$strict>;
|
|
1248
1253
|
/**
|
|
1249
1254
|
* Generic per-vendor provider config — used by image / audio / video
|
|
1250
|
-
* capability providers via `cfg.providers.<id>`.
|
|
1251
|
-
* everything optional) so adding a new vendor never requires a config
|
|
1252
|
-
* migration.
|
|
1255
|
+
* capability providers via `cfg.providers.<id>`.
|
|
1253
1256
|
*/
|
|
1254
1257
|
export declare const ProviderAuthConfigSchema: z.ZodObject<{
|
|
1255
|
-
apiKey: z.ZodOptional<z.ZodString>;
|
|
1256
1258
|
baseUrl: z.ZodOptional<z.ZodString>;
|
|
1257
|
-
region: z.ZodOptional<z.
|
|
1258
|
-
|
|
1259
|
+
region: z.ZodOptional<z.ZodEnum<{
|
|
1260
|
+
cn: "cn";
|
|
1261
|
+
intl: "intl";
|
|
1262
|
+
}>>;
|
|
1259
1263
|
request: z.ZodOptional<z.ZodObject<{
|
|
1260
1264
|
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
1261
1265
|
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -1268,15 +1272,16 @@ export declare const ProviderAuthConfigSchema: z.ZodObject<{
|
|
|
1268
1272
|
}, z.core.$strict>;
|
|
1269
1273
|
export type ProviderAuthConfig = z.infer<typeof ProviderAuthConfigSchema>;
|
|
1270
1274
|
/**
|
|
1271
|
-
* `cfg.providers.<id>`
|
|
1272
|
-
*
|
|
1275
|
+
* `cfg.providers.<id>` stores non-secret connection settings. Credentials
|
|
1276
|
+
* live in the credential store or environment. Every entry is validated by
|
|
1273
1277
|
* {@link ProviderAuthConfigSchema}.
|
|
1274
1278
|
*/
|
|
1275
1279
|
export declare const ProvidersConfigSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1276
|
-
apiKey: z.ZodOptional<z.ZodString>;
|
|
1277
1280
|
baseUrl: z.ZodOptional<z.ZodString>;
|
|
1278
|
-
region: z.ZodOptional<z.
|
|
1279
|
-
|
|
1281
|
+
region: z.ZodOptional<z.ZodEnum<{
|
|
1282
|
+
cn: "cn";
|
|
1283
|
+
intl: "intl";
|
|
1284
|
+
}>>;
|
|
1280
1285
|
request: z.ZodOptional<z.ZodObject<{
|
|
1281
1286
|
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
1282
1287
|
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -2330,10 +2335,11 @@ export declare const ConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
2330
2335
|
}, z.core.$strict>>;
|
|
2331
2336
|
extensions: z.ZodDefault<z.ZodType<Record<string, unknown>, unknown, z.core.$ZodTypeInternals<Record<string, unknown>, unknown>>>;
|
|
2332
2337
|
providers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
2333
|
-
apiKey: z.ZodOptional<z.ZodString>;
|
|
2334
2338
|
baseUrl: z.ZodOptional<z.ZodString>;
|
|
2335
|
-
region: z.ZodOptional<z.
|
|
2336
|
-
|
|
2339
|
+
region: z.ZodOptional<z.ZodEnum<{
|
|
2340
|
+
cn: "cn";
|
|
2341
|
+
intl: "intl";
|
|
2342
|
+
}>>;
|
|
2337
2343
|
request: z.ZodOptional<z.ZodObject<{
|
|
2338
2344
|
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
2339
2345
|
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
@@ -2347,6 +2353,11 @@ export declare const ConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
2347
2353
|
modelsDev: z.ZodDefault<z.ZodObject<{
|
|
2348
2354
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
2349
2355
|
}, z.core.$strip>>;
|
|
2356
|
+
modelCatalog: z.ZodDefault<z.ZodObject<{
|
|
2357
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
2358
|
+
refreshOnStartup: z.ZodDefault<z.ZodBoolean>;
|
|
2359
|
+
intervalHours: z.ZodDefault<z.ZodNumber>;
|
|
2360
|
+
}, z.core.$strict>>;
|
|
2350
2361
|
messages: z.ZodOptional<z.ZodObject<{
|
|
2351
2362
|
tts: z.ZodOptional<z.ZodObject<{
|
|
2352
2363
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -2446,6 +2457,6 @@ export interface ParsedModelRef {
|
|
|
2446
2457
|
}
|
|
2447
2458
|
export declare function getAgentDefaultModelRef(config: Config): string | undefined;
|
|
2448
2459
|
export declare function getAgentDefaultImageModelConfig(config: Config): AgentModelConfig | undefined;
|
|
2449
|
-
export declare function getAgentDefaultImageGenerationModelConfig(config: Config): AgentImageGenerationModelConfig | undefined;
|
|
2460
|
+
export declare function getAgentDefaultImageGenerationModelConfig(config: Config, agentId: string): AgentImageGenerationModelConfig | undefined;
|
|
2450
2461
|
/** `provider/model` or null when invalid. */
|
|
2451
2462
|
export declare function parseModelRef(ref: string): ParsedModelRef | null;
|
|
@@ -26,9 +26,9 @@ function getAgentDefaultModelRef(config) {
|
|
|
26
26
|
applyModels(agent.models);
|
|
27
27
|
return modelRef;
|
|
28
28
|
}
|
|
29
|
-
function getAgentDefaultModelsConfig(config) {
|
|
29
|
+
function getAgentDefaultModelsConfig(config, requestedAgentId) {
|
|
30
30
|
const list = Array.isArray(config.agents?.list) ? config.agents.list : [];
|
|
31
|
-
const defaultId = config.agents?.default?.trim() || list.find((entry) => entry.default === true)?.id?.trim() || list[0]?.id;
|
|
31
|
+
const defaultId = requestedAgentId?.trim() || config.agents?.default?.trim() || list.find((entry) => entry.default === true)?.id?.trim() || list[0]?.id;
|
|
32
32
|
const agent = list.find((entry) => entry.enabled !== false && entry.id === defaultId) ?? list[0];
|
|
33
33
|
if (!agent) return void 0;
|
|
34
34
|
let modelConfig;
|
|
@@ -51,8 +51,8 @@ function getAgentDefaultModelsConfig(config) {
|
|
|
51
51
|
function getAgentDefaultImageModelConfig(config) {
|
|
52
52
|
return getAgentDefaultModelsConfig(config)?.imageModel;
|
|
53
53
|
}
|
|
54
|
-
function getAgentDefaultImageGenerationModelConfig(config) {
|
|
55
|
-
return getAgentDefaultModelsConfig(config)?.imageGenerationModel;
|
|
54
|
+
function getAgentDefaultImageGenerationModelConfig(config, agentId) {
|
|
55
|
+
return getAgentDefaultModelsConfig(config, agentId)?.imageGenerationModel;
|
|
56
56
|
}
|
|
57
57
|
/** `provider/model` or null when invalid. */
|
|
58
58
|
function parseModelRef(ref) {
|
|
@@ -64,7 +64,7 @@ function parseModelRef(ref) {
|
|
|
64
64
|
model: trimmed.slice(idx + 1).trim()
|
|
65
65
|
};
|
|
66
66
|
}
|
|
67
|
-
var AgentModelRefSchema, AgentImageGenerationModelSchema, AgentTypedModelRoleSchema, AgentTypedModelRolesSchema, AgentModelsSchema, AgentsConfigSchema, BrowserCloudConfigSchema, BrowserExtensionConfigSchema, BrowserCloakConfigSchema, BrowserConfigSchema, BindingMatchSchema, BindingRuleSchema, BindingsConfigSchema, SessionDmScopeSchema, SessionStorageConfigSchema, SessionResetModeSchema, SessionResetConfigSchema, SessionResetByTypeSchema, SessionScopeSchema, SessionConfigSchema, ChannelsConfigSchema, SearchProviderEntrySchema, WebSearchConfigSchema, WebsiteBlocklistSchema, WebToolsConfigSchema, ToolsConfigSchema, GatewayAuthRateLimitSchema, GatewaySecuritySchema, GatewayTrustedProxySchema, GatewayAuthSchema, GatewayTailscaleConsentSchema, GatewayTailscaleSchema, GatewayRemoteSchema, GatewayTlsSchema, GatewayModeSchema, HeartbeatConfigSchema, GatewayChannelConnectDeferModeSchema, TunnelConsentSchema, TunnelConfigSchema, WorkspaceImportConfigSchema, WorkspaceConfigSchema, GatewayBindModeSchema, GatewayConfigSchema, ModelsDevConfigSchema, SttProviderConfigCatchallSchema, STTProviderConfigSchema, STTFallbackConfigSchema, MediaUnderstandingCapabilitiesSchema, MediaUnderstandingModelSchema, STTConfigSchema, TtsProviderConfigCatchallSchema, TTSProviderConfigSchema, TTSFallbackConfigSchema, TTSModelOverridesConfigSchema, TTSEdgeConfigSchema, TTSSummarizationConfigSchema, TTSConfigSchema, VoiceRefinementConfigSchema, VoiceConfigSchema, MessagesConfigSchema, ToolsMediaAudioConfigSchema, ToolsMediaConfigSchema, ProviderAzureConfigSchema, ProviderRequestOverridesSchema, ProviderAuthConfigSchema, ProvidersConfigSchema, ExtensionSecurityConfigSchema, ExtensionSlotsConfigSchema, ExtensionsConfigSchema, UpdateAutoConfigSchema, GoalNotificationEventSchema, GoalNotificationTargetSchema, GoalNotificationsConfigSchema, GoalsConfigSchema, UpdateConfigSchema, CommandsConfigSchema, TuiConfigSchema, McpHttpUrlSchema, ConnectorSecretReferenceSchema, McpConfigScalarSchema, McpServerSchema, McpConfigSchema, CodeIntelligenceConfigSchema, ConnectorsConfigSchema, ExperimentalConfigSchema, ConfigSchema;
|
|
67
|
+
var AgentModelRefSchema, AgentImageGenerationModelSchema, AgentTypedModelRoleSchema, AgentTypedModelRolesSchema, AgentModelsSchema, AgentsConfigSchema, BrowserCloudConfigSchema, BrowserExtensionConfigSchema, BrowserCloakConfigSchema, BrowserConfigSchema, BindingMatchSchema, BindingRuleSchema, BindingsConfigSchema, SessionDmScopeSchema, SessionStorageConfigSchema, SessionResetModeSchema, SessionResetConfigSchema, SessionResetByTypeSchema, SessionScopeSchema, SessionConfigSchema, ChannelsConfigSchema, SearchProviderEntrySchema, WebSearchConfigSchema, WebsiteBlocklistSchema, WebToolsConfigSchema, ToolsConfigSchema, GatewayAuthRateLimitSchema, GatewaySecuritySchema, GatewayTrustedProxySchema, GatewayAuthSchema, GatewayTailscaleConsentSchema, GatewayTailscaleSchema, GatewayRemoteSchema, GatewayTlsSchema, GatewayModeSchema, HeartbeatConfigSchema, GatewayChannelConnectDeferModeSchema, TunnelConsentSchema, TunnelConfigSchema, WorkspaceImportConfigSchema, WorkspaceConfigSchema, GatewayBindModeSchema, GatewayConfigSchema, ModelsDevConfigSchema, ModelCatalogConfigSchema, SttProviderConfigCatchallSchema, STTProviderConfigSchema, STTFallbackConfigSchema, MediaUnderstandingCapabilitiesSchema, MediaUnderstandingModelSchema, STTConfigSchema, TtsProviderConfigCatchallSchema, TTSProviderConfigSchema, TTSFallbackConfigSchema, TTSModelOverridesConfigSchema, TTSEdgeConfigSchema, TTSSummarizationConfigSchema, TTSConfigSchema, VoiceRefinementConfigSchema, VoiceConfigSchema, MessagesConfigSchema, ToolsMediaAudioConfigSchema, ToolsMediaConfigSchema, ProviderAzureConfigSchema, ProviderRequestOverridesSchema, ProviderAuthConfigSchema, ProvidersConfigSchema, ExtensionSecurityConfigSchema, ExtensionSlotsConfigSchema, ExtensionsConfigSchema, UpdateAutoConfigSchema, GoalNotificationEventSchema, GoalNotificationTargetSchema, GoalNotificationsConfigSchema, GoalsConfigSchema, UpdateConfigSchema, CommandsConfigSchema, TuiConfigSchema, McpHttpUrlSchema, ConnectorSecretReferenceSchema, McpConfigScalarSchema, McpServerSchema, McpConfigSchema, CodeIntelligenceConfigSchema, ConnectorsConfigSchema, ExperimentalConfigSchema, ConfigSchema;
|
|
68
68
|
var init_schema = __esmMin((() => {
|
|
69
69
|
init_schema$1();
|
|
70
70
|
init_preset_chain();
|
|
@@ -645,6 +645,15 @@ strict: z.boolean().optional() }).optional();
|
|
|
645
645
|
skillsStoreBaseUrl: "https://store.xopc.ai"
|
|
646
646
|
});
|
|
647
647
|
ModelsDevConfigSchema = z.object({ enabled: z.boolean().default(true) }).default({ enabled: true });
|
|
648
|
+
ModelCatalogConfigSchema = z.object({
|
|
649
|
+
enabled: z.boolean().default(true),
|
|
650
|
+
refreshOnStartup: z.boolean().default(true),
|
|
651
|
+
intervalHours: z.number().min(.25).default(6)
|
|
652
|
+
}).strict().default({
|
|
653
|
+
enabled: true,
|
|
654
|
+
refreshOnStartup: true,
|
|
655
|
+
intervalHours: 6
|
|
656
|
+
});
|
|
648
657
|
SttProviderConfigCatchallSchema = z.union([
|
|
649
658
|
z.string(),
|
|
650
659
|
z.number(),
|
|
@@ -804,14 +813,10 @@ tts: TTSConfigSchema.optional() }).optional();
|
|
|
804
813
|
headers: z.record(z.string(), z.string()).optional()
|
|
805
814
|
}).strict();
|
|
806
815
|
ProviderAuthConfigSchema = z.object({
|
|
807
|
-
/** Static API key (api-key / azure-key modes). */
|
|
808
|
-
apiKey: z.string().optional(),
|
|
809
816
|
/** Override the default REST base URL. */
|
|
810
817
|
baseUrl: z.string().url().optional(),
|
|
811
|
-
/**
|
|
812
|
-
region: z.
|
|
813
|
-
/** Image-only base URL override (DashScope splits image vs LLM). */
|
|
814
|
-
imageBaseUrl: z.string().url().optional(),
|
|
818
|
+
/** Provider deployment region. */
|
|
819
|
+
region: z.enum(["cn", "intl"]).optional(),
|
|
815
820
|
/** Per-vendor request overrides. */
|
|
816
821
|
request: ProviderRequestOverridesSchema.optional(),
|
|
817
822
|
/** Azure OpenAI deployment overrides; only consumed by OpenAI image provider. */
|
|
@@ -1015,6 +1020,7 @@ workDiscoveryOnboarding: z.boolean().default(true) }).strict().default({ workDis
|
|
|
1015
1020
|
/** Per-vendor capability provider config (image / audio / video). */
|
|
1016
1021
|
providers: ProvidersConfigSchema.optional(),
|
|
1017
1022
|
modelsDev: ModelsDevConfigSchema,
|
|
1023
|
+
modelCatalog: ModelCatalogConfigSchema,
|
|
1018
1024
|
/** Delivery / presentation concerns (currently `tts`). */
|
|
1019
1025
|
messages: MessagesConfigSchema,
|
|
1020
1026
|
/** User-facing voice input behavior beyond provider selection. */
|
|
@@ -1168,9 +1174,14 @@ workDiscoveryOnboarding: z.boolean().default(true) }).strict().default({ workDis
|
|
|
1168
1174
|
slots: {}
|
|
1169
1175
|
},
|
|
1170
1176
|
modelsDev: { enabled: true },
|
|
1177
|
+
modelCatalog: {
|
|
1178
|
+
enabled: true,
|
|
1179
|
+
refreshOnStartup: true,
|
|
1180
|
+
intervalHours: 6
|
|
1181
|
+
},
|
|
1171
1182
|
tui: {}
|
|
1172
1183
|
});
|
|
1173
1184
|
}));
|
|
1174
1185
|
//#endregion
|
|
1175
1186
|
init_schema();
|
|
1176
|
-
export { AgentImageGenerationModelSchema, AgentModelRefSchema, AgentModelsSchema, AgentTypedModelRoleSchema, AgentsConfigSchema, BindingMatchSchema, BindingRuleSchema, BindingsConfigSchema, BrowserConfigSchema, ChannelsConfigSchema, CodeIntelligenceConfigSchema, CommandsConfigSchema, ConfigSchema, ConnectorsConfigSchema, ExperimentalConfigSchema, ExtensionSecurityConfigSchema, ExtensionSlotsConfigSchema, ExtensionsConfigSchema, GatewayAuthRateLimitSchema, GatewayAuthSchema, GatewayBindModeSchema, GatewayChannelConnectDeferModeSchema, GatewayConfigSchema, GatewayModeSchema, GatewayRemoteSchema, GatewaySecuritySchema, GatewayTailscaleConsentSchema, GatewayTailscaleSchema, GatewayTlsSchema, GatewayTrustedProxySchema, GoalNotificationEventSchema, GoalNotificationTargetSchema, GoalNotificationsConfigSchema, GoalsConfigSchema, HeartbeatConfigSchema, McpConfigSchema, McpServerSchema, MediaUnderstandingCapabilitiesSchema, MediaUnderstandingModelSchema, MessagesConfigSchema, ModelsDevConfigSchema, ProviderAuthConfigSchema, ProviderAzureConfigSchema, ProviderRequestOverridesSchema, ProvidersConfigSchema, STTConfigSchema, STTFallbackConfigSchema, STTProviderConfigSchema, SearchProviderEntrySchema, SessionConfigSchema, SessionDmScopeSchema, SessionResetByTypeSchema, SessionResetConfigSchema, SessionResetModeSchema, SessionScopeSchema, SessionStorageConfigSchema, TTSConfigSchema, TTSEdgeConfigSchema, TTSFallbackConfigSchema, TTSModelOverridesConfigSchema, TTSProviderConfigSchema, TTSSummarizationConfigSchema, TelegramAccountConfigSchema, TelegramConfigSchema, TelegramGroupConfigSchema, TelegramTopicConfigSchema, ToolsConfigSchema, ToolsMediaAudioConfigSchema, ToolsMediaConfigSchema, TuiConfigSchema, TunnelConfigSchema, TunnelConsentSchema, UpdateAutoConfigSchema, UpdateConfigSchema, VoiceConfigSchema, VoiceRefinementConfigSchema, WebSearchConfigSchema, WebToolsConfigSchema, WebsiteBlocklistSchema, WeixinAccountConfigSchema, WeixinConfigSchema, WorkspaceConfigSchema, WorkspaceImportConfigSchema, getAgentDefaultImageGenerationModelConfig, getAgentDefaultImageModelConfig, getAgentDefaultModelRef, init_schema, parseModelRef };
|
|
1187
|
+
export { AgentImageGenerationModelSchema, AgentModelRefSchema, AgentModelsSchema, AgentTypedModelRoleSchema, AgentsConfigSchema, BindingMatchSchema, BindingRuleSchema, BindingsConfigSchema, BrowserConfigSchema, ChannelsConfigSchema, CodeIntelligenceConfigSchema, CommandsConfigSchema, ConfigSchema, ConnectorsConfigSchema, ExperimentalConfigSchema, ExtensionSecurityConfigSchema, ExtensionSlotsConfigSchema, ExtensionsConfigSchema, GatewayAuthRateLimitSchema, GatewayAuthSchema, GatewayBindModeSchema, GatewayChannelConnectDeferModeSchema, GatewayConfigSchema, GatewayModeSchema, GatewayRemoteSchema, GatewaySecuritySchema, GatewayTailscaleConsentSchema, GatewayTailscaleSchema, GatewayTlsSchema, GatewayTrustedProxySchema, GoalNotificationEventSchema, GoalNotificationTargetSchema, GoalNotificationsConfigSchema, GoalsConfigSchema, HeartbeatConfigSchema, McpConfigSchema, McpServerSchema, MediaUnderstandingCapabilitiesSchema, MediaUnderstandingModelSchema, MessagesConfigSchema, ModelCatalogConfigSchema, ModelsDevConfigSchema, ProviderAuthConfigSchema, ProviderAzureConfigSchema, ProviderRequestOverridesSchema, ProvidersConfigSchema, STTConfigSchema, STTFallbackConfigSchema, STTProviderConfigSchema, SearchProviderEntrySchema, SessionConfigSchema, SessionDmScopeSchema, SessionResetByTypeSchema, SessionResetConfigSchema, SessionResetModeSchema, SessionScopeSchema, SessionStorageConfigSchema, TTSConfigSchema, TTSEdgeConfigSchema, TTSFallbackConfigSchema, TTSModelOverridesConfigSchema, TTSProviderConfigSchema, TTSSummarizationConfigSchema, TelegramAccountConfigSchema, TelegramConfigSchema, TelegramGroupConfigSchema, TelegramTopicConfigSchema, ToolsConfigSchema, ToolsMediaAudioConfigSchema, ToolsMediaConfigSchema, TuiConfigSchema, TunnelConfigSchema, TunnelConsentSchema, UpdateAutoConfigSchema, UpdateConfigSchema, VoiceConfigSchema, VoiceRefinementConfigSchema, WebSearchConfigSchema, WebToolsConfigSchema, WebsiteBlocklistSchema, WeixinAccountConfigSchema, WeixinConfigSchema, WorkspaceConfigSchema, WorkspaceImportConfigSchema, getAgentDefaultImageGenerationModelConfig, getAgentDefaultImageModelConfig, getAgentDefaultModelRef, init_schema, parseModelRef };
|
|
@@ -12,7 +12,7 @@ import { buildGatewayConsoleCspHeader } from "../security/csp.js";
|
|
|
12
12
|
import { checkBrowserOrigin } from "../security/origin-check.js";
|
|
13
13
|
import { auth } from "./middleware/auth.js";
|
|
14
14
|
import { operatorScopes } from "./middleware/scopes.js";
|
|
15
|
-
import { createChannelRateLimitMiddleware, createStrictRateLimitMiddleware } from "./middleware/strict-rate-limit.js";
|
|
15
|
+
import { createChannelRateLimitMiddleware, createStrictRateLimitMiddleware, createXopcCloudPollRateLimitMiddleware } from "./middleware/strict-rate-limit.js";
|
|
16
16
|
import { logContextMiddleware } from "./middleware/log-context.js";
|
|
17
17
|
import { logger } from "./middleware/logger.js";
|
|
18
18
|
import { routeErrorMiddleware } from "./middleware/route-errors.js";
|
|
@@ -204,16 +204,22 @@ function createHonoApp(config) {
|
|
|
204
204
|
})
|
|
205
205
|
}));
|
|
206
206
|
authenticated.use(operatorScopes());
|
|
207
|
+
const strictRateLimitMiddleware = createStrictRateLimitMiddleware({ getTrustedProxyContext: () => ({
|
|
208
|
+
trustedProxies: service.currentConfig.gateway?.trustedProxies,
|
|
209
|
+
allowRealIpFallback: service.currentConfig.gateway?.allowRealIpFallback === true
|
|
210
|
+
}) });
|
|
211
|
+
const channelRateLimitMiddleware = createChannelRateLimitMiddleware({ getTrustedProxyContext: () => ({
|
|
212
|
+
trustedProxies: service.currentConfig.gateway?.trustedProxies,
|
|
213
|
+
allowRealIpFallback: service.currentConfig.gateway?.allowRealIpFallback === true
|
|
214
|
+
}) });
|
|
207
215
|
registerAuthenticatedRoutes(app, authenticated, {
|
|
208
216
|
service,
|
|
209
|
-
strictRateLimitMiddleware
|
|
210
|
-
|
|
211
|
-
allowRealIpFallback: service.currentConfig.gateway?.allowRealIpFallback === true
|
|
212
|
-
}) }),
|
|
213
|
-
channelRateLimitMiddleware: createChannelRateLimitMiddleware({ getTrustedProxyContext: () => ({
|
|
217
|
+
strictRateLimitMiddleware,
|
|
218
|
+
xopcCloudPollRateLimitMiddleware: createXopcCloudPollRateLimitMiddleware({ getTrustedProxyContext: () => ({
|
|
214
219
|
trustedProxies: service.currentConfig.gateway?.trustedProxies,
|
|
215
220
|
allowRealIpFallback: service.currentConfig.gateway?.allowRealIpFallback === true
|
|
216
221
|
}) }),
|
|
222
|
+
channelRateLimitMiddleware,
|
|
217
223
|
sseConfig: {
|
|
218
224
|
service,
|
|
219
225
|
maxSseConnections: service.currentConfig.gateway.maxSseConnections
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import type { Config } from '../../../config/schema.js';
|
|
2
2
|
/**
|
|
3
3
|
* Per-vendor slice of {@link Config.providers} safe for GET `/api/config`.
|
|
4
|
-
* Secrets are never sent verbatim; `apiKey` is length-preserving bullets when set, else empty.
|
|
5
4
|
*/
|
|
6
5
|
export type SafeProviderAuthEntry = {
|
|
7
|
-
apiKey: string;
|
|
8
6
|
region?: string;
|
|
9
7
|
baseUrl?: string;
|
|
10
|
-
imageBaseUrl?: string;
|
|
11
8
|
};
|
|
12
9
|
/**
|
|
13
10
|
* Build a redacted `providersConfig` map for the gateway console (image / audio / video keys).
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { maskSecretLength } from "./mask-secret-length.js";
|
|
2
1
|
//#region src/gateway/hono/lib/safe-providers-config.ts
|
|
3
2
|
/**
|
|
4
3
|
* Build a redacted `providersConfig` map for the gateway console (image / audio / video keys).
|
|
@@ -10,10 +9,9 @@ function buildSafeProvidersConfigForWeb(providers) {
|
|
|
10
9
|
if (!id) continue;
|
|
11
10
|
if (!raw || typeof raw !== "object" || Array.isArray(raw)) continue;
|
|
12
11
|
const o = raw;
|
|
13
|
-
const entry = {
|
|
12
|
+
const entry = {};
|
|
14
13
|
if (typeof o.region === "string" && o.region.trim()) entry.region = o.region.trim();
|
|
15
14
|
if (typeof o.baseUrl === "string" && o.baseUrl.trim()) entry.baseUrl = o.baseUrl.trim();
|
|
16
|
-
if (typeof o.imageBaseUrl === "string" && o.imageBaseUrl.trim()) entry.imageBaseUrl = o.imageBaseUrl.trim();
|
|
17
15
|
out[id] = entry;
|
|
18
16
|
}
|
|
19
17
|
return out;
|
|
@@ -12,6 +12,10 @@ export declare function createStrictRateLimitMiddleware(deps: StrictRateLimitDep
|
|
|
12
12
|
error: string;
|
|
13
13
|
code: string;
|
|
14
14
|
}, 429, "json">>;
|
|
15
|
+
export declare function createXopcCloudPollRateLimitMiddleware(deps: StrictRateLimitDeps): import("hono").MiddlewareHandler<any, string, {}, Response & import("hono").TypedResponse<{
|
|
16
|
+
error: string;
|
|
17
|
+
code: string;
|
|
18
|
+
}, 429, "json">>;
|
|
15
19
|
export declare function createChannelRateLimitMiddleware(deps: StrictRateLimitDeps): import("hono").MiddlewareHandler<any, string, {}, Response & import("hono").TypedResponse<{
|
|
16
20
|
error: string;
|
|
17
21
|
code: string;
|
|
@@ -63,6 +63,13 @@ function createStrictRateLimitMiddleware(deps) {
|
|
|
63
63
|
reason: "strict_rate_limit_exceeded"
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
|
+
function createXopcCloudPollRateLimitMiddleware(deps) {
|
|
67
|
+
return createClientRateLimitMiddleware(deps, {
|
|
68
|
+
limiter: () => buckets.xopcCloudPoll(),
|
|
69
|
+
exceededMessage: "XOPC Cloud polling rate limit exceeded",
|
|
70
|
+
reason: "xopc_cloud_poll_rate_limit_exceeded"
|
|
71
|
+
});
|
|
72
|
+
}
|
|
66
73
|
function createChannelRateLimitMiddleware(deps) {
|
|
67
74
|
return createClientRateLimitMiddleware(deps, {
|
|
68
75
|
limiter: () => buckets.channelApi(),
|
|
@@ -71,4 +78,4 @@ function createChannelRateLimitMiddleware(deps) {
|
|
|
71
78
|
});
|
|
72
79
|
}
|
|
73
80
|
//#endregion
|
|
74
|
-
export { createChannelRateLimitMiddleware, createStrictRateLimitMiddleware };
|
|
81
|
+
export { createChannelRateLimitMiddleware, createStrictRateLimitMiddleware, createXopcCloudPollRateLimitMiddleware };
|
|
@@ -72,17 +72,8 @@ async function applyMiscPatch(config, body) {
|
|
|
72
72
|
if (!raw || typeof raw !== "object" || Array.isArray(raw)) continue;
|
|
73
73
|
const next = cfgProviders[vendorId] ?? {};
|
|
74
74
|
const patch = raw;
|
|
75
|
-
for (const field of [
|
|
76
|
-
|
|
77
|
-
"baseUrl",
|
|
78
|
-
"region",
|
|
79
|
-
"imageBaseUrl"
|
|
80
|
-
]) if (patch[field] === null || patch[field] === "") delete next[field];
|
|
81
|
-
else if (typeof patch[field] === "string") {
|
|
82
|
-
const trimmed = patch[field].trim();
|
|
83
|
-
if (field === "apiKey" && isMaskedSecretPatchValue(trimmed)) continue;
|
|
84
|
-
next[field] = trimmed;
|
|
85
|
-
}
|
|
75
|
+
for (const field of ["baseUrl", "region"]) if (patch[field] === null || patch[field] === "") delete next[field];
|
|
76
|
+
else if (typeof patch[field] === "string") next[field] = patch[field].trim();
|
|
86
77
|
if (patch.azure === null) delete next.azure;
|
|
87
78
|
else if (patch.azure && typeof patch.azure === "object" && !Array.isArray(patch.azure)) next.azure = {
|
|
88
79
|
...next.azure ?? {},
|
|
@@ -4,6 +4,7 @@ import type { SSEHandlerConfig } from '../sse.js';
|
|
|
4
4
|
export interface AuthenticatedRouteDeps {
|
|
5
5
|
service: GatewayService;
|
|
6
6
|
strictRateLimitMiddleware: MiddlewareHandler;
|
|
7
|
+
xopcCloudPollRateLimitMiddleware: MiddlewareHandler;
|
|
7
8
|
channelRateLimitMiddleware?: MiddlewareHandler;
|
|
8
9
|
sseConfig: SSEHandlerConfig;
|
|
9
10
|
}
|
|
@@ -92,6 +92,14 @@ const AUTHENTICATED_LAZY_ROUTE_BUNDLES = [
|
|
|
92
92
|
return { register: registerDreamingRoutes };
|
|
93
93
|
}
|
|
94
94
|
},
|
|
95
|
+
{
|
|
96
|
+
id: "image-generation",
|
|
97
|
+
match: (path) => startsWithAny(path, ["/api/image-generation"]) || /^\/api\/agents\/[^/]+\/image-generation(?:\/setup)?$/.test(path),
|
|
98
|
+
load: async () => {
|
|
99
|
+
const { registerModelsRoutes } = await import("./models.js");
|
|
100
|
+
return { register: registerModelsRoutes };
|
|
101
|
+
}
|
|
102
|
+
},
|
|
95
103
|
{
|
|
96
104
|
id: "agents",
|
|
97
105
|
match: (path) => startsWithAny(path, [
|
|
@@ -135,8 +143,7 @@ const AUTHENTICATED_LAZY_ROUTE_BUNDLES = [
|
|
|
135
143
|
match: (path) => startsWithAny(path, [
|
|
136
144
|
"/api/models",
|
|
137
145
|
"/api/models-json",
|
|
138
|
-
"/api/providers"
|
|
139
|
-
"/api/image"
|
|
146
|
+
"/api/providers"
|
|
140
147
|
]),
|
|
141
148
|
load: async () => {
|
|
142
149
|
const { registerModelsRoutes } = await import("./models.js");
|