heybash-xdpool 1.0.0 → 1.0.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Heybash
2
2
 
3
+ ## 1.0.2 — 路由与安装兼容修复
4
+
5
+ - 安装时不再自动运行依赖链接脚本,避免 pnpm 严格脚本审批阻断插件安装或升级;脚本仍可在需要排查宿主依赖时手动运行。
6
+ - 修复路由链渠道模型误报不在册及历史重复前缀,并保留已停用路由的成员。
7
+ - 路由链可按成员实际图片能力接收图片;图片请求只尝试明确支持图片的成员。
8
+
9
+ ## 1.0.1 — 模型回退与推理档位修复
10
+
11
+ - CodeArts benefit 模型遇到 APIG.0101 时去掉 benefit 头、重新签名并仅重试一次。
12
+ - 推理路由链提供 Low / High / Max,按每次实际命中的模型转换档位;不支持 Max 时降为 High。只有开关的模型将 Low 映射为关闭,High / Max 映射为开启。
13
+ - 长会话压缩的 CodeArts 请求遇到网络或网关超时,可使用已有同模型路由链回退一次。
14
+ - 侧边栏显示 Heybash-Xdpool,账号池深色按钮改用白色文字。
15
+
3
16
  ## 1.0.0 — Heybash-xdpool 首个独立版本
4
17
 
5
18
  - 独立版本从 1.0.0 开始;npm 包名 `heybash-xdpool`,通过 DSH 插件安装入口直接安装。
package/README.en.md CHANGED
@@ -76,9 +76,17 @@ Measured across four accounts, one pass collected **3300 credits and 135 energy*
76
76
 
77
77
  > **The global region doesn't show this panel** — that gateway has no growth system at all.
78
78
 
79
+ ### 3. Routing-chain reasoning effort
80
+
81
+ Chains containing a reasoning model offer **Low / High / Max**. Each selected member receives a supported native effort: Max falls back to High when Max is unavailable; binary models map Low to off and High / Max to on. The mapping is recalculated for each member.
82
+
83
+ If a CodeArts context-summary call encounters a network or gateway timeout, the plugin can retry once through an existing chain containing that model. This requires a matching chain to be configured; a failed fallback follows normal error handling.
84
+
85
+ A chain accepts images when at least one member explicitly supports them. Requests containing images are sent only to image-capable members, as reported by their channels.
86
+
79
87
  ## Install
80
88
 
81
- Since DSH 0.2.0, settings use peer tabs. Open **Heybash** from the sidebar, or press `Ctrl+Alt+,` and choose **Heybash**.
89
+ Since DSH 0.2.0, settings use peer tabs. Open **Heybash-Xdpool** from the sidebar, or press `Ctrl+Alt+,` and choose **Heybash**.
82
90
 
83
91
  Install Heybash from npm (recommended):
84
92
 
@@ -102,6 +110,8 @@ dsh plugin --profile desktop add "file:/your/project/path/dsh-xdpool-fork"
102
110
 
103
111
  After editing source, rebuild and update the installed plugin, then fully quit and reopen DSH Desktop. Keep the tracked `lib/` build outputs in sync with source.
104
112
 
113
+ The package does not run a dependency-linking script during installation. DeepSeek Harness normally supplies the shared dependencies; if a particular environment cannot resolve them, run `node scripts/link-host-peers.mjs` manually from the installed package to troubleshoot.
114
+
105
115
  The account pools appear as **Heybash(国内版)** and **Heybash(国际版)**; the optional free-model group is **Heybash · 免费模型**.
106
116
 
107
117
  ## Upgrading from an older version
package/README.md CHANGED
@@ -79,9 +79,17 @@ Heybash-xdpool 使用独立版本号,从 **1.0.0** 开始。
79
79
 
80
80
  > **国际版不显示这个面板**——那边的网关压根没有积分系统。
81
81
 
82
+ ### 三、路由链推理强度
83
+
84
+ 包含推理模型的路由链提供 **Low / High / Max**。每次实际请求按候选模型的原生档位转换:不支持 Max 而支持 High 时,Max 降为 High;只有开关的模型将 Low 映射为关闭,High / Max 映射为开启。切换候选时重新计算,不沿用上一个候选的降档结果。
85
+
86
+ 长会话压缩的 CodeArts 请求若遇到网络或网关超时,会使用已有的同模型路由链回退一次。需要已配置包含该 CodeArts 模型的路由链;回退仍失败时保留原错误处理。
87
+
88
+ 路由链只要有明确支持图片的成员即可接收图片;带图片的请求只会尝试支持图片的成员,不会把图片丢给纯文本模型。图片能力取决于各渠道提供的模型信息。
89
+
82
90
  ## 安装
83
91
 
84
- DSH 0.2.0 起,设置面板使用平级标签。安装后从左侧栏 **Heybash** 进入,或按 `Ctrl+Alt+,` 打开设置并选择 **Heybash**。
92
+ DSH 0.2.0 起,设置面板使用平级标签。安装后从左侧栏 **Heybash-Xdpool** 进入,或按 `Ctrl+Alt+,` 打开设置并选择 **Heybash**。
85
93
 
86
94
  从 npm 安装 Heybash(推荐):
87
95
 
@@ -105,6 +113,8 @@ dsh plugin --profile desktop add "file:/你的项目路径/dsh-xdpool-fork"
105
113
 
106
114
  改动源码后需重新构建并更新已安装的插件,再完整退出、重新启动 DSH Desktop。构建产物 `lib/` 随仓库维护,源码和产物应同步提交。
107
115
 
116
+ 安装包不自动执行依赖链接脚本。通常由 DeepSeek Harness 提供插件所需的共享依赖;如特殊环境出现依赖无法解析,可手动运行安装目录下的 `node scripts/link-host-peers.mjs` 进行排查。
117
+
108
118
  模型选择器中的账号池分别显示为 **Heybash(国内版)**、**Heybash(国际版)**,免费模型分组显示为 **Heybash · 免费模型**。
109
119
 
110
120
  ## 从旧版升级
package/lib/client.js CHANGED
@@ -810,8 +810,8 @@ window.__ModuleLoader__.load({
810
810
  .dsm-xdpool-cpool-card .dsm-xdpool-cpool-fold:hover:not(:disabled),.dsm-xdpool-cpool-card .dsm-xdpool-cpool-fold[aria-expanded=true]{border-color:var(--dsw-alias-border-l2,#36373b)}
811
811
  .dsm-xdpool-cpool-card .dsm-xdpool-cpool-fold:hover:not(:disabled){background:color-mix(in srgb, var(--dsw-alias-label-primary,#f2f3f5) 7%, transparent)}
812
812
  .dsm-xdpool-cpool-card .dsm-xdpool-minibtn:hover:not(:disabled){border-color:var(--dsw-alias-border-l2,#36373b);background:color-mix(in srgb, var(--dsw-alias-label-primary,#f2f3f5) 6%, transparent)}
813
- .dsm-xdpool-btn[data-tone="primary"]{border-color:transparent;background:color-mix(in srgb, var(--dsw-alias-brand-primary,#5686fe) 82%, #ffffff 4%);color:#0d1014;font-weight:640}
814
- .dsm-xdpool-btn[data-tone="primary"]:hover:not(:disabled){background:color-mix(in srgb, var(--dsw-alias-brand-primary,#5686fe) 94%, #ffffff 6%);color:#0d1014}
813
+ .dsm-xdpool-btn[data-tone="primary"]{border-color:transparent;background:color-mix(in srgb, var(--dsw-alias-brand-primary,#5686fe) 82%, #ffffff 4%);color:#fff;font-weight:640}
814
+ .dsm-xdpool-btn[data-tone="primary"]:hover:not(:disabled){background:color-mix(in srgb, var(--dsw-alias-brand-primary,#5686fe) 94%, #ffffff 6%);color:#fff}
815
815
  .dsm-xdpool-btn[data-tone="quiet"]{border-color:transparent;background:transparent;color:var(--dsw-alias-label-secondary,#c9ccd1);font-weight:500}
816
816
  .dsm-xdpool-btn[data-tone="claimed"]{border-color:var(--dsw-alias-border-l2,#36373b);background:transparent;color:var(--dsw-alias-label-tertiary,#9aa0a8);font-weight:600;cursor:default}
817
817
  @media (prefers-reduced-motion: reduce){
@@ -10133,11 +10133,17 @@ window.__ModuleLoader__.load({
10133
10133
  * a fallback that never happened. A pool model is its bare id; anything else is
10134
10134
  * `owner/model`, the same composite id the aggregate catalog publishes.
10135
10135
  */
10136
+ function bareForOwner(owner, model) {
10137
+ if (owner === "workbuddy") return model;
10138
+ while (model.startsWith(`${owner}/`) || model.startsWith(`${owner}:`)) model = model.slice(owner.length + 1);
10139
+ return model;
10140
+ }
10136
10141
  function flattenDraft(platforms) {
10137
10142
  const out = [];
10138
10143
  const seen = /* @__PURE__ */ new Set();
10139
10144
  for (const platform of platforms) for (const model of platform.models) {
10140
- const id = platform.owner === "workbuddy" ? model : `${platform.owner}/${model}`;
10145
+ const bare = bareForOwner(platform.owner, model);
10146
+ const id = platform.owner === "workbuddy" ? bare : `${platform.owner}/${bare}`;
10141
10147
  if (seen.has(id)) continue;
10142
10148
  seen.add(id);
10143
10149
  out.push(id);
@@ -10161,16 +10167,21 @@ window.__ModuleLoader__.load({
10161
10167
  * message that names neither the chain nor the field, leaving nothing to act on.
10162
10168
  * Normalising here means every reader below can treat the shape as total.
10163
10169
  */
10164
- const platforms = (Array.isArray(combo.platforms) ? combo.platforms : []).filter((group) => group !== null && typeof group === "object").map((group) => ({
10165
- owner: typeof group.owner === "string" ? group.owner : "workbuddy",
10166
- models: Array.isArray(group.models) ? [...group.models].filter((model) => typeof model === "string") : []
10167
- }));
10170
+ const platforms = (Array.isArray(combo.platforms) ? combo.platforms : []).filter((group) => group !== null && typeof group === "object").map((group) => {
10171
+ const owner = typeof group.owner === "string" ? group.owner : "workbuddy";
10172
+ return {
10173
+ owner,
10174
+ models: Array.isArray(group.models) ? [...new Set(group.models.filter((model) => typeof model === "string").map((model) => bareForOwner(owner, model)))] : []
10175
+ };
10176
+ });
10168
10177
  const known = new Set(Array.isArray(combo.models) ? combo.models : []);
10169
10178
  for (const modelId of Array.isArray(combo.missing) ? combo.missing : []) {
10170
10179
  if (known.has(modelId)) continue;
10171
10180
  const slash = modelId.indexOf("/");
10172
- const owner = slash === -1 ? "workbuddy" : modelId.slice(0, slash);
10173
- const model = slash === -1 ? modelId : modelId.slice(slash + 1);
10181
+ const colon = modelId.indexOf(":");
10182
+ const separator = slash === -1 ? colon : colon === -1 ? slash : Math.min(slash, colon);
10183
+ const owner = separator === -1 ? "workbuddy" : modelId.slice(0, separator);
10184
+ const model = bareForOwner(owner, separator === -1 ? modelId : modelId.slice(separator + 1));
10174
10185
  const group = platforms.find((entry) => entry.owner === owner);
10175
10186
  if (group === void 0) platforms.push({
10176
10187
  owner,
@@ -16411,7 +16422,7 @@ window.__ModuleLoader__.load({
16411
16422
  * @module dsh-xdpool/client/locales
16412
16423
  */
16413
16424
  const en = {
16414
- "row.navLabel": "Heybash",
16425
+ "row.navLabel": "Heybash-Xdpool",
16415
16426
  "row.title": "Account pool",
16416
16427
  "row.desc": "",
16417
16428
  "row.expand": "Expand",
@@ -16521,8 +16532,8 @@ window.__ModuleLoader__.load({
16521
16532
  "row.modelsDiscard": "Discard",
16522
16533
  "row.modelsSaved": "Model selection saved",
16523
16534
  "row.sidebarRowTitle": "Sidebar entry",
16524
- "row.sidebarRowOn": "Heybash has its own row in the left sidebar. Turn it off to open the pool from Settings instead.",
16525
- "row.sidebarRowOff": "The sidebar row is hidden; the pool still opens from Settings → Heybash, and models are unaffected.",
16535
+ "row.sidebarRowOn": "Heybash-Xdpool has its own row in the left sidebar. Turn it off to open the pool from Settings instead.",
16536
+ "row.sidebarRowOff": "The sidebar row is hidden; the pool still opens from Settings → Heybash-Xdpool, and models are unaffected.",
16526
16537
  "row.modelsConflict": "The settings changed elsewhere; review and save again",
16527
16538
  "row.modelsSaveError": "Could not save: {message}",
16528
16539
  "row.modelsEmpty": "No model enabled — enable at least one before saving.",
@@ -16996,7 +17007,7 @@ window.__ModuleLoader__.load({
16996
17007
  "channelpool.note": "Note"
16997
17008
  };
16998
17009
  const zh = {
16999
- "row.navLabel": "Heybash",
17010
+ "row.navLabel": "Heybash-Xdpool",
17000
17011
  "row.title": "账号池",
17001
17012
  "row.desc": "",
17002
17013
  "row.expand": "展开",
@@ -17106,8 +17117,8 @@ window.__ModuleLoader__.load({
17106
17117
  "row.modelsDiscard": "放弃修改",
17107
17118
  "row.modelsSaved": "模型选择已保存",
17108
17119
  "row.sidebarRowTitle": "侧栏入口",
17109
- "row.sidebarRowOn": "左侧栏会给 Heybash 留一行入口。关掉后改为从「设置 → Heybash」进入,模型池不受影响。",
17110
- "row.sidebarRowOff": "侧栏入口已隐藏;仍可从「设置 → Heybash」进入,模型池不受影响。",
17120
+ "row.sidebarRowOn": "左侧栏会给 Heybash-Xdpool 留一行入口。关掉后改为从「设置 → Heybash-Xdpool」进入,模型池不受影响。",
17121
+ "row.sidebarRowOff": "侧栏入口已隐藏;仍可从「设置 → Heybash-Xdpool」进入,模型池不受影响。",
17111
17122
  "row.modelsConflict": "设置已在别处被修改,请确认后重新保存",
17112
17123
  "row.modelsSaveError": "保存失败:{message}",
17113
17124
  "row.modelsEmpty": "至少要启用一个模型才能保存。",
package/lib/index.d.ts CHANGED
@@ -2712,12 +2712,33 @@ interface ComboModelRow {
2712
2712
  contextWindow: number;
2713
2713
  maxOutputTokens: number;
2714
2714
  supportsImages: boolean;
2715
+ /** Chain controls are resolved against each selected member's native ladder. */
2716
+ supportedEfforts?: readonly string[];
2715
2717
  /**
2716
2718
  * Discriminator. Aggregate rows carry `providerId`, pool rows carry neither,
2717
2719
  * and only this shape is `true`.
2718
2720
  */
2719
2721
  combo: true;
2720
2722
  }
2723
+ /**
2724
+ * One model served by a 扫码登录 channel, as the route editor sees it.
2725
+ *
2726
+ * These are the channels the vendored pack registers with the HOST (`trae`,
2727
+ * `qoder`, `codebuddy`…). They are in neither catalog above: the pool catalog
2728
+ * describes the WorkBuddy account lanes, and the aggregate catalog describes the
2729
+ * vendors in this plugin's own registry. A chain could not name them at all, which
2730
+ * is why the routing page offered exactly ONE platform — the pool — while the login
2731
+ * page happily showed thirteen.
2732
+ */
2733
+ interface HostModelRow {
2734
+ /** `<channel>:<modelId>` — the id the shim already resolves to its fifth lane. */
2735
+ id: string;
2736
+ channel: string;
2737
+ modelId: string;
2738
+ name: string;
2739
+ supportsImages?: boolean;
2740
+ supportedEfforts?: readonly string[];
2741
+ }
2721
2742
  /**
2722
2743
  * The aggregate section as it lives on disk.
2723
2744
  *
@@ -3035,6 +3056,8 @@ interface AggregateModelRow {
3035
3056
  contextWindow: number;
3036
3057
  maxOutputTokens: number;
3037
3058
  supportsImages: boolean;
3059
+ /** Optional declared reasoning ladder; absent means unknown. */
3060
+ supportedEfforts?: readonly string[];
3038
3061
  wire: AggregateWire;
3039
3062
  /** `static` from the registry, `discovered` from a live listing. */
3040
3063
  source: 'static' | 'discovered';
@@ -3043,6 +3066,7 @@ interface AggregateModelRow {
3043
3066
  declare class AggregateCatalog {
3044
3067
  private readonly read;
3045
3068
  private readonly poolRows;
3069
+ private readonly hostRows;
3046
3070
  private rows;
3047
3071
  private chainRows;
3048
3072
  /**
@@ -3051,7 +3075,7 @@ declare class AggregateCatalog {
3051
3075
  * that names a WorkBuddy model. A chain may mix pool models with aggregate
3052
3076
  * ones, so without this a perfectly valid chain would lose its pool half.
3053
3077
  */
3054
- constructor(read: () => AggregateStore | Promise<AggregateStore>, poolRows?: () => readonly WorkBuddyModelInfo[]);
3078
+ constructor(read: () => AggregateStore | Promise<AggregateStore>, poolRows?: () => readonly WorkBuddyModelInfo[], hostRows?: () => readonly HostModelRow[]);
3055
3079
  /**
3056
3080
  * Every row this catalog offers: third-party rows first, then chain rows.
3057
3081
  *
@@ -3081,6 +3105,8 @@ interface ChannelLaneRow {
3081
3105
  channel: string;
3082
3106
  modelId: string;
3083
3107
  name: string;
3108
+ supportsImages?: boolean;
3109
+ supportedEfforts?: readonly string[];
3084
3110
  }
3085
3111
  /** One translated event, so the caller decides how to frame it as SSE. */
3086
3112
  type ChannelLaneEvent = {
@@ -4339,6 +4365,24 @@ export declare function poolWebStatus(deps: PoolStatusRouteOptions, region?: Poo
4339
4365
  * make this registration disappear.
4340
4366
  */
4341
4367
  export declare function registerPoolStatusRoute(ctx: Context$1, deps: PoolStatusRouteOptions): void;
4368
+ /**
4369
+ * The routing document the chain editor draws from.
4370
+ *
4371
+ * `missing` is reported rather than silently dropped: the user's chain named a
4372
+ * model that is gone, and the only honest thing is to show them WHICH one. OFM
4373
+ * makes the same choice, for the same reason — a chain that quietly rewrites
4374
+ * itself looks like it obeyed, and the user is the only one who can tell that a
4375
+ * member they paid for is now a fallback to something free.
4376
+ */
4377
+ export declare function combosStatusOf(store: AggregateStore, catalog: AggregateCatalog, poolRows: readonly WorkBuddyModelInfo[],
4378
+ /**
4379
+ * Models served by the 扫码登录 channels, from the host's own registry.
4380
+ *
4381
+ * Passed in rather than fetched here because this function is synchronous and the
4382
+ * host's listing is not. Omitted or empty simply means "no channel member is
4383
+ * offered", which is the behaviour before this parameter existed.
4384
+ */
4385
+ hostRows?: readonly HostModelRow[]): PoolWebCombosStatus;
4342
4386
  /** Stable Cordis plugin name. */
4343
4387
  export declare const name = "llm-xdpool";
4344
4388
  /** The model registry required before the provider can register. */
package/lib/index.js CHANGED
@@ -10910,6 +10910,41 @@ function modelsEndpoint(provider) {
10910
10910
  function hasModelsListing(provider) {
10911
10911
  return typeof provider.modelsUrl === "string" && provider.modelsUrl.trim() !== "";
10912
10912
  }
10913
+ // src/reasoning.ts
10914
+ /** A chain's controls are routing intent; each member resolves to its own ladder. */
10915
+ const CHAIN_REASONING_EFFORTS = [
10916
+ "low",
10917
+ "high",
10918
+ "max"
10919
+ ];
10920
+ const LEVELS = [
10921
+ "minimal",
10922
+ "low",
10923
+ "medium",
10924
+ "high",
10925
+ "xhigh",
10926
+ "max"
10927
+ ];
10928
+ /** Select a real native effort, keeping Max -> High explicit where Max is absent. */
10929
+ function resolveMemberReasoningEffort(requested, supported) {
10930
+ if (supported === void 0) return requested;
10931
+ if (supported.includes(requested)) return requested;
10932
+ const rank = LEVELS.indexOf(requested);
10933
+ if (rank < 0) return void 0;
10934
+ if (supported.includes("on")) return requested === "low" && supported.includes("off") ? "off" : "on";
10935
+ if (requested === "max" && supported.includes("high")) return "high";
10936
+ const native = LEVELS.filter((level) => supported.includes(level));
10937
+ return native.filter((level) => LEVELS.indexOf(level) <= rank).at(-1) ?? native[0];
10938
+ }
10939
+ /** A fresh request per member prevents one fallback's downgrade leaking to the next. */
10940
+ function withMemberReasoningEffort(raw, supported) {
10941
+ const body = JSON.parse(raw);
10942
+ if (typeof body.reasoning_effort !== "string") return raw;
10943
+ const effort = resolveMemberReasoningEffort(body.reasoning_effort, supported);
10944
+ if (effort === void 0) delete body.reasoning_effort;
10945
+ else body.reasoning_effort = effort;
10946
+ return JSON.stringify(body);
10947
+ }
10913
10948
  // src/combos.ts
10914
10949
  /** Id prefix every combo row advertises under. */
10915
10950
  const COMBO_PREFIX = "combo:";
@@ -11115,7 +11150,8 @@ function resolveComboMember(modelId, sources) {
11115
11150
  name: aggregateRow.name,
11116
11151
  contextWindow: aggregateRow.contextWindow,
11117
11152
  maxOutputTokens: aggregateRow.maxOutputTokens,
11118
- supportsImages: aggregateRow.supportsImages
11153
+ supportsImages: aggregateRow.supportsImages,
11154
+ ...aggregateRow.supportedEfforts === void 0 ? {} : { supportedEfforts: aggregateRow.supportedEfforts }
11119
11155
  };
11120
11156
  }
11121
11157
  /**
@@ -11127,21 +11163,28 @@ function resolveComboMember(modelId, sources) {
11127
11163
  * channel first cannot shadow one — and doing it first keeps a channel named after
11128
11164
  * a pool id from being swallowed.
11129
11165
  *
11130
- * The window and image flag are not known for a channel row (the host's listing
11131
- * publishes neither), so the chain's intersection falls back to the documented
11132
- * defaults. That is the honest answer: an unknown window must not be treated as a
11133
- * large one, or the host would size a compaction against a limit nobody promised.
11166
+ * An unknown window uses the conservative default. Image support comes from
11167
+ * resolved host metadata; missing capability metadata is not treated as support.
11134
11168
  */
11135
- const hostRow = sources.host?.find((row) => row.id === id);
11169
+ const hostRow = sources.host?.find((row) => {
11170
+ if (row.id === id) return true;
11171
+ let bare = id;
11172
+ while (bare.startsWith(`${row.channel}/`) || bare.startsWith(`${row.channel}:`)) {
11173
+ bare = bare.slice(row.channel.length + 1);
11174
+ if (bare === row.modelId) return true;
11175
+ }
11176
+ return false;
11177
+ });
11136
11178
  if (hostRow !== void 0) return {
11137
- modelId: id,
11179
+ modelId: hostRow.id,
11138
11180
  aggregate: false,
11139
11181
  host: true,
11140
11182
  channel: hostRow.channel,
11141
11183
  name: hostRow.name,
11142
11184
  contextWindow: COMBO_DEFAULT_CONTEXT_WINDOW,
11143
11185
  maxOutputTokens: COMBO_DEFAULT_MAX_OUTPUT,
11144
- supportsImages: false
11186
+ supportsImages: hostRow.supportsImages === true,
11187
+ ...hostRow.supportedEfforts === void 0 ? {} : { supportedEfforts: hostRow.supportedEfforts }
11145
11188
  };
11146
11189
  const poolRow = sources.pool.find((row) => row.id === id);
11147
11190
  if (poolRow === void 0) return void 0;
@@ -11151,7 +11194,8 @@ function resolveComboMember(modelId, sources) {
11151
11194
  name: poolRow.name,
11152
11195
  contextWindow: poolRow.contextWindow,
11153
11196
  maxOutputTokens: poolRow.maxOutputTokens,
11154
- supportsImages: poolRow.supportsImages
11197
+ supportsImages: poolRow.supportsImages,
11198
+ ...poolRow.supportedEfforts === void 0 ? {} : { supportedEfforts: poolRow.supportedEfforts }
11155
11199
  };
11156
11200
  }
11157
11201
  /**
@@ -11216,11 +11260,16 @@ function buildComboCatalog(chains, sources) {
11216
11260
  const id = isComboId(chain.id ?? "") ? chain.id : comboId(chain.name);
11217
11261
  if (id === "") continue;
11218
11262
  const members = [];
11263
+ const memberIds = /* @__PURE__ */ new Set();
11219
11264
  for (const memberId of chain.models) {
11220
11265
  const member = resolveComboMember(memberId, sources);
11221
- if (member !== void 0) members.push(member);
11266
+ if (member !== void 0 && !memberIds.has(member.modelId)) {
11267
+ memberIds.add(member.modelId);
11268
+ members.push(member);
11269
+ }
11222
11270
  }
11223
11271
  if (members.length === 0) continue;
11272
+ const supportedEfforts = members.some((member) => member.supportedEfforts?.some((effort) => effort !== "off")) ? CHAIN_REASONING_EFFORTS : [];
11224
11273
  rows.push({
11225
11274
  id,
11226
11275
  name: chain.name,
@@ -11229,7 +11278,8 @@ function buildComboCatalog(chains, sources) {
11229
11278
  stickyLimit: typeof chain.stickyLimit === "number" && chain.stickyLimit > 0 ? Math.floor(chain.stickyLimit) : 1,
11230
11279
  contextWindow: Math.min(...members.map((member) => member.contextWindow || 131072)),
11231
11280
  maxOutputTokens: Math.min(...members.map((member) => member.maxOutputTokens || 32768)),
11232
- supportsImages: members.every((member) => member.supportsImages),
11281
+ supportsImages: members.some((member) => member.supportsImages),
11282
+ ...supportedEfforts.length === 0 ? {} : { supportedEfforts },
11233
11283
  combo: true
11234
11284
  });
11235
11285
  }
@@ -12428,6 +12478,7 @@ function buildAggregateCatalog(store) {
12428
12478
  var AggregateCatalog = class {
12429
12479
  read;
12430
12480
  poolRows;
12481
+ hostRows;
12431
12482
  rows = [];
12432
12483
  chainRows = [];
12433
12484
  /**
@@ -12436,9 +12487,10 @@ var AggregateCatalog = class {
12436
12487
  * that names a WorkBuddy model. A chain may mix pool models with aggregate
12437
12488
  * ones, so without this a perfectly valid chain would lose its pool half.
12438
12489
  */
12439
- constructor(read, poolRows = () => []) {
12490
+ constructor(read, poolRows = () => [], hostRows = () => []) {
12440
12491
  this.read = read;
12441
12492
  this.poolRows = poolRows;
12493
+ this.hostRows = hostRows;
12442
12494
  }
12443
12495
  /**
12444
12496
  * Every row this catalog offers: third-party rows first, then chain rows.
@@ -12463,10 +12515,11 @@ var AggregateCatalog = class {
12463
12515
  const next = buildAggregateCatalog(store);
12464
12516
  const chains = buildComboCatalog(combosOf(store), {
12465
12517
  pool: this.poolRows(),
12466
- aggregate: next
12518
+ aggregate: next,
12519
+ host: this.hostRows()
12467
12520
  });
12468
12521
  pruneRotation(combosOf(store));
12469
- if (next.length === this.rows.length && chains.length === this.chainRows.length && next.every((row, index) => row.id === this.rows[index]?.id) && chains.every((row, index) => row.id === this.chainRows[index]?.id)) return this.current();
12522
+ if (JSON.stringify(next) === JSON.stringify(this.rows) && JSON.stringify(chains) === JSON.stringify(this.chainRows)) return this.current();
12470
12523
  this.rows = next;
12471
12524
  this.chainRows = chains;
12472
12525
  for (const listener of this.listeners) listener();
@@ -13333,6 +13386,7 @@ function toAggregateModel(row, baseUrl, providerId) {
13333
13386
  * letting the turn run past it.
13334
13387
  */
13335
13388
  function toComboModel(row, baseUrl, providerId) {
13389
+ const map = thinkingLevelMap(row);
13336
13390
  return {
13337
13391
  id: row.id,
13338
13392
  name: row.name,
@@ -13343,8 +13397,9 @@ function toComboModel(row, baseUrl, providerId) {
13343
13397
  cost: NO_COST,
13344
13398
  contextWindow: row.contextWindow,
13345
13399
  maxTokens: row.maxOutputTokens,
13346
- reasoning: false,
13347
- compat: { supportsReasoningEffort: false }
13400
+ reasoning: map !== void 0,
13401
+ ...map === void 0 ? {} : { thinkingLevelMap: map },
13402
+ compat: { supportsReasoningEffort: map !== void 0 }
13348
13403
  };
13349
13404
  }
13350
13405
  /**
@@ -13358,14 +13413,7 @@ function toComboModel(row, baseUrl, providerId) {
13358
13413
  */
13359
13414
  function toExtraLaneModel(row, baseUrl, providerId) {
13360
13415
  const efforts = "efforts" in row && Array.isArray(row.efforts) && row.efforts.length > 0 ? row.efforts : void 0;
13361
- const map = efforts === void 0 ? void 0 : thinkingLevelMap({
13362
- id: row.id,
13363
- name: row.name,
13364
- contextWindow: row.contextWindow,
13365
- maxOutputTokens: row.maxOutput,
13366
- supportsImages: row.vision,
13367
- supportedEfforts: efforts
13368
- });
13416
+ const map = efforts === void 0 ? void 0 : thinkingLevelMap({ supportedEfforts: efforts });
13369
13417
  return {
13370
13418
  id: row.modelId,
13371
13419
  name: row.name,
@@ -18727,6 +18775,70 @@ function recordStartupNote(line) {
18727
18775
  } catch {}
18728
18776
  return text;
18729
18777
  }
18778
+ // src/compaction-recovery.ts
18779
+ /** Match transport/gateway failures without retrying auth, quota, or bad input. */
18780
+ function transportFailure(value) {
18781
+ if (value === null || typeof value !== "object") return false;
18782
+ const error = value;
18783
+ if ([
18784
+ 408,
18785
+ 502,
18786
+ 503,
18787
+ 504
18788
+ ].includes(Number(error.status ?? error.statusCode))) return true;
18789
+ if (typeof error.code === "string" && /^(?:TRANSPORT|NETWORK|TIMEOUT|ECONNRESET|ECONNREFUSED|EPIPE|ETIMEDOUT|ENOTFOUND|UND_ERR_CONNECT_TIMEOUT|UND_ERR_HEADERS_TIMEOUT|UND_ERR_BODY_TIMEOUT|UND_ERR_SOCKET)$/u.test(error.code)) return true;
18790
+ if (typeof error.message === "string" && /fetch failed|network error|socket hang up|\bHTTP (?:408|502|503|504)\b|\bAPIG\.0203\b/iu.test(error.message)) return true;
18791
+ return error.cause !== value && error.cause !== void 0 ? transportFailure(error.cause) : false;
18792
+ }
18793
+ function failedFinish(chunk) {
18794
+ return chunk.type === "finish" && chunk.reason.kind === "error" ? chunk.reason.failure : void 0;
18795
+ }
18796
+ /**
18797
+ * A compaction is an auxiliary call and bypasses the agent's normal request retry.
18798
+ * Buffer its first attempt so a transport failure cannot mix partial summaries.
18799
+ * Ordinary CodeArts calls keep their own behavior, including the benefit retry.
18800
+ */
18801
+ function recoverCompactionStream(options, next, recovery) {
18802
+ if (options.purpose !== "compaction" || options.provider !== "codearts") return next();
18803
+ return (async function* () {
18804
+ const initial = [];
18805
+ let thrown;
18806
+ let failure;
18807
+ try {
18808
+ for await (const chunk of next()) {
18809
+ initial.push(chunk);
18810
+ if (failedFinish(chunk) !== void 0) failure = failedFinish(chunk);
18811
+ }
18812
+ } catch (error) {
18813
+ thrown = error;
18814
+ failure = error;
18815
+ }
18816
+ const target = !options.signal?.aborted && transportFailure(failure) ? recovery.target() : void 0;
18817
+ if (target === void 0 || target.provider === options.provider && target.model === options.model) {
18818
+ if (thrown !== void 0) throw thrown;
18819
+ yield* initial;
18820
+ return;
18821
+ }
18822
+ const from = {
18823
+ provider: options.provider,
18824
+ model: options.model
18825
+ };
18826
+ const replacement = [];
18827
+ let replacementCompleted = false;
18828
+ for await (const chunk of recovery.stream({
18829
+ ...options,
18830
+ ...target
18831
+ })) {
18832
+ replacement.push(chunk);
18833
+ if (chunk.type === "finish") replacementCompleted = chunk.reason.kind === "stop";
18834
+ }
18835
+ if (replacementCompleted) {
18836
+ if (!Object.isFrozen(options)) Object.assign(options, target);
18837
+ recovery.recovered?.(from, target);
18838
+ }
18839
+ yield* replacement;
18840
+ })();
18841
+ }
18730
18842
  // src/model-switch-bridge.ts
18731
18843
  /**
18732
18844
  * The lane id the host's picker uses for each region.
@@ -19195,6 +19307,60 @@ function paidAlternativeFor(model, models) {
19195
19307
  }
19196
19308
  // src/channel-lane.ts
19197
19309
  /**
19310
+ * The channel lane: 扫码登录 vendors served through the host's own LLM seam.
19311
+ *
19312
+ * ## Why this is a separate lane
19313
+ *
19314
+ * Every other lane reaches its upstream over HTTP this plugin owns: the pool
19315
+ * posts to WorkBuddy, the aggregate lane posts to a provider the user keyed, the
19316
+ * free lane posts to a pooled gateway. The login channels do not work that way.
19317
+ * `vendor/channel-pack` registers each one as a HOST adapter
19318
+ * (`llm.registerAdapter([product.id], adapter)`) — the credential, the wire
19319
+ * dialect and the endpoint all belong to the pack, and there is no
19320
+ * OpenAI-compatible port for a client to point at.
19321
+ *
19322
+ * So this lane opens no socket. It calls `ctx.llm`, which already knows how to
19323
+ * reach every registered provider, and translates between the two vocabularies.
19324
+ * The listing is built the same way, from `llm.listModels`, which is what the
19325
+ * card's own model list already calls: a channel that is not signed in throws,
19326
+ * the throw becomes "contributes nothing", and the gateway therefore cannot
19327
+ * advertise a channel the card would not show.
19328
+ *
19329
+ * ## What is translated
19330
+ *
19331
+ * The host stream vocabulary is `block-start | text-delta | reasoning-delta |
19332
+ * tool-call-delta | block-end | usage | finish` (dsh-llm `types.d.ts`), and each
19333
+ * of the four that carry content has an OpenAI spelling, so nothing is dropped on
19334
+ * the way out — including tool calls, which a gateway that silently swallowed
19335
+ * them would make look like a model that refuses to use tools.
19336
+ *
19337
+ * On the way in, every message becomes the host's `content: ContentBlock[]`;
19338
+ * a bare string is rejected by the host's own validation, which is the exact bug
19339
+ * fixed in `model-probe.ts`, so this lane does not repeat it.
19340
+ *
19341
+ * Images must go through the host's durable attachment store, for the same
19342
+ * reason: the typed `ImageBlock` (dsh-llm `types.d.ts`) has no `url` field at
19343
+ * all — only `attachment: ImageAttachmentRef`. A base64 `image_url` part is
19344
+ * therefore decoded and handed to `attachments.saveImage`, and the reference that
19345
+ * comes back is what goes into the block. Emitting `{ type: 'image', url }` is
19346
+ * the failure mode this note exists for: the host does not reject it, it simply
19347
+ * is not an image as far as the host is concerned, so the picture is dropped and
19348
+ * the model narrates the text alone — a solid red square came back described as
19349
+ * white, with a token count that proved nothing had arrived. A remote `http(s)`
19350
+ * URL is refused rather than fetched, matching the pack's own bridge, so the
19351
+ * gateway never becomes a fetch primitive on someone else's behalf.
19352
+ *
19353
+ * ## One deliberate difference from the pool lane
19354
+ *
19355
+ * The pool forces `stream: true` (`prepareChatBody`), so a client asking for a
19356
+ * non-streaming completion still receives SSE from it. This lane honours
19357
+ * `stream: false`. Copying the deviation would make the gateway's behaviour
19358
+ * depend on which lane a model happens to sit in — the kind of difference a
19359
+ * client cannot see coming and discovers as a parse error.
19360
+ *
19361
+ * @module dsh-xdpool/channel-lane
19362
+ */
19363
+ /**
19198
19364
  * A request this lane will not serve as written, and that is the caller's to fix.
19199
19365
  *
19200
19366
  * Kept as its own type so the route can answer 400 for it: a refused image and a
@@ -19274,11 +19440,22 @@ function createChannelLane(options) {
19274
19440
  if (hit !== void 0 && Date.now() - hit.at < LISTING_TTL_MS) return Promise.resolve(hit.rows);
19275
19441
  const running = inflight.get(channel);
19276
19442
  if (running !== void 0) return running;
19277
- const tracked = llm.listModels(channel).then((models) => models.map((model) => ({
19278
- id: toId(channel, model.id),
19279
- channel,
19280
- modelId: model.id,
19281
- name: model.name ?? model.id
19443
+ const tracked = llm.listModels(channel).then((models) => Promise.all(models.map(async (model) => {
19444
+ let supportedEfforts;
19445
+ let supportsImages;
19446
+ if (llm.resolveModelInfo !== void 0) try {
19447
+ const info = await llm.resolveModelInfo(channel, model.id);
19448
+ if (Array.isArray(info.inputModalities)) supportsImages = info.inputModalities.includes("image");
19449
+ supportedEfforts = [...new Set((info.reasoning?.efforts ?? []).map((effort) => effort.id === "on" ? "high" : effort.id))];
19450
+ } catch {}
19451
+ return {
19452
+ id: toId(channel, model.id),
19453
+ channel,
19454
+ modelId: model.id,
19455
+ name: model.name ?? model.id,
19456
+ ...supportsImages === void 0 ? {} : { supportsImages },
19457
+ ...supportedEfforts === void 0 ? {} : { supportedEfforts }
19458
+ };
19282
19459
  }))).catch((error) => {
19283
19460
  logger?.warn?.(`heybash-xdpool: channel ${channel} listed no models: ${String(error)}`);
19284
19461
  return [];
@@ -19347,9 +19524,10 @@ async function toHostMessage(message, attachments) {
19347
19524
  });
19348
19525
  continue;
19349
19526
  }
19527
+ if (block.type === "image" || block.type === "input_image") throw new ChannelRequestError("unsupported image part format; use an image_url data URL");
19350
19528
  if (block.type === "image_url" && typeof block.image_url === "object" && block.image_url !== null) {
19351
19529
  const url = block.image_url.url;
19352
- if (typeof url !== "string" || url.trim() === "") continue;
19530
+ if (typeof url !== "string" || url.trim() === "") throw new ChannelRequestError("image_url part has no image URL");
19353
19531
  if (attachments === void 0) throw new ChannelRequestError("this gateway build has no attachment store, so images cannot be forwarded");
19354
19532
  const reading = interpretImagePart(url);
19355
19533
  if (!reading.ok) throw new ChannelRequestError(reading.reason);
@@ -19361,7 +19539,9 @@ async function toHostMessage(message, attachments) {
19361
19539
  type: "image",
19362
19540
  attachment: ref
19363
19541
  });
19542
+ continue;
19364
19543
  }
19544
+ if (block.type === "image_url") throw new ChannelRequestError("image_url part has no image URL");
19365
19545
  }
19366
19546
  return {
19367
19547
  role,
@@ -19436,11 +19616,24 @@ async function* runTurn(input) {
19436
19616
  messages: converted.filter((message) => message.role !== "system"),
19437
19617
  signal
19438
19618
  };
19439
- if (system.length > 0) options.system = system[0].content;
19619
+ if (system.length > 0) options.system = system.map((message) => message.content.map((block) => typeof block.text === "string" ? block.text : "").join("")).join("\n\n");
19440
19620
  if (typeof body.max_tokens === "number") options.maxTokens = body.max_tokens;
19441
19621
  if (typeof body.temperature === "number") options.temperature = body.temperature;
19442
- if (Array.isArray(body.tools) && body.tools.length > 0) options.tools = body.tools;
19622
+ if (Array.isArray(body.tools) && body.tools.length > 0) options.tools = body.tools.map((tool) => {
19623
+ const fn = tool.function;
19624
+ return typeof fn === "object" && fn !== null ? fn : tool;
19625
+ });
19626
+ if (typeof body.reasoning_effort === "string" && body.reasoning_effort.trim() !== "") {
19627
+ const requested = body.reasoning_effort.trim();
19628
+ let selected = requested;
19629
+ if (llm.resolveModelInfo !== void 0) selected = resolveMemberReasoningEffort(requested, (await llm.resolveModelInfo(channel, modelId, signal)).reasoning?.efforts.map((effort) => effort.id) ?? []) ?? "";
19630
+ if (selected !== "") options.reasoningEffort = selected;
19631
+ }
19443
19632
  for await (const chunk of llm.stream(options)) {
19633
+ if (chunk.type === "finish" && typeof chunk.reason === "object" && chunk.reason !== null && chunk.reason.kind === "error") {
19634
+ const failure = chunk.reason.failure;
19635
+ throw new Error(typeof failure?.message === "string" ? failure.message : `channel ${channel} model request failed`);
19636
+ }
19444
19637
  const event = toChannelEvent(chunk);
19445
19638
  if (event !== void 0) yield event;
19446
19639
  }
@@ -20261,9 +20454,22 @@ function createWorkBuddyShim(options) {
20261
20454
  const store = aggregate?.readStore();
20262
20455
  const sources = {
20263
20456
  pool: catalog.current(),
20264
- aggregate: aggregate === void 0 ? [] : aggregate.catalog.providerRows()
20457
+ aggregate: aggregate === void 0 ? [] : aggregate.catalog.providerRows(),
20458
+ host: channels === void 0 ? [] : await channels.rows()
20265
20459
  };
20266
- const members = comboChain(row).map((modelId) => resolveComboMember(modelId, sources)).filter((member) => member !== void 0);
20460
+ let members = comboChain(row).map((modelId) => resolveComboMember(modelId, sources)).filter((member) => member !== void 0);
20461
+ const body = JSON.parse(raw);
20462
+ if (Array.isArray(body.messages) && body.messages.some((message) => Array.isArray(message.content) && message.content.some((part) => typeof part === "object" && part !== null && [
20463
+ "image_url",
20464
+ "input_image",
20465
+ "image"
20466
+ ].includes(String(part.type))))) {
20467
+ members = members.filter((member) => member.supportsImages);
20468
+ if (members.length === 0) {
20469
+ writeOpenAIError(res, 400, "combo_no_image_member", `chain ${row.id} has no image-capable member available`);
20470
+ return;
20471
+ }
20472
+ }
20267
20473
  if (members.length === 0) {
20268
20474
  writeOpenAIError(res, 503, "combo_empty", `chain ${row.id} has no member model available right now`);
20269
20475
  return;
@@ -20416,10 +20622,10 @@ function createWorkBuddyShim(options) {
20416
20622
  noteSwitch(member.modelId, why.reason, last.status);
20417
20623
  continue;
20418
20624
  }
20419
- const memberRaw = JSON.stringify({
20625
+ const memberRaw = withMemberReasoningEffort(JSON.stringify({
20420
20626
  ...JSON.parse(raw),
20421
20627
  model: member.modelId
20422
- });
20628
+ }), member.supportedEfforts);
20423
20629
  const prepared = client.prepareChatBodyFor(memberRaw, region ?? "cn");
20424
20630
  const result = await client.chatStream(account.credential, prepared, memberSignal, conversationKey);
20425
20631
  if (result.ok) {
@@ -20476,7 +20682,7 @@ function createWorkBuddyShim(options) {
20476
20682
  }
20477
20683
  const frames = [];
20478
20684
  try {
20479
- await forwardAggregateStreamed(resolved, parsed.modelId, withBareModelId(raw, parsed.modelId), {
20685
+ await forwardAggregateStreamed(resolved, parsed.modelId, withMemberReasoningEffort(withBareModelId(raw, parsed.modelId), member.supportedEfforts), {
20480
20686
  signal: memberSignal,
20481
20687
  onData: (payload) => frames.push(payload),
20482
20688
  ...usageRecorder === void 0 ? {} : { usage: {
@@ -22264,29 +22470,37 @@ function combosStatusOf(store, catalog, poolRows, hostRows = []) {
22264
22470
  };
22265
22471
  }),
22266
22472
  ...hostRows.map((row) => ({
22267
- id: row.id,
22473
+ id: `${row.channel}/${row.modelId}`,
22268
22474
  name: row.name,
22269
22475
  owner: row.channel,
22270
22476
  usable: true,
22271
22477
  contextWindow: COMBO_DEFAULT_CONTEXT_WINDOW,
22272
- supportsImages: false,
22478
+ supportsImages: row.supportsImages === true,
22273
22479
  siblings: []
22274
22480
  }))
22275
22481
  ];
22276
- const known = new Set(candidates.map((candidate) => candidate.id));
22482
+ const sources = {
22483
+ pool: poolRows,
22484
+ aggregate: providerRows,
22485
+ host: hostRows
22486
+ };
22487
+ const displayId = (id) => {
22488
+ const host = hostRows.find((row) => row.id === id);
22489
+ return host === void 0 ? id : `${host.channel}/${host.modelId}`;
22490
+ };
22277
22491
  return {
22278
22492
  combos: chains.map((chain) => {
22279
- const resolved = buildComboCatalog([chain], {
22280
- pool: poolRows,
22281
- aggregate: providerRows,
22282
- host: hostRows
22283
- })[0];
22493
+ const resolved = buildComboCatalog([{
22494
+ ...chain,
22495
+ enabled: true
22496
+ }], sources)[0];
22497
+ const displayModels = [...new Set((resolved?.models ?? []).map(displayId))];
22284
22498
  return {
22285
22499
  id: resolved?.id ?? comboId(chain.name),
22286
22500
  name: chain.name,
22287
- models: resolved?.models ?? [],
22288
- platforms: splitPlatforms(resolved?.models ?? []),
22289
- missing: chain.models.filter((modelId) => !known.has(modelId)),
22501
+ models: displayModels,
22502
+ platforms: splitPlatforms(displayModels),
22503
+ missing: chain.models.filter((modelId) => resolveComboMember(modelId, sources) === void 0),
22290
22504
  strategy: resolved?.strategy ?? chain.strategy ?? "fallback",
22291
22505
  stickyLimit: resolved?.stickyLimit ?? chain.stickyLimit ?? 1,
22292
22506
  enabled: chain.enabled !== false,
@@ -22767,8 +22981,23 @@ function apply(ctx, config = {}) {
22767
22981
  const storedLedger = current().automationEarnings;
22768
22982
  if (storedLedger !== void 0) core.scheduler.applyEarningsLedger(storedLedger);
22769
22983
  const usageRecorder = new UsageRecorder();
22770
- const aggregateCatalog = new AggregateCatalog(() => readAggregateSettingsSync(), () => core.catalogs.cn.current());
22984
+ let hostRosterCache = [];
22985
+ const aggregateCatalog = new AggregateCatalog(() => readAggregateSettingsSync(), () => core.catalogs.cn.current(), () => hostRosterCache);
22771
22986
  aggregateCatalog.refresh();
22987
+ ctx.on("llm/stream", (options, next) => recoverCompactionStream(options, next, {
22988
+ target: () => {
22989
+ const matching = aggregateCatalog.comboRows().find((row) => row.models.some((model) => model === options.model || model === `${options.provider}:${options.model}` || model === `${options.provider}/${options.model}`));
22990
+ if (matching !== void 0) recordStartupNote(`compaction transport retry ${options.provider}/${options.model} -> ${XDPOOL_AGGREGATE_PROVIDER}/${matching.id}`);
22991
+ return matching === void 0 ? void 0 : {
22992
+ provider: XDPOOL_AGGREGATE_PROVIDER,
22993
+ model: matching.id
22994
+ };
22995
+ },
22996
+ stream: (request) => ctx.llm.stream(request),
22997
+ recovered: (from, to) => {
22998
+ recordStartupNote(`compaction transport recovery ${from.provider}/${from.model} -> ${to.provider}/${to.model}`);
22999
+ }
23000
+ }), { global: true });
22772
23001
  const freeCatalog = new FreeCatalog();
22773
23002
  freeLaneSwitch = (enabled) => {
22774
23003
  freeCatalog.setEnabled(enabled);
@@ -22817,14 +23046,15 @@ function apply(ctx, config = {}) {
22817
23046
  * The two pool-owned channels are excluded by `channelLane` itself, so the same
22818
23047
  * model cannot appear once as a pool row and again as a channel row.
22819
23048
  */
22820
- let hostRosterCache = [];
22821
23049
  const hostRoster = async () => {
22822
23050
  try {
22823
23051
  hostRosterCache = (await channelLane.rows()).map((row) => ({
22824
23052
  id: row.id,
22825
23053
  channel: row.channel,
22826
23054
  modelId: row.modelId,
22827
- name: row.name
23055
+ name: row.name,
23056
+ ...row.supportsImages === void 0 ? {} : { supportsImages: row.supportsImages },
23057
+ ...row.supportedEfforts === void 0 ? {} : { supportedEfforts: row.supportedEfforts }
22828
23058
  }));
22829
23059
  } catch (error) {
22830
23060
  ctx.logger?.warn?.("heybash-xdpool: could not list login-channel models:", error);
@@ -23009,6 +23239,8 @@ function apply(ctx, config = {}) {
23009
23239
  },
23010
23240
  refreshCatalog: async () => {
23011
23241
  const result = await seedCatalog();
23242
+ await hostRoster();
23243
+ await aggregateCatalog.refresh();
23012
23244
  invalidateCatalog();
23013
23245
  return result;
23014
23246
  },
@@ -23208,6 +23440,8 @@ function apply(ctx, config = {}) {
23208
23440
  const accounts = await core.pool.scan();
23209
23441
  ctx.logger.info?.(`heybash-xdpool: discovered ${accounts.length} account(s)`);
23210
23442
  await seedCatalog();
23443
+ await hostRoster();
23444
+ await aggregateCatalog.refresh();
23211
23445
  invalidateCatalog();
23212
23446
  return accounts.length;
23213
23447
  },
@@ -23436,6 +23670,8 @@ function apply(ctx, config = {}) {
23436
23670
  });
23437
23671
  (async () => {
23438
23672
  await seedCatalog();
23673
+ await hostRoster();
23674
+ await aggregateCatalog.refresh();
23439
23675
  invalidateCatalog();
23440
23676
  })().catch((error) => {
23441
23677
  ctx.logger.warn("heybash-xdpool: account catalog seed failed", error);
@@ -23444,4 +23680,4 @@ function apply(ctx, config = {}) {
23444
23680
  ctx.logger.error("heybash-xdpool: shim failed to listen", error);
23445
23681
  });
23446
23682
  }
23447
- export { APPEARANCE_THEME_KEY, AUTOMATION_JOB_KINDS, AUTOMATION_TICK_MS, BUDDY_APP_ID, BUDDY_APP_NAME, Config, DEFAULT_AUTOMATION_HOURS, DEFAULT_CONTEXT_BUDGET, EVENT_SCORE_WAIT_MS, FALLBACK_WORKBUDDY_MODELS, IGNORED_FILE_NAME, LIBRARY_DOC_URL, LIGHTHOUSE_EXPERT_ID, PLAYBOOK_CASE_ID, PLAYBOOK_CASE_NAME, PLUGIN_DATA_DIR_NAME, POOL_ACCOUNT_IGNORE_PATH, POOL_AUTOMATION_RUN_PATH, POOL_CHECKIN_PATH, POOL_CREDIT_RESERVE_PATH, POOL_MODELS_SAVE_PATH, POOL_RESCAN_PATH, POOL_RESET_COOLDOWN_PATH, POOL_STATUS_PATH, SKILL_ID, SKILL_NAME, TEMPLATE_PRESETS, WORKBUDDY_AUTH_FILE_ENV, WORKBUDDY_LIVE_FILENAME, WorkBuddyAccountPool, WorkBuddyCatalog, WorkBuddyScheduler, WorkBuddyUpstreamClient, XDPOOL_PROVIDER, XDPOOL_SETTINGS_NS, appearanceChain, apply, automationChain, automationOptions, buddyAppChain, buddyAppEvents, buildStatus, candidateAuthDirs, canvasChain, chatChain, classifyUpstreamError, createCore, createWorkBuddyAdapter, createWorkBuddyShim, currentApi, dayKey, defaultDesktopAuthDirs, desktopAutomationCreatedEvent, desktopCanvasEvents, desktopChatEvents, dshHome, expertActualUseEvent, expertChatEvents, expertSummonEvents, formatRates, formatStatus, ignoreAccount, ignoredIdsPath, inject, isAutomationJobKind, isFireHour, libraryReadChain, modelSelectionKeyFor, name, parseRateLimitReset, parseWorkBuddyAuth, playbookChain, pluginDataDir, poolWebStatus, preferredIdPath, readIgnoredAccounts, readIgnoredAccountsSync, readPreferredId, readPreferredIdSync, registerPoolStatusRoute, setApi, skillChain, templateChain, templateChains, unignoreAccount, workbuddyAccountId, writeIgnoredAccounts, writePreferredId };
23683
+ export { APPEARANCE_THEME_KEY, AUTOMATION_JOB_KINDS, AUTOMATION_TICK_MS, BUDDY_APP_ID, BUDDY_APP_NAME, Config, DEFAULT_AUTOMATION_HOURS, DEFAULT_CONTEXT_BUDGET, EVENT_SCORE_WAIT_MS, FALLBACK_WORKBUDDY_MODELS, IGNORED_FILE_NAME, LIBRARY_DOC_URL, LIGHTHOUSE_EXPERT_ID, PLAYBOOK_CASE_ID, PLAYBOOK_CASE_NAME, PLUGIN_DATA_DIR_NAME, POOL_ACCOUNT_IGNORE_PATH, POOL_AUTOMATION_RUN_PATH, POOL_CHECKIN_PATH, POOL_CREDIT_RESERVE_PATH, POOL_MODELS_SAVE_PATH, POOL_RESCAN_PATH, POOL_RESET_COOLDOWN_PATH, POOL_STATUS_PATH, SKILL_ID, SKILL_NAME, TEMPLATE_PRESETS, WORKBUDDY_AUTH_FILE_ENV, WORKBUDDY_LIVE_FILENAME, WorkBuddyAccountPool, WorkBuddyCatalog, WorkBuddyScheduler, WorkBuddyUpstreamClient, XDPOOL_PROVIDER, XDPOOL_SETTINGS_NS, appearanceChain, apply, automationChain, automationOptions, buddyAppChain, buddyAppEvents, buildStatus, candidateAuthDirs, canvasChain, chatChain, classifyUpstreamError, combosStatusOf, createCore, createWorkBuddyAdapter, createWorkBuddyShim, currentApi, dayKey, defaultDesktopAuthDirs, desktopAutomationCreatedEvent, desktopCanvasEvents, desktopChatEvents, dshHome, expertActualUseEvent, expertChatEvents, expertSummonEvents, formatRates, formatStatus, ignoreAccount, ignoredIdsPath, inject, isAutomationJobKind, isFireHour, libraryReadChain, modelSelectionKeyFor, name, parseRateLimitReset, parseWorkBuddyAuth, playbookChain, pluginDataDir, poolWebStatus, preferredIdPath, readIgnoredAccounts, readIgnoredAccountsSync, readPreferredId, readPreferredIdSync, registerPoolStatusRoute, setApi, skillChain, templateChain, templateChains, unignoreAccount, workbuddyAccountId, writeIgnoredAccounts, writePreferredId };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "heybash-xdpool",
3
3
  "displayName": "Heybash",
4
4
  "description": "Heybash model pool for DeepSeek Harness: account rotation, provider aggregation, routing chains, usage insights and a local OpenAI-compatible gateway.",
5
- "version": "1.0.0",
5
+ "version": "1.0.2",
6
6
  "license": "MIT",
7
7
  "author": "Heybash",
8
8
  "contributors": [
@@ -62,8 +62,7 @@
62
62
  "prepublishOnly": "tsdown",
63
63
  "test": "vitest run",
64
64
  "typecheck": "tsc -p tsconfig.json --noEmit",
65
- "typecheck:client": "tsc -p tsconfig.client.json --noEmit",
66
- "postinstall": "node scripts/link-host-peers.mjs"
65
+ "typecheck:client": "tsc -p tsconfig.client.json --noEmit"
67
66
  },
68
67
  "dsh": {
69
68
  "bundle": {
@@ -32689,6 +32689,10 @@ var CHAT_API_BASE = "https://snap-access.cn-north-4.myhuaweicloud.com/api/v2";
32689
32689
  var PROVIDER = "codearts";
32690
32690
  var BENEFIT_NOT_FOUND_CODE = "BENEFIT_NOT_FOUND";
32691
32691
  var CODEARTS_BENEFIT_NOT_FOUND_ERROR_CODE = "InferHub.4004.200";
32692
+ // [patch:codearts-benefit-apig] benefit 通道被拒(APIG.0101 / 404)≠ 凭据或模型无效:
32693
+ // 同凭据对照实测,去掉 maas_type: benefit 头即恢复 200。单独一个错误码,
32694
+ // 供调用侧只对该情形做一次有限回退(不重复循环)。
32695
+ var BENEFIT_HEADER_REJECTED_CODE = "BENEFIT_HEADER_REJECTED";
32692
32696
  var DEFAULT_MODELS = [
32693
32697
  "GLM-5.2",
32694
32698
  "GLM-5.1",
@@ -33472,7 +33476,8 @@ var CodeArtsAdapter = class extends LlmAdapter {
33472
33476
  throw new LlmError2(message2, QUOTA_EXCEEDED_CODE, { status: 200 });
33473
33477
  }
33474
33478
  if (error instanceof SseQueueRetryError) {
33475
- } else if (error instanceof LlmError2 && error.code === BENEFIT_NOT_FOUND_CODE && isBenefitModel && !benefitHeaderDropped) {
33479
+ } else if (error instanceof LlmError2 && (error.code === BENEFIT_NOT_FOUND_CODE || error.code === BENEFIT_HEADER_REJECTED_CODE) && isBenefitModel && !benefitHeaderDropped) {
33480
+ // [patch:codearts-benefit-apig] One header-free retry, shared with the existing benefit fallback.
33476
33481
  benefitHeaderDropped = true;
33477
33482
  continue;
33478
33483
  } else {
@@ -33481,6 +33486,12 @@ var CodeArtsAdapter = class extends LlmAdapter {
33481
33486
  }
33482
33487
  } else {
33483
33488
  const errorText = await response.text().catch(() => "");
33489
+ // [patch:codearts-benefit-apig] benefit 通道被拒:404 或 APIG.0101 —— 去掉 maas_type 重签重试一次;
33490
+ // benefitHeaderDropped 置位后不会再走这里,失败即按普通错误抛出,不会循环。
33491
+ if (isBenefitModel && !benefitHeaderDropped && (response.status === 404 || errorText.includes("APIG.0101"))) {
33492
+ benefitHeaderDropped = true;
33493
+ continue;
33494
+ }
33484
33495
  if (isAuthError(response.status, errorText) && !authRefreshed) {
33485
33496
  authRefreshed = true;
33486
33497
  // [xdpool-local] auth failure rotates the account, not just refresh it.
@@ -33731,6 +33742,11 @@ var CodeArtsAdapter = class extends LlmAdapter {
33731
33742
  if (data.error_code === CODEARTS_BENEFIT_NOT_FOUND_ERROR_CODE) {
33732
33743
  throw new LlmError2(`codearts: ${message2}`, BENEFIT_NOT_FOUND_CODE, { status: 200 });
33733
33744
  }
33745
+ // [patch:codearts-benefit-apig] 同样的问题也可能以 200 + SSE error frame 出现,
33746
+ // 且插件的报错只带 error_msg,丢了 error_code(本机 10:06 即此路径)。
33747
+ if (data.error_code.includes("APIG.0101") || message2.includes("APIG.0101")) {
33748
+ throw new LlmError2(`codearts: ${data.error_code} ${message2}`, BENEFIT_HEADER_REJECTED_CODE, { status: 200 });
33749
+ }
33734
33750
  throw new LlmError2(`codearts: ${message2}`, "INVALID_REQUEST", { status: 200 });
33735
33751
  }
33736
33752
  const choice = data.choices?.[0];