@staff0rd/assist 0.1021.1 → 0.1022.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/dist/commands/sessions/web/bundle.js +2 -2
- package/dist/index.js +108 -237
- 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.1022.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -22653,6 +22653,9 @@ function validateCommentText(raw, isHash = false) {
|
|
|
22653
22653
|
import { mkdirSync as mkdirSync17, writeFileSync as writeFileSync27 } from "fs";
|
|
22654
22654
|
import { randomInt } from "crypto";
|
|
22655
22655
|
|
|
22656
|
+
// src/commands/notify/deliverPinNotification.ts
|
|
22657
|
+
import { randomUUID as randomUUID12 } from "crypto";
|
|
22658
|
+
|
|
22656
22659
|
// src/commands/notify/showNotification.ts
|
|
22657
22660
|
import notifier from "node-notifier";
|
|
22658
22661
|
|
|
@@ -22708,6 +22711,27 @@ function showNotification(options2) {
|
|
|
22708
22711
|
return true;
|
|
22709
22712
|
}
|
|
22710
22713
|
|
|
22714
|
+
// src/commands/notify/deliverPinNotification.ts
|
|
22715
|
+
var ROUTE_TIMEOUT_MS = 1e4;
|
|
22716
|
+
async function relayToViewerNode(notification) {
|
|
22717
|
+
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
22718
|
+
if (!sessionId) return void 0;
|
|
22719
|
+
const requestId = randomUUID12();
|
|
22720
|
+
const reply2 = await requestDaemonReply(
|
|
22721
|
+
{ type: "notify-pin", sessionId, requestId, ...notification },
|
|
22722
|
+
"notify-pin-result",
|
|
22723
|
+
ROUTE_TIMEOUT_MS
|
|
22724
|
+
);
|
|
22725
|
+
if (reply2?.requestId !== requestId) return void 0;
|
|
22726
|
+
return reply2.node;
|
|
22727
|
+
}
|
|
22728
|
+
async function deliverPinNotification(notification) {
|
|
22729
|
+
const node = await relayToViewerNode(notification);
|
|
22730
|
+
if (node) return { delivered: true, node };
|
|
22731
|
+
const { title, message: message3 } = notification;
|
|
22732
|
+
return { delivered: showNotification({ title, message: message3 }) };
|
|
22733
|
+
}
|
|
22734
|
+
|
|
22711
22735
|
// src/commands/codeComment/issuePin.ts
|
|
22712
22736
|
function issuePin(file, lineNumber, text19) {
|
|
22713
22737
|
const pin2 = generatePin();
|
|
@@ -22717,7 +22741,9 @@ function issuePin(file, lineNumber, text19) {
|
|
|
22717
22741
|
getPinStatePath(pin2),
|
|
22718
22742
|
JSON.stringify({ pin: pin2, file, line: lineNumber, text: text19 })
|
|
22719
22743
|
);
|
|
22720
|
-
return
|
|
22744
|
+
return deliverPinNotification({
|
|
22745
|
+
area: "code-comment",
|
|
22746
|
+
pin: pin2,
|
|
22721
22747
|
title: "assist code-comment pin",
|
|
22722
22748
|
message: `Pin ${pin2} \u2014 run: assist code-comment confirm ${pin2}`
|
|
22723
22749
|
});
|
|
@@ -22727,7 +22753,7 @@ function generatePin() {
|
|
|
22727
22753
|
}
|
|
22728
22754
|
|
|
22729
22755
|
// src/commands/codeComment/codeCommentSet.ts
|
|
22730
|
-
function codeCommentSet(file, line, text19) {
|
|
22756
|
+
async function codeCommentSet(file, line, text19) {
|
|
22731
22757
|
const lineNumber = Number.parseInt(line, 10);
|
|
22732
22758
|
if (!Number.isInteger(lineNumber) || lineNumber < 1) {
|
|
22733
22759
|
console.error(chalk119.red(`Invalid line number: ${line}`));
|
|
@@ -22748,7 +22774,7 @@ function codeCommentSet(file, line, text19) {
|
|
|
22748
22774
|
"THIS IS YOUR LAST CHANCE TO RECONSIDER BEFORE INVOLVING A HUMAN.\nRequesting this pin pages a real person to approve a comment. DO NOT WASTE THEIR TIME.\nYou had BETTER BE RIGHT that this comment is genuinely necessary.\n\nComments are a last resort, not a habit. Almost every comment you reach for is a sign\nthe code should be clearer instead. Before a human is pulled in, ask whether a better\nname, a smaller function, or a test would make the comment redundant. ONLY if you are\ncertain this one line earns its keep should you proceed to the confirm step below."
|
|
22749
22775
|
)
|
|
22750
22776
|
);
|
|
22751
|
-
const delivered = issuePin(file, lineNumber, validation.text);
|
|
22777
|
+
const { delivered, node } = await issuePin(file, lineNumber, validation.text);
|
|
22752
22778
|
if (!delivered) {
|
|
22753
22779
|
console.error(
|
|
22754
22780
|
chalk119.red(
|
|
@@ -22759,8 +22785,8 @@ function codeCommentSet(file, line, text19) {
|
|
|
22759
22785
|
return;
|
|
22760
22786
|
}
|
|
22761
22787
|
console.log(
|
|
22762
|
-
`A confirmation pin was sent to your desktop notifications.
|
|
22763
|
-
To insert "${marker2} ${validation.text}" at ${file}:${lineNumber}, run:
|
|
22788
|
+
`A confirmation pin was sent to your desktop notifications${node ? ` on ${node}, the node controlling this session` : ""}.
|
|
22789
|
+
To insert "${marker2} ${validation.text}" at ${file}:${lineNumber}, run${node ? ` on ${node}` : ""}:
|
|
22764
22790
|
${chalk119.cyan(" assist code-comment confirm <PIN>")}
|
|
22765
22791
|
using the pin from that notification.`
|
|
22766
22792
|
);
|
|
@@ -25284,7 +25310,7 @@ function nextMigrationId() {
|
|
|
25284
25310
|
}
|
|
25285
25311
|
|
|
25286
25312
|
// src/commands/dbMigration/dbMigrationUnlock.ts
|
|
25287
|
-
function dbMigrationUnlock() {
|
|
25313
|
+
async function dbMigrationUnlock() {
|
|
25288
25314
|
const migrationId = nextMigrationId();
|
|
25289
25315
|
const pin2 = randomInt2(0, 1e3).toString().padStart(3, "0");
|
|
25290
25316
|
mkdirSync19(getRestrictedDir(), { recursive: true });
|
|
@@ -25295,7 +25321,9 @@ function dbMigrationUnlock() {
|
|
|
25295
25321
|
"THIS IS YOUR LAST CHANCE TO RECONSIDER BEFORE INVOLVING A HUMAN.\nRequesting this pin pages a real person to approve a new database migration.\nA schema change is hard to reverse once shipped. You had BETTER have confirmed\nthe change with the user and be certain this migration is genuinely necessary."
|
|
25296
25322
|
)
|
|
25297
25323
|
);
|
|
25298
|
-
const delivered =
|
|
25324
|
+
const { delivered, node } = await deliverPinNotification({
|
|
25325
|
+
area: "db-migration",
|
|
25326
|
+
pin: pin2,
|
|
25299
25327
|
title: "assist db-migration pin",
|
|
25300
25328
|
message: `Pin ${pin2} \u2014 run: assist db-migration confirm ${pin2}`
|
|
25301
25329
|
});
|
|
@@ -25309,8 +25337,8 @@ function dbMigrationUnlock() {
|
|
|
25309
25337
|
return;
|
|
25310
25338
|
}
|
|
25311
25339
|
console.log(
|
|
25312
|
-
`A confirmation pin was sent to your desktop notifications.
|
|
25313
|
-
To approve creating migration ${migrationId}, run:
|
|
25340
|
+
`A confirmation pin was sent to your desktop notifications${node ? ` on ${node}, the node controlling this session` : ""}.
|
|
25341
|
+
To approve creating migration ${migrationId}, run${node ? ` on ${node}` : ""}:
|
|
25314
25342
|
${chalk156.cyan(" assist db-migration confirm <PIN>")}
|
|
25315
25343
|
using the pin from that notification.`
|
|
25316
25344
|
);
|
|
@@ -26013,24 +26041,8 @@ function registerDevlog(program) {
|
|
|
26013
26041
|
}
|
|
26014
26042
|
|
|
26015
26043
|
// src/commands/docs/docsConfirm.ts
|
|
26016
|
-
import chalk166 from "chalk";
|
|
26017
|
-
|
|
26018
|
-
// src/commands/notify/forwardPinConfirm.ts
|
|
26019
|
-
import { randomUUID as randomUUID12 } from "crypto";
|
|
26020
|
-
var CONFIRM_TIMEOUT_MS = 15e3;
|
|
26021
|
-
async function forwardPinConfirm(area, pin2) {
|
|
26022
|
-
const requestId = randomUUID12();
|
|
26023
|
-
const reply2 = await requestDaemonReply(
|
|
26024
|
-
{ type: "confirm-pin", requestId, area, pin: pin2 },
|
|
26025
|
-
"confirm-pin-result",
|
|
26026
|
-
CONFIRM_TIMEOUT_MS
|
|
26027
|
-
);
|
|
26028
|
-
if (!reply2?.found || reply2.requestId !== requestId) return void 0;
|
|
26029
|
-
return { ok: reply2.ok === true, message: reply2.message ?? "" };
|
|
26030
|
-
}
|
|
26031
|
-
|
|
26032
|
-
// src/commands/docs/approveDocsUnlock.ts
|
|
26033
26044
|
import { unlinkSync as unlinkSync10 } from "fs";
|
|
26045
|
+
import chalk166 from "chalk";
|
|
26034
26046
|
|
|
26035
26047
|
// src/commands/docs/getDocsUnlockPinPath.ts
|
|
26036
26048
|
import { join as join71 } from "path";
|
|
@@ -26071,75 +26083,43 @@ async function recordDocsUnlock(orm, itemId2, phase) {
|
|
|
26071
26083
|
});
|
|
26072
26084
|
}
|
|
26073
26085
|
|
|
26074
|
-
// src/commands/docs/
|
|
26075
|
-
async function
|
|
26086
|
+
// src/commands/docs/docsConfirm.ts
|
|
26087
|
+
async function docsConfirm(pin2) {
|
|
26076
26088
|
sweepRestrictedDir();
|
|
26077
26089
|
const state = readDocsUnlockPinState(pin2);
|
|
26078
|
-
if (!state)
|
|
26090
|
+
if (!state) {
|
|
26091
|
+
console.error(chalk166.red(`No pending docs unlock for pin: ${pin2}`));
|
|
26092
|
+
process.exitCode = 1;
|
|
26093
|
+
return;
|
|
26094
|
+
}
|
|
26079
26095
|
unlinkSync10(getDocsUnlockPinPath(pin2));
|
|
26080
26096
|
const found = await findOneItem(String(state.itemId));
|
|
26081
|
-
if (!found)
|
|
26082
|
-
return {
|
|
26083
|
-
ok: false,
|
|
26084
|
-
message: `Item ${formatItemId(state.itemId)} not found; nothing was approved.`
|
|
26085
|
-
};
|
|
26086
|
-
const label = `${formatItemId(state.itemId)} ${found.item.name}`;
|
|
26087
|
-
if ((found.item.currentPhase ?? 1) !== state.phase)
|
|
26088
|
-
return {
|
|
26089
|
-
ok: false,
|
|
26090
|
-
message: `${label} has moved on from phase ${state.phase} since the unlock was requested. Nothing was approved; request a new unlock from the current phase.`
|
|
26091
|
-
};
|
|
26092
|
-
await recordDocsUnlock(found.orm, state.itemId, state.phase);
|
|
26093
|
-
return {
|
|
26094
|
-
ok: true,
|
|
26095
|
-
message: `Approved docs changes for phase ${state.phase} of ${label}. Its sessions may edit and commit docs pages and screenshots until the item moves on from that phase or is done or won't-do.`
|
|
26096
|
-
};
|
|
26097
|
-
}
|
|
26098
|
-
|
|
26099
|
-
// src/commands/docs/docsConfirm.ts
|
|
26100
|
-
async function docsConfirm(pin2) {
|
|
26101
|
-
const result = await approveDocsUnlock(pin2) ?? await forwardPinConfirm("docs", pin2);
|
|
26102
|
-
if (!result) {
|
|
26103
|
-
console.error(chalk166.red(`No pending docs unlock for pin: ${pin2}`));
|
|
26097
|
+
if (!found) {
|
|
26104
26098
|
process.exitCode = 1;
|
|
26105
26099
|
return;
|
|
26106
26100
|
}
|
|
26107
|
-
|
|
26108
|
-
|
|
26101
|
+
const label = `${formatItemId(state.itemId)} ${found.item.name}`;
|
|
26102
|
+
if ((found.item.currentPhase ?? 1) !== state.phase) {
|
|
26103
|
+
console.error(
|
|
26104
|
+
chalk166.red(
|
|
26105
|
+
`${label} has moved on from phase ${state.phase} since the unlock was requested. Nothing was approved; request a new unlock from the current phase.`
|
|
26106
|
+
)
|
|
26107
|
+
);
|
|
26108
|
+
process.exitCode = 1;
|
|
26109
26109
|
return;
|
|
26110
26110
|
}
|
|
26111
|
-
|
|
26112
|
-
|
|
26111
|
+
await recordDocsUnlock(found.orm, state.itemId, state.phase);
|
|
26112
|
+
console.log(
|
|
26113
|
+
chalk166.green(
|
|
26114
|
+
`Approved docs changes for phase ${state.phase} of ${label}. Its sessions may edit and commit docs pages and screenshots until the item moves on from that phase or is done or won't-do.`
|
|
26115
|
+
)
|
|
26116
|
+
);
|
|
26113
26117
|
}
|
|
26114
26118
|
|
|
26115
26119
|
// src/commands/docs/docsUnlock.ts
|
|
26116
26120
|
import { randomInt as randomInt3 } from "crypto";
|
|
26117
26121
|
import { mkdirSync as mkdirSync21, unlinkSync as unlinkSync11, writeFileSync as writeFileSync34 } from "fs";
|
|
26118
26122
|
import chalk167 from "chalk";
|
|
26119
|
-
|
|
26120
|
-
// src/commands/notify/deliverPinNotification.ts
|
|
26121
|
-
import { randomUUID as randomUUID13 } from "crypto";
|
|
26122
|
-
var ROUTE_TIMEOUT_MS = 1e4;
|
|
26123
|
-
async function relayToViewerNode(notification) {
|
|
26124
|
-
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
26125
|
-
if (!sessionId) return void 0;
|
|
26126
|
-
const requestId = randomUUID13();
|
|
26127
|
-
const reply2 = await requestDaemonReply(
|
|
26128
|
-
{ type: "notify-pin", sessionId, requestId, ...notification },
|
|
26129
|
-
"notify-pin-result",
|
|
26130
|
-
ROUTE_TIMEOUT_MS
|
|
26131
|
-
);
|
|
26132
|
-
if (reply2?.requestId !== requestId) return void 0;
|
|
26133
|
-
return reply2.node;
|
|
26134
|
-
}
|
|
26135
|
-
async function deliverPinNotification(notification) {
|
|
26136
|
-
const node = await relayToViewerNode(notification);
|
|
26137
|
-
if (node) return { delivered: true, node };
|
|
26138
|
-
const { title, message: message3 } = notification;
|
|
26139
|
-
return { delivered: showNotification({ title, message: message3 }) };
|
|
26140
|
-
}
|
|
26141
|
-
|
|
26142
|
-
// src/commands/docs/docsUnlock.ts
|
|
26143
26123
|
function fail7(message3) {
|
|
26144
26124
|
console.error(chalk167.red(message3));
|
|
26145
26125
|
process.exitCode = 1;
|
|
@@ -28344,13 +28324,13 @@ function validateProposedContent(labels, title, body) {
|
|
|
28344
28324
|
}
|
|
28345
28325
|
|
|
28346
28326
|
// src/commands/github/issue/reviewProposedIssueComment.ts
|
|
28347
|
-
import { randomUUID as
|
|
28327
|
+
import { randomUUID as randomUUID13 } from "crypto";
|
|
28348
28328
|
async function reviewProposedIssueComment(title, body) {
|
|
28349
28329
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
28350
28330
|
if (process.env.ASSIST_SESSION !== "1" || !sessionId) return;
|
|
28351
28331
|
await awaitPreviewApproval("GitHub issue comment preview", {
|
|
28352
28332
|
sessionId,
|
|
28353
|
-
requestId:
|
|
28333
|
+
requestId: randomUUID13(),
|
|
28354
28334
|
title,
|
|
28355
28335
|
body,
|
|
28356
28336
|
prNumber: null,
|
|
@@ -28868,13 +28848,13 @@ function resolveCreateIssueMetadata(options2) {
|
|
|
28868
28848
|
}
|
|
28869
28849
|
|
|
28870
28850
|
// src/commands/github/issue/reviewProposedIssue.ts
|
|
28871
|
-
import { randomUUID as
|
|
28851
|
+
import { randomUUID as randomUUID14 } from "crypto";
|
|
28872
28852
|
async function reviewProposedIssue(title, body, metadata2 = []) {
|
|
28873
28853
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
28874
28854
|
if (process.env.ASSIST_SESSION !== "1" || !sessionId) return void 0;
|
|
28875
28855
|
return await awaitPreviewApproval("GitHub issue preview", {
|
|
28876
28856
|
sessionId,
|
|
28877
|
-
requestId:
|
|
28857
|
+
requestId: randomUUID14(),
|
|
28878
28858
|
title,
|
|
28879
28859
|
body,
|
|
28880
28860
|
prNumber: null,
|
|
@@ -29174,7 +29154,7 @@ function pushUnchangedIssue(number, repo, target, fetchedAt, bodyPath) {
|
|
|
29174
29154
|
}
|
|
29175
29155
|
|
|
29176
29156
|
// src/commands/github/issue/reviewProposedIssueEdit.ts
|
|
29177
|
-
import { randomUUID as
|
|
29157
|
+
import { randomUUID as randomUUID15 } from "crypto";
|
|
29178
29158
|
async function reviewProposedIssueEdit(title, body, working) {
|
|
29179
29159
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
29180
29160
|
if (process.env.ASSIST_SESSION !== "1" || !sessionId) return body;
|
|
@@ -29182,7 +29162,7 @@ async function reviewProposedIssueEdit(title, body, working) {
|
|
|
29182
29162
|
"GitHub issue edit preview",
|
|
29183
29163
|
{
|
|
29184
29164
|
sessionId,
|
|
29185
|
-
requestId:
|
|
29165
|
+
requestId: randomUUID15(),
|
|
29186
29166
|
title,
|
|
29187
29167
|
body,
|
|
29188
29168
|
prNumber: null,
|
|
@@ -30195,7 +30175,7 @@ function registerRefineLaunch(program, resumeFlag) {
|
|
|
30195
30175
|
}
|
|
30196
30176
|
|
|
30197
30177
|
// src/commands/fixConflict.ts
|
|
30198
|
-
import { randomUUID as
|
|
30178
|
+
import { randomUUID as randomUUID16 } from "crypto";
|
|
30199
30179
|
|
|
30200
30180
|
// src/commands/review/checkoutPr.ts
|
|
30201
30181
|
import { execFileSync as execFileSync16 } from "child_process";
|
|
@@ -30980,7 +30960,7 @@ function buildPrompt2(rebase) {
|
|
|
30980
30960
|
async function fixConflict(number, options2 = {}) {
|
|
30981
30961
|
const { resumeSessionId } = options2;
|
|
30982
30962
|
if (number && !resumeSessionId) await checkoutPr(number);
|
|
30983
|
-
const claudeSessionId = resumeSessionId ??
|
|
30963
|
+
const claudeSessionId = resumeSessionId ?? randomUUID16();
|
|
30984
30964
|
emitActivity({
|
|
30985
30965
|
kind: "command",
|
|
30986
30966
|
name: "fix-conflict",
|
|
@@ -31008,7 +30988,7 @@ function registerFixConflict(program, resumeFlag) {
|
|
|
31008
30988
|
}
|
|
31009
30989
|
|
|
31010
30990
|
// src/commands/reviewPrComments.ts
|
|
31011
|
-
import { randomUUID as
|
|
30991
|
+
import { randomUUID as randomUUID17 } from "crypto";
|
|
31012
30992
|
function buildPrompt3(number, announce, options2) {
|
|
31013
30993
|
const args = [
|
|
31014
30994
|
"/review-pr-comments",
|
|
@@ -31034,7 +31014,7 @@ async function reviewPrComments(number, options2 = {}) {
|
|
|
31034
31014
|
validateAnnounce(number, announce);
|
|
31035
31015
|
validateMode(options2);
|
|
31036
31016
|
if (number && !resumeSessionId) await checkoutPr(number);
|
|
31037
|
-
const claudeSessionId = resumeSessionId ??
|
|
31017
|
+
const claudeSessionId = resumeSessionId ?? randomUUID17();
|
|
31038
31018
|
emitActivity({
|
|
31039
31019
|
kind: "command",
|
|
31040
31020
|
name: "review-pr-comments",
|
|
@@ -31576,7 +31556,7 @@ async function offerSaveExtract(extract2, options2, paths = {}) {
|
|
|
31576
31556
|
}
|
|
31577
31557
|
|
|
31578
31558
|
// src/commands/miro/pickAnchors.ts
|
|
31579
|
-
import { randomUUID as
|
|
31559
|
+
import { randomUUID as randomUUID18 } from "crypto";
|
|
31580
31560
|
|
|
31581
31561
|
// src/commands/miro/isBox.ts
|
|
31582
31562
|
var boxTypes = /* @__PURE__ */ new Set(["shape", "sticky_note"]);
|
|
@@ -31597,7 +31577,7 @@ async function pickAnchors(sessionId, items2) {
|
|
|
31597
31577
|
"Miro anchor selection",
|
|
31598
31578
|
{
|
|
31599
31579
|
sessionId,
|
|
31600
|
-
requestId:
|
|
31580
|
+
requestId: randomUUID18(),
|
|
31601
31581
|
title: "Pick the top-left then the bottom-right box",
|
|
31602
31582
|
body: encodeMiroBoardPreview(items2),
|
|
31603
31583
|
prNumber: null,
|
|
@@ -32828,13 +32808,13 @@ function postReviewComment(vars) {
|
|
|
32828
32808
|
}
|
|
32829
32809
|
|
|
32830
32810
|
// src/commands/prs/reviewProposedPrComment.ts
|
|
32831
|
-
import { randomUUID as
|
|
32811
|
+
import { randomUUID as randomUUID19 } from "crypto";
|
|
32832
32812
|
async function reviewProposedPrComment(title, body, prNumber) {
|
|
32833
32813
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
32834
32814
|
if (process.env.ASSIST_SESSION !== "1" || !sessionId) return;
|
|
32835
32815
|
await awaitPreviewApproval("PR comment preview", {
|
|
32836
32816
|
sessionId,
|
|
32837
|
-
requestId:
|
|
32817
|
+
requestId: randomUUID19(),
|
|
32838
32818
|
title,
|
|
32839
32819
|
body,
|
|
32840
32820
|
prNumber,
|
|
@@ -33869,7 +33849,7 @@ function parseScreenshotSpecs(specs) {
|
|
|
33869
33849
|
}
|
|
33870
33850
|
|
|
33871
33851
|
// src/commands/prs/previewAndApplyEdit.ts
|
|
33872
|
-
import { randomUUID as
|
|
33852
|
+
import { randomUUID as randomUUID20 } from "crypto";
|
|
33873
33853
|
|
|
33874
33854
|
// src/commands/prs/stageScreenshots.ts
|
|
33875
33855
|
import { readFile as readFile8 } from "fs/promises";
|
|
@@ -33891,7 +33871,7 @@ function stageScreenshots(screenshots = []) {
|
|
|
33891
33871
|
async function previewAndApplyEdit(args) {
|
|
33892
33872
|
const decision = await awaitPreviewApproval("PR preview", {
|
|
33893
33873
|
sessionId: args.sessionId,
|
|
33894
|
-
requestId:
|
|
33874
|
+
requestId: randomUUID20(),
|
|
33895
33875
|
title: args.title ?? args.currentTitle,
|
|
33896
33876
|
body: args.body,
|
|
33897
33877
|
prNumber: args.number,
|
|
@@ -34226,7 +34206,7 @@ async function placePr(prNumber, title, body, options2, attachments = []) {
|
|
|
34226
34206
|
}
|
|
34227
34207
|
|
|
34228
34208
|
// src/commands/prs/previewAndPlace.ts
|
|
34229
|
-
import { randomUUID as
|
|
34209
|
+
import { randomUUID as randomUUID21 } from "crypto";
|
|
34230
34210
|
|
|
34231
34211
|
// src/commands/review/announcePr.ts
|
|
34232
34212
|
function announcePr(prNumber) {
|
|
@@ -34302,7 +34282,7 @@ function enableAutoMerge() {
|
|
|
34302
34282
|
async function previewAndPlace(args) {
|
|
34303
34283
|
const decision = await awaitPreviewApproval("PR preview", {
|
|
34304
34284
|
sessionId: args.sessionId,
|
|
34305
|
-
requestId:
|
|
34285
|
+
requestId: randomUUID21(),
|
|
34306
34286
|
title: args.title,
|
|
34307
34287
|
body: args.body,
|
|
34308
34288
|
prNumber: args.prNumber,
|
|
@@ -38829,10 +38809,10 @@ function registerRefactor(program) {
|
|
|
38829
38809
|
}
|
|
38830
38810
|
|
|
38831
38811
|
// src/commands/review/checkoutPrSession.ts
|
|
38832
|
-
import { randomUUID as
|
|
38812
|
+
import { randomUUID as randomUUID22 } from "crypto";
|
|
38833
38813
|
async function checkoutPrSession(number, prompt = "") {
|
|
38834
38814
|
await checkoutPr(number);
|
|
38835
|
-
const claudeSessionId =
|
|
38815
|
+
const claudeSessionId = randomUUID22();
|
|
38836
38816
|
emitActivity({ kind: "command", name: "review", claudeSessionId });
|
|
38837
38817
|
const { done: done2 } = spawnClaude(prompt, {
|
|
38838
38818
|
permissionMode: "auto",
|
|
@@ -39939,7 +39919,7 @@ function gatherHighLevelSubject(prNumber, force) {
|
|
|
39939
39919
|
}
|
|
39940
39920
|
|
|
39941
39921
|
// src/commands/review/highLevel/openHighLevelOverlay.ts
|
|
39942
|
-
import { randomUUID as
|
|
39922
|
+
import { randomUUID as randomUUID24 } from "crypto";
|
|
39943
39923
|
|
|
39944
39924
|
// src/commands/review/highLevel/highLevelProgress.ts
|
|
39945
39925
|
function toItem2(check2, decision) {
|
|
@@ -40198,7 +40178,7 @@ function splitQueuedComments(record) {
|
|
|
40198
40178
|
}
|
|
40199
40179
|
|
|
40200
40180
|
// src/commands/review/highLevel/previewHighLevelReview.ts
|
|
40201
|
-
import { randomUUID as
|
|
40181
|
+
import { randomUUID as randomUUID23 } from "crypto";
|
|
40202
40182
|
|
|
40203
40183
|
// src/commands/review/highLevel/formatHighLevelReviewPreview.ts
|
|
40204
40184
|
function formatHighLevelReviewPreview(lineLevel, body) {
|
|
@@ -40225,7 +40205,7 @@ async function previewHighLevelReview(sessionId, record, submission) {
|
|
|
40225
40205
|
"Review",
|
|
40226
40206
|
{
|
|
40227
40207
|
sessionId,
|
|
40228
|
-
requestId:
|
|
40208
|
+
requestId: randomUUID23(),
|
|
40229
40209
|
title: `${LABELS[submission.event]} ${record.repo}#${record.prNumber}`,
|
|
40230
40210
|
body: formatHighLevelReviewPreview(submission.comments, submission.body),
|
|
40231
40211
|
prNumber: record.prNumber,
|
|
@@ -40276,7 +40256,7 @@ async function openHighLevelOverlay(sessionId, subject) {
|
|
|
40276
40256
|
"High-level review",
|
|
40277
40257
|
{
|
|
40278
40258
|
sessionId,
|
|
40279
|
-
requestId:
|
|
40259
|
+
requestId: randomUUID24(),
|
|
40280
40260
|
title: `${subject.repo}#${subject.prNumber} \u2014 ${subject.title}`,
|
|
40281
40261
|
body: JSON.stringify(highLevelPreviewPayload(subject)),
|
|
40282
40262
|
prNumber: subject.prNumber,
|
|
@@ -43515,7 +43495,7 @@ function registerSeq(program) {
|
|
|
43515
43495
|
}
|
|
43516
43496
|
|
|
43517
43497
|
// src/commands/show.ts
|
|
43518
|
-
import { randomUUID as
|
|
43498
|
+
import { randomUUID as randomUUID25 } from "crypto";
|
|
43519
43499
|
|
|
43520
43500
|
// src/commands/sessions/shared/sendShowPreview.ts
|
|
43521
43501
|
async function sendShowPreview(request) {
|
|
@@ -43674,7 +43654,7 @@ async function show3(options2) {
|
|
|
43674
43654
|
try {
|
|
43675
43655
|
await sendShowPreview({
|
|
43676
43656
|
sessionId,
|
|
43677
|
-
requestId:
|
|
43657
|
+
requestId: randomUUID25(),
|
|
43678
43658
|
title: options2.title ?? "Show",
|
|
43679
43659
|
body
|
|
43680
43660
|
});
|
|
@@ -43760,7 +43740,7 @@ function readSlackParts(files) {
|
|
|
43760
43740
|
}
|
|
43761
43741
|
|
|
43762
43742
|
// src/commands/slack/reviewProposedSlackMessage.ts
|
|
43763
|
-
import { randomUUID as
|
|
43743
|
+
import { randomUUID as randomUUID26 } from "crypto";
|
|
43764
43744
|
async function reviewProposedSlackMessage(target, body, workingPath) {
|
|
43765
43745
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
43766
43746
|
if (process.env.ASSIST_SESSION !== "1" || !sessionId) return;
|
|
@@ -43770,7 +43750,7 @@ async function reviewProposedSlackMessage(target, body, workingPath) {
|
|
|
43770
43750
|
part ? `Slack message ${part.index} of ${part.total}` : "Slack message preview",
|
|
43771
43751
|
{
|
|
43772
43752
|
sessionId,
|
|
43773
|
-
requestId:
|
|
43753
|
+
requestId: randomUUID26(),
|
|
43774
43754
|
title: part ? `${destination} (${part.index}/${part.total})` : destination,
|
|
43775
43755
|
body,
|
|
43776
43756
|
prNumber: null,
|
|
@@ -48838,9 +48818,6 @@ var ClientHub = class extends Set {
|
|
|
48838
48818
|
isPeer(client) {
|
|
48839
48819
|
return this.peers.has(client);
|
|
48840
48820
|
}
|
|
48841
|
-
peerNode(client) {
|
|
48842
|
-
return this.peers.get(client);
|
|
48843
|
-
}
|
|
48844
48821
|
peerFor(node) {
|
|
48845
48822
|
let latest2;
|
|
48846
48823
|
for (const [client, name] of this.peers) if (name === node) latest2 = client;
|
|
@@ -48871,7 +48848,7 @@ var ClientHub = class extends Set {
|
|
|
48871
48848
|
};
|
|
48872
48849
|
|
|
48873
48850
|
// src/commands/sessions/daemon/createSession.ts
|
|
48874
|
-
import { randomUUID as
|
|
48851
|
+
import { randomUUID as randomUUID27 } from "crypto";
|
|
48875
48852
|
|
|
48876
48853
|
// src/commands/sessions/daemon/sessionBase.ts
|
|
48877
48854
|
function sessionBase(id, status2) {
|
|
@@ -49094,7 +49071,7 @@ function spawnRun(opts) {
|
|
|
49094
49071
|
function createSession(id, { prompt, cwd, design, auto, harness, holdPty } = {}) {
|
|
49095
49072
|
if (harness && harness !== "claude")
|
|
49096
49073
|
return createHarnessSession(id, harness, prompt, cwd, holdPty);
|
|
49097
|
-
const claudeSessionId =
|
|
49074
|
+
const claudeSessionId = randomUUID27();
|
|
49098
49075
|
return {
|
|
49099
49076
|
...sessionBase(id, prompt ? "running" : "waiting"),
|
|
49100
49077
|
name: `Session ${id}`,
|
|
@@ -52265,7 +52242,7 @@ function codexRespawnPlan(session) {
|
|
|
52265
52242
|
}
|
|
52266
52243
|
|
|
52267
52244
|
// src/commands/sessions/daemon/interactiveRespawnPlan.ts
|
|
52268
|
-
import { randomUUID as
|
|
52245
|
+
import { randomUUID as randomUUID28 } from "crypto";
|
|
52269
52246
|
|
|
52270
52247
|
// src/commands/sessions/daemon/hasTranscriptOnDisk.ts
|
|
52271
52248
|
function hasTranscriptOnDisk(session) {
|
|
@@ -52292,7 +52269,7 @@ function interactiveRespawnPlan(session, resumes) {
|
|
|
52292
52269
|
return null;
|
|
52293
52270
|
}
|
|
52294
52271
|
function freshClaudePlan(session, prompt, cwd) {
|
|
52295
|
-
const claudeSessionId =
|
|
52272
|
+
const claudeSessionId = randomUUID28();
|
|
52296
52273
|
return {
|
|
52297
52274
|
spawn: () => {
|
|
52298
52275
|
session.claudeSessionId = claudeSessionId;
|
|
@@ -53697,64 +53674,25 @@ async function collectHistory(linked) {
|
|
|
53697
53674
|
}
|
|
53698
53675
|
|
|
53699
53676
|
// src/commands/sessions/daemon/pins/PinRelay.ts
|
|
53700
|
-
var ORIGIN_TTL_MS = 30 * 60 * 1e3;
|
|
53701
53677
|
var PinRelay = class {
|
|
53702
|
-
constructor(now = Date.now) {
|
|
53703
|
-
this.now = now;
|
|
53704
|
-
}
|
|
53705
|
-
origins = /* @__PURE__ */ new Map();
|
|
53706
53678
|
deliveries = /* @__PURE__ */ new Map();
|
|
53707
|
-
confirms = /* @__PURE__ */ new Map();
|
|
53708
|
-
rememberOrigin(area, pin2, node) {
|
|
53709
|
-
this.origins.set(`${area}:${pin2}`, { node, at: this.now() });
|
|
53710
|
-
}
|
|
53711
|
-
takeOrigin(area, pin2) {
|
|
53712
|
-
const key = `${area}:${pin2}`;
|
|
53713
|
-
const origin = this.origins.get(key);
|
|
53714
|
-
this.origins.delete(key);
|
|
53715
|
-
if (!origin || this.now() - origin.at > ORIGIN_TTL_MS) return void 0;
|
|
53716
|
-
return origin.node;
|
|
53717
|
-
}
|
|
53718
53679
|
awaitDelivery(requestId, timeoutMs, settle) {
|
|
53719
|
-
|
|
53720
|
-
|
|
53721
|
-
|
|
53722
|
-
settleWaiter(this.deliveries, requestId, delivered);
|
|
53723
|
-
}
|
|
53724
|
-
awaitConfirm(requestId, client, timeoutMs, node) {
|
|
53725
|
-
addWaiter(
|
|
53726
|
-
this.confirms,
|
|
53727
|
-
requestId,
|
|
53728
|
-
timeoutMs,
|
|
53729
|
-
{ ok: false, message: `${node} did not answer the confirmation.` },
|
|
53730
|
-
(result) => sendTo(client, {
|
|
53731
|
-
type: "confirm-pin-result",
|
|
53732
|
-
requestId,
|
|
53733
|
-
found: true,
|
|
53734
|
-
...result
|
|
53735
|
-
})
|
|
53680
|
+
const timer = setTimeout(
|
|
53681
|
+
() => this.settleDelivery(requestId, false),
|
|
53682
|
+
timeoutMs
|
|
53736
53683
|
);
|
|
53684
|
+
timer.unref?.();
|
|
53685
|
+
this.deliveries.set(requestId, { settle, timer });
|
|
53737
53686
|
}
|
|
53738
|
-
|
|
53739
|
-
|
|
53687
|
+
settleDelivery(requestId, delivered) {
|
|
53688
|
+
if (typeof requestId !== "string") return;
|
|
53689
|
+
const waiter = this.deliveries.get(requestId);
|
|
53690
|
+
if (!waiter) return;
|
|
53691
|
+
this.deliveries.delete(requestId);
|
|
53692
|
+
clearTimeout(waiter.timer);
|
|
53693
|
+
waiter.settle(delivered);
|
|
53740
53694
|
}
|
|
53741
53695
|
};
|
|
53742
|
-
function addWaiter(waiters, requestId, timeoutMs, onTimeout, settle) {
|
|
53743
|
-
const timer = setTimeout(
|
|
53744
|
-
() => settleWaiter(waiters, requestId, onTimeout),
|
|
53745
|
-
timeoutMs
|
|
53746
|
-
);
|
|
53747
|
-
timer.unref?.();
|
|
53748
|
-
waiters.set(requestId, { settle, timer });
|
|
53749
|
-
}
|
|
53750
|
-
function settleWaiter(waiters, requestId, value) {
|
|
53751
|
-
if (typeof requestId !== "string") return;
|
|
53752
|
-
const waiter = waiters.get(requestId);
|
|
53753
|
-
if (!waiter) return;
|
|
53754
|
-
waiters.delete(requestId);
|
|
53755
|
-
clearTimeout(waiter.timer);
|
|
53756
|
-
waiter.settle(value);
|
|
53757
|
-
}
|
|
53758
53696
|
|
|
53759
53697
|
// src/commands/sessions/daemon/links/guardLinkCallback.ts
|
|
53760
53698
|
function guardLinkCallback(label, callback) {
|
|
@@ -54168,10 +54106,9 @@ function tryShow(title, message3) {
|
|
|
54168
54106
|
}
|
|
54169
54107
|
function showRelayedPin(ctx, msg) {
|
|
54170
54108
|
const node = ctx.spec.name;
|
|
54171
|
-
const { area
|
|
54172
|
-
const valid = typeof area === "string"
|
|
54109
|
+
const { area } = msg;
|
|
54110
|
+
const valid = typeof area === "string";
|
|
54173
54111
|
const delivered = valid && tryShow(msg.title, msg.message);
|
|
54174
|
-
if (delivered) ctx.deps.pins.rememberOrigin(area, pin2, node);
|
|
54175
54112
|
daemonLog(
|
|
54176
54113
|
`link ${node} ws: ${valid ? area : "malformed"} PIN notification for a session on ${node} ${delivered ? "shown" : "not shown"}`
|
|
54177
54114
|
);
|
|
@@ -54265,19 +54202,8 @@ function onLinkLine(ctx, line) {
|
|
|
54265
54202
|
if (msg.type === "hello") return onHello(ctx, msg);
|
|
54266
54203
|
if (!ctx.greeted) return;
|
|
54267
54204
|
if (msg.type === "notify-pin") return showRelayedPin(ctx, msg);
|
|
54268
|
-
if (msg.type === "confirm-pin-result") return settleRelayedConfirm(ctx, msg);
|
|
54269
54205
|
relayLinkMessage(ctx.relay, msg);
|
|
54270
54206
|
}
|
|
54271
|
-
function settleRelayedConfirm(ctx, msg) {
|
|
54272
|
-
const ok = msg.ok === true;
|
|
54273
|
-
daemonLog(
|
|
54274
|
-
`link ${ctx.spec.name} ws: PIN confirmation ${ok ? "approved" : "rejected"} by ${ctx.spec.name}`
|
|
54275
|
-
);
|
|
54276
|
-
ctx.deps.pins.settleConfirm(msg.requestId, {
|
|
54277
|
-
ok,
|
|
54278
|
-
message: typeof msg.message === "string" ? msg.message : ""
|
|
54279
|
-
});
|
|
54280
|
-
}
|
|
54281
54207
|
|
|
54282
54208
|
// src/commands/sessions/daemon/links/openLink.ts
|
|
54283
54209
|
function onLinkClose(ctx, socket, reason4) {
|
|
@@ -55557,60 +55483,6 @@ var lifecycleHandlers = {
|
|
|
55557
55483
|
shutdown: handleShutdown
|
|
55558
55484
|
};
|
|
55559
55485
|
|
|
55560
|
-
// src/commands/sessions/daemon/pins/pinConfirmers.ts
|
|
55561
|
-
var pinConfirmers = {
|
|
55562
|
-
docs: approveDocsUnlock
|
|
55563
|
-
};
|
|
55564
|
-
|
|
55565
|
-
// src/commands/sessions/daemon/pins/confirmPinLocally.ts
|
|
55566
|
-
async function confirmPinLocally(area, pin2) {
|
|
55567
|
-
const confirm = pinConfirmers[area];
|
|
55568
|
-
if (!confirm)
|
|
55569
|
-
return { ok: false, message: `Unknown confirmation area ${area}.` };
|
|
55570
|
-
try {
|
|
55571
|
-
return await confirm(pin2) ?? {
|
|
55572
|
-
ok: false,
|
|
55573
|
-
message: `No pending ${area} confirmation for that pin.`
|
|
55574
|
-
};
|
|
55575
|
-
} catch (error) {
|
|
55576
|
-
return {
|
|
55577
|
-
ok: false,
|
|
55578
|
-
message: error instanceof Error ? error.message : String(error)
|
|
55579
|
-
};
|
|
55580
|
-
}
|
|
55581
|
-
}
|
|
55582
|
-
|
|
55583
|
-
// src/commands/sessions/daemon/pins/handleConfirmPin.ts
|
|
55584
|
-
var CONFIRM_TIMEOUT_MS2 = 1e4;
|
|
55585
|
-
var handlePeerConfirm = (client, m, d) => {
|
|
55586
|
-
const area = String(d.area);
|
|
55587
|
-
const from = m.clients.peerNode(client) ?? "unknown node";
|
|
55588
|
-
void confirmPinLocally(area, String(d.pin)).then((result) => {
|
|
55589
|
-
daemonLog(
|
|
55590
|
-
`confirm-pin: ${area} confirmation relayed from ${from} ${result.ok ? "approved" : "rejected"}`
|
|
55591
|
-
);
|
|
55592
|
-
sendTo(client, {
|
|
55593
|
-
type: "confirm-pin-result",
|
|
55594
|
-
requestId: d.requestId,
|
|
55595
|
-
...result
|
|
55596
|
-
});
|
|
55597
|
-
});
|
|
55598
|
-
};
|
|
55599
|
-
var handleConfirmPin = (client, m, d) => {
|
|
55600
|
-
if (m.clients.isPeer(client)) return handlePeerConfirm(client, m, d);
|
|
55601
|
-
const area = String(d.area);
|
|
55602
|
-
const requestId = String(d.requestId);
|
|
55603
|
-
const node = m.links.pins.takeOrigin(area, String(d.pin));
|
|
55604
|
-
if (!node) {
|
|
55605
|
-
daemonLog(`confirm-pin: no relayed ${area} PIN matches; nothing forwarded`);
|
|
55606
|
-
sendTo(client, { type: "confirm-pin-result", requestId, found: false });
|
|
55607
|
-
return;
|
|
55608
|
-
}
|
|
55609
|
-
daemonLog(`confirm-pin: forwarding ${area} confirmation to ${node}`);
|
|
55610
|
-
m.links.pins.awaitConfirm(requestId, client, CONFIRM_TIMEOUT_MS2, node);
|
|
55611
|
-
m.links.route(client, { ...d, node });
|
|
55612
|
-
};
|
|
55613
|
-
|
|
55614
55486
|
// src/commands/sessions/daemon/pins/pinNotificationTarget.ts
|
|
55615
55487
|
function pinNotificationTarget(viewerNode, localNode, peerFor) {
|
|
55616
55488
|
if (!viewerNode) return { kind: "local", reason: "has no active viewer" };
|
|
@@ -55668,8 +55540,7 @@ var handleNotifyPin = (client, m, d) => {
|
|
|
55668
55540
|
// src/commands/sessions/daemon/pins/pinHandlers.ts
|
|
55669
55541
|
var pinHandlers = {
|
|
55670
55542
|
"notify-pin": handleNotifyPin,
|
|
55671
|
-
"notify-pin-result": (_client, m, d) => m.links.pins.settleDelivery(d.requestId, d.delivered === true)
|
|
55672
|
-
"confirm-pin": handleConfirmPin
|
|
55543
|
+
"notify-pin-result": (_client, m, d) => m.links.pins.settleDelivery(d.requestId, d.delivered === true)
|
|
55673
55544
|
};
|
|
55674
55545
|
|
|
55675
55546
|
// src/commands/sessions/daemon/handleSnapshotRequest.ts
|