@xopcai/xopc 0.0.190 → 0.0.191
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/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-9vAbkroX.js → agent-avatar-dicebear-DvEkT222.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-D1t4SfMQ.js → agents-CXyivfqY.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-DkFeIdBf.js → app-management-settings-panel-COpP_pKN.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-Bxs8Fpaj.js → appearance-settings-DTVNUEDq.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-Cgrgu5OW.js → apps-page-DsE67BSO.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-Ch2RmLCC.js → archive-plugin-IpX6VA0o.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-BhMQM_Ky.js → attachment-load-CKVFNUi1.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-CtJxstKh.js → automations-page-D0TVev47.js} +1 -1
- package/dist/gateway/static/root/assets/{binary-plugins-D6CqlymH.js → binary-plugins-BrfvfOS4.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-ClL6HEg9.js → block-editor-D9sEfg32.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-DW99iDmD.js → browser-settings-page-DpZzq8j2.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-BYy48VhN.js → browser-workflow-inputs-BixZ5lCR.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-zgLibuMH.js → browser-workflows-page-YEFuodJI.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-CHUrT9EB.js → capabilities-settings-panel-B9Cmcuff.js} +2 -2
- package/dist/gateway/static/root/assets/{capability-presets-settings-panel-Cycrv0YV.js → capability-presets-settings-panel-C_EpuQtk.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-settings-V96gPUAU.js → channels-settings-CvzD5qSv.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-api-DS9ED-EL.js → connectors-api-BMMqC0_9.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-BhlyQoQI.js → connectors-page-BKrm7tJ9.js} +1 -1
- package/dist/gateway/static/root/assets/{cron-expression-CkgsvhtW.js → cron-expression-Bm8koRoD.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-Cv8rGhYW.js → desktop-pet-CMG3mcaJ.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-CIeJdwfV.js → desktop-pet-settings-D8aaPb0x.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-D8jXEiAY.js → directory-picker-path-field-C95yW03b.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-CCZ9u6TZ.js → extension-debug-page-DsG7Z9lV.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-CV36ILRG.js → extension-page-CUAXEbAt.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-IyQrSILY.js → extension-settings-page-CsR7QOJo.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-D4_r5iJM.js → gateway-config-api-DL70Nakc.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-CYlntpBH.js → gateway-settings-BgDxQ08c.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-D4SyWob8.js → heartbeat-settings-BX7q55uZ.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-B2Kagoh8.js → home-page-C08Nen5T.js} +1 -1
- package/dist/gateway/static/root/assets/{index-CYT5DOzr.js → index-B-_CEvIX.js} +7 -7
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BMhCuVBZ.js → keyboard-shortcuts-settings-Dt6wS5zW.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-BHYbFjqy.js → local-app-workbench-page-BQVC0tWq.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-ijIe7_y2.js → local-apps-page-DcD3-N00.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-IIn8Tess.js → logs-page-D6yvW-E4.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings--V_fovKD.js → management-settings-B6EVkJQy.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-Dt9-in6W.js → markdown-split-CHUjCnBh.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-B3pj_iO0.js → media-plugins-DRrtI2O0.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-DZ366lIT.js → notes-page-fermYvpI.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-workbench-S2sBVOLw.js → notes-workbench-BVCwabjq.js} +2 -2
- package/dist/gateway/static/root/assets/{page-tabs-C5ge434C.js → page-tabs-BO262zuu.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-BFa9DgSV.js → preview-open-alternatives-yZYTy-2e.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-Dc9CcWdu.js → product-open-page-Dgy8XWhR.js} +1 -1
- package/dist/gateway/static/root/assets/{project-detail-page-BilzoCJ7.js → project-detail-page-CS4Ujor7.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-BoQUyacP.js → projects-page-DMtPC8c4.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-DUyUaCRF.js → remote-access-hub-BpfHZT88.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-B84DckWe.js → schema-form-DdE4gtw_.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-Dzxlq1F0.js → sessions-page-BZkyrJBM.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-DQlK0A4l.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-Dp9itvdy.js → settings-form-section-CiYU8AvV.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-CCtlhoy7.js → settings-loading-skeleton-Bv03cWib.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-DQmMKf8r.js → settings-page-C-LdINFj.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-EQIOJa_L.js → settings-page-layout-t_Ox1slk.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-Cwi-SPja.js → setup-status-panel-HRG_lK4_.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-C4_B2jvf.js → share-preview-page-DF8gW6bo.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-CkyuGlZK.js → shares-settings-v_iLhxxa.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-BJCePQK5.js → skill-reload-api-S-bjtsXX.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-BYWLfmJi.js → skills-page-BiNBfaX5.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-Jhm24i4h.js → skills-page.utils-DlnGtvAH.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-Dpx2ags2.js → system-settings-panel-Bv7GXFc6.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-DLAdxI6e.js → task-detail-page-BhQcOpnx.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-DULmTHUB.js → typed-models-lib-4XBsLEuv.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-BrjVk5VH.js → use-autosave-BN2QgFGn.js} +1 -1
- package/dist/gateway/static/root/assets/{user-context-page-9AAFpGAL.js → user-context-page-PtcY7BoJ.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-BISTPfq_.js → voice-api-key-field-DnhJtC5l.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-Wr-uF7VA.js → work-discovery-overlay-nmEAafFl.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-page-BWds95sL.js → work-discovery-page-C5Kwe_bc.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DHqHP8_6.js → workflow-run-setup-panel-BnNWBDwz.js} +1 -1
- package/dist/gateway/static/root/assets/{workflows-page-0b4_DFHr.js → workflows-page-Z_qzaohv.js} +1 -1
- package/dist/gateway/static/root/index.html +1 -1
- package/dist/package.js +1 -1
- package/dist/src/agent/image/generation/openai-images-provider.d.ts +1 -1
- package/dist/src/agent/image/generation/openai-images-provider.js +1 -1
- package/dist/src/agent/image/generation/provider-registry.d.ts +2 -0
- package/dist/src/agent/image/generation/provider-registry.js +20 -10
- package/dist/src/agent/image/generation/providers/xopc-cloud.d.ts +2 -0
- package/dist/src/agent/image/generation/providers/xopc-cloud.js +74 -0
- package/dist/src/agent/image/generation/types.d.ts +2 -2
- package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
- package/dist/src/cli/commands/onboard/model.d.ts +3 -0
- package/dist/src/cli/commands/onboard/model.js +19 -4
- package/dist/src/cli/commands/update.js +1 -1
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/hono/routes/local-apps.js +1 -1
- package/dist/src/gateway/hono/routes/models.js +9 -8
- package/dist/src/gateway/hono/routes/update.js +2 -2
- package/dist/src/gateway/index.js +1 -1
- package/dist/src/gateway/run-loop.js +1 -1
- package/dist/src/gateway/service.js +5 -5
- 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/providers/model-catalog-store.d.ts +15 -0
- package/dist/src/providers/model-catalog-store.js +14 -1
- package/dist/src/providers/model-catalog-sync-service.js +6 -0
- package/dist/src/providers/model-registry.js +4 -4
- package/dist/src/providers/register-runtime-providers.js +4 -4
- package/dist/src/providers/xopc-cloud-model-source.js +55 -8
- package/dist/src/tui/backends/gateway-realtime-backend.js +1 -1
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/settings-advanced-gate-TzwlZxU6.js +0 -1
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png?v=20260713-1" />
|
|
12
12
|
<link rel="manifest" href="/site.webmanifest?v=20260713-1" />
|
|
13
13
|
<title>XOPC — Turn goals into loops. Keep what matters moving.</title>
|
|
14
|
-
<script type="module" crossorigin src="/assets/index-
|
|
14
|
+
<script type="module" crossorigin src="/assets/index-B-_CEvIX.js"></script>
|
|
15
15
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-aKtaBQYM.js">
|
|
16
16
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-zJ_50EbN.js">
|
|
17
17
|
<link rel="modulepreload" crossorigin href="/assets/vendor-react-BOUWij0V.js">
|
package/dist/package.js
CHANGED
|
@@ -43,7 +43,7 @@ export interface OpenAiImagesProviderOptions {
|
|
|
43
43
|
/** Sync env / cfg lookup that decides if the provider has any usable credential. */
|
|
44
44
|
isConfigured: (ctx: ImageGenerationProviderConfiguredContext) => boolean;
|
|
45
45
|
/** Resolve API key for one request. May return null when using OAuth/header auth. */
|
|
46
|
-
resolveApiKey: (req: ImageGenerationRequest) => string | null | undefined
|
|
46
|
+
resolveApiKey: (req: ImageGenerationRequest) => string | null | undefined | Promise<string | null | undefined>;
|
|
47
47
|
/** Resolve endpoint info per-request (region, baseUrl override, Azure deployment, …). */
|
|
48
48
|
resolveEndpoint: (req: ImageGenerationRequest) => OpenAiImagesEndpointResolution;
|
|
49
49
|
/** Default per-call timeout. Combined with provider-level config in provider-http. */
|
|
@@ -26,7 +26,7 @@ function createOpenAiImagesProvider(options) {
|
|
|
26
26
|
capabilities: options.capabilities,
|
|
27
27
|
isConfigured: options.isConfigured,
|
|
28
28
|
async generateImage(req) {
|
|
29
|
-
const apiKey = options.resolveApiKey(req) ?? null;
|
|
29
|
+
const apiKey = await options.resolveApiKey(req) ?? null;
|
|
30
30
|
const endpoint = options.resolveEndpoint(req);
|
|
31
31
|
const httpDefaults = resolveProviderHttpRequestConfig({
|
|
32
32
|
providerId: options.id,
|
|
@@ -2,6 +2,8 @@ import type { ModelsJsonConfig } from '../../../config/models-json.js';
|
|
|
2
2
|
import type { ImageGenerationProvider, ImageGenerationProviderSummary } from './types.js';
|
|
3
3
|
export declare function reloadImageGenerationProviders(config?: ModelsJsonConfig): void;
|
|
4
4
|
export declare function getImageGenerationProvider(providerId: string): ImageGenerationProvider | undefined;
|
|
5
|
+
/** Resolve the auth mode consistently for provider objects and catalog summaries. */
|
|
6
|
+
export declare function resolveImageGenerationCredentialMode(provider: Pick<ImageGenerationProvider, 'credentialMode'>): NonNullable<ImageGenerationProvider['credentialMode']>;
|
|
5
7
|
export declare function listImageGenerationProviders(): ImageGenerationProvider[];
|
|
6
8
|
export declare function listImageGenerationProvidersSummary(): ImageGenerationProviderSummary[];
|
|
7
9
|
export type { ImageGenerationProvider, ImageGenerationProviderSummary } from './types.js';
|
|
@@ -7,24 +7,30 @@ import { buildFalImageGenerationProvider } from "./providers/fal.js";
|
|
|
7
7
|
import { buildGoogleImageGenerationProvider } from "./providers/google.js";
|
|
8
8
|
import { buildMinimaxImageGenerationProvider } from "./providers/minimax.js";
|
|
9
9
|
import { buildOpenAIImageGenerationProvider } from "./providers/openai.js";
|
|
10
|
+
import { buildXopcCloudImageGenerationProvider } from "./providers/xopc-cloud.js";
|
|
10
11
|
//#region src/agent/image/generation/provider-registry.ts
|
|
11
12
|
init_models_json();
|
|
12
13
|
init_logger();
|
|
13
14
|
const log = createLogger("ImageGenerationRegistry");
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
function buildBuiltInProviders() {
|
|
16
|
+
const cloud = buildXopcCloudImageGenerationProvider();
|
|
17
|
+
return [
|
|
18
|
+
...cloud ? [cloud] : [],
|
|
19
|
+
buildOpenAIImageGenerationProvider(),
|
|
20
|
+
buildDashScopeImageGenerationProvider(),
|
|
21
|
+
buildMinimaxImageGenerationProvider(),
|
|
22
|
+
buildGoogleImageGenerationProvider(),
|
|
23
|
+
buildFalImageGenerationProvider()
|
|
24
|
+
];
|
|
25
|
+
}
|
|
26
|
+
let providers = buildBuiltInProviders();
|
|
22
27
|
let providersById = new Map(providers.map((provider) => [provider.id, provider]));
|
|
23
28
|
let customProvidersLoaded = false;
|
|
24
29
|
function ensureCustomProvidersLoaded() {
|
|
25
30
|
if (!customProvidersLoaded) reloadImageGenerationProviders();
|
|
26
31
|
}
|
|
27
32
|
function reloadImageGenerationProviders(config) {
|
|
33
|
+
const builtInProviders = buildBuiltInProviders();
|
|
28
34
|
let resolved = config;
|
|
29
35
|
if (!resolved) {
|
|
30
36
|
const loaded = loadModelsJson();
|
|
@@ -54,6 +60,10 @@ function getImageGenerationProvider(providerId) {
|
|
|
54
60
|
ensureCustomProvidersLoaded();
|
|
55
61
|
return providersById.get(providerId);
|
|
56
62
|
}
|
|
63
|
+
/** Resolve the auth mode consistently for provider objects and catalog summaries. */
|
|
64
|
+
function resolveImageGenerationCredentialMode(provider) {
|
|
65
|
+
return provider.credentialMode ?? "api-key";
|
|
66
|
+
}
|
|
57
67
|
function listImageGenerationProviders() {
|
|
58
68
|
ensureCustomProvidersLoaded();
|
|
59
69
|
return [...providers];
|
|
@@ -64,7 +74,7 @@ function listImageGenerationProvidersSummary() {
|
|
|
64
74
|
id: provider.id,
|
|
65
75
|
label: provider.label,
|
|
66
76
|
source: provider.source ?? "builtin",
|
|
67
|
-
credentialMode: provider
|
|
77
|
+
credentialMode: resolveImageGenerationCredentialMode(provider),
|
|
68
78
|
...provider.documentationUrl ? { documentationUrl: provider.documentationUrl } : {},
|
|
69
79
|
...provider.apiKeyUrl ? { apiKeyUrl: provider.apiKeyUrl } : {},
|
|
70
80
|
defaultModel: provider.defaultModel,
|
|
@@ -74,4 +84,4 @@ function listImageGenerationProvidersSummary() {
|
|
|
74
84
|
}));
|
|
75
85
|
}
|
|
76
86
|
//#endregion
|
|
77
|
-
export { getImageGenerationProvider, listImageGenerationProviders, listImageGenerationProvidersSummary, reloadImageGenerationProviders };
|
|
87
|
+
export { getImageGenerationProvider, listImageGenerationProviders, listImageGenerationProvidersSummary, reloadImageGenerationProviders, resolveImageGenerationCredentialMode };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { getModelCatalogStore, init_model_catalog_store } from "../../../../providers/model-catalog-store.js";
|
|
2
|
+
import { init_xopc_cloud_config, resolveXopcModelRouterUrl } from "../../../../providers/xopc-cloud-config.js";
|
|
3
|
+
import { getProviderAuthService, init_provider_auth_service } from "../../../../providers/provider-auth-service.js";
|
|
4
|
+
import { createOpenAiImagesProvider } from "../openai-images-provider.js";
|
|
5
|
+
//#region src/agent/image/generation/providers/xopc-cloud.ts
|
|
6
|
+
init_model_catalog_store();
|
|
7
|
+
init_provider_auth_service();
|
|
8
|
+
init_xopc_cloud_config();
|
|
9
|
+
function buildXopcCloudImageGenerationProvider() {
|
|
10
|
+
const source = getModelCatalogStore().getSource("xopc-cloud");
|
|
11
|
+
const models = source?.models.filter((model) => model.availability === "available" && model.kind === "image" && model.operations.includes("images.generate")) ?? [];
|
|
12
|
+
if (models.length === 0) return void 0;
|
|
13
|
+
const modelCapabilities = Object.fromEntries(models.map((model) => [model.id, toProviderCapabilities(model)]));
|
|
14
|
+
const defaultModel = models[0].id;
|
|
15
|
+
const baseUrl = source?.baseUrl ?? resolveXopcModelRouterUrl();
|
|
16
|
+
const executors = new Map(models.map((model) => [model.id, createOpenAiImagesProvider({
|
|
17
|
+
id: "xopc-cloud",
|
|
18
|
+
label: "XOPC Model Service",
|
|
19
|
+
defaultModel: model.id,
|
|
20
|
+
models: [model.id],
|
|
21
|
+
capabilities: modelCapabilities[model.id],
|
|
22
|
+
isConfigured: () => true,
|
|
23
|
+
resolveApiKey: (request) => getProviderAuthService().resolveApiKey("xopc-cloud", request.signal),
|
|
24
|
+
resolveEndpoint: () => ({ baseUrl }),
|
|
25
|
+
...model.imageGeneration?.sizes[0] ? { defaultSize: model.imageGeneration.sizes[0] } : {}
|
|
26
|
+
})]));
|
|
27
|
+
return {
|
|
28
|
+
id: "xopc-cloud",
|
|
29
|
+
label: "XOPC Model Service",
|
|
30
|
+
credentialMode: "oauth",
|
|
31
|
+
defaultModel,
|
|
32
|
+
models: models.map((model) => model.id),
|
|
33
|
+
capabilities: modelCapabilities[defaultModel],
|
|
34
|
+
modelCapabilities,
|
|
35
|
+
isConfigured: () => true,
|
|
36
|
+
async generateImage(request) {
|
|
37
|
+
const executor = executors.get(request.model);
|
|
38
|
+
if (!executor) throw new Error(`Image model is not available from XOPC Model Service: ${request.model}`);
|
|
39
|
+
const geometry = modelCapabilities[request.model]?.geometry;
|
|
40
|
+
const size = request.size ?? (request.aspectRatio && geometry?.aspectRatios?.includes(request.aspectRatio) ? request.aspectRatio : void 0) ?? (request.resolution && geometry?.resolutions?.includes(request.resolution) ? request.resolution : void 0);
|
|
41
|
+
return executor.generateImage({
|
|
42
|
+
...request,
|
|
43
|
+
...size ? { size } : {}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function toProviderCapabilities(model) {
|
|
49
|
+
const image = model.imageGeneration;
|
|
50
|
+
return {
|
|
51
|
+
generate: {
|
|
52
|
+
maxCount: image?.maxCount ?? 1,
|
|
53
|
+
supportsSize: Boolean(image?.sizes.length),
|
|
54
|
+
supportsAspectRatio: Boolean(image?.aspectRatios?.length)
|
|
55
|
+
},
|
|
56
|
+
edit: {
|
|
57
|
+
enabled: model.operations.includes("images.edit"),
|
|
58
|
+
maxInputImages: image?.maxInputImages ?? 0,
|
|
59
|
+
supportsSize: Boolean(image?.sizes.length),
|
|
60
|
+
supportsAspectRatio: Boolean(image?.aspectRatios?.length)
|
|
61
|
+
},
|
|
62
|
+
geometry: {
|
|
63
|
+
sizes: image?.sizes ?? [],
|
|
64
|
+
aspectRatios: image?.aspectRatios ?? []
|
|
65
|
+
},
|
|
66
|
+
output: {
|
|
67
|
+
qualities: image?.qualities ?? [],
|
|
68
|
+
formats: image?.formats ?? [],
|
|
69
|
+
backgrounds: image?.backgrounds ?? []
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
//#endregion
|
|
74
|
+
export { buildXopcCloudImageGenerationProvider };
|
|
@@ -52,7 +52,7 @@ export interface ImageGenerationProvider {
|
|
|
52
52
|
id: string;
|
|
53
53
|
label: string;
|
|
54
54
|
source?: 'builtin' | 'custom';
|
|
55
|
-
credentialMode?: 'api-key' | 'none';
|
|
55
|
+
credentialMode?: 'api-key' | 'oauth' | 'none';
|
|
56
56
|
documentationUrl?: string;
|
|
57
57
|
apiKeyUrl?: string;
|
|
58
58
|
defaultModel: string;
|
|
@@ -67,7 +67,7 @@ export interface ImageGenerationProviderSummary {
|
|
|
67
67
|
id: string;
|
|
68
68
|
label: string;
|
|
69
69
|
source: 'builtin' | 'custom';
|
|
70
|
-
credentialMode: 'api-key' | 'none';
|
|
70
|
+
credentialMode: 'api-key' | 'oauth' | 'none';
|
|
71
71
|
documentationUrl?: string;
|
|
72
72
|
apiKeyUrl?: string;
|
|
73
73
|
defaultModel: string;
|
|
@@ -3,8 +3,8 @@ import { loadConfig } from "../../../config/loader.js";
|
|
|
3
3
|
import "../../../config/index.js";
|
|
4
4
|
import { isRestartEnabled } from "../../../config/commands.flags.js";
|
|
5
5
|
import { resolveGatewayService } from "../../../daemon/service.js";
|
|
6
|
-
import { authorizeGatewaySigusr1Restart, writeGatewayRestartIntentSync } from "../../../infra/restart.js";
|
|
7
6
|
import { findVerifiedGatewayListenerPidsOnPortSync, formatGatewayPidList, signalVerifiedGatewayPidSync } from "../../../infra/gateway-processes.js";
|
|
7
|
+
import { authorizeGatewaySigusr1Restart, writeGatewayRestartIntentSync } from "../../../infra/restart.js";
|
|
8
8
|
import { runServiceRestart, runServiceStop } from "./lifecycle-core.js";
|
|
9
9
|
import { DEFAULT_RESTART_HEALTH_ATTEMPTS, renderGatewayPortHealthDiagnostics, waitForGatewayHealthyListener } from "./restart-health.js";
|
|
10
10
|
import { parsePortFromArgs, renderGatewayServiceStartHints, resolveGatewayPortFromConfig } from "./shared.js";
|
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
* Catalog-driven model configuration for onboarding.
|
|
3
3
|
*/
|
|
4
4
|
import type { Config } from '../../../config/schema.js';
|
|
5
|
+
import { type ModelCatalogStore } from '../../../providers/model-catalog-store.js';
|
|
5
6
|
import { XopcCloudModelSource } from '../../../providers/xopc-cloud-model-source.js';
|
|
6
7
|
import type { CLIContext } from '../../registry.js';
|
|
8
|
+
export declare function defaultXopcCloudImageModel(catalogStore?: ModelCatalogStore): string | undefined;
|
|
9
|
+
export declare function setPrimaryModel(config: Config, workspacePath: string, modelRef: string, defaultImageGenerationModel?: string): Config;
|
|
7
10
|
export declare function refreshOnboardModelCatalogIfNeeded(provider: string, hasCatalogModels: boolean, source?: Pick<XopcCloudModelSource, 'refresh'>): Promise<void>;
|
|
8
11
|
export declare function setupModel(existingConfig: Config | null, ctx: CLIContext): Promise<Config>;
|
|
@@ -2,6 +2,7 @@ import { getAgentDefaultModelRef, init_schema } from "../../../config/schema.js"
|
|
|
2
2
|
import { resolveModelsJsonPath } from "../../../config/paths.js";
|
|
3
3
|
import { init_models_json, loadModelsJson, saveModelsJson } from "../../../config/models-json.js";
|
|
4
4
|
import { getApiKeyFromEnv } from "../../../providers/env-keys.js";
|
|
5
|
+
import { getModelCatalogStore, init_model_catalog_store } from "../../../providers/model-catalog-store.js";
|
|
5
6
|
import { getModelRegistry } from "../../../providers/model-registry.js";
|
|
6
7
|
import { CredentialResolver, init_credentials } from "../../../auth/credentials.js";
|
|
7
8
|
import { getAllProviders, getModelsByProvider, getProviderDisplayName, init_providers, providerSupportsApiKey, providerSupportsOAuth } from "../../../providers/index.js";
|
|
@@ -23,7 +24,12 @@ init_credentials();
|
|
|
23
24
|
init_models_json();
|
|
24
25
|
init_schema();
|
|
25
26
|
init_providers();
|
|
26
|
-
|
|
27
|
+
init_model_catalog_store();
|
|
28
|
+
function defaultXopcCloudImageModel(catalogStore = getModelCatalogStore()) {
|
|
29
|
+
const model = catalogStore.getSource("xopc-cloud")?.models.find((entry) => entry.availability === "available" && entry.kind === "image" && entry.operations.includes("images.generate"));
|
|
30
|
+
return model ? `xopc-cloud/${model.id}` : void 0;
|
|
31
|
+
}
|
|
32
|
+
function setPrimaryModel(config, workspacePath, modelRef, defaultImageGenerationModel) {
|
|
27
33
|
const id = config.agents.default ?? config.agents.list[0]?.id ?? "main";
|
|
28
34
|
const index = config.agents.list.findIndex((entry) => entry.id === id);
|
|
29
35
|
let nextConfig = config;
|
|
@@ -42,9 +48,16 @@ function setPrimaryModel(config, workspacePath, modelRef) {
|
|
|
42
48
|
}
|
|
43
49
|
};
|
|
44
50
|
}
|
|
51
|
+
const presetId = nextConfig.agents.defaultPreset ?? "default";
|
|
52
|
+
const currentModels = nextConfig.agents.capabilityPresets[presetId]?.models;
|
|
45
53
|
const prep = prepareUpdateGlobalDefaults(nextConfig, { models: {
|
|
54
|
+
...currentModels,
|
|
46
55
|
defaultRole: "deep",
|
|
47
|
-
roles: {
|
|
56
|
+
roles: {
|
|
57
|
+
...currentModels?.roles,
|
|
58
|
+
deep: { model: modelRef }
|
|
59
|
+
},
|
|
60
|
+
...!currentModels?.imageGenerationModel && defaultImageGenerationModel ? { imageGenerationModel: { primary: defaultImageGenerationModel } } : {}
|
|
48
61
|
} });
|
|
49
62
|
if (prep.ok === false) throw new Error(prep.error);
|
|
50
63
|
return prep.data.nextConfig;
|
|
@@ -469,7 +482,9 @@ async function setupModel(existingConfig, ctx) {
|
|
|
469
482
|
}))
|
|
470
483
|
});
|
|
471
484
|
console.log("\n✅ Model configured:", model);
|
|
472
|
-
|
|
485
|
+
const imageModel = provider === "xopc-cloud" ? defaultXopcCloudImageModel() : void 0;
|
|
486
|
+
if (imageModel) console.log("✅ Image generation configured:", imageModel);
|
|
487
|
+
return setPrimaryModel(config, ctx.workspacePath, model, imageModel);
|
|
473
488
|
}
|
|
474
489
|
//#endregion
|
|
475
|
-
export { refreshOnboardModelCatalogIfNeeded, setupModel };
|
|
490
|
+
export { defaultXopcCloudImageModel, refreshOnboardModelCatalogIfNeeded, setPrimaryModel, setupModel };
|
|
@@ -2,9 +2,9 @@ import { PACKAGE_VERSION, init_package_version } from "../../package-version.js"
|
|
|
2
2
|
import { loadConfig } from "../../config/loader.js";
|
|
3
3
|
import { formatExamples, register } from "../registry.js";
|
|
4
4
|
import "../../config/index.js";
|
|
5
|
-
import { acquireUpdateLock } from "../../infra/update-lock.js";
|
|
6
5
|
import { normalizeUpdateChannel } from "../../infra/update-channels.js";
|
|
7
6
|
import { compareSemver, resolveNpmChannelTag } from "../../infra/update-check.js";
|
|
7
|
+
import { acquireUpdateLock } from "../../infra/update-lock.js";
|
|
8
8
|
import { formatUpdateApiResult, resolveUpdateInstallSurface, runGatewayUpdateWithPostSteps } from "../../infra/update-runner.js";
|
|
9
9
|
import { Command } from "commander";
|
|
10
10
|
//#region src/cli/commands/update.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { init_agent_scope, normalizeAgentId, resolveAgentWorkspaceDir } from "../agent/agent-scope.js";
|
|
1
2
|
import { resolveEffectiveAgentManifest } from "../agent-manifest/resolver.js";
|
|
2
3
|
import "../agent-manifest/index.js";
|
|
3
|
-
import { init_agent_scope, normalizeAgentId, resolveAgentWorkspaceDir } from "../agent/agent-scope.js";
|
|
4
4
|
import { init_session_key, parseSessionKey } from "../routing/session-key.js";
|
|
5
5
|
import { agentExists, getDefaultAgentId, init_resolve_route } from "../routing/resolve-route.js";
|
|
6
6
|
//#region src/config/agent-profile.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { resolveCapabilityPresetLayer, 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 { resolveCapabilityPresetLayer, resolveEffectiveAgentManifest } from "../agent-manifest/resolver.js";
|
|
3
3
|
import { resolveEffectiveAgentProfile } from "../config/agent-profile.js";
|
|
4
4
|
import { WORKSPACE_FILES, init_paths } from "../config/paths.js";
|
|
5
5
|
import { AGENT_PROFILE_MARKDOWN_SYSTEM_FILES, REQUIRED_AGENT_PROFILE_MARKDOWN_FILE_SET } from "../agent/context/workspace.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readLocalAppAcceptanceConfig } from "../../../local-apps/acceptance.js";
|
|
2
|
-
import { extensionAssetMimeType } from "../lib/extension-assets.js";
|
|
3
2
|
import { LOCAL_APP_RUNTIME_BRIDGE_HASH, injectLocalAppRuntimeBridge } from "../../../local-apps/preview-runtime-bridge.js";
|
|
3
|
+
import { extensionAssetMimeType } from "../lib/extension-assets.js";
|
|
4
4
|
import { relative, resolve } from "node:path";
|
|
5
5
|
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
6
6
|
//#region src/gateway/hono/routes/local-apps.ts
|
|
@@ -7,7 +7,7 @@ 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
|
+
import { getImageGenerationProvider, reloadImageGenerationProviders, resolveImageGenerationCredentialMode } from "../../../agent/image/generation/provider-registry.js";
|
|
11
11
|
import { SessionConfigStore } from "../../../session/config-store.js";
|
|
12
12
|
import { deleteCustomImageProvider, listCustomImageProviders, upsertCustomImageProvider } from "../../custom-image-providers.js";
|
|
13
13
|
import { getDomesticProviderPreset, getDomesticProviderPresetIds } from "../../../providers/domestic-presets.js";
|
|
@@ -346,7 +346,7 @@ function registerModelsRoutes(authenticated, deps) {
|
|
|
346
346
|
ok: false,
|
|
347
347
|
error: { message: `Unknown image provider: ${providerId}` }
|
|
348
348
|
}, 404);
|
|
349
|
-
if (provider
|
|
349
|
+
if (resolveImageGenerationCredentialMode(provider) !== "api-key") return c.json({
|
|
350
350
|
ok: false,
|
|
351
351
|
error: { message: "This provider does not use an API key" }
|
|
352
352
|
}, 400);
|
|
@@ -473,14 +473,15 @@ function registerModelsRoutes(authenticated, deps) {
|
|
|
473
473
|
error: { message: prepared.error }
|
|
474
474
|
}, 400);
|
|
475
475
|
const resolver = new CredentialResolver();
|
|
476
|
-
const
|
|
476
|
+
const usesApiKey = resolveImageGenerationCredentialMode(getImageGenerationProvider(prepared.providerId)) === "api-key";
|
|
477
|
+
const previousKey = usesApiKey ? await resolver.revealGatewayStoredApiKey(prepared.providerId) : void 0;
|
|
477
478
|
const suppliedKey = typeof body.apiKey === "string" ? body.apiKey.trim() : "";
|
|
478
|
-
const effectiveKey = suppliedKey || await resolver.resolveApiKey(prepared.providerId);
|
|
479
|
-
if (
|
|
479
|
+
const effectiveKey = usesApiKey ? suppliedKey || await resolver.resolveApiKey(prepared.providerId) : void 0;
|
|
480
|
+
if (usesApiKey && !effectiveKey) return c.json({
|
|
480
481
|
ok: false,
|
|
481
482
|
error: { message: "API key is required" }
|
|
482
483
|
}, 400);
|
|
483
|
-
const verification = suppliedKey ? await verifyImageGenerationCredential({
|
|
484
|
+
const verification = usesApiKey && suppliedKey ? await verifyImageGenerationCredential({
|
|
484
485
|
providerId: prepared.providerId,
|
|
485
486
|
apiKey: suppliedKey,
|
|
486
487
|
baseUrl: typeof body.baseUrl === "string" ? body.baseUrl : void 0
|
|
@@ -492,10 +493,10 @@ function registerModelsRoutes(authenticated, deps) {
|
|
|
492
493
|
ok: false,
|
|
493
494
|
error: { message: verification.message ?? "Credential verification failed" }
|
|
494
495
|
}, 400);
|
|
495
|
-
if (suppliedKey) await resolver.saveApiKey(prepared.providerId, suppliedKey, { profileName: "default" });
|
|
496
|
+
if (usesApiKey && suppliedKey) await resolver.saveApiKey(prepared.providerId, suppliedKey, { profileName: "default" });
|
|
496
497
|
const saved = await service.saveConfig(prepared.config);
|
|
497
498
|
if (!saved.saved) {
|
|
498
|
-
if (suppliedKey) if (previousKey) await resolver.saveApiKey(prepared.providerId, previousKey, { profileName: "default" });
|
|
499
|
+
if (usesApiKey && suppliedKey) if (previousKey) await resolver.saveApiKey(prepared.providerId, previousKey, { profileName: "default" });
|
|
499
500
|
else await resolver.deleteProfile(`${prepared.providerId}:default`);
|
|
500
501
|
return c.json({
|
|
501
502
|
ok: false,
|
|
@@ -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 { acquireUpdateLock } from "../../../infra/update-lock.js";
|
|
5
4
|
import { normalizeUpdateChannel } from "../../../infra/update-channels.js";
|
|
5
|
+
import { acquireUpdateLock } from "../../../infra/update-lock.js";
|
|
6
|
+
import { formatUpdateApiResult, runGatewayUpdateWithPostSteps } from "../../../infra/update-runner.js";
|
|
6
7
|
import { getUpdateAvailable, runGatewayUpdateCheck } from "../../../infra/update-startup.js";
|
|
7
8
|
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();
|
|
@@ -3,6 +3,7 @@ import { defaultGatewayBindMode, isContainerEnvironment, resolveGatewayBindHost,
|
|
|
3
3
|
import { buckets } from "./rate-limit/buckets.js";
|
|
4
4
|
import { isGatewayStrictSecurityEnabled } from "./rate-limit/env-flags.js";
|
|
5
5
|
import "./rate-limit/index.js";
|
|
6
|
+
import { checkPortAvailable, forceFreePortAndWait, listPortListeners, parseLsofOutput } from "./ports.js";
|
|
6
7
|
import { assertGatewayAuthConfigured, extractToken, resolveGatewayAuth, validateToken } from "./auth.js";
|
|
7
8
|
import { resolveGatewayListenHost, resolveGatewayListenPlan } from "./listen.js";
|
|
8
9
|
import { assertGatewayRuntimeConfig } from "./runtime-config.js";
|
|
@@ -12,7 +13,6 @@ import { createHonoApp } from "./hono/app.js";
|
|
|
12
13
|
import { GatewayServer } from "./server.js";
|
|
13
14
|
import { GatewayLockError, acquireGatewayLock } from "./lock.js";
|
|
14
15
|
import { runGatewayLoop } from "./run-loop.js";
|
|
15
|
-
import { checkPortAvailable, forceFreePortAndWait, listPortListeners, parseLsofOutput } from "./ports.js";
|
|
16
16
|
import { apiError, apiOk } from "./protocol.js";
|
|
17
17
|
import "./hono/index.js";
|
|
18
18
|
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";
|
|
4
5
|
import { runBootstrapMigrationsSync } from "../migrations/runner.js";
|
|
5
6
|
import { restartGatewayProcessWithFreshPid } from "./respawn.js";
|
|
6
7
|
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
|
|
@@ -66,6 +66,11 @@ import { DiscussionSealer } from "../discussions/sealer.js";
|
|
|
66
66
|
import "../discussions/index.js";
|
|
67
67
|
import { EndpointToolRuntime } from "../endpoint-tools/runtime.js";
|
|
68
68
|
import "../endpoint-tools/index.js";
|
|
69
|
+
import { scheduleGatewayUpdateCheck } from "../infra/update-startup.js";
|
|
70
|
+
import { LocalAppService } from "../local-apps/service.js";
|
|
71
|
+
import "../local-apps/index.js";
|
|
72
|
+
import { runBootstrapMigrationsSync } from "../migrations/runner.js";
|
|
73
|
+
import { MobileNotificationService } from "../mobile/notification-service.js";
|
|
69
74
|
import { assertGatewayAuthConfigured, extractToken, resolveGatewayAuth, validateToken } from "./auth.js";
|
|
70
75
|
import { reconcileDreamingAutomations } from "./dreaming-automation-reconciler.js";
|
|
71
76
|
import { NotesStore } from "../notes/store.js";
|
|
@@ -83,10 +88,6 @@ import { assertGatewayAuthNotKnownWeak } from "./security/known-weak-secrets.js"
|
|
|
83
88
|
import { assertGatewayRuntimeConfig } from "./runtime-config.js";
|
|
84
89
|
import { auditGatewayConfig } from "./security/audit.js";
|
|
85
90
|
import { ModelCatalogSyncService } from "../providers/model-catalog-sync-service.js";
|
|
86
|
-
import { runBootstrapMigrationsSync } from "../migrations/runner.js";
|
|
87
|
-
import { MobileNotificationService } from "../mobile/notification-service.js";
|
|
88
|
-
import { LocalAppService } from "../local-apps/service.js";
|
|
89
|
-
import "../local-apps/index.js";
|
|
90
91
|
import { createRuntimeBrowserRecipeService } from "../browser/recipes/runtime-service.js";
|
|
91
92
|
import "../browser/recipes/index.js";
|
|
92
93
|
import { mapProductEventToProactive } from "../proactive/events/product-event-bridge.js";
|
|
@@ -98,7 +99,6 @@ import { ProactiveTemporalWorker } from "../proactive/temporal/worker.js";
|
|
|
98
99
|
import { ProactiveInboxService } from "../proactive/inbox/service.js";
|
|
99
100
|
import { ProactiveInboxWorker } from "../proactive/inbox/worker.js";
|
|
100
101
|
import "../proactive/index.js";
|
|
101
|
-
import { scheduleGatewayUpdateCheck } from "../infra/update-startup.js";
|
|
102
102
|
import { resolveChannelConnectDeferSet } from "./resolve-channel-connect-defer.js";
|
|
103
103
|
import { restartGatewayProcessWithFreshPid } from "./respawn.js";
|
|
104
104
|
import { GatewaySessionsApi } from "./service/sessions-api.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { listPortListeners } from "../gateway/ports.js";
|
|
2
1
|
import { isGatewayArgv, parseProcCmdline } from "./gateway-process-argv.js";
|
|
2
|
+
import { listPortListeners } from "../gateway/ports.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 { authorizeGatewaySigusr1Restart, writeGatewayRestartIntentSync } from "./restart.js";
|
|
8
7
|
import { findVerifiedGatewayListenerPidsOnPortSync, signalVerifiedGatewayPidSync } from "./gateway-processes.js";
|
|
8
|
+
import { authorizeGatewaySigusr1Restart, writeGatewayRestartIntentSync } from "./restart.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";
|
|
4
2
|
import { readPackageName, readPackageVersion } from "./package-json.js";
|
|
5
3
|
import { createDefaultCommandRunner, runCommandWithTimeout } from "./run-command.js";
|
|
6
4
|
import { XOPC_PACKAGE_NAME, cleanupGlobalRenameDirs, createGlobalInstallEnv, detectGlobalInstallManagerForRoot, resolveGlobalInstallSpec, resolveGlobalInstallTarget } from "./update-global.js";
|
|
7
5
|
import { runGlobalPackageUpdateSteps } from "./package-update-steps.js";
|
|
8
6
|
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";
|
|
7
6
|
import { normalizeUpdateChannel } from "./update-channels.js";
|
|
8
7
|
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
|
|
@@ -2,7 +2,22 @@ export interface CatalogModel {
|
|
|
2
2
|
id: string;
|
|
3
3
|
name: string;
|
|
4
4
|
availability: 'available' | 'unavailable';
|
|
5
|
+
kind: 'language' | 'image';
|
|
6
|
+
input: Array<'text' | 'image'>;
|
|
7
|
+
output: Array<'text' | 'image'>;
|
|
8
|
+
operations: Array<'chat.completions' | 'responses' | 'images.generate' | 'images.edit'>;
|
|
9
|
+
reasoning: boolean;
|
|
10
|
+
contextWindow: number;
|
|
5
11
|
maxOutputTokens: number | null;
|
|
12
|
+
imageGeneration?: {
|
|
13
|
+
maxCount: number;
|
|
14
|
+
sizes: string[];
|
|
15
|
+
aspectRatios?: string[];
|
|
16
|
+
qualities: Array<'low' | 'medium' | 'high' | 'auto'>;
|
|
17
|
+
formats: Array<'png' | 'jpeg' | 'webp'>;
|
|
18
|
+
backgrounds: Array<'transparent' | 'opaque' | 'auto'>;
|
|
19
|
+
maxInputImages: number;
|
|
20
|
+
};
|
|
6
21
|
}
|
|
7
22
|
export interface CatalogSource {
|
|
8
23
|
providerId: string;
|
|
@@ -53,7 +53,20 @@ var init_model_catalog_store = __esmMin((() => {
|
|
|
53
53
|
cloneSource(source) {
|
|
54
54
|
return {
|
|
55
55
|
...source,
|
|
56
|
-
models: source.models.map((model) => ({
|
|
56
|
+
models: source.models.map((model) => ({
|
|
57
|
+
...model,
|
|
58
|
+
input: [...model.input],
|
|
59
|
+
output: [...model.output],
|
|
60
|
+
operations: [...model.operations],
|
|
61
|
+
...model.imageGeneration ? { imageGeneration: {
|
|
62
|
+
...model.imageGeneration,
|
|
63
|
+
sizes: [...model.imageGeneration.sizes],
|
|
64
|
+
aspectRatios: [...model.imageGeneration.aspectRatios ?? []],
|
|
65
|
+
qualities: [...model.imageGeneration.qualities],
|
|
66
|
+
formats: [...model.imageGeneration.formats],
|
|
67
|
+
backgrounds: [...model.imageGeneration.backgrounds]
|
|
68
|
+
} } : {}
|
|
69
|
+
}))
|
|
57
70
|
};
|
|
58
71
|
}
|
|
59
72
|
};
|
|
@@ -110,6 +110,12 @@ var ModelCatalogSyncService = class {
|
|
|
110
110
|
}, models.map((model) => ({
|
|
111
111
|
id: model.id,
|
|
112
112
|
name: model.name ?? model.id,
|
|
113
|
+
kind: "language",
|
|
114
|
+
input: ["text"],
|
|
115
|
+
output: ["text"],
|
|
116
|
+
operations: provider.api === "openai-responses" ? ["responses"] : ["chat.completions"],
|
|
117
|
+
reasoning: false,
|
|
118
|
+
contextWindow: 128e3,
|
|
113
119
|
maxOutputTokens: null
|
|
114
120
|
})));
|
|
115
121
|
return providerId;
|
|
@@ -236,21 +236,21 @@ var init_model_registry = __esmMin((() => {
|
|
|
236
236
|
log.warn({ err }, "Failed to load remote model catalog");
|
|
237
237
|
return [];
|
|
238
238
|
}
|
|
239
|
-
return Object.values(sources).flatMap((source) => source.models.filter((model) => model.availability === "available").map((model) => ({
|
|
239
|
+
return Object.values(sources).flatMap((source) => source.models.filter((model) => model.availability === "available" && model.kind === "language").map((model) => ({
|
|
240
240
|
id: model.id,
|
|
241
241
|
name: model.name,
|
|
242
242
|
api: source.api,
|
|
243
243
|
provider: source.providerId,
|
|
244
244
|
baseUrl: source.baseUrl,
|
|
245
|
-
reasoning:
|
|
246
|
-
input:
|
|
245
|
+
reasoning: model.reasoning,
|
|
246
|
+
input: model.input,
|
|
247
247
|
cost: {
|
|
248
248
|
input: 0,
|
|
249
249
|
output: 0,
|
|
250
250
|
cacheRead: 0,
|
|
251
251
|
cacheWrite: 0
|
|
252
252
|
},
|
|
253
|
-
contextWindow:
|
|
253
|
+
contextWindow: model.contextWindow,
|
|
254
254
|
maxTokens: model.maxOutputTokens ?? 16384
|
|
255
255
|
})));
|
|
256
256
|
}
|
|
@@ -16,18 +16,18 @@ function registerRuntimeProvider(modelRuntime, source) {
|
|
|
16
16
|
baseUrl: source.baseUrl,
|
|
17
17
|
api: source.api,
|
|
18
18
|
oauth,
|
|
19
|
-
models: source.models.filter((model) => model.availability === "available").map((model) => ({
|
|
19
|
+
models: source.models.filter((model) => model.availability === "available" && model.kind === "language").map((model) => ({
|
|
20
20
|
id: model.id,
|
|
21
21
|
name: model.name,
|
|
22
|
-
reasoning:
|
|
23
|
-
input:
|
|
22
|
+
reasoning: model.reasoning,
|
|
23
|
+
input: model.input,
|
|
24
24
|
cost: {
|
|
25
25
|
input: 0,
|
|
26
26
|
output: 0,
|
|
27
27
|
cacheRead: 0,
|
|
28
28
|
cacheWrite: 0
|
|
29
29
|
},
|
|
30
|
-
contextWindow:
|
|
30
|
+
contextWindow: model.contextWindow,
|
|
31
31
|
maxTokens: model.maxOutputTokens ?? 16384
|
|
32
32
|
}))
|
|
33
33
|
});
|