@tomflow/chatloop-tools 0.4.28 → 0.4.29
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/lib/release.mjs +9 -2
- package/package.json +1 -1
package/lib/release.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import {spawn,spawnSync} from 'node:child_process';
|
|
|
3
3
|
import {randomUUID,createHash} from 'node:crypto';
|
|
4
4
|
import {existsSync,readFileSync,writeFileSync,openSync,closeSync,unlinkSync,mkdirSync,renameSync,lstatSync,rmSync} from 'node:fs';
|
|
5
5
|
import {homedir,userInfo} from 'node:os';
|
|
6
|
-
import {join,dirname} from 'node:path';
|
|
6
|
+
import {join,dirname,delimiter} from 'node:path';
|
|
7
7
|
import {PACKAGE_VERSION} from './control.mjs';
|
|
8
8
|
|
|
9
9
|
const name='@tomflow/chatloop-tools';
|
|
@@ -31,6 +31,13 @@ const delay=ms=>new Promise(r=>setTimeout(r,ms));
|
|
|
31
31
|
const safeVersion=v=>/^[0-9]+\.[0-9]+\.[0-9]+(?:-[a-zA-Z0-9.-]+)?$/.test(v);
|
|
32
32
|
const quote=s=>JSON.stringify(s);
|
|
33
33
|
const freshResult=(status,extra={})=>({command:'upgrade',status,version:PACKAGE_VERSION,...extra});
|
|
34
|
+
// launchctl inherits a minimal PATH. The single runtime launcher supplies the
|
|
35
|
+
// matching Node/npm/npx bin for every child tool rather than each adapter
|
|
36
|
+
// mutating its own environment or assuming an interactive user's shell.
|
|
37
|
+
export const runtimeLaunchEnv=(env=process.env)=>({
|
|
38
|
+
...env,PATH:[dirname(process.execPath),env.PATH].filter(Boolean).join(delimiter)
|
|
39
|
+
});
|
|
40
|
+
|
|
34
41
|
|
|
35
42
|
export function upgradeLayout(base=runtimeRoot(),version=PACKAGE_VERSION){
|
|
36
43
|
if(!safeVersion(version))throw Error('INVALID_VERSION');
|
|
@@ -321,7 +328,7 @@ export async function upgradeRuntime(options={}){
|
|
|
321
328
|
main.command=quote(process.execPath)+' '+quote(p.entry)+' mcp';
|
|
322
329
|
atomicWrite(p.profile,JSON.stringify(profile,null,2)+'\n');
|
|
323
330
|
phase='start-new';
|
|
324
|
-
const started=await cli(p.entry,'start',{env:{...
|
|
331
|
+
const started=await cli(p.entry,'start',{env:{...runtimeLaunchEnv(),CHAT_LOOP_SKIP_UPGRADE:'1'}});
|
|
325
332
|
if(!['OK','STARTING'].includes(started.status))
|
|
326
333
|
throw Object.assign(Error('NEW_RUNTIME_UNHEALTHY'),{code:'NEW_RUNTIME_UNHEALTHY'});
|
|
327
334
|
phase='record-new';
|