dsh-xdpool 2.6.4 → 2.6.6

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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "dsh-xdpool",
3
3
  "displayName": "DSH XD Pool",
4
4
  "description": "One DSH model pool for every free quota you have: merge all locally signed-in WorkBuddy accounts with auto-failover, sign in to 13 vendors by QR/web, aggregate 76 vendors' free tiers, plus a usage dashboard, model routing, a local OpenAI-compatible gateway and a points-automation suite.",
5
- "version": "2.6.4",
5
+ "version": "2.6.6",
6
6
  "license": "MIT",
7
7
  "author": "XDTrees",
8
8
  "homepage": "https://github.com/XDTrees/dsh-xdpool#readme",
@@ -1,46 +1,50 @@
1
1
  /**
2
2
  * Link the host-provided peer dependencies into this package's node_modules.
3
3
  *
4
- * WHY THIS IS NEEDED
4
+ * WHY THIS EXISTS
5
5
  *
6
- * Seven of this plugin's dependencies are `peerDependencies`: they are supplied by the
7
- * host, not by npm. A manual copy of the package into `node_modules/dsh-xdpool` resolved
8
- * them by walking up to the host's own tree, so nothing was ever missing. Installing
9
- * normally breaks that walk: the package ends up beside the host rather than inside it,
10
- * and `import` fails with
6
+ * Seven of this plugin's dependencies are `peerDependencies`: the host supplies them, not
7
+ * npm. A manual copy of the package into `node_modules/dsh-xdpool` resolved them by walking
8
+ * up into the host's tree, so nothing was ever missing. Installing normally breaks that
9
+ * walk, and a top-level import failure prevents `apply()` from ever running — so EVERY web
10
+ * route is unregistered and the card renders empty while blaming the gateway.
11
11
  *
12
- * Cannot find package '@earendil-works/pi-ai'
12
+ * WHAT IT MAY NOT DO: FAIL THE INSTALL
13
13
  *
14
- * which — being a top-level import failure — prevents `apply()` from ever running, so
15
- * EVERY web route is unregistered and the card renders empty while blaming the gateway.
14
+ * The script links what it can find and then stops. It does not exit non-zero when the
15
+ * host cannot be located, for a reason that two bug reports made concrete:
16
16
  *
17
- * WHAT IT DOES
17
+ * - A PACKAGED host keeps its dependencies inside `app.asar`, and `fs.existsSync` in a
18
+ * plain Node process cannot see inside an asar archive — only Electron's patched `fs`
19
+ * can. So "not found" from here often means "invisible to this process", not "absent".
20
+ * - The host resolves these peers itself at runtime. 2.6.3 shipped with no postinstall at
21
+ * all and loaded fine on macOS for exactly that reason.
18
22
  *
19
- * For each peer dependency, find a copy the host actually runs with and point
20
- * `node_modules/<name>` at it. Junctions on Windows, symlinks elsewhere. Skipped when a
21
- * copy already resolves — an operator who installed a peer deliberately keeps theirs.
23
+ * The previous version treated a failed probe as proof of a broken install and exited 1,
24
+ * which made the plugin manager roll back a working upgrade. That is the worst outcome
25
+ * available: the user loses the new version to protect against a problem they did not have.
22
26
  *
23
- * WHERE IT LOOKS
27
+ * So the contract is now: link when the host is reachable, otherwise say what was not
28
+ * found and finish successfully. Only an actual failure to CREATE a link is reported, and
29
+ * even then as a warning — the plugin may still load through the host's own resolution.
24
30
  *
25
- * `DSH_HOST_ROOT` when set (the harness passes it), then the paths a packaged DSH
26
- * install actually uses. Both `resources/app/node_modules` and
27
- * `resources/app/dsh/node_modules` are searched because the host splits its tree between
28
- * them: `pi-ai` lives in the latter, `cordis` in the former.
31
+ * HOW RESOLUTION IS CHECKED
29
32
  *
30
- * FAILURE IS LOUD ON PURPOSE
33
+ * With ESM, not CJS. `@earendil-works/pi-ai` is ESM-only: its `exports` map has `types` and
34
+ * `import` but no `require` and no `./package.json` subpath. A `require.resolve()` of it
35
+ * throws ERR_PACKAGE_PATH_NOT_EXPORTED even when the package is installed and importable,
36
+ * which is precisely the false negative the reporter hit. `import.meta.resolve` asks the
37
+ * question the plugin will actually ask.
31
38
  *
32
- * A silently skipped link is what produced the blank panel. If a peer cannot be found the
33
- * script says which one and exits non-zero, so the install fails visibly instead of
34
- * producing a package that cannot load.
39
+ * @module dsh-xdpool/scripts/link-host-peers
35
40
  */
36
- import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, symlinkSync } from 'node:fs'
37
- import { createRequire } from 'node:module'
41
+ import { existsSync, mkdirSync, readFileSync, rmSync, symlinkSync } from 'node:fs'
38
42
  import { dirname, join, resolve } from 'node:path'
39
- import { fileURLToPath } from 'node:url'
43
+ import { fileURLToPath, pathToFileURL } from 'node:url'
40
44
 
41
45
  const HERE = dirname(fileURLToPath(import.meta.url))
42
46
  const PACKAGE_ROOT = resolve(HERE, '..')
43
- const REQUIRE = createRequire(import.meta.url)
47
+ const ENTRY_URL = pathToFileURL(join(PACKAGE_ROOT, 'lib', 'index.js')).href
44
48
 
45
49
  /** The peer dependencies this plugin imports at runtime. */
46
50
  function peerNames() {
@@ -49,75 +53,239 @@ function peerNames() {
49
53
  }
50
54
 
51
55
  /**
52
- * Candidate host module roots, most specific first.
56
+ * Can the plugin resolve `name` from its own entry point?
53
57
  *
54
- * Derived from this file's own location as well, because when the host loads the plugin
55
- * from `app/dsh/node_modules`, two levels up IS the host root.
58
+ * `import.meta.resolve` answers with ESM conditions, which is what the plugin uses. It
59
+ * never throws for a missing package in current Node — it returns a URL that may not
60
+ * exist — so the answer is checked for existence as well.
61
+ *
62
+ * A `data:` or `node:` result is not a real package file and is treated as unresolved.
63
+ */
64
+ function resolvesFromEntry(name) {
65
+ try {
66
+ const url = import.meta.resolve(name, ENTRY_URL)
67
+ if (typeof url !== 'string' || url === '') return undefined
68
+ if (url.startsWith('node:') || url.startsWith('data:')) return undefined
69
+ return fileURLToPath(url)
70
+ } catch {
71
+ return undefined
72
+ }
73
+ }
74
+
75
+ /** The installed version of a package directory, or undefined when unreadable. */
76
+ function versionOf(dir) {
77
+ try {
78
+ const manifest = JSON.parse(readFileSync(join(dir, 'package.json'), 'utf8'))
79
+ return typeof manifest.version === 'string' ? manifest.version : undefined
80
+ } catch {
81
+ return undefined
82
+ }
83
+ }
84
+
85
+ /**
86
+ * The host's copy of a peer, if one can be found.
87
+ *
88
+ * Separate from `locate` because the two answer different questions: `locate` asks "is this
89
+ * importable", `hostCopyOf` asks "where is the host's own copy". The second is needed to
90
+ * detect a version MISMATCH, which is a failure mode `locate` cannot see — the package
91
+ * resolves perfectly well at the wrong generation.
92
+ */
93
+ function hostCopyOf(name) {
94
+ for (const root of hostRoots()) {
95
+ const candidate = join(root, name)
96
+ if (existsSync(join(candidate, 'package.json'))) return candidate
97
+ }
98
+ return undefined
99
+ }
100
+
101
+ /**
102
+ * The package directory for `name`, whether or not it can be imported right now.
103
+ *
104
+ * The physical check comes FIRST because it is the only one that works for an ESM-only
105
+ * package whose `exports` map omits `./package.json`: `require.resolve(`${name}/package.json`)`
106
+ * throws ERR_PACKAGE_PATH_NOT_EXPORTED for `pi-ai` even with the package sitting on disk.
107
+ * That false negative used to send an already-linked peer back into the missing list, so a
108
+ * second `postinstall` run re-linked what it had just built.
109
+ */
110
+ function locate(name) {
111
+ // 1. On disk under this package's own node_modules — a junction we made earlier counts.
112
+ const physical = join(PACKAGE_ROOT, 'node_modules', name)
113
+ if (existsSync(join(physical, 'package.json'))) return physical
114
+ // 2. Whatever ESM resolves from the entry, which is the real question.
115
+ const resolved = resolvesFromEntry(name)
116
+ if (resolved !== undefined) {
117
+ // Walk up to the package root: the first directory named like the package.
118
+ const wanted = name.startsWith('@') ? name.split('/')[1] : name
119
+ let dir = dirname(resolved)
120
+ while (dir !== dirname(dir)) {
121
+ if (dir.endsWith(`/${wanted}`) || dir.endsWith(`\\${wanted}`)) return dir
122
+ dir = dirname(dir)
123
+ }
124
+ return dirname(resolved)
125
+ }
126
+ return undefined
127
+ }
128
+
129
+ /**
130
+ * Candidate host module roots.
131
+ *
132
+ * The host SPLITS its tree — `cordis` and the `@deepseek-ai/*` runtime in one place,
133
+ * `pi-ai` in another — so several roots are tried rather than one.
134
+ *
135
+ * `DSH_HOST_ROOT` is honoured when set, but note it is NOT injected by the host: two
136
+ * reporters verified that the plugin manager does not pass it. It exists for an operator
137
+ * who wants to point at a specific tree by hand.
138
+ *
139
+ * On a packaged install most of this is unverifiable from a plain Node process, because the
140
+ * dependencies live inside `app.asar` and `existsSync` cannot see in. That is expected and
141
+ * is why a miss is not an error.
56
142
  */
57
143
  function hostRoots() {
58
144
  const roots = []
59
145
  const env = process.env['DSH_HOST_ROOT']
60
146
  if (typeof env === 'string' && env !== '') roots.push(env)
61
- // `<host>/resources/app/dsh/node_modules/dsh-xdpool` → `<host>/resources/app/dsh/node_modules`
147
+ // When the host loads the plugin from inside its own tree.
62
148
  roots.push(resolve(PACKAGE_ROOT, '..'))
63
- // A source checkout beside the harness: look for the resources tree directly.
64
- for (const base of [process.env['LOCALAPPDATA'], process.env['PROGRAMFILES']]) {
65
- if (typeof base !== 'string' || base === '') continue
66
- roots.push(join(base, 'DeepSeek Harness', 'resources', 'app', 'dsh', 'node_modules'))
67
- roots.push(join(base, 'DeepSeek Harness', 'resources', 'app', 'node_modules'))
149
+ roots.push(resolve(PACKAGE_ROOT, '..', '..', '..'))
150
+ /**
151
+ * Derived from the running executable, which is the only signal that survives a
152
+ * non-default install drive — the reporter's harness sat on `F:` while every hard-coded
153
+ * guess pointed at `C:`. `process.execPath` is the Node or Electron binary doing the
154
+ * install, which for the bundled runtime lives inside the harness directory.
155
+ */
156
+ for (const up of [1, 2, 3, 4, 5]) {
157
+ const segments = [process.execPath]
158
+ for (let i = 0; i < up; i += 1) segments.push('..')
159
+ const base = resolve(...segments)
160
+ for (const app of ['app', join('app', 'dsh')]) {
161
+ roots.push(join(base, 'resources', app, 'node_modules'))
162
+ }
163
+ roots.push(join(base, 'node_modules'))
68
164
  }
69
- return roots
70
- }
71
-
72
- /** Resolve a package's directory without importing it. */
73
- function locate(name) {
74
- try {
75
- return dirname(REQUIRE.resolve(`${name}/package.json`))
76
- } catch {
77
- // Some packages do not export package.json; fall back to the resolver's own answer.
78
- try {
79
- const entry = REQUIRE.resolve(name)
80
- // Walk up to the package root — the first directory whose name is the package's.
81
- let dir = dirname(entry)
82
- const wanted = name.startsWith('@') ? name.split('/')[1] : name
83
- while (dir !== dirname(dir)) {
84
- if (dir.endsWith(`/${wanted}`) || dir.endsWith(`\\${wanted}`)) return dir
85
- dir = dirname(dir)
86
- }
87
- } catch {
88
- return undefined
165
+ for (const base of HARNESS_BASES) {
166
+ if (typeof base !== 'string' || base === '') continue
167
+ for (const app of ['app', join('app', 'dsh')]) {
168
+ roots.push(join(base, 'resources', app, 'node_modules'))
89
169
  }
90
- return undefined
91
170
  }
171
+ return [...new Set(roots)]
92
172
  }
93
173
 
94
174
  /**
95
- * When to ENFORCE.
175
+ * Where a DSH install commonly sits, per platform.
96
176
  *
97
- * This runs on `postinstall` of the published package, where a missing peer really does
98
- * mean a plugin that cannot load — and it must fail loudly there. But the same script also
99
- * runs when someone installs the repository for development or CI, where the host does not
100
- * exist and the peers are resolved from `devDependencies` instead. Failing there would
101
- * break every fresh clone and every pipeline for a condition that is not a problem.
177
+ * Every entry is a guess and a miss is silent, which is what makes listing several
178
+ * acceptable. `HARNESS_BASES` used to be Windows-only — the macOS reporter's whole
179
+ * `LOCALAPPDATA`/`PROGRAMFILES` loop simply never ran.
180
+ */
181
+ const HARNESS_BASES = [
182
+ process.env['DSH_HARNESS_ROOT'],
183
+ // macOS: /Applications/DeepSeek Harness.app/Contents/Resources
184
+ '/Applications/DeepSeek Harness.app/Contents/Resources',
185
+ join(process.env['HOME'] ?? '', 'Applications', 'DeepSeek Harness.app', 'Contents', 'Resources'),
186
+ // Linux
187
+ join(process.env['HOME'] ?? '', '.local', 'share', 'deepseek-harness'),
188
+ '/opt/DeepSeek Harness',
189
+ // Windows, default locations
190
+ typeof process.env['LOCALAPPDATA'] === 'string' ? join(process.env['LOCALAPPDATA'], 'Programs', 'DeepSeek Harness') : undefined,
191
+ typeof process.env['LOCALAPPDATA'] === 'string' ? join(process.env['LOCALAPPDATA'], 'DeepSeek Harness') : undefined,
192
+ typeof process.env['ProgramW6432'] === 'string' ? process.env['ProgramW6432'] : undefined,
193
+ typeof process.env['PROGRAMFILES'] === 'string' ? process.env['PROGRAMFILES'] : undefined,
194
+ /**
195
+ * Windows, installed on another drive.
196
+ *
197
+ * Not a guess about this particular machine: it is derived from where the PROFILE lives.
198
+ * A DSH profile sits at `<harness data dir>/profiles/<name>`, and on Windows the data
199
+ * directory is often the harness's own folder — which is exactly the layout this repo
200
+ * was developed against (`D:\dsh-home\profiles\desktop` beside `D:\DeepSeek Harness`).
201
+ * When they are siblings, the harness is one segment up with a different name, so the
202
+ * sibling of the data dir is tried as a harness root too.
203
+ *
204
+ * A miss costs nothing, which is why deriving is preferable to hard-coding a drive letter.
205
+ */
206
+ ...siblingHarnessBases(),
207
+ ]
208
+
209
+ /**
210
+ * Harness roots that can be derived from where this profile lives.
102
211
  *
103
- * The two cases are told apart by whether this is a source checkout: `src/` ships in the
104
- * repository and not in the tarball (`files` lists `lib`, `vendor`, `scripts`…).
212
+ * `D:\dsh-home\profiles\desktop\node_modules\dsh-xdpool` → walk up to the data directory,
213
+ * then try every plausible sibling. Cheap, and it is the only way to find a harness on a
214
+ * non-default drive without asking the user to set an environment variable.
215
+ *
216
+ * Several levels are tried because the two layouts in the wild differ:
217
+ *
218
+ * - `<dataDir>/profiles/<name>` — the data dir's PARENT holds the harness
219
+ * (`D:\dsh-home` beside `D:\DeepSeek Harness`)
220
+ * - the harness IS the data dir's parent — some installs put profiles inside the app
221
+ *
222
+ * A miss costs nothing, which is why deriving beats hard-coding a drive letter.
105
223
  */
224
+ function siblingHarnessBases() {
225
+ const out = []
226
+ let dir = PACKAGE_ROOT
227
+ let dataDir
228
+ for (let i = 0; i < 8; i += 1) {
229
+ dir = dirname(dir)
230
+ if (dir === dirname(dir)) break
231
+ // `<x>/profiles/...` means `<x>` is the data directory.
232
+ if (dirname(dir).endsWith('profiles')) { dataDir = dirname(dir); break }
233
+ if (dir.endsWith('profiles')) { dataDir = dirname(dir); break }
234
+ }
235
+ const start = dataDir ?? resolve(PACKAGE_ROOT, '..', '..', '..')
236
+ // Walk up a few levels from the data directory, offering a sibling at each.
237
+ let cursor = start
238
+ for (let i = 0; i < 3; i += 1) {
239
+ out.push(join(cursor, 'DeepSeek Harness'))
240
+ const parent = dirname(cursor)
241
+ if (parent === cursor) break
242
+ out.push(join(parent, 'DeepSeek Harness'))
243
+ cursor = parent
244
+ }
245
+ return out
246
+ }
247
+
248
+ /** Whether this is a source checkout rather than an installed package. */
106
249
  const IS_SOURCE_CHECKOUT = existsSync(join(PACKAGE_ROOT, 'src'))
107
- const ENFORCE = !IS_SOURCE_CHECKOUT
108
250
 
109
251
  const linked = []
110
- const missing = []
252
+ const alreadyResolved = []
253
+ const notFound = []
254
+ const failed = []
255
+
111
256
  for (const name of peerNames()) {
112
- // Already resolvable: leave it alone. Someone who installed a peer on purpose keeps
113
- // control, and re-linking would overwrite that choice.
114
- if (locate(name) !== undefined) continue
115
- let target
116
- for (const root of hostRoots()) {
117
- const candidate = join(root, name)
118
- if (existsSync(candidate)) { target = candidate; break }
257
+ /**
258
+ * A peer that resolves is only acceptable if its VERSION matches the host's.
259
+ *
260
+ * Resolvability alone is not the contract that matters. `@earendil-works/pi-ai` shipped
261
+ * from a `devDependency` at 0.85.1 while the host ran 1.1.0, and the plugin's own
262
+ * `warnOnPiAiGenerationMismatch` documents the result: two copies on one call chain throw
263
+ * at the adapter seam and the host reports every turn as a non-retryable `PI_AI_ERROR`.
264
+ * The package resolved fine — at the wrong generation.
265
+ *
266
+ * So when the host has a copy and ours differs, the host's copy WINS. That is the whole
267
+ * point of treating these as peer dependencies: the host owns them, and a second
268
+ * generation beside it is a defect rather than a choice.
269
+ */
270
+ const current = locate(name)
271
+ const hostCopy = hostCopyOf(name)
272
+ const hostVersion = hostCopy === undefined ? undefined : versionOf(hostCopy)
273
+ const ours = current === undefined ? undefined : versionOf(current)
274
+ if (current !== undefined && (hostVersion === undefined || ours === hostVersion)) {
275
+ alreadyResolved.push(name)
276
+ continue
119
277
  }
120
- if (target === undefined) { missing.push(name); continue }
278
+ // A mismatch is reported below through `relinked` when the host copy is linked.
279
+ let target = hostCopy
280
+ if (target === undefined) {
281
+ for (const root of hostRoots()) {
282
+ const candidate = join(root, name)
283
+ // `existsSync` cannot see inside `app.asar`; on a packaged host this simply misses and
284
+ // the peer is reported as not found, which is no longer fatal.
285
+ if (existsSync(join(candidate, 'package.json'))) { target = candidate; break }
286
+ }
287
+ }
288
+ if (target === undefined) { notFound.push(name); continue }
121
289
  const dest = join(PACKAGE_ROOT, 'node_modules', name)
122
290
  try {
123
291
  mkdirSync(dirname(dest), { recursive: true })
@@ -127,9 +295,9 @@ for (const name of peerNames()) {
127
295
  // Junction on Windows because creating a real symlink needs elevation there; a
128
296
  // junction needs none and behaves the same for directory reads.
129
297
  symlinkSync(target, dest, process.platform === 'win32' ? 'junction' : 'dir')
130
- linked.push(`${name} → ${target}`)
298
+ linked.push(`${name} → ${target}${ours === undefined ? '' : ` (was ${ours}, host has ${hostVersion ?? '?'})`}`)
131
299
  } catch (error) {
132
- missing.push(`${name} (${error instanceof Error ? error.message : String(error)})`)
300
+ failed.push(`${name} (${error instanceof Error ? error.message : String(error)})`)
133
301
  }
134
302
  }
135
303
 
@@ -137,63 +305,55 @@ if (linked.length > 0) {
137
305
  process.stdout.write(`dsh-xdpool: linked ${String(linked.length)} host dependency(ies)\n`)
138
306
  for (const line of linked) process.stdout.write(` ${line}\n`)
139
307
  }
140
- if (missing.length > 0) {
141
- const where = IS_SOURCE_CHECKOUT
142
- ? 'a source checkout, so the host is not expected to be present'
143
- : 'an installed package, where a missing peer prevents the plugin from loading'
144
- process.stderr.write(
145
- `dsh-xdpool: could not satisfy ${String(missing.length)} peer dependency(ies) `
146
- + `(${where}):\n`
147
- + missing.map(name => ` ${name}\n`).join(''),
308
+ if (alreadyResolved.length > 0 && linked.length === 0) {
309
+ process.stdout.write(`dsh-xdpool: all ${String(alreadyResolved.length)} peer dependencies already resolve\n`)
310
+ }
311
+
312
+ /**
313
+ * Report, and deliberately do not fail.
314
+ *
315
+ * A packaged host hides these inside `app.asar` (invisible to a bare Node process) and
316
+ * resolves them itself at runtime — 2.6.3 shipped with no postinstall and loaded fine. So
317
+ * "not found from here" is not evidence of a broken install, and exiting non-zero on it
318
+ * rolled back working upgrades for macOS and Windows users alike.
319
+ */
320
+ if (notFound.length > 0) {
321
+ process.stdout.write(
322
+ `dsh-xdpool: ${String(notFound.length)} peer dependency(ies) not visible from this process:\n`
323
+ + notFound.map(name => ` ${name}\n`).join('')
324
+ + (IS_SOURCE_CHECKOUT
325
+ ? 'Expected in a source checkout: build and test resolve them from devDependencies.\n'
326
+ : 'This is normal for a packaged host, which keeps them inside app.asar and resolves\n'
327
+ + 'them itself at runtime. Set DSH_HOST_ROOT to a directory containing node_modules\n'
328
+ + 'only if the plugin later fails to load.\n'),
329
+ )
330
+ }
331
+ if (failed.length > 0) {
332
+ // A link that could not be CREATED is a real problem, but still not fatal: the host may
333
+ // resolve the peer without our help. Worth a warning, not a rollback.
334
+ process.stdout.write(
335
+ `dsh-xdpool: could not link ${String(failed.length)} dependency(ies):\n`
336
+ + failed.map(name => ` ${name}\n`).join(''),
148
337
  )
149
- if (ENFORCE) {
150
- process.stderr.write(
151
- 'The plugin will fail to load without them. Install them into this profile, or set\n'
152
- + 'DSH_HOST_ROOT to the directory containing node_modules.\n',
153
- )
154
- // Hard failure on purpose: a silently skipped link is what produced a package that
155
- // installed cleanly and then could not load at all.
156
- process.exit(1)
157
- }
158
- // A source checkout keeps going: `devDependencies` provide these for build and test,
159
- // and CI has no harness to link against. Failing here would break the pipeline for a
160
- // condition that is not a defect.
161
- process.stdout.write('dsh-xdpool: continuing — this looks like a development checkout\n')
162
- } else {
163
- /**
164
- * Self-check: confirm every peer RESOLVES from the package root.
165
- *
166
- * Not a full `import` of the entry: that would also pull the host's own runtime (cordis,
167
- * the llm plumbing) and can only succeed inside a live harness, so it would fail in a
168
- * source checkout and in CI for a reason unrelated to this script's job.
169
- *
170
- * Resolution is the exact property that broke: a top-level import failure aborts
171
- * `apply()`, and every web route then goes unregistered while the card blames the
172
- * gateway. Checking `require.resolve` from inside the package reproduces that failure
173
- * without needing the host running.
174
- */
175
- const unresolved = []
176
- const localRequire = createRequire(join(PACKAGE_ROOT, 'lib', 'index.js'))
177
- for (const name of peerNames()) {
178
- try {
179
- localRequire.resolve(name)
180
- } catch {
181
- unresolved.push(name)
182
- }
183
- }
184
- if (unresolved.length > 0) {
185
- process.stderr.write(
186
- `dsh-xdpool: ${String(unresolved.length)} peer dependency(ies) still do not resolve:\n`
187
- + unresolved.map(name => ` ${name}\n`).join(''),
188
- )
189
- // Same split as above: fatal for an installed package, informational in a checkout.
190
- if (ENFORCE) process.exit(1)
191
- process.stdout.write('dsh-xdpool: continuing — this looks like a development checkout\n')
192
- } else {
193
- process.stdout.write('dsh-xdpool: all peer dependencies resolve; the build should load\n')
194
- }
195
338
  }
196
339
 
197
- // Keep the unused helper referenced so a tree-shaker cannot hide it if this file is ever
198
- // bundled; it is intentionally exported for a maintenance script.
199
- export { readdirSync }
340
+ /**
341
+ * Final self-check, phrased as the plugin would phrase it.
342
+ *
343
+ * Uses ESM resolution rather than CJS: `pi-ai` is ESM-only with no `require` condition and
344
+ * no `./package.json` subpath, so a `require.resolve` of it throws
345
+ * ERR_PACKAGE_PATH_NOT_EXPORTED while the package sits there fully importable. That false
346
+ * negative is what made 2.6.4 uninstallable on Windows.
347
+ *
348
+ * An unresolved peer is reported and the script still exits 0, for the asar reason above.
349
+ */
350
+ const unresolved = peerNames().filter(name => locate(name) === undefined)
351
+ if (unresolved.length === 0) {
352
+ process.stdout.write('dsh-xdpool: all peer dependencies resolve; the build should load\n')
353
+ } else {
354
+ process.stdout.write(
355
+ `dsh-xdpool: ${String(unresolved.length)} peer dependency(ies) do not resolve here: `
356
+ + `${unresolved.join(', ')}\n`
357
+ + ' Not treated as an install failure — see the note above.\n',
358
+ )
359
+ }
@@ -36894,7 +36894,19 @@ var LobsteraiAdapter = class extends LlmAdapter3 {
36894
36894
  */
36895
36895
  providerInfo(provider) {
36896
36896
  const id = typeof provider === "string" && provider.length > 0 ? provider : this.product.id;
36897
- return { id, name: this.product.displayName };
36897
+ // [xdpool-local] Present this lane under the name the rest of the plugin uses.
36898
+ //
36899
+ // `channels.ts` (REGISTERED_CHANNELS), `region-card.tsx` and
36900
+ // `ChannelPoolSection.tsx` all call this lane 「WorkBuddy 国内版」, while the
36901
+ // vendor product constant still carries the upstream name "CodeBuddy (腾讯)".
36902
+ // One lane rendered under two names in one product is issue #119: the pool card
36903
+ // and the model picker disagreed about which product the user had signed in to.
36904
+ //
36905
+ // Overridden at the PRESENTATION layer rather than in the constant, because
36906
+ // `throwIfAllAccountsRateLimited` also reads `product.displayName` for its error
36907
+ // text; changing the constant would silently rewrite those messages too.
36908
+ const name = id === "buddy" ? "WorkBuddy 国内版" : this.product.displayName;
36909
+ return { id, name };
36898
36910
  }
36899
36911
  /**
36900
36912
  * 懒加载远端模型目录(仅拉取一次)。