agentsw 0.5.2 → 0.5.4

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.
Files changed (2) hide show
  1. package/dist/apps.js +43 -0
  2. package/package.json +1 -1
package/dist/apps.js CHANGED
@@ -80,11 +80,54 @@ export const appPackages = [
80
80
  id: "dsh",
81
81
  name: "DeepSeek Harness",
82
82
  binary: "dsh",
83
+ // dsh may be globally installed (binary in PATH) or used via npx only.
84
+ // installedVersion() probes the binary first; localVersion() covers npx-only users.
83
85
  latest: { kind: "npm", name: "@deepseek-ai/dsh" },
84
86
  installCmd: "npm install -g @deepseek-ai/dsh@latest",
87
+ upgradeCmd: "npm install -g @deepseek-ai/dsh@latest",
85
88
  windowsInstallCmd: "npm install -g @deepseek-ai/dsh@latest",
89
+ localVersion: () => dshLocalVersion(),
86
90
  },
87
91
  ];
92
+ // dsh config dir; respects $DSH_HOME.
93
+ function dshHome() {
94
+ const env = process.env.DSH_HOME?.trim();
95
+ return env ? (env.startsWith("~") ? path.join(home, env.slice(1)) : env) :
96
+ process.platform === "win32" ? path.join(home, "AppData", "Local", "dsh") : path.join(home, ".dsh");
97
+ }
98
+ /** dsh version: search npx cache for @deepseek-ai/dsh, fall back to "?" if config dir exists. */
99
+ function dshLocalVersion() {
100
+ // 1. Fast path: check global node_modules directly (no subprocess)
101
+ try {
102
+ const globalRoot = execSync("npm root -g", {
103
+ encoding: "utf8", timeout: 5000, stdio: ["ignore", "pipe", "pipe"],
104
+ }).trim();
105
+ const pkg = path.join(globalRoot, "@deepseek-ai", "dsh", "package.json");
106
+ if (fs.existsSync(pkg)) {
107
+ return JSON.parse(fs.readFileSync(pkg, "utf8")).version;
108
+ }
109
+ }
110
+ catch { /* npm not available */ }
111
+ // 2. Check npx cache (~/.npm/_npx/*/node_modules/@deepseek-ai/dsh/package.json)
112
+ const npxCache = path.join(home, ".npm", "_npx");
113
+ if (fs.existsSync(npxCache)) {
114
+ for (const dir of fs.readdirSync(npxCache)) {
115
+ const pkg = path.join(npxCache, dir, "node_modules", "@deepseek-ai", "dsh", "package.json");
116
+ if (fs.existsSync(pkg)) {
117
+ try {
118
+ const v = JSON.parse(fs.readFileSync(pkg, "utf8")).version;
119
+ if (v)
120
+ return v;
121
+ }
122
+ catch { /* ignore */ }
123
+ }
124
+ }
125
+ }
126
+ // 3. Config dir exists -> used via npx, version unknown
127
+ if (fs.existsSync(dshHome()))
128
+ return "?";
129
+ return undefined;
130
+ }
88
131
  function workbuddyDataDir() {
89
132
  return process.env.WORKBUDDY_CONFIG_DIR?.trim() || process.env.CODEBUDDY_CONFIG_DIR?.trim() ||
90
133
  (process.platform === "win32" ? appDataDir("workbuddy") : path.join(home, ".workbuddy"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentsw",
3
- "version": "0.5.2",
3
+ "version": "0.5.4",
4
4
  "description": "CLI provider switcher for coding agents: manage OpenAI/Anthropic-protocol providers in one place and sync them, with models.dev metadata, into Claude Code, Codex, omp, pi, prime-agent, opencode, Hermes, WorkBuddy and DeepSeek Harness",
5
5
  "type": "module",
6
6
  "repository": {