dsh-free-model 3.0.0 → 3.1.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/SECURITY-AUDIT.md CHANGED
@@ -11,13 +11,13 @@
11
11
  | 文件 | sha256 |
12
12
  | --- | --- |
13
13
  | `index.js` | `a932bcb6bdeef608496071a60d1f9e8499997fca52765e0eb300171d8728aa57` |
14
- | `client.js` | `13332f9b4102e5cc7125998983126df7b50cfa6a32ef5e20aefc51aca0a5e820` |
15
- | `vendor/channel-pack/pack.js` | `9255642fdaf064b11e0f1e233b0d771419515e8803dbe0e173c0cb6a9f76bfba` |
14
+ | `client.js` | `ddd7680be53b06a8cdcea19b3e3ece7b4a134783d9a88a66bb08a5c554a59f69` |
15
+ | `vendor/channel-pack/pack.js` | `2f9a8d58007fcec287c5f9be484b79adbfea8ec332bddc1ba01d52acb5877c19` |
16
16
 
17
17
  ⚠️ `pack.js` 的指纹随每次「刷新模型数据 / 移植上游修复」而变(它是构建产物)。
18
- 上面的值对应**上游跟进第二批(2026-11-09:codearts UA/业务码 + zcode 3.17 身份块 + 第四条指纹 + cline 快照后缀)之后**的版本;
18
+ 上面的值对应**3.1.0(2026-11-11:渠道卡按接入状态分组)之后**的版本;
19
19
  域名面结论未变,`scripts/egress-audit.mjs` 可随时重跑复验。
20
- (上一版 `b1d9d582…` 是目录自适应 + 12 项修复后的产物。)
20
+ (上一版 `9255642f…` 是上游第二轮跟进后的产物。)
21
21
 
22
22
  ## 结论
23
23
 
package/client.js CHANGED
@@ -72,6 +72,8 @@ window.__ModuleLoader__.load({
72
72
  'chan.pack.failed': '渠道包未挂载:{reason}(免费车道与 EAC 不受影响)',
73
73
  'chan.pack.hint': '渠道包由本插件内置(vendor/channel-pack),随插件一起升级。',
74
74
  'chan.state.on': '已接入',
75
+ 'chan.group.on': '已接入',
76
+ 'chan.group.off': '未接入',
75
77
  'chan.state.off': '未接入',
76
78
  'chan.state.closed': '已关闭',
77
79
  'chan.meta.accounts': '账号',
@@ -254,6 +256,8 @@ window.__ModuleLoader__.load({
254
256
  'chan.pack.failed': 'Channel pack not mounted: {reason} (the free and EAC lanes are unaffected)',
255
257
  'chan.pack.hint': 'The pack ships inside this plugin (vendor/channel-pack) and upgrades with it.',
256
258
  'chan.state.on': 'Connected',
259
+ 'chan.group.on': 'Connected',
260
+ 'chan.group.off': 'Not connected',
257
261
  'chan.state.off': 'Not connected',
258
262
  'chan.state.closed': 'Turned off',
259
263
  'chan.meta.accounts': 'Accounts',
@@ -566,6 +570,14 @@ window.__ModuleLoader__.load({
566
570
  .ofm_glass{background:color-mix(in srgb,var(--dsw-alias-bg-layer-2) 68%,transparent);border:1px solid color-mix(in srgb,var(--dsw-alias-border-l2) 78%,transparent);box-shadow:inset 0 1px 0 rgb(255 255 255 / 6%),0 12px 34px rgb(0 0 0 / 9%)}.ofm_root .ofm_hero,.ofm_root .ofm_panel,.ofm_root .ofm_modal{background:color-mix(in srgb,var(--dsw-alias-bg-layer-2) 70%,transparent);box-shadow:inset 0 1px 0 rgb(255 255 255 / 7%),0 14px 40px rgb(0 0 0 / 10%)}
567
571
  /* ══ 渠道接入页 ════════════════════════════════════════════════════════ */
568
572
  .ofm_chanwrap{display:grid;grid-template-columns:repeat(auto-fill,minmax(330px,1fr));gap:14px}
573
+ /* 渠道分组标题:已接入 / 未接入。⚠️ 必须 grid-column:1/-1 横跨整行 ——
574
+ 否则它会变成一个 330px 的格子(把第一张卡挤到第二列)。 */
575
+ .ofm_chargroup{grid-column:1/-1;display:flex;align-items:center;gap:9px;margin:2px 0 -4px;font-size:12px;font-weight:650;letter-spacing:.02em;color:var(--dsw-alias-text-l3)}
576
+ .ofm_chargroup:not(:first-child){margin-top:12px}
577
+ .ofm_chargroup::after{content:"";flex:1;height:1px;background:linear-gradient(90deg,var(--dsw-alias-border-l2),transparent)}
578
+ .ofm_chargroupn{font-variant-numeric:tabular-nums;font-weight:600;opacity:.72}
579
+ .ofm_chargroupdot{width:6px;height:6px;border-radius:50%;background:var(--dsw-alias-state-success-primary,#12b76a);flex:none}
580
+ .ofm_chargroupdot.off{background:var(--dsw-alias-text-l3);opacity:.5}
569
581
  .ofm_chan{position:relative;display:flex;flex-direction:column;gap:12px;padding:16px 17px 15px;border-radius:16px;border:1px solid var(--dsw-alias-border-l2);background:color-mix(in srgb,var(--dsw-alias-bg-layer-3) 78%,transparent);box-shadow:inset 0 1px 0 rgb(255 255 255 / 5%),0 1px 2px rgb(0 0 0 / 5%);overflow:hidden;transition:transform .22s cubic-bezier(.32,.72,0,1),box-shadow .24s ease,border-color .2s ease}
570
582
  .ofm_chan::before{content:"";position:absolute;left:0;right:0;top:0;height:2px;background:linear-gradient(90deg,var(--chan-accent,var(--dsw-alias-state-business-primary)),transparent 78%);opacity:.95}
571
583
  .ofm_chan:hover{transform:translateY(-3px);box-shadow:inset 0 1px 0 rgb(255 255 255 / 8%),0 18px 40px rgb(0 0 0 / 15%);border-color:color-mix(in srgb,var(--chan-accent,var(--dsw-alias-state-business-primary)) 55%,transparent)}
@@ -1425,6 +1437,30 @@ window.__ModuleLoader__.load({
1425
1437
  { id: 'accio', name: 'Accio Work', org: '阿里', accent: '#FF6A00', note: '标准 OAuth + PKCE(公开客户端),可脱离 IDE 使用', login: 'browser' },
1426
1438
  ]
1427
1439
 
1440
+ /**
1441
+ * 把渠道按「是否已接入账号」分成两组:**已接入在前、未接入在后**,
1442
+ * 各自保持 `PROVIDERS` 里的原始相对顺序。
1443
+ *
1444
+ * ## 为什么抽成纯函数(2026-11-11)
1445
+ *
1446
+ * 卡片顺序是被用户直接看见的行为,值得一条**顺序语义**的回归钉子;
1447
+ * 而频道页要经 RPC 才拿到 `statuses`,渲染测试的替身里没有 connection,
1448
+ * 永远停在「未就绪」态(那一态刻意不分组)。⇒ 抽出来让套件直接测语义,
1449
+ * 而不是为了测顺序去伪造一整套 RPC。
1450
+ *
1451
+ * ⚠️ `statuses === undefined`(还没拉到数据)→ **不分组**:那时所有卡都是
1452
+ * 骨架态,硬分会让人看到列表在一次数据到达后整体跳动。
1453
+ * ⚠️ 「已接入」判据与卡片绿点/计数**必须同一个**(`accounts.enabled > 0`)。
1454
+ */
1455
+ function groupChannelsByConnected(providers, statuses, labels) {
1456
+ if (statuses === undefined) return [{ key: 'all', label: null, dot: null, rows: providers }]
1457
+ const isOn = row => (statuses?.[row.id]?.accounts?.enabled ?? 0) > 0
1458
+ return [
1459
+ { key: 'on', label: labels.on, dot: 'on', rows: providers.filter(isOn) },
1460
+ { key: 'off', label: labels.off, dot: 'off', rows: providers.filter(row => !isOn(row)) },
1461
+ ].filter(group => group.rows.length > 0)
1462
+ }
1463
+
1428
1464
  /** 与现有 RPC 的能力对应:余额、每日领取及独立签到状态分别判断。 */
1429
1465
  const CHANNEL_CREDITS = {
1430
1466
  codearts: { claim: true },
@@ -1920,6 +1956,26 @@ window.__ModuleLoader__.load({
1920
1956
 
1921
1957
  const connected = statuses === undefined ? 0 : CHANNEL_PROVIDERS.filter(row => (statuses[row.id]?.accounts?.enabled ?? 0) > 0).length
1922
1958
  const failed = !ready && pack.state === 'failed'
1959
+ /**
1960
+ * **渠道分组**(2026-11-11 用户要求):「已接入账号的一组、未接入的一组;
1961
+ * 已接入的上移、未接入的不动」。
1962
+ *
1963
+ * ⚠️ 顺序判据:`CHANNEL_PROVIDERS` 是**硬编码**的产品顺序(codearts → buddy →
1964
+ * … → accio),这是有意的品牌编排,不能在数组里就地重排(否则以后维护
1965
+ * 看不出原始顺序)。
1966
+ * ⇒ 渲染时**派生成两组**:`filter` 保持各自在源数组里的相对顺序,
1967
+ * 「已接入」在前、「未接入」在后 —— 正好是「上移 + 未动的保持原序」。
1968
+ *
1969
+ * ⚠️ 「已接入」判据与卡片上的绿点/计数**必须同一个**(`accounts.enabled > 0`):
1970
+ * 用别的判据(如 `accounts.total`)会出现「卡片显示未接入却排在已接入组」。
1971
+ *
1972
+ * ⚠️ `statuses === undefined`(还没拉到数据)时**不分组**:那时所有卡都是
1973
+ * 骨架态,硬分会让人看到列表在一次数据到达后整体跳动。
1974
+ */
1975
+ const channelGroups = groupChannelsByConnected(CHANNEL_PROVIDERS, statuses, {
1976
+ on: t('chan.group.on'),
1977
+ off: t('chan.group.off'),
1978
+ })
1923
1979
 
1924
1980
  return h('div', { className: 'ofm_page' },
1925
1981
  h('header', { className: 'ofm_hero ofm_glass' },
@@ -1941,15 +1997,22 @@ window.__ModuleLoader__.load({
1941
1997
  !available ? h('div', { className: 'ofm_callout' }, h('div', null, t('chan.rpc.unavailable'))) : null,
1942
1998
  !ready ? h('div', { className: 'ofm_chanwrap' },
1943
1999
  [0, 1, 2].map(index => h('div', { className: 'ofm_skel', key: index, style: { minHeight: 168 } }))) : null,
1944
- ready ? h('div', { className: 'ofm_chanwrap' }, CHANNEL_PROVIDERS.map(channel => h(ChannelCard, {
1945
- key: channel.id,
1946
- channel,
1947
- status: statuses?.[channel.id],
1948
- rpc: available ? rpc : null,
1949
- t,
1950
- onError,
1951
- onChanged,
1952
- }))) : null,
2000
+ ready ? h('div', { className: 'ofm_chanwrap' },
2001
+ channelGroups.flatMap(group => [
2002
+ group.label === null ? null : h('div', { className: 'ofm_chargroup', key: `g-${group.key}` },
2003
+ h('span', { className: `ofm_chargroupdot ${group.dot === 'off' ? 'off' : ''}`.trim() }),
2004
+ h('span', null, group.label),
2005
+ h('span', { className: 'ofm_chargroupn' }, String(group.rows.length))),
2006
+ ...group.rows.map(channel => h(ChannelCard, {
2007
+ key: channel.id,
2008
+ channel,
2009
+ status: statuses?.[channel.id],
2010
+ rpc: available ? rpc : null,
2011
+ t,
2012
+ onError,
2013
+ onChanged,
2014
+ })),
2015
+ ].filter(Boolean))) : null,
1953
2016
  error !== '' && !failed ? h('p', { className: 'ofm_note' }, `${t('chan.error').replace('{reason}', error)}`) : null)
1954
2017
  }
1955
2018
 
@@ -2525,7 +2588,7 @@ window.__ModuleLoader__.load({
2525
2588
  exports.inject = inject
2526
2589
  exports.name = 'our-free-model'
2527
2590
  // Headless test seams use the same stub React as scripts/client-lint.mjs.
2528
- exports.__test = { parseSafeHtml, safeUrl, sanitizeStyle, htmlToDom, ChannelsPage }
2591
+ exports.__test = { parseSafeHtml, safeUrl, sanitizeStyle, htmlToDom, ChannelsPage, groupChannelsByConnected, CHANNEL_PROVIDERS }
2529
2592
  return module.exports
2530
2593
  },
2531
2594
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-free-model",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "type": "module",
5
5
  "description": "dsh 插件(DeepSeek Harness / cordis bundle)· 模型接入 —— 把 CodeArts、CodeBuddy / WorkBuddy、LobsterAI、Qoder / Qoder CN、TRAE、Cline、Loomy、Raccoon、MiniMax Code、ZCode、Gemini、OfficeAce、Accio Work 十五个账号渠道接进 dsh 的模型选择器,并保留数据看板、运行日志与本地网关(含局域网中继)。上游 2.1.0 的匿名免费车道、EAC 协付车道、聚合渠道、省 Token、路由、公告/升级/热重载与独立 Web 产品已全部移除。",
6
6
  "main": "./index.js",
@@ -72651,6 +72651,28 @@ function makeReadImageRequest(ctx) {
72651
72651
  }
72652
72652
  };
72653
72653
  }
72654
+ function refreshCatalogsOnce(deps) {
72655
+ return (async () => {
72656
+ for (const [tag2, adapter] of Object.entries(deps.adapters)) {
72657
+ const refresh = adapter.refreshCatalog;
72658
+ if (typeof refresh !== "function") continue;
72659
+ if (deps.hasAccount !== void 0) {
72660
+ let has = false;
72661
+ try {
72662
+ has = await deps.hasAccount(tag2);
72663
+ } catch {
72664
+ has = false;
72665
+ }
72666
+ if (!has) continue;
72667
+ }
72668
+ try {
72669
+ await refresh.call(adapter);
72670
+ } catch (error) {
72671
+ deps.onError?.(tag2, error);
72672
+ }
72673
+ }
72674
+ })();
72675
+ }
72654
72676
  function apply(ctx, config = {}) {
72655
72677
  const network = createChannelFetch({ outlet: config.outlet });
72656
72678
  ctx.effect(() => () => {
@@ -73531,22 +73553,32 @@ function apply(ctx, config = {}) {
73531
73553
  ["accio", (p) => accio.refreshAll(p)]
73532
73554
  ];
73533
73555
  let catalogRefreshInFlight = false;
73556
+ async function hasCatalogAccount(provider) {
73557
+ const probe = pool.hasLoggedInAccount;
73558
+ if (typeof probe !== "function") return true;
73559
+ try {
73560
+ return await probe.call(pool, provider);
73561
+ } catch {
73562
+ return false;
73563
+ }
73564
+ }
73534
73565
  async function refreshAllCatalogs() {
73535
73566
  if (catalogRefreshInFlight) return;
73536
73567
  if (typeof modelAdapters === "undefined") return;
73537
73568
  catalogRefreshInFlight = true;
73538
73569
  try {
73539
- for (const [tag2, adapter] of Object.entries(modelAdapters)) {
73540
- const refresh = adapter.refreshCatalog;
73541
- if (typeof refresh !== "function") continue;
73542
- try {
73543
- await refresh.call(adapter);
73544
- } catch (error) {
73570
+ await refreshCatalogsOnce({
73571
+ adapters: modelAdapters,
73572
+ // ⚠️ 闸门:**没配账号的渠道不刷**(2026-11-09 用户报障:未配 cline 账号,
73573
+ // 却每 30 分钟刷「models.dev 拉取失败 / 无可用凭据」两条 warn)。
73574
+ // 判据是 `hasLoggedInAccount(provider)`;能力缺失时传 undefined ⇒ 照旧刷新。
73575
+ hasAccount: typeof pool.hasLoggedInAccount === "function" ? (provider) => hasCatalogAccount(provider) : void 0,
73576
+ onError: (tag2, error) => {
73545
73577
  ctx.logger?.warn?.(
73546
73578
  `[channel-pack] ${tag2} \u76EE\u5F55\u5237\u65B0\u5931\u8D25\uFF08\u4FDD\u7559\u65E7\u76EE\u5F55\uFF09\uFF1A${error instanceof Error ? error.message : String(error)}`
73547
73579
  );
73548
73580
  }
73549
- }
73581
+ });
73550
73582
  } finally {
73551
73583
  catalogRefreshInFlight = false;
73552
73584
  }
@@ -73839,6 +73871,7 @@ export {
73839
73871
  maybeClaimBonus,
73840
73872
  name,
73841
73873
  parseWindowsProxy,
73874
+ refreshCatalogsOnce,
73842
73875
  rewriteTencentContentFingerprints,
73843
73876
  serializeTraeMessagesForTest,
73844
73877
  stripClineSnapshotSuffix,