dsh-qoder-connect 0.1.5 → 0.1.9

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.
@@ -362,6 +362,15 @@ function qoderOwnAuthPath(variant) {
362
362
  /** Plugin-owned status endpoint consumed by its browser half. */
363
363
  const QODER_STATUS_PATH = "/plugins/dsh-qoder-connect/status";
364
364
  /**
365
+ * Plugin-owned settings endpoint consumed by its browser half.
366
+ *
367
+ * GET answers the whole entry configuration as three layers (value/base/user)
368
+ * plus the write key; POST applies one patch. This is the plugin's own settings
369
+ * surface, replacing writes through the host's settings service — see
370
+ * {@link ./settings-store.ts} for why.
371
+ */
372
+ const QODER_SETTINGS_FACE_PATH = "/plugins/dsh-qoder-connect/settings";
373
+ /**
365
374
  * Plugin-owned probe control endpoint.
366
375
  *
367
376
  * Separate from the status route because it accepts writes: the status route's
@@ -502,11 +511,18 @@ var QoderCatalog = class {
502
511
  useMaximumContextWindow = false;
503
512
  /** Per-model window overrides (model id → tokens); an override wins over the preference. */
504
513
  modelContextWindows = {};
514
+ /** Disabled model IDs (blacklist); disabled models are filtered out from current(). */
515
+ disabledModels = /* @__PURE__ */ new Set();
505
516
  constructor(initial = FALLBACK_QODER_MODELS) {
506
517
  this.models = initial;
507
518
  }
508
- /** Current entries; empty while the variant has no usable credential. */
519
+ /** Current entries; empty while the variant has no usable credential, excluding disabled models. */
509
520
  current() {
521
+ if (!this.visible) return [];
522
+ return this.all().filter((model) => !this.disabledModels.has(model.id));
523
+ }
524
+ /** All configured entries including disabled ones; empty while the variant has no usable credential. */
525
+ all() {
510
526
  if (!this.visible) return [];
511
527
  return this.models.map((model) => {
512
528
  const override = this.modelContextWindows[model.id];
@@ -557,6 +573,20 @@ var QoderCatalog = class {
557
573
  return true;
558
574
  }
559
575
  /**
576
+ * Replace the disabled model IDs wholesale. Returns whether the set
577
+ * changed, so the caller can skip an invalidation over an identical write.
578
+ */
579
+ setDisabledModels(disabledModels) {
580
+ const next = new Set(disabledModels);
581
+ if (next.size === this.disabledModels.size && [...next].every((id) => this.disabledModels.has(id))) return false;
582
+ this.disabledModels = next;
583
+ return true;
584
+ }
585
+ /** Current disabled model IDs. */
586
+ getDisabledModels() {
587
+ return Array.from(this.disabledModels);
588
+ }
589
+ /**
560
590
  * Models to fall back to when the upstream fetch fails; ignores
561
591
  * visibility, because the caller asking for the fallback already knows the
562
592
  * credential state.
@@ -2367,6 +2397,7 @@ var QoderUsageReader = class {
2367
2397
  return {
2368
2398
  userQuota: normalizeQuota(data.userQuota),
2369
2399
  orgResourcePackage: normalizeQuota(data.orgResourcePackage),
2400
+ addOnQuota: normalizeQuota(data.addOnQuota),
2370
2401
  totalUsagePercentage: typeof data.totalUsagePercentage === "number" ? data.totalUsagePercentage : void 0,
2371
2402
  isQuotaExceeded: typeof data.isQuotaExceeded === "boolean" ? data.isQuotaExceeded : false,
2372
2403
  expiresAt: normalizeExpiresAt(data.expiresAt),
@@ -2438,6 +2469,7 @@ var QoderCheckInService = class {
2438
2469
  const data = await openApiJsonRequest(this.fetchImpl, {
2439
2470
  url,
2440
2471
  token,
2472
+ headers: { "cosy-clienttype": "10" },
2441
2473
  signal,
2442
2474
  timeoutMs: this.timeoutMs,
2443
2475
  logger: this.logger,
@@ -2453,7 +2485,10 @@ var QoderCheckInService = class {
2453
2485
  url,
2454
2486
  method: "POST",
2455
2487
  token,
2456
- headers: { origin: openApiUrl },
2488
+ headers: {
2489
+ origin: openApiUrl,
2490
+ "cosy-clienttype": "10"
2491
+ },
2457
2492
  signal,
2458
2493
  timeoutMs: this.timeoutMs,
2459
2494
  logger: this.logger,
@@ -3983,6 +4018,13 @@ var QoderUpstreamClient = class {
3983
4018
  size: org.total,
3984
4019
  ...usage.expiresAt === void 0 ? {} : { packageEndTime: usage.expiresAt }
3985
4020
  });
4021
+ const addOn = usage.addOnQuota;
4022
+ if (addOn !== void 0) accounts.push({
4023
+ packageName: "赠送额度",
4024
+ remain: addOn.remaining,
4025
+ size: addOn.total,
4026
+ ...usage.expiresAt === void 0 ? {} : { packageEndTime: usage.expiresAt }
4027
+ });
3986
4028
  const unlimited = usage.isQuotaExceeded === false && personal !== void 0 && personal.total === 0;
3987
4029
  return {
3988
4030
  total: usage.totalUsagePercentage ?? personal?.percentage ?? 0,
@@ -4233,7 +4275,7 @@ const DEFAULT_MAX_TOKENS = 32768;
4233
4275
  const DEFAULT_CONTEXT_WINDOW = 18e4;
4234
4276
  //#endregion
4235
4277
  //#region src/version.ts
4236
- const QODER_CONNECT_VERSION = "0.1.5";
4278
+ const QODER_CONNECT_VERSION = "0.1.9";
4237
4279
  //#endregion
4238
4280
  //#region src/host-heartbeat.ts
4239
4281
  /**
@@ -4430,4 +4472,4 @@ function variantFor(id) {
4430
4472
  return QODER_VARIANTS.find((variant) => variant.id === id);
4431
4473
  }
4432
4474
  //#endregion
4433
- export { QODER_GLOBAL_AUTH_PATH as A, qoderCredentialIdentity as B, probeModel as C, FALLBACK_QODER_MODELS as D, qoderCatalogPath as E, QODER_AUTH_FILENAME as F, qoderPluginDataDir as G, QODER_DATA_DIR_ENV as H, QODER_PAT_ENV_CN as I, qoderStateDir as K, QODER_PAT_ENV_GLOBAL as L, QODER_GLOBAL_STATUS_PATH as M, QODER_PROBE_PATH as N, QoderCatalog as O, QODER_STATUS_PATH as P, QoderCredentialStore as R, PROBE_EFFORT_CANDIDATES as S, QoderCatalogStore as T, QODER_DATA_DIR_NAME as U, qoderOwnAuthPath as V, qoderMachineIdPath as W, modelInfoOf as _, QODER_HOST_HEARTBEAT_FILENAME as a, createQoderTransport as b, processStartTimeMs as c, writeHostHeartbeat as d, QODER_CONNECT_VERSION as f, kindFromQoderFailure as g, classifyUpstreamError as h, variantFor as i, QODER_GLOBAL_PROBE_PATH as j, QODER_AUTH_PATH as k, qoderHostHeartbeatPath as l, QoderUpstreamClient as m, GLOBAL_VARIANT as n, clearHostHeartbeat as o, KIND_STATUS as p, QODER_VARIANTS as r, isHeartbeatProcessAlive as s, CHINA_VARIANT as t, readHostHeartbeat as u, normalizeCredits as v, randomSentinel as w, getMachineId as x, validateApiKey as y, patTail as z };
4475
+ export { QODER_GLOBAL_AUTH_PATH as A, patTail as B, probeModel as C, FALLBACK_QODER_MODELS as D, qoderCatalogPath as E, QODER_STATUS_PATH as F, qoderMachineIdPath as G, qoderOwnAuthPath as H, QODER_AUTH_FILENAME as I, qoderPluginDataDir as K, QODER_PAT_ENV_CN as L, QODER_GLOBAL_STATUS_PATH as M, QODER_PROBE_PATH as N, QoderCatalog as O, QODER_SETTINGS_FACE_PATH as P, QODER_PAT_ENV_GLOBAL as R, PROBE_EFFORT_CANDIDATES as S, QoderCatalogStore as T, QODER_DATA_DIR_ENV as U, qoderCredentialIdentity as V, QODER_DATA_DIR_NAME as W, modelInfoOf as _, QODER_HOST_HEARTBEAT_FILENAME as a, createQoderTransport as b, processStartTimeMs as c, writeHostHeartbeat as d, QODER_CONNECT_VERSION as f, kindFromQoderFailure as g, classifyUpstreamError as h, variantFor as i, QODER_GLOBAL_PROBE_PATH as j, QODER_AUTH_PATH as k, qoderHostHeartbeatPath as l, QoderUpstreamClient as m, GLOBAL_VARIANT as n, clearHostHeartbeat as o, KIND_STATUS as p, qoderStateDir as q, QODER_VARIANTS as r, isHeartbeatProcessAlive as s, CHINA_VARIANT as t, readHostHeartbeat as u, normalizeCredits as v, randomSentinel as w, getMachineId as x, validateApiKey as y, QoderCredentialStore as z };
package/package.json CHANGED
@@ -1,116 +1,120 @@
1
- {
2
- "name": "dsh-qoder-connect",
3
- "displayName": "DSH Qoder Connect",
4
- "description": "将 Qoder(国内版 / 国际版)的模型接入 DeepSeek Harness — bring Qoder (CN & international) models into DeepSeek Harness.",
5
- "version": "0.1.5",
6
- "author": "corrinehu",
7
- "keywords": [
8
- "dsh-plugin",
9
- "deepseek-harness",
10
- "deepseek",
11
- "qoder",
12
- "model-provider"
13
- ],
14
- "type": "module",
15
- "engines": {
16
- "node": "^22.19.0 || >=24.0.0"
17
- },
18
- "main": "lib/index.js",
19
- "types": "lib/index.d.ts",
20
- "bin": {
21
- "dsh-qoder-connect": "lib/bin.js"
22
- },
23
- "scripts": {
24
- "prepack": "npm run build",
25
- "build": "tsdown",
26
- "test": "node -r ./tests/sandbox-shim.cjs ./node_modules/vitest/vitest.mjs run",
27
- "test:qoder": "node --test --test-isolation=none --experimental-strip-types tests/qoder/*.test.ts",
28
- "typecheck": "tsc -p tsconfig.json && tsc -p tsconfig.client.json",
29
- "check": "pnpm run typecheck && pnpm run test && pnpm run test:qoder && pnpm run build"
30
- },
31
- "exports": {
32
- ".": {
33
- "types": "./lib/index.d.ts",
34
- "default": "./lib/index.js"
35
- },
36
- "./client": "./lib/client.js",
37
- "./cordis.patch.yml": "./cordis.patch.yml",
38
- "./package.json": "./package.json"
39
- },
40
- "files": [
41
- "lib",
42
- "assets",
43
- "cordis.patch.yml",
44
- "README.md",
45
- "README.en.md",
46
- "LICENSE"
47
- ],
48
- "license": "MIT",
49
- "repository": {
50
- "type": "git",
51
- "url": "git+https://github.com/masknull/dsh-qoder-connect.git"
52
- },
53
- "homepage": "https://github.com/masknull/dsh-qoder-connect#readme",
54
- "bugs": "https://github.com/masknull/dsh-qoder-connect/issues",
55
- "dsh": {
56
- "bundle": {
57
- "patch": "./cordis.patch.yml"
58
- },
59
- "client": {
60
- "inject": [
61
- "@deepseek-ai/dsh-api-remotes",
62
- "@deepseek-ai/dsh-api-session-controller",
63
- "@deepseek-ai/dsh-client-ui-renderer",
64
- "@deepseek-ai/dsh-client-ui-settings-plugins",
65
- "@deepseek-ai/dsh-client-ui-settings",
66
- "@deepseek-ai/dsh-client-ui-conversation",
67
- "@deepseek-ai/dsh-client-ui-model-selection",
68
- "@deepseek-ai/dsh-client-ui-sidebar",
69
- "@deepseek-ai/dsh-client-locale"
70
- ],
71
- "platform": "web"
72
- }
73
- },
74
- "peerDependencies": {
75
- "@deepseek-ai/cordis": "^4.0.2",
76
- "@deepseek-ai/dsh-atomic-write": "^0.1.5-rc.1",
77
- "@deepseek-ai/dsh-attachment": "^0.1.5-rc.1",
78
- "@deepseek-ai/dsh-home-paths": "^0.1.5-rc.1",
79
- "@deepseek-ai/dsh-host-webserver": "^0.1.5-rc.1",
80
- "@deepseek-ai/dsh-llm": "^0.1.5-rc.1",
81
- "@deepseek-ai/dsh-llm-pi-ai": "^0.1.5-rc.1",
82
- "@deepseek-ai/dsh-settings": "^0.1.5-rc.1",
83
- "@deepseek-ai/schemastery": "^3.18.2",
84
- "@earendil-works/pi-ai": "^0.85.1",
85
- "react": "^18.2.0"
86
- },
87
- "devDependencies": {
88
- "@deepseek-ai/cordis": "^4.0.2",
89
- "@deepseek-ai/dsh-atomic-write": "^0.1.5-rc.1",
90
- "@deepseek-ai/dsh-attachment": "^0.1.5-rc.1",
91
- "@deepseek-ai/dsh-client-locale": "^0.1.5-rc.1",
92
- "@deepseek-ai/dsh-client-ui-conversation": "0.1.5-rc.1",
93
- "@deepseek-ai/dsh-client-ui-model-selection": "0.1.5-rc.1",
94
- "@deepseek-ai/dsh-client-ui-renderer": "^0.1.5-rc.1",
95
- "@deepseek-ai/dsh-client-ui-settings": "^0.1.5-rc.1",
96
- "@deepseek-ai/dsh-client-ui-settings-plugins": "^0.1.5-rc.1",
97
- "@deepseek-ai/dsh-client-ui-sidebar": "^0.1.5-rc.1",
98
- "@deepseek-ai/dsh-client-ui-slots": "^0.1.5-rc.1",
99
- "@deepseek-ai/dsh-credentials": "^0.1.5-rc.1",
100
- "@deepseek-ai/dsh-home-paths": "^0.1.5-rc.1",
101
- "@deepseek-ai/dsh-host-webserver": "^0.1.5-rc.1",
102
- "@deepseek-ai/dsh-llm": "^0.1.5-rc.1",
103
- "@deepseek-ai/dsh-llm-pi-ai": "^0.1.5-rc.1",
104
- "@deepseek-ai/dsh-settings": "^0.1.5-rc.1",
105
- "@deepseek-ai/schemastery": "^3.18.2",
106
- "@earendil-works/pi-ai": "^0.85.1",
107
- "@types/node": "^22.20.0",
108
- "@types/react": "~18.3.1",
109
- "@types/react-test-renderer": "^18.3.1",
110
- "react": "^18.2.0",
111
- "react-test-renderer": "18.3.1",
112
- "tsdown": "^0.22.2",
113
- "typescript": "^5.9.3",
114
- "vitest": "^4.1.8"
115
- }
116
- }
1
+ {
2
+ "name": "dsh-qoder-connect",
3
+ "displayName": "DSH Qoder Connect",
4
+ "description": "将 Qoder(国内版 / 国际版)的模型接入 DeepSeek Harness — bring Qoder (CN & international) models into DeepSeek Harness.",
5
+ "version": "0.1.9",
6
+ "author": "corrinehu",
7
+ "keywords": [
8
+ "dsh-plugin",
9
+ "deepseek-harness",
10
+ "deepseek",
11
+ "qoder",
12
+ "model-provider"
13
+ ],
14
+ "type": "module",
15
+ "engines": {
16
+ "dsh": ">=0.1.5-rc.2",
17
+ "node": "^22.19.0 || >=24.0.0"
18
+ },
19
+ "main": "lib/index.js",
20
+ "types": "lib/index.d.ts",
21
+ "bin": {
22
+ "dsh-qoder-connect": "lib/bin.js"
23
+ },
24
+ "scripts": {
25
+ "prepack": "npm run build",
26
+ "build": "tsdown",
27
+ "test": "node -r ./tests/sandbox-shim.cjs ./node_modules/vitest/vitest.mjs run",
28
+ "test:qoder": "node --test --test-isolation=none --experimental-strip-types tests/qoder/*.test.ts",
29
+ "typecheck": "tsc -p tsconfig.json && tsc -p tsconfig.client.json",
30
+ "check": "pnpm run typecheck && pnpm run test && pnpm run test:qoder && pnpm run build"
31
+ },
32
+ "exports": {
33
+ ".": {
34
+ "types": "./lib/index.d.ts",
35
+ "default": "./lib/index.js"
36
+ },
37
+ "./client": "./lib/client.js",
38
+ "./cordis.patch.yml": "./cordis.patch.yml",
39
+ "./package.json": "./package.json"
40
+ },
41
+ "files": [
42
+ "lib",
43
+ "assets",
44
+ "cordis.patch.yml",
45
+ "README.md",
46
+ "README.en.md",
47
+ "LICENSE"
48
+ ],
49
+ "license": "MIT",
50
+ "repository": {
51
+ "type": "git",
52
+ "url": "git+https://github.com/masknull/dsh-qoder-connect.git"
53
+ },
54
+ "homepage": "https://github.com/masknull/dsh-qoder-connect#readme",
55
+ "bugs": "https://github.com/masknull/dsh-qoder-connect/issues",
56
+ "dsh": {
57
+ "bundle": {
58
+ "patch": "./cordis.patch.yml"
59
+ },
60
+ "client": {
61
+ "inject": [
62
+ "@deepseek-ai/dsh-api-remotes",
63
+ "@deepseek-ai/dsh-api-session-controller",
64
+ "@deepseek-ai/dsh-client-ui-renderer",
65
+ "@deepseek-ai/dsh-client-ui-settings-plugins",
66
+ "@deepseek-ai/dsh-client-ui-settings",
67
+ "@deepseek-ai/dsh-client-ui-conversation",
68
+ "@deepseek-ai/dsh-client-ui-model-selection",
69
+ "@deepseek-ai/dsh-client-ui-sidebar",
70
+ "@deepseek-ai/dsh-client-locale"
71
+ ],
72
+ "platform": "web"
73
+ }
74
+ },
75
+ "peerDependencies": {
76
+ "@deepseek-ai/cordis": "^4.0.2",
77
+ "@deepseek-ai/dsh-atomic-write": "^0.1.5-rc.1",
78
+ "@deepseek-ai/dsh-attachment": "^0.1.5-rc.1",
79
+ "@deepseek-ai/dsh-home-paths": "^0.1.5-rc.1",
80
+ "@deepseek-ai/dsh-host-webserver": "^0.1.5-rc.1",
81
+ "@deepseek-ai/dsh-llm": "^0.1.5-rc.1",
82
+ "@deepseek-ai/dsh-llm-pi-ai": "^0.1.5-rc.1",
83
+ "@deepseek-ai/dsh-settings": "^0.1.5-rc.1",
84
+ "@deepseek-ai/schemastery": "^3.18.2",
85
+ "@earendil-works/pi-ai": "^0.85.1",
86
+ "react": "^18.2.0"
87
+ },
88
+ "devDependencies": {
89
+ "@deepseek-ai/cordis": "^4.0.2",
90
+ "@deepseek-ai/dsh-atomic-write": "^0.1.5-rc.1",
91
+ "@deepseek-ai/dsh-attachment": "^0.1.5-rc.1",
92
+ "@deepseek-ai/dsh-client-locale": "^0.1.5-rc.1",
93
+ "@deepseek-ai/dsh-client-ui-conversation": "0.1.5-rc.1",
94
+ "@deepseek-ai/dsh-client-ui-model-selection": "0.1.5-rc.1",
95
+ "@deepseek-ai/dsh-client-ui-renderer": "^0.1.5-rc.1",
96
+ "@deepseek-ai/dsh-client-ui-settings": "^0.1.5-rc.1",
97
+ "@deepseek-ai/dsh-client-ui-settings-plugins": "^0.1.5-rc.1",
98
+ "@deepseek-ai/dsh-client-ui-sidebar": "^0.1.5-rc.1",
99
+ "@deepseek-ai/dsh-client-ui-slots": "^0.1.5-rc.1",
100
+ "@deepseek-ai/dsh-credentials": "^0.1.5-rc.1",
101
+ "@deepseek-ai/dsh-home-paths": "^0.1.5-rc.1",
102
+ "@deepseek-ai/dsh-host-webserver": "^0.1.5-rc.1",
103
+ "@deepseek-ai/dsh-llm": "^0.1.5-rc.1",
104
+ "@deepseek-ai/dsh-llm-pi-ai": "^0.1.5-rc.1",
105
+ "@deepseek-ai/dsh-settings": "^0.1.5-rc.1",
106
+ "@deepseek-ai/schemastery": "^3.18.2",
107
+ "@earendil-works/pi-ai": "^0.85.1",
108
+ "@types/node": "^22.20.0",
109
+ "@types/react": "~18.3.1",
110
+ "@types/react-test-renderer": "^18.3.1",
111
+ "react": "^18.2.0",
112
+ "react-test-renderer": "18.3.1",
113
+ "tsdown": "^0.22.2",
114
+ "typescript": "^5.9.3",
115
+ "vitest": "^4.1.8"
116
+ },
117
+ "dependencies": {
118
+ "js-yaml": "^4.1.0"
119
+ }
120
+ }