@staff0rd/assist 0.1114.0 → 0.1116.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/built-version +1 -1
- package/dist/commands/sessions/web/bundle.js +433 -433
- package/dist/index.js +409 -299
- 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.1116.0",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -446,13 +446,13 @@ function releaseSpawnLock() {
|
|
|
446
446
|
}
|
|
447
447
|
function spawnDaemon(reason4) {
|
|
448
448
|
const log2 = openSync(daemonPaths.log, "a");
|
|
449
|
-
const
|
|
449
|
+
const child2 = spawn(process.execPath, [process.argv[1], "daemon", "run"], {
|
|
450
450
|
detached: true,
|
|
451
451
|
windowsHide: true,
|
|
452
452
|
stdio: ["ignore", log2, log2],
|
|
453
453
|
env: { ...process.env, ASSIST_DAEMON_SPAWN_REASON: reason4 }
|
|
454
454
|
});
|
|
455
|
-
|
|
455
|
+
child2.unref();
|
|
456
456
|
}
|
|
457
457
|
function delay(ms) {
|
|
458
458
|
return new Promise((resolve35) => setTimeout(resolve35, ms));
|
|
@@ -552,6 +552,13 @@ var durationSchema = z.string().superRefine((value, ctx) => {
|
|
|
552
552
|
}
|
|
553
553
|
});
|
|
554
554
|
|
|
555
|
+
// src/shared/harnessKinds.ts
|
|
556
|
+
var harnessKinds = [
|
|
557
|
+
"claude",
|
|
558
|
+
"codex",
|
|
559
|
+
"pi"
|
|
560
|
+
];
|
|
561
|
+
|
|
555
562
|
// src/shared/hotkeys/hotkeysSchema.ts
|
|
556
563
|
import { z as z2 } from "zod";
|
|
557
564
|
|
|
@@ -764,6 +771,11 @@ var miroExtractSchema = z6.strictObject({
|
|
|
764
771
|
var DEFAULT_BACKUP_DIR = "~/.assist/backups";
|
|
765
772
|
var DEFAULT_BACKUP_STALE_AFTER = "32h";
|
|
766
773
|
var DEFAULT_CLONE_DIR = "~/git";
|
|
774
|
+
var harnessKindSchema = z6.enum(harnessKinds);
|
|
775
|
+
var sessionTypeDefaultsSchema = z6.strictObject({
|
|
776
|
+
harness: harnessKindSchema.optional(),
|
|
777
|
+
model: z6.string().min(1).optional()
|
|
778
|
+
}).optional();
|
|
767
779
|
var assistConfigShape = {
|
|
768
780
|
advice: z6.strictObject({
|
|
769
781
|
sections: z6.partialRecord(z6.enum(adviceFragmentNames), z6.boolean()).default({}),
|
|
@@ -1008,10 +1020,17 @@ var assistConfigShape = {
|
|
|
1008
1020
|
autoConfirm: z6.boolean().default(false)
|
|
1009
1021
|
}).default({ autoConfirm: false }),
|
|
1010
1022
|
harness: z6.strictObject({
|
|
1011
|
-
engine:
|
|
1023
|
+
engine: harnessKindSchema.default("claude"),
|
|
1012
1024
|
exposeCodexActions: z6.boolean().optional(),
|
|
1013
1025
|
exposePiActions: z6.boolean().optional(),
|
|
1014
|
-
codexModel: z6.string().optional()
|
|
1026
|
+
codexModel: z6.string().optional(),
|
|
1027
|
+
defaults: z6.strictObject({
|
|
1028
|
+
draft: sessionTypeDefaultsSchema,
|
|
1029
|
+
bug: sessionTypeDefaultsSchema,
|
|
1030
|
+
prompt: sessionTypeDefaultsSchema,
|
|
1031
|
+
design: sessionTypeDefaultsSchema,
|
|
1032
|
+
run: sessionTypeDefaultsSchema
|
|
1033
|
+
}).optional()
|
|
1015
1034
|
}).default({ engine: "claude" })
|
|
1016
1035
|
};
|
|
1017
1036
|
var repoConfigSchema = z6.strictObject(assistConfigShape).partial();
|
|
@@ -4849,13 +4868,6 @@ async function daemonLogTail(req, res) {
|
|
|
4849
4868
|
});
|
|
4850
4869
|
}
|
|
4851
4870
|
|
|
4852
|
-
// src/shared/harnessKinds.ts
|
|
4853
|
-
var harnessKinds = [
|
|
4854
|
-
"claude",
|
|
4855
|
-
"codex",
|
|
4856
|
-
"pi"
|
|
4857
|
-
];
|
|
4858
|
-
|
|
4859
4871
|
// src/commands/sessions/shared/conversationFromParams.ts
|
|
4860
4872
|
function isHarnessKind(value) {
|
|
4861
4873
|
return harnessKinds.includes(value);
|
|
@@ -5316,6 +5328,7 @@ function buildArgs(opts) {
|
|
|
5316
5328
|
if (opts.appendSystemPromptFile)
|
|
5317
5329
|
base.push("--append-system-prompt-file", opts.appendSystemPromptFile);
|
|
5318
5330
|
if (opts.auto) base.push("--permission-mode", "auto");
|
|
5331
|
+
if (opts.model) base.push("--model", opts.model);
|
|
5319
5332
|
if (opts.resumeSessionId) {
|
|
5320
5333
|
return opts.prompt ? [...base, "--resume", opts.resumeSessionId, opts.prompt] : [...base, "--resume", opts.resumeSessionId];
|
|
5321
5334
|
}
|
|
@@ -5525,16 +5538,16 @@ function spawnInherit(command, args, options2 = {}) {
|
|
|
5525
5538
|
CLAUDE_CODE_CHILD_SESSION: _childSession,
|
|
5526
5539
|
...env
|
|
5527
5540
|
} = process.env;
|
|
5528
|
-
const
|
|
5541
|
+
const child2 = spawn3(command, args, {
|
|
5529
5542
|
stdio: "inherit",
|
|
5530
5543
|
env: { ...env, ...options2.env },
|
|
5531
5544
|
cwd: options2.cwd
|
|
5532
5545
|
});
|
|
5533
5546
|
const done2 = new Promise((resolve35, reject) => {
|
|
5534
|
-
|
|
5535
|
-
|
|
5547
|
+
child2.on("close", (code) => resolve35(code ?? 0));
|
|
5548
|
+
child2.on("error", reject);
|
|
5536
5549
|
});
|
|
5537
|
-
return { child, done: done2 };
|
|
5550
|
+
return { child: child2, done: done2 };
|
|
5538
5551
|
}
|
|
5539
5552
|
|
|
5540
5553
|
// src/shared/spawnClaude.ts
|
|
@@ -6087,9 +6100,9 @@ function flushBuffer(buffer, onLine) {
|
|
|
6087
6100
|
if (line.trim()) onLine(line);
|
|
6088
6101
|
}
|
|
6089
6102
|
}
|
|
6090
|
-
function attachLineParser(
|
|
6103
|
+
function attachLineParser(child2, onLine) {
|
|
6091
6104
|
let buffer = "";
|
|
6092
|
-
|
|
6105
|
+
child2.stdout?.on("data", (chunk2) => {
|
|
6093
6106
|
buffer += chunk2.toString("utf8");
|
|
6094
6107
|
buffer = flushBuffer(buffer, onLine);
|
|
6095
6108
|
});
|
|
@@ -6099,9 +6112,9 @@ function attachLineParser(child, onLine) {
|
|
|
6099
6112
|
}
|
|
6100
6113
|
|
|
6101
6114
|
// src/commands/review/attachStderrCollector.ts
|
|
6102
|
-
function attachStderrCollector(
|
|
6115
|
+
function attachStderrCollector(child2) {
|
|
6103
6116
|
const state = { value: "" };
|
|
6104
|
-
|
|
6117
|
+
child2.stderr?.on("data", (chunk2) => {
|
|
6105
6118
|
state.value += chunk2.toString("utf8");
|
|
6106
6119
|
});
|
|
6107
6120
|
return state;
|
|
@@ -6425,17 +6438,17 @@ function describeExit(code, signal) {
|
|
|
6425
6438
|
return signal ? `claude was killed (${signal})` : `claude exited ${code}`;
|
|
6426
6439
|
}
|
|
6427
6440
|
async function claudeConnectorRun(run5) {
|
|
6428
|
-
const
|
|
6441
|
+
const child2 = spawn4(harnesses.claude.command, buildClaudeConnectorArgs(run5), {
|
|
6429
6442
|
stdio: ["ignore", "pipe", "pipe"],
|
|
6430
6443
|
windowsHide: true,
|
|
6431
6444
|
timeout: run5.timeoutMs
|
|
6432
6445
|
});
|
|
6433
6446
|
const stream = createClaudeConnectorStream(run5.onEvent);
|
|
6434
|
-
const flush = attachLineParser(
|
|
6435
|
-
const stderr = attachStderrCollector(
|
|
6447
|
+
const flush = attachLineParser(child2, stream.onLine);
|
|
6448
|
+
const stderr = attachStderrCollector(child2);
|
|
6436
6449
|
const exit = await new Promise((resolve35, reject) => {
|
|
6437
|
-
|
|
6438
|
-
|
|
6450
|
+
child2.on("error", reject);
|
|
6451
|
+
child2.on("close", (code, signal) => resolve35(describeExit(code, signal)));
|
|
6439
6452
|
});
|
|
6440
6453
|
flush();
|
|
6441
6454
|
const tail = stderr.value.trim().slice(-500);
|
|
@@ -6619,9 +6632,9 @@ function finaliseReviewerRun(spec, spinner, result) {
|
|
|
6619
6632
|
import { spawn as spawn5 } from "child_process";
|
|
6620
6633
|
|
|
6621
6634
|
// src/commands/review/attachStdoutTail.ts
|
|
6622
|
-
function attachStdoutTail(
|
|
6635
|
+
function attachStdoutTail(child2, maxBytes = 8192) {
|
|
6623
6636
|
const state = { value: "" };
|
|
6624
|
-
|
|
6637
|
+
child2.stdout?.on("data", (chunk2) => {
|
|
6625
6638
|
state.value += chunk2.toString("utf8");
|
|
6626
6639
|
if (state.value.length > maxBytes) {
|
|
6627
6640
|
state.value = state.value.slice(state.value.length - maxBytes);
|
|
@@ -6779,34 +6792,34 @@ function waitForChildExit(ctx) {
|
|
|
6779
6792
|
}
|
|
6780
6793
|
|
|
6781
6794
|
// src/commands/review/runStreamingChild.ts
|
|
6782
|
-
function writeStdinSafely(
|
|
6783
|
-
|
|
6795
|
+
function writeStdinSafely(child2, payload) {
|
|
6796
|
+
child2.stdin?.on("error", () => {
|
|
6784
6797
|
});
|
|
6785
6798
|
try {
|
|
6786
|
-
|
|
6787
|
-
|
|
6799
|
+
child2.stdin?.write(payload);
|
|
6800
|
+
child2.stdin?.end();
|
|
6788
6801
|
} catch {
|
|
6789
6802
|
}
|
|
6790
6803
|
}
|
|
6791
6804
|
function startChild(spec) {
|
|
6792
|
-
const
|
|
6805
|
+
const child2 = spawn5(spec.command, spec.args, {
|
|
6793
6806
|
stdio: ["pipe", "pipe", "pipe"],
|
|
6794
6807
|
shell: process.platform === "win32",
|
|
6795
6808
|
...spec.env ? { env: { ...process.env, ...spec.env } } : {}
|
|
6796
6809
|
});
|
|
6797
|
-
const flushPending = attachLineParser(
|
|
6798
|
-
const stderr = attachStderrCollector(
|
|
6799
|
-
const stdout = attachStdoutTail(
|
|
6800
|
-
writeStdinSafely(
|
|
6801
|
-
return { child, flushPending, stderr, stdout };
|
|
6810
|
+
const flushPending = attachLineParser(child2, spec.onLine);
|
|
6811
|
+
const stderr = attachStderrCollector(child2);
|
|
6812
|
+
const stdout = attachStdoutTail(child2);
|
|
6813
|
+
writeStdinSafely(child2, spec.stdin);
|
|
6814
|
+
return { child: child2, flushPending, stderr, stdout };
|
|
6802
6815
|
}
|
|
6803
6816
|
function runStreamingChild(spec) {
|
|
6804
6817
|
const startedAt = Date.now();
|
|
6805
6818
|
if (!spec.quiet)
|
|
6806
6819
|
console.log(`[${reviewerLabel(spec.name, spec.model)}] starting`);
|
|
6807
|
-
const { child, flushPending, stderr, stdout } = startChild(spec);
|
|
6820
|
+
const { child: child2, flushPending, stderr, stdout } = startChild(spec);
|
|
6808
6821
|
return waitForChildExit({
|
|
6809
|
-
child,
|
|
6822
|
+
child: child2,
|
|
6810
6823
|
flushPending,
|
|
6811
6824
|
stderr,
|
|
6812
6825
|
stdout,
|
|
@@ -7057,7 +7070,8 @@ var claudeAdapter = {
|
|
|
7057
7070
|
prompt,
|
|
7058
7071
|
cwd,
|
|
7059
7072
|
appendSystemPromptFile,
|
|
7060
|
-
auto
|
|
7073
|
+
auto,
|
|
7074
|
+
model
|
|
7061
7075
|
}) => spawnClaude({
|
|
7062
7076
|
prompt,
|
|
7063
7077
|
cwd,
|
|
@@ -7065,7 +7079,8 @@ var claudeAdapter = {
|
|
|
7065
7079
|
resumeSessionId: resumeId,
|
|
7066
7080
|
claudeSessionId: conversationId,
|
|
7067
7081
|
appendSystemPromptFile,
|
|
7068
|
-
auto
|
|
7082
|
+
auto,
|
|
7083
|
+
model
|
|
7069
7084
|
}),
|
|
7070
7085
|
oneShot: claudeOneShot,
|
|
7071
7086
|
structured: claudeStructuredRun,
|
|
@@ -7283,7 +7298,7 @@ function spawnCodex(opts = {}) {
|
|
|
7283
7298
|
if (trusted) daemonLog(`codex: trusted ${trusted} in config.toml`);
|
|
7284
7299
|
const untrusted = prepareCodexHookTrust();
|
|
7285
7300
|
if (untrusted) daemonLog(`codex: ${untrusted}`);
|
|
7286
|
-
const override = buildHarnessCodexArgs();
|
|
7301
|
+
const override = opts.model ? { args: ["-m", opts.model], env: {} } : buildHarnessCodexArgs();
|
|
7287
7302
|
const sessionEnv = codexSessionEnvArgs({
|
|
7288
7303
|
ASSIST_SESSION: "1",
|
|
7289
7304
|
ASSIST_SESSION_ID: opts.sessionId,
|
|
@@ -8185,12 +8200,20 @@ var codexAdapter = {
|
|
|
8185
8200
|
sandbox: sandbox(allowEdits),
|
|
8186
8201
|
resumeSessionId: conversationId
|
|
8187
8202
|
}),
|
|
8188
|
-
interactive: ({
|
|
8203
|
+
interactive: ({
|
|
8204
|
+
sessionId: sessionId2,
|
|
8205
|
+
resumeId,
|
|
8206
|
+
prompt,
|
|
8207
|
+
cwd,
|
|
8208
|
+
appendSystemPromptFile,
|
|
8209
|
+
model
|
|
8210
|
+
}) => spawnCodex({
|
|
8189
8211
|
prompt,
|
|
8190
8212
|
cwd,
|
|
8191
8213
|
sessionId: sessionId2,
|
|
8192
8214
|
resumeSessionId: resumeId,
|
|
8193
|
-
appendSystemPromptFile
|
|
8215
|
+
appendSystemPromptFile,
|
|
8216
|
+
model
|
|
8194
8217
|
}),
|
|
8195
8218
|
oneShot: codexOneShot,
|
|
8196
8219
|
structured: codexStructuredRun,
|
|
@@ -8205,6 +8228,7 @@ var piTerminalArgs = ["--tui-mode", "regular"];
|
|
|
8205
8228
|
// src/commands/sessions/daemon/spawnPi.ts
|
|
8206
8229
|
function spawnPi(opts = {}) {
|
|
8207
8230
|
const args = ["pi", ...piTerminalArgs];
|
|
8231
|
+
if (opts.model) args.push("--model", opts.model);
|
|
8208
8232
|
if (opts.prompt) args.push(opts.prompt);
|
|
8209
8233
|
return spawnPty(args, opts.cwd, opts.sessionId, { ASSIST_HARNESS: "pi" });
|
|
8210
8234
|
}
|
|
@@ -8285,7 +8309,7 @@ var piAdapter = {
|
|
|
8285
8309
|
launchSkill: (skill, args, { cwd }) => spawnPi2(buildSlashCommand(skill, args), { cwd }),
|
|
8286
8310
|
launchPrompt: (prompt, { cwd }) => spawnPi2(prompt, { cwd }),
|
|
8287
8311
|
resume: cannotResume,
|
|
8288
|
-
interactive: ({ sessionId: sessionId2, resumeId, prompt, cwd }) => resumeId ? cannotResume() : spawnPi({ prompt, cwd, sessionId: sessionId2 }),
|
|
8312
|
+
interactive: ({ sessionId: sessionId2, resumeId, prompt, cwd, model }) => resumeId ? cannotResume() : spawnPi({ prompt, cwd, sessionId: sessionId2, model }),
|
|
8289
8313
|
oneShot: noOneShot,
|
|
8290
8314
|
structured: noOneShot,
|
|
8291
8315
|
connectorRun: rejectConnectorRun("pi"),
|
|
@@ -9453,7 +9477,7 @@ function objectConfigNode(inner, base, build2) {
|
|
|
9453
9477
|
const shape = inner.def?.shape;
|
|
9454
9478
|
if (inner.def?.type !== "object" || !shape) return void 0;
|
|
9455
9479
|
const fields = Object.entries(shape).map(
|
|
9456
|
-
([name2,
|
|
9480
|
+
([name2, child2]) => build2(child2, [...base.path, { kind: "key", name: name2 }])
|
|
9457
9481
|
);
|
|
9458
9482
|
return { ...base, kind: "object", fields };
|
|
9459
9483
|
}
|
|
@@ -9641,9 +9665,9 @@ function isPlainRecord(value) {
|
|
|
9641
9665
|
function mapChildren(value, path118, childNode, map) {
|
|
9642
9666
|
if (!isPlainRecord(value)) return value;
|
|
9643
9667
|
return Object.fromEntries(
|
|
9644
|
-
Object.entries(value).map(([name2,
|
|
9668
|
+
Object.entries(value).map(([name2, child2]) => [
|
|
9645
9669
|
name2,
|
|
9646
|
-
walk(
|
|
9670
|
+
walk(child2, [...path118, name2], childNode(name2), map)
|
|
9647
9671
|
])
|
|
9648
9672
|
);
|
|
9649
9673
|
}
|
|
@@ -9874,6 +9898,29 @@ var harnessConfigHelp = [
|
|
|
9874
9898
|
}
|
|
9875
9899
|
];
|
|
9876
9900
|
|
|
9901
|
+
// src/commands/backlog/harnessDefaultsConfigHelp.ts
|
|
9902
|
+
var launches = {
|
|
9903
|
+
draft: "draft sessions (assist draft, New Session dialog)",
|
|
9904
|
+
bug: "bug sessions (assist bug, New Session dialog)",
|
|
9905
|
+
prompt: "prompt sessions in the New Session dialog",
|
|
9906
|
+
design: "design sessions in the New Session dialog",
|
|
9907
|
+
run: "backlog runs (assist backlog run, web Start buttons)"
|
|
9908
|
+
};
|
|
9909
|
+
var harnessDefaultsConfigHelp = Object.entries(
|
|
9910
|
+
launches
|
|
9911
|
+
).flatMap(([type, launch]) => [
|
|
9912
|
+
{
|
|
9913
|
+
key: `harness.defaults.${type}.harness`,
|
|
9914
|
+
setter: `assist config set harness.defaults.${type}.harness <claude|codex|pi>`,
|
|
9915
|
+
note: `harness for ${launch} when none is picked; unset falls back to harness.engine`
|
|
9916
|
+
},
|
|
9917
|
+
{
|
|
9918
|
+
key: `harness.defaults.${type}.model`,
|
|
9919
|
+
setter: `assist config set harness.defaults.${type}.model <model>`,
|
|
9920
|
+
note: `model for ${launch} on the type's harness; unset uses the harness's own default`
|
|
9921
|
+
}
|
|
9922
|
+
]);
|
|
9923
|
+
|
|
9877
9924
|
// src/commands/inbox/inboxConfigHelp.ts
|
|
9878
9925
|
var inboxConfigHelp = [
|
|
9879
9926
|
{
|
|
@@ -10564,6 +10611,7 @@ var configHelpEntries = [
|
|
|
10564
10611
|
...devlogConfigHelp,
|
|
10565
10612
|
...dotnetConfigHelp,
|
|
10566
10613
|
...harnessConfigHelp,
|
|
10614
|
+
...harnessDefaultsConfigHelp,
|
|
10567
10615
|
...inboxConfigHelp,
|
|
10568
10616
|
...jiraConfigHelp,
|
|
10569
10617
|
...litellmConfigHelp,
|
|
@@ -15033,24 +15081,24 @@ function runCommandToCompletion(command, args, env, cwd, quiet) {
|
|
|
15033
15081
|
});
|
|
15034
15082
|
return;
|
|
15035
15083
|
}
|
|
15036
|
-
const
|
|
15084
|
+
const child2 = spawn6(resolveCommand(command), args, {
|
|
15037
15085
|
stdio: quiet ? "pipe" : "inherit",
|
|
15038
15086
|
env: env ? { ...process.env, ...expandEnv(env) } : void 0,
|
|
15039
15087
|
cwd
|
|
15040
15088
|
});
|
|
15041
15089
|
const chunks = [];
|
|
15042
15090
|
if (quiet) {
|
|
15043
|
-
|
|
15044
|
-
|
|
15091
|
+
child2.stdout?.on("data", (data) => chunks.push(data));
|
|
15092
|
+
child2.stderr?.on("data", (data) => chunks.push(data));
|
|
15045
15093
|
}
|
|
15046
|
-
|
|
15094
|
+
child2.on("close", (code) => {
|
|
15047
15095
|
resolveResult({
|
|
15048
15096
|
kind: "completed",
|
|
15049
15097
|
exitCode: code ?? 0,
|
|
15050
15098
|
output: Buffer.concat(chunks).toString()
|
|
15051
15099
|
});
|
|
15052
15100
|
});
|
|
15053
|
-
|
|
15101
|
+
child2.on("error", (err) => {
|
|
15054
15102
|
resolveResult({
|
|
15055
15103
|
kind: "failed",
|
|
15056
15104
|
message: `Failed to execute command: ${err.message}`
|
|
@@ -15135,6 +15183,34 @@ async function revertDiffPaths(req, res) {
|
|
|
15135
15183
|
respondJson(res, 200, { reverted, failed: failed3 });
|
|
15136
15184
|
}
|
|
15137
15185
|
|
|
15186
|
+
// src/commands/sessions/web/newSessionDefaults/resolveDialogHarnesses.ts
|
|
15187
|
+
var harnessShape = assistConfigSchema.shape.harness.unwrap().shape;
|
|
15188
|
+
var engineSchema = harnessShape.engine;
|
|
15189
|
+
var typeShape = harnessShape.defaults.unwrap().shape.draft.unwrap().shape;
|
|
15190
|
+
var dialogTypes = ["draft", "bug", "prompt", "design"];
|
|
15191
|
+
function child(value, key) {
|
|
15192
|
+
if (!value || typeof value !== "object") return void 0;
|
|
15193
|
+
return value[key];
|
|
15194
|
+
}
|
|
15195
|
+
function resolveDialogHarnesses(raw) {
|
|
15196
|
+
const harness = child(raw, "harness");
|
|
15197
|
+
const engine = engineSchema.safeParse(child(harness, "engine"));
|
|
15198
|
+
if (!engine.success) return { error: "harness.engine" };
|
|
15199
|
+
const defaults = child(harness, "defaults");
|
|
15200
|
+
const harnesses2 = {};
|
|
15201
|
+
const models = {};
|
|
15202
|
+
for (const type of dialogTypes) {
|
|
15203
|
+
const typeDefaults = child(defaults, type);
|
|
15204
|
+
const parsed = typeShape.harness.safeParse(child(typeDefaults, "harness"));
|
|
15205
|
+
if (!parsed.success) return { error: `harness.defaults.${type}.harness` };
|
|
15206
|
+
harnesses2[type] = parsed.data ?? engine.data;
|
|
15207
|
+
const model = typeShape.model.safeParse(child(typeDefaults, "model"));
|
|
15208
|
+
if (!model.success) return { error: `harness.defaults.${type}.model` };
|
|
15209
|
+
if (model.data) models[type] = model.data;
|
|
15210
|
+
}
|
|
15211
|
+
return { harnesses: harnesses2, models };
|
|
15212
|
+
}
|
|
15213
|
+
|
|
15138
15214
|
// src/commands/sessions/web/newSessionDefaults.ts
|
|
15139
15215
|
var newSessionModeSchema = assistConfigSchema.shape.sessions.unwrap().shape.newSessionMode;
|
|
15140
15216
|
function configuredMode(raw) {
|
|
@@ -15161,7 +15237,12 @@ function newSessionDefaults(req, res) {
|
|
|
15161
15237
|
});
|
|
15162
15238
|
return;
|
|
15163
15239
|
}
|
|
15164
|
-
|
|
15240
|
+
const resolved = resolveDialogHarnesses(raw);
|
|
15241
|
+
if ("error" in resolved) {
|
|
15242
|
+
respondJson(res, 422, { error: `Invalid config ${resolved.error}` });
|
|
15243
|
+
return;
|
|
15244
|
+
}
|
|
15245
|
+
respondJson(res, 200, { mode: parsed.data, ...resolved });
|
|
15165
15246
|
}
|
|
15166
15247
|
|
|
15167
15248
|
// src/commands/sessions/nodes/fetchPeerJson.ts
|
|
@@ -15992,9 +16073,9 @@ function configLeafSchema(schema2, key) {
|
|
|
15992
16073
|
let current2 = schema2;
|
|
15993
16074
|
for (const name2 of key.split(".")) {
|
|
15994
16075
|
const { inner } = unwrapSchemaNode(current2);
|
|
15995
|
-
const
|
|
15996
|
-
if (!
|
|
15997
|
-
current2 =
|
|
16076
|
+
const child2 = inner.def?.type === "object" ? inner.def.shape?.[name2] : void 0;
|
|
16077
|
+
if (!child2) return void 0;
|
|
16078
|
+
current2 = child2;
|
|
15998
16079
|
}
|
|
15999
16080
|
return current2;
|
|
16000
16081
|
}
|
|
@@ -16606,24 +16687,24 @@ function withoutKey(container, key) {
|
|
|
16606
16687
|
const { [key]: _deleted, ...rest } = container;
|
|
16607
16688
|
return rest;
|
|
16608
16689
|
}
|
|
16609
|
-
function withChild(container, key,
|
|
16690
|
+
function withChild(container, key, child2) {
|
|
16610
16691
|
if (Array.isArray(container)) {
|
|
16611
16692
|
const next3 = [...container];
|
|
16612
|
-
next3[toIndex(key)] =
|
|
16693
|
+
next3[toIndex(key)] = child2;
|
|
16613
16694
|
return next3;
|
|
16614
16695
|
}
|
|
16615
|
-
return { ...container, [key]:
|
|
16696
|
+
return { ...container, [key]: child2 };
|
|
16616
16697
|
}
|
|
16617
16698
|
function isPrunable(container) {
|
|
16618
16699
|
return isPlainObject3(container) && Object.keys(container).length === 0;
|
|
16619
16700
|
}
|
|
16620
|
-
function replaceOrPrune(container, key,
|
|
16621
|
-
return isPrunable(
|
|
16701
|
+
function replaceOrPrune(container, key, child2) {
|
|
16702
|
+
return isPrunable(child2) ? withoutKey(container, key) : withChild(container, key, child2);
|
|
16622
16703
|
}
|
|
16623
16704
|
function removeFromChild(container, key, rest) {
|
|
16624
|
-
const
|
|
16625
|
-
if (!isContainer(
|
|
16626
|
-
const inner = removeAt(
|
|
16705
|
+
const child2 = getItem2(container, key);
|
|
16706
|
+
if (!isContainer(child2)) return { container, removed: false };
|
|
16707
|
+
const inner = removeAt(child2, rest);
|
|
16627
16708
|
if (!inner.removed) return { container, removed: false };
|
|
16628
16709
|
return {
|
|
16629
16710
|
container: replaceOrPrune(container, key, inner.container),
|
|
@@ -19357,11 +19438,11 @@ function spawnCommand(fullCommand, cwd, env, quiet) {
|
|
|
19357
19438
|
env: env ? { ...process.env, ...expandEnv(env) } : void 0
|
|
19358
19439
|
});
|
|
19359
19440
|
}
|
|
19360
|
-
function collectOutput(
|
|
19441
|
+
function collectOutput(child2, quiet) {
|
|
19361
19442
|
if (!shouldSuppress(quiet)) return [];
|
|
19362
19443
|
const chunks = [];
|
|
19363
|
-
|
|
19364
|
-
|
|
19444
|
+
child2.stdout?.on("data", (data) => chunks.push(data));
|
|
19445
|
+
child2.stderr?.on("data", (data) => chunks.push(data));
|
|
19365
19446
|
return chunks;
|
|
19366
19447
|
}
|
|
19367
19448
|
function flushIfFailed(exitCode, chunks) {
|
|
@@ -19381,14 +19462,14 @@ ${failed3.length} script(s) failed:`);
|
|
|
19381
19462
|
function runEntry(entry) {
|
|
19382
19463
|
return new Promise((resolve35) => {
|
|
19383
19464
|
const startTime = Date.now();
|
|
19384
|
-
const
|
|
19465
|
+
const child2 = spawnCommand(
|
|
19385
19466
|
entry.fullCommand,
|
|
19386
19467
|
entry.cwd,
|
|
19387
19468
|
entry.env,
|
|
19388
19469
|
entry.quiet
|
|
19389
19470
|
);
|
|
19390
|
-
const chunks = collectOutput(
|
|
19391
|
-
|
|
19471
|
+
const chunks = collectOutput(child2, entry.quiet);
|
|
19472
|
+
child2.on("close", (code) => {
|
|
19392
19473
|
const exitCode = code ?? 1;
|
|
19393
19474
|
flushIfFailed(exitCode, chunks);
|
|
19394
19475
|
resolve35({
|
|
@@ -21164,10 +21245,10 @@ function buildGraph(names, edges) {
|
|
|
21164
21245
|
const present = new Set(names);
|
|
21165
21246
|
const indegree = new Map(names.map((n) => [n, 0]));
|
|
21166
21247
|
const children = /* @__PURE__ */ new Map();
|
|
21167
|
-
for (const { child, parent } of edges) {
|
|
21168
|
-
if (!present.has(
|
|
21169
|
-
indegree.set(
|
|
21170
|
-
children.set(parent, [...children.get(parent) ?? [],
|
|
21248
|
+
for (const { child: child2, parent } of edges) {
|
|
21249
|
+
if (!present.has(child2) || !present.has(parent)) continue;
|
|
21250
|
+
indegree.set(child2, (indegree.get(child2) ?? 0) + 1);
|
|
21251
|
+
children.set(parent, [...children.get(parent) ?? [], child2]);
|
|
21171
21252
|
}
|
|
21172
21253
|
return { indegree, children };
|
|
21173
21254
|
}
|
|
@@ -21186,8 +21267,8 @@ function topoSort(entries, edges) {
|
|
|
21186
21267
|
throw new Error("Cannot dump: foreign-key cycle between tables.");
|
|
21187
21268
|
emitted.add(next3);
|
|
21188
21269
|
ordered.push(byRaw.get(next3));
|
|
21189
|
-
for (const
|
|
21190
|
-
indegree.set(
|
|
21270
|
+
for (const child2 of children.get(next3) ?? []) {
|
|
21271
|
+
indegree.set(child2, (indegree.get(child2) ?? 0) - 1);
|
|
21191
21272
|
}
|
|
21192
21273
|
}
|
|
21193
21274
|
return ordered;
|
|
@@ -23884,7 +23965,7 @@ function readSignal() {
|
|
|
23884
23965
|
}
|
|
23885
23966
|
|
|
23886
23967
|
// src/commands/backlog/watchForMarker.ts
|
|
23887
|
-
function watchForMarker(
|
|
23968
|
+
function watchForMarker(child2, options2) {
|
|
23888
23969
|
let killed = false;
|
|
23889
23970
|
const statusPath = getSignalPath();
|
|
23890
23971
|
if (!statusPath) return { killedOnMarker: () => killed };
|
|
@@ -23895,7 +23976,7 @@ function watchForMarker(child, options2) {
|
|
|
23895
23976
|
if (signal.event === "done" && !options2?.actOnDone) return;
|
|
23896
23977
|
unwatchFile(statusPath);
|
|
23897
23978
|
killed = true;
|
|
23898
|
-
|
|
23979
|
+
child2.kill("SIGTERM");
|
|
23899
23980
|
});
|
|
23900
23981
|
return { killedOnMarker: () => killed };
|
|
23901
23982
|
}
|
|
@@ -23909,12 +23990,12 @@ async function launchPhaseClaude(prompt, spawnOptions, context, harness) {
|
|
|
23909
23990
|
const adapter = harnessAdapter(harness);
|
|
23910
23991
|
const cwd = process.cwd();
|
|
23911
23992
|
const { allowEdits, resumeSessionId, sessionId: sessionId2 } = spawnOptions;
|
|
23912
|
-
const { child, done: done2 } = resumeSessionId ? adapter.resume(resumeSessionId, prompt, { cwd, allowEdits }) : adapter.launchPrompt(prompt, {
|
|
23993
|
+
const { child: child2, done: done2 } = resumeSessionId ? adapter.resume(resumeSessionId, prompt, { cwd, allowEdits }) : adapter.launchPrompt(prompt, {
|
|
23913
23994
|
cwd,
|
|
23914
23995
|
allowEdits,
|
|
23915
23996
|
conversationId: sessionId2
|
|
23916
23997
|
});
|
|
23917
|
-
watchForMarker(
|
|
23998
|
+
watchForMarker(child2);
|
|
23918
23999
|
const exitCode = await awaitHarness(done2, context, adapter.label);
|
|
23919
24000
|
stopWatching();
|
|
23920
24001
|
return exitCode;
|
|
@@ -24689,8 +24770,8 @@ async function launchMode(slashCommand, options2) {
|
|
|
24689
24770
|
}
|
|
24690
24771
|
if (!resumeSessionId) await pullIfConfigured();
|
|
24691
24772
|
process.env.ASSIST_SESSION_ID ??= String(process.pid);
|
|
24692
|
-
const { child, done: done2 } = spawnLaunch(adapter, slashCommand, options2 ?? {});
|
|
24693
|
-
const marker2 = watchForMarker(
|
|
24773
|
+
const { child: child2, done: done2 } = spawnLaunch(adapter, slashCommand, options2 ?? {});
|
|
24774
|
+
const marker2 = watchForMarker(child2, { actOnDone: options2?.once });
|
|
24694
24775
|
const exitCode = await awaitHarness(done2, `/${slashCommand}`, adapter.label);
|
|
24695
24776
|
stopWatching();
|
|
24696
24777
|
if (exitCode === HARNESS_SPAWN_FAILED) return;
|
|
@@ -24741,9 +24822,10 @@ async function refine(id, options2) {
|
|
|
24741
24822
|
}
|
|
24742
24823
|
|
|
24743
24824
|
// src/commands/backlog/resolveHarness.ts
|
|
24744
|
-
function resolveHarness2(value) {
|
|
24825
|
+
function resolveHarness2(value, type) {
|
|
24745
24826
|
if (value === "claude" || value === "codex" || value === "pi") return value;
|
|
24746
|
-
|
|
24827
|
+
const { harness } = loadConfig();
|
|
24828
|
+
return type && harness.defaults?.[type]?.harness || harness.engine;
|
|
24747
24829
|
}
|
|
24748
24830
|
|
|
24749
24831
|
// src/commands/backlog/registerRefineCommand.ts
|
|
@@ -24820,9 +24902,9 @@ function registerRewindCommand(cmd) {
|
|
|
24820
24902
|
|
|
24821
24903
|
// src/commands/backlog/registerRunCommand.ts
|
|
24822
24904
|
function registerRunCommand(cmd) {
|
|
24823
|
-
cmd.command("run <id>").description("Run a backlog item's plan phase-by-phase").option("-w, --write", "Run the harness with write access (default)").option("--no-write", "Run the harness without write access").option(
|
|
24905
|
+
const command = cmd.command("run <id>").description("Run a backlog item's plan phase-by-phase").option("-w, --write", "Run the harness with write access (default)").option("--no-write", "Run the harness without write access").option(
|
|
24824
24906
|
"--harness <harness>",
|
|
24825
|
-
"Coding harness to launch (claude|codex|pi); defaults to the configured harness.engine"
|
|
24907
|
+
"Coding harness to launch (claude|codex|pi); defaults to the configured harness.defaults.run.harness, then harness.engine"
|
|
24826
24908
|
).option(
|
|
24827
24909
|
"--resume-session <id>",
|
|
24828
24910
|
"Resume an interrupted Claude session for the current phase (used by the sessions daemon on restart)"
|
|
@@ -24831,11 +24913,12 @@ function registerRunCommand(cmd) {
|
|
|
24831
24913
|
if (!opts.resumeSession) await pullIfConfigured();
|
|
24832
24914
|
await run3(id, {
|
|
24833
24915
|
allowEdits: opts.write !== false,
|
|
24834
|
-
harness: resolveHarness2(opts.harness),
|
|
24916
|
+
harness: resolveHarness2(opts.harness, "run"),
|
|
24835
24917
|
resumeSessionId: opts.resumeSession
|
|
24836
24918
|
});
|
|
24837
24919
|
}
|
|
24838
24920
|
);
|
|
24921
|
+
configHelp(command, [...harnessConfigHelp, ...harnessDefaultsConfigHelp]);
|
|
24839
24922
|
}
|
|
24840
24923
|
|
|
24841
24924
|
// src/commands/backlog/search.ts
|
|
@@ -28068,11 +28151,11 @@ function showWindowsNotificationFromWsl(options2) {
|
|
|
28068
28151
|
if (sound) {
|
|
28069
28152
|
args.push("-s", "ms-winsoundevent:Notification.Default");
|
|
28070
28153
|
}
|
|
28071
|
-
const
|
|
28154
|
+
const child2 = spawn8(snoreToastPath, args, {
|
|
28072
28155
|
detached: true,
|
|
28073
28156
|
stdio: "ignore"
|
|
28074
28157
|
});
|
|
28075
|
-
|
|
28158
|
+
child2.unref();
|
|
28076
28159
|
return true;
|
|
28077
28160
|
}
|
|
28078
28161
|
|
|
@@ -28414,7 +28497,7 @@ import { spawn as spawn9 } from "child_process";
|
|
|
28414
28497
|
import { createInterface as createInterface6 } from "readline";
|
|
28415
28498
|
|
|
28416
28499
|
// src/commands/sync/createCodexRpcClient.ts
|
|
28417
|
-
function createCodexRpcClient(
|
|
28500
|
+
function createCodexRpcClient(child2, pending, timer) {
|
|
28418
28501
|
let nextId = 0;
|
|
28419
28502
|
return {
|
|
28420
28503
|
call(method, params) {
|
|
@@ -28425,15 +28508,15 @@ function createCodexRpcClient(child, pending, timer) {
|
|
|
28425
28508
|
resolve: resolve35,
|
|
28426
28509
|
reject
|
|
28427
28510
|
});
|
|
28428
|
-
|
|
28511
|
+
child2.stdin.write(`${JSON.stringify({ id, method, params })}
|
|
28429
28512
|
`);
|
|
28430
28513
|
});
|
|
28431
28514
|
},
|
|
28432
28515
|
close() {
|
|
28433
28516
|
clearTimeout(timer);
|
|
28434
|
-
|
|
28435
|
-
|
|
28436
|
-
|
|
28517
|
+
child2.removeAllListeners("exit");
|
|
28518
|
+
child2.stdin.end();
|
|
28519
|
+
child2.kill();
|
|
28437
28520
|
}
|
|
28438
28521
|
};
|
|
28439
28522
|
}
|
|
@@ -28462,15 +28545,15 @@ function routeCodexRpcLine(line, pending) {
|
|
|
28462
28545
|
}
|
|
28463
28546
|
|
|
28464
28547
|
// src/commands/sync/watchCodexAppServer.ts
|
|
28465
|
-
function watchCodexAppServer(
|
|
28548
|
+
function watchCodexAppServer(child2, fail15) {
|
|
28466
28549
|
let stderr = "";
|
|
28467
|
-
|
|
28550
|
+
child2.stderr.on("data", (chunk2) => {
|
|
28468
28551
|
stderr += chunk2;
|
|
28469
28552
|
});
|
|
28470
|
-
|
|
28471
|
-
|
|
28553
|
+
child2.on("error", fail15);
|
|
28554
|
+
child2.stdin.on("error", () => {
|
|
28472
28555
|
});
|
|
28473
|
-
|
|
28556
|
+
child2.on(
|
|
28474
28557
|
"exit",
|
|
28475
28558
|
(code) => fail15(
|
|
28476
28559
|
new Error(
|
|
@@ -28483,7 +28566,7 @@ function watchCodexAppServer(child, fail15) {
|
|
|
28483
28566
|
// src/commands/sync/openCodexAppServer.ts
|
|
28484
28567
|
var TIMEOUT_MS3 = 2e4;
|
|
28485
28568
|
async function openCodexAppServer(homeDir) {
|
|
28486
|
-
const
|
|
28569
|
+
const child2 = spawn9(harnesses.codex.command, ["app-server"], {
|
|
28487
28570
|
env: { ...process.env, CODEX_HOME: homeDir },
|
|
28488
28571
|
stdio: ["pipe", "pipe", "pipe"]
|
|
28489
28572
|
});
|
|
@@ -28492,8 +28575,8 @@ async function openCodexAppServer(homeDir) {
|
|
|
28492
28575
|
for (const entry of pending.values()) entry.reject(error);
|
|
28493
28576
|
pending.clear();
|
|
28494
28577
|
};
|
|
28495
|
-
watchCodexAppServer(
|
|
28496
|
-
createInterface6({ input:
|
|
28578
|
+
watchCodexAppServer(child2, failAll);
|
|
28579
|
+
createInterface6({ input: child2.stdout }).on(
|
|
28497
28580
|
"line",
|
|
28498
28581
|
(line) => routeCodexRpcLine(line, pending)
|
|
28499
28582
|
);
|
|
@@ -28501,7 +28584,7 @@ async function openCodexAppServer(homeDir) {
|
|
|
28501
28584
|
() => failAll(new Error("codex app-server did not respond in time")),
|
|
28502
28585
|
TIMEOUT_MS3
|
|
28503
28586
|
);
|
|
28504
|
-
const server = createCodexRpcClient(
|
|
28587
|
+
const server = createCodexRpcClient(child2, pending, timer);
|
|
28505
28588
|
try {
|
|
28506
28589
|
await server.call("initialize", {
|
|
28507
28590
|
clientInfo: { name: "assist", version: "0" }
|
|
@@ -28510,7 +28593,7 @@ async function openCodexAppServer(homeDir) {
|
|
|
28510
28593
|
server.close();
|
|
28511
28594
|
throw startupError(error);
|
|
28512
28595
|
}
|
|
28513
|
-
|
|
28596
|
+
child2.stdin.write(`${JSON.stringify({ method: "initialized" })}
|
|
28514
28597
|
`);
|
|
28515
28598
|
return server;
|
|
28516
28599
|
}
|
|
@@ -32680,9 +32763,9 @@ function buildTree(csprojPath, repoRoot3, visited = /* @__PURE__ */ new Set()) {
|
|
|
32680
32763
|
function collectAllDeps(node) {
|
|
32681
32764
|
const result = /* @__PURE__ */ new Set();
|
|
32682
32765
|
function walk2(n) {
|
|
32683
|
-
for (const
|
|
32684
|
-
result.add(
|
|
32685
|
-
walk2(
|
|
32766
|
+
for (const child2 of n.children) {
|
|
32767
|
+
result.add(child2.path);
|
|
32768
|
+
walk2(child2);
|
|
32686
32769
|
}
|
|
32687
32770
|
}
|
|
32688
32771
|
walk2(node);
|
|
@@ -32768,9 +32851,9 @@ ${totalCount} projects total (including root)`));
|
|
|
32768
32851
|
console.log();
|
|
32769
32852
|
}
|
|
32770
32853
|
function nodesToJson(node) {
|
|
32771
|
-
return node.children.map((
|
|
32772
|
-
project:
|
|
32773
|
-
dependencies: nodesToJson(
|
|
32854
|
+
return node.children.map((child2) => ({
|
|
32855
|
+
project: child2.relativePath,
|
|
32856
|
+
dependencies: nodesToJson(child2)
|
|
32774
32857
|
}));
|
|
32775
32858
|
}
|
|
32776
32859
|
function printJson(tree, totalCount, solutions) {
|
|
@@ -34280,7 +34363,7 @@ function parseIssueNode(node) {
|
|
|
34280
34363
|
repo,
|
|
34281
34364
|
typeName: raw.issueType?.name ?? null,
|
|
34282
34365
|
labels: (raw.labels?.nodes ?? []).filter((label) => label !== null),
|
|
34283
|
-
childIds: (raw.subIssues?.nodes ?? []).filter((
|
|
34366
|
+
childIds: (raw.subIssues?.nodes ?? []).filter((child2) => child2 !== null).map((child2) => child2.id)
|
|
34284
34367
|
};
|
|
34285
34368
|
}
|
|
34286
34369
|
|
|
@@ -34368,7 +34451,7 @@ function orderDepthFirst(issues) {
|
|
|
34368
34451
|
const ordered = [];
|
|
34369
34452
|
const visit2 = (issue) => {
|
|
34370
34453
|
ordered.push(issue);
|
|
34371
|
-
for (const
|
|
34454
|
+
for (const child2 of byParent.get(issue.id) ?? []) visit2(child2);
|
|
34372
34455
|
};
|
|
34373
34456
|
for (const root2 of byParent.get(null) ?? []) visit2(root2);
|
|
34374
34457
|
return ordered;
|
|
@@ -35591,17 +35674,17 @@ async function previewIssueEdit(number, repo, fresh, body) {
|
|
|
35591
35674
|
// src/commands/github/issue/setIssueParent.ts
|
|
35592
35675
|
function setIssueParent(number, repo, parentArg) {
|
|
35593
35676
|
const target = resolveIssueRepoTarget(repo);
|
|
35594
|
-
const
|
|
35677
|
+
const child2 = `${target.owner}/${target.repo}#${number}`;
|
|
35595
35678
|
try {
|
|
35596
35679
|
const childId = fetchIssueNodeId({ ...target, number });
|
|
35597
35680
|
const parent = resolveCreateIssueParent(target, parentArg);
|
|
35598
35681
|
addSubIssue(parent.id, childId);
|
|
35599
35682
|
console.log(
|
|
35600
|
-
`${
|
|
35683
|
+
`${child2} is now a sub-issue of ${parent.owner}/${parent.repo}#${parent.number}`
|
|
35601
35684
|
);
|
|
35602
35685
|
} catch (error) {
|
|
35603
35686
|
const message4 = error instanceof Error ? error.message : String(error);
|
|
35604
|
-
console.error(`Setting the parent of ${
|
|
35687
|
+
console.error(`Setting the parent of ${child2} failed: ${message4}`);
|
|
35605
35688
|
process.exit(1);
|
|
35606
35689
|
}
|
|
35607
35690
|
}
|
|
@@ -36450,15 +36533,15 @@ function renderNodes(nodes, indent4) {
|
|
|
36450
36533
|
function isListNode(node) {
|
|
36451
36534
|
return node.type === "orderedList" || node.type === "bulletList";
|
|
36452
36535
|
}
|
|
36453
|
-
function renderListChild(
|
|
36454
|
-
if (isListNode(
|
|
36455
|
-
if (
|
|
36456
|
-
const text19 = renderChildren(
|
|
36536
|
+
function renderListChild(child2, indent4, pad3, marker2, isFirst) {
|
|
36537
|
+
if (isListNode(child2)) return renderNodes([child2], indent4 + 1);
|
|
36538
|
+
if (child2.type !== "paragraph") return renderNode(child2, indent4);
|
|
36539
|
+
const text19 = renderChildren(child2, indent4);
|
|
36457
36540
|
return isFirst ? `${pad3}${marker2} ${text19}` : `${pad3} ${text19}`;
|
|
36458
36541
|
}
|
|
36459
36542
|
function renderListItem(node, indent4, marker2) {
|
|
36460
36543
|
const pad3 = " ".repeat(indent4);
|
|
36461
|
-
return (node.content ?? []).map((
|
|
36544
|
+
return (node.content ?? []).map((child2, i) => renderListChild(child2, indent4, pad3, marker2, i === 0)).join("\n");
|
|
36462
36545
|
}
|
|
36463
36546
|
function adfToText(doc) {
|
|
36464
36547
|
return renderNodes([doc], 0);
|
|
@@ -36789,6 +36872,7 @@ var persistedSessionSchema = z21.object({
|
|
|
36789
36872
|
divergenceEscalation: z21.boolean().optional(),
|
|
36790
36873
|
design: z21.boolean().optional(),
|
|
36791
36874
|
auto: z21.boolean().optional(),
|
|
36875
|
+
model: z21.string().optional(),
|
|
36792
36876
|
autoAdvance: z21.boolean().optional(),
|
|
36793
36877
|
autoApprove: z21.boolean().optional(),
|
|
36794
36878
|
reviewStarted: z21.boolean().optional(),
|
|
@@ -36825,6 +36909,7 @@ function toPersistedSession(session) {
|
|
|
36825
36909
|
divergenceEscalation: session.divergenceEscalation,
|
|
36826
36910
|
design: session.design,
|
|
36827
36911
|
auto: session.auto,
|
|
36912
|
+
model: session.model,
|
|
36828
36913
|
autoAdvance: session.autoAdvance,
|
|
36829
36914
|
autoApprove: session.autoApprove,
|
|
36830
36915
|
reviewStarted: session.reviewStarted,
|
|
@@ -36969,26 +37054,26 @@ function quoteForPosixShell(value) {
|
|
|
36969
37054
|
// src/commands/sessions/daemon/worktree/stopInstall.ts
|
|
36970
37055
|
import { execFile as execFile14 } from "child_process";
|
|
36971
37056
|
var running2 = /* @__PURE__ */ new Map();
|
|
36972
|
-
function trackInstall(worktreePath,
|
|
37057
|
+
function trackInstall(worktreePath, child2) {
|
|
36973
37058
|
const children = running2.get(worktreePath) ?? /* @__PURE__ */ new Set();
|
|
36974
|
-
children.add(
|
|
37059
|
+
children.add(child2);
|
|
36975
37060
|
running2.set(worktreePath, children);
|
|
36976
37061
|
}
|
|
36977
|
-
function untrackInstall(worktreePath,
|
|
37062
|
+
function untrackInstall(worktreePath, child2) {
|
|
36978
37063
|
const children = running2.get(worktreePath);
|
|
36979
|
-
if (!children?.delete(
|
|
37064
|
+
if (!children?.delete(child2)) return false;
|
|
36980
37065
|
if (children.size === 0) running2.delete(worktreePath);
|
|
36981
37066
|
return true;
|
|
36982
37067
|
}
|
|
36983
37068
|
function stopInstall(worktreePath) {
|
|
36984
37069
|
const children = running2.get(worktreePath);
|
|
36985
37070
|
running2.delete(worktreePath);
|
|
36986
|
-
for (const
|
|
36987
|
-
if (!
|
|
37071
|
+
for (const child2 of children ?? []) {
|
|
37072
|
+
if (!child2.pid) continue;
|
|
36988
37073
|
daemonLog(
|
|
36989
|
-
`worktree ${worktreePath} install still running at teardown; killing pid ${
|
|
37074
|
+
`worktree ${worktreePath} install still running at teardown; killing pid ${child2.pid} so removal is not racing it`
|
|
36990
37075
|
);
|
|
36991
|
-
killTree(
|
|
37076
|
+
killTree(child2.pid);
|
|
36992
37077
|
}
|
|
36993
37078
|
}
|
|
36994
37079
|
function killTree(pid) {
|
|
@@ -37016,25 +37101,25 @@ function killTree(pid) {
|
|
|
37016
37101
|
var STDERR_TAIL = 2e3;
|
|
37017
37102
|
function spawnInstall(worktreePath, cwd, command, where, onDone) {
|
|
37018
37103
|
daemonLog(`worktree ${worktreePath} installing deps${where}: ${command}`);
|
|
37019
|
-
const
|
|
37020
|
-
trackInstall(worktreePath,
|
|
37104
|
+
const child2 = spawn10(...installInvocation(cwd, command));
|
|
37105
|
+
trackInstall(worktreePath, child2);
|
|
37021
37106
|
let stderr = "";
|
|
37022
|
-
|
|
37107
|
+
child2.stderr?.on("data", (chunk2) => {
|
|
37023
37108
|
stderr = (stderr + chunk2.toString()).slice(-STDERR_TAIL);
|
|
37024
37109
|
});
|
|
37025
37110
|
let settled = false;
|
|
37026
37111
|
const settle = (ok, outcome) => {
|
|
37027
37112
|
if (settled) return;
|
|
37028
37113
|
settled = true;
|
|
37029
|
-
const stopped = !untrackInstall(worktreePath,
|
|
37114
|
+
const stopped = !untrackInstall(worktreePath, child2);
|
|
37030
37115
|
daemonLog(`worktree ${worktreePath} install${where} ${outcome}`);
|
|
37031
37116
|
onDone({ ok, stopped });
|
|
37032
37117
|
};
|
|
37033
|
-
|
|
37118
|
+
child2.on(
|
|
37034
37119
|
"error",
|
|
37035
37120
|
(error) => settle(false, `failed to start: ${error.message}`)
|
|
37036
37121
|
);
|
|
37037
|
-
|
|
37122
|
+
child2.on(
|
|
37038
37123
|
"close",
|
|
37039
37124
|
(code, signal) => settle(
|
|
37040
37125
|
code === 0,
|
|
@@ -37507,7 +37592,7 @@ function registerReviewPrComments(program, resumeFlag) {
|
|
|
37507
37592
|
}
|
|
37508
37593
|
|
|
37509
37594
|
// src/commands/registerDescriptionLaunch.ts
|
|
37510
|
-
var harnessFlag = (feature) => `Coding harness to launch (claude|codex|pi); defaults to the configured harness.engine. Exits with the reasons, without launching, when ${feature.label} is unavailable on it`;
|
|
37595
|
+
var harnessFlag = (feature) => `Coding harness to launch (claude|codex|pi); defaults to the configured harness.defaults.<command>.harness, then harness.engine. Exits with the reasons, without launching, when ${feature.label} is unavailable on it`;
|
|
37511
37596
|
function registerDescriptionLaunch(program, name2, slashCommand, description, feature, resumeFlag, alias) {
|
|
37512
37597
|
const command = program.command(name2).argument(
|
|
37513
37598
|
"[description]",
|
|
@@ -37517,11 +37602,11 @@ function registerDescriptionLaunch(program, name2, slashCommand, description, fe
|
|
|
37517
37602
|
once: opts.once,
|
|
37518
37603
|
description: text19,
|
|
37519
37604
|
resumeSessionId: opts.resumeSession,
|
|
37520
|
-
harness: resolveHarness2(opts.harness),
|
|
37605
|
+
harness: resolveHarness2(opts.harness, name2),
|
|
37521
37606
|
feature
|
|
37522
37607
|
})
|
|
37523
37608
|
);
|
|
37524
|
-
configHelp(command, harnessConfigHelp);
|
|
37609
|
+
configHelp(command, [...harnessConfigHelp, ...harnessDefaultsConfigHelp]);
|
|
37525
37610
|
if (alias) command.alias(alias);
|
|
37526
37611
|
}
|
|
37527
37612
|
|
|
@@ -38571,8 +38656,8 @@ function visitObjects(root2, fn) {
|
|
|
38571
38656
|
if (v == null || typeof v !== "object") continue;
|
|
38572
38657
|
const o = asObject(v);
|
|
38573
38658
|
if (o) fn(o);
|
|
38574
|
-
for (const
|
|
38575
|
-
if (
|
|
38659
|
+
for (const child2 of Array.isArray(v) ? v : Object.values(v)) {
|
|
38660
|
+
if (child2 && typeof child2 === "object") stack.push(child2);
|
|
38576
38661
|
}
|
|
38577
38662
|
}
|
|
38578
38663
|
}
|
|
@@ -43257,19 +43342,19 @@ function getViolations(pattern2, options2 = {}, maxLines = DEFAULT_MAX_LINES2) {
|
|
|
43257
43342
|
// src/commands/refactor/check.ts
|
|
43258
43343
|
function runScript(script, cwd) {
|
|
43259
43344
|
return new Promise((resolve35) => {
|
|
43260
|
-
const
|
|
43345
|
+
const child2 = spawn11("npm", ["run", script], {
|
|
43261
43346
|
stdio: "pipe",
|
|
43262
43347
|
shell: true,
|
|
43263
43348
|
cwd
|
|
43264
43349
|
});
|
|
43265
43350
|
let output = "";
|
|
43266
|
-
|
|
43351
|
+
child2.stdout?.on("data", (data) => {
|
|
43267
43352
|
output += data.toString();
|
|
43268
43353
|
});
|
|
43269
|
-
|
|
43354
|
+
child2.stderr?.on("data", (data) => {
|
|
43270
43355
|
output += data.toString();
|
|
43271
43356
|
});
|
|
43272
|
-
|
|
43357
|
+
child2.on("close", (code) => {
|
|
43273
43358
|
resolve35({ script, code: code ?? 1, output });
|
|
43274
43359
|
});
|
|
43275
43360
|
});
|
|
@@ -45118,9 +45203,9 @@ import path90 from "path";
|
|
|
45118
45203
|
function insert(root2, parts2) {
|
|
45119
45204
|
let node = root2;
|
|
45120
45205
|
for (const part of parts2) {
|
|
45121
|
-
const
|
|
45122
|
-
node.set(part,
|
|
45123
|
-
node =
|
|
45206
|
+
const child2 = node.get(part) ?? /* @__PURE__ */ new Map();
|
|
45207
|
+
node.set(part, child2);
|
|
45208
|
+
node = child2;
|
|
45124
45209
|
}
|
|
45125
45210
|
}
|
|
45126
45211
|
function render(node, indent4, lines) {
|
|
@@ -45128,9 +45213,9 @@ function render(node, indent4, lines) {
|
|
|
45128
45213
|
const dirFirst = Number(cb.size > 0) - Number(ca.size > 0);
|
|
45129
45214
|
return dirFirst || a.localeCompare(b);
|
|
45130
45215
|
});
|
|
45131
|
-
for (const [name2,
|
|
45132
|
-
lines.push(`${indent4}${name2}${
|
|
45133
|
-
render(
|
|
45216
|
+
for (const [name2, child2] of entries) {
|
|
45217
|
+
lines.push(`${indent4}${name2}${child2.size > 0 ? "/" : ""}`);
|
|
45218
|
+
render(child2, `${indent4} `, lines);
|
|
45134
45219
|
}
|
|
45135
45220
|
}
|
|
45136
45221
|
function formatTree(files, scopeRoot) {
|
|
@@ -45646,7 +45731,7 @@ function byName(a, b) {
|
|
|
45646
45731
|
}
|
|
45647
45732
|
function nodesOf(at2, prefix2) {
|
|
45648
45733
|
const dirs = [...at2.dirs].map(
|
|
45649
|
-
([name2,
|
|
45734
|
+
([name2, child2]) => collapsedDirNode(name2, child2, prefix2)
|
|
45650
45735
|
);
|
|
45651
45736
|
const files = at2.files.map((file) => ({
|
|
45652
45737
|
kind: "file",
|
|
@@ -45660,10 +45745,10 @@ function collapsedDirNode(name2, at2, prefix2) {
|
|
|
45660
45745
|
let path118 = prefix2 ? `${prefix2}/${name2}` : name2;
|
|
45661
45746
|
let node = at2;
|
|
45662
45747
|
while (node.files.length === 0 && node.dirs.size === 1) {
|
|
45663
|
-
const [childName,
|
|
45748
|
+
const [childName, child2] = [...node.dirs][0];
|
|
45664
45749
|
label = `${label}/${childName}`;
|
|
45665
45750
|
path118 = `${path118}/${childName}`;
|
|
45666
|
-
node =
|
|
45751
|
+
node = child2;
|
|
45667
45752
|
}
|
|
45668
45753
|
const children = nodesOf(node, path118);
|
|
45669
45754
|
return {
|
|
@@ -46443,8 +46528,8 @@ function changedLines(call, changed) {
|
|
|
46443
46528
|
// src/commands/review/highLevel/extractTestHierarchy.ts
|
|
46444
46529
|
function collect7(node, context) {
|
|
46445
46530
|
const found = [];
|
|
46446
|
-
node.forEachChild((
|
|
46447
|
-
found.push(...visit(
|
|
46531
|
+
node.forEachChild((child2) => {
|
|
46532
|
+
found.push(...visit(child2, context));
|
|
46448
46533
|
});
|
|
46449
46534
|
return found;
|
|
46450
46535
|
}
|
|
@@ -47075,7 +47160,7 @@ function formatNode(node, indent4) {
|
|
|
47075
47160
|
const dir = node;
|
|
47076
47161
|
return [
|
|
47077
47162
|
`${indent4}${chalk268.bold(`${dir.name}/`)} ${chalk268.dim(counts(dir.additions, dir.deletions))}`,
|
|
47078
|
-
...dir.children.flatMap((
|
|
47163
|
+
...dir.children.flatMap((child2) => formatNode(child2, `${indent4} `))
|
|
47079
47164
|
];
|
|
47080
47165
|
}
|
|
47081
47166
|
function formatHighLevelStructure(structure) {
|
|
@@ -47100,7 +47185,7 @@ function formatNode2(node, depth) {
|
|
|
47100
47185
|
return [`${indent4}${chalk269.dim(changeMarker(node.change))} ${node.name}`];
|
|
47101
47186
|
return [
|
|
47102
47187
|
`${indent4}${chalk269.bold(node.name)}`,
|
|
47103
|
-
...node.children.flatMap((
|
|
47188
|
+
...node.children.flatMap((child2) => formatNode2(child2, depth + 1))
|
|
47104
47189
|
];
|
|
47105
47190
|
}
|
|
47106
47191
|
function formatHighLevelTests(files, testPaths) {
|
|
@@ -55025,129 +55110,6 @@ var ClientHub = class extends Set {
|
|
|
55025
55110
|
};
|
|
55026
55111
|
};
|
|
55027
55112
|
|
|
55028
|
-
// src/commands/sessions/daemon/designSystemPromptPath.ts
|
|
55029
|
-
import * as path117 from "path";
|
|
55030
|
-
import { fileURLToPath as fileURLToPath11 } from "url";
|
|
55031
|
-
var __filename6 = fileURLToPath11(import.meta.url);
|
|
55032
|
-
var __dirname7 = path117.dirname(__filename6);
|
|
55033
|
-
function designSystemPromptPath() {
|
|
55034
|
-
return path117.join(__dirname7, "..", "claude", "design-system-prompt.md");
|
|
55035
|
-
}
|
|
55036
|
-
|
|
55037
|
-
// src/commands/sessions/daemon/sessionModeLaunch.ts
|
|
55038
|
-
function sessionModeLaunch(adapter, { design, auto }) {
|
|
55039
|
-
if (!design) return { auto };
|
|
55040
|
-
const blocker = launchBlocker(adapter, designFeature);
|
|
55041
|
-
if (blocker) {
|
|
55042
|
-
daemonLog(
|
|
55043
|
-
`design: launching without the design prompt, ${blocker.replaceAll("\n", " ")}`
|
|
55044
|
-
);
|
|
55045
|
-
return { auto };
|
|
55046
|
-
}
|
|
55047
|
-
return { appendSystemPromptFile: designSystemPromptPath(), auto: true };
|
|
55048
|
-
}
|
|
55049
|
-
|
|
55050
|
-
// src/commands/sessions/daemon/resolveRunConfig.ts
|
|
55051
|
-
function resolveRunConfig(name2, cwd) {
|
|
55052
|
-
try {
|
|
55053
|
-
const { run: run5 } = loadConfigFrom(cwd);
|
|
55054
|
-
const configs = resolveRunConfigs(run5, runConfigBaseDirFrom(cwd));
|
|
55055
|
-
const exact = configs.find((r) => r.name === name2);
|
|
55056
|
-
if (exact) return exact;
|
|
55057
|
-
const suffixMatches = configs.filter((r) => r.name.endsWith(`:${name2}`));
|
|
55058
|
-
return suffixMatches.length === 1 ? suffixMatches[0] : void 0;
|
|
55059
|
-
} catch {
|
|
55060
|
-
return void 0;
|
|
55061
|
-
}
|
|
55062
|
-
}
|
|
55063
|
-
|
|
55064
|
-
// src/commands/sessions/daemon/serverRunMeta.ts
|
|
55065
|
-
var DEFAULT_SERVER_GROUP = "default";
|
|
55066
|
-
function serverRunMeta(runName, cwd) {
|
|
55067
|
-
const dir = cwd ?? process.cwd();
|
|
55068
|
-
const config = resolveRunConfig(runName, dir);
|
|
55069
|
-
if (!config?.server) return { server: false };
|
|
55070
|
-
return {
|
|
55071
|
-
server: true,
|
|
55072
|
-
group: typeof config.server === "string" ? config.server : DEFAULT_SERVER_GROUP,
|
|
55073
|
-
port: config.port,
|
|
55074
|
-
protocol: config.protocol,
|
|
55075
|
-
path: config.path,
|
|
55076
|
-
origin: getCurrentOrigin(dir)
|
|
55077
|
-
};
|
|
55078
|
-
}
|
|
55079
|
-
|
|
55080
|
-
// src/commands/sessions/daemon/spawnRun.ts
|
|
55081
|
-
function spawnRun(opts) {
|
|
55082
|
-
return spawnPty(["assist", "run", opts.name, ...opts.args ?? []], opts.cwd);
|
|
55083
|
-
}
|
|
55084
|
-
|
|
55085
|
-
// src/commands/sessions/daemon/startOrHoldPty.ts
|
|
55086
|
-
function startOrHoldPty(start2, hold) {
|
|
55087
|
-
if (hold) return { pty: null, pendingStart: start2 };
|
|
55088
|
-
return { pty: start2() };
|
|
55089
|
-
}
|
|
55090
|
-
|
|
55091
|
-
// src/commands/sessions/daemon/sessionBase.ts
|
|
55092
|
-
function sessionBase(id, status2) {
|
|
55093
|
-
const startedAt = Date.now();
|
|
55094
|
-
return {
|
|
55095
|
-
id,
|
|
55096
|
-
status: status2,
|
|
55097
|
-
startedAt,
|
|
55098
|
-
runningMs: 0,
|
|
55099
|
-
/* why: runningMs counts only running stretches, so a session that starts
|
|
55100
|
-
* waiting (idle, awaiting first input) has no open stretch to stamp. */
|
|
55101
|
-
runningSince: status2 === "running" ? startedAt : null,
|
|
55102
|
-
waitingSince: status2 === "waiting" ? startedAt : null,
|
|
55103
|
-
scrollback: ""
|
|
55104
|
-
};
|
|
55105
|
-
}
|
|
55106
|
-
|
|
55107
|
-
// src/commands/sessions/daemon/createSession.ts
|
|
55108
|
-
function createSession(id, { prompt, cwd, design, auto, harness, holdPty } = {}) {
|
|
55109
|
-
const adapter = harnessAdapter(harness);
|
|
55110
|
-
const conversationId = preassignedId(adapter);
|
|
55111
|
-
return {
|
|
55112
|
-
...sessionBase(id, prompt ? "running" : "waiting"),
|
|
55113
|
-
name: `Session ${id}`,
|
|
55114
|
-
commandType: "claude",
|
|
55115
|
-
...adapter.activityIdentity(conversationId),
|
|
55116
|
-
...startOrHoldPty(
|
|
55117
|
-
() => adapter.interactive({
|
|
55118
|
-
prompt,
|
|
55119
|
-
cwd,
|
|
55120
|
-
sessionId: id,
|
|
55121
|
-
conversationId,
|
|
55122
|
-
...sessionModeLaunch(adapter, { design, auto })
|
|
55123
|
-
}),
|
|
55124
|
-
holdPty
|
|
55125
|
-
),
|
|
55126
|
-
cwd,
|
|
55127
|
-
initialPrompt: prompt,
|
|
55128
|
-
design,
|
|
55129
|
-
auto
|
|
55130
|
-
};
|
|
55131
|
-
}
|
|
55132
|
-
function createRunSession(id, { runName, runArgs, cwd, meta }) {
|
|
55133
|
-
const serverMeta = meta ?? serverRunMeta(runName, cwd);
|
|
55134
|
-
return {
|
|
55135
|
-
...sessionBase(id, "running"),
|
|
55136
|
-
name: `run: ${runName}`,
|
|
55137
|
-
commandType: "run",
|
|
55138
|
-
pty: spawnRun({ name: runName, args: runArgs, cwd }),
|
|
55139
|
-
runName,
|
|
55140
|
-
runArgs,
|
|
55141
|
-
cwd,
|
|
55142
|
-
server: serverMeta.server || void 0,
|
|
55143
|
-
serverPort: serverMeta.port,
|
|
55144
|
-
serverProtocol: serverMeta.protocol,
|
|
55145
|
-
serverPath: serverMeta.path,
|
|
55146
|
-
serverOrigin: serverMeta.origin,
|
|
55147
|
-
serverGroup: serverMeta.group
|
|
55148
|
-
};
|
|
55149
|
-
}
|
|
55150
|
-
|
|
55151
55113
|
// src/commands/sessions/daemon/autoUpdate/autoUpdateControl.ts
|
|
55152
55114
|
import { existsSync as existsSync99, rmSync as rmSync15, writeFileSync as writeFileSync64 } from "fs";
|
|
55153
55115
|
var paused;
|
|
@@ -55330,16 +55292,98 @@ function trimWatcherLog(cwd) {
|
|
|
55330
55292
|
|
|
55331
55293
|
// src/commands/sessions/daemon/worktree/appendWatcherLog.ts
|
|
55332
55294
|
import { appendFileSync as appendFileSync4, mkdirSync as mkdirSync45 } from "fs";
|
|
55333
|
-
import { dirname as
|
|
55295
|
+
import { dirname as dirname54 } from "path";
|
|
55334
55296
|
function appendWatcherLog(cwd, data) {
|
|
55335
55297
|
try {
|
|
55336
55298
|
const path118 = watcherLogPath(cwd);
|
|
55337
|
-
mkdirSync45(
|
|
55299
|
+
mkdirSync45(dirname54(path118), { recursive: true });
|
|
55338
55300
|
appendFileSync4(path118, data);
|
|
55339
55301
|
} catch {
|
|
55340
55302
|
}
|
|
55341
55303
|
}
|
|
55342
55304
|
|
|
55305
|
+
// src/commands/sessions/daemon/designSystemPromptPath.ts
|
|
55306
|
+
import * as path117 from "path";
|
|
55307
|
+
import { fileURLToPath as fileURLToPath11 } from "url";
|
|
55308
|
+
var __filename6 = fileURLToPath11(import.meta.url);
|
|
55309
|
+
var __dirname7 = path117.dirname(__filename6);
|
|
55310
|
+
function designSystemPromptPath() {
|
|
55311
|
+
return path117.join(__dirname7, "..", "claude", "design-system-prompt.md");
|
|
55312
|
+
}
|
|
55313
|
+
|
|
55314
|
+
// src/commands/sessions/daemon/sessionModeLaunch.ts
|
|
55315
|
+
function sessionModeLaunch(adapter, { design, auto, model }) {
|
|
55316
|
+
return model ? { ...designLaunch(adapter, design, auto), model } : designLaunch(adapter, design, auto);
|
|
55317
|
+
}
|
|
55318
|
+
function designLaunch(adapter, design, auto) {
|
|
55319
|
+
if (!design) return { auto };
|
|
55320
|
+
const blocker = launchBlocker(adapter, designFeature);
|
|
55321
|
+
if (blocker) {
|
|
55322
|
+
daemonLog(
|
|
55323
|
+
`design: launching without the design prompt, ${blocker.replaceAll("\n", " ")}`
|
|
55324
|
+
);
|
|
55325
|
+
return { auto };
|
|
55326
|
+
}
|
|
55327
|
+
return { appendSystemPromptFile: designSystemPromptPath(), auto: true };
|
|
55328
|
+
}
|
|
55329
|
+
|
|
55330
|
+
// src/commands/sessions/daemon/startOrHoldPty.ts
|
|
55331
|
+
function startOrHoldPty(start2, hold) {
|
|
55332
|
+
if (hold) return { pty: null, pendingStart: start2 };
|
|
55333
|
+
return { pty: start2() };
|
|
55334
|
+
}
|
|
55335
|
+
|
|
55336
|
+
// src/commands/sessions/daemon/sessionBase.ts
|
|
55337
|
+
function sessionBase(id, status2) {
|
|
55338
|
+
const startedAt = Date.now();
|
|
55339
|
+
return {
|
|
55340
|
+
id,
|
|
55341
|
+
status: status2,
|
|
55342
|
+
startedAt,
|
|
55343
|
+
runningMs: 0,
|
|
55344
|
+
/* why: runningMs counts only running stretches, so a session that starts
|
|
55345
|
+
* waiting (idle, awaiting first input) has no open stretch to stamp. */
|
|
55346
|
+
runningSince: status2 === "running" ? startedAt : null,
|
|
55347
|
+
waitingSince: status2 === "waiting" ? startedAt : null,
|
|
55348
|
+
scrollback: ""
|
|
55349
|
+
};
|
|
55350
|
+
}
|
|
55351
|
+
|
|
55352
|
+
// src/commands/sessions/daemon/createSession.ts
|
|
55353
|
+
function createSession(id, {
|
|
55354
|
+
prompt,
|
|
55355
|
+
cwd,
|
|
55356
|
+
design,
|
|
55357
|
+
auto,
|
|
55358
|
+
harness,
|
|
55359
|
+
model,
|
|
55360
|
+
holdPty
|
|
55361
|
+
} = {}) {
|
|
55362
|
+
const adapter = harnessAdapter(harness);
|
|
55363
|
+
const conversationId = preassignedId(adapter);
|
|
55364
|
+
return {
|
|
55365
|
+
...sessionBase(id, prompt ? "running" : "waiting"),
|
|
55366
|
+
name: `Session ${id}`,
|
|
55367
|
+
commandType: "claude",
|
|
55368
|
+
...adapter.activityIdentity(conversationId),
|
|
55369
|
+
...startOrHoldPty(
|
|
55370
|
+
() => adapter.interactive({
|
|
55371
|
+
prompt,
|
|
55372
|
+
cwd,
|
|
55373
|
+
sessionId: id,
|
|
55374
|
+
conversationId,
|
|
55375
|
+
...sessionModeLaunch(adapter, { design, auto, model })
|
|
55376
|
+
}),
|
|
55377
|
+
holdPty
|
|
55378
|
+
),
|
|
55379
|
+
cwd,
|
|
55380
|
+
initialPrompt: prompt,
|
|
55381
|
+
design,
|
|
55382
|
+
auto,
|
|
55383
|
+
model
|
|
55384
|
+
};
|
|
55385
|
+
}
|
|
55386
|
+
|
|
55343
55387
|
// src/commands/sessions/daemon/worktree/detectExistingWorktree.ts
|
|
55344
55388
|
function detectExistingWorktree(cwd) {
|
|
55345
55389
|
const repoRoot3 = findRepoRoot(cwd) ?? cwd;
|
|
@@ -55643,7 +55687,7 @@ function runUpdateLap(cwd, onOutput) {
|
|
|
55643
55687
|
clearLapSignals(cwd);
|
|
55644
55688
|
return new Promise((resolve35, reject) => {
|
|
55645
55689
|
const { ASSIST_ACTIVITY_ID: _activity, ...env } = process.env;
|
|
55646
|
-
const
|
|
55690
|
+
const child2 = spawn13(
|
|
55647
55691
|
process.execPath,
|
|
55648
55692
|
[process.argv[1], ...WATCH_LAP_ARGS],
|
|
55649
55693
|
{
|
|
@@ -55654,16 +55698,16 @@ function runUpdateLap(cwd, onOutput) {
|
|
|
55654
55698
|
}
|
|
55655
55699
|
);
|
|
55656
55700
|
const killWithDaemon = () => {
|
|
55657
|
-
|
|
55701
|
+
child2.kill();
|
|
55658
55702
|
};
|
|
55659
55703
|
process.on("exit", killWithDaemon);
|
|
55660
|
-
|
|
55661
|
-
|
|
55662
|
-
|
|
55704
|
+
child2.stdout.on("data", (chunk2) => onOutput(chunk2.toString()));
|
|
55705
|
+
child2.stderr.on("data", (chunk2) => onOutput(chunk2.toString()));
|
|
55706
|
+
child2.on("close", (code, signal) => {
|
|
55663
55707
|
process.off("exit", killWithDaemon);
|
|
55664
55708
|
resolve35({ code, signal });
|
|
55665
55709
|
});
|
|
55666
|
-
|
|
55710
|
+
child2.on("error", (error) => {
|
|
55667
55711
|
process.off("exit", killWithDaemon);
|
|
55668
55712
|
reject(error);
|
|
55669
55713
|
});
|
|
@@ -55729,10 +55773,10 @@ function treeUnderClose(session) {
|
|
|
55729
55773
|
}
|
|
55730
55774
|
|
|
55731
55775
|
// src/commands/sessions/daemon/closeChildServerRuns.ts
|
|
55732
|
-
function isChildServerRun(
|
|
55733
|
-
if (!
|
|
55734
|
-
if (
|
|
55735
|
-
return !!parent.worktree && treeUnderClose(
|
|
55776
|
+
function isChildServerRun(child2, parent) {
|
|
55777
|
+
if (!child2.server || child2.id === parent.id) return false;
|
|
55778
|
+
if (child2.launchedFrom === parent.id) return true;
|
|
55779
|
+
return !!parent.worktree && treeUnderClose(child2)?.path === parent.worktree.path;
|
|
55736
55780
|
}
|
|
55737
55781
|
function closeChildServerRuns(sessions, parentId, close) {
|
|
55738
55782
|
const parent = sessions.get(parentId);
|
|
@@ -55740,9 +55784,9 @@ function closeChildServerRuns(sessions, parentId, close) {
|
|
|
55740
55784
|
const children = [...sessions.values()].filter(
|
|
55741
55785
|
(s) => isChildServerRun(s, parent)
|
|
55742
55786
|
);
|
|
55743
|
-
for (const
|
|
55744
|
-
daemonLog(`closing server run ${
|
|
55745
|
-
close(
|
|
55787
|
+
for (const child2 of children) {
|
|
55788
|
+
daemonLog(`closing server run ${child2.id} with ${parentId}`);
|
|
55789
|
+
close(child2.id);
|
|
55746
55790
|
}
|
|
55747
55791
|
}
|
|
55748
55792
|
|
|
@@ -57012,6 +57056,22 @@ function emitSessionOutput(session, clients, data) {
|
|
|
57012
57056
|
// src/commands/sessions/daemon/exitReason.ts
|
|
57013
57057
|
import { existsSync as existsSync105 } from "fs";
|
|
57014
57058
|
import { resolve as resolve34 } from "path";
|
|
57059
|
+
|
|
57060
|
+
// src/commands/sessions/daemon/resolveRunConfig.ts
|
|
57061
|
+
function resolveRunConfig(name2, cwd) {
|
|
57062
|
+
try {
|
|
57063
|
+
const { run: run5 } = loadConfigFrom(cwd);
|
|
57064
|
+
const configs = resolveRunConfigs(run5, runConfigBaseDirFrom(cwd));
|
|
57065
|
+
const exact = configs.find((r) => r.name === name2);
|
|
57066
|
+
if (exact) return exact;
|
|
57067
|
+
const suffixMatches = configs.filter((r) => r.name.endsWith(`:${name2}`));
|
|
57068
|
+
return suffixMatches.length === 1 ? suffixMatches[0] : void 0;
|
|
57069
|
+
} catch {
|
|
57070
|
+
return void 0;
|
|
57071
|
+
}
|
|
57072
|
+
}
|
|
57073
|
+
|
|
57074
|
+
// src/commands/sessions/daemon/exitReason.ts
|
|
57015
57075
|
function exitDetail(session) {
|
|
57016
57076
|
if (session.cwd && !existsSync105(session.cwd))
|
|
57017
57077
|
return `working directory ${session.cwd} no longer exists`;
|
|
@@ -58637,6 +58697,7 @@ function restoreBase(id, persisted) {
|
|
|
58637
58697
|
divergenceEscalation: persisted.divergenceEscalation,
|
|
58638
58698
|
design: persisted.design,
|
|
58639
58699
|
auto: persisted.auto,
|
|
58700
|
+
model: persisted.model,
|
|
58640
58701
|
autoAdvance: restoredAutoAdvance(id, persisted),
|
|
58641
58702
|
autoApprove: persisted.autoApprove,
|
|
58642
58703
|
reviewStarted: persisted.reviewStarted,
|
|
@@ -58839,6 +58900,7 @@ function createHeld(id, persisted) {
|
|
|
58839
58900
|
design: persisted.design,
|
|
58840
58901
|
auto: persisted.auto,
|
|
58841
58902
|
harness: persisted.harness,
|
|
58903
|
+
model: persisted.model,
|
|
58842
58904
|
holdPty: true
|
|
58843
58905
|
});
|
|
58844
58906
|
return void 0;
|
|
@@ -58990,6 +59052,27 @@ function restoreConversation(adapter, restored, status2) {
|
|
|
58990
59052
|
return plan2.idle ? waitingSession(base, persisted, pty2) : runningSession(base, persisted, pty2);
|
|
58991
59053
|
}
|
|
58992
59054
|
|
|
59055
|
+
// src/commands/sessions/daemon/serverRunMeta.ts
|
|
59056
|
+
var DEFAULT_SERVER_GROUP = "default";
|
|
59057
|
+
function serverRunMeta(runName, cwd) {
|
|
59058
|
+
const dir = cwd ?? process.cwd();
|
|
59059
|
+
const config = resolveRunConfig(runName, dir);
|
|
59060
|
+
if (!config?.server) return { server: false };
|
|
59061
|
+
return {
|
|
59062
|
+
server: true,
|
|
59063
|
+
group: typeof config.server === "string" ? config.server : DEFAULT_SERVER_GROUP,
|
|
59064
|
+
port: config.port,
|
|
59065
|
+
protocol: config.protocol,
|
|
59066
|
+
path: config.path,
|
|
59067
|
+
origin: getCurrentOrigin(dir)
|
|
59068
|
+
};
|
|
59069
|
+
}
|
|
59070
|
+
|
|
59071
|
+
// src/commands/sessions/daemon/spawnRun.ts
|
|
59072
|
+
function spawnRun(opts) {
|
|
59073
|
+
return spawnPty(["assist", "run", opts.name, ...opts.args ?? []], opts.cwd);
|
|
59074
|
+
}
|
|
59075
|
+
|
|
58993
59076
|
// src/commands/sessions/daemon/restoreServerRun.ts
|
|
58994
59077
|
function restoreServerRun(id, persisted, base) {
|
|
58995
59078
|
const { runName } = persisted;
|
|
@@ -60622,7 +60705,7 @@ async function seedBacklogRunActivity(sessions, session, notify2) {
|
|
|
60622
60705
|
}
|
|
60623
60706
|
|
|
60624
60707
|
// src/commands/sessions/daemon/worktree/spawnInTree.ts
|
|
60625
|
-
function spawnInTree(ctx, { prompt, cwd, design, auto, harness, inPlace }, context) {
|
|
60708
|
+
function spawnInTree(ctx, { prompt, cwd, design, auto, harness, model, inPlace }, context) {
|
|
60626
60709
|
return allocateAndBind(
|
|
60627
60710
|
ctx,
|
|
60628
60711
|
cwd,
|
|
@@ -60632,6 +60715,7 @@ function spawnInTree(ctx, { prompt, cwd, design, auto, harness, inPlace }, conte
|
|
|
60632
60715
|
design,
|
|
60633
60716
|
auto,
|
|
60634
60717
|
harness,
|
|
60718
|
+
model,
|
|
60635
60719
|
holdPty: holdUntilSeeded
|
|
60636
60720
|
}),
|
|
60637
60721
|
{ inPlace },
|
|
@@ -60743,6 +60827,26 @@ function resumeInTree(ctx, sessionId2, cwd, name2, harness) {
|
|
|
60743
60827
|
return id;
|
|
60744
60828
|
}
|
|
60745
60829
|
|
|
60830
|
+
// src/commands/sessions/daemon/createRunSession.ts
|
|
60831
|
+
function createRunSession(id, { runName, runArgs, cwd, meta }) {
|
|
60832
|
+
const serverMeta = meta ?? serverRunMeta(runName, cwd);
|
|
60833
|
+
return {
|
|
60834
|
+
...sessionBase(id, "running"),
|
|
60835
|
+
name: `run: ${runName}`,
|
|
60836
|
+
commandType: "run",
|
|
60837
|
+
pty: spawnRun({ name: runName, args: runArgs, cwd }),
|
|
60838
|
+
runName,
|
|
60839
|
+
runArgs,
|
|
60840
|
+
cwd,
|
|
60841
|
+
server: serverMeta.server || void 0,
|
|
60842
|
+
serverPort: serverMeta.port,
|
|
60843
|
+
serverProtocol: serverMeta.protocol,
|
|
60844
|
+
serverPath: serverMeta.path,
|
|
60845
|
+
serverOrigin: serverMeta.origin,
|
|
60846
|
+
serverGroup: serverMeta.group
|
|
60847
|
+
};
|
|
60848
|
+
}
|
|
60849
|
+
|
|
60746
60850
|
// src/commands/sessions/daemon/SessionManager.ts
|
|
60747
60851
|
var SessionManager = class {
|
|
60748
60852
|
constructor(onIdleChange) {
|
|
@@ -62117,22 +62221,27 @@ function spawnAssistCreate(m, d) {
|
|
|
62117
62221
|
return prCheckoutHolder(assistArgs, cwd).then(spawn14);
|
|
62118
62222
|
}
|
|
62119
62223
|
|
|
62120
|
-
// src/commands/sessions/daemon/
|
|
62224
|
+
// src/commands/sessions/daemon/sessionBlocker.ts
|
|
62121
62225
|
function sessionBlocker(harness, design) {
|
|
62122
62226
|
return launchBlocker(
|
|
62123
62227
|
harnessAdapter(harness),
|
|
62124
62228
|
design ? designFeature : sessionFeature
|
|
62125
62229
|
);
|
|
62126
62230
|
}
|
|
62231
|
+
|
|
62232
|
+
// src/commands/sessions/daemon/spawnCreate.ts
|
|
62127
62233
|
function spawnCreate(m, d) {
|
|
62128
62234
|
const design = d.design === true;
|
|
62129
62235
|
const harness = d.harness;
|
|
62130
62236
|
const prompt = d.prompt;
|
|
62131
62237
|
const auto = d.auto === true;
|
|
62238
|
+
const model = typeof d.model === "string" && d.model ? d.model : void 0;
|
|
62132
62239
|
if (design)
|
|
62133
62240
|
daemonLog(`create: design session (cwd=${d.cwd ?? ""})`);
|
|
62134
62241
|
if (harness)
|
|
62135
|
-
daemonLog(
|
|
62242
|
+
daemonLog(
|
|
62243
|
+
`create: ${harness} session${model ? ` on ${model}` : ""} (cwd=${d.cwd ?? ""})`
|
|
62244
|
+
);
|
|
62136
62245
|
const joinSessionId = design ? void 0 : d.joinSessionId;
|
|
62137
62246
|
if (joinSessionId) {
|
|
62138
62247
|
const joined = m.addAgent(joinSessionId, { prompt, harness, auto });
|
|
@@ -62151,6 +62260,7 @@ function spawnCreate(m, d) {
|
|
|
62151
62260
|
design,
|
|
62152
62261
|
auto,
|
|
62153
62262
|
harness,
|
|
62263
|
+
model,
|
|
62154
62264
|
inPlace: d.inPlace === true
|
|
62155
62265
|
},
|
|
62156
62266
|
spawnContextFrom(d)
|
|
@@ -63068,7 +63178,7 @@ function registerSessions(program) {
|
|
|
63068
63178
|
registerOutputCommand(cmd);
|
|
63069
63179
|
registerSetStatusCommand(cmd);
|
|
63070
63180
|
registerNodes(cmd);
|
|
63071
|
-
configHelp(cmd, sessionsConfigHelp);
|
|
63181
|
+
configHelp(cmd, [...sessionsConfigHelp, ...harnessDefaultsConfigHelp]);
|
|
63072
63182
|
}
|
|
63073
63183
|
|
|
63074
63184
|
// src/programRegistrars.ts
|