autodev-cli 1.4.191 → 1.4.193
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/out/cli.js +4 -0
- package/out/cli.js.map +1 -1
- package/out/commands/grokKeepalive.d.ts +10 -0
- package/out/commands/grokKeepalive.js +27 -0
- package/out/commands/grokKeepalive.js.map +1 -0
- package/out/commands/leaderStop.d.ts +10 -0
- package/out/commands/leaderStop.js +63 -0
- package/out/commands/leaderStop.js.map +1 -0
- package/out/pendingSteers.d.ts +28 -0
- package/out/pendingSteers.js +145 -0
- package/out/pendingSteers.js.map +1 -0
- package/out/providers/acp/AcpSession.d.ts +31 -0
- package/out/providers/acp/AcpSession.js +70 -1
- package/out/providers/acp/AcpSession.js.map +1 -1
- package/out/providers/grok/GrokAcpSession.d.ts +14 -1
- package/out/providers/grok/GrokAcpSession.js +29 -2
- package/out/providers/grok/GrokAcpSession.js.map +1 -1
- package/out/providers/grok/keepalive.d.ts +15 -0
- package/out/providers/grok/keepalive.js +141 -0
- package/out/providers/grok/keepalive.js.map +1 -0
- package/out/providers/grok/keepaliveMain.d.ts +1 -0
- package/out/providers/grok/keepaliveMain.js +22 -0
- package/out/providers/grok/keepaliveMain.js.map +1 -0
- package/out/providers/grok/leader.d.ts +66 -0
- package/out/providers/grok/leader.js +390 -0
- package/out/providers/grok/leader.js.map +1 -0
- package/out/providers/grok/tui.d.ts +18 -0
- package/out/providers/grok/tui.js +187 -28
- package/out/providers/grok/tui.js.map +1 -1
- package/out/providers/opencode/acp.d.ts +13 -1
- package/out/providers/opencode/acp.js +45 -0
- package/out/providers/opencode/acp.js.map +1 -1
- package/out/providers/opencode/sdk.d.ts +1 -0
- package/out/providers/opencode/sdk.js +8 -0
- package/out/providers/opencode/sdk.js.map +1 -1
- package/out/taskLoop.d.ts +29 -0
- package/out/taskLoop.js +177 -2
- package/out/taskLoop.js.map +1 -1
- package/out/webSocketPoller.d.ts +6 -2
- package/out/webSocketPoller.js +8 -2
- package/out/webSocketPoller.js.map +1 -1
- package/out/webhookPoller.d.ts +4 -1
- package/out/webhookPoller.js +7 -0
- package/out/webhookPoller.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ---------------------------------------------------------------------------
|
|
3
|
+
// grok LEADER daemon — "always open, reconnect-never-reload" (Layer B, 1.4.193).
|
|
4
|
+
//
|
|
5
|
+
// GOAL: the grok backend OUTLIVES loop/app restarts so a restarted loop
|
|
6
|
+
// RECONNECTS to the live in-memory session with NO `session/load` replay (the
|
|
7
|
+
// office-feed spam Layer A only quieted). GATED behind env AUTODEV_GROK_LEADER,
|
|
8
|
+
// DEFAULT OFF — when off, the existing non-leader ACP path (1.4.188/1.4.191) is
|
|
9
|
+
// used UNCHANGED.
|
|
10
|
+
//
|
|
11
|
+
// ARCHITECTURE (verified live on grok 1.0.41; see memory `grok-leader-always-open`
|
|
12
|
+
// + the 1.4.193 re-spike):
|
|
13
|
+
// • A per-agent grok LEADER daemon (`grok agent --always-approve leader
|
|
14
|
+
// --no-exit-on-disconnect --relay-on-demand --no-auto-update --leader-socket
|
|
15
|
+
// <per-agent .sock>`) is a shared backend that survives client disconnects.
|
|
16
|
+
// • CRITICAL grok-1.0.41 fact: the leader EVICTS a session's in-memory context
|
|
17
|
+
// when its LAST client disconnects (the session persists on disk, but a fresh
|
|
18
|
+
// client then gets "unknown session id" and must `session/load` = the replay).
|
|
19
|
+
// So a bare leader is NOT enough for attach-without-load across a loop restart.
|
|
20
|
+
// • Fix: a detached KEEPALIVE client holds the session warm in the leader's
|
|
21
|
+
// memory forever. Loop clients then attach as a SECOND concurrent client and
|
|
22
|
+
// `session/prompt {sessionId}` DIRECTLY — context intact, NO session/load —
|
|
23
|
+
// across any number of loop-process restarts (proven: codeword recalled,
|
|
24
|
+
// zero session/load).
|
|
25
|
+
// • The ONE `session/load` (cold recovery from disk) happens inside the
|
|
26
|
+
// keepalive at cold start when it is seeded with the persisted id; every
|
|
27
|
+
// subsequent loop restart is a warm attach. No live keepalive ⇒ degrade to
|
|
28
|
+
// Layer A (session/load), never data-loss.
|
|
29
|
+
//
|
|
30
|
+
// REAP BY PID (critical): `grok leader list/kill` CANNOT see a per-socket
|
|
31
|
+
// `--relay-on-demand` leader (verified: list→[], "No leader candidates found").
|
|
32
|
+
// So we track the leader + keepalive PIDs in `.autodev/leader.json` and reap the
|
|
33
|
+
// pid-trees ourselves. `autodev leader-stop <root>` (hidden) is what the app calls
|
|
34
|
+
// on office stop/remove/quit. The loop's own SIGINT/exit reaper kills ONLY the
|
|
35
|
+
// thin client (leader/keepalive are DETACHED, so they survive a loop restart).
|
|
36
|
+
// ---------------------------------------------------------------------------
|
|
37
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
38
|
+
if (k2 === undefined) k2 = k;
|
|
39
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
40
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
41
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
42
|
+
}
|
|
43
|
+
Object.defineProperty(o, k2, desc);
|
|
44
|
+
}) : (function(o, m, k, k2) {
|
|
45
|
+
if (k2 === undefined) k2 = k;
|
|
46
|
+
o[k2] = m[k];
|
|
47
|
+
}));
|
|
48
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
49
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
50
|
+
}) : function(o, v) {
|
|
51
|
+
o["default"] = v;
|
|
52
|
+
});
|
|
53
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
54
|
+
var ownKeys = function(o) {
|
|
55
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
56
|
+
var ar = [];
|
|
57
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
58
|
+
return ar;
|
|
59
|
+
};
|
|
60
|
+
return ownKeys(o);
|
|
61
|
+
};
|
|
62
|
+
return function (mod) {
|
|
63
|
+
if (mod && mod.__esModule) return mod;
|
|
64
|
+
var result = {};
|
|
65
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
66
|
+
__setModuleDefault(result, mod);
|
|
67
|
+
return result;
|
|
68
|
+
};
|
|
69
|
+
})();
|
|
70
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
71
|
+
exports.runKeepalive = void 0;
|
|
72
|
+
exports.leaderModeEnabled = leaderModeEnabled;
|
|
73
|
+
exports.leaderSocketPath = leaderSocketPath;
|
|
74
|
+
exports.leaderJsonPath = leaderJsonPath;
|
|
75
|
+
exports.leaderSidPath = leaderSidPath;
|
|
76
|
+
exports.readLeaderInfo = readLeaderInfo;
|
|
77
|
+
exports.writeLeaderInfo = writeLeaderInfo;
|
|
78
|
+
exports.removeLeaderInfo = removeLeaderInfo;
|
|
79
|
+
exports.isPidAlive = isPidAlive;
|
|
80
|
+
exports.decideLeaderAction = decideLeaderAction;
|
|
81
|
+
exports.leaderHealthy = leaderHealthy;
|
|
82
|
+
exports.keepaliveEntryPath = keepaliveEntryPath;
|
|
83
|
+
exports.ensureLeader = ensureLeader;
|
|
84
|
+
exports.stopLeader = stopLeader;
|
|
85
|
+
const fs = __importStar(require("fs"));
|
|
86
|
+
const os = __importStar(require("os"));
|
|
87
|
+
const path = __importStar(require("path"));
|
|
88
|
+
const crypto = __importStar(require("crypto"));
|
|
89
|
+
const child_process = __importStar(require("child_process"));
|
|
90
|
+
const killProcessTree_1 = require("../../core/killProcessTree");
|
|
91
|
+
const sessionState_1 = require("../../sessionState");
|
|
92
|
+
// Re-export the keepalive runner + its options so existing importers keep working.
|
|
93
|
+
var keepalive_1 = require("./keepalive");
|
|
94
|
+
Object.defineProperty(exports, "runKeepalive", { enumerable: true, get: function () { return keepalive_1.runKeepalive; } });
|
|
95
|
+
/** Env gate — leader mode is OPT-IN and DEFAULT OFF. Pure (env injectable). */
|
|
96
|
+
function leaderModeEnabled(env = process.env) {
|
|
97
|
+
const raw = String(env['AUTODEV_GROK_LEADER'] ?? '').toLowerCase().trim();
|
|
98
|
+
return raw === '1' || raw === 'true' || raw === 'on' || raw === 'yes';
|
|
99
|
+
}
|
|
100
|
+
/** Per-agent AF_UNIX socket. Prefer `.autodev/grok-leader.sock`; fall back to a
|
|
101
|
+
* hashed path under tmp when the workspace path would blow the ~108-byte sun_path
|
|
102
|
+
* limit (a deterministic function of the root either way). */
|
|
103
|
+
function leaderSocketPath(root) {
|
|
104
|
+
const inAutodev = path.join(root, '.autodev', 'grok-leader.sock');
|
|
105
|
+
if (Buffer.byteLength(inAutodev) <= 100) {
|
|
106
|
+
return inAutodev;
|
|
107
|
+
}
|
|
108
|
+
const h = crypto.createHash('sha1').update(path.resolve(root)).digest('hex').slice(0, 16);
|
|
109
|
+
return path.join(os.tmpdir(), `autodev-grok-${h}.sock`);
|
|
110
|
+
}
|
|
111
|
+
function leaderJsonPath(root) { return path.join(root, '.autodev', 'leader.json'); }
|
|
112
|
+
function leaderSidPath(root) { return path.join(root, '.autodev', 'grok-leader.sid'); }
|
|
113
|
+
function readLeaderInfo(root) {
|
|
114
|
+
try {
|
|
115
|
+
const raw = fs.readFileSync(leaderJsonPath(root), 'utf8');
|
|
116
|
+
const info = JSON.parse(raw);
|
|
117
|
+
if (info && typeof info.pid === 'number' && typeof info.socket === 'string') {
|
|
118
|
+
return info;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
catch { /* absent / malformed */ }
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
function writeLeaderInfo(root, info) {
|
|
125
|
+
try {
|
|
126
|
+
(0, sessionState_1.autodevDir)(root);
|
|
127
|
+
fs.writeFileSync(leaderJsonPath(root), JSON.stringify(info, null, 2), 'utf8');
|
|
128
|
+
}
|
|
129
|
+
catch { /* best effort */ }
|
|
130
|
+
}
|
|
131
|
+
function removeLeaderInfo(root) {
|
|
132
|
+
try {
|
|
133
|
+
fs.unlinkSync(leaderJsonPath(root));
|
|
134
|
+
}
|
|
135
|
+
catch { /* already gone */ }
|
|
136
|
+
}
|
|
137
|
+
/** `process.kill(pid, 0)` liveness probe — true iff the pid exists (and is ours
|
|
138
|
+
* or EPERM, which still means alive). */
|
|
139
|
+
function isPidAlive(pid) {
|
|
140
|
+
if (!pid || !Number.isInteger(pid) || pid <= 1) {
|
|
141
|
+
return false;
|
|
142
|
+
}
|
|
143
|
+
try {
|
|
144
|
+
process.kill(pid, 0);
|
|
145
|
+
return true;
|
|
146
|
+
}
|
|
147
|
+
catch (err) {
|
|
148
|
+
return err?.code === 'EPERM';
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* PURE orphan-sweep decision. Given the persisted info and the observed liveness
|
|
153
|
+
* of its pieces, decide whether to reuse a still-live leader ('adopt'), reap a
|
|
154
|
+
* stale/dead one ('reap-stale'), or spawn fresh ('spawn'). Unit-tested.
|
|
155
|
+
*/
|
|
156
|
+
function decideLeaderAction(info, alive) {
|
|
157
|
+
if (!info) {
|
|
158
|
+
return 'spawn';
|
|
159
|
+
}
|
|
160
|
+
const keepaliveOk = info.keepalivePid ? alive.keepalive : true;
|
|
161
|
+
if (alive.leader && keepaliveOk && alive.socket) {
|
|
162
|
+
return 'adopt';
|
|
163
|
+
}
|
|
164
|
+
return 'reap-stale';
|
|
165
|
+
}
|
|
166
|
+
/** Is the persisted leader fully healthy right now (adoptable)? */
|
|
167
|
+
function leaderHealthy(info) {
|
|
168
|
+
if (!info) {
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
171
|
+
const alive = { leader: isPidAlive(info.pid), keepalive: isPidAlive(info.keepalivePid), socket: (() => { try {
|
|
172
|
+
return fs.existsSync(info.socket);
|
|
173
|
+
}
|
|
174
|
+
catch {
|
|
175
|
+
return false;
|
|
176
|
+
} })() };
|
|
177
|
+
return decideLeaderAction(info, alive) === 'adopt';
|
|
178
|
+
}
|
|
179
|
+
function readSidFile(sidFile) {
|
|
180
|
+
try {
|
|
181
|
+
const s = fs.readFileSync(sidFile, 'utf8').trim();
|
|
182
|
+
return s || null;
|
|
183
|
+
}
|
|
184
|
+
catch {
|
|
185
|
+
return null;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
async function waitUntil(pred, ms, stepMs = 100) {
|
|
189
|
+
const end = Date.now() + ms;
|
|
190
|
+
while (Date.now() < end) {
|
|
191
|
+
if (pred()) {
|
|
192
|
+
return true;
|
|
193
|
+
}
|
|
194
|
+
await new Promise((r) => setTimeout(r, stepMs));
|
|
195
|
+
}
|
|
196
|
+
return pred();
|
|
197
|
+
}
|
|
198
|
+
function openLogFd(file) {
|
|
199
|
+
try {
|
|
200
|
+
return fs.openSync(file, 'a');
|
|
201
|
+
}
|
|
202
|
+
catch {
|
|
203
|
+
return 'ignore';
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
/** Resolve the minimal keepalive entry (out/providers/grok/keepaliveMain.js) so a
|
|
207
|
+
* detached keepalive loads with NO commander/CLI graph. Overridable for odd
|
|
208
|
+
* packagings via AUTODEV_KEEPALIVE_ENTRY. */
|
|
209
|
+
function keepaliveEntryPath() {
|
|
210
|
+
const override = process.env['AUTODEV_KEEPALIVE_ENTRY'];
|
|
211
|
+
if (override && fs.existsSync(override)) {
|
|
212
|
+
return override;
|
|
213
|
+
}
|
|
214
|
+
return path.join(__dirname, 'keepaliveMain.js');
|
|
215
|
+
}
|
|
216
|
+
/** Reap the leader + keepalive pid-trees named in `info` (best-effort). */
|
|
217
|
+
function reapLeaderProcs(info) {
|
|
218
|
+
if (info.keepalivePid) {
|
|
219
|
+
try {
|
|
220
|
+
(0, killProcessTree_1.killProcessTree)(info.keepalivePid);
|
|
221
|
+
}
|
|
222
|
+
catch { /* ignore */ }
|
|
223
|
+
}
|
|
224
|
+
if (info.pid) {
|
|
225
|
+
try {
|
|
226
|
+
(0, killProcessTree_1.killProcessTree)(info.pid);
|
|
227
|
+
}
|
|
228
|
+
catch { /* ignore */ }
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* ORPHAN-SWEEP + ensure a live leader+keepalive for this root. Adopts a still-live
|
|
233
|
+
* one (no second leader), reaps a stale/dead one, else spawns both DETACHED so they
|
|
234
|
+
* survive the loop process exiting. Returns the LeaderInfo (with the warm session
|
|
235
|
+
* id) or null when the backend could not be established (caller falls back to the
|
|
236
|
+
* non-leader ACP path). Never throws.
|
|
237
|
+
*/
|
|
238
|
+
async function ensureLeader(opts) {
|
|
239
|
+
const { root, bin, providerId, model, log } = opts;
|
|
240
|
+
const existing = readLeaderInfo(root);
|
|
241
|
+
if (existing && leaderHealthy(existing)) {
|
|
242
|
+
log(`grok leader: adopting live backend (leader=${existing.pid} keepalive=${existing.keepalivePid ?? '?'} sid=${(existing.sessionId ?? '').slice(0, 8)}…)`);
|
|
243
|
+
return existing;
|
|
244
|
+
}
|
|
245
|
+
if (existing) {
|
|
246
|
+
log(`grok leader: reaping stale backend (leader=${existing.pid} keepalive=${existing.keepalivePid ?? '?'})`);
|
|
247
|
+
reapLeaderProcs(existing);
|
|
248
|
+
removeLeaderInfo(existing.root ?? root);
|
|
249
|
+
}
|
|
250
|
+
const socket = leaderSocketPath(root);
|
|
251
|
+
try {
|
|
252
|
+
fs.unlinkSync(socket);
|
|
253
|
+
}
|
|
254
|
+
catch { /* no stale socket */ }
|
|
255
|
+
(0, sessionState_1.autodevDir)(root);
|
|
256
|
+
// 1) Spawn the LEADER daemon, detached.
|
|
257
|
+
const leaderArgs = ['agent', '--always-approve', 'leader', '--no-exit-on-disconnect', '--relay-on-demand', '--no-auto-update', '--leader-socket', socket];
|
|
258
|
+
const leaderErrFd = openLogFd(path.join(root, '.autodev', 'grok-leader.err'));
|
|
259
|
+
let leaderChild;
|
|
260
|
+
try {
|
|
261
|
+
leaderChild = child_process.spawn(bin, leaderArgs, {
|
|
262
|
+
cwd: root, detached: true,
|
|
263
|
+
stdio: ['ignore', 'ignore', leaderErrFd],
|
|
264
|
+
env: { ...process.env, TERM: process.env['TERM'] || 'xterm-256color' },
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
catch (err) {
|
|
268
|
+
log(`grok leader: spawn failed (${err?.message ?? err})`);
|
|
269
|
+
return null;
|
|
270
|
+
}
|
|
271
|
+
leaderChild.unref();
|
|
272
|
+
const leaderPid = leaderChild.pid;
|
|
273
|
+
if (!leaderPid) {
|
|
274
|
+
log('grok leader: no pid after spawn');
|
|
275
|
+
return null;
|
|
276
|
+
}
|
|
277
|
+
const sockOk = await waitUntil(() => { try {
|
|
278
|
+
return fs.existsSync(socket);
|
|
279
|
+
}
|
|
280
|
+
catch {
|
|
281
|
+
return false;
|
|
282
|
+
} }, 15_000);
|
|
283
|
+
if (!sockOk) {
|
|
284
|
+
log('grok leader: socket never appeared — reaping');
|
|
285
|
+
try {
|
|
286
|
+
(0, killProcessTree_1.killProcessTree)(leaderPid);
|
|
287
|
+
}
|
|
288
|
+
catch { /* ignore */ }
|
|
289
|
+
return null;
|
|
290
|
+
}
|
|
291
|
+
// 2) Spawn the KEEPALIVE client, detached — it holds the session warm. Seed it
|
|
292
|
+
// with the persisted id so a cold start does its ONE session/load here.
|
|
293
|
+
const sidFile = leaderSidPath(root);
|
|
294
|
+
try {
|
|
295
|
+
fs.unlinkSync(sidFile);
|
|
296
|
+
}
|
|
297
|
+
catch { /* ignore */ }
|
|
298
|
+
const seed = (0, sessionState_1.getSessionId)(root, providerId) || undefined;
|
|
299
|
+
const kaArgs = [keepaliveEntryPath(), '--socket', socket, '--cwd', root, '--sid-file', sidFile, '--bin', bin];
|
|
300
|
+
if (seed) {
|
|
301
|
+
kaArgs.push('--seed', seed);
|
|
302
|
+
}
|
|
303
|
+
let kaChild;
|
|
304
|
+
try {
|
|
305
|
+
kaChild = child_process.spawn(process.execPath, kaArgs, {
|
|
306
|
+
cwd: root, detached: true, stdio: 'ignore',
|
|
307
|
+
// ELECTRON_RUN_AS_NODE so an Electron-bundled CLI runs the keepalive as pure
|
|
308
|
+
// node (no window) — the inverse of the app's ELECTRON_RUN_AS_NODE trap.
|
|
309
|
+
env: { ...process.env, ELECTRON_RUN_AS_NODE: '1', TERM: process.env['TERM'] || 'xterm-256color' },
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
catch (err) {
|
|
313
|
+
log(`grok leader: keepalive spawn failed (${err?.message ?? err})`);
|
|
314
|
+
try {
|
|
315
|
+
(0, killProcessTree_1.killProcessTree)(leaderPid);
|
|
316
|
+
}
|
|
317
|
+
catch { /* ignore */ }
|
|
318
|
+
return null;
|
|
319
|
+
}
|
|
320
|
+
kaChild.unref();
|
|
321
|
+
const keepalivePid = kaChild.pid;
|
|
322
|
+
const gotSid = await waitUntil(() => readSidFile(sidFile) !== null, 25_000);
|
|
323
|
+
const sessionId = readSidFile(sidFile) || undefined;
|
|
324
|
+
if (!keepalivePid || !gotSid || !sessionId) {
|
|
325
|
+
log('grok leader: keepalive failed to establish a session — reaping');
|
|
326
|
+
if (keepalivePid) {
|
|
327
|
+
try {
|
|
328
|
+
(0, killProcessTree_1.killProcessTree)(keepalivePid);
|
|
329
|
+
}
|
|
330
|
+
catch { /* ignore */ }
|
|
331
|
+
}
|
|
332
|
+
try {
|
|
333
|
+
(0, killProcessTree_1.killProcessTree)(leaderPid);
|
|
334
|
+
}
|
|
335
|
+
catch { /* ignore */ }
|
|
336
|
+
return null;
|
|
337
|
+
}
|
|
338
|
+
const info = { pid: leaderPid, socket, startedAt: new Date().toISOString(), keepalivePid, sessionId, root };
|
|
339
|
+
writeLeaderInfo(root, info);
|
|
340
|
+
try {
|
|
341
|
+
(0, sessionState_1.saveSessionId)(root, providerId, sessionId);
|
|
342
|
+
}
|
|
343
|
+
catch { /* ignore */ }
|
|
344
|
+
log(`grok leader: backend up (leader=${leaderPid} keepalive=${keepalivePid} sid=${sessionId.slice(0, 8)}…)`);
|
|
345
|
+
return info;
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* `autodev leader-stop <root>` — kill the leader + keepalive pid-trees named in
|
|
349
|
+
* `.autodev/leader.json` and clean up the socket / sid / json. This is what the
|
|
350
|
+
* app calls on office stop / remove / quit. Best-effort; returns whether anything
|
|
351
|
+
* was reaped.
|
|
352
|
+
*/
|
|
353
|
+
function stopLeader(root, log) {
|
|
354
|
+
const info = readLeaderInfo(root);
|
|
355
|
+
let killed = false;
|
|
356
|
+
if (info) {
|
|
357
|
+
if (info.keepalivePid && isPidAlive(info.keepalivePid)) {
|
|
358
|
+
try {
|
|
359
|
+
(0, killProcessTree_1.killProcessTree)(info.keepalivePid);
|
|
360
|
+
killed = true;
|
|
361
|
+
}
|
|
362
|
+
catch { /* ignore */ }
|
|
363
|
+
}
|
|
364
|
+
if (info.pid && isPidAlive(info.pid)) {
|
|
365
|
+
try {
|
|
366
|
+
(0, killProcessTree_1.killProcessTree)(info.pid);
|
|
367
|
+
killed = true;
|
|
368
|
+
}
|
|
369
|
+
catch { /* ignore */ }
|
|
370
|
+
}
|
|
371
|
+
try {
|
|
372
|
+
if (info.socket) {
|
|
373
|
+
fs.unlinkSync(info.socket);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
catch { /* ignore */ }
|
|
377
|
+
}
|
|
378
|
+
try {
|
|
379
|
+
fs.unlinkSync(leaderSocketPath(root));
|
|
380
|
+
}
|
|
381
|
+
catch { /* ignore */ }
|
|
382
|
+
try {
|
|
383
|
+
fs.unlinkSync(leaderSidPath(root));
|
|
384
|
+
}
|
|
385
|
+
catch { /* ignore */ }
|
|
386
|
+
removeLeaderInfo(root);
|
|
387
|
+
log(killed ? `leader-stop: reaped grok leader backend for ${root}` : `leader-stop: no live grok leader for ${root}`);
|
|
388
|
+
return killed;
|
|
389
|
+
}
|
|
390
|
+
//# sourceMappingURL=leader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3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EAAE,CAAC;YAAC,IAAI,CAAC;gBAAC,IAAA,iCAAe,EAAC,IAAI,CAAC,YAAY,CAAC,CAAC;gBAAC,MAAM,GAAG,IAAI,CAAC;YAAC,CAAC;YAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC;QAAC,CAAC;QAC7I,IAAI,IAAI,CAAC,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YAAC,IAAI,CAAC;gBAAC,IAAA,iCAAe,EAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBAAC,MAAM,GAAG,IAAI,CAAC;YAAC,CAAC;YAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC;QAAC,CAAC;QAClH,IAAI,CAAC;YAAC,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;gBAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAAC,CAAC;QAAC,CAAC;QAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC;IACjF,CAAC;IACD,IAAI,CAAC;QAAC,EAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;IAAC,CAAC;IAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC;IACrE,IAAI,CAAC;QAAC,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;IAAC,CAAC;IAAC,MAAM,CAAC,CAAC,YAAY,CAAC,CAAC;IAClE,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACvB,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,+CAA+C,IAAI,EAAE,CAAC,CAAC,CAAC,wCAAwC,IAAI,EAAE,CAAC,CAAC;IACrH,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -94,6 +94,24 @@ export declare function sendGrokAcpPrompt(root: string, promptFilePath: string,
|
|
|
94
94
|
export declare function steerGrokAcp(root: string, text: string, log: (msg: string) => void): boolean;
|
|
95
95
|
/** True if a persistent ACP session for this root is mid-turn. */
|
|
96
96
|
export declare function isGrokAcpBusy(root: string): boolean;
|
|
97
|
+
/** True when a LIVE (alive) persistent grok ACP session is held for this root. */
|
|
98
|
+
export declare function hasGrokAcpSession(root: string): boolean;
|
|
99
|
+
/**
|
|
100
|
+
* Durable-steer delivery to an EXISTING live grok ACP session. Returns a promise
|
|
101
|
+
* that resolves when the steered turn COMPLETES (so the caller can ack + de-queue
|
|
102
|
+
* only then), or null when no live session exists (the caller keeps it queued and
|
|
103
|
+
* retries via {@link ensureGrokAcpSteer} at the next boundary).
|
|
104
|
+
*/
|
|
105
|
+
export declare function steerGrokAcpTracked(root: string, text: string, log: (msg: string) => void): Promise<import('./GrokAcpSession').AcpTurnResult> | null;
|
|
106
|
+
/**
|
|
107
|
+
* Restart-drain delivery: ENSURE a live grok ACP session (spawn + session/load if
|
|
108
|
+
* none is held — e.g. right after a loop restart with an empty TODO), then deliver
|
|
109
|
+
* the steer and await its completion. Returns the turn result, or null when the
|
|
110
|
+
* session could not be brought up (caller keeps the steer queued for a later
|
|
111
|
+
* boundary). Grok stays ALIVE between turns, so the common case just reuses the
|
|
112
|
+
* live session.
|
|
113
|
+
*/
|
|
114
|
+
export declare function ensureGrokAcpSteer(root: string, providerId: 'grok-cli' | 'grok-tui', model: string | undefined, text: string, log: (msg: string) => void): Promise<import('./GrokAcpSession').AcpTurnResult | null>;
|
|
97
115
|
/**
|
|
98
116
|
* grok-tui: persistent — run the turn in the per-workspace tmux session so
|
|
99
117
|
* grok's in-process context accumulates across tasks. Falls back to the old
|