@aiwayds/dsh-llm-proxy 0.8.0 → 0.8.1

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiwayds/dsh-llm-proxy",
3
- "version": "0.8.0",
3
+ "version": "0.8.1",
4
4
  "description": "dsh plugin: SYSTEM proxy (env) + LLM traffic-splitting proxy via a process-global undici routing dispatcher",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -37,10 +37,9 @@
37
37
  "build": "tsc -p tsconfig.json",
38
38
  "check": "tsc --noEmit -p tsconfig.json",
39
39
  "pretest": "npm run build",
40
- "prepare": "npm run build",
40
+ "prepare": "node scripts/link-dsh-closure.mjs && npm run build",
41
41
  "test": "node --test test/match.test.mjs test/router.test.mjs test/config.test.mjs test/skill.test.mjs test/dispose.test.mjs test/e2e.test.mjs && node test/packaged-install.test.mjs",
42
- "smoke": "node scripts/smoke-boot.mjs",
43
- "postinstall": "node scripts/link-dsh-closure.mjs"
42
+ "smoke": "node scripts/smoke-boot.mjs"
44
43
  },
45
44
  "dependencies": {
46
45
  "undici": "8.9.0"
@@ -67,9 +66,9 @@
67
66
  },
68
67
  "devDependencies": {
69
68
  "@deepseek-ai/cordis": "4.1.0",
70
- "@deepseek-ai/dsh-scope": "0.2.2-rc.1",
71
- "@deepseek-ai/dsh-settings": "0.2.2-rc.1",
72
- "@deepseek-ai/dsh-skill": "0.2.2-rc.1",
69
+ "@deepseek-ai/dsh-scope": "0.2.2-rc.2",
70
+ "@deepseek-ai/dsh-settings": "0.2.2-rc.2",
71
+ "@deepseek-ai/dsh-skill": "0.2.2-rc.2",
73
72
  "@deepseek-ai/schemastery": "3.19.0",
74
73
  "@types/node": "^24.0.0",
75
74
  "typescript": "^5.9.0"
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Postinstall linker: point every `node_modules/@deepseek-ai/*` entry at the
2
+ * Install-hook linker: point every `node_modules/@deepseek-ai/*` entry at the
3
3
  * global dsh closure.
4
4
  *
5
5
  * Why this exists: dsh-tui-pi is a plugin that runs *inside* the installed
@@ -17,7 +17,12 @@
17
17
  * (`Property 'settings' does not exist on type 'Context'`), so they must stay
18
18
  * *undeclared*. pnpm then treats the closure links as extraneous — and, as
19
19
  * it prunes entries it once managed, the links can still disappear after an
20
- * install. This script re-creates them on every `pnpm install` (postinstall).
20
+ * install. This script re-creates them on every root install (the `prepare`
21
+ * hook). It is deliberately NOT `postinstall`: pnpm 11 treats any dependency
22
+ * install hook as an unapproved build (strictDepBuilds) and fails the
23
+ * consumer's install with ERR_PNPM_IGNORED_BUILDS, while `prepare` never runs
24
+ * for registry dependencies — so the published package carries no install
25
+ * hook at all.
21
26
  *
22
27
  * It is a no-op (exit 0) when no global dsh install is found — a dev machine
23
28
  * without dsh simply cannot typecheck against dsh types.
@@ -29,17 +34,28 @@ import { dirname, join } from 'node:path'
29
34
  import { fileURLToPath } from 'node:url'
30
35
 
31
36
  const repoRoot = dirname(dirname(fileURLToPath(import.meta.url)))
32
- // Guard: this postinstall is a dev-machine convenience for THIS repo. A
33
- // published tarball ships scripts/ (the hook must resolve), but the linker
34
- // must never touch a consumer's node_modules there — it would delete their
35
- // @deepseek-ai packages and replace them with symlinks into their global dsh
36
- // closure. pnpm ≥10 blocks dependency lifecycle scripts by default, but npm
37
- // would run this — exit silently outside the repo. The repo markers must be
38
- // things the files allow-list never ships: tsconfig.json (dev typecheck
39
- // input) and .git.
37
+ // Guard: this hook is a dev-machine convenience for THIS repo. The published
38
+ // tarball ships scripts/ and the `prepare` script (a dev hook, carried but
39
+ // never executed for registry dependencies), and the linker must never touch
40
+ // a consumer's node_modules there — it would delete their @deepseek-ai
41
+ // packages and replace them with symlinks into their global dsh closure. Exit
42
+ // silently outside the repo. The repo markers must be things the files
43
+ // allow-list never ships: tsconfig.json (dev typecheck input) and .git.
40
44
  if (!existsSync(join(repoRoot, 'tsconfig.json')) || !existsSync(join(repoRoot, '.git'))) {
41
45
  process.exit(0)
42
46
  }
47
+ // Second guard: npm runs `prepare` inside a throwaway clone when installing a
48
+ // git dependency, and a root project install in a subdirectory walks up to
49
+ // this package with INIT_CWD elsewhere. Only a direct root install (INIT_CWD
50
+ // = repoRoot, or unset for `node scripts/...`) may link.
51
+ const initCwd = process.env.INIT_CWD
52
+ if (initCwd !== undefined && initCwd !== '') {
53
+ try {
54
+ if (realpathSync(initCwd) !== realpathSync(repoRoot)) process.exit(0)
55
+ } catch {
56
+ process.exit(0)
57
+ }
58
+ }
43
59
  const scopeDir = join(repoRoot, 'node_modules', '@deepseek-ai')
44
60
 
45
61
  /** The global dsh package's own `node_modules/@deepseek-ai` closure dir. */
@@ -9,7 +9,11 @@
9
9
  // blocks dependency lifecycle scripts by default, which is exactly how
10
10
  // the #2-class tarball breakage (postinstall → unshipped file) stayed
11
11
  // invisible to every pnpm-based install; npm-class clients (the desktop
12
- // plugin manager) are the ones that run it.
12
+ // plugin manager) are the ones that run it. Since the pnpm 11
13
+ // strictDepBuilds fix the tarball has no install hook to run (the dev
14
+ // linker rides `prepare`, which npm/pnpm skip for registry
15
+ // dependencies), so this proves the hook-free package installs and boots
16
+ // clean.
13
17
  // 4. `dsh --profile smoke --dump-config` must compose the plugin into the
14
18
  // tree (mount/patch-layer proof)
15
19
  // 5. a real boot under a timeout must load the plugin tree without a