@xopcai/xopc 0.0.165 → 0.0.167
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/feishu/src/outbound/media-load.js +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-DkALQFJT.js → activity-store-DjEDu38T.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CKVX2TyD.js → agent-avatar-dicebear-DQULz7qY.js} +1 -1
- package/dist/gateway/static/root/assets/agents-CnzkBgKC.js +2 -0
- package/dist/gateway/static/root/assets/{api-DPIXEcIq.js → api-DwVCuPOb.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-ClToHdDF.js → app-management-settings-panel-DOjWALVF.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-Ci2jWAkQ.js → appearance-settings-C31COUIC.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-DCow0nte.js → apps-page-lSC486eu.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-CKv5A1_M.js → archive-plugin-DQPvLqfx.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-LgoN-Vwo.js → attachment-load-DwT1x1rc.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-suggestion-card-BwnZqDQE.js → automation-suggestion-card-ByYBiiMR.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-DWWHMqCZ.js → automations-page-iZTnc1YZ.js} +1 -1
- package/dist/gateway/static/root/assets/{binary-plugins-WwMRnBdP.js → binary-plugins-CRXiHoZS.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-CThEfJSn.js → block-editor-CHO6ILiz.js} +3 -3
- package/dist/gateway/static/root/assets/{browser-settings-page-7x8rKLOl.js → browser-settings-page-C-OOPZcJ.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-DCj9DG0A.js → browser-workflow-inputs-3UaarfXS.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-C1k2vHLV.js → browser-workflows-page-BFaa-N_D.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-settings-panel-BayH0Uom.js +7 -0
- package/dist/gateway/static/root/assets/capability-presets-api-DdCHSzcA.js +1 -0
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-JlhjAhT7.js +2 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-B5rLegwk.js → channel-recipient-api-BOkLI89e.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-settings-DU93p9RZ.js → channels-settings-C-Spmwr5.js} +1 -1
- package/dist/gateway/static/root/assets/channels-status-swr-ZrqadU60.js +1 -0
- package/dist/gateway/static/root/assets/{connector-logo-au5xzRMl.js → connector-logo-CbcC0T6i.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-B9sD56hT.js → connectors-page-DpDmJ3Nx.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-CaTO9bAV.js → desktop-pet-CR7RGQff.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-CORq2BIE.js → desktop-pet-settings-BudmCcPE.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-Daf0tqrN.js → directory-picker-path-field-BLG2Oe6z.js} +1 -1
- package/dist/gateway/static/root/assets/{dreaming-settings-CJqJpvgc.js → dreaming-settings-BwBGC0SG.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-0XmiUqsm.js → extension-debug-page-Pr65_hLC.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-C_9HSvyu.js → extension-page-BuJDcoKn.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-DcmUCmOu.js → extension-settings-page-B3802tn5.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-CZqfsxJf.js → gateway-config-api-D-NVkfts.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-CzX8TVmO.js → gateway-settings-DIdsKVXv.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-ulwTJovP.js → gateway-startup-retry-qnEmj-vL.js} +1 -1
- package/dist/gateway/static/root/assets/{goal-create-dialog-Dbj_sgV-.js → goal-create-dialog-51j_DxgV.js} +1 -1
- package/dist/gateway/static/root/assets/{goal-detail-page-BdkiZwW-.js → goal-detail-page-CeqMr5GF.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-config-api-Cvlq3jyf.js → goals-config-api-BkVBh7ct.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-page-BD9ztXNA.js → goals-page-lf3oM4Xa.js} +1 -1
- package/dist/gateway/static/root/assets/{goals-settings-CSGvHJDi.js → goals-settings-Cg7MJLvx.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-BvXA7oNN.js → heartbeat-settings-BV3kJOcX.js} +1 -1
- package/dist/gateway/static/root/assets/{index-CfOzvGDb.js → index-B24B26og.js} +9 -9
- package/dist/gateway/static/root/assets/index-DfE2j0g8.css +1 -0
- package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-B9K5rTZZ.js +1 -0
- package/dist/gateway/static/root/assets/{local-app-workbench-page-DH4nglP_.js → local-app-workbench-page-ehzr9CBG.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-BScdXqMo.js → local-apps-page-BBx6mfAD.js} +1 -1
- package/dist/gateway/static/root/assets/locale-store-tnRLWdx2.js +1 -0
- package/dist/gateway/static/root/assets/{logs-page-BBpAWjyF.js → logs-page-xuwEkusZ.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-8hnAS25m.js → markdown-split-DRDddIt8.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-DzlHseMD.js → media-plugins-Dn3hxhOV.js} +1 -1
- package/dist/gateway/static/root/assets/{messages-C96Zjb0V.js → messages-B1EG4gdu.js} +2 -4
- package/dist/gateway/static/root/assets/{notes-page-DbDHFPiI.js → notes-page-BtKHSb4z.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-workbench-B-A9whbg.js → notes-workbench-DXGXn5XF.js} +2 -2
- package/dist/gateway/static/root/assets/{page-tabs-CXJiygUJ.js → page-tabs-P2BEd1D8.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-Cq6aue5a.js → preview-open-alternatives-DrkjmW0F.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-nP8vuNlJ.js → product-open-page-CGzMEowb.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-BXrscUbq.js → project-detail-page-IiE2ddWb.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-m0EKUeaY.js → projects-page-DGOVhaYI.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-B16uQSY5.js → remote-access-hub-l_y_Shgl.js} +1 -1
- package/dist/gateway/static/root/assets/{save-bar-controls-BPgnLY1p.js → save-bar-controls-BkGrufxl.js} +1 -1
- package/dist/gateway/static/root/assets/{schedule-field-rHWpueWl.js → schedule-field-A8tDpL-9.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-CHKIUrzk.js → schema-form-N6_hDWgx.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-C5_qtznc.js → sessions-page-CAX4ipPv.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-eVlH9brU.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-CR4J0N4X.js → settings-form-section-Bb6yYt5f.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-B8v-lHKT.js → settings-loading-skeleton-Q_Vh6HEl.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-BcLf8Rd5.js → settings-page-CjOtQpbR.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-Co31Becn.js → settings-page-layout-CtESNNdx.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-BFLA1Fsj.js → setup-status-panel-CGxHXgJB.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-B5vMe8DY.js → share-preview-page-C65IsFmd.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-DL2tKPq6.js → shares-settings-Ct3fcbHr.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-ElA5kabh.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-DAOZXlp5.js → skills-page-FeieOEn3.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-CHt3FXI8.js → system-settings-panel-CdUl2I0D.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-D37XLD_C.js → theme-store-H9T49Iar.js} +1 -1
- package/dist/gateway/static/root/assets/{time-picker-C9Rr1IUV.js → time-picker-EkhqT3fS.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-QMF30Yvh.js → typed-models-lib-5xRRUE9Y.js} +1 -1
- package/dist/gateway/static/root/assets/{use-channel-catalog-DBh0dOC9.js → use-channel-catalog-UACJTyH0.js} +1 -1
- package/dist/gateway/static/root/assets/{user-context-page-D6EEhj-e.js → user-context-page-DHiRvd4i.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-Gjjs3qih.js → voice-api-key-field-Bql0SPCp.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-page-CDnL9daG.js → work-discovery-page-BcmZux7y.js} +1 -1
- package/dist/gateway/static/root/assets/{work-item-detail-page-BCoT4p1E.js → work-item-detail-page-D94Q5zVD.js} +1 -1
- package/dist/gateway/static/root/assets/{work-page-l8h2Y50w.js → work-page-DdFBMDcB.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DnOfronD.js → workflow-run-setup-panel-Dow7ZztR.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-IVbQ83CW.js → workflows-page-wOVSoduy.js} +1 -1
- package/dist/gateway/static/root/index.html +8 -8
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-manager.js +3 -3
- package/dist/src/agent/bootstrap/filter-bootstrap-files.js +1 -1
- package/dist/src/agent/embedded/model-runtime.js +1 -1
- package/dist/src/agent/goals/post-turn.js +1 -1
- package/dist/src/agent/image/generation/custom-openai-images-provider.d.ts +7 -0
- package/dist/src/agent/image/generation/custom-openai-images-provider.js +81 -0
- package/dist/src/agent/image/generation/{openai-compatible-image-provider.d.ts → openai-images-provider.d.ts} +10 -31
- package/dist/src/agent/image/generation/{openai-compatible-image-provider.js → openai-images-provider.js} +36 -23
- package/dist/src/agent/image/generation/provider-registry.d.ts +2 -0
- package/dist/src/agent/image/generation/provider-registry.js +50 -4
- package/dist/src/agent/image/generation/providers/openai.js +2 -2
- package/dist/src/agent/image/generation/runtime.js +5 -1
- package/dist/src/agent/image/generation/types.d.ts +11 -0
- package/dist/src/agent/image/tool-model-config.js +1 -1
- package/dist/src/agent/ipc/inbox.js +1 -1
- package/dist/src/agent/memory/dreaming/config.js +1 -1
- package/dist/src/agent/service.js +2 -2
- package/dist/src/agent/skills/hub-lock.js +1 -1
- package/dist/src/agent-runtime/index.js +1 -1
- package/dist/src/agent-runtime/runtime-profile.js +1 -1
- package/dist/src/auth/credentials.js +2 -2
- package/dist/src/auth/profiles/store.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +2 -2
- package/dist/src/browser/providers/browser-ext-install.js +1 -1
- package/dist/src/cli/commands/channels.js +1 -1
- package/dist/src/cli/commands/connectors.js +2 -2
- package/dist/src/cli/commands/doctor/checks/image-providers.d.ts +2 -0
- package/dist/src/cli/commands/doctor/checks/image-providers.js +68 -0
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
- package/dist/src/cli/commands/doctor/flow.js +2 -0
- package/dist/src/cli/commands/extension-marketplace.js +2 -2
- package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
- package/dist/src/cli/commands/models.js +2 -2
- package/dist/src/cli/commands/onboard.js +1 -1
- package/dist/src/cli/commands/update.js +1 -1
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/config/index.js +5 -5
- package/dist/src/config/loader.js +1 -1
- package/dist/src/config/models-json.d.ts +325 -0
- package/dist/src/config/models-json.js +140 -5
- package/dist/src/connectors/connector-memory-sync.js +1 -1
- package/dist/src/connectors/health.js +1 -1
- package/dist/src/extensions/lockfile.js +1 -1
- package/dist/src/extensions/sdk/index.js +1 -1
- package/dist/src/gateway/agents-admin.js +2 -2
- package/dist/src/gateway/custom-image-providers.d.ts +89 -0
- package/dist/src/gateway/custom-image-providers.js +59 -0
- package/dist/src/gateway/file-path-classifier.js +1 -1
- package/dist/src/gateway/heartbeat/service.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/routes/mcp.js +1 -1
- package/dist/src/gateway/hono/routes/models.js +183 -2
- package/dist/src/gateway/hono/routes/update.js +2 -2
- package/dist/src/gateway/image-generation-setup.js +7 -1
- package/dist/src/gateway/index.js +1 -1
- package/dist/src/gateway/run-loop.js +1 -1
- package/dist/src/gateway/service/config-coordinator.js +3 -1
- package/dist/src/gateway/service.js +6 -6
- package/dist/src/goals/goal-workflow-judge.js +1 -1
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/infra/gateway-processes.js +1 -1
- package/dist/src/infra/update-restart.js +1 -1
- package/dist/src/infra/update-runner.js +2 -2
- package/dist/src/infra/update-startup.js +1 -1
- package/dist/src/mcp/channel-bridge.js +1 -1
- package/dist/src/media-shared/http/index.d.ts +1 -1
- package/dist/src/media-shared/http/index.js +2 -2
- package/dist/src/media-shared/http/provider-http.d.ts +2 -0
- package/dist/src/media-shared/http/provider-http.js +43 -4
- package/dist/src/notes/service.js +1 -1
- package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
- package/dist/src/providers/index.js +7 -4
- package/dist/src/providers/model-ref.d.ts +6 -0
- package/dist/src/providers/model-ref.js +15 -0
- package/dist/src/providers/model-reference-auditor.d.ts +1 -0
- package/dist/src/providers/model-reference-auditor.js +23 -13
- package/dist/src/providers/model-registry.js +6 -3
- package/dist/src/tui/tui-startup-resources.js +2 -2
- package/dist/src/tui/tui.js +1 -1
- package/dist/src/workflows/service/workflow-run-service.js +1 -1
- package/package.json +2 -2
- package/dist/gateway/static/root/assets/agents-F8749KZ_.js +0 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DIwGIpuS.js +0 -2
- package/dist/gateway/static/root/assets/capability-presets-api-C_NVbV7o.js +0 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-DBdvIcV0.js +0 -2
- package/dist/gateway/static/root/assets/channels-status-swr-DZZq0upi.js +0 -1
- package/dist/gateway/static/root/assets/index-BXtJvaQl.css +0 -1
- package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-xb6mna1C.js +0 -1
- package/dist/gateway/static/root/assets/locale-store-C_ax27uc.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-DQlbm1mA.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-C8jkuLob.js +0 -1
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { type ModelsJsonConfig } from '../config/models-json.js';
|
|
3
|
+
export declare const CustomImageProviderInputSchema: z.ZodObject<{
|
|
4
|
+
baseUrl: z.ZodString;
|
|
5
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
6
|
+
imageGeneration: z.ZodObject<{
|
|
7
|
+
api: z.ZodLiteral<"openai-images">;
|
|
8
|
+
name: z.ZodString;
|
|
9
|
+
documentationUrl: z.ZodOptional<z.ZodString>;
|
|
10
|
+
apiKeyUrl: z.ZodOptional<z.ZodString>;
|
|
11
|
+
defaultModel: z.ZodString;
|
|
12
|
+
auth: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
13
|
+
type: z.ZodLiteral<"bearer">;
|
|
14
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
15
|
+
type: z.ZodLiteral<"header">;
|
|
16
|
+
headerName: z.ZodString;
|
|
17
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
18
|
+
type: z.ZodLiteral<"none">;
|
|
19
|
+
}, z.core.$strict>], "type">;
|
|
20
|
+
paths: z.ZodOptional<z.ZodObject<{
|
|
21
|
+
generations: z.ZodOptional<z.ZodString>;
|
|
22
|
+
edits: z.ZodOptional<z.ZodString>;
|
|
23
|
+
}, z.core.$strict>>;
|
|
24
|
+
network: z.ZodOptional<z.ZodObject<{
|
|
25
|
+
allowedHosts: z.ZodArray<z.ZodString>;
|
|
26
|
+
}, z.core.$strict>>;
|
|
27
|
+
models: z.ZodArray<z.ZodObject<{
|
|
28
|
+
id: z.ZodString;
|
|
29
|
+
name: z.ZodOptional<z.ZodString>;
|
|
30
|
+
capabilities: z.ZodObject<{
|
|
31
|
+
generate: z.ZodOptional<z.ZodObject<{
|
|
32
|
+
maxCount: z.ZodOptional<z.ZodNumber>;
|
|
33
|
+
supportsSize: z.ZodOptional<z.ZodBoolean>;
|
|
34
|
+
supportsAspectRatio: z.ZodOptional<z.ZodBoolean>;
|
|
35
|
+
supportsResolution: z.ZodOptional<z.ZodBoolean>;
|
|
36
|
+
}, z.core.$strict>>;
|
|
37
|
+
edit: z.ZodOptional<z.ZodObject<{
|
|
38
|
+
enabled: z.ZodBoolean;
|
|
39
|
+
maxInputImages: z.ZodOptional<z.ZodNumber>;
|
|
40
|
+
supportsSize: z.ZodOptional<z.ZodBoolean>;
|
|
41
|
+
supportsAspectRatio: z.ZodOptional<z.ZodBoolean>;
|
|
42
|
+
}, z.core.$strict>>;
|
|
43
|
+
geometry: z.ZodOptional<z.ZodObject<{
|
|
44
|
+
sizes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
45
|
+
aspectRatios: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
46
|
+
resolutions: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
47
|
+
"1K": "1K";
|
|
48
|
+
"2K": "2K";
|
|
49
|
+
"4K": "4K";
|
|
50
|
+
}>>>;
|
|
51
|
+
}, z.core.$strict>>;
|
|
52
|
+
output: z.ZodOptional<z.ZodObject<{
|
|
53
|
+
qualities: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
54
|
+
low: "low";
|
|
55
|
+
high: "high";
|
|
56
|
+
auto: "auto";
|
|
57
|
+
medium: "medium";
|
|
58
|
+
}>>>;
|
|
59
|
+
formats: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
60
|
+
png: "png";
|
|
61
|
+
jpeg: "jpeg";
|
|
62
|
+
webp: "webp";
|
|
63
|
+
}>>>;
|
|
64
|
+
backgrounds: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
65
|
+
auto: "auto";
|
|
66
|
+
transparent: "transparent";
|
|
67
|
+
opaque: "opaque";
|
|
68
|
+
}>>>;
|
|
69
|
+
}, z.core.$strict>>;
|
|
70
|
+
}, z.core.$strict>;
|
|
71
|
+
defaults: z.ZodOptional<z.ZodObject<{
|
|
72
|
+
count: z.ZodOptional<z.ZodNumber>;
|
|
73
|
+
size: z.ZodOptional<z.ZodString>;
|
|
74
|
+
outputFormat: z.ZodOptional<z.ZodEnum<{
|
|
75
|
+
png: "png";
|
|
76
|
+
jpeg: "jpeg";
|
|
77
|
+
webp: "webp";
|
|
78
|
+
}>>;
|
|
79
|
+
}, z.core.$strict>>;
|
|
80
|
+
}, z.core.$strict>>;
|
|
81
|
+
}, z.core.$strict>;
|
|
82
|
+
}, z.core.$strict>;
|
|
83
|
+
export type CustomImageProviderInput = z.infer<typeof CustomImageProviderInputSchema>;
|
|
84
|
+
export interface CustomImageProviderRecord extends CustomImageProviderInput {
|
|
85
|
+
providerId: string;
|
|
86
|
+
}
|
|
87
|
+
export declare function listCustomImageProviders(config: ModelsJsonConfig): CustomImageProviderRecord[];
|
|
88
|
+
export declare function upsertCustomImageProvider(config: ModelsJsonConfig, providerIdRaw: string, input: unknown): ModelsJsonConfig;
|
|
89
|
+
export declare function deleteCustomImageProvider(config: ModelsJsonConfig, providerIdRaw: string): ModelsJsonConfig;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { ImageGenerationProviderSchema, init_models_json, validateModelsConfig } from "../config/models-json.js";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
//#region src/gateway/custom-image-providers.ts
|
|
4
|
+
init_models_json();
|
|
5
|
+
const PROVIDER_ID_REGEX = /^[a-z0-9]([a-z0-9-_]*[a-z0-9])?$/;
|
|
6
|
+
const CustomImageProviderInputSchema = z.object({
|
|
7
|
+
baseUrl: z.string().url(),
|
|
8
|
+
headers: z.record(z.string(), z.string()).optional(),
|
|
9
|
+
imageGeneration: ImageGenerationProviderSchema
|
|
10
|
+
}).strict();
|
|
11
|
+
function listCustomImageProviders(config) {
|
|
12
|
+
return Object.entries(config.providers).flatMap(([providerId, provider]) => {
|
|
13
|
+
if (!provider.imageGeneration) return [];
|
|
14
|
+
return [{
|
|
15
|
+
providerId,
|
|
16
|
+
baseUrl: provider.baseUrl,
|
|
17
|
+
...provider.headers ? { headers: { ...provider.headers } } : {},
|
|
18
|
+
imageGeneration: structuredClone(provider.imageGeneration)
|
|
19
|
+
}];
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
function upsertCustomImageProvider(config, providerIdRaw, input) {
|
|
23
|
+
const providerId = normalizeProviderId(providerIdRaw);
|
|
24
|
+
const parsed = CustomImageProviderInputSchema.safeParse(input);
|
|
25
|
+
if (!parsed.success) throw new Error(parsed.error.issues.map((issue) => `${issue.path.join(".")}: ${issue.message}`).join("; "));
|
|
26
|
+
const { headers: _currentHeaders, ...currentWithoutHeaders } = config.providers[providerId] ?? {};
|
|
27
|
+
const next = structuredClone(config);
|
|
28
|
+
next.providers[providerId] = {
|
|
29
|
+
...currentWithoutHeaders,
|
|
30
|
+
baseUrl: parsed.data.baseUrl,
|
|
31
|
+
...parsed.data.headers ? { headers: parsed.data.headers } : {},
|
|
32
|
+
imageGeneration: parsed.data.imageGeneration
|
|
33
|
+
};
|
|
34
|
+
assertValid(next);
|
|
35
|
+
return next;
|
|
36
|
+
}
|
|
37
|
+
function deleteCustomImageProvider(config, providerIdRaw) {
|
|
38
|
+
const providerId = normalizeProviderId(providerIdRaw);
|
|
39
|
+
const current = config.providers[providerId];
|
|
40
|
+
if (!current?.imageGeneration) throw new Error(`Custom image provider not found: ${providerId}`);
|
|
41
|
+
const next = structuredClone(config);
|
|
42
|
+
if (Boolean(current.api || current.apiKey || current.authHeader !== void 0 || current.models?.length || current.modelOverrides && Object.keys(current.modelOverrides).length > 0 || current.modelDiscovery)) {
|
|
43
|
+
const { imageGeneration: _removed, ...remaining } = current;
|
|
44
|
+
next.providers[providerId] = remaining;
|
|
45
|
+
} else delete next.providers[providerId];
|
|
46
|
+
assertValid(next);
|
|
47
|
+
return next;
|
|
48
|
+
}
|
|
49
|
+
function normalizeProviderId(value) {
|
|
50
|
+
const providerId = value.trim();
|
|
51
|
+
if (!PROVIDER_ID_REGEX.test(providerId)) throw new Error("Provider ID must start/end with alphanumeric and contain only lowercase letters, numbers, hyphens, and underscores");
|
|
52
|
+
return providerId;
|
|
53
|
+
}
|
|
54
|
+
function assertValid(config) {
|
|
55
|
+
const validation = validateModelsConfig(config);
|
|
56
|
+
if (!validation.valid) throw new Error(validation.errors.filter((entry) => entry.severity === "error").map((entry) => `${entry.path}: ${entry.message}`).join("; "));
|
|
57
|
+
}
|
|
58
|
+
//#endregion
|
|
59
|
+
export { CustomImageProviderInputSchema, deleteCustomImageProvider, listCustomImageProviders, upsertCustomImageProvider };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { init_paths_state, resolveStateDir } from "../config/paths-state.js";
|
|
2
2
|
import { init_agent_scope, resolveAgentProfileDir } from "../agent/agent-scope.js";
|
|
3
|
-
import { init_paths, resolveConfigPath, resolveSkillsDir } from "../config/paths.js";
|
|
4
3
|
import { extractProfileAgentId } from "../config/agent-profile.js";
|
|
4
|
+
import { init_paths, resolveConfigPath, resolveSkillsDir } from "../config/paths.js";
|
|
5
5
|
import { isBareProfileMarkdownFileName, resolveProfileMarkdownPathIfBareName } from "../agent/tools/tool-paths.js";
|
|
6
6
|
import { isPathUnderWorkspace, resolveWorkspaceSafePath } from "./workspace-editor-path.js";
|
|
7
7
|
import { basename, isAbsolute, resolve } from "node:path";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
3
|
import { shouldSilence, stripHeartbeatToken } from "../../heartbeat/tokens.js";
|
|
4
|
+
import { appendCronEventLines } from "../../heartbeat/event-prompt.js";
|
|
4
5
|
import { isWithinActiveHours } from "../../heartbeat/active-hours.js";
|
|
5
6
|
import { isHeartbeatContentEmpty } from "../../heartbeat/content-check.js";
|
|
6
|
-
import { appendCronEventLines } from "../../heartbeat/event-prompt.js";
|
|
7
7
|
import { createHeartbeatWake } from "../../heartbeat/wake.js";
|
|
8
8
|
import { resolveHeartbeatMdPath } from "../workspace-heartbeat-path.js";
|
|
9
9
|
import { readFile } from "fs/promises";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { init_agent_scope, listAgentEntries, normalizeAgentId, resolveDefaultAgentId } from "../../../agent/agent-scope.js";
|
|
2
2
|
import { resolveModelsJsonPath } from "../../../config/paths.js";
|
|
3
|
+
import { buildChannelCatalogForConfig, buildChannelCatalogFromSnapshot, getChannelSetupStatus, init_channel_catalog_service } from "../../../channels/catalog/channel-catalog-service.js";
|
|
3
4
|
import { init_models_json, loadModelsJson } from "../../../config/models-json.js";
|
|
4
5
|
import { CredentialResolver, init_credentials } from "../../../auth/credentials.js";
|
|
5
|
-
import { buildChannelCatalogForConfig, buildChannelCatalogFromSnapshot, getChannelSetupStatus, init_channel_catalog_service } from "../../../channels/catalog/channel-catalog-service.js";
|
|
6
6
|
import { getProviderRegistry, init_plugin_registry } from "../../../providers/plugin-registry.js";
|
|
7
7
|
import { getAllProviders, init_providers, isProviderConfigured } from "../../../providers/index.js";
|
|
8
8
|
import { resolveShareConfig } from "../../../share/share-config.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { canonicalizeConfiguredMcpServer, normalizeConfiguredMcpServers } from "../../../config/mcp-config-normalize.js";
|
|
2
2
|
import { loadMergedBundleMcpConfig } from "../../../agent/mcp/bundle-mcp-config.js";
|
|
3
3
|
import { listBundleMcpServerCapabilitiesForGateway, listBundleMcpServerToolsForGateway } from "../../../agent/mcp/bundle-mcp-materialize.js";
|
|
4
|
-
import { getWorkspacePath } from "../../../config/workspace-path-helpers.js";
|
|
5
4
|
import { isManagedConnectorServer } from "../../../connectors/materialize.js";
|
|
5
|
+
import { getWorkspacePath } from "../../../config/workspace-path-helpers.js";
|
|
6
6
|
//#region src/gateway/hono/routes/mcp.ts
|
|
7
7
|
function registerMcpRoutes(authenticated, deps) {
|
|
8
8
|
authenticated.get("/api/mcp/servers", (c) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { init_resolve_config_value, testApiKeyResolution } from "../../../config/resolve-config-value.js";
|
|
2
1
|
import { resolveModelsJsonPath } from "../../../config/paths.js";
|
|
2
|
+
import { init_resolve_config_value, testApiKeyResolution } from "../../../config/resolve-config-value.js";
|
|
3
3
|
import { init_models_json, loadModelsJson, saveModelsJson, validateModelsConfig } from "../../../config/models-json.js";
|
|
4
4
|
import { getModelCatalogStore, init_model_catalog_store } from "../../../providers/model-catalog-store.js";
|
|
5
5
|
import { getModelRegistry } from "../../../providers/model-registry.js";
|
|
@@ -7,7 +7,9 @@ import { CredentialResolver, init_credentials } from "../../../auth/credentials.
|
|
|
7
7
|
import "../../../providers/constants.js";
|
|
8
8
|
import { getProviderRegistry, init_plugin_registry } from "../../../providers/plugin-registry.js";
|
|
9
9
|
import { PROVIDER_META, getAllModels, getAllProviders, getAvailableModels, getProviderAuthState, init_providers, isProviderConfigured } from "../../../providers/index.js";
|
|
10
|
+
import { getImageGenerationProvider, reloadImageGenerationProviders } from "../../../agent/image/generation/provider-registry.js";
|
|
10
11
|
import { SessionConfigStore } from "../../../session/config-store.js";
|
|
12
|
+
import { deleteCustomImageProvider, listCustomImageProviders, upsertCustomImageProvider } from "../../custom-image-providers.js";
|
|
11
13
|
import { getDomesticProviderPreset, getDomesticProviderPresetIds } from "../../../providers/domestic-presets.js";
|
|
12
14
|
import { getOnboardingFeaturedProviders, getProviderHint, getRecommendedModelsForProvider, isRecommendedModel, sortModelsForPicker, sortProvidersForPicker } from "../../../providers/presentation.js";
|
|
13
15
|
import { getAgentImageGenerationConfig, getImageGenerationCatalog, prepareImageGenerationSetup, verifyImageGenerationCredential } from "../../image-generation-setup.js";
|
|
@@ -119,6 +121,7 @@ function registerModelsRoutes(authenticated, deps) {
|
|
|
119
121
|
}, 400);
|
|
120
122
|
const registry = getModelRegistry();
|
|
121
123
|
registry.refresh();
|
|
124
|
+
reloadImageGenerationProviders(config);
|
|
122
125
|
service.emit("models-json.updated", { modelCount: registry.getAll().length });
|
|
123
126
|
return c.json({
|
|
124
127
|
ok: true,
|
|
@@ -131,6 +134,7 @@ function registerModelsRoutes(authenticated, deps) {
|
|
|
131
134
|
authenticated.post("/api/models-json/reload", async (c) => {
|
|
132
135
|
const registry = getModelRegistry();
|
|
133
136
|
registry.refresh();
|
|
137
|
+
reloadImageGenerationProviders();
|
|
134
138
|
const error = registry.getError();
|
|
135
139
|
const models = registry.getAll();
|
|
136
140
|
service.emit("models-json.reloaded", {
|
|
@@ -239,6 +243,182 @@ function registerModelsRoutes(authenticated, deps) {
|
|
|
239
243
|
payload: { providers: getImageGenerationCatalog(service.currentConfig) }
|
|
240
244
|
});
|
|
241
245
|
});
|
|
246
|
+
authenticated.get("/api/image-generation/custom-providers", (c) => {
|
|
247
|
+
const loaded = loadModelsJson(resolveModelsJsonPath());
|
|
248
|
+
if (loaded.error) return c.json({
|
|
249
|
+
ok: false,
|
|
250
|
+
error: { message: loaded.error }
|
|
251
|
+
}, 409);
|
|
252
|
+
return c.json({
|
|
253
|
+
ok: true,
|
|
254
|
+
payload: { providers: listCustomImageProviders(loaded.config) }
|
|
255
|
+
});
|
|
256
|
+
});
|
|
257
|
+
authenticated.put("/api/image-generation/custom-providers/:providerId", strictRateLimitMiddleware, async (c) => {
|
|
258
|
+
const loaded = loadModelsJson(resolveModelsJsonPath());
|
|
259
|
+
if (loaded.error) return c.json({
|
|
260
|
+
ok: false,
|
|
261
|
+
error: { message: loaded.error }
|
|
262
|
+
}, 409);
|
|
263
|
+
try {
|
|
264
|
+
const body = await c.req.json();
|
|
265
|
+
const next = upsertCustomImageProvider(loaded.config, c.req.param("providerId"), body);
|
|
266
|
+
const saved = saveModelsJson(resolveModelsJsonPath(), next);
|
|
267
|
+
if (!saved.success) return c.json({
|
|
268
|
+
ok: false,
|
|
269
|
+
error: { message: saved.error }
|
|
270
|
+
}, 400);
|
|
271
|
+
getModelRegistry().refresh();
|
|
272
|
+
reloadImageGenerationProviders(next);
|
|
273
|
+
service.emit("models-json.updated", { modelCount: getModelRegistry().getAll().length });
|
|
274
|
+
return c.json({
|
|
275
|
+
ok: true,
|
|
276
|
+
payload: {
|
|
277
|
+
provider: listCustomImageProviders(next).find((entry) => entry.providerId === c.req.param("providerId")),
|
|
278
|
+
providers: getImageGenerationCatalog(service.currentConfig)
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
} catch (error) {
|
|
282
|
+
return c.json({
|
|
283
|
+
ok: false,
|
|
284
|
+
error: { message: error instanceof Error ? error.message : String(error) }
|
|
285
|
+
}, 400);
|
|
286
|
+
}
|
|
287
|
+
});
|
|
288
|
+
authenticated.delete("/api/image-generation/custom-providers/:providerId", strictRateLimitMiddleware, (c) => {
|
|
289
|
+
const loaded = loadModelsJson(resolveModelsJsonPath());
|
|
290
|
+
if (loaded.error) return c.json({
|
|
291
|
+
ok: false,
|
|
292
|
+
error: { message: loaded.error }
|
|
293
|
+
}, 409);
|
|
294
|
+
try {
|
|
295
|
+
const next = deleteCustomImageProvider(loaded.config, c.req.param("providerId"));
|
|
296
|
+
const saved = saveModelsJson(resolveModelsJsonPath(), next);
|
|
297
|
+
if (!saved.success) return c.json({
|
|
298
|
+
ok: false,
|
|
299
|
+
error: { message: saved.error }
|
|
300
|
+
}, 400);
|
|
301
|
+
getModelRegistry().refresh();
|
|
302
|
+
reloadImageGenerationProviders(next);
|
|
303
|
+
service.emit("models-json.updated", { modelCount: getModelRegistry().getAll().length });
|
|
304
|
+
return c.json({
|
|
305
|
+
ok: true,
|
|
306
|
+
payload: {
|
|
307
|
+
deleted: c.req.param("providerId"),
|
|
308
|
+
providers: getImageGenerationCatalog(service.currentConfig)
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
} catch (error) {
|
|
312
|
+
return c.json({
|
|
313
|
+
ok: false,
|
|
314
|
+
error: { message: error instanceof Error ? error.message : String(error) }
|
|
315
|
+
}, 400);
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
authenticated.put("/api/image-generation/providers/:providerId/credential", strictRateLimitMiddleware, async (c) => {
|
|
319
|
+
const providerId = c.req.param("providerId").trim();
|
|
320
|
+
const provider = getImageGenerationProvider(providerId);
|
|
321
|
+
if (!provider) return c.json({
|
|
322
|
+
ok: false,
|
|
323
|
+
error: { message: `Unknown image provider: ${providerId}` }
|
|
324
|
+
}, 404);
|
|
325
|
+
if (provider.credentialMode === "none") return c.json({
|
|
326
|
+
ok: false,
|
|
327
|
+
error: { message: "This provider does not use an API key" }
|
|
328
|
+
}, 400);
|
|
329
|
+
const body = await c.req.json().catch(() => null);
|
|
330
|
+
const apiKey = typeof body?.apiKey === "string" ? body.apiKey.trim() : "";
|
|
331
|
+
if (!apiKey) return c.json({
|
|
332
|
+
ok: false,
|
|
333
|
+
error: { message: "API key is required" }
|
|
334
|
+
}, 400);
|
|
335
|
+
await new CredentialResolver().saveApiKey(providerId, apiKey, { profileName: "default" });
|
|
336
|
+
return c.json({
|
|
337
|
+
ok: true,
|
|
338
|
+
payload: {
|
|
339
|
+
providerId,
|
|
340
|
+
saved: true
|
|
341
|
+
}
|
|
342
|
+
});
|
|
343
|
+
});
|
|
344
|
+
authenticated.post("/api/image-generation/providers/:providerId/reveal-api-key", strictRateLimitMiddleware, async (c) => {
|
|
345
|
+
const providerId = c.req.param("providerId").trim();
|
|
346
|
+
if (!getImageGenerationProvider(providerId)) return c.json({
|
|
347
|
+
ok: false,
|
|
348
|
+
error: { message: `Unknown image provider: ${providerId}` }
|
|
349
|
+
}, 404);
|
|
350
|
+
const apiKey = await new CredentialResolver().revealGatewayStoredApiKey(providerId);
|
|
351
|
+
return c.json({
|
|
352
|
+
ok: true,
|
|
353
|
+
payload: {
|
|
354
|
+
providerId,
|
|
355
|
+
apiKey: apiKey ?? null,
|
|
356
|
+
source: apiKey ? "credential" : "none"
|
|
357
|
+
}
|
|
358
|
+
});
|
|
359
|
+
});
|
|
360
|
+
authenticated.delete("/api/image-generation/providers/:providerId/credential", strictRateLimitMiddleware, async (c) => {
|
|
361
|
+
const providerId = c.req.param("providerId").trim();
|
|
362
|
+
if (!getImageGenerationProvider(providerId)) return c.json({
|
|
363
|
+
ok: false,
|
|
364
|
+
error: { message: `Unknown image provider: ${providerId}` }
|
|
365
|
+
}, 404);
|
|
366
|
+
await new CredentialResolver().deleteProviderCredential(providerId);
|
|
367
|
+
return c.json({
|
|
368
|
+
ok: true,
|
|
369
|
+
payload: {
|
|
370
|
+
providerId,
|
|
371
|
+
deleted: true
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
});
|
|
375
|
+
authenticated.post("/api/image-generation/providers/:providerId/test", strictRateLimitMiddleware, async (c) => {
|
|
376
|
+
const providerId = c.req.param("providerId").trim();
|
|
377
|
+
const provider = getImageGenerationProvider(providerId);
|
|
378
|
+
if (!provider) return c.json({
|
|
379
|
+
ok: false,
|
|
380
|
+
error: { message: `Unknown image provider: ${providerId}` }
|
|
381
|
+
}, 404);
|
|
382
|
+
if (!provider.isConfigured({ cfg: service.currentConfig })) return c.json({
|
|
383
|
+
ok: false,
|
|
384
|
+
error: { message: "Provider credential is not configured" }
|
|
385
|
+
}, 400);
|
|
386
|
+
const body = await c.req.json().catch(() => ({}));
|
|
387
|
+
const modelId = typeof body.modelId === "string" && body.modelId.trim() ? body.modelId.trim() : provider.defaultModel;
|
|
388
|
+
if (!provider.models.includes(modelId)) return c.json({
|
|
389
|
+
ok: false,
|
|
390
|
+
error: { message: `Unknown ${providerId} image model: ${modelId}` }
|
|
391
|
+
}, 400);
|
|
392
|
+
const prompt = typeof body.prompt === "string" && body.prompt.trim() ? body.prompt.trim() : "A simple blue circle centered on a white background.";
|
|
393
|
+
try {
|
|
394
|
+
const result = await provider.generateImage({
|
|
395
|
+
provider: providerId,
|
|
396
|
+
model: modelId,
|
|
397
|
+
prompt,
|
|
398
|
+
count: 1,
|
|
399
|
+
cfg: service.currentConfig,
|
|
400
|
+
timeoutMs: 12e4
|
|
401
|
+
});
|
|
402
|
+
return c.json({
|
|
403
|
+
ok: true,
|
|
404
|
+
payload: {
|
|
405
|
+
providerId,
|
|
406
|
+
modelId: result.model ?? modelId,
|
|
407
|
+
images: result.images.map((image) => ({
|
|
408
|
+
mimeType: image.mimeType,
|
|
409
|
+
fileName: image.fileName,
|
|
410
|
+
dataUrl: `data:${image.mimeType};base64,${image.buffer.toString("base64")}`,
|
|
411
|
+
...image.revisedPrompt ? { revisedPrompt: image.revisedPrompt } : {}
|
|
412
|
+
}))
|
|
413
|
+
}
|
|
414
|
+
});
|
|
415
|
+
} catch (error) {
|
|
416
|
+
return c.json({
|
|
417
|
+
ok: false,
|
|
418
|
+
error: { message: error instanceof Error ? error.message : String(error) }
|
|
419
|
+
}, 502);
|
|
420
|
+
}
|
|
421
|
+
});
|
|
242
422
|
authenticated.get("/api/agents/:agentId/image-generation", (c) => {
|
|
243
423
|
try {
|
|
244
424
|
return c.json({
|
|
@@ -271,7 +451,8 @@ function registerModelsRoutes(authenticated, deps) {
|
|
|
271
451
|
const resolver = new CredentialResolver();
|
|
272
452
|
const previousKey = await resolver.revealGatewayStoredApiKey(prepared.providerId);
|
|
273
453
|
const suppliedKey = typeof body.apiKey === "string" ? body.apiKey.trim() : "";
|
|
274
|
-
|
|
454
|
+
const effectiveKey = suppliedKey || await resolver.resolveApiKey(prepared.providerId);
|
|
455
|
+
if (getImageGenerationProvider(prepared.providerId).credentialMode !== "none" && !effectiveKey) return c.json({
|
|
275
456
|
ok: false,
|
|
276
457
|
error: { message: "API key is required" }
|
|
277
458
|
}, 400);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { PACKAGE_VERSION, init_package_version } from "../../../package-version.js";
|
|
2
2
|
import { loadConfig } from "../../../config/loader.js";
|
|
3
3
|
import "../../../config/index.js";
|
|
4
|
-
import { normalizeUpdateChannel } from "../../../infra/update-channels.js";
|
|
5
4
|
import { acquireUpdateLock } from "../../../infra/update-lock.js";
|
|
6
|
-
import {
|
|
5
|
+
import { normalizeUpdateChannel } from "../../../infra/update-channels.js";
|
|
7
6
|
import { getUpdateAvailable, runGatewayUpdateCheck } from "../../../infra/update-startup.js";
|
|
8
7
|
import { createGatewayRouteLogger } from "../lib/route-logger.js";
|
|
8
|
+
import { formatUpdateApiResult, runGatewayUpdateWithPostSteps } from "../../../infra/update-runner.js";
|
|
9
9
|
import { streamSSE } from "hono/streaming";
|
|
10
10
|
//#region src/gateway/hono/routes/update.ts
|
|
11
11
|
init_package_version();
|
|
@@ -64,7 +64,13 @@ function prepareImageGenerationSetup(config, agentIdRaw, input) {
|
|
|
64
64
|
}
|
|
65
65
|
};
|
|
66
66
|
const entry = next.agents.list[index];
|
|
67
|
-
entry.models
|
|
67
|
+
entry.models = {
|
|
68
|
+
...entry.models ?? {
|
|
69
|
+
defaultRole: resolveEffectiveAgentManifestForAgent(config, agentId).models.defaultRole,
|
|
70
|
+
roles: {}
|
|
71
|
+
},
|
|
72
|
+
imageGenerationModel: { primary: `${providerId}/${modelId}` }
|
|
73
|
+
};
|
|
68
74
|
const parsed = ConfigSchema.safeParse(next);
|
|
69
75
|
if (!parsed.success) return {
|
|
70
76
|
ok: false,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { buildDefaultCorsOrigins, isAllInterfacesHost, isLoopbackHost, resolveEffectiveGatewayPort, resolveGatewayServiceListenPort } from "./host.js";
|
|
2
2
|
import { defaultGatewayBindMode, isContainerEnvironment, resolveGatewayBindHost, resolveGatewayBindHostSync, resolveGatewayBindMode, resolveGatewayEffectiveHost } from "../config/gateway-bind.js";
|
|
3
|
-
import { checkPortAvailable, forceFreePortAndWait, listPortListeners, parseLsofOutput } from "./ports.js";
|
|
4
3
|
import { assertGatewayAuthConfigured, extractToken, resolveGatewayAuth, validateToken } from "./auth.js";
|
|
5
4
|
import { resolveGatewayListenHost, resolveGatewayListenPlan } from "./listen.js";
|
|
6
5
|
import { buckets } from "./rate-limit/buckets.js";
|
|
@@ -14,6 +13,7 @@ import { createHonoApp } from "./hono/app.js";
|
|
|
14
13
|
import { GatewayServer } from "./server.js";
|
|
15
14
|
import { GatewayLockError, acquireGatewayLock } from "./lock.js";
|
|
16
15
|
import { runGatewayLoop } from "./run-loop.js";
|
|
16
|
+
import { checkPortAvailable, forceFreePortAndWait, listPortListeners, parseLsofOutput } from "./ports.js";
|
|
17
17
|
import { apiError, apiOk } from "./protocol.js";
|
|
18
18
|
import "./hono/index.js";
|
|
19
19
|
import { assertSecureGatewayHttpUrl, assertSecureWebSocketUrl, isInsecurePrivateWsAllowed, isSecureWebSocketUrl } from "./ws-security.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { loadConfig } from "../config/loader.js";
|
|
2
2
|
import "../config/index.js";
|
|
3
3
|
import { isRestartEnabled } from "../config/commands.flags.js";
|
|
4
|
-
import { consumeGatewayRestartIntentSync, consumeGatewaySigusr1RestartAuthorization, isGatewaySigusr1RestartExternallyAllowed, resetGatewayRestartStateForInProcessRestart, scheduleGatewaySigusr1Restart, setGatewaySigusr1RestartPolicy } from "../infra/restart.js";
|
|
5
4
|
import { runBootstrapMigrationsSync } from "../migrations/runner.js";
|
|
6
5
|
import { restartGatewayProcessWithFreshPid } from "./respawn.js";
|
|
7
6
|
import { acquireGatewayLock } from "./lock.js";
|
|
7
|
+
import { consumeGatewayRestartIntentSync, consumeGatewaySigusr1RestartAuthorization, isGatewaySigusr1RestartExternallyAllowed, resetGatewayRestartStateForInProcessRestart, scheduleGatewaySigusr1Restart, setGatewaySigusr1RestartPolicy } from "../infra/restart.js";
|
|
8
8
|
//#region src/gateway/run-loop.ts
|
|
9
9
|
/**
|
|
10
10
|
* Gateway Run Loop - Core run loop for gateway process management
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
|
-
import { getModelRegistry } from "../../providers/model-registry.js";
|
|
4
3
|
import { loadConfig, saveConfig } from "../../config/loader.js";
|
|
4
|
+
import { getModelRegistry } from "../../providers/model-registry.js";
|
|
5
5
|
import { init_providers } from "../../providers/index.js";
|
|
6
|
+
import { reloadImageGenerationProviders } from "../../agent/image/generation/provider-registry.js";
|
|
6
7
|
import { disposeAllSessionMcpRuntimes } from "../../agent/mcp/bundle-mcp-runtime.js";
|
|
7
8
|
import "../../agent/mcp/bundle-mcp-tools.js";
|
|
8
9
|
import { ConfigHotReloader } from "../../config/reload.js";
|
|
@@ -214,6 +215,7 @@ var GatewayConfigCoordinator = class {
|
|
|
214
215
|
log.debug("Reloading models config...");
|
|
215
216
|
this.opts.setConfig(newConfig);
|
|
216
217
|
getModelRegistry().refresh();
|
|
218
|
+
reloadImageGenerationProviders();
|
|
217
219
|
this.opts.emit("config.reload", { section: "models" });
|
|
218
220
|
log.debug("Models config reloaded");
|
|
219
221
|
}
|
|
@@ -8,14 +8,14 @@ import { closeXopcDatabase, openXopcDatabase } from "../storage/sqlite/connectio
|
|
|
8
8
|
import "../storage/sqlite/index.js";
|
|
9
9
|
import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
|
|
10
10
|
import { init_agent_scope, listAgentEntries, normalizeAgentId, resolveDefaultAgentId } from "../agent/agent-scope.js";
|
|
11
|
+
import { buildSessionKey, init_session_key, sanitizeSegment } from "../routing/session-key.js";
|
|
12
|
+
import { getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
|
|
11
13
|
import { init_paths, resolveAgentDir, resolveConfigPath, resolveExtensionsDir } from "../config/paths.js";
|
|
12
|
-
import { prewarmModelRegistry } from "../providers/model-registry.js";
|
|
13
14
|
import { areExtensionsGloballyDisabled } from "../extensions/discover-extensions.js";
|
|
14
15
|
import { buildExtensionMetadataSnapshot } from "../extensions/extension-metadata-snapshot.js";
|
|
15
16
|
import { buildChannelCatalogForConfig, buildChannelCatalogFromSnapshot, init_channel_catalog_service } from "../channels/catalog/channel-catalog-service.js";
|
|
16
17
|
import { loadConfig, saveConfig } from "../config/loader.js";
|
|
17
|
-
import {
|
|
18
|
-
import { getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
|
|
18
|
+
import { prewarmModelRegistry } from "../providers/model-registry.js";
|
|
19
19
|
import { init_providers, providers_exports } from "../providers/index.js";
|
|
20
20
|
import { onAutomationProductEvent, publishAutomationProductEvent } from "../automations/product-events.js";
|
|
21
21
|
import { GoalRunner } from "../goals/goal-runner.js";
|
|
@@ -37,16 +37,15 @@ import { AgentService } from "../agent/service.js";
|
|
|
37
37
|
import { ensureStarterAgentsInitialized } from "../agent/starter-agents.js";
|
|
38
38
|
import { AutomationService } from "../automations/service/automation-service.js";
|
|
39
39
|
import "../automations/index.js";
|
|
40
|
-
import { getWorkspacePath } from "../config/workspace-path-helpers.js";
|
|
41
|
-
import "../config/index.js";
|
|
42
40
|
import { setPairingBroadcastSink } from "../channels/pairing/pairing-events.js";
|
|
43
41
|
import { registerClarifyBridge } from "./clarify-runtime.js";
|
|
44
42
|
import { ChannelManager } from "../channels/manager.js";
|
|
43
|
+
import { getWorkspacePath } from "../config/workspace-path-helpers.js";
|
|
44
|
+
import "../config/index.js";
|
|
45
45
|
import { startConnectedKnowledgeCoordinator } from "../knowledge/coordinator.js";
|
|
46
46
|
import "../knowledge/index.js";
|
|
47
47
|
import { startConnectorMemorySyncCoordinator } from "../connectors/memory-sync-coordinator.js";
|
|
48
48
|
import { startConnectorSupervisor } from "../connectors/supervisor.js";
|
|
49
|
-
import { scheduleGatewayUpdateCheck } from "../infra/update-startup.js";
|
|
50
49
|
import { assertGatewayAuthConfigured, extractToken, resolveGatewayAuth, validateToken } from "./auth.js";
|
|
51
50
|
import { reconcileDreamingAutomations } from "./dreaming-automation-reconciler.js";
|
|
52
51
|
import { FocusService } from "../proactive/focus-service.js";
|
|
@@ -82,6 +81,7 @@ import { LocalAppService } from "../local-apps/service.js";
|
|
|
82
81
|
import "../local-apps/index.js";
|
|
83
82
|
import { createRuntimeBrowserRecipeService } from "../browser/recipes/runtime-service.js";
|
|
84
83
|
import "../browser/recipes/index.js";
|
|
84
|
+
import { scheduleGatewayUpdateCheck } from "../infra/update-startup.js";
|
|
85
85
|
import { resolveChannelConnectDeferSet } from "./resolve-channel-connect-defer.js";
|
|
86
86
|
import { restartGatewayProcessWithFreshPid } from "./respawn.js";
|
|
87
87
|
import { GatewaySessionsApi } from "./service/sessions-api.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createLogger } from "../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
3
|
import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
|
|
4
|
-
import { resolveGoalUiLocale } from "../agent/goals/goal-locale.js";
|
|
5
4
|
import { GoalService } from "./goal-service.js";
|
|
6
5
|
import { renderWorkflowText } from "../agent/workflow/snapshot.js";
|
|
6
|
+
import { resolveGoalUiLocale } from "../agent/goals/goal-locale.js";
|
|
7
7
|
import { evaluateAfterTurnHermesLike } from "../agent/goals/evaluate-turn.js";
|
|
8
8
|
import { runViewToSnapshot } from "../workflows/service/run-view-to-snapshot.js";
|
|
9
9
|
//#region src/goals/goal-workflow-judge.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DEFAULT_ACK_MAX_CHARS, HEARTBEAT_OK, NO_REPLY, shouldSilence, stripHeartbeatToken } from "./tokens.js";
|
|
2
|
+
import { appendCronEventLines } from "./event-prompt.js";
|
|
2
3
|
import { isWithinActiveHours } from "./active-hours.js";
|
|
3
4
|
import { isHeartbeatContentEmpty } from "./content-check.js";
|
|
4
|
-
import { appendCronEventLines } from "./event-prompt.js";
|
|
5
5
|
import { createHeartbeatWake } from "./wake.js";
|
|
6
6
|
export { DEFAULT_ACK_MAX_CHARS, HEARTBEAT_OK, NO_REPLY, appendCronEventLines, createHeartbeatWake, isHeartbeatContentEmpty, isWithinActiveHours, shouldSilence, stripHeartbeatToken };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isGatewayArgv, parseProcCmdline } from "./gateway-process-argv.js";
|
|
2
1
|
import { listPortListeners } from "../gateway/ports.js";
|
|
2
|
+
import { isGatewayArgv, parseProcCmdline } from "./gateway-process-argv.js";
|
|
3
3
|
import fs from "node:fs";
|
|
4
4
|
import { spawnSync } from "node:child_process";
|
|
5
5
|
//#region src/infra/gateway-processes.ts
|
|
@@ -4,8 +4,8 @@ import { init_paths, resolveConfigPath } from "../config/paths.js";
|
|
|
4
4
|
import { init_loader, loadConfig } from "../config/loader.js";
|
|
5
5
|
import { isRestartEnabled } from "../config/commands.flags.js";
|
|
6
6
|
import { resolveGatewayService } from "../daemon/service.js";
|
|
7
|
-
import { findVerifiedGatewayListenerPidsOnPortSync, signalVerifiedGatewayPidSync } from "./gateway-processes.js";
|
|
8
7
|
import { authorizeGatewaySigusr1Restart, writeGatewayRestartIntentSync } from "./restart.js";
|
|
8
|
+
import { findVerifiedGatewayListenerPidsOnPortSync, signalVerifiedGatewayPidSync } from "./gateway-processes.js";
|
|
9
9
|
import { refreshGatewayServiceAfterUpdate } from "./update-service-refresh.js";
|
|
10
10
|
//#region src/infra/update-restart.ts
|
|
11
11
|
init_loader();
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { runPostUpdateExtensionSync } from "../extensions/update.js";
|
|
2
|
+
import "./update-channels.js";
|
|
3
|
+
import { compareSemver, resolveNpmChannelTag } from "./update-check.js";
|
|
2
4
|
import { readPackageName, readPackageVersion } from "./package-json.js";
|
|
3
5
|
import { createDefaultCommandRunner, runCommandWithTimeout } from "./run-command.js";
|
|
4
6
|
import { XOPC_PACKAGE_NAME, cleanupGlobalRenameDirs, createGlobalInstallEnv, detectGlobalInstallManagerForRoot, resolveGlobalInstallSpec, resolveGlobalInstallTarget } from "./update-global.js";
|
|
5
7
|
import { runGlobalPackageUpdateSteps } from "./package-update-steps.js";
|
|
6
8
|
import { resolveStableNodePath } from "./stable-node-path.js";
|
|
7
|
-
import "./update-channels.js";
|
|
8
|
-
import { compareSemver, resolveNpmChannelTag } from "./update-check.js";
|
|
9
9
|
import { trimLogTail } from "./update-log.js";
|
|
10
10
|
import { maybeRestartGatewayAfterUpdate } from "./update-restart.js";
|
|
11
11
|
import path from "node:path";
|
|
@@ -3,9 +3,9 @@ import { init_paths_state, resolveUpdateCheckStatePath } from "../config/paths-s
|
|
|
3
3
|
import { createLogger } from "../utils/logger/index.js";
|
|
4
4
|
import { init_logger } from "../utils/logger.js";
|
|
5
5
|
import { init_write_file_atomic, writeTextAtomic } from "./write-file-atomic.js";
|
|
6
|
+
import { acquireUpdateLock } from "./update-lock.js";
|
|
6
7
|
import { normalizeUpdateChannel } from "./update-channels.js";
|
|
7
8
|
import { compareSemver, detectInstallKind, resolveNpmChannelTag, resolvePackageRoot } from "./update-check.js";
|
|
8
|
-
import { acquireUpdateLock } from "./update-lock.js";
|
|
9
9
|
import { createHash, randomUUID } from "node:crypto";
|
|
10
10
|
import { readFile } from "node:fs/promises";
|
|
11
11
|
//#region src/infra/update-startup.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createLogger } from "../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
3
|
import { init_loader, loadConfig } from "../config/loader.js";
|
|
4
|
-
import { loadUndiciRuntimeDeps } from "../infra/undici-fetch.js";
|
|
5
4
|
import { gatewayCredentialAuthorization } from "../gateway/credential.js";
|
|
5
|
+
import { loadUndiciRuntimeDeps } from "../infra/undici-fetch.js";
|
|
6
6
|
import { toConversation } from "./channel-shared.js";
|
|
7
7
|
import { createGatewayHttpClientFromConfig, resolveGatewayHttpBaseUrl } from "./gateway-http-client.js";
|
|
8
8
|
//#region src/mcp/channel-bridge.ts
|
|
@@ -7,5 +7,5 @@ export { TimeoutAbortError, isTimeoutAbortError, pickEffectiveTimeoutMs, pickTim
|
|
|
7
7
|
export { BlockedPrivateNetworkError, assertNotPrivateNetwork, classifyHost, defaultPolicy as defaultPrivateNetworkPolicy, privateNetworkPolicyToSsrfGuardOptions, type HostClass, type PrivateNetworkPolicy, } from './private-network.js';
|
|
8
8
|
export { resolveProviderHttpRequestConfig, type ResolvedProviderHttpDefaults, type ResolveProviderHttpRequestConfigOptions, } from './resolve-provider-http-request-config.js';
|
|
9
9
|
export { ProviderHttpError, assertOk, assertOkOrThrowHttpError, assertOkOrThrowProviderError, createProviderHttpError, extractProviderErrorDetail, extractProviderRequestId, extractVendorErrorFields, formatProviderErrorPayload, formatProviderHttpErrorMessage, readResponseTextLimited, truncateErrorDetail, type ProviderHttpErrorParts, } from './provider-http-errors.js';
|
|
10
|
-
export { createProviderOperationDeadline, fetchWithTimeoutGuarded, getJsonRequest, normalizeBaseUrl, postJsonRequest, postMultipartRequest, waitProviderOperationPollInterval, type FetchWithGuardOptions, type GetJsonRequestOptions, type PostJsonRequestOptions, type PostMultipartRequestOptions, type ProviderHttpRequestConfig, type ProviderOperationDeadline, } from './provider-http.js';
|
|
10
|
+
export { createProviderOperationDeadline, fetchWithTimeoutGuarded, getJsonRequest, normalizeBaseUrl, postJsonRequest, postMultipartRequest, readJsonResponseLimited, waitProviderOperationPollInterval, type FetchWithGuardOptions, type GetJsonRequestOptions, type PostJsonRequestOptions, type PostMultipartRequestOptions, type ProviderHttpRequestConfig, type ProviderOperationDeadline, } from './provider-http.js';
|
|
11
11
|
export { SsrfBlockedError, assertSafeUrl, isPrivateIpAddress, isPrivateIpv4, isPrivateIpv6, type ResolvedSsrfTarget, type SsrfGuardOptions, } from './ssrf-guard.js';
|