@nac3/forge-cli 1.19.5 → 1.20.1
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/bin/yf.d.ts.map +1 -1
- package/dist/bin/yf.js +2 -1
- package/dist/bin/yf.js.map +1 -1
- package/dist/chat/instance_lock.d.ts +98 -0
- package/dist/chat/instance_lock.d.ts.map +1 -1
- package/dist/chat/instance_lock.js +135 -11
- package/dist/chat/instance_lock.js.map +1 -1
- package/dist/chat/instances.d.ts +84 -0
- package/dist/chat/instances.d.ts.map +1 -0
- package/dist/chat/instances.js +224 -0
- package/dist/chat/instances.js.map +1 -0
- package/dist/chat/panel.d.ts.map +1 -1
- package/dist/chat/panel.js +276 -5
- package/dist/chat/panel.js.map +1 -1
- package/dist/chat/server.d.ts.map +1 -1
- package/dist/chat/server.js +64 -1
- package/dist/chat/server.js.map +1 -1
- package/dist/chat/tools/evidence.d.ts.map +1 -1
- package/dist/chat/tools/evidence.js +7 -3
- package/dist/chat/tools/evidence.js.map +1 -1
- package/dist/commands/task.d.ts +13 -0
- package/dist/commands/task.d.ts.map +1 -1
- package/dist/commands/task.js +134 -0
- package/dist/commands/task.js.map +1 -1
- package/dist/commands/upgrade.d.ts +15 -0
- package/dist/commands/upgrade.d.ts.map +1 -1
- package/dist/commands/upgrade.js +63 -0
- package/dist/commands/upgrade.js.map +1 -1
- package/dist/commands/urazuke.d.ts.map +1 -1
- package/dist/commands/urazuke.js +68 -1
- package/dist/commands/urazuke.js.map +1 -1
- package/dist/core/forge_profile.d.ts.map +1 -1
- package/dist/core/forge_profile.js +41 -4
- package/dist/core/forge_profile.js.map +1 -1
- package/dist/core/provider_keys.d.ts +10 -0
- package/dist/core/provider_keys.d.ts.map +1 -1
- package/dist/core/provider_keys.js +19 -0
- package/dist/core/provider_keys.js.map +1 -1
- package/dist/core/whats_new.d.ts.map +1 -1
- package/dist/core/whats_new.js +26 -0
- package/dist/core/whats_new.js.map +1 -1
- package/dist/urazuke/current.d.ts +5 -0
- package/dist/urazuke/current.d.ts.map +1 -1
- package/dist/urazuke/current.js +14 -3
- package/dist/urazuke/current.js.map +1 -1
- package/dist/urazuke/cycle.d.ts.map +1 -1
- package/dist/urazuke/cycle.js +6 -2
- package/dist/urazuke/cycle.js.map +1 -1
- package/dist/urazuke/evidence.d.ts.map +1 -1
- package/dist/urazuke/evidence.js +9 -1
- package/dist/urazuke/evidence.js.map +1 -1
- package/dist/urazuke/freeze.d.ts +29 -0
- package/dist/urazuke/freeze.d.ts.map +1 -0
- package/dist/urazuke/freeze.js +150 -0
- package/dist/urazuke/freeze.js.map +1 -0
- package/dist/urazuke/gate.d.ts +18 -1
- package/dist/urazuke/gate.d.ts.map +1 -1
- package/dist/urazuke/gate.js +21 -0
- package/dist/urazuke/gate.js.map +1 -1
- package/dist/urazuke/gates_data.d.ts +219 -0
- package/dist/urazuke/gates_data.d.ts.map +1 -0
- package/dist/urazuke/gates_data.js +441 -0
- package/dist/urazuke/gates_data.js.map +1 -0
- package/dist/urazuke/prompts_client.d.ts +6 -0
- package/dist/urazuke/prompts_client.d.ts.map +1 -1
- package/dist/urazuke/prompts_client.js +1 -1
- package/dist/urazuke/prompts_client.js.map +1 -1
- package/dist/urazuke/receipts.d.ts +53 -1
- package/dist/urazuke/receipts.d.ts.map +1 -1
- package/dist/urazuke/receipts.js +65 -3
- package/dist/urazuke/receipts.js.map +1 -1
- package/dist/urazuke/ruleset.d.ts +56 -0
- package/dist/urazuke/ruleset.d.ts.map +1 -0
- package/dist/urazuke/ruleset.js +159 -0
- package/dist/urazuke/ruleset.js.map +1 -0
- package/dist/urazuke/start.d.ts +5 -0
- package/dist/urazuke/start.d.ts.map +1 -1
- package/dist/urazuke/start.js +39 -2
- package/dist/urazuke/start.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/bin/yf.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"yf.d.ts","sourceRoot":"","sources":["../../src/bin/yf.ts"],"names":[],"mappings":";AAUA,OAAO,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA0EpC,wBAAgB,YAAY,IAAI,OAAO,
|
|
1
|
+
{"version":3,"file":"yf.d.ts","sourceRoot":"","sources":["../../src/bin/yf.ts"],"names":[],"mappings":";AAUA,OAAO,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA0EpC,wBAAgB,YAAY,IAAI,OAAO,CAkHtC"}
|
package/dist/bin/yf.js
CHANGED
|
@@ -33,7 +33,7 @@ import { registerProjectsCommand } from '../commands/projects.js';
|
|
|
33
33
|
import { registerPendingCommand } from '../commands/pending.js';
|
|
34
34
|
import { registerWorkflowCommand } from '../commands/workflow.js';
|
|
35
35
|
import { registerUrazukeCommand } from '../commands/urazuke.js';
|
|
36
|
-
import { registerTaskCommand } from '../commands/task.js';
|
|
36
|
+
import { registerTaskCommand, registerInstanceCommand } from '../commands/task.js';
|
|
37
37
|
import { registerStartCommand } from '../commands/start.js';
|
|
38
38
|
import { registerWiringCommand } from '../commands/wiring.js';
|
|
39
39
|
import { registerTestAgentCommand } from '../commands/test_agent.js';
|
|
@@ -125,6 +125,7 @@ export function buildProgram() {
|
|
|
125
125
|
registerWorkflowCommand(program);
|
|
126
126
|
registerUrazukeCommand(program);
|
|
127
127
|
registerTaskCommand(program);
|
|
128
|
+
registerInstanceCommand(program);
|
|
128
129
|
registerStartCommand(program);
|
|
129
130
|
registerWiringCommand(program);
|
|
130
131
|
registerTestAgentCommand(program);
|
package/dist/bin/yf.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"yf.js","sourceRoot":"","sources":["../../src/bin/yf.ts"],"names":[],"mappings":";AACA;;;;;;;;GAQG;AACH,OAAO,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,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CAAC,KAAK,CAAC,mBAAmB,CAAC,EAAW,CAAC,CAAC,CAAC;gBACzD,CAAC;gBAAC,MAAM,CAAC;oBACP;oEACgD;oBAChD,OAAO,CAAC,KAAK,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;gBAClE,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,KAAK,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;YAClE,CAAC;YACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -3,22 +3,101 @@ export interface LockHolder {
|
|
|
3
3
|
port: number;
|
|
4
4
|
root: string;
|
|
5
5
|
since: number;
|
|
6
|
+
/** When the holder last proved it was alive (ms). */
|
|
7
|
+
beat_at?: number;
|
|
8
|
+
/** V8 heap used / its ceiling, at that beat. */
|
|
9
|
+
heap_mb?: number;
|
|
10
|
+
heap_limit_mb?: number;
|
|
11
|
+
/** Resident set at that beat. A death by memory becomes readable in
|
|
12
|
+
* Forge instead of in the operating system's event viewer. */
|
|
13
|
+
rss_mb?: number;
|
|
14
|
+
/** What kind of process holds it: a chat panel, a `yf start`. */
|
|
15
|
+
kind?: 'panel' | 'start';
|
|
16
|
+
/** The Forge version of the holder, so a module replaced underneath a
|
|
17
|
+
* live process is visible as a version mismatch. */
|
|
18
|
+
version?: string;
|
|
19
|
+
/** The directory this Forge was LOADED from (the package root, not the
|
|
20
|
+
* project root). Recorded so the global update can tell a panel running
|
|
21
|
+
* off the global module -- which is the one it is about to pull the floor
|
|
22
|
+
* out from under -- from one running off a checkout (PND-160). Taken from
|
|
23
|
+
* the module's own location, so it never depends on reading another
|
|
24
|
+
* process's command line. */
|
|
25
|
+
module_dir?: string;
|
|
26
|
+
}
|
|
27
|
+
/** A holder that stopped breathing without releasing its lock.
|
|
28
|
+
*
|
|
29
|
+
* The signal is the lock FILE itself: an ordered shutdown removes it, so a
|
|
30
|
+
* file still on disk whose pid is gone means the process died without
|
|
31
|
+
* getting to run its handler. No extra bookkeeping, and no new race -- the
|
|
32
|
+
* exclusive create keeps protecting the normal restart, which still finds
|
|
33
|
+
* no file at all. */
|
|
34
|
+
export interface DeadInstance {
|
|
35
|
+
pid: number;
|
|
36
|
+
port: number;
|
|
37
|
+
root: string;
|
|
38
|
+
/** When it started. */
|
|
39
|
+
since: number;
|
|
40
|
+
/** Its last heartbeat, when it had one. Undefined for a lock written by a
|
|
41
|
+
* Forge older than the heartbeat: then the hour of death is unknown, and
|
|
42
|
+
* must be reported as unknown rather than guessed from the file. */
|
|
43
|
+
beat_at?: number;
|
|
44
|
+
heap_mb?: number;
|
|
45
|
+
heap_limit_mb?: number;
|
|
46
|
+
rss_mb?: number;
|
|
47
|
+
kind?: 'panel' | 'start';
|
|
48
|
+
version?: string;
|
|
49
|
+
module_dir?: string;
|
|
50
|
+
/** True when the last beat showed heap above 85% of its ceiling: the
|
|
51
|
+
* death is consistent with running out of memory. Stated as consistent,
|
|
52
|
+
* never as proven -- Forge does not see the kill. */
|
|
53
|
+
memory_pressure: boolean;
|
|
6
54
|
}
|
|
7
55
|
export interface LockResult {
|
|
8
56
|
ok: boolean;
|
|
9
57
|
/** Present when ok=false: the live instance already holding this root. */
|
|
10
58
|
holder?: LockHolder;
|
|
59
|
+
/** Present when ok=true AND the lock we reclaimed belonged to a process
|
|
60
|
+
* that died without releasing it. This is what lets the panel tell the
|
|
61
|
+
* owner "the previous session was cut at HH:MM" instead of opening as if
|
|
62
|
+
* nothing had happened. */
|
|
63
|
+
previous?: DeadInstance;
|
|
11
64
|
/** Present when ok=true: remove the lock (only if we still own it). */
|
|
12
65
|
release?: () => void;
|
|
13
66
|
/** Present when ok=true: rewrite the stored port once the real bound port
|
|
14
67
|
* is known (the requested port may have changed via fallback). */
|
|
15
68
|
update?: (port: number) => void;
|
|
69
|
+
/** Present when ok=true: refresh the heartbeat. Call it on an interval;
|
|
70
|
+
* the stored beat is what dates a death that leaves no other trace. */
|
|
71
|
+
heartbeat?: () => void;
|
|
16
72
|
}
|
|
17
73
|
/** Thrown by startChatServer when a live instance already owns the root. */
|
|
18
74
|
export declare class DuplicateInstanceError extends Error {
|
|
19
75
|
readonly holder: LockHolder;
|
|
20
76
|
constructor(holder: LockHolder);
|
|
21
77
|
}
|
|
78
|
+
/** Where every instance lock of this machine lives. Exported because the
|
|
79
|
+
* instance registry (src/chat/instances.ts) enumerates it: a panel is not a
|
|
80
|
+
* supervisor task, so the only record that it exists is its lock.
|
|
81
|
+
*
|
|
82
|
+
* YF_LOCKS_DIR redirects just this directory. It exists so a test can get
|
|
83
|
+
* an isolated registry WITHOUT moving TMPDIR/TEMP/TMP, which is
|
|
84
|
+
* process-wide: with maxWorkers=2 many test files share a worker, and a
|
|
85
|
+
* dozen of them build their temp HOME from os.tmpdir(), so redirecting it
|
|
86
|
+
* reaches far past the file that did it. Learned the hard way in this very
|
|
87
|
+
* session -- the first version of the instance-register test moved TMPDIR
|
|
88
|
+
* and the full-suite run came back with failures in unrelated fresh-user
|
|
89
|
+
* files that pass in isolation. A narrow override is the fix; a broad one
|
|
90
|
+
* was the bug. */
|
|
91
|
+
export declare function locksDir(): string;
|
|
92
|
+
/** A heap/RSS sample for the heartbeat. Cheap on purpose: no subprocess, no
|
|
93
|
+
* syscall beyond what node already keeps, because this runs on a timer
|
|
94
|
+
* inside the process it measures. */
|
|
95
|
+
export declare function selfVitals(): {
|
|
96
|
+
heap_mb: number;
|
|
97
|
+
heap_limit_mb: number;
|
|
98
|
+
rss_mb: number;
|
|
99
|
+
};
|
|
100
|
+
export declare function toDeadInstance(h: LockHolder): DeadInstance;
|
|
22
101
|
/** True when a process with `pid` is currently running. `process.kill(pid, 0)`
|
|
23
102
|
* sends no signal -- it only probes existence. EPERM means it exists but is
|
|
24
103
|
* not ours (still alive); ESRCH means gone. */
|
|
@@ -26,10 +105,29 @@ export declare function pidAlive(pid: number): boolean;
|
|
|
26
105
|
/** Claim the single-instance lock for a project root. Returns {ok:false,
|
|
27
106
|
* holder} if a LIVE instance already owns it, else writes our lock and
|
|
28
107
|
* returns {ok:true, release, update}. */
|
|
108
|
+
/** The package root this Forge is running from: two levels up from
|
|
109
|
+
* dist/chat/, i.e. the directory that holds package.json. Computed from the
|
|
110
|
+
* module's own URL so it is right whether Forge was installed globally,
|
|
111
|
+
* linked, or run from a checkout. */
|
|
112
|
+
export declare function selfModuleDir(): string;
|
|
29
113
|
export declare function acquireProjectLock(root: string, self: {
|
|
30
114
|
pid: number;
|
|
31
115
|
port: number;
|
|
116
|
+
kind?: 'panel' | 'start';
|
|
117
|
+
version?: string;
|
|
32
118
|
}): LockResult;
|
|
119
|
+
/** Every lock on this machine, split into what is still running and what
|
|
120
|
+
* died without releasing.
|
|
121
|
+
*
|
|
122
|
+
* This exists because a panel (`yf chat`) or a `yf start` is NOT a
|
|
123
|
+
* supervisor task, so `yf task list` never saw them: on 2026-10-21 three
|
|
124
|
+
* node processes from two days earlier were holding 134 GB of virtual space
|
|
125
|
+
* between them and nothing in Forge could name them (PND-162). The lock is
|
|
126
|
+
* the only record that an instance exists, so it is also the register. */
|
|
127
|
+
export declare function listInstanceLocks(): {
|
|
128
|
+
alive: LockHolder[];
|
|
129
|
+
dead: DeadInstance[];
|
|
130
|
+
};
|
|
33
131
|
/** A human, actionable message for the CLI when a duplicate is refused. */
|
|
34
132
|
export declare function duplicateMessage(holder: LockHolder): string;
|
|
35
133
|
//# sourceMappingURL=instance_lock.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instance_lock.d.ts","sourceRoot":"","sources":["../../src/chat/instance_lock.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"instance_lock.d.ts","sourceRoot":"","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ASCII-only.
|
|
18
18
|
*/
|
|
19
19
|
import { createHash } from 'node:crypto';
|
|
20
|
-
import { mkdirSync, readFileSync, writeFileSync, rmSync } from 'node:fs';
|
|
20
|
+
import { mkdirSync, readFileSync, readdirSync, writeFileSync, rmSync } from 'node:fs';
|
|
21
21
|
import * as os from 'node:os';
|
|
22
22
|
import * as path from 'node:path';
|
|
23
|
+
import v8 from 'node:v8';
|
|
24
|
+
import { fileURLToPath } from 'node:url';
|
|
23
25
|
/** Thrown by startChatServer when a live instance already owns the root. */
|
|
24
26
|
export class DuplicateInstanceError extends Error {
|
|
25
27
|
holder;
|
|
@@ -33,10 +35,59 @@ function normRoot(root) {
|
|
|
33
35
|
const r = path.resolve(root);
|
|
34
36
|
return process.platform === 'win32' ? r.toLowerCase() : r;
|
|
35
37
|
}
|
|
38
|
+
/** Where every instance lock of this machine lives. Exported because the
|
|
39
|
+
* instance registry (src/chat/instances.ts) enumerates it: a panel is not a
|
|
40
|
+
* supervisor task, so the only record that it exists is its lock.
|
|
41
|
+
*
|
|
42
|
+
* YF_LOCKS_DIR redirects just this directory. It exists so a test can get
|
|
43
|
+
* an isolated registry WITHOUT moving TMPDIR/TEMP/TMP, which is
|
|
44
|
+
* process-wide: with maxWorkers=2 many test files share a worker, and a
|
|
45
|
+
* dozen of them build their temp HOME from os.tmpdir(), so redirecting it
|
|
46
|
+
* reaches far past the file that did it. Learned the hard way in this very
|
|
47
|
+
* session -- the first version of the instance-register test moved TMPDIR
|
|
48
|
+
* and the full-suite run came back with failures in unrelated fresh-user
|
|
49
|
+
* files that pass in isolation. A narrow override is the fix; a broad one
|
|
50
|
+
* was the bug. */
|
|
51
|
+
export function locksDir() {
|
|
52
|
+
const override = process.env['YF_LOCKS_DIR'];
|
|
53
|
+
if (override && override.trim())
|
|
54
|
+
return override.trim();
|
|
55
|
+
return path.join(os.tmpdir(), 'yujin-forge', 'locks');
|
|
56
|
+
}
|
|
36
57
|
function lockPath(root) {
|
|
37
|
-
const dir = path.join(os.tmpdir(), 'yujin-forge', 'locks');
|
|
38
58
|
const h = createHash('sha1').update(normRoot(root)).digest('hex').slice(0, 16);
|
|
39
|
-
return path.join(
|
|
59
|
+
return path.join(locksDir(), h + '.json');
|
|
60
|
+
}
|
|
61
|
+
/** A heap/RSS sample for the heartbeat. Cheap on purpose: no subprocess, no
|
|
62
|
+
* syscall beyond what node already keeps, because this runs on a timer
|
|
63
|
+
* inside the process it measures. */
|
|
64
|
+
export function selfVitals() {
|
|
65
|
+
const MB = 1024 * 1024;
|
|
66
|
+
let limit = 0;
|
|
67
|
+
try {
|
|
68
|
+
limit = Math.round(v8.getHeapStatistics().heap_size_limit / MB);
|
|
69
|
+
}
|
|
70
|
+
catch { /* best effort */ }
|
|
71
|
+
const m = process.memoryUsage();
|
|
72
|
+
return { heap_mb: Math.round(m.heapUsed / MB), heap_limit_mb: limit, rss_mb: Math.round(m.rss / MB) };
|
|
73
|
+
}
|
|
74
|
+
/** Heap at or above this share of its ceiling makes a death consistent with
|
|
75
|
+
* an out-of-memory. Matches heap_watch's `critical` band minus a margin:
|
|
76
|
+
* the last beat before a kill is rarely the peak. */
|
|
77
|
+
const PRESSURE_RATIO = 0.85;
|
|
78
|
+
export function toDeadInstance(h) {
|
|
79
|
+
const ratio = h.heap_limit_mb && h.heap_mb ? h.heap_mb / h.heap_limit_mb : 0;
|
|
80
|
+
return {
|
|
81
|
+
pid: h.pid, port: h.port, root: h.root, since: h.since,
|
|
82
|
+
...(h.beat_at != null ? { beat_at: h.beat_at } : {}),
|
|
83
|
+
...(h.heap_mb != null ? { heap_mb: h.heap_mb } : {}),
|
|
84
|
+
...(h.heap_limit_mb != null ? { heap_limit_mb: h.heap_limit_mb } : {}),
|
|
85
|
+
...(h.rss_mb != null ? { rss_mb: h.rss_mb } : {}),
|
|
86
|
+
...(h.kind ? { kind: h.kind } : {}),
|
|
87
|
+
...(h.version ? { version: h.version } : {}),
|
|
88
|
+
...(h.module_dir ? { module_dir: h.module_dir } : {}),
|
|
89
|
+
memory_pressure: ratio >= PRESSURE_RATIO,
|
|
90
|
+
};
|
|
40
91
|
}
|
|
41
92
|
/** True when a process with `pid` is currently running. `process.kill(pid, 0)`
|
|
42
93
|
* sends no signal -- it only probes existence. EPERM means it exists but is
|
|
@@ -64,22 +115,46 @@ function readHolder(p) {
|
|
|
64
115
|
/** Claim the single-instance lock for a project root. Returns {ok:false,
|
|
65
116
|
* holder} if a LIVE instance already owns it, else writes our lock and
|
|
66
117
|
* returns {ok:true, release, update}. */
|
|
118
|
+
/** The package root this Forge is running from: two levels up from
|
|
119
|
+
* dist/chat/, i.e. the directory that holds package.json. Computed from the
|
|
120
|
+
* module's own URL so it is right whether Forge was installed globally,
|
|
121
|
+
* linked, or run from a checkout. */
|
|
122
|
+
export function selfModuleDir() {
|
|
123
|
+
try {
|
|
124
|
+
return path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..');
|
|
125
|
+
}
|
|
126
|
+
catch {
|
|
127
|
+
return '';
|
|
128
|
+
}
|
|
129
|
+
}
|
|
67
130
|
export function acquireProjectLock(root, self) {
|
|
68
131
|
const p = lockPath(root);
|
|
69
132
|
try {
|
|
70
133
|
mkdirSync(path.dirname(p), { recursive: true });
|
|
71
134
|
}
|
|
72
135
|
catch { /* exists */ }
|
|
73
|
-
const
|
|
74
|
-
|
|
136
|
+
const since = Date.now();
|
|
137
|
+
const moduleDir = selfModuleDir();
|
|
138
|
+
const describe = (port, beat) => ({
|
|
139
|
+
pid: self.pid, port, root: path.resolve(root), since,
|
|
140
|
+
...(self.kind ? { kind: self.kind } : {}),
|
|
141
|
+
...(self.version ? { version: self.version } : {}),
|
|
142
|
+
...(moduleDir ? { module_dir: moduleDir } : {}),
|
|
143
|
+
...(beat ? { beat_at: Date.now(), ...selfVitals() } : {}),
|
|
144
|
+
});
|
|
145
|
+
const write = (port, beat = false) => {
|
|
75
146
|
try {
|
|
76
|
-
writeFileSync(p, JSON.stringify(
|
|
147
|
+
writeFileSync(p, JSON.stringify(describe(port, beat)), 'utf-8');
|
|
77
148
|
}
|
|
78
149
|
catch { /* best effort */ }
|
|
79
150
|
};
|
|
80
|
-
/* Exclusive create wins the common no-lock case + the simultaneous race.
|
|
151
|
+
/* Exclusive create wins the common no-lock case + the simultaneous race.
|
|
152
|
+
* Note that release() still REMOVES the file, so this path is still the
|
|
153
|
+
* normal one after a clean shutdown -- which is exactly what makes a
|
|
154
|
+
* leftover file meaningful below. */
|
|
155
|
+
let previous;
|
|
81
156
|
try {
|
|
82
|
-
writeFileSync(p, JSON.stringify(
|
|
157
|
+
writeFileSync(p, JSON.stringify(describe(self.port, false)), { flag: 'wx' });
|
|
83
158
|
}
|
|
84
159
|
catch {
|
|
85
160
|
/* File exists -> inspect the incumbent. */
|
|
@@ -87,7 +162,12 @@ export function acquireProjectLock(root, self) {
|
|
|
87
162
|
if (held && held.pid !== self.pid && pidAlive(held.pid)) {
|
|
88
163
|
return { ok: false, holder: held };
|
|
89
164
|
}
|
|
90
|
-
/* Stale (dead pid) or ours -> reclaim by overwriting.
|
|
165
|
+
/* Stale (dead pid) or ours -> reclaim by overwriting. And if it was
|
|
166
|
+
* somebody else's dead pid, the file being here at all means that
|
|
167
|
+
* somebody never got to release it: it was killed. That is the fact the
|
|
168
|
+
* owner could only get out of the Windows Event Log until now. */
|
|
169
|
+
if (held && held.pid !== self.pid)
|
|
170
|
+
previous = toDeadInstance(held);
|
|
91
171
|
write(self.port);
|
|
92
172
|
}
|
|
93
173
|
const release = () => {
|
|
@@ -102,9 +182,53 @@ export function acquireProjectLock(root, self) {
|
|
|
102
182
|
const update = (port) => {
|
|
103
183
|
const cur = readHolder(p);
|
|
104
184
|
if (!cur || cur.pid === self.pid)
|
|
105
|
-
write(port);
|
|
185
|
+
write(port, true);
|
|
106
186
|
};
|
|
107
|
-
|
|
187
|
+
/** Refresh the beat, but only while the lock is still ours: a heartbeat
|
|
188
|
+
* that rewrote somebody else's lock would be worse than none. */
|
|
189
|
+
const heartbeat = () => {
|
|
190
|
+
const cur = readHolder(p);
|
|
191
|
+
if (!cur || cur.pid !== self.pid)
|
|
192
|
+
return;
|
|
193
|
+
try {
|
|
194
|
+
writeFileSync(p, JSON.stringify({ ...cur, beat_at: Date.now(), ...selfVitals() }), 'utf-8');
|
|
195
|
+
}
|
|
196
|
+
catch { /* a heartbeat must never throw */ }
|
|
197
|
+
};
|
|
198
|
+
return { ok: true, release, update, heartbeat, ...(previous ? { previous } : {}) };
|
|
199
|
+
}
|
|
200
|
+
/** Every lock on this machine, split into what is still running and what
|
|
201
|
+
* died without releasing.
|
|
202
|
+
*
|
|
203
|
+
* This exists because a panel (`yf chat`) or a `yf start` is NOT a
|
|
204
|
+
* supervisor task, so `yf task list` never saw them: on 2026-10-21 three
|
|
205
|
+
* node processes from two days earlier were holding 134 GB of virtual space
|
|
206
|
+
* between them and nothing in Forge could name them (PND-162). The lock is
|
|
207
|
+
* the only record that an instance exists, so it is also the register. */
|
|
208
|
+
export function listInstanceLocks() {
|
|
209
|
+
const alive = [];
|
|
210
|
+
const dead = [];
|
|
211
|
+
let names = [];
|
|
212
|
+
try {
|
|
213
|
+
names = readdirSync(locksDir());
|
|
214
|
+
}
|
|
215
|
+
catch {
|
|
216
|
+
return { alive, dead };
|
|
217
|
+
}
|
|
218
|
+
for (const name of names) {
|
|
219
|
+
if (!name.endsWith('.json'))
|
|
220
|
+
continue;
|
|
221
|
+
const h = readHolder(path.join(locksDir(), name));
|
|
222
|
+
if (!h)
|
|
223
|
+
continue;
|
|
224
|
+
if (pidAlive(h.pid))
|
|
225
|
+
alive.push(h);
|
|
226
|
+
else
|
|
227
|
+
dead.push(toDeadInstance(h));
|
|
228
|
+
}
|
|
229
|
+
alive.sort((a, b) => a.since - b.since);
|
|
230
|
+
dead.sort((a, b) => a.since - b.since);
|
|
231
|
+
return { alive, dead };
|
|
108
232
|
}
|
|
109
233
|
/** A human, actionable message for the CLI when a duplicate is refused. */
|
|
110
234
|
export function duplicateMessage(holder) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instance_lock.js","sourceRoot":"","sources":["../../src/chat/instance_lock.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"instance_lock.js","sourceRoot":"","sources":["../../src/chat/instance_lock.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACtF,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAwFzC,4EAA4E;AAC5E,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IACtC,MAAM,CAAa;IAC5B,YAAY,MAAkB;QAC5B,KAAK,CAAC,yDAAyD,CAAC,CAAC;QACjE,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;QACrC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAED,SAAS,QAAQ,CAAC,IAAY;IAC5B,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,OAAO,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AAC5D,CAAC;AAED;;;;;;;;;;;;mBAYmB;AACnB,MAAM,UAAU,QAAQ;IACtB,MAAM,QAAQ,GAAG,OAAO,CA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QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC;YAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;;YAC9B,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;IACpC,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;IACxC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;IACvC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AACzB,CAAC;AAED,2EAA2E;AAC3E,MAAM,UAAU,gBAAgB,CAAC,MAAkB;IACjD,OAAO,2DAA2D;UAC9D,IAAI,GAAG,MAAM,CAAC,IAAI,GAAG,IAAI;UACzB,SAAS,GAAG,MAAM,CAAC,GAAG,GAAG,8BAA8B,GAAG,MAAM,CAAC,IAAI,GAAG,OAAO;UAC/E,4EAA4E;UAC5E,0EAA0E;UAC1E,oBAAoB,CAAC;AAC3B,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { type DeadInstance } from './instance_lock.js';
|
|
2
|
+
export interface LiveInstance {
|
|
3
|
+
pid: number;
|
|
4
|
+
port: number;
|
|
5
|
+
root: string;
|
|
6
|
+
kind: 'panel' | 'start' | 'desconocido';
|
|
7
|
+
version?: string;
|
|
8
|
+
started_at: number;
|
|
9
|
+
age_minutes: number;
|
|
10
|
+
/** Last heartbeat. Absent when the holder predates the heartbeat: then
|
|
11
|
+
* "is it responsive" is simply unknown, and is reported that way. */
|
|
12
|
+
beat_at?: number;
|
|
13
|
+
/** Minutes since the last beat. A number much larger than the beat
|
|
14
|
+
* interval means the process is alive but not breathing -- blocked, or
|
|
15
|
+
* stopped by a debugger. */
|
|
16
|
+
beat_age_minutes?: number;
|
|
17
|
+
heap_mb?: number;
|
|
18
|
+
heap_limit_mb?: number;
|
|
19
|
+
rss_mb?: number;
|
|
20
|
+
/** Virtual size, when the platform gave it. This is the number that
|
|
21
|
+
* exhausts the system's commit charge, and the one the heap hides. */
|
|
22
|
+
vsz_mb?: number;
|
|
23
|
+
/** The package root the process was loaded from (PND-160). */
|
|
24
|
+
module_dir?: string;
|
|
25
|
+
/** Started before this process did: left over from another session. */
|
|
26
|
+
from_previous_session: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface InstanceReport {
|
|
29
|
+
alive: LiveInstance[];
|
|
30
|
+
/** Sessions that died without releasing their lock, oldest first. */
|
|
31
|
+
dead: DeadInstance[];
|
|
32
|
+
/** True when the virtual size could not be read on this platform. Stated
|
|
33
|
+
* so a zero is never mistaken for "measured and small". */
|
|
34
|
+
vsz_unavailable?: boolean;
|
|
35
|
+
}
|
|
36
|
+
/** Virtual size in MB per pid, best effort, ONE query for all of them.
|
|
37
|
+
*
|
|
38
|
+
* Windows: Get-Process, which is the only place VirtualMemorySize64 lives.
|
|
39
|
+
* Linux: /proc/<pid>/statm, field 1, in pages. Elsewhere: nothing, and the
|
|
40
|
+
* caller is told it is nothing rather than zero. */
|
|
41
|
+
export declare function virtualSizes(pids: number[]): Promise<{
|
|
42
|
+
bytes: Map<number, number>;
|
|
43
|
+
unavailable: boolean;
|
|
44
|
+
}>;
|
|
45
|
+
/** The instance report. `with_vsz` costs one subprocess, so it is opt-in:
|
|
46
|
+
* the panel's startup notice does not need it, `yf task list` does. */
|
|
47
|
+
export declare function instanceReport(opts?: {
|
|
48
|
+
now?: number;
|
|
49
|
+
processStart?: number;
|
|
50
|
+
with_vsz?: boolean;
|
|
51
|
+
}): Promise<InstanceReport>;
|
|
52
|
+
/** The chat line for a PREVIOUS session that died without closing (PND-161).
|
|
53
|
+
*
|
|
54
|
+
* Empty when there is nothing to say -- and that is the hard rule here: an
|
|
55
|
+
* ordered shutdown removes its lock, so it reaches this function as
|
|
56
|
+
* nothing, and produces no message. A notice about the normal case becomes
|
|
57
|
+
* noise and then stops being read, which would cost exactly the signal
|
|
58
|
+
* this was built to give. */
|
|
59
|
+
export declare function renderDeathNotice(dead: DeadInstance[]): string;
|
|
60
|
+
/** The chat line for OTHER instances still running (PND-162). Only the ones
|
|
61
|
+
* from a previous session: the one the owner just opened is not news, and
|
|
62
|
+
* a second panel on another project is legitimate and current. */
|
|
63
|
+
export declare function renderOldInstancesNotice(alive: LiveInstance[], selfPid?: number): string;
|
|
64
|
+
/** Stop a Forge instance by pid, with its whole process tree.
|
|
65
|
+
*
|
|
66
|
+
* Two guards, and both matter. It refuses our own pid, and it refuses any
|
|
67
|
+
* pid that is not in the lock registry -- so this is a way to stop Forge
|
|
68
|
+
* instances, never a general process killer reachable from the chat. On
|
|
69
|
+
* Windows the tree flag is not optional: a panel's real work happens in
|
|
70
|
+
* children, and killing only the parent leaves them holding the memory
|
|
71
|
+
* that was the problem in the first place. */
|
|
72
|
+
export declare function stopInstance(pid: number, selfPid?: number): Promise<{
|
|
73
|
+
stopped: boolean;
|
|
74
|
+
reason?: string;
|
|
75
|
+
}>;
|
|
76
|
+
/** Instances running from the GLOBAL module, for the update precheck
|
|
77
|
+
* (PND-160). A panel keeps better_sqlite3.node mapped, and on Windows a
|
|
78
|
+
* mapped file cannot be replaced -- so `npm i -g` deletes the old module,
|
|
79
|
+
* fails to write the new native binary, and aborts leaving the global
|
|
80
|
+
* package as a bare node_modules with no dist and no binaries. `yf` stops
|
|
81
|
+
* existing. The matching is on the lock's own record of where the process
|
|
82
|
+
* came from, so it does not depend on reading another process's argv. */
|
|
83
|
+
export declare function instancesFromGlobal(alive: LiveInstance[], globalPrefix: string, selfPid?: number): LiveInstance[];
|
|
84
|
+
//# sourceMappingURL=instances.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instances.d.ts","sourceRoot":"","sources":["../../src/chat/instances.ts"],"names":[],"mappings":"AAsCA,OAA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