@adhdev/daemon-core 1.0.18-rc.4 → 1.0.18-rc.5
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/index.js +31 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +31 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/commands/windows-atomic-upgrade.ts +29 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adhdev/daemon-core",
|
|
3
|
-
"version": "1.0.18-rc.
|
|
3
|
+
"version": "1.0.18-rc.5",
|
|
4
4
|
"description": "ADHDev daemon core — CDP, IDE detection, providers, command execution",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"author": "vilmire",
|
|
48
48
|
"license": "AGPL-3.0-or-later",
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@adhdev/mesh-shared": "1.0.18-rc.
|
|
51
|
-
"@adhdev/session-host-core": "1.0.18-rc.
|
|
50
|
+
"@adhdev/mesh-shared": "1.0.18-rc.5",
|
|
51
|
+
"@adhdev/session-host-core": "1.0.18-rc.5",
|
|
52
52
|
"@agentclientprotocol/sdk": "^0.16.1",
|
|
53
53
|
"ajv": "^8.20.0",
|
|
54
54
|
"ajv-formats": "^3.0.1",
|
|
@@ -114,6 +114,28 @@ function packageRootForPrefix(prefix: string, packageName: string): string {
|
|
|
114
114
|
return path.join(prefix, 'node_modules', ...packageName.split('/'));
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
+
// node-pty ships a Windows x64 prebuild. If npm rebuilds from source (because a
|
|
118
|
+
// .npmrc sets build-from-source=true), the install script deletes the prebuild
|
|
119
|
+
// and may leave no conpty.node on machines without build tools. Verify it
|
|
120
|
+
// survived before we ever activate the staged prefix.
|
|
121
|
+
const CONPTY_PREBUILD_RELATIVE_PATH = path.join(
|
|
122
|
+
'node_modules', 'adhdev', 'node_modules', 'node-pty', 'prebuilds', 'win32-x64', 'conpty.node'
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
function resolveStagedConptyPrebuildPath(stagedPrefix: string): string {
|
|
126
|
+
return path.join(stagedPrefix, CONPTY_PREBUILD_RELATIVE_PATH);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
function verifyStagedConptyPrebuild(stagedPrefix: string): void {
|
|
130
|
+
const conptyPath = resolveStagedConptyPrebuildPath(stagedPrefix);
|
|
131
|
+
if (!fs.existsSync(conptyPath)) {
|
|
132
|
+
throw new Error(
|
|
133
|
+
`Staged install is missing required native addon: ${conptyPath}. ` +
|
|
134
|
+
'Aborting activation to prevent a daemon boot crash.'
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
117
139
|
function readPackageCliEntry(prefix: string, packageName: string, targetVersion: string): string {
|
|
118
140
|
const packageRoot = packageRootForPrefix(prefix, packageName);
|
|
119
141
|
const packageJsonPath = path.join(packageRoot, 'package.json');
|
|
@@ -259,6 +281,7 @@ export async function performWindowsAtomicUpgrade(options: WindowsAtomicUpgradeO
|
|
|
259
281
|
try {
|
|
260
282
|
hooks.log(`Installing ${packageName}@${targetVersion} into inactive prefix ${stagedPrefix}`);
|
|
261
283
|
await hooks.install(stagedPrefix, portableNode);
|
|
284
|
+
verifyStagedConptyPrebuild(stagedPrefix);
|
|
262
285
|
const stagedCliEntry = readPackageCliEntry(stagedPrefix, packageName, targetVersion);
|
|
263
286
|
pinStagedShims(stagedPrefix, portableNode, stagedCliEntry);
|
|
264
287
|
validateStagedCli(portableNode, stagedCliEntry, targetVersion);
|
|
@@ -321,7 +344,12 @@ export function createDefaultWindowsAtomicHooks(options: {
|
|
|
321
344
|
}): WindowsAtomicUpgradeHooks {
|
|
322
345
|
return {
|
|
323
346
|
install: (stagedPrefix, portableNode) => {
|
|
324
|
-
const env: NodeJS.ProcessEnv = {
|
|
347
|
+
const env: NodeJS.ProcessEnv = {
|
|
348
|
+
...options.env,
|
|
349
|
+
ADHDEV_BOOTSTRAP: '1',
|
|
350
|
+
npm_config_build_from_source: 'false',
|
|
351
|
+
'npm_config_build-from-source': 'false',
|
|
352
|
+
};
|
|
325
353
|
const pathKey = Object.keys(env).find((key) => key.toLowerCase() === 'path') || 'Path';
|
|
326
354
|
env[pathKey] = `${path.dirname(portableNode)};${env[pathKey] || ''}`;
|
|
327
355
|
execFileSync(portableNode, [
|