@xopcai/xopc 0.0.120 → 0.0.121
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/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/dashscope/src/image-generation-provider.d.ts +6 -5
- package/dist/extensions/dashscope/src/image-generation-provider.js +40 -64
- package/dist/extensions/dashscope/src/image-generation-provider.js.map +1 -1
- package/dist/extensions/dashscope/src/index.d.ts +1 -1
- package/dist/extensions/dashscope/src/index.js +2 -2
- package/dist/extensions/dashscope/xopc.extension.json +3 -2
- package/dist/extensions/minimax/src/image-generation-provider.d.ts +7 -5
- package/dist/extensions/minimax/src/image-generation-provider.js +43 -37
- package/dist/extensions/minimax/src/image-generation-provider.js.map +1 -1
- package/dist/extensions/minimax/src/index.d.ts +1 -1
- package/dist/extensions/minimax/src/index.js +2 -2
- package/dist/extensions/minimax/xopc.extension.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/Combination-HAlzriaz.js +41 -0
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-APTlX9Sq.js → agent-avatar-dicebear-4AW4JgSU.js} +1 -1
- package/dist/gateway/static/root/assets/agents-2SVUUPlp.js +2 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-DTKc5HHT.js → app-management-settings-panel-CE6GkGU2.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-BTciFrE9.js → appearance-settings-BmaUjghw.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-DT52OrbM.js → apps-page-BWeQ1I49.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-CiHaUMII.js → archive-plugin-CX4_KWut.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-t4gSrNjL.js → attachment-load-jf-PIIUU.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-suggestion-card-CtysjSoQ.js → automation-suggestion-card-BHk5rtJz.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-QHotl53D.js +1 -0
- package/dist/gateway/static/root/assets/{binary-plugins-BAbSldW5.js → binary-plugins-DG9XQikd.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-BNr_82xl.js → block-editor-Up_VIxLJ.js} +6 -6
- package/dist/gateway/static/root/assets/browser-settings-page-Cmwi6IIQ.js +8 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-tzD702Gg.js → capability-presets-api-CGM4OyMw.js} +1 -1
- package/dist/gateway/static/root/assets/{capability-presets-settings-panel-AGhTueAc.js → capability-presets-settings-panel-CzWt0LBb.js} +1 -1
- package/dist/gateway/static/root/assets/{channel-recipient-api-DL_KzwGE.js → channel-recipient-api-BEByL4_o.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-BOMCUe2J.js +1 -0
- package/dist/gateway/static/root/assets/connectors-page-C-Dexk_F.js +2 -0
- package/dist/gateway/static/root/assets/dist-Mys7eFJ5.js +1 -0
- package/dist/gateway/static/root/assets/dist-wO9a2_ID.js +1 -0
- package/dist/gateway/static/root/assets/{dreaming-settings-BEwWA1yf.js → dreaming-settings-WPEj8pir.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-Dl2kO0Sf.js → extension-debug-page-DZxa_j7-.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DmbLPsx_.js → extension-page-CseziW53.js} +1 -1
- package/dist/gateway/static/root/assets/extension-settings-page-B_9J-xyo.js +1 -0
- package/dist/gateway/static/root/assets/{fetch-B3ME5Eri.js → fetch-Cs4ck8zA.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-DI9_BBTo.js → gateway-config-api-Dl223a7r.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-DdzbtW9R.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-CSZQTz6K.js → gateway-startup-retry-IvePwjFE.js} +1 -1
- package/dist/gateway/static/root/assets/goal-detail-page-Dxldogms.js +1 -0
- package/dist/gateway/static/root/assets/{goals-config-api-Bhzqrp2w.js → goals-config-api-CUCP6yCl.js} +1 -1
- package/dist/gateway/static/root/assets/goals-page-DU5Nd6Xp.js +2 -0
- package/dist/gateway/static/root/assets/goals-settings-Dj87qPxv.js +1 -0
- package/dist/gateway/static/root/assets/heartbeat-settings-Cgm5JmwH.js +1 -0
- package/dist/gateway/static/root/assets/index-BU1pvxmS.js +191 -0
- package/dist/gateway/static/root/assets/index-l54WfSqe.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-kMp08SlX.js → keyboard-shortcuts-settings-DJgYw0nB.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-C10aS4XO.js +2 -0
- package/dist/gateway/static/root/assets/{markdown-split-Bc0w40vz.js → markdown-split-gnQ_EiGo.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-DJ_HvgIy.js → media-plugins-CQV-mgJn.js} +1 -1
- package/dist/gateway/static/root/assets/messages-C6Kc4Jhf.js +3 -0
- package/dist/gateway/static/root/assets/models-hub-panel-B35CAfg6.js +2 -0
- package/dist/gateway/static/root/assets/note-detail-page-Brlwse8x.js +2 -0
- package/dist/gateway/static/root/assets/{note-image-lightbox-4zntqpZq.js → note-image-lightbox-BthwKjLA.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-VocWOjoK.js → notes-page-CoAwRc7L.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-BbA7sRd_.js → preview-open-alternatives-BPMXC-2u.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-B36RQ05h.js +1 -0
- package/dist/gateway/static/root/assets/{save-bar-controls-Dividh61.js → save-bar-controls-BEHqwZjz.js} +1 -1
- package/dist/gateway/static/root/assets/schedule-field-CMY25m97.js +1 -0
- package/dist/gateway/static/root/assets/schema-form-CxjxsFfg.js +1 -0
- package/dist/gateway/static/root/assets/sessions-page-73THChnj.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-CR9VsY-R.js +1 -0
- package/dist/gateway/static/root/assets/{settings-collapsible-section-BMCOfuE_.js → settings-collapsible-section-s-kiLAxP.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-form-section-DBkGwpIN.js → settings-form-section-CIxIEYxU.js} +1 -1
- package/dist/gateway/static/root/assets/settings-page-BJ1AhfKI.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-layout-NxoW5Y57.js → settings-page-layout--6qT7ZJa.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-C1TtS1vJ.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-B0suFCfj.js → share-preview-page-BZADSbS1.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-gqC8Rmhy.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-C9P-WYvS.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-CEpSvOhF.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-CrmEnyX4.js → system-settings-panel-Czjf0kLJ.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-BAsGn25g.js → typed-models-lib-Cmt8SYdI.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-C7vcAoGb.js → use-channel-catalog-DyM-ckEQ.js} +1 -1
- package/dist/gateway/static/root/assets/user-profile-settings-panel-BygLv8vm.js +1 -0
- package/dist/gateway/static/root/assets/{utils-Dl9efgnV.js → utils-CloW8coB.js} +1 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-BsoqJba6.js +1 -0
- package/dist/gateway/static/root/assets/{voice-player-store-CMC5NOJp.js → voice-player-store-DduWlJYV.js} +1 -1
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-CcQeX6l5.js +3 -0
- package/dist/gateway/static/root/assets/workflows-page-CeA8A9Ef.js +18 -0
- package/dist/gateway/static/root/index.html +7 -8
- package/dist/package.js +1 -1
- package/dist/src/agent/embedded/xopc-auth-storage.d.ts +1 -5
- package/dist/src/agent/embedded/xopc-auth-storage.js +2 -8
- package/dist/src/agent/embedded/xopc-auth-storage.js.map +1 -1
- package/dist/src/agent/embedded/xopc-tools-bridge.js +23 -0
- package/dist/src/agent/embedded/xopc-tools-bridge.js.map +1 -1
- package/dist/src/agent/goals/checklist-judge.js +1 -1
- package/dist/src/agent/goals/checklist-judge.js.map +1 -1
- package/dist/src/agent/goals/judge.js +1 -1
- package/dist/src/agent/goals/judge.js.map +1 -1
- package/dist/src/agent/image/tool-model-config.d.ts +2 -0
- package/dist/src/agent/image/tool-model-config.js +2 -2
- package/dist/src/agent/image/tool-model-config.js.map +1 -1
- package/dist/src/agent/image/understanding/pi-ai-provider.js +1 -1
- package/dist/src/agent/image/understanding/pi-ai-provider.js.map +1 -1
- package/dist/src/agent/memory/compaction.d.ts +1 -1
- package/dist/src/agent/memory/compaction.js +1 -1
- package/dist/src/agent/memory/compaction.js.map +1 -1
- package/dist/src/agent/middleware/self-verify.d.ts +3 -0
- package/dist/src/agent/middleware/self-verify.js +18 -0
- package/dist/src/agent/middleware/self-verify.js.map +1 -1
- package/dist/src/agent/orchestration/agent-event-handler.js +28 -3
- package/dist/src/agent/orchestration/agent-event-handler.js.map +1 -1
- package/dist/src/agent/prompt/sections/tooling.js +21 -5
- package/dist/src/agent/prompt/sections/tooling.js.map +1 -1
- package/dist/src/agent/prompt/service-prompt-builder.js +1 -0
- package/dist/src/agent/prompt/service-prompt-builder.js.map +1 -1
- package/dist/src/agent/prompt/system-prompt.d.ts +1 -0
- package/dist/src/agent/prompt/system-prompt.js +13 -1
- package/dist/src/agent/prompt/system-prompt.js.map +1 -1
- package/dist/src/agent/sandbox/path-policy.js +30 -6
- package/dist/src/agent/sandbox/path-policy.js.map +1 -1
- package/dist/src/agent/service/btw-query.js +1 -1
- package/dist/src/agent/service/btw-query.js.map +1 -1
- package/dist/src/agent/starter-agents.js +16 -16
- package/dist/src/agent/starter-agents.js.map +1 -1
- package/dist/src/agent/tools/image-generate-tool.js +12 -1
- package/dist/src/agent/tools/image-generate-tool.js.map +1 -1
- package/dist/src/agent/tools/session-search-tool.js +1 -1
- package/dist/src/agent/tools/session-search-tool.js.map +1 -1
- package/dist/src/agent/tools/web-extract.js +1 -1
- package/dist/src/agent/tools/web-extract.js.map +1 -1
- package/dist/src/agent-manifest/index.js +2 -2
- package/dist/src/agent-manifest/schema.d.ts +66 -0
- package/dist/src/agent-manifest/schema.js +28 -2
- package/dist/src/agent-manifest/schema.js.map +1 -1
- package/dist/src/automations/draft/automation-draft-service.js +1 -1
- package/dist/src/automations/draft/automation-draft-service.js.map +1 -1
- package/dist/src/cli/commands/agent.js +2 -2
- package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/cli/commands/onboard/model.js +161 -11
- package/dist/src/cli/commands/onboard/model.js.map +1 -1
- package/dist/src/cli/commands/onboard.js +1 -1
- package/dist/src/cli/commands/profile.js +1 -1
- package/dist/src/cli/commands/tunnel.js +1 -1
- package/dist/src/cli/commands/update.js +1 -1
- package/dist/src/cli/extension-cli-register.js +1 -1
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/config/default-model.d.ts +11 -0
- package/dist/src/config/default-model.js +19 -0
- package/dist/src/config/default-model.js.map +1 -0
- package/dist/src/config/index.js +3 -3
- package/dist/src/config/schema.d.ts +71 -11
- package/dist/src/config/schema.js +57 -22
- package/dist/src/config/schema.js.map +1 -1
- package/dist/src/connectors/registries/smithery.js +10 -9
- package/dist/src/connectors/registries/smithery.js.map +1 -1
- package/dist/src/daemon/install-plan.js +2 -1
- package/dist/src/daemon/install-plan.js.map +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/global-defaults-admin.js +6 -16
- package/dist/src/gateway/global-defaults-admin.js.map +1 -1
- package/dist/src/gateway/hono/lib/config-payload.d.ts +24 -0
- package/dist/src/gateway/hono/routes/agents.js +1 -79
- package/dist/src/gateway/hono/routes/agents.js.map +1 -1
- package/dist/src/gateway/hono/routes/models.js +132 -14
- package/dist/src/gateway/hono/routes/models.js.map +1 -1
- package/dist/src/gateway/hono/routes/voice.js +1 -1
- package/dist/src/gateway/hono/routes/voice.js.map +1 -1
- package/dist/src/gateway/image-capabilities.d.ts +11 -1
- package/dist/src/gateway/image-capabilities.js +32 -43
- package/dist/src/gateway/image-capabilities.js.map +1 -1
- package/dist/src/gateway/run-loop.js +1 -1
- package/dist/src/gateway/workspace-editor-path.js +9 -1
- package/dist/src/gateway/workspace-editor-path.js.map +1 -1
- package/dist/src/generated/bundled-image-generation-providers.d.ts +4 -2
- package/dist/src/generated/bundled-image-generation-providers.js +6 -4
- package/dist/src/generated/bundled-image-generation-providers.js.map +1 -1
- package/dist/src/mcp/channel-bridge.js +1 -1
- package/dist/src/media/paths.js +3 -4
- package/dist/src/media/paths.js.map +1 -1
- package/dist/src/notes/service.js +1 -1
- package/dist/src/notes/service.js.map +1 -1
- package/dist/src/providers/domestic-presets.d.ts +615 -0
- package/dist/src/providers/domestic-presets.js +834 -0
- package/dist/src/providers/domestic-presets.js.map +1 -0
- package/dist/src/providers/env-keys.js +29 -5
- package/dist/src/providers/env-keys.js.map +1 -1
- package/dist/src/providers/extension-stream-bridge.js +1 -1
- package/dist/src/providers/extension-stream-bridge.js.map +1 -1
- package/dist/src/providers/index.d.ts +5 -5
- package/dist/src/providers/index.js +101 -21
- package/dist/src/providers/index.js.map +1 -1
- package/dist/src/providers/model-discovery.d.ts +17 -0
- package/dist/src/providers/model-discovery.js +61 -0
- package/dist/src/providers/model-discovery.js.map +1 -0
- package/dist/src/providers/model-registry.d.ts +1 -1
- package/dist/src/providers/model-registry.js +1 -1
- package/dist/src/providers/model-registry.js.map +1 -1
- package/dist/src/providers/presentation.js +185 -14
- package/dist/src/providers/presentation.js.map +1 -1
- package/dist/src/session/session-title.js +1 -1
- package/dist/src/session/session-title.js.map +1 -1
- package/dist/src/tui/xopc-tui-keybindings.d.ts +1 -1
- package/dist/src/voice/tts/summarize.js +1 -1
- package/dist/src/voice/tts/summarize.js.map +1 -1
- package/dist/src/workflows/draft/workflow-draft-service.js +1 -1
- package/dist/src/workflows/draft/workflow-draft-service.js.map +1 -1
- package/package.json +6 -6
- package/dist/gateway/static/root/assets/Combination-BzaXOLd9.js +0 -41
- package/dist/gateway/static/root/assets/agents-CFW_FS_V.js +0 -2
- package/dist/gateway/static/root/assets/automations-page-B2YvT3ES.js +0 -1
- package/dist/gateway/static/root/assets/browser-settings-page-BQEXPhDU.js +0 -8
- package/dist/gateway/static/root/assets/channels-settings-DRTutLlN.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-DneJVuge.js +0 -2
- package/dist/gateway/static/root/assets/dist-By6Rh2ee.js +0 -1
- package/dist/gateway/static/root/assets/dist-CkobR7mk.js +0 -1
- package/dist/gateway/static/root/assets/dist-DokQNVMQ.js +0 -1
- package/dist/gateway/static/root/assets/extension-settings-page-BS2rx40e.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-DAFI_T0W.js +0 -1
- package/dist/gateway/static/root/assets/goal-detail-page-DLuz4jC9.js +0 -1
- package/dist/gateway/static/root/assets/goals-page-DTAfv9Ft.js +0 -2
- package/dist/gateway/static/root/assets/goals-settings-CWN2iirQ.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-CkkkHvOi.js +0 -1
- package/dist/gateway/static/root/assets/index-CnjzMw5i.js +0 -191
- package/dist/gateway/static/root/assets/index-E1QinYKp.css +0 -1
- package/dist/gateway/static/root/assets/logs-page-CDXDlS_W.js +0 -2
- package/dist/gateway/static/root/assets/messages-CISb1HLv.js +0 -3
- package/dist/gateway/static/root/assets/models-hub-panel-BTwxMIgZ.js +0 -2
- package/dist/gateway/static/root/assets/note-detail-page-BBfOeB0m.js +0 -2
- package/dist/gateway/static/root/assets/remote-access-hub-CXwjuD_Q.js +0 -1
- package/dist/gateway/static/root/assets/schedule-field-pRheF2CO.js +0 -1
- package/dist/gateway/static/root/assets/schema-form-D6PiPxfr.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-CpcVySQK.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BVy_TawT.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-CZpNyCWn.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-MVHLLu_a.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-C6DBbQGo.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-6hJmhwSn.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-Im1MA0Iw.js +0 -2
- package/dist/gateway/static/root/assets/user-profile-settings-panel-QAQWGelF.js +0 -1
- package/dist/gateway/static/root/assets/voice-api-key-field-D-6XueTv.js +0 -1
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-DVPllR4k.js +0 -3
- package/dist/gateway/static/root/assets/workflows-page-B94WISTW.js +0 -18
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","names":[],"sources":["../../../src/config/schema.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport {\n AgentConfigEntrySchema,\n CapabilityPresetSchema,\n DEFAULT_CAPABILITY_PRESET_ID,\n} from '../agent-manifest/schema.js';\nimport { checkCacheDir } from '../browser/cache-dir-policy.js';\nimport { validatePublicUrl } from './public-url.js';\n\n// ============================================\n// Agent Configs\n// ============================================\n\n/**\n * Agent model ref. Always an object with explicit `primary` and optional\n * `fallbacks` chain. No string-form shorthand — every write site builds the\n * object explicitly so reads never branch on shape.\n */\nexport const AgentModelRefSchema = z\n .object({\n primary: z.string().min(1),\n fallbacks: z.array(z.string()).optional(),\n })\n .strict();\n\nexport type AgentModelConfig = z.infer<typeof AgentModelRefSchema>;\n\nexport const AgentTypedModelRoleSchema = z\n .object({\n description: z.string().max(500).optional(),\n model: z.string().min(1),\n fallbacks: z.array(z.string().min(1)).optional(),\n })\n .strict()\n .superRefine((entry, ctx) => {\n const validateRef = (ref: string) => {\n const trimmed = ref.trim();\n const idx = trimmed.indexOf('/');\n return idx > 0 && idx < trimmed.length - 1;\n };\n if (!validateRef(entry.model)) {\n ctx.addIssue({\n code: 'custom',\n message: `model must be provider/model format (got '${entry.model}')`,\n path: ['model'],\n });\n }\n for (const [index, fallback] of (entry.fallbacks ?? []).entries()) {\n if (!validateRef(fallback)) {\n ctx.addIssue({\n code: 'custom',\n message: `fallback must be provider/model format (got '${fallback}')`,\n path: ['fallbacks', index],\n });\n }\n }\n });\n\nexport type AgentTypedModelRole = z.infer<typeof AgentTypedModelRoleSchema>;\n\nconst AgentTypedModelRolesSchema = z\n .record(z.string().regex(/^[a-z][a-z0-9_-]{0,63}$/), AgentTypedModelRoleSchema)\n .optional();\n\nexport const AgentModelsSchema = z\n .object({\n defaultRole: z.string().regex(/^[a-z][a-z0-9_-]{0,63}$/).optional(),\n roles: AgentTypedModelRolesSchema,\n })\n .strict()\n .optional();\n\nexport type AgentModelsConfig = z.infer<typeof AgentModelsSchema>;\n\n/**\n * Image-generation model ref. {@link AgentModelRefSchema} plus runtime knobs\n * (`timeoutMs`, `autoProviderFallback`) used by the image-generation runtime.\n */\nexport const AgentImageGenerationModelSchema = z\n .object({\n primary: z.string().min(1),\n fallbacks: z.array(z.string()).optional(),\n /** Hard cap for the whole generation attempt (ms). */\n timeoutMs: z.number().int().positive().optional(),\n /**\n * When all `primary + fallbacks` candidates fail, sweep every other\n * configured provider before giving up.\n */\n autoProviderFallback: z.boolean().optional(),\n })\n .strict();\n\nexport type AgentImageGenerationModelConfig = z.infer<typeof AgentImageGenerationModelSchema>;\n\nexport type AgentTypedModel = AgentTypedModelRole & { id: string };\n\nexport const AgentsConfigSchema = z.object({\n /** Default agent id when not specified (routing / session creation). */\n default: z.string().optional(),\n /** Protected global defaults preset applied before each agent's own presets. */\n defaultPreset: z.string().default(DEFAULT_CAPABILITY_PRESET_ID),\n capabilityPresets: z.record(z.string(), CapabilityPresetSchema).default({}),\n list: z.array(AgentConfigEntrySchema).default([]),\n}).strict().default({\n default: 'main',\n defaultPreset: DEFAULT_CAPABILITY_PRESET_ID,\n capabilityPresets: {\n [DEFAULT_CAPABILITY_PRESET_ID]: {\n id: DEFAULT_CAPABILITY_PRESET_ID,\n name: 'Global defaults',\n description: 'Default capabilities inherited by every agent.',\n version: 1,\n models: {\n defaultRole: 'deep',\n roles: {},\n },\n },\n },\n list: [\n {\n id: 'main',\n enabled: true,\n identity: {\n name: 'Main',\n role: 'General assistant',\n language: 'en',\n tone: 'direct',\n },\n responsibilities: {\n primary: ['Help the user complete tasks'],\n },\n workspace: { root: '~/.xopc/workspace/main' },\n tools: { builtin: {} },\n skills: { mode: 'all' },\n memory: {\n mode: 'confirmWrite',\n sources: ['session', 'curated'],\n writePolicy: { curated: 'confirm' },\n },\n workflows: {},\n boundaries: { requiresConfirmation: [], forbidden: [], escalation: [] },\n },\n ],\n});\n\nconst BrowserCloudConfigSchema = z\n .object({\n apiKey: z.string().optional(),\n projectId: z.string().optional(),\n region: z.string().optional(),\n })\n .strict()\n .optional();\n\nconst BrowserExtensionConfigSchema = z\n .object({\n port: z.number().int().min(1024).max(65535).optional(),\n host: z.string().min(1).optional(),\n connectionTimeout: z.number().int().positive().optional(),\n })\n .strict()\n .optional();\n\nconst BrowserCloakConfigSchema = z\n .object({\n keepOpen: z.boolean().optional(),\n temporaryProfile: z.boolean().optional(),\n cacheDir: z.string().optional().superRefine((value, ctx) => {\n const result = checkCacheDir(value);\n if (result.ok === false) {\n ctx.addIssue({ code: 'custom', message: result.message });\n }\n }),\n binaryPath: z.string().optional(),\n timezone: z.string().optional(),\n locale: z.string().optional(),\n webrtcIp: z.string().optional(),\n fingerprintPlatform: z.string().optional(),\n extraArgs: z.array(z.string()).optional(),\n })\n .strict()\n .optional();\n\nexport const BrowserConfigSchema = z\n .object({\n enabled: z.boolean().default(true),\n backend: z.enum(['local', 'cdp', 'cloud', 'extension', 'cloakbrowser']).default('extension'),\n headless: z.boolean().optional(),\n allowPrivateUrls: z.boolean().optional(),\n commandTimeout: z.number().int().min(5).max(900).optional(),\n cloudProvider: z.enum(['local', 'browserbase', 'browser-use']).optional(),\n cloud: BrowserCloudConfigSchema,\n cdpUrl: z.string().optional(),\n extension: BrowserExtensionConfigSchema,\n cloakbrowser: BrowserCloakConfigSchema,\n humanize: z.boolean().optional(),\n humanPreset: z.enum(['default', 'careful']).optional(),\n dialogPolicy: z.enum(['must_respond', 'auto_dismiss', 'auto_accept']).optional(),\n dialogTimeoutSeconds: z.number().int().positive().optional(),\n })\n .strict()\n .default({ enabled: true, backend: 'extension' });\n\n// ============================================\n// Channel Configs (per-channel Zod lives in bundled extensions; root schema is open)\n// ============================================\n\nexport {\n TelegramTopicConfigSchema,\n TelegramGroupConfigSchema,\n TelegramAccountConfigSchema,\n TelegramConfigSchema,\n} from '../../extensions/telegram/src/config-schema.js';\nexport type { TelegramConfig } from '../../extensions/telegram/src/config-schema.js';\nexport { WeixinAccountConfigSchema, WeixinConfigSchema } from '../../extensions/weixin/src/config-schema.js';\nexport type { WeixinConfig } from '../../extensions/weixin/src/config-schema.js';\n// ============================================\n// Session Routing Configuration\n// ============================================\n\nexport const BindingMatchSchema = z.object({\n channel: z.string(),\n accountId: z.string().optional(),\n peerKind: z.string().optional(),\n peerId: z.string().optional(),\n guildId: z.string().optional(),\n teamId: z.string().optional(),\n memberRoleIds: z.array(z.string()).optional(),\n});\n\nexport const BindingRuleSchema = z.object({\n id: z.string().optional(),\n agentId: z.string(),\n priority: z.number().default(100),\n match: BindingMatchSchema,\n enabled: z.boolean().default(true),\n});\n\nexport const BindingsConfigSchema = z.array(BindingRuleSchema).default([]);\n\nexport const SessionDmScopeSchema = z.enum([\n 'main',\n 'per-peer',\n 'per-channel-peer',\n 'per-account-channel-peer',\n]);\n\nexport const SessionStorageConfigSchema = z.object({\n pruneAfterMs: z.number().optional(),\n maxEntries: z.number().optional(),\n});\n\nexport const SessionResetModeSchema = z.enum(['daily', 'idle']);\n\nexport const SessionResetConfigSchema = z\n .object({\n mode: SessionResetModeSchema.optional(),\n /** Local hour (0–23) for the daily reset boundary. */\n atHour: z.number().int().min(0).max(23).optional(),\n /** Sliding idle window (minutes). When set with daily mode, whichever expires first wins. */\n idleMinutes: z.number().int().min(0).optional(),\n })\n .strict();\n\nexport const SessionResetByTypeSchema = z\n .object({\n direct: SessionResetConfigSchema.optional(),\n group: SessionResetConfigSchema.optional(),\n thread: SessionResetConfigSchema.optional(),\n })\n .strict();\n\nexport const SessionScopeSchema = z.enum(['per-sender', 'global']);\n\nexport const SessionConfigSchema = z.object({\n scope: SessionScopeSchema.default('per-sender'),\n mainKey: z.string().default('main'),\n dmScope: SessionDmScopeSchema.default('main'),\n identityLinks: z.record(z.string(), z.array(z.string())).optional(),\n resetTriggers: z.array(z.string()).optional(),\n idleMinutes: z.number().int().positive().optional(),\n reset: SessionResetConfigSchema.optional(),\n resetByType: SessionResetByTypeSchema.optional(),\n resetByChannel: z.record(z.string(), SessionResetConfigSchema).optional(),\n storage: SessionStorageConfigSchema.optional(),\n}).default({\n scope: 'per-sender',\n mainKey: 'main',\n dmScope: 'main',\n});\n\n/** Channel buckets — shapes validated post-parse by registered channel plugins. */\nexport const ChannelsConfigSchema = z.record(z.string(), z.unknown()).default({});\n\nexport const SearchProviderEntrySchema = z.object({\n type: z.enum(['brave', 'tavily', 'bing', 'searxng']),\n apiKey: z.string().optional(),\n /** SearXNG instance base URL (e.g. http://localhost:8080) */\n url: z.string().optional(),\n disabled: z.boolean().optional(),\n});\n\nexport type SearchProviderEntry = z.infer<typeof SearchProviderEntrySchema>;\n\nexport const WebSearchConfigSchema = z.object({\n maxResults: z.number().default(5),\n /** Ordered API providers; empty → HTML fallback only */\n providers: z.array(SearchProviderEntrySchema).default([]),\n});\n\nexport type WebSearchConfig = z.infer<typeof WebSearchConfigSchema>;\n\nexport const WebsiteBlocklistSchema = z.object({\n /** Master switch. Default false (no blocking). */\n enabled: z.boolean().default(false),\n /** Domain patterns to block (e.g. \"example.com\", \"*.evil.org\"). */\n domains: z.array(z.string()).default([]),\n});\n\nexport type WebsiteBlocklistConfig = z.infer<typeof WebsiteBlocklistSchema>;\n\nexport const WebToolsConfigSchema = z.object({\n /** Search result HTML fallback: cn → Bing, otherwise DuckDuckGo */\n region: z.enum(['cn', 'global']).optional(),\n search: WebSearchConfigSchema.optional(),\n /** Domain blocklist for web_fetch / web_extract / browser tools. */\n blocklist: WebsiteBlocklistSchema.optional(),\n});\n\nexport type WebToolsConfig = z.infer<typeof WebToolsConfigSchema>;\n\nexport const ToolsConfigSchema = z.object({\n web: WebToolsConfigSchema.optional(),\n /**\n * Per-capability media providers. Currently only `audio` (STT) is wired;\n * `image` / `video` slots are reserved for future capabilities.\n */\n media: z.lazy(() => ToolsMediaConfigSchema),\n}).default({\n web: {\n search: {\n maxResults: 5,\n providers: [],\n },\n },\n});\n\n// ============================================\n// Gateway Configuration\n// ============================================\n\nexport const GatewayAuthRateLimitSchema = z\n .object({\n enabled: z.boolean().default(true),\n maxAttempts: z.number().int().min(1).default(5),\n windowMs: z.number().default(900_000),\n blockDurationMs: z.number().default(300_000),\n /** OpenClaw alias for blockDurationMs. */\n lockoutMs: z.number().optional(),\n /** Skip rate limiting for loopback client IPs (default true). Remote browser Origin requests never exempt. */\n exemptLoopback: z.boolean().default(true),\n /**\n * Coalesce same-client failures arriving within this window into a single\n * attempt. Absorbs SPA fan-out / SDK auto-retry storms without weakening\n * brute-force protection (deliberate attackers are still rate-limited to\n * one effective attempt per window). Set to 0 to disable.\n */\n burstCoalesceMs: z.number().int().min(0).default(1000),\n })\n .optional();\n\nexport const GatewaySecuritySchema = z\n .object({\n /** When true, non-loopback binds require explicit gateway.auth.rateLimit configuration. */\n strict: z.boolean().optional(),\n })\n .optional();\n\nexport const GatewayTrustedProxySchema = z\n .object({\n /** Header set by the reverse proxy with the authenticated user identity. */\n userHeader: z.string().min(1),\n /** Additional headers that must be present (e.g. proxy auth markers). */\n requiredHeaders: z.array(z.string()).optional(),\n /** When non-empty, only these user identities are allowed. */\n allowUsers: z.array(z.string()).optional(),\n /** Allow trusted-proxy auth when the TCP source is loopback (same-host reverse proxy). */\n allowLoopback: z.boolean().optional(),\n })\n .strict();\n\nexport const GatewayAuthSchema = z\n .object({\n mode: z.enum(['none', 'token', 'password', 'trusted-proxy']).default('token'),\n token: z.string().optional(),\n password: z.string().optional(),\n /** When true (default for Serve), browser UI may auth via Tailscale identity headers. API routes still require token. */\n allowTailscale: z.boolean().optional(),\n rateLimit: GatewayAuthRateLimitSchema,\n trustedProxy: GatewayTrustedProxySchema.optional(),\n })\n .default({\n mode: 'token',\n });\n\nexport const GatewayTailscaleConsentSchema = z.object({\n version: z.string().min(1),\n acceptedAt: z.string().min(1),\n});\n\nexport const GatewayTailscaleSchema = z\n .object({\n mode: z.enum(['off', 'serve', 'funnel']).default('off'),\n resetOnExit: z.boolean().default(true),\n consent: GatewayTailscaleConsentSchema.optional(),\n })\n .default({\n mode: 'off',\n resetOnExit: true,\n });\n\nexport const GatewayRemoteSchema = z.object({\n url: z.string().url(),\n token: z.string().optional(),\n password: z.string().optional(),\n transport: z.enum(['direct', 'ssh']).default('direct'),\n sshTarget: z.string().optional(),\n sshIdentity: z.string().optional(),\n tlsFingerprint: z.string().optional(),\n});\n\nexport const GatewayTlsSchema = z\n .object({\n enabled: z.boolean().default(false),\n autoGenerate: z.boolean().default(false),\n certPath: z.string().optional(),\n keyPath: z.string().optional(),\n })\n .default({\n enabled: false,\n autoGenerate: false,\n });\n\nexport const GatewayModeSchema = z.enum(['local', 'remote']).default('local');\n\nexport const HeartbeatConfigSchema = z\n .object({\n enabled: z.boolean(),\n intervalMs: z.number(),\n /** When false, heartbeat instructions are only sent during heartbeat polling turns (not in every chat system prompt). */\n includeSystemPromptSection: z.boolean().optional().default(false),\n target: z.string().optional(),\n targetChatId: z.string().optional(),\n prompt: z.string().optional(),\n ackMaxChars: z.number().optional(),\n isolatedSession: z.boolean().optional(),\n activeHours: z\n .object({\n start: z.string(),\n end: z.string(),\n timezone: z.string().optional(),\n })\n .optional(),\n })\n .default({\n enabled: true,\n intervalMs: 1_800_000,\n includeSystemPromptSection: false,\n });\n\nexport const GatewayChannelConnectDeferModeSchema = z.enum(['auto', 'off', 'explicit']);\n\nexport const TunnelConsentSchema = z.object({\n version: z.string().min(1),\n acceptedAt: z.string().min(1),\n});\n\nexport const TunnelConfigSchema = z\n .object({\n enabled: z.boolean().default(false),\n brokerUrl: z.string().url().default('https://frp.xopc.ai/api'),\n /** Broker register API secret (env `XOPC_TUNNEL_REGISTRATION_SECRET` overrides when set). */\n registrationSecret: z.string().min(1).optional(),\n autoStart: z.boolean().default(false),\n subdomain: z.string().optional(),\n consent: TunnelConsentSchema.optional(),\n })\n .default({\n enabled: false,\n brokerUrl: 'https://frp.xopc.ai/api',\n autoStart: false,\n });\n\nexport type TunnelConfig = z.infer<typeof TunnelConfigSchema>;\n\n/**\n * Workspace-scoped concerns (file import, etc.). Distinct from\n * agent manifest workspace roots; this block carries\n * feature configuration for workspace-related routes.\n */\nexport const WorkspaceImportConfigSchema = z.object({\n /** Workspace-relative subdir for imported files. Default `imports`. */\n targetDir: z.string().default('imports'),\n /** Per-file byte cap. Default 100 MiB. */\n maxBytes: z.number().int().min(1024).max(10_737_418_240).default(104_857_600),\n /** When false, the route rejects `onConflict: 'overwrite'`. Default true. */\n allowOverwrite: z.boolean().default(true),\n});\nexport type WorkspaceImportConfig = z.infer<typeof WorkspaceImportConfigSchema>;\n\nexport const WorkspaceConfigSchema = z.object({\n import: WorkspaceImportConfigSchema.optional(),\n}).optional();\nexport type WorkspaceConfig = z.infer<typeof WorkspaceConfigSchema>;\n\nexport const GatewayBindModeSchema = z.enum(['auto', 'loopback', 'lan', 'tailnet', 'custom']);\n\nexport const GatewayConfigSchema = z.object({\n /** Semantic bind mode. */\n bind: GatewayBindModeSchema.optional(),\n /** IPv4 listen address when `bind` is `custom`. */\n customBindHost: z.string().optional(),\n port: z.number().optional(),\n /** local: this process runs the gateway; remote: CLI clients target gateway.remote. */\n mode: GatewayModeSchema.optional(),\n /** Persistent remote gateway target for CLI/TUI/MCP when mode=remote. */\n remote: GatewayRemoteSchema.optional(),\n tailscale: GatewayTailscaleSchema.optional(),\n tls: GatewayTlsSchema.optional(),\n auth: GatewayAuthSchema.optional(),\n heartbeat: HeartbeatConfigSchema.optional(),\n maxSseConnections: z.number().optional(),\n corsOrigins: z.array(z.string()).optional(),\n /**\n * Reverse-proxy publicly reachable URL (e.g. `https://gateway.example.com`).\n * Optional. When set, mobile pairing surfaces this URL as the preferred\n * baseUrl and it is auto-added to the browser CORS/CSRF allowlist.\n * - Must be a URL with no path / query / userinfo.\n * - Must use `https:` for public hosts; `http:` is only allowed when the\n * hostname is in an RFC1918 / `.local` private range.\n */\n publicUrl: z\n .string()\n .superRefine((value, ctx) => {\n const result = validatePublicUrl(value);\n if (result.ok === false) {\n ctx.addIssue({ code: 'custom', message: `gateway.publicUrl: ${result.message}` });\n }\n })\n .optional(),\n /** Dangerous: allow browser Origin to match the HTTP Host header when not in corsOrigins. */\n dangerouslyAllowHostHeaderOriginFallback: z.boolean().optional(),\n /** CIDRs or exact IPs of reverse proxies allowed to terminate auth (trusted-proxy mode). */\n trustedProxies: z.array(z.string()).optional(),\n /** When true, fall back to X-Real-IP if X-Forwarded-For chain parsing fails. Default false (fail closed). */\n allowRealIpFallback: z.boolean().optional(),\n security: GatewaySecuritySchema,\n /**\n * How channel `start()` is split around HTTP listen when using `GatewayServer`.\n * - `auto` (default): defer ids come from channel plugin `meta.deferConnectUntilAfterListen` + enabled config.\n * - `off`: always start all channels in phase1 (troubleshooting / strict ordering).\n * - `explicit`: defer only `channelConnectDeferIds` (empty = defer none).\n */\n channelConnectDeferMode: GatewayChannelConnectDeferModeSchema.optional(),\n /** When `channelConnectDeferMode` is `explicit`, these channel plugin ids are deferred until after listen. */\n channelConnectDeferIds: z.array(z.string().min(1)).max(24).optional(),\n /** Removed from the defer set (applied after `auto` or `explicit` resolution). */\n channelConnectDeferSkipIds: z.array(z.string().min(1)).max(24).optional(),\n /** Default skills marketplace provider id. Built-in: 'store', 'skillhub', 'clawhub'. Extensions may register more. */\n skillsMarketplaceProvider: z.string().optional(),\n /** Base URL for the xopc skills marketplace (public REST API). */\n skillsStoreBaseUrl: z.string().url().optional(),\n /** File sharing configuration (temporary public download links for workspace files). */\n share: z.object({\n enabled: z.boolean().default(true),\n /** Default TTL in ms (default 24h). */\n defaultTtlMs: z.number().min(60_000).max(604_800_000).default(86_400_000),\n /** Maximum TTL in ms (default 7 days). */\n maxTtlMs: z.number().min(60_000).max(2_592_000_000).default(604_800_000),\n /** Maximum concurrent active shares (default 100). */\n maxActiveShares: z.number().min(1).max(10_000).default(100),\n /** Maximum shareable file size in bytes (default 100MB). */\n maxFileSize: z.number().min(1_048_576).max(10_737_418_240).default(104_857_600),\n /** MIME types allowed for inline preview (?inline=1). */\n inlinePreviewMimes: z.array(z.string()).default([\n 'image/png',\n 'image/jpeg',\n 'image/gif',\n 'image/webp',\n 'image/svg+xml',\n 'application/pdf',\n 'text/html',\n 'text/markdown',\n 'text/plain',\n 'application/json',\n ]),\n /** Folder-sharing controls (browse + ZIP). */\n directory: z.object({\n enabled: z.boolean().default(true),\n /** Maximum folder size in bytes at scan time (default 1 GB). */\n maxFolderSize: z.number().int().min(1_048_576).max(10_737_418_240).default(1_073_741_824),\n /** Maximum number of entries scanned for a single folder share. */\n maxFileCount: z.number().int().min(1).max(100_000).default(1_000),\n /** Traversal depth cap (defense against recursive symlinks). */\n maxDepth: z.number().int().min(1).max(64).default(20),\n /** In-memory directory listing cache TTL. */\n listingCacheMs: z.number().int().min(0).max(600_000).default(60_000),\n /** Maximum simultaneous ZIP streams per share token. */\n zipConcurrency: z.number().int().min(1).max(8).default(1),\n }).default({\n enabled: true,\n maxFolderSize: 1_073_741_824,\n maxFileCount: 1_000,\n maxDepth: 20,\n listingCacheMs: 60_000,\n zipConcurrency: 1,\n }),\n }).optional(),\n /** Site-share configuration (static directory or reverse-proxy a local dev server). */\n siteShare: z.object({\n enabled: z.boolean().default(true),\n /** Public host suffix that subdomain shares are served under. */\n publicHostSuffix: z.string().min(1).default('share.xopc.ai'),\n /** Default TTL in ms (default 6h, shorter than file shares — live app surface). */\n defaultTtlMs: z.number().int().min(60_000).max(604_800_000).default(21_600_000),\n /** Maximum TTL in ms (default 7 days). */\n maxTtlMs: z.number().int().min(60_000).max(2_592_000_000).default(604_800_000),\n /** Maximum concurrent active site shares. */\n maxActiveSites: z.number().int().min(1).max(1_000).default(5),\n static: z.object({\n enabled: z.boolean().default(true),\n /** Maximum total bytes of files served per static site. */\n maxRootDirSize: z.number().int().min(1_048_576).max(10_737_418_240).default(524_288_000),\n /** Maximum file count under root dir. */\n maxFileCount: z.number().int().min(1).max(100_000).default(10_000),\n /** Whether HTML/CSS rewrite of absolute paths is on by default. */\n rewriteEnabledByDefault: z.boolean().default(false),\n }).default({\n enabled: true,\n maxRootDirSize: 524_288_000,\n maxFileCount: 10_000,\n rewriteEnabledByDefault: false,\n }),\n proxy: z.object({\n /** Reverse-proxy mode default-enabled per the product brief. */\n enabled: z.boolean().default(true),\n /** Upstream host whitelist. Loopback by default. */\n allowedUpstreamHosts: z\n .array(z.string().min(1))\n .default(['127.0.0.1', 'localhost', '::1']),\n /** Upstream port whitelist (common dev-server ports). */\n allowedUpstreamPorts: z\n .array(z.number().int().min(1).max(65535))\n .default([3000, 3001, 4321, 5173, 8000, 8080, 8888, 9000]),\n /** Whether to forward WebSocket upgrades. */\n forwardWebSocket: z.boolean().default(true),\n /** Maximum request body size in bytes (50 MB). */\n bodySizeLimit: z.number().int().min(0).max(1_073_741_824).default(52_428_800),\n /** Per-request HTTP timeout in ms. */\n requestTimeoutMs: z.number().int().min(1_000).max(600_000).default(30_000),\n /** Per-WebSocket idle timeout in ms. */\n wsIdleTimeoutMs: z.number().int().min(10_000).max(3_600_000).default(300_000),\n /** Rewrite Set-Cookie Path attribute (subpath mode only). */\n rewriteSetCookiePath: z.boolean().default(true),\n }).default({\n enabled: true,\n allowedUpstreamHosts: ['127.0.0.1', 'localhost', '::1'],\n allowedUpstreamPorts: [3000, 3001, 4321, 5173, 8000, 8080, 8888, 9000],\n forwardWebSocket: true,\n bodySizeLimit: 52_428_800,\n requestTimeoutMs: 30_000,\n wsIdleTimeoutMs: 300_000,\n rewriteSetCookiePath: true,\n }),\n }).optional(),\n}).default({\n bind: 'loopback',\n port: 18790,\n auth: {\n mode: 'token',\n },\n heartbeat: {\n enabled: true,\n intervalMs: 1_800_000,\n includeSystemPromptSection: false,\n },\n maxSseConnections: 100,\n corsOrigins: [],\n skillsMarketplaceProvider: 'skillhub',\n skillsStoreBaseUrl: 'https://store.xopc.ai',\n});\n\nexport const ModelsDevConfigSchema = z.object({\n enabled: z.boolean().default(true),\n}).default({\n enabled: true,\n});\n\n// ============================================\n// STT (Speech-to-Text) Config\n// ============================================\n\nconst SttProviderConfigCatchallSchema = z.union([\n z.string(),\n z.number(),\n z.boolean(),\n z.null(),\n z.array(z.unknown()),\n z.record(z.string(), z.unknown()),\n]);\n\nexport const STTProviderConfigSchema = z\n .object({\n apiKey: z.string().optional(),\n model: z.string().optional(),\n baseUrl: z.string().optional(),\n headers: z.record(z.string(), z.string()).optional(),\n language: z.string().optional(),\n prompt: z.string().optional(),\n })\n .catchall(SttProviderConfigCatchallSchema);\n\nexport const STTFallbackConfigSchema = z.object({\n enabled: z.boolean().default(true),\n order: z.array(z.string().min(1)).default(['alibaba', 'openai']),\n});\n\nexport const MediaUnderstandingCapabilitiesSchema = z\n .array(z.enum(['image', 'audio', 'video']))\n .optional();\n\nexport const MediaUnderstandingModelSchema = z\n .object({\n provider: z.string().optional(),\n model: z.string().optional(),\n capabilities: MediaUnderstandingCapabilitiesSchema,\n type: z.union([z.literal('provider'), z.literal('cli')]).optional(),\n command: z.string().optional(),\n baseUrl: z.string().optional(),\n headers: z.record(z.string(), z.string()).optional(),\n apiKey: z.string().optional(),\n language: z.string().optional(),\n prompt: z.string().optional(),\n })\n .catchall(SttProviderConfigCatchallSchema);\n\nexport const STTConfigSchema = z\n .object({\n enabled: z.boolean().default(false),\n /** Primary provider id — any registered MediaUnderstandingProvider id. */\n provider: z.string().min(1).default('alibaba'),\n fallback: STTFallbackConfigSchema.optional(),\n timeoutMs: z.number().int().min(1000).max(180000).optional(),\n /** Ordered model entries for this capability (OpenClaw `tools.media.audio.models`). */\n models: z.array(MediaUnderstandingModelSchema).optional(),\n /** Provider settings map keyed by provider id. */\n providers: z.record(z.string(), STTProviderConfigSchema).optional(),\n })\n .strict();\n\n// ============================================\n// TTS (Text-to-Speech) Config\n// ============================================\n\nconst TtsProviderConfigCatchallSchema = z.union([\n z.string(),\n z.number(),\n z.boolean(),\n z.null(),\n z.array(z.unknown()),\n z.record(z.string(), z.unknown()),\n]);\n\nexport const TTSProviderConfigSchema = z\n .object({\n apiKey: z.string().optional(),\n model: z.string().optional(),\n voice: z.string().optional(),\n })\n .catchall(TtsProviderConfigCatchallSchema);\n\nexport const TTSFallbackConfigSchema = z.object({\n enabled: z.boolean().default(true),\n order: z\n .array(z.string().min(1))\n .default(['openai', 'alibaba', 'minimax', 'edge']),\n});\n\nexport const TTSModelOverridesConfigSchema = z.object({\n enabled: z.boolean().default(true),\n allowText: z.boolean().default(true),\n allowProvider: z.boolean().default(false),\n allowVoice: z.boolean().default(true),\n allowModelId: z.boolean().default(true),\n allowVoiceSettings: z.boolean().default(false),\n allowNormalization: z.boolean().default(false),\n allowSeed: z.boolean().default(false),\n});\n\nexport const TTSEdgeConfigSchema = z.object({\n enabled: z.boolean().default(true),\n voice: z.string().optional(),\n lang: z.string().optional(),\n outputFormat: z.string().optional(),\n pitch: z.string().optional(),\n rate: z.string().optional(),\n volume: z.string().optional(),\n proxy: z.string().optional(),\n timeoutMs: z.number().int().min(1000).max(120000).optional(),\n});\n\nexport const TTSSummarizationConfigSchema = z.object({\n enabled: z.boolean().optional(),\n targetLength: z.number().int().min(1).optional(),\n threshold: z.number().int().min(1).optional(),\n model: z.string().optional(),\n});\n\nexport const TTSConfigSchema = z\n .object({\n enabled: z.boolean().default(false),\n /** Primary provider id — any registered SpeechProviderPlugin id. */\n provider: z.string().min(1).default('edge'),\n trigger: z.enum(['off', 'always', 'inbound', 'tagged']).default('always'),\n fallback: TTSFallbackConfigSchema.optional(),\n maxTextLength: z.number().int().min(1).default(512), // Conservative default to accommodate all providers (Alibaba limit is 512)\n timeoutMs: z.number().int().min(1000).max(180000).default(60000),\n summarization: TTSSummarizationConfigSchema.optional(),\n modelOverrides: TTSModelOverridesConfigSchema.optional(),\n /** Provider settings map keyed by provider id. */\n providers: z.record(z.string(), TTSProviderConfigSchema).optional(),\n })\n .strict();\n\n// ============================================\n// messages.* — delivery / presentation concerns\n// ============================================\n\nexport const MessagesConfigSchema = z.object({\n /** Voice (text-to-speech) output configuration. */\n tts: TTSConfigSchema.optional(),\n}).optional();\n\nexport const ToolsMediaAudioConfigSchema = STTConfigSchema;\n\nexport const ToolsMediaConfigSchema = z\n .object({\n /** Shared model entries applied across media capabilities when entry lacks capabilities. */\n models: z.array(MediaUnderstandingModelSchema).optional(),\n /** Audio (speech-to-text) capability provider config. */\n audio: ToolsMediaAudioConfigSchema.optional(),\n })\n .optional();\n\n// ============================================\n// Provider Configs (capability providers: image / audio / video)\n// ============================================\n\n/**\n * Optional Azure OpenAI overrides used when an OpenAI image-generation\n * request should hit an Azure deployment instead of `api.openai.com`.\n *\n * URL template (when present):\n * `https://<resource>.openai.azure.com/openai/deployments/<deployment>/images/generations?api-version=<apiVersion>`\n */\nexport const ProviderAzureConfigSchema = z\n .object({\n /** Azure resource name (subdomain before `.openai.azure.com`). */\n resource: z.string().min(1).optional(),\n /** Azure deployment id (configured per model). */\n deployment: z.string().min(1).optional(),\n /** Azure REST API version, e.g. `2024-08-01-preview`. */\n apiVersion: z.string().min(1).optional(),\n })\n .strict();\n\n/** Per-vendor request overrides applied by the provider HTTP layer. */\nexport const ProviderRequestOverridesSchema = z\n .object({\n /** Hard cap for a single HTTP call (ms). */\n timeoutMs: z.number().int().positive().optional(),\n /** Extra headers merged into every outbound request. */\n headers: z.record(z.string(), z.string()).optional(),\n })\n .strict();\n\n/**\n * Generic per-vendor provider config — used by image / audio / video\n * capability providers via `cfg.providers.<id>`. Kept loose (`.strict()` but\n * everything optional) so adding a new vendor never requires a config\n * migration.\n */\nexport const ProviderAuthConfigSchema = z\n .object({\n /** Static API key (api-key / azure-key modes). */\n apiKey: z.string().optional(),\n /** Override the default REST base URL. */\n baseUrl: z.string().url().optional(),\n /** Vendor region (DashScope: `beijing` / `singapore`; AWS: region id). */\n region: z.string().optional(),\n /** Image-only base URL override (DashScope splits image vs LLM). */\n imageBaseUrl: z.string().url().optional(),\n /** Per-vendor request overrides. */\n request: ProviderRequestOverridesSchema.optional(),\n /** Azure OpenAI deployment overrides; only consumed by OpenAI image provider. */\n azure: ProviderAzureConfigSchema.optional(),\n })\n .strict();\n\nexport type ProviderAuthConfig = z.infer<typeof ProviderAuthConfigSchema>;\n\n/**\n * `cfg.providers.<id>` is keyed by provider id (`openai`, `dashscope`,\n * `minimax`, `google`, `fal`, …). Every entry is optional and validated by\n * {@link ProviderAuthConfigSchema}.\n */\nexport const ProvidersConfigSchema = z.record(z.string(), ProviderAuthConfigSchema);\n\nexport type ProvidersConfig = z.infer<typeof ProvidersConfigSchema>;\n\n// ============================================\n// Extension Configs \n// ============================================\n\n// Security config for extensions \nexport const ExtensionSecurityConfigSchema = z.object({\n checkPermissions: z.boolean().default(true),\n allowUntrusted: z.boolean().default(false),\n allow: z.array(z.string()).default([]),\n trackProvenance: z.boolean().default(true),\n allowPromptInjection: z.boolean().default(false),\n});\n\n// Slot config for extensions \nexport const ExtensionSlotsConfigSchema = z.object({\n memory: z.string().optional(),\n tts: z.string().optional(),\n imageGeneration: z.string().optional(),\n webSearch: z.string().optional(),\n});\n\n// Complete extensions config\n// Extension config allows both known fields AND arbitrary extension-specific config\n// Known fields: enabled (array), allow (array), security (object), slots (object)\n// Arbitrary: any other key is extension-specific config (e.g., extensions.hello.greeting)\nexport const ExtensionsConfigSchema: z.ZodType<Record<string, unknown>> = z.record(z.string(), z.unknown());\n\n// ============================================\n// Update Config\n// ============================================\n\nexport const UpdateAutoConfigSchema = z\n .object({\n /** Enable automatic update installation. Default false. */\n enabled: z.boolean().default(false),\n /** Hours to wait before applying a stable update after first detection. */\n stableDelayHours: z.number().min(0).default(6),\n /** Additional random jitter hours for stable rollout (avoids thundering herd). */\n stableJitterHours: z.number().min(0).default(12),\n /** How often to re-check for beta updates (hours). Min 0.25. */\n betaCheckIntervalHours: z.number().min(0.25).default(1),\n })\n .strict()\n .optional();\n\n/** Persistent `/goal` (Ralph loop) — Hermes-aligned defaults. */\nexport const GoalNotificationEventSchema = z.enum([\n 'done',\n 'blocked',\n 'needs_input',\n 'queue_failed',\n 'queue_retry',\n 'queue_succeeded',\n 'queue_skipped',\n]);\n\nexport const GoalNotificationTargetSchema = z\n .object({\n channel: z.string().min(1),\n chatId: z.string().min(1),\n accountId: z.string().optional(),\n threadId: z.union([z.string(), z.number()]).optional(),\n silent: z.boolean().optional(),\n events: z.array(GoalNotificationEventSchema).optional(),\n })\n .strict();\n\nexport const GoalNotificationsConfigSchema = z\n .object({\n enabled: z.boolean().default(false),\n /** Notify Telegram/Weixin chats bound to the goal activeSessionKey. */\n includeLinkedSessions: z.boolean().default(true),\n /** Channels eligible for linked-session notifications. */\n channels: z.array(z.string().min(1)).default(['telegram', 'weixin']),\n events: z\n .array(GoalNotificationEventSchema)\n .default(['done', 'blocked', 'needs_input', 'queue_failed', 'queue_retry']),\n targets: z.array(GoalNotificationTargetSchema).default([]),\n })\n .strict()\n .default({\n enabled: false,\n includeLinkedSessions: true,\n channels: ['telegram', 'weixin'],\n events: ['done', 'blocked', 'needs_input', 'queue_failed', 'queue_retry'],\n targets: [],\n });\n\nexport const GoalsConfigSchema = z\n .object({\n /** Max continuation turns before auto-pause (Hermes default 20). */\n maxTurns: z.number().int().min(1).max(500).default(20),\n /** Optional judge model ref; defaults to the active agent model. */\n judgeModelRef: z.string().optional(),\n /**\n * When true (default), first post-turn runs a decomposition judge to build a checklist;\n * subsequent turns evaluate progress per item (Hermes-style). When false, use legacy freeform judge only.\n */\n checklistMode: z.boolean().default(true),\n /**\n * empty_only preserves legacy behavior: the first post-turn decomposition runs only when the\n * goal has no checklist. supplement_existing lets the first post-turn add non-duplicate judge\n * criteria even when the user supplied initial acceptance criteria.\n */\n checklistDecomposePolicy: z.enum(['empty_only', 'supplement_existing']).default('empty_only'),\n /** Auto-pause after this many consecutive judge JSON/tool parse failures (Hermes default 3). */\n maxConsecutiveParseFailures: z.number().int().min(1).max(20).default(3),\n /** Judge LLM call timeout in ms (Hermes uses 60s). */\n judgeTimeoutMs: z.number().int().min(5_000).max(120_000).default(60_000),\n /** Max characters of recent transcript JSON passed to the checklist judge as extra context. */\n checklistHistoryChars: z.number().int().min(0).max(100_000).default(24_000),\n /** External channel notification policy for durable goal lifecycle events. */\n notifications: GoalNotificationsConfigSchema,\n })\n .strict();\n\nexport type GoalsConfig = z.infer<typeof GoalsConfigSchema>;\n\nexport const UpdateConfigSchema = z\n .object({\n /** Check for updates on gateway startup. Default true. */\n checkOnStart: z.boolean().default(true),\n /** Update channel: stable (default), beta, or dev. */\n channel: z.enum(['stable', 'beta', 'dev']).default('stable'),\n /** Automatic update policy. */\n auto: UpdateAutoConfigSchema,\n })\n .strict()\n .optional();\n\nexport type UpdateConfig = z.infer<typeof UpdateConfigSchema>;\n\nexport const CommandsConfigSchema = z\n .object({\n restart: z.boolean().optional(),\n })\n .strict()\n .optional();\n\nexport type CommandsConfig = z.infer<typeof CommandsConfigSchema>;\n\nexport const TuiConfigSchema = z\n .object({\n /** Default agent id for fresh TUI sessions. Leaves global routing (`agents.default`) untouched. */\n defaultAgent: z.string().min(1).optional(),\n })\n .strict()\n .default({});\n\nexport type TuiConfig = z.infer<typeof TuiConfigSchema>;\n\n// ============================================\n// MCP (Model Context Protocol)\n// ============================================\n\nconst McpHttpUrlSchema = z\n .string()\n .url()\n .refine((value) => {\n try {\n const protocol = new URL(value).protocol;\n return protocol === 'http:' || protocol === 'https:';\n } catch {\n return false;\n }\n }, 'MCP server URL must use http or https');\n\nconst ConnectorSecretReferenceSchema = z.object({\n xopcSecretRef: z.object({\n provider: z.string().min(1),\n fieldKey: z.string().min(1),\n }),\n});\n\nconst McpConfigScalarSchema = z.union([z.string(), z.number(), z.boolean(), ConnectorSecretReferenceSchema]);\n\nexport const McpServerSchema = z\n .object({\n command: z.string().optional(),\n args: z.array(z.string()).optional(),\n env: z.record(z.string(), McpConfigScalarSchema).optional(),\n cwd: z.string().optional(),\n workingDirectory: z.string().optional(),\n url: McpHttpUrlSchema.optional(),\n transport: z.enum(['sse', 'streamable-http']).optional(),\n headers: z.record(z.string(), McpConfigScalarSchema).optional(),\n connectionTimeoutMs: z.number().finite().positive().optional(),\n })\n .catchall(z.unknown())\n .superRefine((value, ctx) => {\n const hasCommand = typeof value.command === 'string' && value.command.trim().length > 0;\n const hasUrl = typeof value.url === 'string' && value.url.trim().length > 0;\n if (hasCommand && hasUrl) {\n ctx.addIssue({\n code: 'custom',\n message: 'MCP server cannot define both command and url',\n });\n }\n });\n\nexport const McpConfigSchema = z\n .object({\n servers: z.record(z.string(), McpServerSchema).optional(),\n sessionIdleTtlMs: z.number().finite().min(0).optional(),\n })\n .strict()\n .optional();\n\nexport type McpServerConfig = z.infer<typeof McpServerSchema>;\nexport type McpConfig = z.infer<typeof McpConfigSchema>;\n\nexport const ConnectorsConfigSchema = z\n .object({\n instances: z.record(z.string(), z.record(z.string(), z.unknown())).optional(),\n })\n .strict()\n .optional();\n\nexport type ConnectorsConfig = z.infer<typeof ConnectorsConfigSchema>;\n\n// ============================================\n// Root Config\n// ============================================\n\nexport const ConfigSchema = z.object({\n agents: AgentsConfigSchema,\n bindings: BindingsConfigSchema,\n session: SessionConfigSchema,\n channels: ChannelsConfigSchema,\n gateway: GatewayConfigSchema,\n browser: BrowserConfigSchema,\n tunnel: TunnelConfigSchema.optional(),\n workspace: WorkspaceConfigSchema,\n tools: ToolsConfigSchema,\n mcp: McpConfigSchema,\n connectors: ConnectorsConfigSchema,\n goals: GoalsConfigSchema.optional(),\n extensions: ExtensionsConfigSchema.default({}),\n /** Per-vendor capability provider config (image / audio / video). */\n providers: ProvidersConfigSchema.optional(),\n modelsDev: ModelsDevConfigSchema,\n /** Delivery / presentation concerns (currently `tts`). */\n messages: MessagesConfigSchema,\n update: UpdateConfigSchema,\n commands: CommandsConfigSchema,\n tui: TuiConfigSchema,\n}).default({\n agents: {\n default: 'main',\n defaultPreset: DEFAULT_CAPABILITY_PRESET_ID,\n capabilityPresets: {\n [DEFAULT_CAPABILITY_PRESET_ID]: {\n id: DEFAULT_CAPABILITY_PRESET_ID,\n name: 'Global defaults',\n description: 'Default capabilities inherited by every agent.',\n version: 1,\n models: {\n defaultRole: 'deep',\n roles: {},\n },\n },\n },\n list: [\n {\n id: 'main',\n enabled: true,\n identity: {\n name: 'Main',\n role: 'General assistant',\n language: 'en',\n tone: 'direct',\n },\n responsibilities: {\n primary: ['Help the user complete tasks'],\n },\n workspace: { root: '~/.xopc/workspace/main' },\n tools: { builtin: {} },\n skills: { mode: 'all' },\n memory: {\n mode: 'confirmWrite',\n sources: ['session', 'curated'],\n writePolicy: { curated: 'confirm' },\n },\n workflows: {},\n boundaries: { requiresConfirmation: [], forbidden: [], escalation: [] },\n },\n ],\n },\n bindings: [],\n session: {\n scope: 'per-sender' as const,\n mainKey: 'main',\n dmScope: 'main' as const,\n },\n channels: {\n telegram: {\n enabled: false,\n debug: false,\n defaults: {\n dmPolicy: 'pairing' as const,\n groupPolicy: 'open' as const,\n replyToMode: 'off' as const,\n historyLimit: 50,\n textChunkLimit: 4000,\n streaming: { mode: 'partial' as const },\n },\n accounts: {\n default: {\n accountId: 'default',\n enabled: true,\n botToken: '',\n allowFrom: [],\n groupAllowFrom: [],\n },\n },\n },\n },\n gateway: {\n bind: 'loopback',\n port: 18790,\n auth: {\n mode: 'token',\n },\n heartbeat: {\n enabled: true,\n intervalMs: 1_800_000,\n includeSystemPromptSection: false,\n },\n maxSseConnections: 100,\n corsOrigins: [],\n skillsMarketplaceProvider: 'skillhub',\n skillsStoreBaseUrl: 'https://store.xopc.ai',\n },\n browser: {\n enabled: true,\n backend: 'extension' as const,\n },\n tools: {\n web: {\n search: {\n maxResults: 5,\n providers: [],\n },\n },\n },\n goals: {\n maxTurns: 20,\n checklistMode: true,\n checklistDecomposePolicy: 'empty_only',\n maxConsecutiveParseFailures: 3,\n judgeTimeoutMs: 60_000,\n checklistHistoryChars: 24_000,\n notifications: {\n enabled: false,\n includeLinkedSessions: true,\n channels: ['telegram', 'weixin'],\n events: ['done', 'blocked', 'needs_input', 'queue_failed', 'queue_retry'],\n targets: [],\n },\n },\n extensions: {\n allow: [],\n security: {\n checkPermissions: true,\n allowUntrusted: false,\n allow: [],\n trackProvenance: true,\n allowPromptInjection: false,\n },\n slots: {},\n },\n modelsDev: {\n enabled: true,\n },\n tui: {},\n // messages.tts / tools.media.audio start undefined; the factory layer fills\n // in provider-level defaults (model/voice) on demand. Fresh configs don't\n // ship with enabled providers so they never make surprise STT/TTS calls.\n});\n\nexport type Config = z.infer<typeof ConfigSchema>;\nexport type GatewayAuthConfig = z.infer<typeof GatewayAuthSchema>;\nexport type GatewayTrustedProxyConfig = z.infer<typeof GatewayTrustedProxySchema>;\nexport type GatewayAuthRateLimitConfig = z.infer<typeof GatewayAuthRateLimitSchema>;\nexport type GatewayBindMode = z.infer<typeof GatewayBindModeSchema>;\nexport type STTConfig = z.infer<typeof STTConfigSchema>;\nexport type TTSConfig = z.infer<typeof TTSConfigSchema>;\n\n// ============================================\n// Helper Functions\n// ============================================\n\n/**\n * Parse a model reference string.\n */\nexport interface ParsedModelRef {\n provider: string;\n model: string;\n}\n\nexport function getAgentDefaultModelRef(config: Config): string | undefined {\n const list = Array.isArray(config.agents?.list) ? config.agents.list : [];\n const defaultId =\n config.agents?.default?.trim() ||\n list.find((entry) => (entry as { default?: boolean }).default === true)?.id?.trim() ||\n list[0]?.id;\n const agent = list.find((entry) => entry.enabled !== false && entry.id === defaultId) ?? list[0];\n if (!agent) return undefined;\n\n let modelRef: string | undefined;\n const visited = new Set<string>();\n const applyModels = (models: AgentModelsConfig | undefined): void => {\n const roles = models?.roles ?? {};\n const defaultRole = models?.defaultRole ?? Object.keys(roles)[0];\n const role = defaultRole ? roles[defaultRole] : undefined;\n const next = role?.model.trim();\n if (next) modelRef = next;\n };\n const applyPreset = (presetId: string): void => {\n if (visited.has(presetId)) return;\n visited.add(presetId);\n const preset = config.agents.capabilityPresets[presetId];\n if (!preset) return;\n for (const parent of preset.extends ?? []) {\n applyPreset(parent);\n }\n applyModels(preset.models);\n };\n\n applyPreset(config.agents.defaultPreset);\n for (const presetId of agent.extends ?? []) {\n if (presetId !== config.agents.defaultPreset) {\n applyPreset(presetId);\n }\n }\n applyModels(agent.models);\n return modelRef;\n}\n\n/** `provider/model` or null when invalid. */\nexport function parseModelRef(ref: string): ParsedModelRef | null {\n const trimmed = ref.trim();\n const idx = trimmed.indexOf('/');\n if (idx <= 0 || idx === trimmed.length - 1) {\n return null;\n }\n return { provider: trimmed.slice(0, idx).trim(), model: trimmed.slice(idx + 1).trim() };\n}\n"],"mappings":";;;;;;;;AAyyCA,SAAgB,wBAAwB,QAAoC;CAC1E,MAAM,OAAO,MAAM,QAAQ,OAAO,QAAQ,KAAK,GAAG,OAAO,OAAO,OAAO,EAAE;CACzE,MAAM,YACJ,OAAO,QAAQ,SAAS,MAAM,IAC9B,KAAK,MAAM,UAAW,MAAgC,YAAY,KAAK,EAAE,IAAI,MAAM,IACnF,KAAK,IAAI;CACX,MAAM,QAAQ,KAAK,MAAM,UAAU,MAAM,YAAY,SAAS,MAAM,OAAO,UAAU,IAAI,KAAK;AAC9F,KAAI,CAAC,MAAO,QAAO,KAAA;CAEnB,IAAI;CACJ,MAAM,0BAAU,IAAI,KAAa;CACjC,MAAM,eAAe,WAAgD;EACnE,MAAM,QAAQ,QAAQ,SAAS,EAAE;EACjC,MAAM,cAAc,QAAQ,eAAe,OAAO,KAAK,MAAM,CAAC;EAE9D,MAAM,QADO,cAAc,MAA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O;GACP,UAAU;IACR,UAAU;IACV,aAAa;IACb,aAAa;IACb,cAAc;IACd,gBAAgB;IAChB,WAAW,EAAE,MAAM,WAAoB;IACxC;GACD,UAAU,EACR,SAAS;IACP,WAAW;IACX,SAAS;IACT,UAAU;IACV,WAAW,EAAE;IACb,gBAAgB,EAAE;IACnB,EACF;GACF,EACF;EACD,SAAS;GACP,MAAM;GACN,MAAM;GACN,MAAM,EACJ,MAAM,SACP;GACD,WAAW;IACT,SAAS;IACT,YAAY;IACZ,4BAA4B;IAC7B;GACD,mBAAmB;GACnB,aAAa,EAAE;GACf,2BAA2B;GAC3B,oBAAoB;GACrB;EACD,SAAS;GACP,SAAS;GACT,SAAS;GACV;EACD,OAAO,EACL,KAAK,EACH,QAAQ;GACN,YAAY;GACZ,WAAW,EAAE;GACd,EACF,EACF;EACD,OAAO;GACL,UAAU;GACV,eAAe;GACf,0BAA0B;GAC1B,6BAA6B;GAC7B,gBAAgB;GAChB,uBAAuB;GACvB,eAAe;IACb,SAAS;IACT,uBAAuB;IACvB,UAAU,CAAC,YAAY,SAAS;IAChC,QAAQ;KAAC;KAAQ;KAAW;KAAe;KAAgB;KAAc;IACzE,SAAS,EAAE;IACZ;GACF;EACD,YAAY;GACV,OAAO,EAAE;GACT,UAAU;IACR,kBAAkB;IAClB,gBAAgB;IAChB,OAAO,EAAE;IACT,iBAAiB;IACjB,sBAAsB;IACvB;GACD,OAAO,EAAE;GACV;EACD,WAAW,EACT,SAAS,MACV;EACD,KAAK,EAAE;EAIR,CAAC"}
|
|
1
|
+
{"version":3,"file":"schema.js","names":[],"sources":["../../../src/config/schema.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport {\n AgentConfigEntrySchema,\n CapabilityPresetSchema,\n DEFAULT_CAPABILITY_PRESET_ID,\n} from '../agent-manifest/schema.js';\nimport { checkCacheDir } from '../browser/cache-dir-policy.js';\nimport { DEFAULT_AGENT_MODELS } from './default-model.js';\nimport { validatePublicUrl } from './public-url.js';\n\n// ============================================\n// Agent Configs\n// ============================================\n\n/**\n * Agent model ref. Always an object with explicit `primary` and optional\n * `fallbacks` chain. No string-form shorthand — every write site builds the\n * object explicitly so reads never branch on shape.\n */\nexport const AgentModelRefSchema = z\n .object({\n primary: z.string().min(1),\n fallbacks: z.array(z.string()).optional(),\n })\n .strict();\n\nexport type AgentModelConfig = z.infer<typeof AgentModelRefSchema>;\n\n/**\n * Image-generation model ref. {@link AgentModelRefSchema} plus runtime knobs\n * (`timeoutMs`, `autoProviderFallback`) used by the image-generation runtime.\n */\nexport const AgentImageGenerationModelSchema = z\n .object({\n primary: z.string().min(1),\n fallbacks: z.array(z.string()).optional(),\n /** Hard cap for the whole generation attempt (ms). */\n timeoutMs: z.number().int().positive().optional(),\n /**\n * When all `primary + fallbacks` candidates fail, sweep every other\n * configured provider before giving up.\n */\n autoProviderFallback: z.boolean().optional(),\n })\n .strict();\n\nexport type AgentImageGenerationModelConfig = z.infer<typeof AgentImageGenerationModelSchema>;\n\nexport const AgentTypedModelRoleSchema = z\n .object({\n description: z.string().max(500).optional(),\n model: z.string().min(1),\n fallbacks: z.array(z.string().min(1)).optional(),\n })\n .strict()\n .superRefine((entry, ctx) => {\n const validateRef = (ref: string) => {\n const trimmed = ref.trim();\n const idx = trimmed.indexOf('/');\n return idx > 0 && idx < trimmed.length - 1;\n };\n if (!validateRef(entry.model)) {\n ctx.addIssue({\n code: 'custom',\n message: `model must be provider/model format (got '${entry.model}')`,\n path: ['model'],\n });\n }\n for (const [index, fallback] of (entry.fallbacks ?? []).entries()) {\n if (!validateRef(fallback)) {\n ctx.addIssue({\n code: 'custom',\n message: `fallback must be provider/model format (got '${fallback}')`,\n path: ['fallbacks', index],\n });\n }\n }\n });\n\nexport type AgentTypedModelRole = z.infer<typeof AgentTypedModelRoleSchema>;\n\nconst AgentTypedModelRolesSchema = z\n .record(z.string().regex(/^[a-z][a-z0-9_-]{0,63}$/), AgentTypedModelRoleSchema)\n .optional();\n\nexport const AgentModelsSchema = z\n .object({\n defaultRole: z.string().regex(/^[a-z][a-z0-9_-]{0,63}$/).optional(),\n roles: AgentTypedModelRolesSchema,\n imageModel: AgentModelRefSchema.optional(),\n imageGenerationModel: AgentImageGenerationModelSchema.optional(),\n })\n .strict()\n .optional();\n\nexport type AgentModelsConfig = z.infer<typeof AgentModelsSchema>;\n\nexport type AgentTypedModel = AgentTypedModelRole & { id: string };\n\nexport const AgentsConfigSchema = z.object({\n /** Default agent id when not specified (routing / session creation). */\n default: z.string().optional(),\n /** Protected global defaults preset applied before each agent's own presets. */\n defaultPreset: z.string().default(DEFAULT_CAPABILITY_PRESET_ID),\n capabilityPresets: z.record(z.string(), CapabilityPresetSchema).default({}),\n list: z.array(AgentConfigEntrySchema).default([]),\n}).strict().default({\n default: 'main',\n defaultPreset: DEFAULT_CAPABILITY_PRESET_ID,\n capabilityPresets: {\n [DEFAULT_CAPABILITY_PRESET_ID]: {\n id: DEFAULT_CAPABILITY_PRESET_ID,\n name: 'Global defaults',\n description: 'Default capabilities inherited by every agent.',\n version: 1,\n models: DEFAULT_AGENT_MODELS,\n },\n },\n list: [\n {\n id: 'main',\n enabled: true,\n identity: {\n name: 'Main',\n role: 'General assistant',\n language: 'en',\n tone: 'direct',\n },\n responsibilities: {\n primary: ['Help the user complete tasks'],\n },\n workspace: { root: '~/.xopc/workspace/main' },\n tools: { builtin: {} },\n skills: { mode: 'all' },\n memory: {\n mode: 'confirmWrite',\n sources: ['session', 'curated'],\n writePolicy: { curated: 'confirm' },\n },\n workflows: {},\n boundaries: { requiresConfirmation: [], forbidden: [], escalation: [] },\n },\n ],\n});\n\nconst BrowserCloudConfigSchema = z\n .object({\n apiKey: z.string().optional(),\n projectId: z.string().optional(),\n region: z.string().optional(),\n })\n .strict()\n .optional();\n\nconst BrowserExtensionConfigSchema = z\n .object({\n port: z.number().int().min(1024).max(65535).optional(),\n host: z.string().min(1).optional(),\n connectionTimeout: z.number().int().positive().optional(),\n })\n .strict()\n .optional();\n\nconst BrowserCloakConfigSchema = z\n .object({\n keepOpen: z.boolean().optional(),\n temporaryProfile: z.boolean().optional(),\n cacheDir: z.string().optional().superRefine((value, ctx) => {\n const result = checkCacheDir(value);\n if (result.ok === false) {\n ctx.addIssue({ code: 'custom', message: result.message });\n }\n }),\n binaryPath: z.string().optional(),\n timezone: z.string().optional(),\n locale: z.string().optional(),\n webrtcIp: z.string().optional(),\n fingerprintPlatform: z.string().optional(),\n extraArgs: z.array(z.string()).optional(),\n })\n .strict()\n .optional();\n\nexport const BrowserConfigSchema = z\n .object({\n enabled: z.boolean().default(true),\n backend: z.enum(['local', 'cdp', 'cloud', 'extension', 'cloakbrowser']).default('extension'),\n headless: z.boolean().optional(),\n allowPrivateUrls: z.boolean().optional(),\n commandTimeout: z.number().int().min(5).max(900).optional(),\n cloudProvider: z.enum(['local', 'browserbase', 'browser-use']).optional(),\n cloud: BrowserCloudConfigSchema,\n cdpUrl: z.string().optional(),\n extension: BrowserExtensionConfigSchema,\n cloakbrowser: BrowserCloakConfigSchema,\n humanize: z.boolean().optional(),\n humanPreset: z.enum(['default', 'careful']).optional(),\n dialogPolicy: z.enum(['must_respond', 'auto_dismiss', 'auto_accept']).optional(),\n dialogTimeoutSeconds: z.number().int().positive().optional(),\n })\n .strict()\n .default({ enabled: true, backend: 'extension' });\n\n// ============================================\n// Channel Configs (per-channel Zod lives in bundled extensions; root schema is open)\n// ============================================\n\nexport {\n TelegramTopicConfigSchema,\n TelegramGroupConfigSchema,\n TelegramAccountConfigSchema,\n TelegramConfigSchema,\n} from '../../extensions/telegram/src/config-schema.js';\nexport type { TelegramConfig } from '../../extensions/telegram/src/config-schema.js';\nexport { WeixinAccountConfigSchema, WeixinConfigSchema } from '../../extensions/weixin/src/config-schema.js';\nexport type { WeixinConfig } from '../../extensions/weixin/src/config-schema.js';\n// ============================================\n// Session Routing Configuration\n// ============================================\n\nexport const BindingMatchSchema = z.object({\n channel: z.string(),\n accountId: z.string().optional(),\n peerKind: z.string().optional(),\n peerId: z.string().optional(),\n guildId: z.string().optional(),\n teamId: z.string().optional(),\n memberRoleIds: z.array(z.string()).optional(),\n});\n\nexport const BindingRuleSchema = z.object({\n id: z.string().optional(),\n agentId: z.string(),\n priority: z.number().default(100),\n match: BindingMatchSchema,\n enabled: z.boolean().default(true),\n});\n\nexport const BindingsConfigSchema = z.array(BindingRuleSchema).default([]);\n\nexport const SessionDmScopeSchema = z.enum([\n 'main',\n 'per-peer',\n 'per-channel-peer',\n 'per-account-channel-peer',\n]);\n\nexport const SessionStorageConfigSchema = z.object({\n pruneAfterMs: z.number().optional(),\n maxEntries: z.number().optional(),\n});\n\nexport const SessionResetModeSchema = z.enum(['daily', 'idle']);\n\nexport const SessionResetConfigSchema = z\n .object({\n mode: SessionResetModeSchema.optional(),\n /** Local hour (0–23) for the daily reset boundary. */\n atHour: z.number().int().min(0).max(23).optional(),\n /** Sliding idle window (minutes). When set with daily mode, whichever expires first wins. */\n idleMinutes: z.number().int().min(0).optional(),\n })\n .strict();\n\nexport const SessionResetByTypeSchema = z\n .object({\n direct: SessionResetConfigSchema.optional(),\n group: SessionResetConfigSchema.optional(),\n thread: SessionResetConfigSchema.optional(),\n })\n .strict();\n\nexport const SessionScopeSchema = z.enum(['per-sender', 'global']);\n\nexport const SessionConfigSchema = z.object({\n scope: SessionScopeSchema.default('per-sender'),\n mainKey: z.string().default('main'),\n dmScope: SessionDmScopeSchema.default('main'),\n identityLinks: z.record(z.string(), z.array(z.string())).optional(),\n resetTriggers: z.array(z.string()).optional(),\n idleMinutes: z.number().int().positive().optional(),\n reset: SessionResetConfigSchema.optional(),\n resetByType: SessionResetByTypeSchema.optional(),\n resetByChannel: z.record(z.string(), SessionResetConfigSchema).optional(),\n storage: SessionStorageConfigSchema.optional(),\n}).default({\n scope: 'per-sender',\n mainKey: 'main',\n dmScope: 'main',\n});\n\n/** Channel buckets — shapes validated post-parse by registered channel plugins. */\nexport const ChannelsConfigSchema = z.record(z.string(), z.unknown()).default({});\n\nexport const SearchProviderEntrySchema = z.object({\n type: z.enum(['brave', 'tavily', 'bing', 'searxng']),\n apiKey: z.string().optional(),\n /** SearXNG instance base URL (e.g. http://localhost:8080) */\n url: z.string().optional(),\n disabled: z.boolean().optional(),\n});\n\nexport type SearchProviderEntry = z.infer<typeof SearchProviderEntrySchema>;\n\nexport const WebSearchConfigSchema = z.object({\n maxResults: z.number().default(5),\n /** Ordered API providers; empty → HTML fallback only */\n providers: z.array(SearchProviderEntrySchema).default([]),\n});\n\nexport type WebSearchConfig = z.infer<typeof WebSearchConfigSchema>;\n\nexport const WebsiteBlocklistSchema = z.object({\n /** Master switch. Default false (no blocking). */\n enabled: z.boolean().default(false),\n /** Domain patterns to block (e.g. \"example.com\", \"*.evil.org\"). */\n domains: z.array(z.string()).default([]),\n});\n\nexport type WebsiteBlocklistConfig = z.infer<typeof WebsiteBlocklistSchema>;\n\nexport const WebToolsConfigSchema = z.object({\n /** Search result HTML fallback: cn → Bing, otherwise DuckDuckGo */\n region: z.enum(['cn', 'global']).optional(),\n search: WebSearchConfigSchema.optional(),\n /** Domain blocklist for web_fetch / web_extract / browser tools. */\n blocklist: WebsiteBlocklistSchema.optional(),\n});\n\nexport type WebToolsConfig = z.infer<typeof WebToolsConfigSchema>;\n\nexport const ToolsConfigSchema = z.object({\n web: WebToolsConfigSchema.optional(),\n /**\n * Per-capability media providers. Currently only `audio` (STT) is wired;\n * `image` / `video` slots are reserved for future capabilities.\n */\n media: z.lazy(() => ToolsMediaConfigSchema),\n}).default({\n web: {\n search: {\n maxResults: 5,\n providers: [],\n },\n },\n});\n\n// ============================================\n// Gateway Configuration\n// ============================================\n\nexport const GatewayAuthRateLimitSchema = z\n .object({\n enabled: z.boolean().default(true),\n maxAttempts: z.number().int().min(1).default(5),\n windowMs: z.number().default(900_000),\n blockDurationMs: z.number().default(300_000),\n /** OpenClaw alias for blockDurationMs. */\n lockoutMs: z.number().optional(),\n /** Skip rate limiting for loopback client IPs (default true). Remote browser Origin requests never exempt. */\n exemptLoopback: z.boolean().default(true),\n /**\n * Coalesce same-client failures arriving within this window into a single\n * attempt. Absorbs SPA fan-out / SDK auto-retry storms without weakening\n * brute-force protection (deliberate attackers are still rate-limited to\n * one effective attempt per window). Set to 0 to disable.\n */\n burstCoalesceMs: z.number().int().min(0).default(1000),\n })\n .optional();\n\nexport const GatewaySecuritySchema = z\n .object({\n /** When true, non-loopback binds require explicit gateway.auth.rateLimit configuration. */\n strict: z.boolean().optional(),\n })\n .optional();\n\nexport const GatewayTrustedProxySchema = z\n .object({\n /** Header set by the reverse proxy with the authenticated user identity. */\n userHeader: z.string().min(1),\n /** Additional headers that must be present (e.g. proxy auth markers). */\n requiredHeaders: z.array(z.string()).optional(),\n /** When non-empty, only these user identities are allowed. */\n allowUsers: z.array(z.string()).optional(),\n /** Allow trusted-proxy auth when the TCP source is loopback (same-host reverse proxy). */\n allowLoopback: z.boolean().optional(),\n })\n .strict();\n\nexport const GatewayAuthSchema = z\n .object({\n mode: z.enum(['none', 'token', 'password', 'trusted-proxy']).default('token'),\n token: z.string().optional(),\n password: z.string().optional(),\n /** When true (default for Serve), browser UI may auth via Tailscale identity headers. API routes still require token. */\n allowTailscale: z.boolean().optional(),\n rateLimit: GatewayAuthRateLimitSchema,\n trustedProxy: GatewayTrustedProxySchema.optional(),\n })\n .default({\n mode: 'token',\n });\n\nexport const GatewayTailscaleConsentSchema = z.object({\n version: z.string().min(1),\n acceptedAt: z.string().min(1),\n});\n\nexport const GatewayTailscaleSchema = z\n .object({\n mode: z.enum(['off', 'serve', 'funnel']).default('off'),\n resetOnExit: z.boolean().default(true),\n consent: GatewayTailscaleConsentSchema.optional(),\n })\n .default({\n mode: 'off',\n resetOnExit: true,\n });\n\nexport const GatewayRemoteSchema = z.object({\n url: z.string().url(),\n token: z.string().optional(),\n password: z.string().optional(),\n transport: z.enum(['direct', 'ssh']).default('direct'),\n sshTarget: z.string().optional(),\n sshIdentity: z.string().optional(),\n tlsFingerprint: z.string().optional(),\n});\n\nexport const GatewayTlsSchema = z\n .object({\n enabled: z.boolean().default(false),\n autoGenerate: z.boolean().default(false),\n certPath: z.string().optional(),\n keyPath: z.string().optional(),\n })\n .default({\n enabled: false,\n autoGenerate: false,\n });\n\nexport const GatewayModeSchema = z.enum(['local', 'remote']).default('local');\n\nexport const HeartbeatConfigSchema = z\n .object({\n enabled: z.boolean(),\n intervalMs: z.number(),\n /** When false, heartbeat instructions are only sent during heartbeat polling turns (not in every chat system prompt). */\n includeSystemPromptSection: z.boolean().optional().default(false),\n target: z.string().optional(),\n targetChatId: z.string().optional(),\n prompt: z.string().optional(),\n ackMaxChars: z.number().optional(),\n isolatedSession: z.boolean().optional(),\n activeHours: z\n .object({\n start: z.string(),\n end: z.string(),\n timezone: z.string().optional(),\n })\n .optional(),\n })\n .default({\n enabled: true,\n intervalMs: 1_800_000,\n includeSystemPromptSection: false,\n });\n\nexport const GatewayChannelConnectDeferModeSchema = z.enum(['auto', 'off', 'explicit']);\n\nexport const TunnelConsentSchema = z.object({\n version: z.string().min(1),\n acceptedAt: z.string().min(1),\n});\n\nexport const TunnelConfigSchema = z\n .object({\n enabled: z.boolean().default(false),\n brokerUrl: z.string().url().default('https://frp.xopc.ai/api'),\n /** Broker register API secret (env `XOPC_TUNNEL_REGISTRATION_SECRET` overrides when set). */\n registrationSecret: z.string().min(1).optional(),\n autoStart: z.boolean().default(false),\n subdomain: z.string().optional(),\n consent: TunnelConsentSchema.optional(),\n })\n .default({\n enabled: false,\n brokerUrl: 'https://frp.xopc.ai/api',\n autoStart: false,\n });\n\nexport type TunnelConfig = z.infer<typeof TunnelConfigSchema>;\n\n/**\n * Workspace-scoped concerns (file import, etc.). Distinct from\n * agent manifest workspace roots; this block carries\n * feature configuration for workspace-related routes.\n */\nexport const WorkspaceImportConfigSchema = z.object({\n /** Workspace-relative subdir for imported files. Default `imports`. */\n targetDir: z.string().default('imports'),\n /** Per-file byte cap. Default 100 MiB. */\n maxBytes: z.number().int().min(1024).max(10_737_418_240).default(104_857_600),\n /** When false, the route rejects `onConflict: 'overwrite'`. Default true. */\n allowOverwrite: z.boolean().default(true),\n});\nexport type WorkspaceImportConfig = z.infer<typeof WorkspaceImportConfigSchema>;\n\nexport const WorkspaceConfigSchema = z.object({\n import: WorkspaceImportConfigSchema.optional(),\n}).optional();\nexport type WorkspaceConfig = z.infer<typeof WorkspaceConfigSchema>;\n\nexport const GatewayBindModeSchema = z.enum(['auto', 'loopback', 'lan', 'tailnet', 'custom']);\n\nexport const GatewayConfigSchema = z.object({\n /** Semantic bind mode. */\n bind: GatewayBindModeSchema.optional(),\n /** IPv4 listen address when `bind` is `custom`. */\n customBindHost: z.string().optional(),\n port: z.number().optional(),\n /** local: this process runs the gateway; remote: CLI clients target gateway.remote. */\n mode: GatewayModeSchema.optional(),\n /** Persistent remote gateway target for CLI/TUI/MCP when mode=remote. */\n remote: GatewayRemoteSchema.optional(),\n tailscale: GatewayTailscaleSchema.optional(),\n tls: GatewayTlsSchema.optional(),\n auth: GatewayAuthSchema.optional(),\n heartbeat: HeartbeatConfigSchema.optional(),\n maxSseConnections: z.number().optional(),\n corsOrigins: z.array(z.string()).optional(),\n /**\n * Reverse-proxy publicly reachable URL (e.g. `https://gateway.example.com`).\n * Optional. When set, mobile pairing surfaces this URL as the preferred\n * baseUrl and it is auto-added to the browser CORS/CSRF allowlist.\n * - Must be a URL with no path / query / userinfo.\n * - Must use `https:` for public hosts; `http:` is only allowed when the\n * hostname is in an RFC1918 / `.local` private range.\n */\n publicUrl: z\n .string()\n .superRefine((value, ctx) => {\n const result = validatePublicUrl(value);\n if (result.ok === false) {\n ctx.addIssue({ code: 'custom', message: `gateway.publicUrl: ${result.message}` });\n }\n })\n .optional(),\n /** Dangerous: allow browser Origin to match the HTTP Host header when not in corsOrigins. */\n dangerouslyAllowHostHeaderOriginFallback: z.boolean().optional(),\n /** CIDRs or exact IPs of reverse proxies allowed to terminate auth (trusted-proxy mode). */\n trustedProxies: z.array(z.string()).optional(),\n /** When true, fall back to X-Real-IP if X-Forwarded-For chain parsing fails. Default false (fail closed). */\n allowRealIpFallback: z.boolean().optional(),\n security: GatewaySecuritySchema,\n /**\n * How channel `start()` is split around HTTP listen when using `GatewayServer`.\n * - `auto` (default): defer ids come from channel plugin `meta.deferConnectUntilAfterListen` + enabled config.\n * - `off`: always start all channels in phase1 (troubleshooting / strict ordering).\n * - `explicit`: defer only `channelConnectDeferIds` (empty = defer none).\n */\n channelConnectDeferMode: GatewayChannelConnectDeferModeSchema.optional(),\n /** When `channelConnectDeferMode` is `explicit`, these channel plugin ids are deferred until after listen. */\n channelConnectDeferIds: z.array(z.string().min(1)).max(24).optional(),\n /** Removed from the defer set (applied after `auto` or `explicit` resolution). */\n channelConnectDeferSkipIds: z.array(z.string().min(1)).max(24).optional(),\n /** Default skills marketplace provider id. Built-in: 'store', 'skillhub', 'clawhub'. Extensions may register more. */\n skillsMarketplaceProvider: z.string().optional(),\n /** Base URL for the xopc skills marketplace (public REST API). */\n skillsStoreBaseUrl: z.string().url().optional(),\n /** File sharing configuration (temporary public download links for workspace files). */\n share: z.object({\n enabled: z.boolean().default(true),\n /** Default TTL in ms (default 24h). */\n defaultTtlMs: z.number().min(60_000).max(604_800_000).default(86_400_000),\n /** Maximum TTL in ms (default 7 days). */\n maxTtlMs: z.number().min(60_000).max(2_592_000_000).default(604_800_000),\n /** Maximum concurrent active shares (default 100). */\n maxActiveShares: z.number().min(1).max(10_000).default(100),\n /** Maximum shareable file size in bytes (default 100MB). */\n maxFileSize: z.number().min(1_048_576).max(10_737_418_240).default(104_857_600),\n /** MIME types allowed for inline preview (?inline=1). */\n inlinePreviewMimes: z.array(z.string()).default([\n 'image/png',\n 'image/jpeg',\n 'image/gif',\n 'image/webp',\n 'image/svg+xml',\n 'application/pdf',\n 'text/html',\n 'text/markdown',\n 'text/plain',\n 'application/json',\n ]),\n /** Folder-sharing controls (browse + ZIP). */\n directory: z.object({\n enabled: z.boolean().default(true),\n /** Maximum folder size in bytes at scan time (default 1 GB). */\n maxFolderSize: z.number().int().min(1_048_576).max(10_737_418_240).default(1_073_741_824),\n /** Maximum number of entries scanned for a single folder share. */\n maxFileCount: z.number().int().min(1).max(100_000).default(1_000),\n /** Traversal depth cap (defense against recursive symlinks). */\n maxDepth: z.number().int().min(1).max(64).default(20),\n /** In-memory directory listing cache TTL. */\n listingCacheMs: z.number().int().min(0).max(600_000).default(60_000),\n /** Maximum simultaneous ZIP streams per share token. */\n zipConcurrency: z.number().int().min(1).max(8).default(1),\n }).default({\n enabled: true,\n maxFolderSize: 1_073_741_824,\n maxFileCount: 1_000,\n maxDepth: 20,\n listingCacheMs: 60_000,\n zipConcurrency: 1,\n }),\n }).optional(),\n /** Site-share configuration (static directory or reverse-proxy a local dev server). */\n siteShare: z.object({\n enabled: z.boolean().default(true),\n /** Public host suffix that subdomain shares are served under. */\n publicHostSuffix: z.string().min(1).default('share.xopc.ai'),\n /** Default TTL in ms (default 6h, shorter than file shares — live app surface). */\n defaultTtlMs: z.number().int().min(60_000).max(604_800_000).default(21_600_000),\n /** Maximum TTL in ms (default 7 days). */\n maxTtlMs: z.number().int().min(60_000).max(2_592_000_000).default(604_800_000),\n /** Maximum concurrent active site shares. */\n maxActiveSites: z.number().int().min(1).max(1_000).default(5),\n static: z.object({\n enabled: z.boolean().default(true),\n /** Maximum total bytes of files served per static site. */\n maxRootDirSize: z.number().int().min(1_048_576).max(10_737_418_240).default(524_288_000),\n /** Maximum file count under root dir. */\n maxFileCount: z.number().int().min(1).max(100_000).default(10_000),\n /** Whether HTML/CSS rewrite of absolute paths is on by default. */\n rewriteEnabledByDefault: z.boolean().default(false),\n }).default({\n enabled: true,\n maxRootDirSize: 524_288_000,\n maxFileCount: 10_000,\n rewriteEnabledByDefault: false,\n }),\n proxy: z.object({\n /** Reverse-proxy mode default-enabled per the product brief. */\n enabled: z.boolean().default(true),\n /** Upstream host whitelist. Loopback by default. */\n allowedUpstreamHosts: z\n .array(z.string().min(1))\n .default(['127.0.0.1', 'localhost', '::1']),\n /** Upstream port whitelist (common dev-server ports). */\n allowedUpstreamPorts: z\n .array(z.number().int().min(1).max(65535))\n .default([3000, 3001, 4321, 5173, 8000, 8080, 8888, 9000]),\n /** Whether to forward WebSocket upgrades. */\n forwardWebSocket: z.boolean().default(true),\n /** Maximum request body size in bytes (50 MB). */\n bodySizeLimit: z.number().int().min(0).max(1_073_741_824).default(52_428_800),\n /** Per-request HTTP timeout in ms. */\n requestTimeoutMs: z.number().int().min(1_000).max(600_000).default(30_000),\n /** Per-WebSocket idle timeout in ms. */\n wsIdleTimeoutMs: z.number().int().min(10_000).max(3_600_000).default(300_000),\n /** Rewrite Set-Cookie Path attribute (subpath mode only). */\n rewriteSetCookiePath: z.boolean().default(true),\n }).default({\n enabled: true,\n allowedUpstreamHosts: ['127.0.0.1', 'localhost', '::1'],\n allowedUpstreamPorts: [3000, 3001, 4321, 5173, 8000, 8080, 8888, 9000],\n forwardWebSocket: true,\n bodySizeLimit: 52_428_800,\n requestTimeoutMs: 30_000,\n wsIdleTimeoutMs: 300_000,\n rewriteSetCookiePath: true,\n }),\n }).optional(),\n}).default({\n bind: 'loopback',\n port: 18790,\n auth: {\n mode: 'token',\n },\n heartbeat: {\n enabled: true,\n intervalMs: 1_800_000,\n includeSystemPromptSection: false,\n },\n maxSseConnections: 100,\n corsOrigins: [],\n skillsMarketplaceProvider: 'skillhub',\n skillsStoreBaseUrl: 'https://store.xopc.ai',\n});\n\nexport const ModelsDevConfigSchema = z.object({\n enabled: z.boolean().default(true),\n}).default({\n enabled: true,\n});\n\n// ============================================\n// STT (Speech-to-Text) Config\n// ============================================\n\nconst SttProviderConfigCatchallSchema = z.union([\n z.string(),\n z.number(),\n z.boolean(),\n z.null(),\n z.array(z.unknown()),\n z.record(z.string(), z.unknown()),\n]);\n\nexport const STTProviderConfigSchema = z\n .object({\n apiKey: z.string().optional(),\n model: z.string().optional(),\n baseUrl: z.string().optional(),\n headers: z.record(z.string(), z.string()).optional(),\n language: z.string().optional(),\n prompt: z.string().optional(),\n })\n .catchall(SttProviderConfigCatchallSchema);\n\nexport const STTFallbackConfigSchema = z.object({\n enabled: z.boolean().default(true),\n order: z.array(z.string().min(1)).default(['alibaba', 'openai']),\n});\n\nexport const MediaUnderstandingCapabilitiesSchema = z\n .array(z.enum(['image', 'audio', 'video']))\n .optional();\n\nexport const MediaUnderstandingModelSchema = z\n .object({\n provider: z.string().optional(),\n model: z.string().optional(),\n capabilities: MediaUnderstandingCapabilitiesSchema,\n type: z.union([z.literal('provider'), z.literal('cli')]).optional(),\n command: z.string().optional(),\n baseUrl: z.string().optional(),\n headers: z.record(z.string(), z.string()).optional(),\n apiKey: z.string().optional(),\n language: z.string().optional(),\n prompt: z.string().optional(),\n })\n .catchall(SttProviderConfigCatchallSchema);\n\nexport const STTConfigSchema = z\n .object({\n enabled: z.boolean().default(false),\n /** Primary provider id — any registered MediaUnderstandingProvider id. */\n provider: z.string().min(1).default('alibaba'),\n fallback: STTFallbackConfigSchema.optional(),\n timeoutMs: z.number().int().min(1000).max(180000).optional(),\n /** Ordered model entries for this capability (OpenClaw `tools.media.audio.models`). */\n models: z.array(MediaUnderstandingModelSchema).optional(),\n /** Provider settings map keyed by provider id. */\n providers: z.record(z.string(), STTProviderConfigSchema).optional(),\n })\n .strict();\n\n// ============================================\n// TTS (Text-to-Speech) Config\n// ============================================\n\nconst TtsProviderConfigCatchallSchema = z.union([\n z.string(),\n z.number(),\n z.boolean(),\n z.null(),\n z.array(z.unknown()),\n z.record(z.string(), z.unknown()),\n]);\n\nexport const TTSProviderConfigSchema = z\n .object({\n apiKey: z.string().optional(),\n model: z.string().optional(),\n voice: z.string().optional(),\n })\n .catchall(TtsProviderConfigCatchallSchema);\n\nexport const TTSFallbackConfigSchema = z.object({\n enabled: z.boolean().default(true),\n order: z\n .array(z.string().min(1))\n .default(['openai', 'alibaba', 'minimax', 'edge']),\n});\n\nexport const TTSModelOverridesConfigSchema = z.object({\n enabled: z.boolean().default(true),\n allowText: z.boolean().default(true),\n allowProvider: z.boolean().default(false),\n allowVoice: z.boolean().default(true),\n allowModelId: z.boolean().default(true),\n allowVoiceSettings: z.boolean().default(false),\n allowNormalization: z.boolean().default(false),\n allowSeed: z.boolean().default(false),\n});\n\nexport const TTSEdgeConfigSchema = z.object({\n enabled: z.boolean().default(true),\n voice: z.string().optional(),\n lang: z.string().optional(),\n outputFormat: z.string().optional(),\n pitch: z.string().optional(),\n rate: z.string().optional(),\n volume: z.string().optional(),\n proxy: z.string().optional(),\n timeoutMs: z.number().int().min(1000).max(120000).optional(),\n});\n\nexport const TTSSummarizationConfigSchema = z.object({\n enabled: z.boolean().optional(),\n targetLength: z.number().int().min(1).optional(),\n threshold: z.number().int().min(1).optional(),\n model: z.string().optional(),\n});\n\nexport const TTSConfigSchema = z\n .object({\n enabled: z.boolean().default(false),\n /** Primary provider id — any registered SpeechProviderPlugin id. */\n provider: z.string().min(1).default('edge'),\n trigger: z.enum(['off', 'always', 'inbound', 'tagged']).default('always'),\n fallback: TTSFallbackConfigSchema.optional(),\n maxTextLength: z.number().int().min(1).default(512), // Conservative default to accommodate all providers (Alibaba limit is 512)\n timeoutMs: z.number().int().min(1000).max(180000).default(60000),\n summarization: TTSSummarizationConfigSchema.optional(),\n modelOverrides: TTSModelOverridesConfigSchema.optional(),\n /** Provider settings map keyed by provider id. */\n providers: z.record(z.string(), TTSProviderConfigSchema).optional(),\n })\n .strict();\n\n// ============================================\n// messages.* — delivery / presentation concerns\n// ============================================\n\nexport const MessagesConfigSchema = z.object({\n /** Voice (text-to-speech) output configuration. */\n tts: TTSConfigSchema.optional(),\n}).optional();\n\nexport const ToolsMediaAudioConfigSchema = STTConfigSchema;\n\nexport const ToolsMediaConfigSchema = z\n .object({\n /** Shared model entries applied across media capabilities when entry lacks capabilities. */\n models: z.array(MediaUnderstandingModelSchema).optional(),\n /** Audio (speech-to-text) capability provider config. */\n audio: ToolsMediaAudioConfigSchema.optional(),\n })\n .optional();\n\n// ============================================\n// Provider Configs (capability providers: image / audio / video)\n// ============================================\n\n/**\n * Optional Azure OpenAI overrides used when an OpenAI image-generation\n * request should hit an Azure deployment instead of `api.openai.com`.\n *\n * URL template (when present):\n * `https://<resource>.openai.azure.com/openai/deployments/<deployment>/images/generations?api-version=<apiVersion>`\n */\nexport const ProviderAzureConfigSchema = z\n .object({\n /** Azure resource name (subdomain before `.openai.azure.com`). */\n resource: z.string().min(1).optional(),\n /** Azure deployment id (configured per model). */\n deployment: z.string().min(1).optional(),\n /** Azure REST API version, e.g. `2024-08-01-preview`. */\n apiVersion: z.string().min(1).optional(),\n })\n .strict();\n\n/** Per-vendor request overrides applied by the provider HTTP layer. */\nexport const ProviderRequestOverridesSchema = z\n .object({\n /** Hard cap for a single HTTP call (ms). */\n timeoutMs: z.number().int().positive().optional(),\n /** Extra headers merged into every outbound request. */\n headers: z.record(z.string(), z.string()).optional(),\n })\n .strict();\n\n/**\n * Generic per-vendor provider config — used by image / audio / video\n * capability providers via `cfg.providers.<id>`. Kept loose (`.strict()` but\n * everything optional) so adding a new vendor never requires a config\n * migration.\n */\nexport const ProviderAuthConfigSchema = z\n .object({\n /** Static API key (api-key / azure-key modes). */\n apiKey: z.string().optional(),\n /** Override the default REST base URL. */\n baseUrl: z.string().url().optional(),\n /** Vendor region (DashScope: `beijing` / `singapore`; AWS: region id). */\n region: z.string().optional(),\n /** Image-only base URL override (DashScope splits image vs LLM). */\n imageBaseUrl: z.string().url().optional(),\n /** Per-vendor request overrides. */\n request: ProviderRequestOverridesSchema.optional(),\n /** Azure OpenAI deployment overrides; only consumed by OpenAI image provider. */\n azure: ProviderAzureConfigSchema.optional(),\n })\n .strict();\n\nexport type ProviderAuthConfig = z.infer<typeof ProviderAuthConfigSchema>;\n\n/**\n * `cfg.providers.<id>` is keyed by provider id (`openai`, `dashscope`,\n * `minimax`, `google`, `fal`, …). Every entry is optional and validated by\n * {@link ProviderAuthConfigSchema}.\n */\nexport const ProvidersConfigSchema = z.record(z.string(), ProviderAuthConfigSchema);\n\nexport type ProvidersConfig = z.infer<typeof ProvidersConfigSchema>;\n\n// ============================================\n// Extension Configs \n// ============================================\n\n// Security config for extensions \nexport const ExtensionSecurityConfigSchema = z.object({\n checkPermissions: z.boolean().default(true),\n allowUntrusted: z.boolean().default(false),\n allow: z.array(z.string()).default([]),\n trackProvenance: z.boolean().default(true),\n allowPromptInjection: z.boolean().default(false),\n});\n\n// Slot config for extensions \nexport const ExtensionSlotsConfigSchema = z.object({\n memory: z.string().optional(),\n tts: z.string().optional(),\n imageGeneration: z.string().optional(),\n webSearch: z.string().optional(),\n});\n\n// Complete extensions config\n// Extension config allows both known fields AND arbitrary extension-specific config\n// Known fields: enabled (array), allow (array), security (object), slots (object)\n// Arbitrary: any other key is extension-specific config (e.g., extensions.hello.greeting)\nexport const ExtensionsConfigSchema: z.ZodType<Record<string, unknown>> = z.record(z.string(), z.unknown());\n\n// ============================================\n// Update Config\n// ============================================\n\nexport const UpdateAutoConfigSchema = z\n .object({\n /** Enable automatic update installation. Default false. */\n enabled: z.boolean().default(false),\n /** Hours to wait before applying a stable update after first detection. */\n stableDelayHours: z.number().min(0).default(6),\n /** Additional random jitter hours for stable rollout (avoids thundering herd). */\n stableJitterHours: z.number().min(0).default(12),\n /** How often to re-check for beta updates (hours). Min 0.25. */\n betaCheckIntervalHours: z.number().min(0.25).default(1),\n })\n .strict()\n .optional();\n\n/** Persistent `/goal` (Ralph loop) — Hermes-aligned defaults. */\nexport const GoalNotificationEventSchema = z.enum([\n 'done',\n 'blocked',\n 'needs_input',\n 'queue_failed',\n 'queue_retry',\n 'queue_succeeded',\n 'queue_skipped',\n]);\n\nexport const GoalNotificationTargetSchema = z\n .object({\n channel: z.string().min(1),\n chatId: z.string().min(1),\n accountId: z.string().optional(),\n threadId: z.union([z.string(), z.number()]).optional(),\n silent: z.boolean().optional(),\n events: z.array(GoalNotificationEventSchema).optional(),\n })\n .strict();\n\nexport const GoalNotificationsConfigSchema = z\n .object({\n enabled: z.boolean().default(false),\n /** Notify Telegram/Weixin chats bound to the goal activeSessionKey. */\n includeLinkedSessions: z.boolean().default(true),\n /** Channels eligible for linked-session notifications. */\n channels: z.array(z.string().min(1)).default(['telegram', 'weixin']),\n events: z\n .array(GoalNotificationEventSchema)\n .default(['done', 'blocked', 'needs_input', 'queue_failed', 'queue_retry']),\n targets: z.array(GoalNotificationTargetSchema).default([]),\n })\n .strict()\n .default({\n enabled: false,\n includeLinkedSessions: true,\n channels: ['telegram', 'weixin'],\n events: ['done', 'blocked', 'needs_input', 'queue_failed', 'queue_retry'],\n targets: [],\n });\n\nexport const GoalsConfigSchema = z\n .object({\n /** Max continuation turns before auto-pause (Hermes default 20). */\n maxTurns: z.number().int().min(1).max(500).default(20),\n /** Optional judge model ref; defaults to the active agent model. */\n judgeModelRef: z.string().optional(),\n /**\n * When true (default), first post-turn runs a decomposition judge to build a checklist;\n * subsequent turns evaluate progress per item (Hermes-style). When false, use legacy freeform judge only.\n */\n checklistMode: z.boolean().default(true),\n /**\n * empty_only preserves legacy behavior: the first post-turn decomposition runs only when the\n * goal has no checklist. supplement_existing lets the first post-turn add non-duplicate judge\n * criteria even when the user supplied initial acceptance criteria.\n */\n checklistDecomposePolicy: z.enum(['empty_only', 'supplement_existing']).default('empty_only'),\n /** Auto-pause after this many consecutive judge JSON/tool parse failures (Hermes default 3). */\n maxConsecutiveParseFailures: z.number().int().min(1).max(20).default(3),\n /** Judge LLM call timeout in ms (Hermes uses 60s). */\n judgeTimeoutMs: z.number().int().min(5_000).max(120_000).default(60_000),\n /** Max characters of recent transcript JSON passed to the checklist judge as extra context. */\n checklistHistoryChars: z.number().int().min(0).max(100_000).default(24_000),\n /** External channel notification policy for durable goal lifecycle events. */\n notifications: GoalNotificationsConfigSchema,\n })\n .strict();\n\nexport type GoalsConfig = z.infer<typeof GoalsConfigSchema>;\n\nexport const UpdateConfigSchema = z\n .object({\n /** Check for updates on gateway startup. Default true. */\n checkOnStart: z.boolean().default(true),\n /** Update channel: stable (default), beta, or dev. */\n channel: z.enum(['stable', 'beta', 'dev']).default('stable'),\n /** Automatic update policy. */\n auto: UpdateAutoConfigSchema,\n })\n .strict()\n .optional();\n\nexport type UpdateConfig = z.infer<typeof UpdateConfigSchema>;\n\nexport const CommandsConfigSchema = z\n .object({\n restart: z.boolean().optional(),\n })\n .strict()\n .optional();\n\nexport type CommandsConfig = z.infer<typeof CommandsConfigSchema>;\n\nexport const TuiConfigSchema = z\n .object({\n /** Default agent id for fresh TUI sessions. Leaves global routing (`agents.default`) untouched. */\n defaultAgent: z.string().min(1).optional(),\n })\n .strict()\n .default({});\n\nexport type TuiConfig = z.infer<typeof TuiConfigSchema>;\n\n// ============================================\n// MCP (Model Context Protocol)\n// ============================================\n\nconst McpHttpUrlSchema = z\n .string()\n .url()\n .refine((value) => {\n try {\n const protocol = new URL(value).protocol;\n return protocol === 'http:' || protocol === 'https:';\n } catch {\n return false;\n }\n }, 'MCP server URL must use http or https');\n\nconst ConnectorSecretReferenceSchema = z.object({\n xopcSecretRef: z.object({\n provider: z.string().min(1),\n fieldKey: z.string().min(1),\n }),\n});\n\nconst McpConfigScalarSchema = z.union([z.string(), z.number(), z.boolean(), ConnectorSecretReferenceSchema]);\n\nexport const McpServerSchema = z\n .object({\n command: z.string().optional(),\n args: z.array(z.string()).optional(),\n env: z.record(z.string(), McpConfigScalarSchema).optional(),\n cwd: z.string().optional(),\n workingDirectory: z.string().optional(),\n url: McpHttpUrlSchema.optional(),\n transport: z.enum(['sse', 'streamable-http']).optional(),\n headers: z.record(z.string(), McpConfigScalarSchema).optional(),\n connectionTimeoutMs: z.number().finite().positive().optional(),\n })\n .catchall(z.unknown())\n .superRefine((value, ctx) => {\n const hasCommand = typeof value.command === 'string' && value.command.trim().length > 0;\n const hasUrl = typeof value.url === 'string' && value.url.trim().length > 0;\n if (hasCommand && hasUrl) {\n ctx.addIssue({\n code: 'custom',\n message: 'MCP server cannot define both command and url',\n });\n }\n });\n\nexport const McpConfigSchema = z\n .object({\n servers: z.record(z.string(), McpServerSchema).optional(),\n sessionIdleTtlMs: z.number().finite().min(0).optional(),\n })\n .strict()\n .optional();\n\nexport type McpServerConfig = z.infer<typeof McpServerSchema>;\nexport type McpConfig = z.infer<typeof McpConfigSchema>;\n\nexport const ConnectorsConfigSchema = z\n .object({\n instances: z.record(z.string(), z.record(z.string(), z.unknown())).optional(),\n })\n .strict()\n .optional();\n\nexport type ConnectorsConfig = z.infer<typeof ConnectorsConfigSchema>;\n\n// ============================================\n// Root Config\n// ============================================\n\nexport const ConfigSchema = z.object({\n agents: AgentsConfigSchema,\n bindings: BindingsConfigSchema,\n session: SessionConfigSchema,\n channels: ChannelsConfigSchema,\n gateway: GatewayConfigSchema,\n browser: BrowserConfigSchema,\n tunnel: TunnelConfigSchema.optional(),\n workspace: WorkspaceConfigSchema,\n tools: ToolsConfigSchema,\n mcp: McpConfigSchema,\n connectors: ConnectorsConfigSchema,\n goals: GoalsConfigSchema.optional(),\n extensions: ExtensionsConfigSchema.default({}),\n /** Per-vendor capability provider config (image / audio / video). */\n providers: ProvidersConfigSchema.optional(),\n modelsDev: ModelsDevConfigSchema,\n /** Delivery / presentation concerns (currently `tts`). */\n messages: MessagesConfigSchema,\n update: UpdateConfigSchema,\n commands: CommandsConfigSchema,\n tui: TuiConfigSchema,\n}).default({\n agents: {\n default: 'main',\n defaultPreset: DEFAULT_CAPABILITY_PRESET_ID,\n capabilityPresets: {\n [DEFAULT_CAPABILITY_PRESET_ID]: {\n id: DEFAULT_CAPABILITY_PRESET_ID,\n name: 'Global defaults',\n description: 'Default capabilities inherited by every agent.',\n version: 1,\n models: DEFAULT_AGENT_MODELS,\n },\n },\n list: [\n {\n id: 'main',\n enabled: true,\n identity: {\n name: 'Main',\n role: 'General assistant',\n language: 'en',\n tone: 'direct',\n },\n responsibilities: {\n primary: ['Help the user complete tasks'],\n },\n workspace: { root: '~/.xopc/workspace/main' },\n tools: { builtin: {} },\n skills: { mode: 'all' },\n memory: {\n mode: 'confirmWrite',\n sources: ['session', 'curated'],\n writePolicy: { curated: 'confirm' },\n },\n workflows: {},\n boundaries: { requiresConfirmation: [], forbidden: [], escalation: [] },\n },\n ],\n },\n bindings: [],\n session: {\n scope: 'per-sender' as const,\n mainKey: 'main',\n dmScope: 'main' as const,\n },\n channels: {\n telegram: {\n enabled: false,\n debug: false,\n defaults: {\n dmPolicy: 'pairing' as const,\n groupPolicy: 'open' as const,\n replyToMode: 'off' as const,\n historyLimit: 50,\n textChunkLimit: 4000,\n streaming: { mode: 'partial' as const },\n },\n accounts: {\n default: {\n accountId: 'default',\n enabled: true,\n botToken: '',\n allowFrom: [],\n groupAllowFrom: [],\n },\n },\n },\n },\n gateway: {\n bind: 'loopback',\n port: 18790,\n auth: {\n mode: 'token',\n },\n heartbeat: {\n enabled: true,\n intervalMs: 1_800_000,\n includeSystemPromptSection: false,\n },\n maxSseConnections: 100,\n corsOrigins: [],\n skillsMarketplaceProvider: 'skillhub',\n skillsStoreBaseUrl: 'https://store.xopc.ai',\n },\n browser: {\n enabled: true,\n backend: 'extension' as const,\n },\n tools: {\n web: {\n search: {\n maxResults: 5,\n providers: [],\n },\n },\n },\n goals: {\n maxTurns: 20,\n checklistMode: true,\n checklistDecomposePolicy: 'empty_only',\n maxConsecutiveParseFailures: 3,\n judgeTimeoutMs: 60_000,\n checklistHistoryChars: 24_000,\n notifications: {\n enabled: false,\n includeLinkedSessions: true,\n channels: ['telegram', 'weixin'],\n events: ['done', 'blocked', 'needs_input', 'queue_failed', 'queue_retry'],\n targets: [],\n },\n },\n extensions: {\n allow: [],\n security: {\n checkPermissions: true,\n allowUntrusted: false,\n allow: [],\n trackProvenance: true,\n allowPromptInjection: false,\n },\n slots: {},\n },\n modelsDev: {\n enabled: true,\n },\n tui: {},\n // messages.tts / tools.media.audio start undefined; the factory layer fills\n // in provider-level defaults (model/voice) on demand. Fresh configs don't\n // ship with enabled providers so they never make surprise STT/TTS calls.\n});\n\nexport type Config = z.infer<typeof ConfigSchema>;\nexport type GatewayAuthConfig = z.infer<typeof GatewayAuthSchema>;\nexport type GatewayTrustedProxyConfig = z.infer<typeof GatewayTrustedProxySchema>;\nexport type GatewayAuthRateLimitConfig = z.infer<typeof GatewayAuthRateLimitSchema>;\nexport type GatewayBindMode = z.infer<typeof GatewayBindModeSchema>;\nexport type STTConfig = z.infer<typeof STTConfigSchema>;\nexport type TTSConfig = z.infer<typeof TTSConfigSchema>;\n\n// ============================================\n// Helper Functions\n// ============================================\n\n/**\n * Parse a model reference string.\n */\nexport interface ParsedModelRef {\n provider: string;\n model: string;\n}\n\nexport function getAgentDefaultModelRef(config: Config): string | undefined {\n const list = Array.isArray(config.agents?.list) ? config.agents.list : [];\n const defaultId =\n config.agents?.default?.trim() ||\n list.find((entry) => (entry as { default?: boolean }).default === true)?.id?.trim() ||\n list[0]?.id;\n const agent = list.find((entry) => entry.enabled !== false && entry.id === defaultId) ?? list[0];\n if (!agent) return undefined;\n\n let modelRef: string | undefined;\n const visited = new Set<string>();\n const applyModels = (models: AgentModelsConfig | undefined): void => {\n const roles = models?.roles ?? {};\n const defaultRole = models?.defaultRole ?? Object.keys(roles)[0];\n const role = defaultRole ? roles[defaultRole] : undefined;\n const next = role?.model.trim();\n if (next) modelRef = next;\n };\n const applyPreset = (presetId: string): void => {\n if (visited.has(presetId)) return;\n visited.add(presetId);\n const preset = config.agents.capabilityPresets[presetId];\n if (!preset) return;\n for (const parent of preset.extends ?? []) {\n applyPreset(parent);\n }\n applyModels(preset.models);\n };\n\n applyPreset(config.agents.defaultPreset);\n for (const presetId of agent.extends ?? []) {\n if (presetId !== config.agents.defaultPreset) {\n applyPreset(presetId);\n }\n }\n applyModels(agent.models);\n return modelRef;\n}\n\nfunction getAgentDefaultModelsConfig(config: Config): AgentModelsConfig | undefined {\n const list = Array.isArray(config.agents?.list) ? config.agents.list : [];\n const defaultId =\n config.agents?.default?.trim() ||\n list.find((entry) => (entry as { default?: boolean }).default === true)?.id?.trim() ||\n list[0]?.id;\n const agent = list.find((entry) => entry.enabled !== false && entry.id === defaultId) ?? list[0];\n if (!agent) return undefined;\n\n let modelConfig: AgentModelsConfig | undefined;\n const visited = new Set<string>();\n const applyModels = (models: AgentModelsConfig | undefined): void => {\n if (!models) return;\n modelConfig = {\n ...modelConfig,\n ...models,\n roles: {\n ...(modelConfig?.roles ?? {}),\n ...(models.roles ?? {}),\n },\n };\n };\n const applyPreset = (presetId: string): void => {\n if (visited.has(presetId)) return;\n visited.add(presetId);\n const preset = config.agents.capabilityPresets[presetId];\n if (!preset) return;\n for (const parent of preset.extends ?? []) {\n applyPreset(parent);\n }\n applyModels(preset.models);\n };\n\n applyPreset(config.agents.defaultPreset);\n for (const presetId of agent.extends ?? []) {\n if (presetId !== config.agents.defaultPreset) {\n applyPreset(presetId);\n }\n }\n applyModels(agent.models);\n return modelConfig;\n}\n\nexport function getAgentDefaultImageModelConfig(config: Config): AgentModelConfig | undefined {\n return getAgentDefaultModelsConfig(config)?.imageModel;\n}\n\nexport function getAgentDefaultImageGenerationModelConfig(\n config: Config,\n): AgentImageGenerationModelConfig | undefined {\n return getAgentDefaultModelsConfig(config)?.imageGenerationModel;\n}\n\n/** `provider/model` or null when invalid. */\nexport function parseModelRef(ref: string): ParsedModelRef | null {\n const trimmed = ref.trim();\n const idx = trimmed.indexOf('/');\n if (idx <= 0 || idx === trimmed.length - 1) {\n return null;\n }\n return { provider: trimmed.slice(0, idx).trim(), model: trimmed.slice(idx + 1).trim() };\n}\n"],"mappings":";;;;;;;;;AAsyCA,SAAgB,wBAAwB,QAAoC;CAC1E,MAAM,OAAO,MAAM,QAAQ,OAAO,QAAQ,KAAK,GAAG,OAAO,OAAO,OAAO,EAAE;CACzE,MAAM,YACJ,OAAO,QAAQ,SAAS,MAAM,IAC9B,KAAK,MAAM,UAAW,MAAgC,YAAY,KAAK,EAAE,IAAI,MAAM,IACnF,KAAK,IAAI;CACX,MAAM,QAAQ,KAAK,MAAM,UAAU,MAAM,YAAY,SAAS,MAAM,OAAO,UAAU,IAAI,KAAK;AAC9F,KAAI,CAAC,MAAO,QAAO,KAAA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ACT,SAAS;GACV;EACD,UAAU,EACR,UAAU;GACR,SAAS;GACT,OAAO;GACP,UAAU;IACR,UAAU;IACV,aAAa;IACb,aAAa;IACb,cAAc;IACd,gBAAgB;IAChB,WAAW,EAAE,MAAM,WAAoB;IACxC;GACD,UAAU,EACR,SAAS;IACP,WAAW;IACX,SAAS;IACT,UAAU;IACV,WAAW,EAAE;IACb,gBAAgB,EAAE;IACnB,EACF;GACF,EACF;EACD,SAAS;GACP,MAAM;GACN,MAAM;GACN,MAAM,EACJ,MAAM,SACP;GACD,WAAW;IACT,SAAS;IACT,YAAY;IACZ,4BAA4B;IAC7B;GACD,mBAAmB;GACnB,aAAa,EAAE;GACf,2BAA2B;GAC3B,oBAAoB;GACrB;EACD,SAAS;GACP,SAAS;GACT,SAAS;GACV;EACD,OAAO,EACL,KAAK,EACH,QAAQ;GACN,YAAY;GACZ,WAAW,EAAE;GACd,EACF,EACF;EACD,OAAO;GACL,UAAU;GACV,eAAe;GACf,0BAA0B;GAC1B,6BAA6B;GAC7B,gBAAgB;GAChB,uBAAuB;GACvB,eAAe;IACb,SAAS;IACT,uBAAuB;IACvB,UAAU,CAAC,YAAY,SAAS;IAChC,QAAQ;KAAC;KAAQ;KAAW;KAAe;KAAgB;KAAc;IACzE,SAAS,EAAE;IACZ;GACF;EACD,YAAY;GACV,OAAO,EAAE;GACT,UAAU;IACR,kBAAkB;IAClB,gBAAgB;IAChB,OAAO,EAAE;IACT,iBAAiB;IACjB,sBAAsB;IACvB;GACD,OAAO,EAAE;GACV;EACD,WAAW,EACT,SAAS,MACV;EACD,KAAK,EAAE;EAIR,CAAC"}
|
|
@@ -18,6 +18,7 @@ function connectorFromSmitheryServer(server, apiKey) {
|
|
|
18
18
|
if (!qualifiedName || !displayName) return void 0;
|
|
19
19
|
const serverId = slugFrom(qualifiedName);
|
|
20
20
|
const url = `https://server.smithery.ai/${qualifiedName.split("/").map((part) => encodeURIComponent(part)).join("/")}/mcp`;
|
|
21
|
+
const headers = apiKey ? { Authorization: `Bearer ${apiKey}` } : void 0;
|
|
21
22
|
return {
|
|
22
23
|
id: `smithery-${serverId}`,
|
|
23
24
|
version: readString(server.version) ?? "registry",
|
|
@@ -26,32 +27,32 @@ function connectorFromSmitheryServer(server, apiKey) {
|
|
|
26
27
|
category: "custom",
|
|
27
28
|
kind: "mcp",
|
|
28
29
|
source: "registry",
|
|
29
|
-
capabilities: [
|
|
30
|
+
capabilities: apiKey ? [
|
|
30
31
|
"tools",
|
|
31
32
|
"resources",
|
|
32
33
|
"prompts",
|
|
33
34
|
"auth.apiKey",
|
|
34
35
|
"runtime.mcp.streamableHttp"
|
|
36
|
+
] : [
|
|
37
|
+
"tools",
|
|
38
|
+
"resources",
|
|
39
|
+
"prompts",
|
|
40
|
+
"runtime.mcp.streamableHttp"
|
|
35
41
|
],
|
|
36
42
|
tags: [
|
|
37
43
|
"smithery",
|
|
38
44
|
"registry",
|
|
39
45
|
"mcp"
|
|
40
46
|
],
|
|
41
|
-
auth: { mode: "apiKey" },
|
|
42
|
-
setup:
|
|
43
|
-
key: "SMITHERY_AUTHORIZATION_HEADER",
|
|
44
|
-
label: "Smithery Authorization header",
|
|
45
|
-
description: "Full Authorization header used when launching hosted Smithery MCP servers, for example \"Bearer ...\".",
|
|
46
|
-
required: true
|
|
47
|
-
}] },
|
|
47
|
+
auth: { mode: apiKey ? "apiKey" : "none" },
|
|
48
|
+
setup: {},
|
|
48
49
|
runtime: {
|
|
49
50
|
type: "mcp",
|
|
50
51
|
serverId,
|
|
51
52
|
serverTemplate: {
|
|
52
53
|
url,
|
|
53
54
|
transport: "streamable-http",
|
|
54
|
-
headers
|
|
55
|
+
...headers ? { headers } : {}
|
|
55
56
|
}
|
|
56
57
|
}
|
|
57
58
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smithery.js","names":[],"sources":["../../../../src/connectors/registries/smithery.ts"],"sourcesContent":["import type { ConnectorDefinition } from '../types.js';\nimport type { ConnectorRegistryAdapter, ConnectorRegistrySearchParams, ConnectorRegistrySearchResult } from './types.js';\n\nconst DEFAULT_BASE_URL = 'https://registry.smithery.ai';\n\nfunction smitheryApiKey(): string | undefined {\n return process.env.XOPC_SMITHERY_API_KEY?.trim() || process.env.SMITHERY_API_KEY?.trim() || undefined;\n}\n\nfunction smitheryBaseUrl(): string {\n return process.env.XOPC_SMITHERY_REGISTRY_URL?.trim().replace(/\\/+$/, '') || DEFAULT_BASE_URL;\n}\n\nfunction readString(value: unknown): string | undefined {\n return typeof value === 'string' && value.trim() ? value.trim() : undefined;\n}\n\nfunction slugFrom(value: string): string {\n return value\n .trim()\n .toLowerCase()\n .replace(/^@/, '')\n .replace(/[^a-z0-9_-]+/g, '-')\n .replace(/^-+|-+$/g, '')\n .slice(0, 64) || 'smithery-mcp';\n}\n\nfunction connectorFromSmitheryServer(server: Record<string, unknown>, apiKey?: string): ConnectorDefinition | undefined {\n const qualifiedName = readString(server.qualifiedName ?? server.qualified_name ?? server.name ?? server.id);\n const displayName = readString(server.displayName ?? server.display_name ?? server.name) ?? qualifiedName;\n if (!qualifiedName || !displayName) return undefined;\n const serverId = slugFrom(qualifiedName);\n const encodedPath = qualifiedName.split('/').map((part) => encodeURIComponent(part)).join('/');\n const url = `https://server.smithery.ai/${encodedPath}/mcp`;\n return {\n id: `smithery-${serverId}`,\n version: readString(server.version) ?? 'registry',\n displayName,\n description: readString(server.description) ?? 'MCP server hosted through Smithery.',\n category: 'custom',\n kind: 'mcp',\n source: 'registry',\n capabilities: ['tools', 'resources', 'prompts', 'auth.apiKey', 'runtime.mcp.streamableHttp'],\n tags: ['smithery', 'registry', 'mcp'],\n auth: { mode:
|
|
1
|
+
{"version":3,"file":"smithery.js","names":[],"sources":["../../../../src/connectors/registries/smithery.ts"],"sourcesContent":["import type { ConnectorDefinition } from '../types.js';\nimport type { ConnectorRegistryAdapter, ConnectorRegistrySearchParams, ConnectorRegistrySearchResult } from './types.js';\n\nconst DEFAULT_BASE_URL = 'https://registry.smithery.ai';\n\nfunction smitheryApiKey(): string | undefined {\n return process.env.XOPC_SMITHERY_API_KEY?.trim() || process.env.SMITHERY_API_KEY?.trim() || undefined;\n}\n\nfunction smitheryBaseUrl(): string {\n return process.env.XOPC_SMITHERY_REGISTRY_URL?.trim().replace(/\\/+$/, '') || DEFAULT_BASE_URL;\n}\n\nfunction readString(value: unknown): string | undefined {\n return typeof value === 'string' && value.trim() ? value.trim() : undefined;\n}\n\nfunction slugFrom(value: string): string {\n return value\n .trim()\n .toLowerCase()\n .replace(/^@/, '')\n .replace(/[^a-z0-9_-]+/g, '-')\n .replace(/^-+|-+$/g, '')\n .slice(0, 64) || 'smithery-mcp';\n}\n\nfunction connectorFromSmitheryServer(server: Record<string, unknown>, apiKey?: string): ConnectorDefinition | undefined {\n const qualifiedName = readString(server.qualifiedName ?? server.qualified_name ?? server.name ?? server.id);\n const displayName = readString(server.displayName ?? server.display_name ?? server.name) ?? qualifiedName;\n if (!qualifiedName || !displayName) return undefined;\n const serverId = slugFrom(qualifiedName);\n const encodedPath = qualifiedName.split('/').map((part) => encodeURIComponent(part)).join('/');\n const url = `https://server.smithery.ai/${encodedPath}/mcp`;\n const headers = apiKey ? { Authorization: `Bearer ${apiKey}` } : undefined;\n return {\n id: `smithery-${serverId}`,\n version: readString(server.version) ?? 'registry',\n displayName,\n description: readString(server.description) ?? 'MCP server hosted through Smithery.',\n category: 'custom',\n kind: 'mcp',\n source: 'registry',\n capabilities: apiKey\n ? ['tools', 'resources', 'prompts', 'auth.apiKey', 'runtime.mcp.streamableHttp']\n : ['tools', 'resources', 'prompts', 'runtime.mcp.streamableHttp'],\n tags: ['smithery', 'registry', 'mcp'],\n auth: { mode: apiKey ? 'apiKey' : 'none' },\n setup: {},\n runtime: {\n type: 'mcp',\n serverId,\n serverTemplate: {\n url,\n transport: 'streamable-http',\n ...(headers ? { headers } : {}),\n },\n },\n };\n}\n\nfunction extractServers(payload: unknown): Record<string, unknown>[] {\n if (Array.isArray(payload)) return payload.filter((item): item is Record<string, unknown> => Boolean(item && typeof item === 'object' && !Array.isArray(item)));\n if (!payload || typeof payload !== 'object' || Array.isArray(payload)) return [];\n const data = payload as Record<string, unknown>;\n for (const key of ['servers', 'items', 'results', 'data']) {\n const value = data[key];\n if (Array.isArray(value)) {\n return value.filter((item): item is Record<string, unknown> => Boolean(item && typeof item === 'object' && !Array.isArray(item)));\n }\n }\n return [];\n}\n\nexport const smitheryRegistryAdapter: ConnectorRegistryAdapter = {\n source: 'smithery',\n displayName: 'Smithery',\n async search(params: ConnectorRegistrySearchParams): Promise<ConnectorRegistrySearchResult> {\n const apiKey = smitheryApiKey();\n const url = new URL('/servers', smitheryBaseUrl());\n const query = params.query?.trim();\n if (query) url.searchParams.set('q', query);\n url.searchParams.set('pageSize', String(Math.min(Math.max(params.pageSize ?? 24, 1), 100)));\n if (params.page && params.page > 1) url.searchParams.set('page', String(params.page));\n const response = await fetch(url, {\n headers: {\n Accept: 'application/json',\n ...(apiKey ? { Authorization: `Bearer ${apiKey}` } : {}),\n },\n });\n if (!response.ok) throw new Error(`Smithery registry returned ${response.status}`);\n const payload = await response.json();\n return {\n source: 'smithery',\n connectors: extractServers(payload).map((server) => connectorFromSmitheryServer(server, apiKey)).filter((item): item is ConnectorDefinition => Boolean(item)),\n };\n },\n};\n"],"mappings":";AAGA,MAAM,mBAAmB;AAEzB,SAAS,iBAAqC;AAC5C,QAAO,QAAQ,IAAI,uBAAuB,MAAM,IAAI,QAAQ,IAAI,kBAAkB,MAAM,IAAI,KAAA;;AAG9F,SAAS,kBAA0B;AACjC,QAAO,QAAQ,IAAI,4BAA4B,MAAM,CAAC,QAAQ,QAAQ,GAAG,IAAI;;AAG/E,SAAS,WAAW,OAAoC;AACtD,QAAO,OAAO,UAAU,YAAY,MAAM,MAAM,GAAG,MAAM,MAAM,GAAG,KAAA;;AAGpE,SAAS,SAAS,OAAuB;AACvC,QAAO,MACJ,MAAM,CACN,aAAa,CACb,QAAQ,MAAM,GAAG,CACjB,QAAQ,i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OAAO;EAAC;EAAW;EAAS;EAAW;EAAO,EAAE;EACzD,MAAM,QAAQ,KAAK;AACnB,MAAI,MAAM,QAAQ,MAAM,CACtB,QAAO,MAAM,QAAQ,SAA0C,QAAQ,QAAQ,OAAO,SAAS,YAAY,CAAC,MAAM,QAAQ,KAAK,CAAC,CAAC;;AAGrI,QAAO,EAAE;;AAGX,MAAa,0BAAoD;CAC/D,QAAQ;CACR,aAAa;CACb,MAAM,OAAO,QAA+E;EAC1F,MAAM,SAAS,gBAAgB;EAC/B,MAAM,MAAM,IAAI,IAAI,YAAY,iBAAiB,CAAC;EAClD,MAAM,QAAQ,OAAO,OAAO,MAAM;AAClC,MAAI,MAAO,KAAI,aAAa,IAAI,KAAK,MAAM;AAC3C,MAAI,aAAa,IAAI,YAAY,OAAO,KAAK,IAAI,KAAK,IAAI,OAAO,YAAY,IAAI,EAAE,EAAE,IAAI,CAAC,CAAC;AAC3F,MAAI,OAAO,QAAQ,OAAO,OAAO,EAAG,KAAI,aAAa,IAAI,QAAQ,OAAO,OAAO,KAAK,CAAC;EACrF,MAAM,WAAW,MAAM,MAAM,KAAK,EAChC,SAAS;GACP,QAAQ;GACR,GAAI,SAAS,EAAE,eAAe,UAAU,UAAU,GAAG,EAAE;GACxD,EACF,CAAC;AACF,MAAI,CAAC,SAAS,GAAI,OAAM,IAAI,MAAM,8BAA8B,SAAS,SAAS;AAElF,SAAO;GACL,QAAQ;GACR,YAAY,eAAe,MAHP,SAAS,MAAM,CAGA,CAAC,KAAK,WAAW,4BAA4B,QAAQ,OAAO,CAAC,CAAC,QAAQ,SAAsC,QAAQ,KAAK,CAAC;GAC9J;;CAEJ"}
|
|
@@ -5,6 +5,7 @@ import { SERVICE_VERSION_ENV_KEY, formatGatewayServiceDescription } from "./cons
|
|
|
5
5
|
import { homedir } from "node:os";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { existsSync } from "node:fs";
|
|
8
|
+
import { fileURLToPath } from "node:url";
|
|
8
9
|
//#region src/daemon/install-plan.ts
|
|
9
10
|
/**
|
|
10
11
|
* Install Plan Builder - Build gateway installation configuration
|
|
@@ -33,7 +34,7 @@ function isSEABinary() {
|
|
|
33
34
|
}
|
|
34
35
|
function resolveEntryPoint() {
|
|
35
36
|
if (isSEABinary()) return process.execPath;
|
|
36
|
-
const thisDir = path.dirname(
|
|
37
|
+
const thisDir = path.dirname(fileURLToPath(import.meta.url));
|
|
37
38
|
const sourceEntryPoint = path.join(thisDir, "..", "cli", "bin.ts");
|
|
38
39
|
if (existsSync(sourceEntryPoint)) return sourceEntryPoint;
|
|
39
40
|
return path.join(thisDir, "..", "cli", "bin.js");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install-plan.js","names":[],"sources":["../../../src/daemon/install-plan.ts"],"sourcesContent":["/**\n * Install Plan Builder - Build gateway installation configuration\n *\n * Aligned with OpenClaw: adds XOPC_SERVICE_VERSION, StandardOut/ErrorPath,\n * supports binary runtime detection, and --foreground arg passing.\n */\n\nimport { existsSync } from 'node:fs';\nimport path from 'node:path';\nimport { homedir } from 'node:os';\nimport { createLogger } from '../utils/logger.js';\nimport { SERVICE_VERSION_ENV_KEY, formatGatewayServiceDescription } from './constants.js';\nimport { PACKAGE_VERSION } from '../package-version.js';\nimport type { GatewayServiceInstallArgs, GatewayServiceEnv } from './types.js';\n\nconst log = createLogger('InstallPlan');\n\nexport interface InstallPlan {\n programArguments: string[];\n workingDirectory: string;\n environment: Record<string, string>;\n description: string;\n}\n\n// ─── Path Resolution ───\n\nfunction resolveDefaultConfigPath(): string {\n const envConfig = process.env.XOPC_CONFIG || process.env.XOPC_CONFIG_PATH;\n if (envConfig) return envConfig;\n return path.join(homedir(), '.xopc', 'xopc.json');\n}\n\nfunction resolveDefaultWorkspace(): string {\n const envWorkspace = process.env.XOPC_WORKSPACE;\n if (envWorkspace) return envWorkspace;\n return path.join(homedir(), '.xopc', 'workspace');\n}\n\nfunction resolveLogDir(): string {\n return path.join(homedir(), '.xopc', 'logs');\n}\n\n// ─── Binary Detection ───\n\nfunction isSEABinary(): boolean {\n // Node.js SEA (Single Executable Application) detection\n return !!(process as NodeJS.Process & { pkg?: unknown }).pkg ||\n process.execPath.endsWith('xopc') ||\n process.execPath.endsWith('xopc.exe');\n}\n\nfunction resolveEntryPoint(): string {\n if (isSEABinary()) {\n return process.execPath;\n }\n // Must match package.json \"bin\" in built packages, while source/dev runs use bin.ts.\n // index.js only exports runCli and exits immediately when executed directly.\n const thisDir = path.dirname(
|
|
1
|
+
{"version":3,"file":"install-plan.js","names":[],"sources":["../../../src/daemon/install-plan.ts"],"sourcesContent":["/**\n * Install Plan Builder - Build gateway installation configuration\n *\n * Aligned with OpenClaw: adds XOPC_SERVICE_VERSION, StandardOut/ErrorPath,\n * supports binary runtime detection, and --foreground arg passing.\n */\n\nimport { existsSync } from 'node:fs';\nimport path from 'node:path';\nimport { homedir } from 'node:os';\nimport { fileURLToPath } from 'node:url';\nimport { createLogger } from '../utils/logger.js';\nimport { SERVICE_VERSION_ENV_KEY, formatGatewayServiceDescription } from './constants.js';\nimport { PACKAGE_VERSION } from '../package-version.js';\nimport type { GatewayServiceInstallArgs, GatewayServiceEnv } from './types.js';\n\nconst log = createLogger('InstallPlan');\n\nexport interface InstallPlan {\n programArguments: string[];\n workingDirectory: string;\n environment: Record<string, string>;\n description: string;\n}\n\n// ─── Path Resolution ───\n\nfunction resolveDefaultConfigPath(): string {\n const envConfig = process.env.XOPC_CONFIG || process.env.XOPC_CONFIG_PATH;\n if (envConfig) return envConfig;\n return path.join(homedir(), '.xopc', 'xopc.json');\n}\n\nfunction resolveDefaultWorkspace(): string {\n const envWorkspace = process.env.XOPC_WORKSPACE;\n if (envWorkspace) return envWorkspace;\n return path.join(homedir(), '.xopc', 'workspace');\n}\n\nfunction resolveLogDir(): string {\n return path.join(homedir(), '.xopc', 'logs');\n}\n\n// ─── Binary Detection ───\n\nfunction isSEABinary(): boolean {\n // Node.js SEA (Single Executable Application) detection\n return !!(process as NodeJS.Process & { pkg?: unknown }).pkg ||\n process.execPath.endsWith('xopc') ||\n process.execPath.endsWith('xopc.exe');\n}\n\nfunction resolveEntryPoint(): string {\n if (isSEABinary()) {\n return process.execPath;\n }\n // Must match package.json \"bin\" in built packages, while source/dev runs use bin.ts.\n // index.js only exports runCli and exits immediately when executed directly.\n const thisDir = path.dirname(fileURLToPath(import.meta.url));\n const sourceEntryPoint = path.join(thisDir, '..', 'cli', 'bin.ts');\n if (existsSync(sourceEntryPoint)) {\n return sourceEntryPoint;\n }\n return path.join(thisDir, '..', 'cli', 'bin.js');\n}\n\nfunction resolveServiceNodeArgs(): string[] {\n const serviceNodeArgs: string[] = [];\n const skipValueFlags = new Set(['-e', '--eval', '-p', '--print', '--test-name-pattern']);\n\n for (let index = 0; index < process.execArgv.length; index += 1) {\n const arg = process.execArgv[index];\n if (!arg) continue;\n if (arg.startsWith('--inspect') || arg.startsWith('--debug')) continue;\n if (skipValueFlags.has(arg)) {\n index += 1;\n continue;\n }\n if ([...skipValueFlags].some((flag) => arg.startsWith(`${flag}=`))) continue;\n serviceNodeArgs.push(arg);\n }\n\n return serviceNodeArgs;\n}\n\n// ─── Plan Builder ───\n\nexport function buildGatewayInstallPlan(params: {\n port: number;\n bind?: import('../config/schema.js').GatewayBindMode;\n token?: string;\n env?: GatewayServiceEnv;\n runtime?: 'node' | 'binary';\n version?: string;\n}): InstallPlan {\n const configPath = resolveDefaultConfigPath();\n const workspace = resolveDefaultWorkspace();\n const version = params.version || PACKAGE_VERSION;\n\n // Determine program + arguments\n let programArguments: string[];\n\n if (params.runtime === 'binary' || isSEABinary()) {\n // SEA binary: direct execution\n const binaryPath = process.execPath;\n programArguments = [binaryPath, 'gateway', '--foreground', '--port', params.port.toString()];\n } else {\n // Node.js runtime\n const nodeArgs = resolveServiceNodeArgs();\n const entryPoint = resolveEntryPoint();\n programArguments = [\n process.execPath,\n ...nodeArgs,\n entryPoint,\n 'gateway',\n '--foreground',\n '--port', params.port.toString(),\n ];\n }\n\n if (params.bind && params.bind !== 'loopback') {\n programArguments.push('--bind', params.bind);\n }\n\n // Build environment\n const environment: Record<string, string> = {\n XOPC_CONFIG: configPath,\n XOPC_WORKSPACE: workspace,\n XOPC_LOG_LEVEL: process.env.XOPC_LOG_LEVEL || 'info',\n XOPC_LOG_FILE: 'true',\n XOPC_LOG_CONSOLE: 'false',\n XOPC_LOG_DIR: resolveLogDir(),\n [SERVICE_VERSION_ENV_KEY]: version,\n XOPC_SERVICE_MARKER: '1',\n };\n\n if (params.token) {\n environment.XOPC_GATEWAY_TOKEN = params.token;\n }\n\n // Copy relevant API key env vars\n const relevantEnvVars = [\n 'OPENAI_API_KEY',\n 'ANTHROPIC_API_KEY',\n 'GOOGLE_API_KEY',\n 'BRAVE_API_KEY',\n 'DASHSCOPE_API_KEY',\n 'XOPC_LOG_RETENTION_DAYS',\n ];\n\n for (const key of relevantEnvVars) {\n if (process.env[key]) {\n environment[key] = process.env[key]!;\n }\n }\n\n // Add custom env from params (non-XOPC keys only; XOPC keys already handled)\n if (params.env) {\n for (const [key, value] of Object.entries(params.env)) {\n if (value !== undefined && !key.startsWith('XOPC_')) {\n environment[key] = value;\n }\n }\n }\n\n // Service description\n const profile = params.env?.XOPC_PROFILE?.trim() || undefined;\n const description = formatGatewayServiceDescription({ profile, version });\n\n log.info({\n programArguments: programArguments.slice(0, 3),\n envKeys: Object.keys(environment),\n version,\n }, 'Built gateway install plan');\n\n return {\n programArguments,\n workingDirectory: path.dirname(configPath),\n environment,\n description,\n };\n}\n\n// ─── Install Args Builder ───\n\nexport function buildGatewayInstallArgs(params: {\n port: number;\n bind?: import('../config/schema.js').GatewayBindMode;\n token?: string;\n env?: GatewayServiceEnv;\n runtime?: 'node' | 'binary';\n version?: string;\n}): GatewayServiceInstallArgs {\n const plan = buildGatewayInstallPlan(params);\n\n return {\n env: params.env || process.env,\n programArguments: plan.programArguments,\n workingDirectory: plan.workingDirectory,\n environment: plan.environment,\n description: plan.description,\n };\n}\n\n// ─── Validation ───\n\n/** Check if the program in an install plan still exists on disk */\nexport function validateInstallPlanProgram(programArguments: string[]): boolean {\n if (programArguments.length === 0) return false;\n const program = programArguments[0];\n return existsSync(program);\n}\n"],"mappings":";;;;;;;;;;;;;;;aAWkD;sBAEM;AAGxD,MAAM,MAAM,aAAa,cAAc;AAWvC,SAAS,2BAAmC;CAC1C,MAAM,YAAY,QAAQ,IAAI,eAAe,QAAQ,IAAI;AACzD,KAAI,UAAW,QAAO;AACtB,QAAO,KAAK,KAAK,SAAS,EAAE,SAAS,YAAY;;AAGnD,SAAS,0BAAkC;CACzC,MAAM,eAAe,QAAQ,IAAI;AACjC,KAAI,aAAc,QAAO;AACzB,QAAO,KAAK,KAAK,SAAS,EAAE,SAAS,YAAY;;AAGnD,SAAS,gBAAwB;AAC/B,QAAO,KAAK,KAAK,SAAS,EAAE,SAAS,OAAO;;AAK9C,SAAS,cAAuB;AAE9B,QAAO,CAAC,CAAE,QAA+C,OACvD,QAAQ,SAAS,SAAS,OAAO,IACjC,QAAQ,SAAS,SAAS,WAAW;;AAGzC,SAAS,oBAA4B;AACnC,KAAI,aAAa,CACf,QAAO,QAAQ;CAIjB,MAAM,UAAU,KAAK,QAAQ,cAAc,OAAO,KAAK,IAAI,CAAC;CAC5D,MAAM,mBAAmB,KAAK,KAAK,SAAS,MAAM,OAAO,SAAS;AAClE,KAAI,WAAW,iBAAiB,CAC9B,QAAO;AAET,QAAO,KAAK,KAAK,SAAS,MAAM,OAAO,SAAS;;AAGlD,SAAS,yBAAmC;CAC1C,MAAM,kBAA4B,EAAE;CACpC,MAAM,iBAAiB,IAAI,IAAI;EAAC;EAAM;EAAU;EAAM;EAAW;EAAsB,CAAC;AAExF,MAAK,IAAI,QAAQ,GAAG,QAAQ,QAAQ,SAAS,QAAQ,SAAS,GAAG;EAC/D,MAAM,MAAM,QAAQ,SAAS;AAC7B,MAAI,CAAC,IAAK;AACV,MAAI,IAAI,WAAW,YAAY,IAAI,IAAI,WAAW,UAAU,CAA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AI,KAAK;EACP,kBAAkB,iBAAiB,MAAM,GAAG,EAAE;EAC9C,SAAS,OAAO,KAAK,YAAY;EACjC;EACD,EAAE,6BAA6B;AAEhC,QAAO;EACL;EACA,kBAAkB,KAAK,QAAQ,WAAW;EAC1C;EACA;EACD;;AAKH,SAAgB,wBAAwB,QAOV;CAC5B,MAAM,OAAO,wBAAwB,OAAO;AAE5C,QAAO;EACL,KAAK,OAAO,OAAO,QAAQ;EAC3B,kBAAkB,KAAK;EACvB,kBAAkB,KAAK;EACvB,aAAa,KAAK;EAClB,aAAa,KAAK;EACnB;;;AAMH,SAAgB,2BAA2B,kBAAqC;AAC9E,KAAI,iBAAiB,WAAW,EAAG,QAAO;CAC1C,MAAM,UAAU,iBAAiB;AACjC,QAAO,WAAW,QAAQ"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { resolveEffectiveAgentManifest } from "../agent-manifest/resolver.js";
|
|
2
1
|
import { init_agent_scope, listAgentEntries, normalizeAgentId, resolveAgentDir, resolveAgentProfileDir, resolveAgentWorkspaceDir, resolveDefaultAgentId, resolveUserPath, validateAgentIdForNewAgent } from "../agent/agent-scope.js";
|
|
2
|
+
import { resolveEffectiveAgentManifest } from "../agent-manifest/resolver.js";
|
|
3
3
|
import { resolveEffectiveAgentProfile } from "../config/agent-profile.js";
|
|
4
4
|
import { WORKSPACE_FILES, init_paths, resolveUserProfilePath } from "../config/paths.js";
|
|
5
5
|
import { AGENT_PROFILE_MARKDOWN_SYSTEM_FILES, REQUIRED_AGENT_PROFILE_MARKDOWN_FILE_SET } from "../agent/context/workspace.js";
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { CapabilityPresetSchema, init_schema } from "../agent-manifest/schema.js";
|
|
2
|
+
import { DEFAULT_AGENT_MODELS, init_default_model } from "../config/default-model.js";
|
|
2
3
|
import { getAllProviders, getModelsByProvider, getProviderAuthState, getProviderDisplayName, init_providers } from "../providers/index.js";
|
|
3
4
|
import { getRecommendedModelsForProvider } from "../providers/presentation.js";
|
|
4
5
|
//#region src/gateway/global-defaults-admin.ts
|
|
5
6
|
init_schema();
|
|
7
|
+
init_default_model();
|
|
6
8
|
init_providers();
|
|
7
9
|
function defaultPresetId(cfg) {
|
|
8
10
|
return cfg.agents.defaultPreset || "default";
|
|
@@ -13,10 +15,7 @@ function emptyGlobalDefaultsPreset(id) {
|
|
|
13
15
|
name: "Global defaults",
|
|
14
16
|
description: "Default capabilities inherited by every agent.",
|
|
15
17
|
version: 1,
|
|
16
|
-
models:
|
|
17
|
-
defaultRole: "deep",
|
|
18
|
-
roles: {}
|
|
19
|
-
}
|
|
18
|
+
models: DEFAULT_AGENT_MODELS
|
|
20
19
|
};
|
|
21
20
|
}
|
|
22
21
|
function ensureGlobalDefaultsConfig(cfg) {
|
|
@@ -27,10 +26,7 @@ function ensureGlobalDefaultsConfig(cfg) {
|
|
|
27
26
|
id: presetId,
|
|
28
27
|
name: current.name || "Global defaults",
|
|
29
28
|
version: current.version || 1,
|
|
30
|
-
models: current.models ??
|
|
31
|
-
defaultRole: "deep",
|
|
32
|
-
roles: {}
|
|
33
|
-
}
|
|
29
|
+
models: current.models ?? DEFAULT_AGENT_MODELS
|
|
34
30
|
} : emptyGlobalDefaultsPreset(presetId);
|
|
35
31
|
return {
|
|
36
32
|
...cfg,
|
|
@@ -87,10 +83,7 @@ async function listGlobalDefaults(cfg) {
|
|
|
87
83
|
providers.sort((a, b) => Number(b.configured) - Number(a.configured) || a.name.localeCompare(b.name));
|
|
88
84
|
return {
|
|
89
85
|
presetId,
|
|
90
|
-
models: preset.models ??
|
|
91
|
-
defaultRole: "deep",
|
|
92
|
-
roles: {}
|
|
93
|
-
},
|
|
86
|
+
models: preset.models ?? DEFAULT_AGENT_MODELS,
|
|
94
87
|
providers,
|
|
95
88
|
recommendations
|
|
96
89
|
};
|
|
@@ -106,10 +99,7 @@ function prepareUpdateGlobalDefaults(cfg, body) {
|
|
|
106
99
|
error: `models ${parsed.error.issues[0]?.message ?? "is invalid"}`,
|
|
107
100
|
status: 400
|
|
108
101
|
};
|
|
109
|
-
const models = parsed.data.models ??
|
|
110
|
-
defaultRole: "deep",
|
|
111
|
-
roles: {}
|
|
112
|
-
};
|
|
102
|
+
const models = parsed.data.models ?? DEFAULT_AGENT_MODELS;
|
|
113
103
|
const roles = models.roles ?? {};
|
|
114
104
|
const defaultRole = models.defaultRole ?? Object.keys(roles)[0] ?? "deep";
|
|
115
105
|
if (Object.keys(roles).length > 0 && !roles[defaultRole]) return {
|