dsh-provider-qoder 0.3.2 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -2
- package/README_CN.md +1 -1
- package/lib/client.js +4 -13
- package/lib/index.d.ts +0 -2
- package/lib/index.js +15 -40
- package/package.json +32 -33
package/README.md
CHANGED
|
@@ -25,8 +25,7 @@ This project is a community adapter plugin and is not affiliated with Qoder or D
|
|
|
25
25
|
|
|
26
26
|
You will need a running DSH Web environment, an active Qoder subscription, and a PAT matching the selected service region. The DSH profile running the plugin must provide a managed credentials service; when configuring via the settings page, the credential storage must also be writable.
|
|
27
27
|
|
|
28
|
-
This package
|
|
29
|
-
|
|
28
|
+
This package supports DSH `>=0.1.7-rc.2 <0.2.0-0 || >=0.2.0-rc.1 <0.3.0-0`, Cordis `>=4.0.4 <5`, and React `^18.2.0`.
|
|
30
29
|
### Install from npm
|
|
31
30
|
|
|
32
31
|
Run in your terminal:
|
package/README_CN.md
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
|
|
28
28
|
你需要可运行的 DSH Web 环境、可用的 Qoder 订阅,以及与所选服务区域匹配的 PAT。运行插件的 DSH profile 必须提供托管凭据服务;通过设置页面配置时,凭据存储还需可写。
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
本包支持 DSH `>=0.1.7-rc.2 <0.2.0-0 || >=0.2.0-rc.1 <0.3.0-0`、Cordis `>=4.0.4 <5` 和 React `^18.2.0`。
|
|
31
31
|
|
|
32
32
|
### 从 npm 安装
|
|
33
33
|
|
package/lib/client.js
CHANGED
|
@@ -781,7 +781,7 @@ window.__ModuleLoader__.load({
|
|
|
781
781
|
const region = selectedRegion ?? (section.region === "china" ? "china" : "global");
|
|
782
782
|
const scoped = section.modelsByRegion?.[region];
|
|
783
783
|
if (Array.isArray(scoped)) return scoped;
|
|
784
|
-
return
|
|
784
|
+
return defaultModels.map((model) => ({ ...model }));
|
|
785
785
|
}
|
|
786
786
|
function regionOf(value) {
|
|
787
787
|
if (typeof value !== "object" || value === null) return "global";
|
|
@@ -1166,24 +1166,15 @@ window.__ModuleLoader__.load({
|
|
|
1166
1166
|
"slots",
|
|
1167
1167
|
"locale",
|
|
1168
1168
|
"remote",
|
|
1169
|
-
"remote.credentials"
|
|
1169
|
+
"remote.credentials",
|
|
1170
|
+
"configForms"
|
|
1170
1171
|
];
|
|
1171
1172
|
const fill = (text, values) => {
|
|
1172
1173
|
if (!values) return text;
|
|
1173
1174
|
return Object.entries(values).reduce((next, [key, value]) => next.replace(new RegExp(`\\{${key}\\}`, "g"), String(value)), text);
|
|
1174
1175
|
};
|
|
1175
1176
|
function apply(ctx) {
|
|
1176
|
-
|
|
1177
|
-
if (configForms) {
|
|
1178
|
-
mount(ctx, configForms.get(settingsNamespace));
|
|
1179
|
-
return;
|
|
1180
|
-
}
|
|
1181
|
-
const settingsScope = ctx.get?.("settingsScope");
|
|
1182
|
-
if (settingsScope) {
|
|
1183
|
-
mount(ctx, settingsScope.bind({ namespace: settingsNamespace }));
|
|
1184
|
-
return;
|
|
1185
|
-
}
|
|
1186
|
-
console.warn("[provider-qoder] Neither configForms nor settingsScope available; settings panel will not mount");
|
|
1177
|
+
mount(ctx, ctx.configForms.get(settingsNamespace));
|
|
1187
1178
|
}
|
|
1188
1179
|
function mount(ctx, modelScope) {
|
|
1189
1180
|
ctx.effect(() => ctx.locale.register(localeNamespace, {
|
package/lib/index.d.ts
CHANGED
|
@@ -43,8 +43,6 @@ type QoderWebSearchMode = 'auto' | 'always' | 'disabled';
|
|
|
43
43
|
interface Config {
|
|
44
44
|
region?: QoderRegion;
|
|
45
45
|
modelsByRegion?: QoderModelsByRegion;
|
|
46
|
-
/** @deprecated Migrated to modelsByRegion for the selected region. */
|
|
47
|
-
models?: QoderCatalogModel[];
|
|
48
46
|
streamIdleTimeoutMs?: number;
|
|
49
47
|
responseHeaderTimeoutMs?: number;
|
|
50
48
|
preserveThinking?: boolean;
|
package/lib/index.js
CHANGED
|
@@ -830,8 +830,7 @@ async function resolveImagePart(block, context) {
|
|
|
830
830
|
const target = {
|
|
831
831
|
width: Math.max(1, Math.floor(width * scale)),
|
|
832
832
|
height: Math.max(1, Math.floor(height * scale)),
|
|
833
|
-
maxBytes: limits.maxImageBytes
|
|
834
|
-
maxPixels: limits.maxImagePixels
|
|
833
|
+
maxBytes: limits.maxImageBytes
|
|
835
834
|
};
|
|
836
835
|
image = await attachments.readImageRequest(block.attachment, target, signal);
|
|
837
836
|
} catch (error) {
|
|
@@ -3000,7 +2999,7 @@ function createQoderTransport(options) {
|
|
|
3000
2999
|
}
|
|
3001
3000
|
//#endregion
|
|
3002
3001
|
//#region src/dsh/config.ts
|
|
3003
|
-
/** DSH configuration schema and region-scoped model catalog
|
|
3002
|
+
/** DSH configuration schema and region-scoped model catalog selection. */
|
|
3004
3003
|
const catalogModel = z.object({
|
|
3005
3004
|
id: z.string().required(),
|
|
3006
3005
|
name: z.string().required(),
|
|
@@ -3028,7 +3027,6 @@ const modelsByRegionSchema = z.dict(z.array(catalogModel));
|
|
|
3028
3027
|
const Config = z.object({
|
|
3029
3028
|
region: z.union(["global", "china"]).default("global"),
|
|
3030
3029
|
modelsByRegion: modelsByRegionSchema.default({}),
|
|
3031
|
-
models: z.array(catalogModel),
|
|
3032
3030
|
streamIdleTimeoutMs: z.number().step(1).min(1).default(defaultStreamIdleTimeoutMs),
|
|
3033
3031
|
responseHeaderTimeoutMs: z.number().step(1).min(1).default(defaultResponseHeaderTimeoutMs),
|
|
3034
3032
|
preserveThinking: z.boolean().default(true),
|
|
@@ -3053,11 +3051,8 @@ function resolveModels(models) {
|
|
|
3053
3051
|
return { ...model };
|
|
3054
3052
|
});
|
|
3055
3053
|
}
|
|
3056
|
-
function modelsFor(config, region
|
|
3057
|
-
|
|
3058
|
-
if (scoped !== void 0) return resolveModels(scoped);
|
|
3059
|
-
if (legacyModelsRegion === region && config.models !== void 0 && config.models.length > 0) return resolveModels(config.models);
|
|
3060
|
-
return resolveModels(defaultModels);
|
|
3054
|
+
function modelsFor(config, region) {
|
|
3055
|
+
return resolveModels(config.modelsByRegion?.[region]);
|
|
3061
3056
|
}
|
|
3062
3057
|
//#endregion
|
|
3063
3058
|
//#region src/dsh/provider.ts
|
|
@@ -3245,14 +3240,6 @@ async function resolveManagedQoderPat(credentials) {
|
|
|
3245
3240
|
//#endregion
|
|
3246
3241
|
//#region src/dsh/settings.ts
|
|
3247
3242
|
function bindQoderSettings(owner, ctx, input, options) {
|
|
3248
|
-
const settings = ctx.settings;
|
|
3249
|
-
if (typeof settings.register === "function") {
|
|
3250
|
-
const namespace = "provider-qoder";
|
|
3251
|
-
return {
|
|
3252
|
-
namespace,
|
|
3253
|
-
scope: settings.register(namespace, Config, options)
|
|
3254
|
-
};
|
|
3255
|
-
}
|
|
3256
3243
|
const namespace = owner.fiber.entry?.options.id ?? "provider-qoder";
|
|
3257
3244
|
const get = () => readConfig(input);
|
|
3258
3245
|
options.validate?.(get());
|
|
@@ -3265,10 +3252,9 @@ function bindQoderSettings(owner, ctx, input, options) {
|
|
|
3265
3252
|
namespace,
|
|
3266
3253
|
scope: {
|
|
3267
3254
|
get,
|
|
3268
|
-
update: (patch) => settings.update(namespace, patch),
|
|
3255
|
+
update: (patch) => ctx.settings.update(namespace, patch),
|
|
3269
3256
|
watch: (listener) => {
|
|
3270
|
-
|
|
3271
|
-
return ctx.effect(() => on("loader/volatile-update", () => {
|
|
3257
|
+
return ctx.effect(() => owner.on("loader/volatile-update", () => {
|
|
3272
3258
|
Promise.resolve().then(listener).catch((error) => ctx.emit("internal/error", error));
|
|
3273
3259
|
}));
|
|
3274
3260
|
}
|
|
@@ -3313,7 +3299,7 @@ function registerQoderRpc(ctx, handler) {
|
|
|
3313
3299
|
fetch: (request) => handleQoderRpcRequest(endpoint, handler, request)
|
|
3314
3300
|
}));
|
|
3315
3301
|
return () => {
|
|
3316
|
-
for (const dispose of disposers)
|
|
3302
|
+
for (const dispose of disposers) dispose();
|
|
3317
3303
|
};
|
|
3318
3304
|
}
|
|
3319
3305
|
/**
|
|
@@ -3386,19 +3372,15 @@ function publicError(code, message, details = { issues: [] }) {
|
|
|
3386
3372
|
function apply(ctx, input = {}) {
|
|
3387
3373
|
const config = readConfig(input);
|
|
3388
3374
|
const logger = ctx.logger;
|
|
3389
|
-
const initialRegion = config.region ?? "global";
|
|
3390
|
-
const hasConfiguredModels = config.models !== void 0 && config.models.length > 0;
|
|
3391
3375
|
const baseConfig = {
|
|
3392
|
-
region:
|
|
3376
|
+
region: config.region ?? "global",
|
|
3393
3377
|
modelsByRegion: { ...config.modelsByRegion },
|
|
3394
|
-
...hasConfiguredModels ? { models: resolveModels(config.models) } : {},
|
|
3395
3378
|
streamIdleTimeoutMs: config.streamIdleTimeoutMs ?? 3e5,
|
|
3396
3379
|
responseHeaderTimeoutMs: config.responseHeaderTimeoutMs ?? 6e4,
|
|
3397
3380
|
preserveThinking: config.preserveThinking ?? true,
|
|
3398
3381
|
webSearchMode: config.webSearchMode ?? "auto"
|
|
3399
3382
|
};
|
|
3400
3383
|
let current = () => baseConfig;
|
|
3401
|
-
let legacyModelsRegion = initialRegion;
|
|
3402
3384
|
let persistDiscoveredModels = async (_region) => {};
|
|
3403
3385
|
const discoveredCatalogs = {
|
|
3404
3386
|
global: [],
|
|
@@ -3418,7 +3400,7 @@ function apply(ctx, input = {}) {
|
|
|
3418
3400
|
const region = value.region ?? "global";
|
|
3419
3401
|
return {
|
|
3420
3402
|
region,
|
|
3421
|
-
models: mergeQoderDiscoveryMetadata(modelsFor(value, region
|
|
3403
|
+
models: mergeQoderDiscoveryMetadata(modelsFor(value, region), discoveredCatalogs[region]),
|
|
3422
3404
|
streamIdleTimeoutMs: value.streamIdleTimeoutMs ?? 3e5,
|
|
3423
3405
|
responseHeaderTimeoutMs: value.responseHeaderTimeoutMs ?? 6e4,
|
|
3424
3406
|
preserveThinking: value.preserveThinking ?? true,
|
|
@@ -3464,15 +3446,11 @@ function apply(ctx, input = {}) {
|
|
|
3464
3446
|
registration.replace([providerQoder]);
|
|
3465
3447
|
};
|
|
3466
3448
|
ctx.inject(["settings"], (settingsCtx) => {
|
|
3467
|
-
const { scope, namespace } = bindQoderSettings(ctx, settingsCtx, input, {
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
modelsFor(value, "china", legacyModelsRegion);
|
|
3473
|
-
}
|
|
3474
|
-
});
|
|
3475
|
-
legacyModelsRegion = scope.get().region ?? initialRegion;
|
|
3449
|
+
const { scope, namespace } = bindQoderSettings(ctx, settingsCtx, input, { validate: (value) => {
|
|
3450
|
+
for (const region of Object.keys(value.modelsByRegion ?? {})) if (region !== "global" && region !== "china") throw new Error(`provider-qoder: unsupported model catalog region "${region}"`);
|
|
3451
|
+
modelsFor(value, "global");
|
|
3452
|
+
modelsFor(value, "china");
|
|
3453
|
+
} });
|
|
3476
3454
|
current = () => scope.get();
|
|
3477
3455
|
let bindingActive = true;
|
|
3478
3456
|
const persistCatalog = async (region) => {
|
|
@@ -3480,7 +3458,7 @@ function apply(ctx, input = {}) {
|
|
|
3480
3458
|
if (!settingsCtx.settings.writable || discoveredCatalogs[region].length === 0) return;
|
|
3481
3459
|
const snapshot = settingsCtx.settings.describe().find((section) => section.ns === namespace);
|
|
3482
3460
|
if (snapshot === void 0) return;
|
|
3483
|
-
const selected = modelsFor(snapshot.value, region
|
|
3461
|
+
const selected = modelsFor(snapshot.value, region);
|
|
3484
3462
|
const enriched = modelsFor(Config({ modelsByRegion: { [region]: mergeQoderDiscoveryMetadata(selected, discoveredCatalogs[region]) } }), region);
|
|
3485
3463
|
if (hasSameQoderDiscoveryMetadata(selected, enriched)) return;
|
|
3486
3464
|
try {
|
|
@@ -3493,9 +3471,6 @@ function apply(ctx, input = {}) {
|
|
|
3493
3471
|
};
|
|
3494
3472
|
persistDiscoveredModels = persistCatalog;
|
|
3495
3473
|
refreshAdapter();
|
|
3496
|
-
const loaded = scope.get();
|
|
3497
|
-
const loadedRegion = loaded.region ?? "global";
|
|
3498
|
-
if (loaded.models !== void 0 && loaded.models.length > 0 && loaded.modelsByRegion?.[loadedRegion] === void 0) scope.update({ modelsByRegion: { [loadedRegion]: resolveModels(loaded.models) } }).catch((error) => logger?.error?.("[Qoder Settings] Failed to migrate model catalog", logError(error)));
|
|
3499
3474
|
scope.watch(async () => {
|
|
3500
3475
|
if (!bindingActive || ctx.fiber.state === fiberUnloading || ctx.fiber.state === fiberDisposed) return;
|
|
3501
3476
|
refreshAdapter();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-provider-qoder",
|
|
3
3
|
"description": "Global Qoder subscription adapter for the DeepSeek Harness LLM seam",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.4.0",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -65,43 +65,42 @@
|
|
|
65
65
|
},
|
|
66
66
|
"license": "MIT",
|
|
67
67
|
"peerDependencies": {
|
|
68
|
-
"@deepseek-ai/cordis": ">=4.0.
|
|
69
|
-
"@deepseek-ai/dsh-api-remotes": ">=0.1.2-rc.1 <0.
|
|
70
|
-
"@deepseek-ai/dsh-attachment": ">=0.1.2-rc.1 <0.
|
|
71
|
-
"@deepseek-ai/dsh-client-connection": ">=0.1.2-rc.1 <0.
|
|
72
|
-
"@deepseek-ai/dsh-client-locale": ">=0.1.2-rc.1 <0.
|
|
73
|
-
"@deepseek-ai/dsh-client-ui-settings": ">=0.1.2-rc.1 <0.
|
|
74
|
-
"@deepseek-ai/dsh-client-ui-slots": ">=0.1.2-rc.1 <0.
|
|
75
|
-
"@deepseek-ai/dsh-credentials": ">=0.1.2-rc.1 <0.
|
|
76
|
-
"@deepseek-ai/dsh-invariants": ">=0.1.2-rc.1 <0.
|
|
77
|
-
"@deepseek-ai/dsh-llm": ">=0.1.2-rc.1 <0.
|
|
78
|
-
"@deepseek-ai/dsh-settings": ">=0.1.2-rc.1 <0.
|
|
79
|
-
"@deepseek-ai/dsh-web": ">=0.1.2-rc.1 <0.
|
|
68
|
+
"@deepseek-ai/cordis": ">=4.0.4 <5",
|
|
69
|
+
"@deepseek-ai/dsh-api-remotes": ">=0.1.7-rc.2 <0.2.0-0 || >=0.2.0-rc.1 <0.3.0-0",
|
|
70
|
+
"@deepseek-ai/dsh-attachment": ">=0.1.7-rc.2 <0.2.0-0 || >=0.2.0-rc.1 <0.3.0-0",
|
|
71
|
+
"@deepseek-ai/dsh-client-connection": ">=0.1.7-rc.2 <0.2.0-0 || >=0.2.0-rc.1 <0.3.0-0",
|
|
72
|
+
"@deepseek-ai/dsh-client-locale": ">=0.1.7-rc.2 <0.2.0-0 || >=0.2.0-rc.1 <0.3.0-0",
|
|
73
|
+
"@deepseek-ai/dsh-client-ui-settings": ">=0.1.7-rc.2 <0.2.0-0 || >=0.2.0-rc.1 <0.3.0-0",
|
|
74
|
+
"@deepseek-ai/dsh-client-ui-slots": ">=0.1.7-rc.2 <0.2.0-0 || >=0.2.0-rc.1 <0.3.0-0",
|
|
75
|
+
"@deepseek-ai/dsh-credentials": ">=0.1.7-rc.2 <0.2.0-0 || >=0.2.0-rc.1 <0.3.0-0",
|
|
76
|
+
"@deepseek-ai/dsh-invariants": ">=0.1.7-rc.2 <0.2.0-0 || >=0.2.0-rc.1 <0.3.0-0",
|
|
77
|
+
"@deepseek-ai/dsh-llm": ">=0.1.7-rc.2 <0.2.0-0 || >=0.2.0-rc.1 <0.3.0-0",
|
|
78
|
+
"@deepseek-ai/dsh-settings": ">=0.1.7-rc.2 <0.2.0-0 || >=0.2.0-rc.1 <0.3.0-0",
|
|
79
|
+
"@deepseek-ai/dsh-web": ">=0.1.7-rc.2 <0.2.0-0 || >=0.2.0-rc.1 <0.3.0-0",
|
|
80
80
|
"react": "^18.2.0"
|
|
81
81
|
},
|
|
82
82
|
"dependencies": {
|
|
83
|
-
"@deepseek-ai/schemastery": "3.18.
|
|
83
|
+
"@deepseek-ai/schemastery": "3.18.4"
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
|
-
"@deepseek-ai/cordis": "4.0.
|
|
87
|
-
"@deepseek-ai/cordis-plugin-loader": "1.0.
|
|
88
|
-
"@deepseek-ai/dsh-agent": "0.1.7-
|
|
89
|
-
"@deepseek-ai/dsh-api-remotes": "0.1.7-
|
|
90
|
-
"@deepseek-ai/dsh-app-boot": "0.1.7-
|
|
91
|
-
"@deepseek-ai/dsh-attachment": "0.1.7-
|
|
92
|
-
"@deepseek-ai/dsh-brand": "0.1.7-
|
|
93
|
-
"@deepseek-ai/dsh-client-connection": "0.1.7-
|
|
94
|
-
"@deepseek-ai/dsh-client-locale": "0.1.7-
|
|
95
|
-
"@deepseek-ai/dsh-client-ui-settings": "0.1.7-
|
|
96
|
-
"@deepseek-ai/dsh-client-ui-slots": "0.1.7-
|
|
97
|
-
"@deepseek-ai/dsh-config-editor": "0.1.7-
|
|
98
|
-
"@deepseek-ai/dsh-credentials": "0.1.7-
|
|
99
|
-
"@deepseek-ai/dsh-invariants": "0.1.7-
|
|
100
|
-
"@deepseek-ai/dsh-llm": "0.1.7-
|
|
101
|
-
"@deepseek-ai/dsh-session": "0.1.7-
|
|
102
|
-
"@deepseek-ai/dsh-settings": "0.1.7-
|
|
103
|
-
"@deepseek-ai/dsh-
|
|
104
|
-
"@deepseek-ai/dsh-web": "0.1.7-alpha.1",
|
|
86
|
+
"@deepseek-ai/cordis": "4.0.4",
|
|
87
|
+
"@deepseek-ai/cordis-plugin-loader": "1.0.5",
|
|
88
|
+
"@deepseek-ai/dsh-agent": "0.1.7-rc.2",
|
|
89
|
+
"@deepseek-ai/dsh-api-remotes": "0.1.7-rc.2",
|
|
90
|
+
"@deepseek-ai/dsh-app-boot": "0.1.7-rc.2",
|
|
91
|
+
"@deepseek-ai/dsh-attachment": "0.1.7-rc.2",
|
|
92
|
+
"@deepseek-ai/dsh-brand": "0.1.7-rc.2",
|
|
93
|
+
"@deepseek-ai/dsh-client-connection": "0.1.7-rc.2",
|
|
94
|
+
"@deepseek-ai/dsh-client-locale": "0.1.7-rc.2",
|
|
95
|
+
"@deepseek-ai/dsh-client-ui-settings": "0.1.7-rc.2",
|
|
96
|
+
"@deepseek-ai/dsh-client-ui-slots": "0.1.7-rc.2",
|
|
97
|
+
"@deepseek-ai/dsh-config-editor": "0.1.7-rc.2",
|
|
98
|
+
"@deepseek-ai/dsh-credentials": "0.1.7-rc.2",
|
|
99
|
+
"@deepseek-ai/dsh-invariants": "0.1.7-rc.2",
|
|
100
|
+
"@deepseek-ai/dsh-llm": "0.1.7-rc.2",
|
|
101
|
+
"@deepseek-ai/dsh-session": "0.1.7-rc.2",
|
|
102
|
+
"@deepseek-ai/dsh-settings": "0.1.7-rc.2",
|
|
103
|
+
"@deepseek-ai/dsh-web": "0.1.7-rc.2",
|
|
105
104
|
"@types/node": "24.3.0",
|
|
106
105
|
"@types/react": "18.3.1",
|
|
107
106
|
"lightningcss": "^1.33.0",
|