@staff0rd/assist 0.550.1 → 0.552.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 +295 -295
- package/dist/index.js +128 -49
- 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.552.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -528,6 +528,7 @@ var assistConfigShape = {
|
|
|
528
528
|
root: z3.string().optional(),
|
|
529
529
|
install: z3.union([z3.boolean(), z3.string()]).default(true),
|
|
530
530
|
commitBeforeManualChecks: z3.boolean().default(false),
|
|
531
|
+
commitBeforePhaseEnd: z3.boolean().optional(),
|
|
531
532
|
copy: z3.array(z3.string()).default([
|
|
532
533
|
".env",
|
|
533
534
|
"settings.local.json",
|
|
@@ -4698,9 +4699,9 @@ var sessionsConfigHelp = [
|
|
|
4698
4699
|
note: "per-worktree dep install: true auto-detects the package manager, or give an explicit command; false to skip"
|
|
4699
4700
|
},
|
|
4700
4701
|
{
|
|
4701
|
-
key: "worktree.
|
|
4702
|
-
setter: "assist config set worktree.
|
|
4703
|
-
note: "phase prompts run /commit before asking the user to perform manual checks, so work is not left uncommitted in a reapable worktree (default off)"
|
|
4702
|
+
key: "worktree.commitBeforePhaseEnd",
|
|
4703
|
+
setter: "assist config set worktree.commitBeforePhaseEnd true -g --repo",
|
|
4704
|
+
note: "phase prompts run /commit once verify passes \u2014 before asking the user to perform manual checks, or before phase-done when the phase has none \u2014 so work is not left uncommitted in a reapable worktree (default off)"
|
|
4704
4705
|
},
|
|
4705
4706
|
{
|
|
4706
4707
|
key: "worktree.copy",
|
|
@@ -4834,7 +4835,9 @@ var configHelpEntries = [
|
|
|
4834
4835
|
];
|
|
4835
4836
|
|
|
4836
4837
|
// src/commands/verify/pendingConfigDocumentation.ts
|
|
4837
|
-
var pendingConfigDocumentation = /* @__PURE__ */ new Set(
|
|
4838
|
+
var pendingConfigDocumentation = /* @__PURE__ */ new Set([
|
|
4839
|
+
"worktree.commitBeforeManualChecks"
|
|
4840
|
+
]);
|
|
4838
4841
|
|
|
4839
4842
|
// src/commands/verify/configKeys.ts
|
|
4840
4843
|
function section(label2, keys) {
|
|
@@ -7561,7 +7564,7 @@ var BACKLOG_MARKERS = [
|
|
|
7561
7564
|
function findBacklogUp(startDir) {
|
|
7562
7565
|
let current = startDir;
|
|
7563
7566
|
while (current !== dirname14(current)) {
|
|
7564
|
-
if (BACKLOG_MARKERS.some((
|
|
7567
|
+
if (BACKLOG_MARKERS.some((marker2) => existsSync21(join17(current, marker2)))) {
|
|
7565
7568
|
return current;
|
|
7566
7569
|
}
|
|
7567
7570
|
current = dirname14(current);
|
|
@@ -8024,11 +8027,11 @@ function formatPromptComment(entry) {
|
|
|
8024
8027
|
}
|
|
8025
8028
|
|
|
8026
8029
|
// src/commands/backlog/buildManualCheckLines.ts
|
|
8027
|
-
function buildManualCheckLines(manualChecks,
|
|
8030
|
+
function buildManualCheckLines(manualChecks, commitBeforePhaseEnd) {
|
|
8028
8031
|
if (manualChecks.length > 0) {
|
|
8029
8032
|
return [
|
|
8030
8033
|
"",
|
|
8031
|
-
...
|
|
8034
|
+
...commitBeforePhaseEnd ? [
|
|
8032
8035
|
"Once verify passes, run /commit to commit the work before asking the user to perform the manual checks below."
|
|
8033
8036
|
] : [],
|
|
8034
8037
|
"Before marking this phase as done, ask the user to perform these manual checks:",
|
|
@@ -8037,12 +8040,18 @@ function buildManualCheckLines(manualChecks, commitBeforeManualChecks) {
|
|
|
8037
8040
|
"Wait for the user to confirm all manual checks pass before proceeding."
|
|
8038
8041
|
];
|
|
8039
8042
|
}
|
|
8043
|
+
if (commitBeforePhaseEnd) {
|
|
8044
|
+
return [
|
|
8045
|
+
"",
|
|
8046
|
+
"Once verify passes, run /commit to commit the work before marking this phase as done."
|
|
8047
|
+
];
|
|
8048
|
+
}
|
|
8040
8049
|
return [];
|
|
8041
8050
|
}
|
|
8042
8051
|
|
|
8043
8052
|
// src/commands/backlog/buildAuthoredPhasePrompt.ts
|
|
8044
8053
|
function buildAuthoredPhasePrompt(item, phaseNumber, phase, options2 = {
|
|
8045
|
-
|
|
8054
|
+
commitBeforePhaseEnd: false
|
|
8046
8055
|
}) {
|
|
8047
8056
|
const manualChecks = phase.manualChecks ?? [];
|
|
8048
8057
|
const needsConfirmation = manualChecks.length > 0;
|
|
@@ -8054,7 +8063,7 @@ function buildAuthoredPhasePrompt(item, phaseNumber, phase, options2 = {
|
|
|
8054
8063
|
"Focus ONLY on this phase. Do not work on other phases.",
|
|
8055
8064
|
"If you need to modify backlog items, run `assist backlog --help` to discover available commands.",
|
|
8056
8065
|
"When you have completed all tasks for this phase, run /verify to check your work.",
|
|
8057
|
-
...buildManualCheckLines(manualChecks, options2.
|
|
8066
|
+
...buildManualCheckLines(manualChecks, options2.commitBeforePhaseEnd),
|
|
8058
8067
|
"",
|
|
8059
8068
|
`Post concise comments for any notable findings or changes using \`assist backlog comment ${formatItemId(item.id)} "<text>"\`.`,
|
|
8060
8069
|
"",
|
|
@@ -8093,7 +8102,7 @@ function formatTasks(phase) {
|
|
|
8093
8102
|
|
|
8094
8103
|
// src/commands/backlog/buildReviewPrompt.ts
|
|
8095
8104
|
function buildReviewPrompt(item, phaseNumber, options2 = {
|
|
8096
|
-
|
|
8105
|
+
commitBeforePhaseEnd: false
|
|
8097
8106
|
}) {
|
|
8098
8107
|
const acLines = item.acceptanceCriteria.map((ac, i) => `${i + 1}. ${ac}`).join("\n");
|
|
8099
8108
|
const itemId2 = formatItemId(item.id);
|
|
@@ -8115,7 +8124,7 @@ function buildReviewPrompt(item, phaseNumber, options2 = {
|
|
|
8115
8124
|
"",
|
|
8116
8125
|
`Post concise comments for any notable findings or changes using \`assist backlog comment ${itemId2} "<text>"\`.`,
|
|
8117
8126
|
"",
|
|
8118
|
-
...options2.
|
|
8127
|
+
...options2.commitBeforePhaseEnd ? [
|
|
8119
8128
|
"Before asking the user to confirm manual checks, run /commit to commit the work (it is fine if there is nothing new to commit).",
|
|
8120
8129
|
""
|
|
8121
8130
|
] : [],
|
|
@@ -8143,12 +8152,13 @@ function buildReviewPrompt(item, phaseNumber, options2 = {
|
|
|
8143
8152
|
// src/commands/backlog/buildPhasePrompt.ts
|
|
8144
8153
|
var REVIEW_PHASE_NAME = "Review";
|
|
8145
8154
|
function buildPhasePrompt(item, phaseNumber, phase) {
|
|
8146
|
-
const
|
|
8155
|
+
const worktree = loadConfig().worktree;
|
|
8156
|
+
const commitBeforePhaseEnd = worktree?.commitBeforePhaseEnd ?? worktree?.commitBeforeManualChecks ?? false;
|
|
8147
8157
|
if (phase.name === REVIEW_PHASE_NAME) {
|
|
8148
|
-
return buildReviewPrompt(item, phaseNumber, {
|
|
8158
|
+
return buildReviewPrompt(item, phaseNumber, { commitBeforePhaseEnd });
|
|
8149
8159
|
}
|
|
8150
8160
|
return buildAuthoredPhasePrompt(item, phaseNumber, phase, {
|
|
8151
|
-
|
|
8161
|
+
commitBeforePhaseEnd
|
|
8152
8162
|
});
|
|
8153
8163
|
}
|
|
8154
8164
|
|
|
@@ -9366,9 +9376,9 @@ function printPhaseTasks(phase) {
|
|
|
9366
9376
|
// src/commands/backlog/show/printPlan.ts
|
|
9367
9377
|
function phaseHeader(index3, name, isCurrent) {
|
|
9368
9378
|
const phaseNumber = index3 + 1;
|
|
9369
|
-
const
|
|
9379
|
+
const marker2 = isCurrent ? chalk56.green("\u25B6 ") : " ";
|
|
9370
9380
|
const label2 = isCurrent ? chalk56.green.bold(`Phase ${phaseNumber}: ${name}`) : `${chalk56.bold(`Phase ${phaseNumber}:`)} ${name}`;
|
|
9371
|
-
return `${
|
|
9381
|
+
return `${marker2}${label2}`;
|
|
9372
9382
|
}
|
|
9373
9383
|
function printPhaseSessions(sessions) {
|
|
9374
9384
|
if (sessions.length === 0) return;
|
|
@@ -14668,12 +14678,12 @@ async function launchMode(slashCommand, options2) {
|
|
|
14668
14678
|
resumeSessionId,
|
|
14669
14679
|
cwd: process.cwd()
|
|
14670
14680
|
});
|
|
14671
|
-
const
|
|
14681
|
+
const marker2 = watchForMarker(child, { actOnDone: options2?.once });
|
|
14672
14682
|
const exitCode = await awaitClaude(done2, `/${slashCommand}`);
|
|
14673
14683
|
stopWatching();
|
|
14674
14684
|
if (exitCode === CLAUDE_SPAWN_FAILED) return;
|
|
14675
14685
|
await handleLaunchSignal(slashCommand, options2?.once);
|
|
14676
|
-
if (exitCode !== 0 && !
|
|
14686
|
+
if (exitCode !== 0 && !marker2.killedOnMarker()) process.exitCode = exitCode;
|
|
14677
14687
|
}
|
|
14678
14688
|
|
|
14679
14689
|
// src/commands/backlog/refine.ts
|
|
@@ -17252,15 +17262,15 @@ function codeCommentConfirm(pin) {
|
|
|
17252
17262
|
process.exitCode = 1;
|
|
17253
17263
|
return;
|
|
17254
17264
|
}
|
|
17255
|
-
const
|
|
17265
|
+
const marker2 = isHashCommentFile(state.file) ? "#" : "//";
|
|
17256
17266
|
const indentSource = lines2[index3] ?? "";
|
|
17257
17267
|
const indent3 = indentSource.match(/^\s*/)?.[0] ?? "";
|
|
17258
|
-
lines2.splice(index3, 0, `${indent3}${
|
|
17268
|
+
lines2.splice(index3, 0, `${indent3}${marker2} ${state.text}`);
|
|
17259
17269
|
writeFileSync24(state.file, lines2.join("\n"));
|
|
17260
17270
|
unlinkSync8(getPinStatePath(pin));
|
|
17261
17271
|
console.log(
|
|
17262
17272
|
chalk121.green(
|
|
17263
|
-
`Inserted "${
|
|
17273
|
+
`Inserted "${marker2} ${state.text}" at ${state.file}:${state.line}`
|
|
17264
17274
|
)
|
|
17265
17275
|
);
|
|
17266
17276
|
}
|
|
@@ -17322,7 +17332,7 @@ function codeCommentSet(file, line, text17) {
|
|
|
17322
17332
|
return;
|
|
17323
17333
|
}
|
|
17324
17334
|
const hash = isHashCommentFile(file);
|
|
17325
|
-
const
|
|
17335
|
+
const marker2 = hash ? "#" : "//";
|
|
17326
17336
|
const validation = validateCommentText(text17, hash);
|
|
17327
17337
|
if (!validation.ok) {
|
|
17328
17338
|
console.error(chalk122.red(`Refused: ${validation.reason}`));
|
|
@@ -17347,7 +17357,7 @@ function codeCommentSet(file, line, text17) {
|
|
|
17347
17357
|
}
|
|
17348
17358
|
console.log(
|
|
17349
17359
|
`A confirmation pin was sent to your desktop notifications.
|
|
17350
|
-
To insert "${
|
|
17360
|
+
To insert "${marker2} ${validation.text}" at ${file}:${lineNumber}, run:
|
|
17351
17361
|
${chalk122.cyan(" assist code-comment confirm <PIN>")}
|
|
17352
17362
|
using the pin from that notification.`
|
|
17353
17363
|
);
|
|
@@ -19816,9 +19826,9 @@ function selectCommentExtractor(filePath) {
|
|
|
19816
19826
|
}
|
|
19817
19827
|
|
|
19818
19828
|
// src/commands/editHook/decideCommentGuard.ts
|
|
19819
|
-
function denyReason(
|
|
19820
|
-
const blockClause =
|
|
19821
|
-
return `This edit introduces a code comment (${
|
|
19829
|
+
function denyReason(marker2) {
|
|
19830
|
+
const blockClause = marker2 === "//" ? ", no block comments" : "";
|
|
19831
|
+
return `This edit introduces a code comment (${marker2}), which is blocked by the comment gate. Comments are a last resort \u2014 prefer a clearer name, a smaller function, or a test that makes the comment unnecessary. The comment must not appear in your edit itself. If this one line genuinely earns its keep, use the escape hatch: run \`assist code-comment set <file> <line> "<text>"\` (single line, max 50 chars${blockClause}) to get a pin, then \`assist code-comment confirm <pin>\` to insert it.`;
|
|
19822
19832
|
}
|
|
19823
19833
|
function decideCommentGuard(input, existingContent) {
|
|
19824
19834
|
const { file_path, content } = input.tool_input;
|
|
@@ -20429,15 +20439,15 @@ function renderNodes(nodes, indent3) {
|
|
|
20429
20439
|
function isListNode(node) {
|
|
20430
20440
|
return node.type === "orderedList" || node.type === "bulletList";
|
|
20431
20441
|
}
|
|
20432
|
-
function renderListChild(child, indent3, pad,
|
|
20442
|
+
function renderListChild(child, indent3, pad, marker2, isFirst) {
|
|
20433
20443
|
if (isListNode(child)) return renderNodes([child], indent3 + 1);
|
|
20434
20444
|
if (child.type !== "paragraph") return renderNode(child, indent3);
|
|
20435
20445
|
const text17 = renderChildren(child, indent3);
|
|
20436
|
-
return isFirst ? `${pad}${
|
|
20446
|
+
return isFirst ? `${pad}${marker2} ${text17}` : `${pad} ${text17}`;
|
|
20437
20447
|
}
|
|
20438
|
-
function renderListItem(node, indent3,
|
|
20448
|
+
function renderListItem(node, indent3, marker2) {
|
|
20439
20449
|
const pad = " ".repeat(indent3);
|
|
20440
|
-
return (node.content ?? []).map((child, i) => renderListChild(child, indent3, pad,
|
|
20450
|
+
return (node.content ?? []).map((child, i) => renderListChild(child, indent3, pad, marker2, i === 0)).join("\n");
|
|
20441
20451
|
}
|
|
20442
20452
|
function adfToText(doc) {
|
|
20443
20453
|
return renderNodes([doc], 0);
|
|
@@ -29535,9 +29545,9 @@ function renderWatchReport({
|
|
|
29535
29545
|
} else {
|
|
29536
29546
|
lines2.push("| SHA | When | Subject |", "| --- | --- | --- |");
|
|
29537
29547
|
for (const commit2 of commits2) {
|
|
29538
|
-
const
|
|
29548
|
+
const marker2 = isNew.has(commit2.sha) ? " \u2190 new" : "";
|
|
29539
29549
|
lines2.push(
|
|
29540
|
-
`| \`${commit2.short}\` | ${commit2.when} | ${escapeCell(commit2.subject)}${
|
|
29550
|
+
`| \`${commit2.short}\` | ${commit2.when} | ${escapeCell(commit2.subject)}${marker2} |`
|
|
29541
29551
|
);
|
|
29542
29552
|
}
|
|
29543
29553
|
}
|
|
@@ -31069,7 +31079,8 @@ function toSessionInfo(session) {
|
|
|
31069
31079
|
design,
|
|
31070
31080
|
verifying,
|
|
31071
31081
|
pendingPrPreview,
|
|
31072
|
-
undurable
|
|
31082
|
+
undurable,
|
|
31083
|
+
lastUserMessage
|
|
31073
31084
|
} = session;
|
|
31074
31085
|
return {
|
|
31075
31086
|
...toSessionRunInfo(session),
|
|
@@ -31093,6 +31104,7 @@ function toSessionInfo(session) {
|
|
|
31093
31104
|
verifying,
|
|
31094
31105
|
pendingPrPreview,
|
|
31095
31106
|
undurable,
|
|
31107
|
+
lastUserMessage,
|
|
31096
31108
|
joinable: joinRefusal(session) === void 0
|
|
31097
31109
|
};
|
|
31098
31110
|
}
|
|
@@ -32539,6 +32551,61 @@ function resolvedToolUseIds(events, afterIdx) {
|
|
|
32539
32551
|
return ids;
|
|
32540
32552
|
}
|
|
32541
32553
|
|
|
32554
|
+
// src/commands/sessions/shared/extractLastUserMessage.ts
|
|
32555
|
+
var MAX_LENGTH2 = 2048;
|
|
32556
|
+
var INTERRUPT_PREFIX2 = "[Request interrupted";
|
|
32557
|
+
function extractLastUserMessage(entries, maxLength = MAX_LENGTH2) {
|
|
32558
|
+
for (let i = entries.length - 1; i >= 0; i--) {
|
|
32559
|
+
const entry = entries[i];
|
|
32560
|
+
if (entry.isSidechain || entry.isMeta) continue;
|
|
32561
|
+
if (entry.type !== "user") continue;
|
|
32562
|
+
const raw = promptTextOrNull(entry);
|
|
32563
|
+
if (raw === null) continue;
|
|
32564
|
+
const message3 = renderPrompt(raw);
|
|
32565
|
+
if (message3) return cap(message3, maxLength);
|
|
32566
|
+
}
|
|
32567
|
+
return void 0;
|
|
32568
|
+
}
|
|
32569
|
+
function promptTextOrNull(entry) {
|
|
32570
|
+
const content = asRecord3(entry.message)?.content;
|
|
32571
|
+
if (typeof content === "string") return isInterrupt(content) ? null : content;
|
|
32572
|
+
if (!Array.isArray(content)) return null;
|
|
32573
|
+
const parts = [];
|
|
32574
|
+
for (const block of content) {
|
|
32575
|
+
const b = asRecord3(block);
|
|
32576
|
+
if (b?.type !== "text") continue;
|
|
32577
|
+
const text17 = typeof b.text === "string" ? b.text : "";
|
|
32578
|
+
if (isInterrupt(text17)) return null;
|
|
32579
|
+
parts.push(text17);
|
|
32580
|
+
}
|
|
32581
|
+
return parts.length === 0 ? null : parts.join("\n");
|
|
32582
|
+
}
|
|
32583
|
+
function renderPrompt(raw) {
|
|
32584
|
+
const command = marker(raw, "command-name");
|
|
32585
|
+
if (command) {
|
|
32586
|
+
const args = marker(raw, "command-args");
|
|
32587
|
+
const name = `/${command.replace(/^\/+/, "")}`;
|
|
32588
|
+
return args ? `${name} ${args}` : name;
|
|
32589
|
+
}
|
|
32590
|
+
return stripBlocks(raw);
|
|
32591
|
+
}
|
|
32592
|
+
function stripBlocks(raw) {
|
|
32593
|
+
return raw.replace(/<system-reminder>[\s\S]*?<\/system-reminder>/g, "").replace(/<command-[^>]*>[\s\S]*?<\/command-[^>]*>/g, "").replace(/<local-command-[^>]*>[\s\S]*?<\/local-command-[^>]*>/g, "").trim();
|
|
32594
|
+
}
|
|
32595
|
+
function marker(raw, tag) {
|
|
32596
|
+
const match = raw.match(new RegExp(`<${tag}>([\\s\\S]*?)</${tag}>`));
|
|
32597
|
+
return match ? match[1].trim() : "";
|
|
32598
|
+
}
|
|
32599
|
+
function cap(message3, maxLength) {
|
|
32600
|
+
return message3.length <= maxLength ? message3 : `${message3.slice(0, maxLength).trimEnd()}\u2026`;
|
|
32601
|
+
}
|
|
32602
|
+
function isInterrupt(value) {
|
|
32603
|
+
return value.trimStart().startsWith(INTERRUPT_PREFIX2);
|
|
32604
|
+
}
|
|
32605
|
+
function asRecord3(value) {
|
|
32606
|
+
return value && typeof value === "object" ? value : null;
|
|
32607
|
+
}
|
|
32608
|
+
|
|
32542
32609
|
// src/commands/sessions/shared/readTranscriptTail.ts
|
|
32543
32610
|
import * as fs46 from "fs";
|
|
32544
32611
|
var DEFAULT_MAX_BYTES = 256 * 1024;
|
|
@@ -32622,9 +32689,19 @@ async function resolveTranscriptPath(session) {
|
|
|
32622
32689
|
if (filePath) session.transcriptPath = filePath;
|
|
32623
32690
|
return filePath;
|
|
32624
32691
|
}
|
|
32625
|
-
|
|
32626
|
-
|
|
32627
|
-
|
|
32692
|
+
function updateLastUserMessage(session, entries, notify2) {
|
|
32693
|
+
const message3 = extractLastUserMessage(entries);
|
|
32694
|
+
if (message3 === session.lastUserMessage) return;
|
|
32695
|
+
session.lastUserMessage = message3;
|
|
32696
|
+
daemonLog(
|
|
32697
|
+
`session ${session.id} last user message: ${JSON.stringify(message3?.slice(0, 120) ?? null)}`
|
|
32698
|
+
);
|
|
32699
|
+
notify2?.();
|
|
32700
|
+
}
|
|
32701
|
+
function isFinished(session) {
|
|
32702
|
+
return session.status === "done" || session.status === "error" || session.status === "stopped";
|
|
32703
|
+
}
|
|
32704
|
+
async function reconcileTranscriptStatus(session, onStatusChange, notify2) {
|
|
32628
32705
|
const filePath = await resolveTranscriptPath(session);
|
|
32629
32706
|
if (!filePath) return;
|
|
32630
32707
|
const entries = await readTranscriptTail(filePath);
|
|
@@ -32632,6 +32709,8 @@ async function reconcileTranscriptStatus(session, onStatusChange) {
|
|
|
32632
32709
|
if (fingerprint !== null && fingerprint === session.transcriptFingerprint)
|
|
32633
32710
|
return;
|
|
32634
32711
|
session.transcriptFingerprint = fingerprint ?? void 0;
|
|
32712
|
+
updateLastUserMessage(session, entries, notify2);
|
|
32713
|
+
if (isFinished(session)) return;
|
|
32635
32714
|
const derived = deriveTranscriptStatus(entries, {
|
|
32636
32715
|
permissionActive: session.permissionActive
|
|
32637
32716
|
});
|
|
@@ -32802,7 +32881,7 @@ function watchTranscript(session, notify2, onStatusChange) {
|
|
|
32802
32881
|
let timer = null;
|
|
32803
32882
|
const run4 = () => {
|
|
32804
32883
|
timer = null;
|
|
32805
|
-
void reconcileTranscriptStatus(session, onStatusChange);
|
|
32884
|
+
void reconcileTranscriptStatus(session, onStatusChange, notify2);
|
|
32806
32885
|
startTranscriptTitleGeneration(session, notify2);
|
|
32807
32886
|
};
|
|
32808
32887
|
try {
|
|
@@ -33411,7 +33490,7 @@ function restoreBase(id, persisted) {
|
|
|
33411
33490
|
}
|
|
33412
33491
|
|
|
33413
33492
|
// src/commands/sessions/daemon/deferredSession.ts
|
|
33414
|
-
function deferredSession(id, persisted,
|
|
33493
|
+
function deferredSession(id, persisted, cap2) {
|
|
33415
33494
|
return {
|
|
33416
33495
|
...restoreBase(id, persisted),
|
|
33417
33496
|
status: "stopped",
|
|
@@ -33425,13 +33504,13 @@ function deferredSession(id, persisted, cap) {
|
|
|
33425
33504
|
runArgs: persisted.runArgs,
|
|
33426
33505
|
activity: persisted.activity,
|
|
33427
33506
|
restored: false,
|
|
33428
|
-
scrollback: deferralNotice(persisted,
|
|
33507
|
+
scrollback: deferralNotice(persisted, cap2)
|
|
33429
33508
|
};
|
|
33430
33509
|
}
|
|
33431
|
-
function deferralNotice(persisted,
|
|
33510
|
+
function deferralNotice(persisted, cap2) {
|
|
33432
33511
|
return [
|
|
33433
33512
|
`\r
|
|
33434
|
-
\x1B[33mNot resumed: restore was already at its cap of ${
|
|
33513
|
+
\x1B[33mNot resumed: restore was already at its cap of ${cap2} session(s) (raise it with: assist config set sessions.maxLive <n> -g)\x1B[0m\r
|
|
33435
33514
|
`,
|
|
33436
33515
|
`This card is the handle for it. Its command, working directory (${persisted.cwd})\r
|
|
33437
33516
|
`,
|
|
@@ -33667,23 +33746,23 @@ function logRestoreError(persisted, error) {
|
|
|
33667
33746
|
// src/commands/sessions/daemon/restoreAll.ts
|
|
33668
33747
|
function restoreAll(spawner, sessions) {
|
|
33669
33748
|
const persisted = loadPersistedSessions();
|
|
33670
|
-
const
|
|
33749
|
+
const cap2 = sessionLimits.maxRestore();
|
|
33671
33750
|
const restoredIds = /* @__PURE__ */ new Map();
|
|
33672
|
-
const names = persisted.slice(0,
|
|
33751
|
+
const names = persisted.slice(0, cap2).map((entry) => {
|
|
33673
33752
|
const id = restoreOne(entry, spawner, sessions);
|
|
33674
33753
|
if (entry.id != null && id != null) restoredIds.set(entry.id, id);
|
|
33675
33754
|
return entry.name;
|
|
33676
33755
|
});
|
|
33677
|
-
for (const over of persisted.slice(
|
|
33678
|
-
deferOne(over, spawner.recoveryCard,
|
|
33756
|
+
for (const over of persisted.slice(cap2))
|
|
33757
|
+
deferOne(over, spawner.recoveryCard, cap2);
|
|
33679
33758
|
remapLaunchedFrom(sessions, restoredIds);
|
|
33680
33759
|
return names;
|
|
33681
33760
|
}
|
|
33682
|
-
function deferOne(persisted, spawnRecoveryCard,
|
|
33761
|
+
function deferOne(persisted, spawnRecoveryCard, cap2) {
|
|
33683
33762
|
try {
|
|
33684
|
-
const id = spawnRecoveryCard((sid) => deferredSession(sid, persisted,
|
|
33763
|
+
const id = spawnRecoveryCard((sid) => deferredSession(sid, persisted, cap2));
|
|
33685
33764
|
daemonLog(
|
|
33686
|
-
`restore capped at ${
|
|
33765
|
+
`restore capped at ${cap2} (sessions.maxLive): ${describePersistedSession(persisted)} deferred to stopped card ${id}`
|
|
33687
33766
|
);
|
|
33688
33767
|
} catch (error) {
|
|
33689
33768
|
logDroppedSession(persisted, error);
|