Fix local link: peer packages invisible outside profile tree.

Path installs junction the checkout outside ~/.dsh/profiles/*/node_modules, so Node cannot see DSH peers; add link-dsh-peers scripts and document the one-time setup.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-09-04 22:25:30 +08:00
parent fd1a86ec2f
commit 13db99484f
5 changed files with 101 additions and 6 deletions

View file

@ -60,12 +60,16 @@ Open `dsh web`, new session → preset **Netx Ops**.
See [TOOL_MAP.md](TOOL_MAP.md). See [TOOL_MAP.md](TOOL_MAP.md).
## Local debug (DeepSeekHarness checkout) ## Local `link:` / path install
See [examples/local-debug/README.md](../examples/local-debug/README.md). When you `dsh plugin add D:\path\to\netxops`, pnpm junctions the checkout **outside** the profile tree. Node then resolves imports from that checkout, so DSH peer packages (`@deepseek-ai/schemastery`, …) are invisible unless you link them once:
Rebuild the Plugins card after editing `src/client/`:
```powershell ```powershell
bun run bundle powershell -File .\scripts\link-dsh-peers.ps1
``` ```
Unix: `./scripts/link-dsh-peers.sh`
(Requires a prior `dsh web` / profile boot so `~/.dsh/profiles/node_modules` exists.)
npm / GitHub installs place the package under the profile `node_modules` and do **not** need this step.

View file

@ -4,10 +4,13 @@
```powershell ```powershell
cd D:\project\chatgpt\netxops cd D:\project\chatgpt\netxops
powershell -File .\scripts\link-dsh-peers.ps1
powershell -File .\scripts\link-preset.ps1 powershell -File .\scripts\link-preset.ps1
powershell -File .\scripts\set-netx-token.ps1 -Token (Get-Content D:\project\chatgpt\netx\data\auth\mcp_token -Raw).Trim() powershell -File .\scripts\set-netx-token.ps1 -Token (Get-Content D:\project\chatgpt\netx\data\auth\mcp_token -Raw).Trim()
``` ```
`link-dsh-peers.ps1` is required for path/`link:` installs: Node resolves peers from the checkout realpath, not from the profile `node_modules`. Run it after the first successful `dsh` boot (so `~/.dsh/profiles/node_modules` exists).
From DeepSeekHarness (source): From DeepSeekHarness (source):
```powershell ```powershell

View file

@ -1,6 +1,6 @@
{ {
"name": "dsh-netxops", "name": "dsh-netxops",
"version": "0.1.3", "version": "0.1.4",
"description": "DeepSeek Harness Netx Ops: host bridge + Plugins settings card + agent preset", "description": "DeepSeek Harness Netx Ops: host bridge + Plugins settings card + agent preset",
"license": "MIT", "license": "MIT",
"type": "module", "type": "module",
@ -77,6 +77,9 @@
"@deepseek-ai/dsh-api-remotes": "*", "@deepseek-ai/dsh-api-remotes": "*",
"react": "^18.2.0 || ^19.0.0" "react": "^18.2.0 || ^19.0.0"
}, },
"dependencies": {
"@deepseek-ai/schemastery": "*"
},
"devDependencies": { "devDependencies": {
"@types/react": "~18.3.1", "@types/react": "~18.3.1",
"typescript": "^5.8.0" "typescript": "^5.8.0"

View file

@ -0,0 +1,56 @@
# Link DSH peer packages into this checkout for local `dsh plugin add <path>` / `link:`.
#
# Node resolves imports from the realpath of a linked package. A junction out of
# ~/.dsh/profiles/<name>/node_modules therefore cannot see the profile's
# hoisted peers or the healed profiles/node_modules fallback. Point the peers
# this package imports at the shared installation copy instead.
#
# Usage (PowerShell):
# .\scripts\link-dsh-peers.ps1
# Optional:
# .\scripts\link-dsh-peers.ps1 -DshHome $env:DSH_HOME
param(
[string]$DshHome = $(if ($env:DSH_HOME) { $env:DSH_HOME } else { Join-Path $env:USERPROFILE '.dsh' })
)
$ErrorActionPreference = 'Stop'
$Root = Split-Path -Parent $PSScriptRoot
$SrcRoot = Join-Path $DshHome 'profiles\node_modules\@deepseek-ai'
$DstRoot = Join-Path $Root 'node_modules\@deepseek-ai'
# Runtime imports from src/index.ts (and peers they commonly need nearby).
$Peers = @(
'schemastery',
'cordis',
'dsh-credentials',
'dsh-settings',
'dsh-mcp-client',
'dsh-tools'
)
if (-not (Test-Path $SrcRoot)) {
throw "DSH installation fallback missing: $SrcRoot`nRun ``dsh web`` once (or any profile) so dsh heals profiles/node_modules."
}
New-Item -ItemType Directory -Force -Path $DstRoot | Out-Null
foreach ($name in $Peers) {
$src = Join-Path $SrcRoot $name
$dst = Join-Path $DstRoot $name
if (-not (Test-Path $src)) {
throw "Peer not found under installation fallback: $src"
}
if (Test-Path $dst) {
$item = Get-Item $dst -Force
if ($item.LinkType -eq 'Junction' -or $item.Attributes -band [IO.FileAttributes]::ReparsePoint) {
cmd /c "rmdir `"$dst`""
} else {
Remove-Item -Recurse -Force $dst
}
}
New-Item -ItemType Junction -Path $dst -Target $src | Out-Null
Write-Host "linked @deepseek-ai/$name -> $src"
}
Write-Host "Done. Re-run: dsh web"

29
scripts/link-dsh-peers.sh Normal file
View file

@ -0,0 +1,29 @@
#!/usr/bin/env bash
# Link DSH peer packages into this checkout for local `dsh plugin add <path>` / `link:`.
# See link-dsh-peers.ps1 for why.
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
DSH_HOME="${DSH_HOME:-$HOME/.dsh}"
SRC_ROOT="$DSH_HOME/profiles/node_modules/@deepseek-ai"
DST_ROOT="$ROOT/node_modules/@deepseek-ai"
PEERS=(schemastery cordis dsh-credentials dsh-settings dsh-mcp-client dsh-tools)
if [[ ! -d "$SRC_ROOT" ]]; then
echo "DSH installation fallback missing: $SRC_ROOT" >&2
echo "Run dsh web once so dsh heals profiles/node_modules." >&2
exit 1
fi
mkdir -p "$DST_ROOT"
for name in "${PEERS[@]}"; do
src="$SRC_ROOT/$name"
dst="$DST_ROOT/$name"
if [[ ! -e "$src" ]]; then
echo "Peer not found: $src" >&2
exit 1
fi
rm -rf "$dst"
ln -s "$src" "$dst"
echo "linked @deepseek-ai/$name -> $src"
done
echo "Done. Re-run: dsh web"