@staff0rd/assist 0.1021.1 → 0.1021.2
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 +73 -206
- 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.1021.
|
|
9
|
+
version: "0.1021.2",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -26013,24 +26013,8 @@ function registerDevlog(program) {
|
|
|
26013
26013
|
}
|
|
26014
26014
|
|
|
26015
26015
|
// 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
26016
|
import { unlinkSync as unlinkSync10 } from "fs";
|
|
26017
|
+
import chalk166 from "chalk";
|
|
26034
26018
|
|
|
26035
26019
|
// src/commands/docs/getDocsUnlockPinPath.ts
|
|
26036
26020
|
import { join as join71 } from "path";
|
|
@@ -26071,45 +26055,37 @@ async function recordDocsUnlock(orm, itemId2, phase) {
|
|
|
26071
26055
|
});
|
|
26072
26056
|
}
|
|
26073
26057
|
|
|
26074
|
-
// src/commands/docs/
|
|
26075
|
-
async function
|
|
26058
|
+
// src/commands/docs/docsConfirm.ts
|
|
26059
|
+
async function docsConfirm(pin2) {
|
|
26076
26060
|
sweepRestrictedDir();
|
|
26077
26061
|
const state = readDocsUnlockPinState(pin2);
|
|
26078
|
-
if (!state)
|
|
26062
|
+
if (!state) {
|
|
26063
|
+
console.error(chalk166.red(`No pending docs unlock for pin: ${pin2}`));
|
|
26064
|
+
process.exitCode = 1;
|
|
26065
|
+
return;
|
|
26066
|
+
}
|
|
26079
26067
|
unlinkSync10(getDocsUnlockPinPath(pin2));
|
|
26080
26068
|
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}`));
|
|
26069
|
+
if (!found) {
|
|
26104
26070
|
process.exitCode = 1;
|
|
26105
26071
|
return;
|
|
26106
26072
|
}
|
|
26107
|
-
|
|
26108
|
-
|
|
26073
|
+
const label = `${formatItemId(state.itemId)} ${found.item.name}`;
|
|
26074
|
+
if ((found.item.currentPhase ?? 1) !== state.phase) {
|
|
26075
|
+
console.error(
|
|
26076
|
+
chalk166.red(
|
|
26077
|
+
`${label} has moved on from phase ${state.phase} since the unlock was requested. Nothing was approved; request a new unlock from the current phase.`
|
|
26078
|
+
)
|
|
26079
|
+
);
|
|
26080
|
+
process.exitCode = 1;
|
|
26109
26081
|
return;
|
|
26110
26082
|
}
|
|
26111
|
-
|
|
26112
|
-
|
|
26083
|
+
await recordDocsUnlock(found.orm, state.itemId, state.phase);
|
|
26084
|
+
console.log(
|
|
26085
|
+
chalk166.green(
|
|
26086
|
+
`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.`
|
|
26087
|
+
)
|
|
26088
|
+
);
|
|
26113
26089
|
}
|
|
26114
26090
|
|
|
26115
26091
|
// src/commands/docs/docsUnlock.ts
|
|
@@ -26118,12 +26094,12 @@ import { mkdirSync as mkdirSync21, unlinkSync as unlinkSync11, writeFileSync as
|
|
|
26118
26094
|
import chalk167 from "chalk";
|
|
26119
26095
|
|
|
26120
26096
|
// src/commands/notify/deliverPinNotification.ts
|
|
26121
|
-
import { randomUUID as
|
|
26097
|
+
import { randomUUID as randomUUID12 } from "crypto";
|
|
26122
26098
|
var ROUTE_TIMEOUT_MS = 1e4;
|
|
26123
26099
|
async function relayToViewerNode(notification) {
|
|
26124
26100
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
26125
26101
|
if (!sessionId) return void 0;
|
|
26126
|
-
const requestId =
|
|
26102
|
+
const requestId = randomUUID12();
|
|
26127
26103
|
const reply2 = await requestDaemonReply(
|
|
26128
26104
|
{ type: "notify-pin", sessionId, requestId, ...notification },
|
|
26129
26105
|
"notify-pin-result",
|
|
@@ -28344,13 +28320,13 @@ function validateProposedContent(labels, title, body) {
|
|
|
28344
28320
|
}
|
|
28345
28321
|
|
|
28346
28322
|
// src/commands/github/issue/reviewProposedIssueComment.ts
|
|
28347
|
-
import { randomUUID as
|
|
28323
|
+
import { randomUUID as randomUUID13 } from "crypto";
|
|
28348
28324
|
async function reviewProposedIssueComment(title, body) {
|
|
28349
28325
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
28350
28326
|
if (process.env.ASSIST_SESSION !== "1" || !sessionId) return;
|
|
28351
28327
|
await awaitPreviewApproval("GitHub issue comment preview", {
|
|
28352
28328
|
sessionId,
|
|
28353
|
-
requestId:
|
|
28329
|
+
requestId: randomUUID13(),
|
|
28354
28330
|
title,
|
|
28355
28331
|
body,
|
|
28356
28332
|
prNumber: null,
|
|
@@ -28868,13 +28844,13 @@ function resolveCreateIssueMetadata(options2) {
|
|
|
28868
28844
|
}
|
|
28869
28845
|
|
|
28870
28846
|
// src/commands/github/issue/reviewProposedIssue.ts
|
|
28871
|
-
import { randomUUID as
|
|
28847
|
+
import { randomUUID as randomUUID14 } from "crypto";
|
|
28872
28848
|
async function reviewProposedIssue(title, body, metadata2 = []) {
|
|
28873
28849
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
28874
28850
|
if (process.env.ASSIST_SESSION !== "1" || !sessionId) return void 0;
|
|
28875
28851
|
return await awaitPreviewApproval("GitHub issue preview", {
|
|
28876
28852
|
sessionId,
|
|
28877
|
-
requestId:
|
|
28853
|
+
requestId: randomUUID14(),
|
|
28878
28854
|
title,
|
|
28879
28855
|
body,
|
|
28880
28856
|
prNumber: null,
|
|
@@ -29174,7 +29150,7 @@ function pushUnchangedIssue(number, repo, target, fetchedAt, bodyPath) {
|
|
|
29174
29150
|
}
|
|
29175
29151
|
|
|
29176
29152
|
// src/commands/github/issue/reviewProposedIssueEdit.ts
|
|
29177
|
-
import { randomUUID as
|
|
29153
|
+
import { randomUUID as randomUUID15 } from "crypto";
|
|
29178
29154
|
async function reviewProposedIssueEdit(title, body, working) {
|
|
29179
29155
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
29180
29156
|
if (process.env.ASSIST_SESSION !== "1" || !sessionId) return body;
|
|
@@ -29182,7 +29158,7 @@ async function reviewProposedIssueEdit(title, body, working) {
|
|
|
29182
29158
|
"GitHub issue edit preview",
|
|
29183
29159
|
{
|
|
29184
29160
|
sessionId,
|
|
29185
|
-
requestId:
|
|
29161
|
+
requestId: randomUUID15(),
|
|
29186
29162
|
title,
|
|
29187
29163
|
body,
|
|
29188
29164
|
prNumber: null,
|
|
@@ -30195,7 +30171,7 @@ function registerRefineLaunch(program, resumeFlag) {
|
|
|
30195
30171
|
}
|
|
30196
30172
|
|
|
30197
30173
|
// src/commands/fixConflict.ts
|
|
30198
|
-
import { randomUUID as
|
|
30174
|
+
import { randomUUID as randomUUID16 } from "crypto";
|
|
30199
30175
|
|
|
30200
30176
|
// src/commands/review/checkoutPr.ts
|
|
30201
30177
|
import { execFileSync as execFileSync16 } from "child_process";
|
|
@@ -30980,7 +30956,7 @@ function buildPrompt2(rebase) {
|
|
|
30980
30956
|
async function fixConflict(number, options2 = {}) {
|
|
30981
30957
|
const { resumeSessionId } = options2;
|
|
30982
30958
|
if (number && !resumeSessionId) await checkoutPr(number);
|
|
30983
|
-
const claudeSessionId = resumeSessionId ??
|
|
30959
|
+
const claudeSessionId = resumeSessionId ?? randomUUID16();
|
|
30984
30960
|
emitActivity({
|
|
30985
30961
|
kind: "command",
|
|
30986
30962
|
name: "fix-conflict",
|
|
@@ -31008,7 +30984,7 @@ function registerFixConflict(program, resumeFlag) {
|
|
|
31008
30984
|
}
|
|
31009
30985
|
|
|
31010
30986
|
// src/commands/reviewPrComments.ts
|
|
31011
|
-
import { randomUUID as
|
|
30987
|
+
import { randomUUID as randomUUID17 } from "crypto";
|
|
31012
30988
|
function buildPrompt3(number, announce, options2) {
|
|
31013
30989
|
const args = [
|
|
31014
30990
|
"/review-pr-comments",
|
|
@@ -31034,7 +31010,7 @@ async function reviewPrComments(number, options2 = {}) {
|
|
|
31034
31010
|
validateAnnounce(number, announce);
|
|
31035
31011
|
validateMode(options2);
|
|
31036
31012
|
if (number && !resumeSessionId) await checkoutPr(number);
|
|
31037
|
-
const claudeSessionId = resumeSessionId ??
|
|
31013
|
+
const claudeSessionId = resumeSessionId ?? randomUUID17();
|
|
31038
31014
|
emitActivity({
|
|
31039
31015
|
kind: "command",
|
|
31040
31016
|
name: "review-pr-comments",
|
|
@@ -31576,7 +31552,7 @@ async function offerSaveExtract(extract2, options2, paths = {}) {
|
|
|
31576
31552
|
}
|
|
31577
31553
|
|
|
31578
31554
|
// src/commands/miro/pickAnchors.ts
|
|
31579
|
-
import { randomUUID as
|
|
31555
|
+
import { randomUUID as randomUUID18 } from "crypto";
|
|
31580
31556
|
|
|
31581
31557
|
// src/commands/miro/isBox.ts
|
|
31582
31558
|
var boxTypes = /* @__PURE__ */ new Set(["shape", "sticky_note"]);
|
|
@@ -31597,7 +31573,7 @@ async function pickAnchors(sessionId, items2) {
|
|
|
31597
31573
|
"Miro anchor selection",
|
|
31598
31574
|
{
|
|
31599
31575
|
sessionId,
|
|
31600
|
-
requestId:
|
|
31576
|
+
requestId: randomUUID18(),
|
|
31601
31577
|
title: "Pick the top-left then the bottom-right box",
|
|
31602
31578
|
body: encodeMiroBoardPreview(items2),
|
|
31603
31579
|
prNumber: null,
|
|
@@ -32828,13 +32804,13 @@ function postReviewComment(vars) {
|
|
|
32828
32804
|
}
|
|
32829
32805
|
|
|
32830
32806
|
// src/commands/prs/reviewProposedPrComment.ts
|
|
32831
|
-
import { randomUUID as
|
|
32807
|
+
import { randomUUID as randomUUID19 } from "crypto";
|
|
32832
32808
|
async function reviewProposedPrComment(title, body, prNumber) {
|
|
32833
32809
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
32834
32810
|
if (process.env.ASSIST_SESSION !== "1" || !sessionId) return;
|
|
32835
32811
|
await awaitPreviewApproval("PR comment preview", {
|
|
32836
32812
|
sessionId,
|
|
32837
|
-
requestId:
|
|
32813
|
+
requestId: randomUUID19(),
|
|
32838
32814
|
title,
|
|
32839
32815
|
body,
|
|
32840
32816
|
prNumber,
|
|
@@ -33869,7 +33845,7 @@ function parseScreenshotSpecs(specs) {
|
|
|
33869
33845
|
}
|
|
33870
33846
|
|
|
33871
33847
|
// src/commands/prs/previewAndApplyEdit.ts
|
|
33872
|
-
import { randomUUID as
|
|
33848
|
+
import { randomUUID as randomUUID20 } from "crypto";
|
|
33873
33849
|
|
|
33874
33850
|
// src/commands/prs/stageScreenshots.ts
|
|
33875
33851
|
import { readFile as readFile8 } from "fs/promises";
|
|
@@ -33891,7 +33867,7 @@ function stageScreenshots(screenshots = []) {
|
|
|
33891
33867
|
async function previewAndApplyEdit(args) {
|
|
33892
33868
|
const decision = await awaitPreviewApproval("PR preview", {
|
|
33893
33869
|
sessionId: args.sessionId,
|
|
33894
|
-
requestId:
|
|
33870
|
+
requestId: randomUUID20(),
|
|
33895
33871
|
title: args.title ?? args.currentTitle,
|
|
33896
33872
|
body: args.body,
|
|
33897
33873
|
prNumber: args.number,
|
|
@@ -34226,7 +34202,7 @@ async function placePr(prNumber, title, body, options2, attachments = []) {
|
|
|
34226
34202
|
}
|
|
34227
34203
|
|
|
34228
34204
|
// src/commands/prs/previewAndPlace.ts
|
|
34229
|
-
import { randomUUID as
|
|
34205
|
+
import { randomUUID as randomUUID21 } from "crypto";
|
|
34230
34206
|
|
|
34231
34207
|
// src/commands/review/announcePr.ts
|
|
34232
34208
|
function announcePr(prNumber) {
|
|
@@ -34302,7 +34278,7 @@ function enableAutoMerge() {
|
|
|
34302
34278
|
async function previewAndPlace(args) {
|
|
34303
34279
|
const decision = await awaitPreviewApproval("PR preview", {
|
|
34304
34280
|
sessionId: args.sessionId,
|
|
34305
|
-
requestId:
|
|
34281
|
+
requestId: randomUUID21(),
|
|
34306
34282
|
title: args.title,
|
|
34307
34283
|
body: args.body,
|
|
34308
34284
|
prNumber: args.prNumber,
|
|
@@ -38829,10 +38805,10 @@ function registerRefactor(program) {
|
|
|
38829
38805
|
}
|
|
38830
38806
|
|
|
38831
38807
|
// src/commands/review/checkoutPrSession.ts
|
|
38832
|
-
import { randomUUID as
|
|
38808
|
+
import { randomUUID as randomUUID22 } from "crypto";
|
|
38833
38809
|
async function checkoutPrSession(number, prompt = "") {
|
|
38834
38810
|
await checkoutPr(number);
|
|
38835
|
-
const claudeSessionId =
|
|
38811
|
+
const claudeSessionId = randomUUID22();
|
|
38836
38812
|
emitActivity({ kind: "command", name: "review", claudeSessionId });
|
|
38837
38813
|
const { done: done2 } = spawnClaude(prompt, {
|
|
38838
38814
|
permissionMode: "auto",
|
|
@@ -39939,7 +39915,7 @@ function gatherHighLevelSubject(prNumber, force) {
|
|
|
39939
39915
|
}
|
|
39940
39916
|
|
|
39941
39917
|
// src/commands/review/highLevel/openHighLevelOverlay.ts
|
|
39942
|
-
import { randomUUID as
|
|
39918
|
+
import { randomUUID as randomUUID24 } from "crypto";
|
|
39943
39919
|
|
|
39944
39920
|
// src/commands/review/highLevel/highLevelProgress.ts
|
|
39945
39921
|
function toItem2(check2, decision) {
|
|
@@ -40198,7 +40174,7 @@ function splitQueuedComments(record) {
|
|
|
40198
40174
|
}
|
|
40199
40175
|
|
|
40200
40176
|
// src/commands/review/highLevel/previewHighLevelReview.ts
|
|
40201
|
-
import { randomUUID as
|
|
40177
|
+
import { randomUUID as randomUUID23 } from "crypto";
|
|
40202
40178
|
|
|
40203
40179
|
// src/commands/review/highLevel/formatHighLevelReviewPreview.ts
|
|
40204
40180
|
function formatHighLevelReviewPreview(lineLevel, body) {
|
|
@@ -40225,7 +40201,7 @@ async function previewHighLevelReview(sessionId, record, submission) {
|
|
|
40225
40201
|
"Review",
|
|
40226
40202
|
{
|
|
40227
40203
|
sessionId,
|
|
40228
|
-
requestId:
|
|
40204
|
+
requestId: randomUUID23(),
|
|
40229
40205
|
title: `${LABELS[submission.event]} ${record.repo}#${record.prNumber}`,
|
|
40230
40206
|
body: formatHighLevelReviewPreview(submission.comments, submission.body),
|
|
40231
40207
|
prNumber: record.prNumber,
|
|
@@ -40276,7 +40252,7 @@ async function openHighLevelOverlay(sessionId, subject) {
|
|
|
40276
40252
|
"High-level review",
|
|
40277
40253
|
{
|
|
40278
40254
|
sessionId,
|
|
40279
|
-
requestId:
|
|
40255
|
+
requestId: randomUUID24(),
|
|
40280
40256
|
title: `${subject.repo}#${subject.prNumber} \u2014 ${subject.title}`,
|
|
40281
40257
|
body: JSON.stringify(highLevelPreviewPayload(subject)),
|
|
40282
40258
|
prNumber: subject.prNumber,
|
|
@@ -43515,7 +43491,7 @@ function registerSeq(program) {
|
|
|
43515
43491
|
}
|
|
43516
43492
|
|
|
43517
43493
|
// src/commands/show.ts
|
|
43518
|
-
import { randomUUID as
|
|
43494
|
+
import { randomUUID as randomUUID25 } from "crypto";
|
|
43519
43495
|
|
|
43520
43496
|
// src/commands/sessions/shared/sendShowPreview.ts
|
|
43521
43497
|
async function sendShowPreview(request) {
|
|
@@ -43674,7 +43650,7 @@ async function show3(options2) {
|
|
|
43674
43650
|
try {
|
|
43675
43651
|
await sendShowPreview({
|
|
43676
43652
|
sessionId,
|
|
43677
|
-
requestId:
|
|
43653
|
+
requestId: randomUUID25(),
|
|
43678
43654
|
title: options2.title ?? "Show",
|
|
43679
43655
|
body
|
|
43680
43656
|
});
|
|
@@ -43760,7 +43736,7 @@ function readSlackParts(files) {
|
|
|
43760
43736
|
}
|
|
43761
43737
|
|
|
43762
43738
|
// src/commands/slack/reviewProposedSlackMessage.ts
|
|
43763
|
-
import { randomUUID as
|
|
43739
|
+
import { randomUUID as randomUUID26 } from "crypto";
|
|
43764
43740
|
async function reviewProposedSlackMessage(target, body, workingPath) {
|
|
43765
43741
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
43766
43742
|
if (process.env.ASSIST_SESSION !== "1" || !sessionId) return;
|
|
@@ -43770,7 +43746,7 @@ async function reviewProposedSlackMessage(target, body, workingPath) {
|
|
|
43770
43746
|
part ? `Slack message ${part.index} of ${part.total}` : "Slack message preview",
|
|
43771
43747
|
{
|
|
43772
43748
|
sessionId,
|
|
43773
|
-
requestId:
|
|
43749
|
+
requestId: randomUUID26(),
|
|
43774
43750
|
title: part ? `${destination} (${part.index}/${part.total})` : destination,
|
|
43775
43751
|
body,
|
|
43776
43752
|
prNumber: null,
|
|
@@ -48838,9 +48814,6 @@ var ClientHub = class extends Set {
|
|
|
48838
48814
|
isPeer(client) {
|
|
48839
48815
|
return this.peers.has(client);
|
|
48840
48816
|
}
|
|
48841
|
-
peerNode(client) {
|
|
48842
|
-
return this.peers.get(client);
|
|
48843
|
-
}
|
|
48844
48817
|
peerFor(node) {
|
|
48845
48818
|
let latest2;
|
|
48846
48819
|
for (const [client, name] of this.peers) if (name === node) latest2 = client;
|
|
@@ -48871,7 +48844,7 @@ var ClientHub = class extends Set {
|
|
|
48871
48844
|
};
|
|
48872
48845
|
|
|
48873
48846
|
// src/commands/sessions/daemon/createSession.ts
|
|
48874
|
-
import { randomUUID as
|
|
48847
|
+
import { randomUUID as randomUUID27 } from "crypto";
|
|
48875
48848
|
|
|
48876
48849
|
// src/commands/sessions/daemon/sessionBase.ts
|
|
48877
48850
|
function sessionBase(id, status2) {
|
|
@@ -49094,7 +49067,7 @@ function spawnRun(opts) {
|
|
|
49094
49067
|
function createSession(id, { prompt, cwd, design, auto, harness, holdPty } = {}) {
|
|
49095
49068
|
if (harness && harness !== "claude")
|
|
49096
49069
|
return createHarnessSession(id, harness, prompt, cwd, holdPty);
|
|
49097
|
-
const claudeSessionId =
|
|
49070
|
+
const claudeSessionId = randomUUID27();
|
|
49098
49071
|
return {
|
|
49099
49072
|
...sessionBase(id, prompt ? "running" : "waiting"),
|
|
49100
49073
|
name: `Session ${id}`,
|
|
@@ -52265,7 +52238,7 @@ function codexRespawnPlan(session) {
|
|
|
52265
52238
|
}
|
|
52266
52239
|
|
|
52267
52240
|
// src/commands/sessions/daemon/interactiveRespawnPlan.ts
|
|
52268
|
-
import { randomUUID as
|
|
52241
|
+
import { randomUUID as randomUUID28 } from "crypto";
|
|
52269
52242
|
|
|
52270
52243
|
// src/commands/sessions/daemon/hasTranscriptOnDisk.ts
|
|
52271
52244
|
function hasTranscriptOnDisk(session) {
|
|
@@ -52292,7 +52265,7 @@ function interactiveRespawnPlan(session, resumes) {
|
|
|
52292
52265
|
return null;
|
|
52293
52266
|
}
|
|
52294
52267
|
function freshClaudePlan(session, prompt, cwd) {
|
|
52295
|
-
const claudeSessionId =
|
|
52268
|
+
const claudeSessionId = randomUUID28();
|
|
52296
52269
|
return {
|
|
52297
52270
|
spawn: () => {
|
|
52298
52271
|
session.claudeSessionId = claudeSessionId;
|
|
@@ -53697,64 +53670,25 @@ async function collectHistory(linked) {
|
|
|
53697
53670
|
}
|
|
53698
53671
|
|
|
53699
53672
|
// src/commands/sessions/daemon/pins/PinRelay.ts
|
|
53700
|
-
var ORIGIN_TTL_MS = 30 * 60 * 1e3;
|
|
53701
53673
|
var PinRelay = class {
|
|
53702
|
-
constructor(now = Date.now) {
|
|
53703
|
-
this.now = now;
|
|
53704
|
-
}
|
|
53705
|
-
origins = /* @__PURE__ */ new Map();
|
|
53706
53674
|
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
53675
|
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
|
-
})
|
|
53676
|
+
const timer = setTimeout(
|
|
53677
|
+
() => this.settleDelivery(requestId, false),
|
|
53678
|
+
timeoutMs
|
|
53736
53679
|
);
|
|
53680
|
+
timer.unref?.();
|
|
53681
|
+
this.deliveries.set(requestId, { settle, timer });
|
|
53737
53682
|
}
|
|
53738
|
-
|
|
53739
|
-
|
|
53683
|
+
settleDelivery(requestId, delivered) {
|
|
53684
|
+
if (typeof requestId !== "string") return;
|
|
53685
|
+
const waiter = this.deliveries.get(requestId);
|
|
53686
|
+
if (!waiter) return;
|
|
53687
|
+
this.deliveries.delete(requestId);
|
|
53688
|
+
clearTimeout(waiter.timer);
|
|
53689
|
+
waiter.settle(delivered);
|
|
53740
53690
|
}
|
|
53741
53691
|
};
|
|
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
53692
|
|
|
53759
53693
|
// src/commands/sessions/daemon/links/guardLinkCallback.ts
|
|
53760
53694
|
function guardLinkCallback(label, callback) {
|
|
@@ -54168,10 +54102,9 @@ function tryShow(title, message3) {
|
|
|
54168
54102
|
}
|
|
54169
54103
|
function showRelayedPin(ctx, msg) {
|
|
54170
54104
|
const node = ctx.spec.name;
|
|
54171
|
-
const { area
|
|
54172
|
-
const valid = typeof area === "string"
|
|
54105
|
+
const { area } = msg;
|
|
54106
|
+
const valid = typeof area === "string";
|
|
54173
54107
|
const delivered = valid && tryShow(msg.title, msg.message);
|
|
54174
|
-
if (delivered) ctx.deps.pins.rememberOrigin(area, pin2, node);
|
|
54175
54108
|
daemonLog(
|
|
54176
54109
|
`link ${node} ws: ${valid ? area : "malformed"} PIN notification for a session on ${node} ${delivered ? "shown" : "not shown"}`
|
|
54177
54110
|
);
|
|
@@ -54265,19 +54198,8 @@ function onLinkLine(ctx, line) {
|
|
|
54265
54198
|
if (msg.type === "hello") return onHello(ctx, msg);
|
|
54266
54199
|
if (!ctx.greeted) return;
|
|
54267
54200
|
if (msg.type === "notify-pin") return showRelayedPin(ctx, msg);
|
|
54268
|
-
if (msg.type === "confirm-pin-result") return settleRelayedConfirm(ctx, msg);
|
|
54269
54201
|
relayLinkMessage(ctx.relay, msg);
|
|
54270
54202
|
}
|
|
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
54203
|
|
|
54282
54204
|
// src/commands/sessions/daemon/links/openLink.ts
|
|
54283
54205
|
function onLinkClose(ctx, socket, reason4) {
|
|
@@ -55557,60 +55479,6 @@ var lifecycleHandlers = {
|
|
|
55557
55479
|
shutdown: handleShutdown
|
|
55558
55480
|
};
|
|
55559
55481
|
|
|
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
55482
|
// src/commands/sessions/daemon/pins/pinNotificationTarget.ts
|
|
55615
55483
|
function pinNotificationTarget(viewerNode, localNode, peerFor) {
|
|
55616
55484
|
if (!viewerNode) return { kind: "local", reason: "has no active viewer" };
|
|
@@ -55668,8 +55536,7 @@ var handleNotifyPin = (client, m, d) => {
|
|
|
55668
55536
|
// src/commands/sessions/daemon/pins/pinHandlers.ts
|
|
55669
55537
|
var pinHandlers = {
|
|
55670
55538
|
"notify-pin": handleNotifyPin,
|
|
55671
|
-
"notify-pin-result": (_client, m, d) => m.links.pins.settleDelivery(d.requestId, d.delivered === true)
|
|
55672
|
-
"confirm-pin": handleConfirmPin
|
|
55539
|
+
"notify-pin-result": (_client, m, d) => m.links.pins.settleDelivery(d.requestId, d.delivered === true)
|
|
55673
55540
|
};
|
|
55674
55541
|
|
|
55675
55542
|
// src/commands/sessions/daemon/handleSnapshotRequest.ts
|