@staff0rd/assist 0.709.0 → 0.710.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/README.md +6 -2
- package/allowed.cli-reads +2 -0
- package/dist/allowed.cli-reads +2 -0
- package/dist/commands/sessions/web/bundle.js +1 -1
- package/dist/index.js +531 -150
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { Command } from "commander";
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "@staff0rd/assist",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.710.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -283,13 +283,13 @@ function remoteUrl(cwd) {
|
|
|
283
283
|
if (origin.out) return { url: origin.out, ok: true };
|
|
284
284
|
const remotes = runGit(cwd, ["remote"]);
|
|
285
285
|
if (!remotes.ok) return { url: null, ok: false };
|
|
286
|
-
let
|
|
286
|
+
let failed3 = false;
|
|
287
287
|
for (const remote of remotes.out.split("\n").map((r) => r.trim()).filter(Boolean)) {
|
|
288
288
|
const url = runGit(cwd, ["remote", "get-url", remote]);
|
|
289
289
|
if (url.out) return { url: url.out, ok: true };
|
|
290
|
-
if (!url.ok)
|
|
290
|
+
if (!url.ok) failed3 = true;
|
|
291
291
|
}
|
|
292
|
-
return { url: null, ok: !
|
|
292
|
+
return { url: null, ok: !failed3 };
|
|
293
293
|
}
|
|
294
294
|
function getRemoteOriginUrl(cwd) {
|
|
295
295
|
return remoteUrl(cwd).url;
|
|
@@ -2088,10 +2088,10 @@ function flushIfFailed(exitCode, chunks) {
|
|
|
2088
2088
|
}
|
|
2089
2089
|
|
|
2090
2090
|
// src/commands/verify/run/runAllEntries.ts
|
|
2091
|
-
function logFailedScripts(
|
|
2091
|
+
function logFailedScripts(failed3) {
|
|
2092
2092
|
console.error(`
|
|
2093
|
-
${
|
|
2094
|
-
for (const f of
|
|
2093
|
+
${failed3.length} script(s) failed:`);
|
|
2094
|
+
for (const f of failed3) {
|
|
2095
2095
|
console.error(` - ${f.script} (exit code ${f.code})`);
|
|
2096
2096
|
}
|
|
2097
2097
|
}
|
|
@@ -2116,9 +2116,9 @@ function runEntry(entry) {
|
|
|
2116
2116
|
});
|
|
2117
2117
|
});
|
|
2118
2118
|
}
|
|
2119
|
-
function exitIfFailed(
|
|
2120
|
-
if (
|
|
2121
|
-
logFailedScripts(
|
|
2119
|
+
function exitIfFailed(failed3) {
|
|
2120
|
+
if (failed3.length === 0) return;
|
|
2121
|
+
logFailedScripts(failed3);
|
|
2122
2122
|
process.exit(1);
|
|
2123
2123
|
}
|
|
2124
2124
|
async function runAllEntries(entries) {
|
|
@@ -11458,6 +11458,52 @@ async function handleItemRoute(req, res, pathname) {
|
|
|
11458
11458
|
return false;
|
|
11459
11459
|
}
|
|
11460
11460
|
|
|
11461
|
+
// src/commands/sessions/shared/readLogTail.ts
|
|
11462
|
+
import { closeSync as closeSync3, fstatSync, openSync as openSync4, readSync as readSync2 } from "fs";
|
|
11463
|
+
var MAX_TAIL_BYTES = 4 * 1024 * 1024;
|
|
11464
|
+
function completeLines(text18, windowIsPartial) {
|
|
11465
|
+
const all = text18.split("\n");
|
|
11466
|
+
if (all.at(-1) === "") all.pop();
|
|
11467
|
+
if (windowIsPartial) all.shift();
|
|
11468
|
+
return all;
|
|
11469
|
+
}
|
|
11470
|
+
function readLogTail(path103, lines2) {
|
|
11471
|
+
let fd;
|
|
11472
|
+
try {
|
|
11473
|
+
fd = openSync4(path103, "r");
|
|
11474
|
+
} catch {
|
|
11475
|
+
return [];
|
|
11476
|
+
}
|
|
11477
|
+
try {
|
|
11478
|
+
const size = fstatSync(fd).size;
|
|
11479
|
+
const length = Math.min(size, MAX_TAIL_BYTES);
|
|
11480
|
+
const buffer = Buffer.alloc(length);
|
|
11481
|
+
readSync2(fd, buffer, 0, length, size - length);
|
|
11482
|
+
return completeLines(buffer.toString("utf8"), length < size).slice(-lines2);
|
|
11483
|
+
} finally {
|
|
11484
|
+
closeSync3(fd);
|
|
11485
|
+
}
|
|
11486
|
+
}
|
|
11487
|
+
|
|
11488
|
+
// src/commands/sessions/web/daemonLogTail.ts
|
|
11489
|
+
var DEFAULT_LINES = 200;
|
|
11490
|
+
var MAX_LINES = 1e4;
|
|
11491
|
+
function requestedLines(req) {
|
|
11492
|
+
const raw = new URL(req.url ?? "/", "http://localhost").searchParams.get(
|
|
11493
|
+
"lines"
|
|
11494
|
+
);
|
|
11495
|
+
const parsed = Number.parseInt(raw ?? "", 10);
|
|
11496
|
+
if (!Number.isFinite(parsed) || parsed < 1) return DEFAULT_LINES;
|
|
11497
|
+
return Math.min(parsed, MAX_LINES);
|
|
11498
|
+
}
|
|
11499
|
+
async function daemonLogTail(req, res) {
|
|
11500
|
+
respondJson(res, 200, {
|
|
11501
|
+
nodeName: resolveNodeName(),
|
|
11502
|
+
path: daemonPaths.log,
|
|
11503
|
+
lines: readLogTail(daemonPaths.log, requestedLines(req))
|
|
11504
|
+
});
|
|
11505
|
+
}
|
|
11506
|
+
|
|
11461
11507
|
// src/commands/sessions/web/getCwdParam.ts
|
|
11462
11508
|
function getCwdParam(req, res) {
|
|
11463
11509
|
const url = new URL(req.url ?? "/", "http://localhost");
|
|
@@ -13330,13 +13376,51 @@ function protocolMismatched(msg) {
|
|
|
13330
13376
|
return typeof msg.protocol === "number" && msg.protocol !== PROTOCOL_VERSION;
|
|
13331
13377
|
}
|
|
13332
13378
|
|
|
13379
|
+
// src/commands/sessions/nodes/queryNodes.ts
|
|
13380
|
+
import { createInterface as createInterface5 } from "readline";
|
|
13381
|
+
var QUERY_TIMEOUT_MS = 3e3;
|
|
13382
|
+
async function queryNodes() {
|
|
13383
|
+
let socket;
|
|
13384
|
+
try {
|
|
13385
|
+
socket = await connectToDaemon();
|
|
13386
|
+
} catch {
|
|
13387
|
+
return void 0;
|
|
13388
|
+
}
|
|
13389
|
+
return new Promise((resolve25) => {
|
|
13390
|
+
const finish2 = (result) => {
|
|
13391
|
+
clearTimeout(timer);
|
|
13392
|
+
socket.destroy();
|
|
13393
|
+
resolve25(result);
|
|
13394
|
+
};
|
|
13395
|
+
const timer = setTimeout(() => finish2(void 0), QUERY_TIMEOUT_MS);
|
|
13396
|
+
const lines2 = createInterface5({ input: socket });
|
|
13397
|
+
lines2.on("error", () => {
|
|
13398
|
+
});
|
|
13399
|
+
lines2.on("line", (line) => {
|
|
13400
|
+
try {
|
|
13401
|
+
const data = JSON.parse(line);
|
|
13402
|
+
if (data.type === "nodes") finish2(data);
|
|
13403
|
+
} catch {
|
|
13404
|
+
}
|
|
13405
|
+
});
|
|
13406
|
+
socket.on("error", () => finish2(void 0));
|
|
13407
|
+
socket.write(`${JSON.stringify({ type: "nodes" })}
|
|
13408
|
+
`);
|
|
13409
|
+
});
|
|
13410
|
+
}
|
|
13411
|
+
|
|
13333
13412
|
// src/commands/sessions/web/health.ts
|
|
13334
13413
|
async function health(_req, res) {
|
|
13414
|
+
const [reachable, nodes] = await Promise.all([
|
|
13415
|
+
isDaemonRunning(),
|
|
13416
|
+
queryNodes()
|
|
13417
|
+
]);
|
|
13335
13418
|
respondJson(res, 200, {
|
|
13336
13419
|
nodeName: resolveNodeName(),
|
|
13337
13420
|
version: ASSIST_VERSION,
|
|
13338
13421
|
protocol: PROTOCOL_VERSION,
|
|
13339
|
-
daemon: { reachable
|
|
13422
|
+
daemon: { reachable },
|
|
13423
|
+
links: nodes?.links ?? []
|
|
13340
13424
|
});
|
|
13341
13425
|
}
|
|
13342
13426
|
|
|
@@ -13991,6 +14075,13 @@ async function prList(req, res) {
|
|
|
13991
14075
|
respondJson(res, 200, { prs: await getOpenPrs(cwd) });
|
|
13992
14076
|
}
|
|
13993
14077
|
|
|
14078
|
+
// src/commands/sessions/shared/newTraceId.ts
|
|
14079
|
+
import { randomUUID as randomUUID7 } from "crypto";
|
|
14080
|
+
var TRACE_HEADER = "x-assist-trace-id";
|
|
14081
|
+
function newTraceId() {
|
|
14082
|
+
return randomUUID7().slice(0, 8);
|
|
14083
|
+
}
|
|
14084
|
+
|
|
13994
14085
|
// src/commands/sessions/web/forwardToPeer.ts
|
|
13995
14086
|
import {
|
|
13996
14087
|
request as httpRequest
|
|
@@ -13999,7 +14090,8 @@ import { request as httpsRequest } from "https";
|
|
|
13999
14090
|
var LINKED_FROM_HEADER = "x-assist-linked-from";
|
|
14000
14091
|
function forwardToPeer(req, res, node, url) {
|
|
14001
14092
|
const started = Date.now();
|
|
14002
|
-
const
|
|
14093
|
+
const traceId = newTraceId();
|
|
14094
|
+
const label2 = `link ${node} http: ${req.method} ${url.pathname} trace=${traceId}`;
|
|
14003
14095
|
const elapsed = () => `${Date.now() - started}ms`;
|
|
14004
14096
|
const send = url.protocol === "https:" ? httpsRequest : httpRequest;
|
|
14005
14097
|
return new Promise((resolve25) => {
|
|
@@ -14010,7 +14102,8 @@ function forwardToPeer(req, res, node, url) {
|
|
|
14010
14102
|
headers: {
|
|
14011
14103
|
...req.headers,
|
|
14012
14104
|
host: url.host,
|
|
14013
|
-
[LINKED_FROM_HEADER]: resolveNodeName()
|
|
14105
|
+
[LINKED_FROM_HEADER]: resolveNodeName(),
|
|
14106
|
+
[TRACE_HEADER]: traceId
|
|
14014
14107
|
}
|
|
14015
14108
|
},
|
|
14016
14109
|
(peer) => {
|
|
@@ -14054,7 +14147,20 @@ function proxyTarget(req) {
|
|
|
14054
14147
|
url: new URL(`${url.pathname}${url.search}`, link3.url)
|
|
14055
14148
|
};
|
|
14056
14149
|
}
|
|
14150
|
+
function logLinkedRequest(req, res) {
|
|
14151
|
+
const started = Date.now();
|
|
14152
|
+
const from = req.headers[LINKED_FROM_HEADER2];
|
|
14153
|
+
const trace = req.headers[TRACE_HEADER] ?? "none";
|
|
14154
|
+
const path103 = new URL(req.url ?? "/", "http://localhost").pathname;
|
|
14155
|
+
res.once(
|
|
14156
|
+
"finish",
|
|
14157
|
+
() => console.log(
|
|
14158
|
+
`link-from ${from} http: ${req.method} ${path103} trace=${trace} -> ${res.statusCode} (${Date.now() - started}ms)`
|
|
14159
|
+
)
|
|
14160
|
+
);
|
|
14161
|
+
}
|
|
14057
14162
|
async function proxyToNode(req, res) {
|
|
14163
|
+
if (arrivedOverLink(req)) logLinkedRequest(req, res);
|
|
14058
14164
|
const target = proxyTarget(req);
|
|
14059
14165
|
if (target.kind === "local") return false;
|
|
14060
14166
|
if (target.kind === "unknown") {
|
|
@@ -14874,11 +14980,11 @@ async function revertDiffPaths(req, res) {
|
|
|
14874
14980
|
}
|
|
14875
14981
|
const root2 = repoRoot(cwd);
|
|
14876
14982
|
const reverted = [];
|
|
14877
|
-
const
|
|
14983
|
+
const failed3 = [];
|
|
14878
14984
|
for (const path103 of paths) {
|
|
14879
14985
|
const target = resolveWithinCwd(cwd, path103);
|
|
14880
14986
|
if (!target) {
|
|
14881
|
-
|
|
14987
|
+
failed3.push({ path: path103, error: "Path outside cwd" });
|
|
14882
14988
|
continue;
|
|
14883
14989
|
}
|
|
14884
14990
|
const relativePath = relative4(root2, target);
|
|
@@ -14886,13 +14992,13 @@ async function revertDiffPaths(req, res) {
|
|
|
14886
14992
|
await revertPathChanges(cwd, relativePath);
|
|
14887
14993
|
reverted.push(relativePath);
|
|
14888
14994
|
} catch (error) {
|
|
14889
|
-
|
|
14995
|
+
failed3.push({
|
|
14890
14996
|
path: relativePath,
|
|
14891
14997
|
error: error instanceof Error ? error.message : "Failed to revert file"
|
|
14892
14998
|
});
|
|
14893
14999
|
}
|
|
14894
15000
|
}
|
|
14895
|
-
respondJson(res, 200, { reverted, failed:
|
|
15001
|
+
respondJson(res, 200, { reverted, failed: failed3 });
|
|
14896
15002
|
}
|
|
14897
15003
|
|
|
14898
15004
|
// src/commands/sessions/web/sessionLayout.ts
|
|
@@ -15788,6 +15894,7 @@ var routes2 = {
|
|
|
15788
15894
|
"text/css"
|
|
15789
15895
|
),
|
|
15790
15896
|
"GET /api/health": health,
|
|
15897
|
+
"GET /api/daemon-log": daemonLogTail,
|
|
15791
15898
|
"GET /api/items": listItems,
|
|
15792
15899
|
"GET /api/backlog/summary": getBacklogSummary,
|
|
15793
15900
|
"GET /api/repo-location": getRepoLocation,
|
|
@@ -16054,7 +16161,7 @@ function installRestartMenu(options2 = {}) {
|
|
|
16054
16161
|
}
|
|
16055
16162
|
|
|
16056
16163
|
// src/commands/sessions/web/streamDaemonLogs.ts
|
|
16057
|
-
import { createInterface as
|
|
16164
|
+
import { createInterface as createInterface6 } from "readline";
|
|
16058
16165
|
var RECONNECT_MS = 3e3;
|
|
16059
16166
|
function streamDaemonLogs() {
|
|
16060
16167
|
void connect2();
|
|
@@ -16073,7 +16180,7 @@ async function connect2() {
|
|
|
16073
16180
|
}
|
|
16074
16181
|
}
|
|
16075
16182
|
function wire(socket) {
|
|
16076
|
-
const lines2 =
|
|
16183
|
+
const lines2 = createInterface6({ input: socket });
|
|
16077
16184
|
lines2.on("error", () => {
|
|
16078
16185
|
});
|
|
16079
16186
|
lines2.on("line", emit);
|
|
@@ -20529,7 +20636,7 @@ function registerDevlog(program2) {
|
|
|
20529
20636
|
}
|
|
20530
20637
|
|
|
20531
20638
|
// src/commands/dotnet/checkBuildLocks.ts
|
|
20532
|
-
import { closeSync as
|
|
20639
|
+
import { closeSync as closeSync4, openSync as openSync5, readdirSync as readdirSync7 } from "fs";
|
|
20533
20640
|
import { join as join57 } from "path";
|
|
20534
20641
|
import chalk151 from "chalk";
|
|
20535
20642
|
var SKIP_DIRS = /* @__PURE__ */ new Set(["node_modules", ".git", "packages"]);
|
|
@@ -20544,8 +20651,8 @@ function isLockedDll(debugDir) {
|
|
|
20544
20651
|
if (!file.toLowerCase().endsWith(".dll")) continue;
|
|
20545
20652
|
const dllPath = join57(debugDir, file);
|
|
20546
20653
|
try {
|
|
20547
|
-
const fd =
|
|
20548
|
-
|
|
20654
|
+
const fd = openSync5(dllPath, "r+");
|
|
20655
|
+
closeSync4(fd);
|
|
20549
20656
|
} catch {
|
|
20550
20657
|
return dllPath;
|
|
20551
20658
|
}
|
|
@@ -22707,13 +22814,13 @@ function validateProposedContent(labels, title, body) {
|
|
|
22707
22814
|
}
|
|
22708
22815
|
|
|
22709
22816
|
// src/commands/github/issue/reviewProposedIssueComment.ts
|
|
22710
|
-
import { randomUUID as
|
|
22817
|
+
import { randomUUID as randomUUID8 } from "crypto";
|
|
22711
22818
|
async function reviewProposedIssueComment(title, body) {
|
|
22712
22819
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
22713
22820
|
if (process.env.ASSIST_SESSION !== "1" || !sessionId) return;
|
|
22714
22821
|
await awaitPreviewApproval("GitHub issue comment preview", {
|
|
22715
22822
|
sessionId,
|
|
22716
|
-
requestId:
|
|
22823
|
+
requestId: randomUUID8(),
|
|
22717
22824
|
title,
|
|
22718
22825
|
body,
|
|
22719
22826
|
prNumber: null,
|
|
@@ -23195,13 +23302,13 @@ function resolveCreateIssueMetadata(options2) {
|
|
|
23195
23302
|
}
|
|
23196
23303
|
|
|
23197
23304
|
// src/commands/github/issue/reviewProposedIssue.ts
|
|
23198
|
-
import { randomUUID as
|
|
23305
|
+
import { randomUUID as randomUUID9 } from "crypto";
|
|
23199
23306
|
async function reviewProposedIssue(title, body, metadata2 = []) {
|
|
23200
23307
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
23201
23308
|
if (process.env.ASSIST_SESSION !== "1" || !sessionId) return void 0;
|
|
23202
23309
|
return await awaitPreviewApproval("GitHub issue preview", {
|
|
23203
23310
|
sessionId,
|
|
23204
|
-
requestId:
|
|
23311
|
+
requestId: randomUUID9(),
|
|
23205
23312
|
title,
|
|
23206
23313
|
body,
|
|
23207
23314
|
prNumber: null,
|
|
@@ -23424,7 +23531,7 @@ function pushUnchangedIssue(number, repo, target, fetchedAt, bodyPath) {
|
|
|
23424
23531
|
}
|
|
23425
23532
|
|
|
23426
23533
|
// src/commands/github/issue/reviewProposedIssueEdit.ts
|
|
23427
|
-
import { randomUUID as
|
|
23534
|
+
import { randomUUID as randomUUID10 } from "crypto";
|
|
23428
23535
|
async function reviewProposedIssueEdit(title, body, working) {
|
|
23429
23536
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
23430
23537
|
if (process.env.ASSIST_SESSION !== "1" || !sessionId) return body;
|
|
@@ -23432,7 +23539,7 @@ async function reviewProposedIssueEdit(title, body, working) {
|
|
|
23432
23539
|
"GitHub issue edit preview",
|
|
23433
23540
|
{
|
|
23434
23541
|
sessionId,
|
|
23435
|
-
requestId:
|
|
23542
|
+
requestId: randomUUID10(),
|
|
23436
23543
|
title,
|
|
23437
23544
|
body,
|
|
23438
23545
|
prNumber: null,
|
|
@@ -24166,7 +24273,7 @@ function registerRefineLaunch(program2, resumeFlag) {
|
|
|
24166
24273
|
}
|
|
24167
24274
|
|
|
24168
24275
|
// src/commands/reviewPrComments.ts
|
|
24169
|
-
import { randomUUID as
|
|
24276
|
+
import { randomUUID as randomUUID11 } from "crypto";
|
|
24170
24277
|
|
|
24171
24278
|
// src/commands/review/checkoutPr.ts
|
|
24172
24279
|
import { execFileSync as execFileSync15 } from "child_process";
|
|
@@ -24822,7 +24929,7 @@ async function reviewPrComments(number, options2 = {}) {
|
|
|
24822
24929
|
const resumeSessionId = options2.resumeSessionId;
|
|
24823
24930
|
validateAnnounce(number, announce);
|
|
24824
24931
|
if (number && !resumeSessionId) await checkoutPr(number);
|
|
24825
|
-
const claudeSessionId = resumeSessionId ??
|
|
24932
|
+
const claudeSessionId = resumeSessionId ?? randomUUID11();
|
|
24826
24933
|
emitActivity({
|
|
24827
24934
|
kind: "command",
|
|
24828
24935
|
name: "review-pr-comments",
|
|
@@ -24840,14 +24947,14 @@ async function reviewPrComments(number, options2 = {}) {
|
|
|
24840
24947
|
}
|
|
24841
24948
|
|
|
24842
24949
|
// src/commands/fixConflict.ts
|
|
24843
|
-
import { randomUUID as
|
|
24950
|
+
import { randomUUID as randomUUID12 } from "crypto";
|
|
24844
24951
|
function buildPrompt3(rebase) {
|
|
24845
24952
|
return rebase ? "/fix-conflict --rebase" : "/fix-conflict";
|
|
24846
24953
|
}
|
|
24847
24954
|
async function fixConflict(number, options2 = {}) {
|
|
24848
24955
|
const { resumeSessionId } = options2;
|
|
24849
24956
|
if (number && !resumeSessionId) await checkoutPr(number);
|
|
24850
|
-
const claudeSessionId = resumeSessionId ??
|
|
24957
|
+
const claudeSessionId = resumeSessionId ?? randomUUID12();
|
|
24851
24958
|
emitActivity({
|
|
24852
24959
|
kind: "command",
|
|
24853
24960
|
name: "fix-conflict",
|
|
@@ -25391,7 +25498,7 @@ async function offerSaveExtract(extract2, options2, paths = {}) {
|
|
|
25391
25498
|
}
|
|
25392
25499
|
|
|
25393
25500
|
// src/commands/miro/pickAnchors.ts
|
|
25394
|
-
import { randomUUID as
|
|
25501
|
+
import { randomUUID as randomUUID13 } from "crypto";
|
|
25395
25502
|
|
|
25396
25503
|
// src/commands/miro/isBox.ts
|
|
25397
25504
|
var boxTypes = /* @__PURE__ */ new Set(["shape", "sticky_note"]);
|
|
@@ -25412,7 +25519,7 @@ async function pickAnchors(sessionId, items2) {
|
|
|
25412
25519
|
"Miro anchor selection",
|
|
25413
25520
|
{
|
|
25414
25521
|
sessionId,
|
|
25415
|
-
requestId:
|
|
25522
|
+
requestId: randomUUID13(),
|
|
25416
25523
|
title: "Pick the top-left then the bottom-right box",
|
|
25417
25524
|
body: encodeMiroBoardPreview(items2),
|
|
25418
25525
|
prNumber: null,
|
|
@@ -26602,13 +26709,13 @@ function postReviewComment(vars) {
|
|
|
26602
26709
|
}
|
|
26603
26710
|
|
|
26604
26711
|
// src/commands/prs/reviewProposedPrComment.ts
|
|
26605
|
-
import { randomUUID as
|
|
26712
|
+
import { randomUUID as randomUUID14 } from "crypto";
|
|
26606
26713
|
async function reviewProposedPrComment(title, body, prNumber) {
|
|
26607
26714
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
26608
26715
|
if (process.env.ASSIST_SESSION !== "1" || !sessionId) return;
|
|
26609
26716
|
await awaitPreviewApproval("PR comment preview", {
|
|
26610
26717
|
sessionId,
|
|
26611
|
-
requestId:
|
|
26718
|
+
requestId: randomUUID14(),
|
|
26612
26719
|
title,
|
|
26613
26720
|
body,
|
|
26614
26721
|
prNumber,
|
|
@@ -27220,7 +27327,7 @@ function registerPrsComments(prsCommand) {
|
|
|
27220
27327
|
}
|
|
27221
27328
|
|
|
27222
27329
|
// src/commands/prs/edit.ts
|
|
27223
|
-
import { randomUUID as
|
|
27330
|
+
import { randomUUID as randomUUID15 } from "crypto";
|
|
27224
27331
|
|
|
27225
27332
|
// src/commands/prs/applyEdit.ts
|
|
27226
27333
|
import { execFileSync as execFileSync16 } from "child_process";
|
|
@@ -27415,7 +27522,7 @@ async function edit(options2) {
|
|
|
27415
27522
|
if (process.env.ASSIST_SESSION === "1" && sessionId) {
|
|
27416
27523
|
const decision = await awaitPreviewApproval("PR preview", {
|
|
27417
27524
|
sessionId,
|
|
27418
|
-
requestId:
|
|
27525
|
+
requestId: randomUUID15(),
|
|
27419
27526
|
title: options2.title ?? title,
|
|
27420
27527
|
body: newBody,
|
|
27421
27528
|
prNumber: number
|
|
@@ -27614,7 +27721,7 @@ async function placePr(prNumber, title, body, options2) {
|
|
|
27614
27721
|
}
|
|
27615
27722
|
|
|
27616
27723
|
// src/commands/prs/previewAndPlace.ts
|
|
27617
|
-
import { randomUUID as
|
|
27724
|
+
import { randomUUID as randomUUID16 } from "crypto";
|
|
27618
27725
|
|
|
27619
27726
|
// src/commands/sessions/shared/requestSession.ts
|
|
27620
27727
|
function parseIncoming(line, type) {
|
|
@@ -27765,7 +27872,7 @@ function enableAutoMerge() {
|
|
|
27765
27872
|
async function previewAndPlace(args) {
|
|
27766
27873
|
const decision = await awaitPreviewApproval("PR preview", {
|
|
27767
27874
|
sessionId: args.sessionId,
|
|
27768
|
-
requestId:
|
|
27875
|
+
requestId: randomUUID16(),
|
|
27769
27876
|
title: args.title,
|
|
27770
27877
|
body: args.body,
|
|
27771
27878
|
prNumber: args.prNumber,
|
|
@@ -30115,13 +30222,13 @@ function runScript(script, cwd) {
|
|
|
30115
30222
|
});
|
|
30116
30223
|
});
|
|
30117
30224
|
}
|
|
30118
|
-
function logFailures(
|
|
30119
|
-
for (const f of
|
|
30225
|
+
function logFailures(failed3) {
|
|
30226
|
+
for (const f of failed3) {
|
|
30120
30227
|
console.error(f.output);
|
|
30121
30228
|
}
|
|
30122
30229
|
console.error(`
|
|
30123
|
-
${
|
|
30124
|
-
for (const f of
|
|
30230
|
+
${failed3.length} verify script(s) failed:`);
|
|
30231
|
+
for (const f of failed3) {
|
|
30125
30232
|
console.error(` - ${f.script} (exit code ${f.code})`);
|
|
30126
30233
|
}
|
|
30127
30234
|
}
|
|
@@ -30132,9 +30239,9 @@ async function runVerifyQuietly() {
|
|
|
30132
30239
|
const results = await Promise.all(
|
|
30133
30240
|
result.verifyScripts.map((script) => runScript(script, packageDir))
|
|
30134
30241
|
);
|
|
30135
|
-
const
|
|
30136
|
-
if (
|
|
30137
|
-
logFailures(
|
|
30242
|
+
const failed3 = results.filter((r) => r.code !== 0);
|
|
30243
|
+
if (failed3.length > 0) {
|
|
30244
|
+
logFailures(failed3);
|
|
30138
30245
|
return false;
|
|
30139
30246
|
}
|
|
30140
30247
|
return true;
|
|
@@ -31930,10 +32037,10 @@ function registerRefactor(program2) {
|
|
|
31930
32037
|
}
|
|
31931
32038
|
|
|
31932
32039
|
// src/commands/review/checkoutOnlySession.ts
|
|
31933
|
-
import { randomUUID as
|
|
32040
|
+
import { randomUUID as randomUUID17 } from "crypto";
|
|
31934
32041
|
async function checkoutOnlySession(number) {
|
|
31935
32042
|
await checkoutPr(number);
|
|
31936
|
-
const claudeSessionId =
|
|
32043
|
+
const claudeSessionId = randomUUID17();
|
|
31937
32044
|
emitActivity({ kind: "command", name: "review", claudeSessionId });
|
|
31938
32045
|
const { done: done2 } = spawnClaude("", {
|
|
31939
32046
|
permissionMode: "acceptEdits",
|
|
@@ -32670,7 +32777,7 @@ function gatherHighLevelSubject(prNumber, force) {
|
|
|
32670
32777
|
}
|
|
32671
32778
|
|
|
32672
32779
|
// src/commands/review/highLevel/openHighLevelOverlay.ts
|
|
32673
|
-
import { randomUUID as
|
|
32780
|
+
import { randomUUID as randomUUID18 } from "crypto";
|
|
32674
32781
|
|
|
32675
32782
|
// src/commands/review/highLevel/buildHighLevelRecord.ts
|
|
32676
32783
|
function toItem2(check2, decision) {
|
|
@@ -32757,7 +32864,7 @@ async function openHighLevelOverlay(sessionId, subject) {
|
|
|
32757
32864
|
"High-level review",
|
|
32758
32865
|
{
|
|
32759
32866
|
sessionId,
|
|
32760
|
-
requestId:
|
|
32867
|
+
requestId: randomUUID18(),
|
|
32761
32868
|
title: `${subject.repo}#${subject.prNumber} \u2014 ${subject.title}`,
|
|
32762
32869
|
body: JSON.stringify(highLevelPreviewPayload(subject)),
|
|
32763
32870
|
prNumber: subject.prNumber,
|
|
@@ -32829,11 +32936,11 @@ function formatHighLevelChecklist(checks2) {
|
|
|
32829
32936
|
const deterministic = checks2.filter(
|
|
32830
32937
|
(check2) => check2.kind === "deterministic"
|
|
32831
32938
|
);
|
|
32832
|
-
const
|
|
32939
|
+
const failed3 = deterministic.filter(
|
|
32833
32940
|
(check2) => check2.status === "fail"
|
|
32834
32941
|
).length;
|
|
32835
|
-
const summary =
|
|
32836
|
-
`${
|
|
32942
|
+
const summary = failed3 === 0 ? chalk227.green(`All ${deterministic.length} deterministic checks pass`) : chalk227.red(
|
|
32943
|
+
`${failed3} of ${deterministic.length} deterministic checks fail`
|
|
32837
32944
|
);
|
|
32838
32945
|
return [
|
|
32839
32946
|
...formatGroup("Deterministic", deterministic),
|
|
@@ -33365,7 +33472,7 @@ function buildCommentBody(finding) {
|
|
|
33365
33472
|
}
|
|
33366
33473
|
async function postFindings(findings) {
|
|
33367
33474
|
let posted = 0;
|
|
33368
|
-
let
|
|
33475
|
+
let failed3 = 0;
|
|
33369
33476
|
for (const finding of findings) {
|
|
33370
33477
|
const body = buildCommentBody(finding);
|
|
33371
33478
|
try {
|
|
@@ -33375,14 +33482,14 @@ async function postFindings(findings) {
|
|
|
33375
33482
|
});
|
|
33376
33483
|
posted++;
|
|
33377
33484
|
} catch (error) {
|
|
33378
|
-
|
|
33485
|
+
failed3++;
|
|
33379
33486
|
const message3 = error instanceof Error ? error.message : String(error);
|
|
33380
33487
|
console.error(
|
|
33381
33488
|
`Failed to post comment on ${finding.file}:${finding.line}: ${message3}`
|
|
33382
33489
|
);
|
|
33383
33490
|
}
|
|
33384
33491
|
}
|
|
33385
|
-
return { posted, failed:
|
|
33492
|
+
return { posted, failed: failed3 };
|
|
33386
33493
|
}
|
|
33387
33494
|
|
|
33388
33495
|
// src/commands/review/runReviewSubmission.ts
|
|
@@ -35639,7 +35746,7 @@ function readSlackParts(files) {
|
|
|
35639
35746
|
}
|
|
35640
35747
|
|
|
35641
35748
|
// src/commands/slack/reviewProposedSlackMessage.ts
|
|
35642
|
-
import { randomUUID as
|
|
35749
|
+
import { randomUUID as randomUUID19 } from "crypto";
|
|
35643
35750
|
async function reviewProposedSlackMessage(target, body, workingPath) {
|
|
35644
35751
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
35645
35752
|
if (process.env.ASSIST_SESSION !== "1" || !sessionId) return;
|
|
@@ -35649,7 +35756,7 @@ async function reviewProposedSlackMessage(target, body, workingPath) {
|
|
|
35649
35756
|
part ? `Slack message ${part.index} of ${part.total}` : "Slack message preview",
|
|
35650
35757
|
{
|
|
35651
35758
|
sessionId,
|
|
35652
|
-
requestId:
|
|
35759
|
+
requestId: randomUUID19(),
|
|
35653
35760
|
title: part ? `${destination} (${part.index}/${part.total})` : destination,
|
|
35654
35761
|
body,
|
|
35655
35762
|
prNumber: null,
|
|
@@ -39287,6 +39394,22 @@ function registerRun(program2) {
|
|
|
39287
39394
|
registerRunSubcommands(runCommand);
|
|
39288
39395
|
}
|
|
39289
39396
|
|
|
39397
|
+
// src/commands/sessions/nodes/formatLink.ts
|
|
39398
|
+
import chalk249 from "chalk";
|
|
39399
|
+
var STATE_COLOURS = {
|
|
39400
|
+
connected: chalk249.green,
|
|
39401
|
+
connecting: chalk249.yellow,
|
|
39402
|
+
disconnected: chalk249.red,
|
|
39403
|
+
"version-blocked": chalk249.red
|
|
39404
|
+
};
|
|
39405
|
+
function formatLink(link3) {
|
|
39406
|
+
const colour = STATE_COLOURS[link3.state] ?? chalk249.white;
|
|
39407
|
+
const peer = link3.peerVersion ? ` peer ${link3.peerVersion}` : "";
|
|
39408
|
+
const error = link3.error ? `
|
|
39409
|
+
${chalk249.dim(`last error${link3.errorAt ? ` ${link3.errorAt}` : ""}: ${link3.error}`)}` : "";
|
|
39410
|
+
return ` ${link3.name} ${colour(link3.state)} direct ${link3.url}${peer}${error}`;
|
|
39411
|
+
}
|
|
39412
|
+
|
|
39290
39413
|
// src/commands/sessions/daemon/listDaemonPids.ts
|
|
39291
39414
|
import { execFileSync as execFileSync24 } from "child_process";
|
|
39292
39415
|
function listDaemonPids() {
|
|
@@ -39302,7 +39425,7 @@ function listDaemonPids() {
|
|
|
39302
39425
|
}
|
|
39303
39426
|
|
|
39304
39427
|
// src/commands/sessions/daemon/queryDaemon.ts
|
|
39305
|
-
import { createInterface as
|
|
39428
|
+
import { createInterface as createInterface8 } from "readline";
|
|
39306
39429
|
var STATUS_TIMEOUT_MS = 5e3;
|
|
39307
39430
|
function queryDaemon(socket) {
|
|
39308
39431
|
socket.write(`${JSON.stringify({ type: "ping" })}
|
|
@@ -39311,7 +39434,7 @@ function queryDaemon(socket) {
|
|
|
39311
39434
|
const result = { sessions: [] };
|
|
39312
39435
|
const pending = /* @__PURE__ */ new Set(["sessions", "pong"]);
|
|
39313
39436
|
const timer = setTimeout(() => resolve25(result), STATUS_TIMEOUT_MS);
|
|
39314
|
-
const lines2 =
|
|
39437
|
+
const lines2 = createInterface8({ input: socket });
|
|
39315
39438
|
lines2.on("error", () => {
|
|
39316
39439
|
});
|
|
39317
39440
|
lines2.on("line", (line) => {
|
|
@@ -39384,14 +39507,18 @@ async function daemonStatus() {
|
|
|
39384
39507
|
console.log(`Sessions daemon is running${pid ? ` (PID ${pid})` : ""}`);
|
|
39385
39508
|
reportStolenSocket(pid);
|
|
39386
39509
|
reportStrays(listDaemonPids().filter((p) => p !== pid));
|
|
39387
|
-
if (sessions.length === 0)
|
|
39388
|
-
console.log("No sessions");
|
|
39389
|
-
return;
|
|
39390
|
-
}
|
|
39510
|
+
if (sessions.length === 0) console.log("No sessions");
|
|
39391
39511
|
for (const session of sessions) {
|
|
39392
39512
|
const restored = session.restored === false ? " (not restored)" : "";
|
|
39393
39513
|
console.log(` [${session.status}] ${session.name}${restored}`);
|
|
39394
39514
|
}
|
|
39515
|
+
await reportLinks();
|
|
39516
|
+
}
|
|
39517
|
+
async function reportLinks() {
|
|
39518
|
+
const links2 = (await queryNodes())?.links ?? [];
|
|
39519
|
+
if (links2.length === 0) return;
|
|
39520
|
+
console.log("Links:");
|
|
39521
|
+
for (const link3 of links2) console.log(formatLink(link3));
|
|
39395
39522
|
}
|
|
39396
39523
|
function reportStrays(pids) {
|
|
39397
39524
|
if (pids.length === 0) return;
|
|
@@ -39401,7 +39528,7 @@ function reportStrays(pids) {
|
|
|
39401
39528
|
}
|
|
39402
39529
|
|
|
39403
39530
|
// src/commands/sessions/daemon/drainDaemon.ts
|
|
39404
|
-
import { createInterface as
|
|
39531
|
+
import { createInterface as createInterface9 } from "readline";
|
|
39405
39532
|
|
|
39406
39533
|
// src/commands/sessions/daemon/clearPersistedSessionsOnDrain.ts
|
|
39407
39534
|
function clearPersistedSessionsOnDrain() {
|
|
@@ -39443,7 +39570,7 @@ async function drainDaemon(options2 = {}) {
|
|
|
39443
39570
|
clearPersistedSessionsOnDrain();
|
|
39444
39571
|
return;
|
|
39445
39572
|
}
|
|
39446
|
-
const lines2 =
|
|
39573
|
+
const lines2 = createInterface9({ input: socket });
|
|
39447
39574
|
lines2.on("error", () => {
|
|
39448
39575
|
});
|
|
39449
39576
|
const live = await liveSessions(lines2);
|
|
@@ -39791,7 +39918,7 @@ var ClientHub = class extends Set {
|
|
|
39791
39918
|
};
|
|
39792
39919
|
|
|
39793
39920
|
// src/commands/sessions/daemon/createSession.ts
|
|
39794
|
-
import { randomUUID as
|
|
39921
|
+
import { randomUUID as randomUUID20 } from "crypto";
|
|
39795
39922
|
|
|
39796
39923
|
// src/commands/sessions/daemon/sessionBase.ts
|
|
39797
39924
|
function sessionBase(id, status3) {
|
|
@@ -39997,7 +40124,7 @@ function spawnRun(opts) {
|
|
|
39997
40124
|
function createSession(id, { prompt, cwd, design, auto, harness, holdPty } = {}) {
|
|
39998
40125
|
if (harness && harness !== "claude")
|
|
39999
40126
|
return createHarnessSession(id, harness, prompt, cwd, holdPty);
|
|
40000
|
-
const claudeSessionId =
|
|
40127
|
+
const claudeSessionId = randomUUID20();
|
|
40001
40128
|
return {
|
|
40002
40129
|
...sessionBase(id, prompt ? "running" : "waiting"),
|
|
40003
40130
|
name: `Session ${id}`,
|
|
@@ -40920,8 +41047,8 @@ function handleErroredExit(session, exitCode, priorStatus, onStatusChange) {
|
|
|
40920
41047
|
|
|
40921
41048
|
// src/commands/sessions/daemon/handleFailedResume.ts
|
|
40922
41049
|
function handleFailedResume(session, exitCode, onStatusChange) {
|
|
40923
|
-
const
|
|
40924
|
-
if (!
|
|
41050
|
+
const failed3 = session.restored === true && exitCode !== 0 && session.scrollback.length === 0;
|
|
41051
|
+
if (!failed3) return false;
|
|
40925
41052
|
session.error = `resume process exited with code ${exitCode} before producing any output`;
|
|
40926
41053
|
daemonLog(
|
|
40927
41054
|
`could not resume restored session "${session.name}" (id ${session.id}): ${session.error}`
|
|
@@ -42168,7 +42295,7 @@ function codexRespawnPlan(session) {
|
|
|
42168
42295
|
}
|
|
42169
42296
|
|
|
42170
42297
|
// src/commands/sessions/daemon/interactiveRespawnPlan.ts
|
|
42171
|
-
import { randomUUID as
|
|
42298
|
+
import { randomUUID as randomUUID21 } from "crypto";
|
|
42172
42299
|
function interactiveRespawnPlan(session, resumes) {
|
|
42173
42300
|
const { claudeSessionId, cwd, initialPrompt, design, auto } = session;
|
|
42174
42301
|
if (!resumes) return null;
|
|
@@ -42188,7 +42315,7 @@ function interactiveRespawnPlan(session, resumes) {
|
|
|
42188
42315
|
return null;
|
|
42189
42316
|
}
|
|
42190
42317
|
function freshClaudePlan(session, prompt, cwd) {
|
|
42191
|
-
const claudeSessionId =
|
|
42318
|
+
const claudeSessionId = randomUUID21();
|
|
42192
42319
|
return {
|
|
42193
42320
|
spawn: () => {
|
|
42194
42321
|
session.claudeSessionId = claudeSessionId;
|
|
@@ -43197,10 +43324,10 @@ function startReusedRunPty(session, assistArgs, itemId2, hold, clients, onStatus
|
|
|
43197
43324
|
}
|
|
43198
43325
|
|
|
43199
43326
|
// src/commands/sessions/daemon/createWatcherSession.ts
|
|
43200
|
-
import { randomUUID as
|
|
43327
|
+
import { randomUUID as randomUUID22 } from "crypto";
|
|
43201
43328
|
var WATCH_PROMPT = "/watch";
|
|
43202
43329
|
function createWatcherSession(id, cwd) {
|
|
43203
|
-
const claudeSessionId =
|
|
43330
|
+
const claudeSessionId = randomUUID22();
|
|
43204
43331
|
return {
|
|
43205
43332
|
...sessionBase(id, "running"),
|
|
43206
43333
|
name: `Session ${id}`,
|
|
@@ -43773,11 +43900,12 @@ function forwardLinkCreate(ctx, client, data) {
|
|
|
43773
43900
|
});
|
|
43774
43901
|
return;
|
|
43775
43902
|
}
|
|
43903
|
+
const traceId = newTraceId();
|
|
43776
43904
|
daemonLog(
|
|
43777
|
-
`link ${node} ws: routing ${data.type} (cwd=${data.cwd ?? "default"})`
|
|
43905
|
+
`link ${node} ws: routing ${data.type} (cwd=${data.cwd ?? "default"}) trace=${traceId}`
|
|
43778
43906
|
);
|
|
43779
43907
|
armCreateTimeout(ctx, client, data);
|
|
43780
|
-
sendToLink(ctx, toPeerMessage(data));
|
|
43908
|
+
sendToLink(ctx, { ...toPeerMessage(data), traceId });
|
|
43781
43909
|
}
|
|
43782
43910
|
|
|
43783
43911
|
// src/commands/sessions/daemon/links/forwardToLink.ts
|
|
@@ -44657,7 +44785,7 @@ function exitAfterFlush(code) {
|
|
|
44657
44785
|
}
|
|
44658
44786
|
|
|
44659
44787
|
// src/commands/sessions/daemon/handleConnection.ts
|
|
44660
|
-
import { createInterface as
|
|
44788
|
+
import { createInterface as createInterface10 } from "readline";
|
|
44661
44789
|
|
|
44662
44790
|
// src/commands/sessions/daemon/handleHelloRequest.ts
|
|
44663
44791
|
var handleHelloRequest = (client, m, d) => {
|
|
@@ -45184,6 +45312,10 @@ var messageHandlers = {
|
|
|
45184
45312
|
|
|
45185
45313
|
// src/commands/sessions/daemon/dispatchMessage.ts
|
|
45186
45314
|
function dispatchMessage(client, manager, data) {
|
|
45315
|
+
if (typeof data.traceId === "string")
|
|
45316
|
+
daemonLog(
|
|
45317
|
+
`linked ${data.type} received (cwd=${data.cwd ?? "default"}) trace=${data.traceId}`
|
|
45318
|
+
);
|
|
45187
45319
|
messageHandlers[data.type]?.(client, manager, data);
|
|
45188
45320
|
}
|
|
45189
45321
|
|
|
@@ -45197,7 +45329,7 @@ function handleConnection(socket, manager) {
|
|
|
45197
45329
|
};
|
|
45198
45330
|
manager.addClient(client);
|
|
45199
45331
|
manager.clients.greet(client);
|
|
45200
|
-
const lines2 =
|
|
45332
|
+
const lines2 = createInterface10({ input: socket });
|
|
45201
45333
|
lines2.on("error", () => {
|
|
45202
45334
|
});
|
|
45203
45335
|
lines2.on("line", (line) => {
|
|
@@ -45388,8 +45520,263 @@ async function closeSession() {
|
|
|
45388
45520
|
}
|
|
45389
45521
|
}
|
|
45390
45522
|
|
|
45523
|
+
// src/commands/sessions/nodes/DoctorProbes.ts
|
|
45524
|
+
function passed(hop, detail) {
|
|
45525
|
+
return { hop, ok: true, detail };
|
|
45526
|
+
}
|
|
45527
|
+
function failed2(hop, error, remediation) {
|
|
45528
|
+
return { hop, ok: false, error, remediation };
|
|
45529
|
+
}
|
|
45530
|
+
|
|
45531
|
+
// src/commands/sessions/nodes/fetchPeerJson.ts
|
|
45532
|
+
var PEER_TIMEOUT_MS = 3e3;
|
|
45533
|
+
function peerErrorCode(error) {
|
|
45534
|
+
if (!(error instanceof Error)) return void 0;
|
|
45535
|
+
const { code, cause } = error;
|
|
45536
|
+
if (code) return code;
|
|
45537
|
+
if (error.name === "TimeoutError") return "ETIMEDOUT";
|
|
45538
|
+
return cause instanceof Error ? peerErrorCode(cause) : void 0;
|
|
45539
|
+
}
|
|
45540
|
+
function describePeerError(error) {
|
|
45541
|
+
if (!(error instanceof Error)) return String(error);
|
|
45542
|
+
const cause = error.cause;
|
|
45543
|
+
return cause instanceof Error ? `${error.message}: ${describePeerError(cause)}` : error.message;
|
|
45544
|
+
}
|
|
45545
|
+
async function fetchPeerJson(baseUrl, path103, timeoutMs = PEER_TIMEOUT_MS) {
|
|
45546
|
+
const res = await fetch(new URL(path103, baseUrl), {
|
|
45547
|
+
signal: AbortSignal.timeout(timeoutMs)
|
|
45548
|
+
});
|
|
45549
|
+
if (!res.ok)
|
|
45550
|
+
throw Object.assign(
|
|
45551
|
+
new Error(`GET ${path103} returned ${res.status} ${res.statusText}`),
|
|
45552
|
+
{ status: res.status }
|
|
45553
|
+
);
|
|
45554
|
+
return await res.json();
|
|
45555
|
+
}
|
|
45556
|
+
|
|
45557
|
+
// src/commands/sessions/nodes/helloHop.ts
|
|
45558
|
+
async function helloHop(spec, probes) {
|
|
45559
|
+
let msg;
|
|
45560
|
+
try {
|
|
45561
|
+
msg = await probes.hello(spec.url);
|
|
45562
|
+
} catch (error) {
|
|
45563
|
+
return failed2(
|
|
45564
|
+
"ws",
|
|
45565
|
+
describePeerError(error),
|
|
45566
|
+
`${spec.name}'s /api/health answers but its /ws does not \u2014 restart the web server on ${spec.name}, then check \`assist sessions nodes logs ${spec.name}\``
|
|
45567
|
+
);
|
|
45568
|
+
}
|
|
45569
|
+
if (!isHello(msg))
|
|
45570
|
+
return failed2(
|
|
45571
|
+
"ws",
|
|
45572
|
+
`malformed hello: ${JSON.stringify(msg)}`,
|
|
45573
|
+
`run \`assist update\` on ${spec.name}`
|
|
45574
|
+
);
|
|
45575
|
+
const detail = `hello ${msg.version} (protocol ${msg.protocol ?? "legacy"})`;
|
|
45576
|
+
if (helloCompatible(msg)) return passed("ws", detail);
|
|
45577
|
+
const mismatch = `${helloMismatchKind(msg)} mismatch: peer ${msg.version} (protocol ${msg.protocol ?? "legacy"}), this node ${ASSIST_VERSION} (protocol ${PROTOCOL_VERSION})`;
|
|
45578
|
+
const mode = linkVersionCheck();
|
|
45579
|
+
if (mode !== "block")
|
|
45580
|
+
return passed(
|
|
45581
|
+
"ws",
|
|
45582
|
+
`${mismatch}; allowed by sessions.linkVersionCheck=${mode}`
|
|
45583
|
+
);
|
|
45584
|
+
return failed2(
|
|
45585
|
+
"ws",
|
|
45586
|
+
mismatch,
|
|
45587
|
+
`this node heals an older peer via its /api/self-update on connect; if the heal latched, run \`assist update\` on the older node, then \`assist daemon restart\` here`
|
|
45588
|
+
);
|
|
45589
|
+
}
|
|
45590
|
+
|
|
45591
|
+
// src/commands/sessions/nodes/linkStateHop.ts
|
|
45592
|
+
function linkStateHop(spec, probes) {
|
|
45593
|
+
const status3 = probes.linkState(spec.name);
|
|
45594
|
+
if (status3 === "no-daemon")
|
|
45595
|
+
return failed2(
|
|
45596
|
+
"link",
|
|
45597
|
+
"this node's daemon is not running",
|
|
45598
|
+
"links run in the daemon \u2014 start this node's web server or run `assist daemon restart`"
|
|
45599
|
+
);
|
|
45600
|
+
if (status3 === "unknown-link")
|
|
45601
|
+
return failed2(
|
|
45602
|
+
"link",
|
|
45603
|
+
`this node's daemon has no link named ${spec.name}`,
|
|
45604
|
+
"the daemon has not loaded sessions.links \u2014 run `assist daemon restart`"
|
|
45605
|
+
);
|
|
45606
|
+
if (status3.state === "connected") return passed("link", "connected");
|
|
45607
|
+
const error = status3.error ?? status3.state;
|
|
45608
|
+
if (status3.state === "version-blocked")
|
|
45609
|
+
return failed2("link", error, `version mismatch \u2014 heal latched. ${error}`);
|
|
45610
|
+
return failed2(
|
|
45611
|
+
"link",
|
|
45612
|
+
error,
|
|
45613
|
+
`every probe passed but the daemon's link is ${status3.state}; it retries behind the circuit breaker \u2014 check this node's daemon.log for \`link ${spec.name} ws:\` lines`
|
|
45614
|
+
);
|
|
45615
|
+
}
|
|
45616
|
+
|
|
45617
|
+
// src/commands/sessions/nodes/webHop.ts
|
|
45618
|
+
function webRemediation(spec, error) {
|
|
45619
|
+
const { hostname: hostname2, port } = new URL(spec.url);
|
|
45620
|
+
switch (peerErrorCode(error)) {
|
|
45621
|
+
case "ECONNREFUSED":
|
|
45622
|
+
return `nothing listening on ${port} on ${hostname2} \u2014 is ${spec.name}'s web server running (project-switch webservers)?`;
|
|
45623
|
+
case "ETIMEDOUT":
|
|
45624
|
+
return `${hostname2}:${port} did not answer \u2014 is ${spec.name} up and the port reachable from here?`;
|
|
45625
|
+
case "ENOTFOUND":
|
|
45626
|
+
return `cannot resolve ${hostname2} \u2014 fix the url with \`assist sessions nodes link ${spec.name} <url>\``;
|
|
45627
|
+
}
|
|
45628
|
+
if (error.status === 404)
|
|
45629
|
+
return `${spec.name}'s web server has no /api/health \u2014 run \`assist update\` on ${spec.name}`;
|
|
45630
|
+
return `check the link url ${spec.url} with \`assist sessions nodes\``;
|
|
45631
|
+
}
|
|
45632
|
+
async function webHop(spec, probes) {
|
|
45633
|
+
let health2;
|
|
45634
|
+
try {
|
|
45635
|
+
health2 = await probes.health(spec.url);
|
|
45636
|
+
} catch (error) {
|
|
45637
|
+
return {
|
|
45638
|
+
hop: failed2("web", describePeerError(error), webRemediation(spec, error))
|
|
45639
|
+
};
|
|
45640
|
+
}
|
|
45641
|
+
if (health2.nodeName !== spec.name)
|
|
45642
|
+
return {
|
|
45643
|
+
hop: failed2(
|
|
45644
|
+
"web",
|
|
45645
|
+
`peer reports nodeName ${health2.nodeName}, link expects ${spec.name}`,
|
|
45646
|
+
`relink with \`assist sessions nodes unlink ${spec.name}\` then \`assist sessions nodes link ${health2.nodeName} ${spec.url}\`, or set sessions.nodeName on the peer`
|
|
45647
|
+
)
|
|
45648
|
+
};
|
|
45649
|
+
return {
|
|
45650
|
+
hop: passed(
|
|
45651
|
+
"web",
|
|
45652
|
+
`${health2.nodeName} ${health2.version} (protocol ${health2.protocol})`
|
|
45653
|
+
),
|
|
45654
|
+
health: health2
|
|
45655
|
+
};
|
|
45656
|
+
}
|
|
45657
|
+
|
|
45658
|
+
// src/commands/sessions/nodes/diagnoseLink.ts
|
|
45659
|
+
function peerDaemonHop(spec, health2) {
|
|
45660
|
+
if (health2.daemon?.reachable) return passed("daemon", "reachable");
|
|
45661
|
+
return failed2(
|
|
45662
|
+
"daemon",
|
|
45663
|
+
`${spec.name}'s web server reports its daemon unreachable`,
|
|
45664
|
+
`run \`assist daemon status\` on ${spec.name}; restarting its web server starts the daemon`
|
|
45665
|
+
);
|
|
45666
|
+
}
|
|
45667
|
+
async function diagnoseLink(spec, probes) {
|
|
45668
|
+
const hops = [];
|
|
45669
|
+
const done2 = () => ({ ...spec, ok: hops.every((h) => h.ok), hops });
|
|
45670
|
+
const web3 = await webHop(spec, probes);
|
|
45671
|
+
hops.push(web3.hop);
|
|
45672
|
+
if (!web3.health) return done2();
|
|
45673
|
+
hops.push(peerDaemonHop(spec, web3.health));
|
|
45674
|
+
if (!hops.at(-1)?.ok) return done2();
|
|
45675
|
+
hops.push(await helloHop(spec, probes));
|
|
45676
|
+
if (!hops.at(-1)?.ok) return done2();
|
|
45677
|
+
hops.push(linkStateHop(spec, probes));
|
|
45678
|
+
return done2();
|
|
45679
|
+
}
|
|
45680
|
+
|
|
45681
|
+
// src/commands/sessions/nodes/findUnlinkedWindowsNode.ts
|
|
45682
|
+
var WINDOWS_NODE_URL = "http://127.0.0.1:3101";
|
|
45683
|
+
async function findUnlinkedWindowsNode(health2, platform = detectPlatform()) {
|
|
45684
|
+
if (platform !== "wsl") return void 0;
|
|
45685
|
+
try {
|
|
45686
|
+
const { nodeName } = await health2(WINDOWS_NODE_URL);
|
|
45687
|
+
if (!nodeName) return void 0;
|
|
45688
|
+
return {
|
|
45689
|
+
nodeName,
|
|
45690
|
+
url: WINDOWS_NODE_URL,
|
|
45691
|
+
command: `assist sessions nodes link ${nodeName} ${WINDOWS_NODE_URL}`
|
|
45692
|
+
};
|
|
45693
|
+
} catch {
|
|
45694
|
+
return void 0;
|
|
45695
|
+
}
|
|
45696
|
+
}
|
|
45697
|
+
|
|
45698
|
+
// src/commands/sessions/nodes/probePeerHello.ts
|
|
45699
|
+
var HELLO_TIMEOUT_MS = 5e3;
|
|
45700
|
+
async function probePeerHello(url) {
|
|
45701
|
+
let settle = () => {
|
|
45702
|
+
};
|
|
45703
|
+
const reply2 = new Promise((resolve25) => {
|
|
45704
|
+
settle = resolve25;
|
|
45705
|
+
});
|
|
45706
|
+
const socket = await connectLinkWebSocket(url, {
|
|
45707
|
+
onLine: (line) => {
|
|
45708
|
+
try {
|
|
45709
|
+
const msg = JSON.parse(line);
|
|
45710
|
+
if (msg.type === "hello") settle(msg);
|
|
45711
|
+
} catch {
|
|
45712
|
+
}
|
|
45713
|
+
},
|
|
45714
|
+
onClose: (reason4) => settle(new Error(`closed before hello reply (${reason4})`))
|
|
45715
|
+
});
|
|
45716
|
+
const timer = setTimeout(
|
|
45717
|
+
() => settle(new Error(`no hello reply within ${HELLO_TIMEOUT_MS / 1e3}s`)),
|
|
45718
|
+
HELLO_TIMEOUT_MS
|
|
45719
|
+
);
|
|
45720
|
+
socket.send(JSON.stringify(buildHello()));
|
|
45721
|
+
const result = await reply2;
|
|
45722
|
+
clearTimeout(timer);
|
|
45723
|
+
socket.close();
|
|
45724
|
+
if (result instanceof Error) throw result;
|
|
45725
|
+
return result;
|
|
45726
|
+
}
|
|
45727
|
+
|
|
45728
|
+
// src/commands/sessions/nodes/printReport.ts
|
|
45729
|
+
import chalk250 from "chalk";
|
|
45730
|
+
function printReport(report2) {
|
|
45731
|
+
if (report2.links.length === 0) {
|
|
45732
|
+
console.log(`${report2.local} has no links`);
|
|
45733
|
+
if (report2.suggestion)
|
|
45734
|
+
console.log(
|
|
45735
|
+
`A Windows node (${report2.suggestion.nodeName}) answers on ${report2.suggestion.url} but is not linked. Link it with:
|
|
45736
|
+
${report2.suggestion.command}`
|
|
45737
|
+
);
|
|
45738
|
+
return;
|
|
45739
|
+
}
|
|
45740
|
+
for (const diagnosis of report2.links) printDiagnosis(diagnosis);
|
|
45741
|
+
}
|
|
45742
|
+
function printDiagnosis(diagnosis) {
|
|
45743
|
+
console.log(`${chalk250.bold(diagnosis.name)} ${chalk250.dim(diagnosis.url)}`);
|
|
45744
|
+
for (const hop of diagnosis.hops) {
|
|
45745
|
+
const mark = hop.ok ? chalk250.green("\u2713") : chalk250.red("\u2717");
|
|
45746
|
+
console.log(` ${mark} ${hop.hop.padEnd(6)} ${hop.detail ?? hop.error}`);
|
|
45747
|
+
if (hop.remediation) console.log(` ${chalk250.yellow(hop.remediation)}`);
|
|
45748
|
+
}
|
|
45749
|
+
}
|
|
45750
|
+
|
|
45751
|
+
// src/commands/sessions/nodes/doctorNodes.ts
|
|
45752
|
+
function doctorProbes(live) {
|
|
45753
|
+
return {
|
|
45754
|
+
health: (url) => fetchPeerJson(url, "/api/health"),
|
|
45755
|
+
hello: probePeerHello,
|
|
45756
|
+
linkState: (name) => {
|
|
45757
|
+
if (!live) return "no-daemon";
|
|
45758
|
+
return live.links.find((l) => l.name === name) ?? "unknown-link";
|
|
45759
|
+
}
|
|
45760
|
+
};
|
|
45761
|
+
}
|
|
45762
|
+
async function doctorNodes(name, options2) {
|
|
45763
|
+
const specs = (loadConfig().sessions?.links ?? []).filter(
|
|
45764
|
+
(spec) => !name || spec.name === name
|
|
45765
|
+
);
|
|
45766
|
+
if (name && specs.length === 0)
|
|
45767
|
+
throw new Error(`No link named ${name}; see assist sessions nodes`);
|
|
45768
|
+
const probes = doctorProbes(await queryNodes());
|
|
45769
|
+
const report2 = { local: resolveNodeName(), links: [] };
|
|
45770
|
+
for (const spec of specs) report2.links.push(await diagnoseLink(spec, probes));
|
|
45771
|
+
if (specs.length === 0)
|
|
45772
|
+
report2.suggestion = await findUnlinkedWindowsNode(probes.health);
|
|
45773
|
+
if (report2.links.some((l) => !l.ok)) process.exitCode = 1;
|
|
45774
|
+
if (options2.json) console.log(JSON.stringify(report2, null, 2));
|
|
45775
|
+
else printReport(report2);
|
|
45776
|
+
}
|
|
45777
|
+
|
|
45391
45778
|
// src/commands/sessions/nodes/linkNode.ts
|
|
45392
|
-
import
|
|
45779
|
+
import chalk251 from "chalk";
|
|
45393
45780
|
|
|
45394
45781
|
// src/commands/sessions/nodes/writeLinks.ts
|
|
45395
45782
|
function readLinks() {
|
|
@@ -45421,46 +45808,11 @@ async function linkNode(name, url) {
|
|
|
45421
45808
|
throw new Error(`${name} is this node; link to a different node`);
|
|
45422
45809
|
const others = readLinks().filter((link3) => link3.name !== name);
|
|
45423
45810
|
await writeLinks([...others, { name, url: parseLinkUrl(url) }]);
|
|
45424
|
-
console.log(
|
|
45425
|
-
}
|
|
45426
|
-
|
|
45427
|
-
// src/commands/sessions/nodes/listNodes.ts
|
|
45428
|
-
import chalk250 from "chalk";
|
|
45429
|
-
|
|
45430
|
-
// src/commands/sessions/nodes/queryNodes.ts
|
|
45431
|
-
import { createInterface as createInterface10 } from "readline";
|
|
45432
|
-
var QUERY_TIMEOUT_MS = 3e3;
|
|
45433
|
-
async function queryNodes() {
|
|
45434
|
-
let socket;
|
|
45435
|
-
try {
|
|
45436
|
-
socket = await connectToDaemon();
|
|
45437
|
-
} catch {
|
|
45438
|
-
return void 0;
|
|
45439
|
-
}
|
|
45440
|
-
return new Promise((resolve25) => {
|
|
45441
|
-
const finish2 = (result) => {
|
|
45442
|
-
clearTimeout(timer);
|
|
45443
|
-
socket.destroy();
|
|
45444
|
-
resolve25(result);
|
|
45445
|
-
};
|
|
45446
|
-
const timer = setTimeout(() => finish2(void 0), QUERY_TIMEOUT_MS);
|
|
45447
|
-
const lines2 = createInterface10({ input: socket });
|
|
45448
|
-
lines2.on("error", () => {
|
|
45449
|
-
});
|
|
45450
|
-
lines2.on("line", (line) => {
|
|
45451
|
-
try {
|
|
45452
|
-
const data = JSON.parse(line);
|
|
45453
|
-
if (data.type === "nodes") finish2(data);
|
|
45454
|
-
} catch {
|
|
45455
|
-
}
|
|
45456
|
-
});
|
|
45457
|
-
socket.on("error", () => finish2(void 0));
|
|
45458
|
-
socket.write(`${JSON.stringify({ type: "nodes" })}
|
|
45459
|
-
`);
|
|
45460
|
-
});
|
|
45811
|
+
console.log(chalk251.green(`Linked ${name} (${parseLinkUrl(url)})`));
|
|
45461
45812
|
}
|
|
45462
45813
|
|
|
45463
45814
|
// src/commands/sessions/nodes/listNodes.ts
|
|
45815
|
+
import chalk252 from "chalk";
|
|
45464
45816
|
async function nodesReport() {
|
|
45465
45817
|
const live = await queryNodes();
|
|
45466
45818
|
if (live)
|
|
@@ -45472,43 +45824,64 @@ async function nodesReport() {
|
|
|
45472
45824
|
links: configured.map((link3) => ({ ...link3, state: "disconnected" }))
|
|
45473
45825
|
};
|
|
45474
45826
|
}
|
|
45475
|
-
var STATE_COLOURS = {
|
|
45476
|
-
connected: chalk250.green,
|
|
45477
|
-
connecting: chalk250.yellow,
|
|
45478
|
-
disconnected: chalk250.red,
|
|
45479
|
-
"version-blocked": chalk250.red
|
|
45480
|
-
};
|
|
45481
|
-
function formatLink(link3) {
|
|
45482
|
-
const colour = STATE_COLOURS[link3.state] ?? chalk250.white;
|
|
45483
|
-
const peer = link3.peerVersion ? ` peer ${link3.peerVersion}` : "";
|
|
45484
|
-
const error = link3.error ? `
|
|
45485
|
-
${chalk250.dim(`last error${link3.errorAt ? ` ${link3.errorAt}` : ""}: ${link3.error}`)}` : "";
|
|
45486
|
-
return ` ${link3.name} ${colour(link3.state)} direct ${link3.url}${peer}${error}`;
|
|
45487
|
-
}
|
|
45488
45827
|
async function listNodes(options2) {
|
|
45489
45828
|
const report2 = await nodesReport();
|
|
45490
45829
|
if (options2.json) {
|
|
45491
45830
|
console.log(JSON.stringify(report2, null, 2));
|
|
45492
45831
|
return;
|
|
45493
45832
|
}
|
|
45494
|
-
console.log(`${report2.local} ${
|
|
45833
|
+
console.log(`${report2.local} ${chalk252.dim("(this node)")}`);
|
|
45495
45834
|
if (!report2.daemonRunning)
|
|
45496
|
-
console.log(
|
|
45497
|
-
if (report2.links.length === 0) console.log(
|
|
45835
|
+
console.log(chalk252.dim(" daemon not running; showing configured links"));
|
|
45836
|
+
if (report2.links.length === 0) console.log(chalk252.dim(" no links"));
|
|
45498
45837
|
for (const link3 of report2.links) console.log(formatLink(link3));
|
|
45499
45838
|
}
|
|
45500
45839
|
|
|
45840
|
+
// src/commands/sessions/nodes/nodeLogs.ts
|
|
45841
|
+
async function fetchLogTail(name, lines2) {
|
|
45842
|
+
if (name === resolveNodeName())
|
|
45843
|
+
return {
|
|
45844
|
+
nodeName: name,
|
|
45845
|
+
path: daemonPaths.log,
|
|
45846
|
+
lines: readLogTail(daemonPaths.log, lines2)
|
|
45847
|
+
};
|
|
45848
|
+
const link3 = loadConfig().sessions?.links?.find((l) => l.name === name);
|
|
45849
|
+
if (!link3)
|
|
45850
|
+
throw new Error(`No link named ${name}; see assist sessions nodes`);
|
|
45851
|
+
try {
|
|
45852
|
+
return await fetchPeerJson(
|
|
45853
|
+
link3.url,
|
|
45854
|
+
`/api/daemon-log?lines=${lines2}`
|
|
45855
|
+
);
|
|
45856
|
+
} catch (error) {
|
|
45857
|
+
throw new Error(
|
|
45858
|
+
`Could not read ${name}'s daemon log: ${describePeerError(error)}. Run assist sessions nodes doctor ${name}`
|
|
45859
|
+
);
|
|
45860
|
+
}
|
|
45861
|
+
}
|
|
45862
|
+
async function nodeLogs(name, options2) {
|
|
45863
|
+
const lines2 = Number.parseInt(options2.lines, 10);
|
|
45864
|
+
if (!Number.isInteger(lines2) || lines2 < 1)
|
|
45865
|
+
throw new Error(`-n must be a positive integer, got ${options2.lines}`);
|
|
45866
|
+
const tail = await fetchLogTail(name, lines2);
|
|
45867
|
+
if (options2.json) {
|
|
45868
|
+
console.log(JSON.stringify(tail, null, 2));
|
|
45869
|
+
return;
|
|
45870
|
+
}
|
|
45871
|
+
for (const line of tail.lines) console.log(line);
|
|
45872
|
+
}
|
|
45873
|
+
|
|
45501
45874
|
// src/commands/sessions/nodes/unlinkNode.ts
|
|
45502
|
-
import
|
|
45875
|
+
import chalk253 from "chalk";
|
|
45503
45876
|
async function unlinkNode(name) {
|
|
45504
45877
|
const links2 = readLinks();
|
|
45505
45878
|
const remaining = links2.filter((link3) => link3.name !== name);
|
|
45506
45879
|
if (remaining.length === links2.length) {
|
|
45507
|
-
console.log(
|
|
45880
|
+
console.log(chalk253.yellow(`No link named ${name}`));
|
|
45508
45881
|
return;
|
|
45509
45882
|
}
|
|
45510
45883
|
await writeLinks(remaining);
|
|
45511
|
-
console.log(
|
|
45884
|
+
console.log(chalk253.green(`Unlinked ${name}`));
|
|
45512
45885
|
}
|
|
45513
45886
|
|
|
45514
45887
|
// src/commands/sessions/nodes/registerNodes.ts
|
|
@@ -45518,6 +45891,14 @@ function registerNodes(sessions) {
|
|
|
45518
45891
|
"Link a peer node by its web server URL (name must match the peer's sessions.nodeName)"
|
|
45519
45892
|
).action(linkNode);
|
|
45520
45893
|
cmd.command("unlink <name>").description("Remove a linked node").action(unlinkNode);
|
|
45894
|
+
cmd.command("doctor [name]").description(
|
|
45895
|
+
"Probe each hop of every link (or one) in order and stop at the first failure with a remediation"
|
|
45896
|
+
).option("--json", "Output as JSON").action(
|
|
45897
|
+
(name, _options, command) => doctorNodes(name, command.optsWithGlobals())
|
|
45898
|
+
);
|
|
45899
|
+
cmd.command("logs <name>").description("Tail a linked node's daemon.log through its web server").option("-n, --lines <lines>", "Number of lines", "200").option("--json", "Output as JSON").action(
|
|
45900
|
+
(name, _options, command) => nodeLogs(name, command.optsWithGlobals())
|
|
45901
|
+
);
|
|
45521
45902
|
configHelp(cmd, nodesConfigHelp);
|
|
45522
45903
|
}
|
|
45523
45904
|
|
|
@@ -45554,7 +45935,7 @@ async function renameSession(title) {
|
|
|
45554
45935
|
|
|
45555
45936
|
// src/commands/sessions/summarise.ts
|
|
45556
45937
|
import * as fs58 from "fs";
|
|
45557
|
-
import
|
|
45938
|
+
import chalk254 from "chalk";
|
|
45558
45939
|
|
|
45559
45940
|
// src/commands/sessions/summarise/shared.ts
|
|
45560
45941
|
import * as fs57 from "fs";
|
|
@@ -45613,22 +45994,22 @@ ${firstMessage}`);
|
|
|
45613
45994
|
async function summarise2(options2) {
|
|
45614
45995
|
const files = await discoverSessionFiles();
|
|
45615
45996
|
if (files.length === 0) {
|
|
45616
|
-
console.log(
|
|
45997
|
+
console.log(chalk254.yellow("No sessions found."));
|
|
45617
45998
|
return;
|
|
45618
45999
|
}
|
|
45619
46000
|
const toProcess = selectCandidates(files, options2);
|
|
45620
46001
|
if (toProcess.length === 0) {
|
|
45621
|
-
console.log(
|
|
46002
|
+
console.log(chalk254.green("All sessions already summarised."));
|
|
45622
46003
|
return;
|
|
45623
46004
|
}
|
|
45624
46005
|
console.log(
|
|
45625
|
-
|
|
46006
|
+
chalk254.cyan(
|
|
45626
46007
|
`Summarising ${toProcess.length} session(s) (${files.length} total)\u2026`
|
|
45627
46008
|
)
|
|
45628
46009
|
);
|
|
45629
|
-
const { succeeded, failed:
|
|
46010
|
+
const { succeeded, failed: failed3 } = processSessions(toProcess);
|
|
45630
46011
|
console.log(
|
|
45631
|
-
|
|
46012
|
+
chalk254.green(`Done: ${succeeded} summarised`) + (failed3 > 0 ? chalk254.yellow(`, ${failed3} skipped`) : "")
|
|
45632
46013
|
);
|
|
45633
46014
|
}
|
|
45634
46015
|
function selectCandidates(files, options2) {
|
|
@@ -45645,23 +46026,23 @@ function selectCandidates(files, options2) {
|
|
|
45645
46026
|
}
|
|
45646
46027
|
function processSessions(files) {
|
|
45647
46028
|
let succeeded = 0;
|
|
45648
|
-
let
|
|
46029
|
+
let failed3 = 0;
|
|
45649
46030
|
for (let i = 0; i < files.length; i++) {
|
|
45650
46031
|
const file = files[i];
|
|
45651
|
-
process.stdout.write(
|
|
46032
|
+
process.stdout.write(chalk254.dim(` [${i + 1}/${files.length}] `));
|
|
45652
46033
|
const summary = summariseSession(file);
|
|
45653
46034
|
if (summary) {
|
|
45654
46035
|
writeSummary(file, summary);
|
|
45655
46036
|
succeeded++;
|
|
45656
|
-
process.stdout.write(`${
|
|
46037
|
+
process.stdout.write(`${chalk254.green("\u2713")} ${summary}
|
|
45657
46038
|
`);
|
|
45658
46039
|
} else {
|
|
45659
|
-
|
|
45660
|
-
process.stdout.write(` ${
|
|
46040
|
+
failed3++;
|
|
46041
|
+
process.stdout.write(` ${chalk254.yellow("skip")}
|
|
45661
46042
|
`);
|
|
45662
46043
|
}
|
|
45663
46044
|
}
|
|
45664
|
-
return { succeeded, failed:
|
|
46045
|
+
return { succeeded, failed: failed3 };
|
|
45665
46046
|
}
|
|
45666
46047
|
|
|
45667
46048
|
// src/commands/sessions/registerSessions.ts
|
|
@@ -45685,10 +46066,10 @@ function registerSessions(program2) {
|
|
|
45685
46066
|
}
|
|
45686
46067
|
|
|
45687
46068
|
// src/reportCliError.ts
|
|
45688
|
-
import
|
|
46069
|
+
import chalk255 from "chalk";
|
|
45689
46070
|
function reportCliError(error) {
|
|
45690
46071
|
if (error instanceof InvalidItemIdError || error instanceof AmbiguousRepoConfigError || error instanceof UnknownRepoConfigError || error instanceof MissingRunCwdError || error instanceof MiroExtractError) {
|
|
45691
|
-
console.error(
|
|
46072
|
+
console.error(chalk255.red(error.message));
|
|
45692
46073
|
} else {
|
|
45693
46074
|
console.error(error);
|
|
45694
46075
|
}
|