@addai/node 0.20.0 → 0.21.0
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/dist/win.d.ts +12 -0
- package/dist/win.js +35 -6
- package/package.json +1 -1
package/dist/win.d.ts
CHANGED
|
@@ -28,6 +28,12 @@ export interface CliInvocation {
|
|
|
28
28
|
* already route spawn errors into a clean per-request failure.
|
|
29
29
|
*/
|
|
30
30
|
export declare function resolveCliInvocation(bin: string, args: string[]): CliInvocation;
|
|
31
|
+
/** Parse a package-manager .cmd shim for the `…\node_modules\…js` script it
|
|
32
|
+
* executes. Returns the absolute script path or null. Two shim dialects:
|
|
33
|
+
* npm's cmd-shim writes `"%dp0%\<rel>.js"` (a variable it SETs earlier);
|
|
34
|
+
* pnpm/yarn-classic write `"%~dp0\<rel>.js"` (batch parameter expansion —
|
|
35
|
+
* note: no trailing `%`). */
|
|
36
|
+
declare function resolveNpmShimScript(shimPath: string): string | null;
|
|
31
37
|
/**
|
|
32
38
|
* Kill an agent child process. POSIX: SIGINT (graceful — CLIs flush and
|
|
33
39
|
* exit). win32: `taskkill /T /F` — Node's SIGINT emulation is a hard
|
|
@@ -65,3 +71,9 @@ export declare function linkOrCopyFile(real: string, dest: string, maxCopyBytes?
|
|
|
65
71
|
/** Directory link that works unprivileged on win32 ('junction' is ignored
|
|
66
72
|
* by Node on POSIX, where a normal symlink is created). */
|
|
67
73
|
export declare function linkDir(real: string, dest: string): void;
|
|
74
|
+
/** Exposed for tests only: the shim parsing is pure file-shape logic and is
|
|
75
|
+
* worth exercising on any platform, not just on a Windows box. */
|
|
76
|
+
export declare const __testables: {
|
|
77
|
+
resolveNpmShimScript: typeof resolveNpmShimScript;
|
|
78
|
+
};
|
|
79
|
+
export {};
|
package/dist/win.js
CHANGED
|
@@ -60,7 +60,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
60
60
|
};
|
|
61
61
|
})();
|
|
62
62
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
63
|
-
exports.IS_WINDOWS = void 0;
|
|
63
|
+
exports.__testables = exports.IS_WINDOWS = void 0;
|
|
64
64
|
exports.whereLookup = whereLookup;
|
|
65
65
|
exports.npmShimCandidates = npmShimCandidates;
|
|
66
66
|
exports.findCliBinary = findCliBinary;
|
|
@@ -212,11 +212,37 @@ function resolveNpmShimScript(shimPath) {
|
|
|
212
212
|
catch {
|
|
213
213
|
return null;
|
|
214
214
|
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
215
|
+
// Two shim shapes, and for a long time only the first was handled.
|
|
216
|
+
//
|
|
217
|
+
// package bin shim "%~dp0\..\pkg\dist\cli.js"
|
|
218
|
+
// npm's OWN npm.cmd SET "NPM_CLI_JS=%~dp0\node_modules\npm\bin\npm-cli.js"
|
|
219
|
+
//
|
|
220
|
+
// The old pattern required the quote to sit immediately before %~dp0, which
|
|
221
|
+
// the first shape satisfies and the second never does — after its quote
|
|
222
|
+
// comes NPM_CLI_JS=. So every package shim resolved and npm.cmd itself did
|
|
223
|
+
// not, which is precisely the binary the auto-updater has to spawn. The
|
|
224
|
+
// result was a node that could not update itself on Windows at all: the roll
|
|
225
|
+
// failed with "could not resolve the node script it wraps" and the machine
|
|
226
|
+
// stayed on whatever version it was first installed with.
|
|
227
|
+
//
|
|
228
|
+
// So: find every %~dp0-relative .js in the file, wherever it sits, and take
|
|
229
|
+
// the first that is actually on disk. Order matters — npm.cmd names the
|
|
230
|
+
// local CLI before the global-prefix one, and the local one is the right
|
|
231
|
+
// answer when both exist.
|
|
232
|
+
const candidates = [];
|
|
233
|
+
const re = /%(?:~dp0|dp0%)[\\/]([^"\s]+\.(?:m|c)?js)/gi;
|
|
234
|
+
for (const m of body.matchAll(re))
|
|
235
|
+
candidates.push(m[1]);
|
|
236
|
+
for (const rel of candidates) {
|
|
237
|
+
// Shims always write backslashes. Split on either separator and re-join
|
|
238
|
+
// with the platform's, so the same parsing is exercisable off Windows —
|
|
239
|
+
// path.join treats a backslash as an ordinary character on POSIX, which
|
|
240
|
+
// would otherwise make every one of these silently unresolvable.
|
|
241
|
+
const script = path.join(path.dirname(shimPath), ...rel.split(/[\\/]+/));
|
|
242
|
+
if (fs.existsSync(script))
|
|
243
|
+
return script;
|
|
244
|
+
}
|
|
245
|
+
return null;
|
|
220
246
|
}
|
|
221
247
|
/**
|
|
222
248
|
* Kill an agent child process. POSIX: SIGINT (graceful — CLIs flush and
|
|
@@ -315,3 +341,6 @@ function linkDir(real, dest) {
|
|
|
315
341
|
}
|
|
316
342
|
catch { /* target exists or FS refuses — caller treats as best-effort */ }
|
|
317
343
|
}
|
|
344
|
+
/** Exposed for tests only: the shim parsing is pure file-shape logic and is
|
|
345
|
+
* worth exercising on any platform, not just on a Windows box. */
|
|
346
|
+
exports.__testables = { resolveNpmShimScript };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@addai/node",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"description": "Daemon that pairs a machine with your +Ai account and runs Claude / Codex / Kimi / Gemini agents on its behalf. Reachable via Supabase from Vault, Entity Studio, or any other +Ai surface.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|