@staff0rd/assist 0.1136.0 → 0.1138.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/agent/advice/ask-question.md +1 -1
- package/dist/built-version +1 -1
- package/dist/commands/sessions/web/bundle.js +437 -437
- package/dist/index.js +95 -69
- 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.1138.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -22313,12 +22313,12 @@ function checkLimitViolations(check2) {
|
|
|
22313
22313
|
];
|
|
22314
22314
|
}
|
|
22315
22315
|
function rejectLongCheck(check2) {
|
|
22316
|
-
const
|
|
22317
|
-
if (
|
|
22316
|
+
const violations2 = checkLimitViolations(check2);
|
|
22317
|
+
if (violations2.length === 0) return;
|
|
22318
22318
|
console.error(
|
|
22319
22319
|
[
|
|
22320
22320
|
"Error: the check is over its limits:",
|
|
22321
|
-
...
|
|
22321
|
+
...violations2,
|
|
22322
22322
|
"Shorten these fields and re-run assist ask-check."
|
|
22323
22323
|
].join("\n")
|
|
22324
22324
|
);
|
|
@@ -22585,18 +22585,25 @@ function formatAskQuestionAnswers(questions, answers) {
|
|
|
22585
22585
|
}
|
|
22586
22586
|
|
|
22587
22587
|
// src/commands/askQuestion/rejectLongQuestions.ts
|
|
22588
|
-
var
|
|
22588
|
+
var MAX_WORDS2 = { question: 30, context: 40 };
|
|
22589
22589
|
function countWords(text18) {
|
|
22590
22590
|
return text18.split(/\s+/).filter(Boolean).length;
|
|
22591
22591
|
}
|
|
22592
|
+
function violations(q) {
|
|
22593
|
+
return Object.keys(MAX_WORDS2).map((field) => ({
|
|
22594
|
+
header: q.header,
|
|
22595
|
+
field,
|
|
22596
|
+
words: countWords(q[field] ?? "")
|
|
22597
|
+
})).filter((v) => v.words > MAX_WORDS2[v.field]);
|
|
22598
|
+
}
|
|
22592
22599
|
function rejectLongQuestions(questions) {
|
|
22593
|
-
const
|
|
22594
|
-
if (
|
|
22600
|
+
const tooLong = questions.flatMap(violations);
|
|
22601
|
+
if (tooLong.length === 0) return;
|
|
22595
22602
|
console.error(
|
|
22596
22603
|
[
|
|
22597
|
-
`Error:
|
|
22598
|
-
...
|
|
22599
|
-
"Shorten these
|
|
22604
|
+
`Error: each question must be ${MAX_WORDS2.question} words or fewer and its context ${MAX_WORDS2.context} words or fewer:`,
|
|
22605
|
+
...tooLong.map((v) => `- ${v.header} ${v.field}: ${v.words} words`),
|
|
22606
|
+
"Shorten these and re-run assist ask-question."
|
|
22600
22607
|
].join("\n")
|
|
22601
22608
|
);
|
|
22602
22609
|
process.exit(1);
|
|
@@ -22629,6 +22636,7 @@ var askQuestionOptionSchema = z17.object({
|
|
|
22629
22636
|
});
|
|
22630
22637
|
var askQuestionSchema = z17.object({
|
|
22631
22638
|
question: z17.string().min(1),
|
|
22639
|
+
context: z17.string().optional(),
|
|
22632
22640
|
header: z17.string().min(1),
|
|
22633
22641
|
multiSelect: z17.boolean(),
|
|
22634
22642
|
options: z17.array(askQuestionOptionSchema).min(2, "Each question needs at least 2 options").max(4, "Each question allows at most 4 options").refine(
|
|
@@ -44117,7 +44125,7 @@ function suggestName(fileName) {
|
|
|
44117
44125
|
}
|
|
44118
44126
|
function checkFileNames() {
|
|
44119
44127
|
const sourceFiles = findSourceFiles2("src");
|
|
44120
|
-
const
|
|
44128
|
+
const violations2 = [];
|
|
44121
44129
|
for (const filePath of sourceFiles) {
|
|
44122
44130
|
const fileName = path55.basename(filePath);
|
|
44123
44131
|
const nameWithoutExt = fileName.replace(/\.(ts|tsx)$/, "");
|
|
@@ -44125,7 +44133,7 @@ function checkFileNames() {
|
|
|
44125
44133
|
if (/^[A-Z]/.test(nameWithoutExt)) {
|
|
44126
44134
|
const content = fs36.readFileSync(filePath, "utf8");
|
|
44127
44135
|
if (!hasClassOrComponent(content) && !hasMatchingTypeExport(content, nameWithoutExt)) {
|
|
44128
|
-
|
|
44136
|
+
violations2.push({
|
|
44129
44137
|
filePath,
|
|
44130
44138
|
fileName,
|
|
44131
44139
|
suggestedName: suggestName(fileName)
|
|
@@ -44133,7 +44141,7 @@ function checkFileNames() {
|
|
|
44133
44141
|
}
|
|
44134
44142
|
}
|
|
44135
44143
|
}
|
|
44136
|
-
return
|
|
44144
|
+
return violations2;
|
|
44137
44145
|
}
|
|
44138
44146
|
|
|
44139
44147
|
// src/commands/lint/lint/fixFileNameViolations.ts
|
|
@@ -44228,14 +44236,14 @@ function fixFileNameViolations(moves) {
|
|
|
44228
44236
|
}
|
|
44229
44237
|
|
|
44230
44238
|
// src/commands/lint/lint/runFileNameCheck.ts
|
|
44231
|
-
function reportViolations(
|
|
44239
|
+
function reportViolations(violations2) {
|
|
44232
44240
|
console.error(chalk237.red("\nFile name check failed:\n"));
|
|
44233
44241
|
console.error(
|
|
44234
44242
|
chalk237.red(
|
|
44235
44243
|
" Files without classes or React components should not start with a capital letter.\n"
|
|
44236
44244
|
)
|
|
44237
44245
|
);
|
|
44238
|
-
for (const violation of
|
|
44246
|
+
for (const violation of violations2) {
|
|
44239
44247
|
console.error(chalk237.red(` ${violation.filePath}`));
|
|
44240
44248
|
console.error(chalk237.gray(` Rename to: ${violation.suggestedName}
|
|
44241
44249
|
`));
|
|
@@ -44243,8 +44251,8 @@ function reportViolations(violations) {
|
|
|
44243
44251
|
console.error(chalk237.dim(" Run with -f to auto-fix.\n"));
|
|
44244
44252
|
}
|
|
44245
44253
|
function runFileNameCheck(fix = false) {
|
|
44246
|
-
const
|
|
44247
|
-
if (
|
|
44254
|
+
const violations2 = checkFileNames();
|
|
44255
|
+
if (violations2.length === 0) {
|
|
44248
44256
|
if (!isAgentHarness()) {
|
|
44249
44257
|
console.log(
|
|
44250
44258
|
"File name check passed. All PascalCase files contain classes or components."
|
|
@@ -44253,11 +44261,11 @@ function runFileNameCheck(fix = false) {
|
|
|
44253
44261
|
return true;
|
|
44254
44262
|
}
|
|
44255
44263
|
if (!fix) {
|
|
44256
|
-
reportViolations(
|
|
44264
|
+
reportViolations(violations2);
|
|
44257
44265
|
return false;
|
|
44258
44266
|
}
|
|
44259
44267
|
fixFileNameViolations(
|
|
44260
|
-
|
|
44268
|
+
violations2.map((v) => ({
|
|
44261
44269
|
sourcePath: v.filePath,
|
|
44262
44270
|
destPath: path59.join(path59.dirname(v.filePath), v.suggestedName)
|
|
44263
44271
|
}))
|
|
@@ -44270,14 +44278,14 @@ import fs39 from "fs";
|
|
|
44270
44278
|
|
|
44271
44279
|
// src/commands/lint/shared.ts
|
|
44272
44280
|
import chalk238 from "chalk";
|
|
44273
|
-
function reportViolations2(
|
|
44274
|
-
if (
|
|
44281
|
+
function reportViolations2(violations2, checkName2, errorMessage3, successMessage) {
|
|
44282
|
+
if (violations2.length > 0) {
|
|
44275
44283
|
console.error(chalk238.red(`
|
|
44276
44284
|
${checkName2} failed:
|
|
44277
44285
|
`));
|
|
44278
44286
|
console.error(chalk238.red(` ${errorMessage3}
|
|
44279
44287
|
`));
|
|
44280
|
-
for (const violation of
|
|
44288
|
+
for (const violation of violations2) {
|
|
44281
44289
|
console.error(chalk238.red(` ${violation.filePath}:${violation.line}`));
|
|
44282
44290
|
console.error(chalk238.gray(` ${violation.content}
|
|
44283
44291
|
`));
|
|
@@ -44294,27 +44302,27 @@ ${checkName2} failed:
|
|
|
44294
44302
|
function checkForImportExtensions(filePath) {
|
|
44295
44303
|
const content = fs39.readFileSync(filePath, "utf8");
|
|
44296
44304
|
const lines = content.split("\n");
|
|
44297
|
-
const
|
|
44305
|
+
const violations2 = [];
|
|
44298
44306
|
const importExtensionPattern = /from\s+["']\..*\.(js|ts)["']/;
|
|
44299
44307
|
for (let i = 0; i < lines.length; i++) {
|
|
44300
44308
|
const line = lines[i];
|
|
44301
44309
|
if (importExtensionPattern.test(line)) {
|
|
44302
|
-
|
|
44310
|
+
violations2.push({
|
|
44303
44311
|
filePath,
|
|
44304
44312
|
line: i + 1,
|
|
44305
44313
|
content: line.trim()
|
|
44306
44314
|
});
|
|
44307
44315
|
}
|
|
44308
44316
|
}
|
|
44309
|
-
return
|
|
44317
|
+
return violations2;
|
|
44310
44318
|
}
|
|
44311
44319
|
function checkImportExtensions() {
|
|
44312
44320
|
const sourceFiles = findSourceFiles2("src");
|
|
44313
|
-
const
|
|
44321
|
+
const violations2 = [];
|
|
44314
44322
|
for (const filePath of sourceFiles) {
|
|
44315
|
-
|
|
44323
|
+
violations2.push(...checkForImportExtensions(filePath));
|
|
44316
44324
|
}
|
|
44317
|
-
return
|
|
44325
|
+
return violations2;
|
|
44318
44326
|
}
|
|
44319
44327
|
function runImportExtensionCheck() {
|
|
44320
44328
|
return reportViolations2(
|
|
@@ -44402,7 +44410,7 @@ var WEB_UI_DIR = "src/commands/sessions/web/ui";
|
|
|
44402
44410
|
var REPORTER_DIR = path60.join(WEB_UI_DIR, "clientFailures");
|
|
44403
44411
|
function runSilentCatchCheck() {
|
|
44404
44412
|
const project = new Project2({ useInMemoryFileSystem: true });
|
|
44405
|
-
const
|
|
44413
|
+
const violations2 = findSourceFiles2(WEB_UI_DIR, { includeTests: false }).filter((filePath) => !filePath.startsWith(REPORTER_DIR)).flatMap(
|
|
44406
44414
|
(filePath) => findSilentCatches(
|
|
44407
44415
|
project.createSourceFile(filePath, fs40.readFileSync(filePath, "utf8"))
|
|
44408
44416
|
)
|
|
@@ -44411,7 +44419,7 @@ function runSilentCatchCheck() {
|
|
|
44411
44419
|
filePath: path60.relative("/", violation.filePath)
|
|
44412
44420
|
}));
|
|
44413
44421
|
return reportViolations2(
|
|
44414
|
-
|
|
44422
|
+
violations2,
|
|
44415
44423
|
"Silent catch check",
|
|
44416
44424
|
"Catch blocks in the web UI that drop an async error must call reportCaughtError(error, context) or surface the error.",
|
|
44417
44425
|
"Silent catch check passed. No dropped async errors in the web UI."
|
|
@@ -44423,28 +44431,28 @@ import fs41 from "fs";
|
|
|
44423
44431
|
function checkForDynamicImports(filePath) {
|
|
44424
44432
|
const content = fs41.readFileSync(filePath, "utf8");
|
|
44425
44433
|
const lines = content.split("\n");
|
|
44426
|
-
const
|
|
44434
|
+
const violations2 = [];
|
|
44427
44435
|
const requirePattern = /\brequire\s*\(/;
|
|
44428
44436
|
const dynamicImportPattern = /\bimport\s*\(/;
|
|
44429
44437
|
for (let i = 0; i < lines.length; i++) {
|
|
44430
44438
|
const line = lines[i];
|
|
44431
44439
|
if (requirePattern.test(line) || dynamicImportPattern.test(line)) {
|
|
44432
|
-
|
|
44440
|
+
violations2.push({
|
|
44433
44441
|
filePath,
|
|
44434
44442
|
line: i + 1,
|
|
44435
44443
|
content: line.trim()
|
|
44436
44444
|
});
|
|
44437
44445
|
}
|
|
44438
44446
|
}
|
|
44439
|
-
return
|
|
44447
|
+
return violations2;
|
|
44440
44448
|
}
|
|
44441
44449
|
function checkStaticImports() {
|
|
44442
44450
|
const sourceFiles = findSourceFiles2("src");
|
|
44443
|
-
const
|
|
44451
|
+
const violations2 = [];
|
|
44444
44452
|
for (const filePath of sourceFiles) {
|
|
44445
|
-
|
|
44453
|
+
violations2.push(...checkForDynamicImports(filePath));
|
|
44446
44454
|
}
|
|
44447
|
-
return
|
|
44455
|
+
return violations2;
|
|
44448
44456
|
}
|
|
44449
44457
|
function runStaticImportCheck() {
|
|
44450
44458
|
return reportViolations2(
|
|
@@ -44960,8 +44968,8 @@ import * as path62 from "path";
|
|
|
44960
44968
|
// src/commands/refactor/logViolations.ts
|
|
44961
44969
|
import chalk243 from "chalk";
|
|
44962
44970
|
var DEFAULT_MAX_LINES2 = 100;
|
|
44963
|
-
function logViolations(
|
|
44964
|
-
if (
|
|
44971
|
+
function logViolations(violations2, maxLines = DEFAULT_MAX_LINES2) {
|
|
44972
|
+
if (violations2.length === 0) {
|
|
44965
44973
|
if (!isAgentHarness()) {
|
|
44966
44974
|
console.log(`Refactor check passed. No files exceed ${maxLines} lines.`);
|
|
44967
44975
|
}
|
|
@@ -44972,7 +44980,7 @@ Refactor check failed:
|
|
|
44972
44980
|
`));
|
|
44973
44981
|
console.error(chalk243.red(` The following files exceed ${maxLines} lines:
|
|
44974
44982
|
`));
|
|
44975
|
-
for (const violation of
|
|
44983
|
+
for (const violation of violations2) {
|
|
44976
44984
|
console.error(chalk243.red(` ${violation.file} (${violation.lines} lines)`));
|
|
44977
44985
|
}
|
|
44978
44986
|
console.error(
|
|
@@ -45088,15 +45096,15 @@ function getViolations(pattern2, options2 = {}, maxLines = DEFAULT_MAX_LINES2) {
|
|
|
45088
45096
|
if (gitFiles) {
|
|
45089
45097
|
sourceFiles = sourceFiles.filter((f) => gitFiles.has(f));
|
|
45090
45098
|
}
|
|
45091
|
-
const
|
|
45099
|
+
const violations2 = [];
|
|
45092
45100
|
for (const filePath of sourceFiles) {
|
|
45093
45101
|
const lineCount2 = countLines(filePath);
|
|
45094
45102
|
const maxAllowed = ignoredFiles.get(filePath) ?? maxLines;
|
|
45095
45103
|
if (lineCount2 > maxAllowed) {
|
|
45096
|
-
|
|
45104
|
+
violations2.push({ file: filePath, lines: lineCount2 });
|
|
45097
45105
|
}
|
|
45098
45106
|
}
|
|
45099
|
-
return
|
|
45107
|
+
return violations2;
|
|
45100
45108
|
}
|
|
45101
45109
|
|
|
45102
45110
|
// src/commands/refactor/check.ts
|
|
@@ -45149,10 +45157,10 @@ async function check(pattern2, options2) {
|
|
|
45149
45157
|
process.exit(1);
|
|
45150
45158
|
}
|
|
45151
45159
|
const maxLines = options2.maxLines ?? DEFAULT_MAX_LINES2;
|
|
45152
|
-
const
|
|
45153
|
-
|
|
45154
|
-
logViolations(
|
|
45155
|
-
if (
|
|
45160
|
+
const violations2 = getViolations(pattern2, options2, maxLines);
|
|
45161
|
+
violations2.sort((a, b) => b.lines - a.lines);
|
|
45162
|
+
logViolations(violations2, maxLines);
|
|
45163
|
+
if (violations2.length > 0) {
|
|
45156
45164
|
process.exit(1);
|
|
45157
45165
|
}
|
|
45158
45166
|
}
|
|
@@ -53900,14 +53908,14 @@ function resolveStringsAtPath(data, path128) {
|
|
|
53900
53908
|
return [];
|
|
53901
53909
|
}
|
|
53902
53910
|
function findRuleViolations(data, rule) {
|
|
53903
|
-
const
|
|
53911
|
+
const violations2 = [];
|
|
53904
53912
|
for (const path128 of rule.paths) {
|
|
53905
53913
|
for (const value of resolveStringsAtPath(data, path128)) {
|
|
53906
53914
|
if (minimatch10(value, rule.disallowed))
|
|
53907
|
-
|
|
53915
|
+
violations2.push({ file: rule.file, path: path128, value });
|
|
53908
53916
|
}
|
|
53909
53917
|
}
|
|
53910
|
-
return
|
|
53918
|
+
return violations2;
|
|
53911
53919
|
}
|
|
53912
53920
|
function findForbiddenStrings(rules2, readJson2) {
|
|
53913
53921
|
return rules2.flatMap((rule) => findRuleViolations(readJson2(rule.file), rule));
|
|
@@ -53937,17 +53945,17 @@ function forbiddenStrings() {
|
|
|
53937
53945
|
cache7.set(file, parsed);
|
|
53938
53946
|
return parsed;
|
|
53939
53947
|
};
|
|
53940
|
-
const
|
|
53941
|
-
if (
|
|
53948
|
+
const violations2 = findForbiddenStrings(rules2, readJson2);
|
|
53949
|
+
if (violations2.length === 0) {
|
|
53942
53950
|
console.log("No forbidden strings found.");
|
|
53943
53951
|
process.exit(0);
|
|
53944
53952
|
}
|
|
53945
53953
|
console.log("Forbidden strings found:\n");
|
|
53946
|
-
for (const { file, path: path128, value } of
|
|
53954
|
+
for (const { file, path: path128, value } of violations2) {
|
|
53947
53955
|
console.log(` ${file} ${path128}: ${value}`);
|
|
53948
53956
|
}
|
|
53949
53957
|
console.log(`
|
|
53950
|
-
Total: ${
|
|
53958
|
+
Total: ${violations2.length} forbidden string(s).`);
|
|
53951
53959
|
console.log(
|
|
53952
53960
|
"\nRemove each flagged value, or adjust the matching forbiddenStrings rule in assist.yml."
|
|
53953
53961
|
);
|
|
@@ -60632,12 +60640,12 @@ function conversationResumeOutcome(session) {
|
|
|
60632
60640
|
}
|
|
60633
60641
|
|
|
60634
60642
|
// src/commands/sessions/daemon/interactiveRespawnPlan.ts
|
|
60635
|
-
function interactiveRespawnPlan(session) {
|
|
60643
|
+
function interactiveRespawnPlan(session, fresh = false) {
|
|
60636
60644
|
const adapter = harnessAdapter(session.harness);
|
|
60637
60645
|
if (!resolveCapability(adapter.capabilities, "conversation.resume").supported)
|
|
60638
60646
|
return null;
|
|
60639
60647
|
const { cwd, initialPrompt } = session;
|
|
60640
|
-
const resumeId = adapter.conversation.findResumable(session);
|
|
60648
|
+
const resumeId = fresh ? void 0 : adapter.conversation.findResumable(session);
|
|
60641
60649
|
if (resumeId)
|
|
60642
60650
|
return {
|
|
60643
60651
|
spawn: () => adapter.interactive({
|
|
@@ -60648,7 +60656,7 @@ function interactiveRespawnPlan(session) {
|
|
|
60648
60656
|
}),
|
|
60649
60657
|
status: "waiting"
|
|
60650
60658
|
};
|
|
60651
|
-
if (!initialPrompt && !cwd) return null;
|
|
60659
|
+
if (!fresh && !initialPrompt && !cwd) return null;
|
|
60652
60660
|
return freshPlan(session, adapter, initialPrompt);
|
|
60653
60661
|
}
|
|
60654
60662
|
function freshPlan(session, adapter, prompt) {
|
|
@@ -60672,17 +60680,21 @@ function freshPlan(session, adapter, prompt) {
|
|
|
60672
60680
|
}
|
|
60673
60681
|
|
|
60674
60682
|
// src/commands/sessions/daemon/respawnPlan.ts
|
|
60675
|
-
function respawnPlan(session) {
|
|
60683
|
+
function respawnPlan(session, fresh = false) {
|
|
60676
60684
|
const { commandType, cwd, assistArgs } = session;
|
|
60677
|
-
if (commandType === "claude") return interactiveRespawnPlan(session);
|
|
60685
|
+
if (commandType === "claude") return interactiveRespawnPlan(session, fresh);
|
|
60678
60686
|
if (commandType === "assist" && assistArgs) {
|
|
60679
|
-
const idle = session.status === "waiting";
|
|
60687
|
+
const idle = !fresh && session.status === "waiting";
|
|
60680
60688
|
let resume;
|
|
60681
60689
|
return {
|
|
60682
60690
|
spawn: () => {
|
|
60683
|
-
|
|
60691
|
+
if (fresh) {
|
|
60692
|
+
session.claudeSessionId = void 0;
|
|
60693
|
+
session.harnessSessionId = void 0;
|
|
60694
|
+
}
|
|
60695
|
+
resume = fresh ? void 0 : conversationResumeOutcome(session);
|
|
60684
60696
|
return spawnPty(
|
|
60685
|
-
assistResumeArgs({ assistArgs, resumeSessionId: resume
|
|
60697
|
+
assistResumeArgs({ assistArgs, resumeSessionId: resume?.id }),
|
|
60686
60698
|
cwd,
|
|
60687
60699
|
session.id,
|
|
60688
60700
|
idle ? { ASSIST_RESUME_IDLE: "1" } : void 0
|
|
@@ -60696,8 +60708,10 @@ function respawnPlan(session) {
|
|
|
60696
60708
|
}
|
|
60697
60709
|
|
|
60698
60710
|
// src/commands/sessions/daemon/restartSession.ts
|
|
60699
|
-
function restartSession(session, clients, onStatusChange) {
|
|
60700
|
-
|
|
60711
|
+
function restartSession(session, clients, onStatusChange, fresh = false) {
|
|
60712
|
+
if (fresh)
|
|
60713
|
+
daemonLog(`session ${session.id} start-over requested: ${session.name}`);
|
|
60714
|
+
const plan2 = respawnPlan(session, fresh);
|
|
60701
60715
|
if (!plan2) return false;
|
|
60702
60716
|
const respawn = () => {
|
|
60703
60717
|
respawnSession(session, plan2.spawn, plan2.status, clients, onStatusChange);
|
|
@@ -60725,7 +60739,7 @@ function restartSession(session, clients, onStatusChange) {
|
|
|
60725
60739
|
}
|
|
60726
60740
|
|
|
60727
60741
|
// src/commands/sessions/daemon/restartManagedSession.ts
|
|
60728
|
-
function restartManagedSession(sessions, id, clients, onStatusChange) {
|
|
60742
|
+
function restartManagedSession(sessions, id, clients, onStatusChange, fresh = false) {
|
|
60729
60743
|
const s = sessions.get(id);
|
|
60730
60744
|
if (!s) {
|
|
60731
60745
|
daemonLog(
|
|
@@ -60737,7 +60751,7 @@ function restartManagedSession(sessions, id, clients, onStatusChange) {
|
|
|
60737
60751
|
};
|
|
60738
60752
|
}
|
|
60739
60753
|
daemonLog(`restart requested: id=${id} status=${s.status} (${s.name})`);
|
|
60740
|
-
if (!restartSession(s, clients, onStatusChange)) {
|
|
60754
|
+
if (!restartSession(s, clients, onStatusChange, fresh)) {
|
|
60741
60755
|
daemonLog(`restart for session ${id} did nothing: no respawn plan`);
|
|
60742
60756
|
return {
|
|
60743
60757
|
ok: false,
|
|
@@ -60748,8 +60762,14 @@ function restartManagedSession(sessions, id, clients, onStatusChange) {
|
|
|
60748
60762
|
}
|
|
60749
60763
|
|
|
60750
60764
|
// src/commands/sessions/daemon/restartAndNotify.ts
|
|
60751
|
-
function restartAndNotify(sessions, id, clients, onStatusChange, notify2) {
|
|
60752
|
-
const result = restartManagedSession(
|
|
60765
|
+
function restartAndNotify(sessions, id, clients, onStatusChange, notify2, fresh = false) {
|
|
60766
|
+
const result = restartManagedSession(
|
|
60767
|
+
sessions,
|
|
60768
|
+
id,
|
|
60769
|
+
clients,
|
|
60770
|
+
onStatusChange,
|
|
60771
|
+
fresh
|
|
60772
|
+
);
|
|
60753
60773
|
if (result.ok) notify2();
|
|
60754
60774
|
return result;
|
|
60755
60775
|
}
|
|
@@ -63353,13 +63373,14 @@ var SessionManager = class {
|
|
|
63353
63373
|
notify: this.notify
|
|
63354
63374
|
});
|
|
63355
63375
|
}
|
|
63356
|
-
restart(id) {
|
|
63376
|
+
restart(id, fresh = false) {
|
|
63357
63377
|
return restartAndNotify(
|
|
63358
63378
|
this.sessions,
|
|
63359
63379
|
id,
|
|
63360
63380
|
this.clients,
|
|
63361
63381
|
this.onStatusChange,
|
|
63362
|
-
this.notify
|
|
63382
|
+
this.notify,
|
|
63383
|
+
fresh
|
|
63363
63384
|
);
|
|
63364
63385
|
}
|
|
63365
63386
|
dismissSession = (id, closeServerRuns = false) => {
|
|
@@ -64302,6 +64323,11 @@ var retryHandlers = {
|
|
|
64302
64323
|
existing: conflict
|
|
64303
64324
|
});
|
|
64304
64325
|
}),
|
|
64326
|
+
"start-over": routed((client, m, d) => {
|
|
64327
|
+
const result = m.restart(d.sessionId, true);
|
|
64328
|
+
if (!result.ok && result.reason)
|
|
64329
|
+
sendTo(client, { type: "error", message: result.reason });
|
|
64330
|
+
}),
|
|
64305
64331
|
restart: routed((client, m, d) => {
|
|
64306
64332
|
const result = m.restart(d.sessionId);
|
|
64307
64333
|
if (!result.ok && result.reason)
|