@staff0rd/assist 0.885.2 → 0.886.1
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/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.886.1",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -5036,7 +5036,6 @@ function docsFeedbackPrompt({
|
|
|
5036
5036
|
// src/commands/sessions/web/docsFeedback/docsFeedbackSchema.ts
|
|
5037
5037
|
import { z as z7 } from "zod";
|
|
5038
5038
|
var docsFeedbackSchema = z7.object({
|
|
5039
|
-
sessionId: z7.string().optional(),
|
|
5040
5039
|
pageId: z7.string().min(1),
|
|
5041
5040
|
heading: z7.string().min(1),
|
|
5042
5041
|
source: z7.string().min(1),
|
|
@@ -5045,6 +5044,7 @@ var docsFeedbackSchema = z7.object({
|
|
|
5045
5044
|
});
|
|
5046
5045
|
|
|
5047
5046
|
// src/commands/sessions/web/docsFeedback/docsFeedback.ts
|
|
5047
|
+
var DOCS_DIR = "docs/guide/";
|
|
5048
5048
|
async function docsFeedback(req, res) {
|
|
5049
5049
|
allowExtensionOrigin(req, res);
|
|
5050
5050
|
const parsed = docsFeedbackSchema.safeParse(
|
|
@@ -5054,15 +5054,13 @@ async function docsFeedback(req, res) {
|
|
|
5054
5054
|
respondJson(res, 400, { error: "Invalid docs feedback body" });
|
|
5055
5055
|
return;
|
|
5056
5056
|
}
|
|
5057
|
-
const { sessionId } = parsed.data;
|
|
5058
|
-
if (!sessionId) {
|
|
5059
|
-
respondJson(res, 404, {
|
|
5060
|
-
error: "This docs preview was not started from an assist session"
|
|
5061
|
-
});
|
|
5062
|
-
return;
|
|
5063
|
-
}
|
|
5064
5057
|
const reply2 = await requestDaemonReply(
|
|
5065
|
-
{
|
|
5058
|
+
{
|
|
5059
|
+
type: "type-prompt-to-writer",
|
|
5060
|
+
file: parsed.data.source,
|
|
5061
|
+
within: DOCS_DIR,
|
|
5062
|
+
text: docsFeedbackPrompt(parsed.data)
|
|
5063
|
+
},
|
|
5066
5064
|
"type-prompt-result"
|
|
5067
5065
|
);
|
|
5068
5066
|
if (!reply2) {
|
|
@@ -14654,15 +14652,15 @@ function newestTranscriptId(dir) {
|
|
|
14654
14652
|
} catch {
|
|
14655
14653
|
return void 0;
|
|
14656
14654
|
}
|
|
14657
|
-
let
|
|
14655
|
+
let newest2;
|
|
14658
14656
|
for (const entry of entries) {
|
|
14659
14657
|
if (!entry.endsWith(".jsonl")) continue;
|
|
14660
14658
|
const modifiedAt = modifiedAtOf(path28.join(dir, entry));
|
|
14661
14659
|
if (modifiedAt === void 0) continue;
|
|
14662
|
-
if (!
|
|
14663
|
-
|
|
14660
|
+
if (!newest2 || modifiedAt > newest2.modifiedAt)
|
|
14661
|
+
newest2 = { id: path28.basename(entry, ".jsonl"), modifiedAt };
|
|
14664
14662
|
}
|
|
14665
|
-
return
|
|
14663
|
+
return newest2?.id;
|
|
14666
14664
|
}
|
|
14667
14665
|
function modifiedAtOf(filePath) {
|
|
14668
14666
|
try {
|
|
@@ -21333,9 +21331,6 @@ function buildCommitMessage(subject, refs) {
|
|
|
21333
21331
|
return [subject, "", ...refs.map((ref) => `Ref: ${ref}`)].join("\n");
|
|
21334
21332
|
}
|
|
21335
21333
|
|
|
21336
|
-
// src/commands/commit/execCommit.ts
|
|
21337
|
-
import { execSync as execSync28 } from "child_process";
|
|
21338
|
-
|
|
21339
21334
|
// src/shared/warnIfUnexpectedBranch.ts
|
|
21340
21335
|
import { execSync as execSync24 } from "child_process";
|
|
21341
21336
|
import chalk124 from "chalk";
|
|
@@ -21487,13 +21482,40 @@ function collectCommitRefs(message3) {
|
|
|
21487
21482
|
return refs;
|
|
21488
21483
|
}
|
|
21489
21484
|
|
|
21490
|
-
// src/commands/commit/
|
|
21485
|
+
// src/commands/commit/pullKeepingIndex.ts
|
|
21491
21486
|
import { execSync as execSync26 } from "child_process";
|
|
21487
|
+
function git2(args, input) {
|
|
21488
|
+
return execSync26(`git --literal-pathspecs ${args}`, {
|
|
21489
|
+
encoding: "utf8",
|
|
21490
|
+
input,
|
|
21491
|
+
maxBuffer: 256 * 1024 * 1024,
|
|
21492
|
+
stdio: "pipe"
|
|
21493
|
+
});
|
|
21494
|
+
}
|
|
21495
|
+
function restoreIndex(paths, patch2) {
|
|
21496
|
+
const pathspec = paths.join("\0");
|
|
21497
|
+
git2("reset -q --pathspec-from-file=- --pathspec-file-nul", pathspec);
|
|
21498
|
+
try {
|
|
21499
|
+
git2("apply --cached --binary", patch2);
|
|
21500
|
+
} catch {
|
|
21501
|
+
git2("add -A --pathspec-from-file=- --pathspec-file-nul", pathspec);
|
|
21502
|
+
}
|
|
21503
|
+
}
|
|
21504
|
+
function pullKeepingIndex() {
|
|
21505
|
+
const paths = git2("diff --cached --name-only -z --no-renames").split("\0").filter(Boolean);
|
|
21506
|
+
const patch2 = git2("diff --cached --binary --no-renames");
|
|
21507
|
+
execSync26("git pull --autostash", { stdio: "inherit" });
|
|
21508
|
+
if (paths.length === 0 || findUnmergedPaths().length > 0) return;
|
|
21509
|
+
restoreIndex(paths, patch2);
|
|
21510
|
+
}
|
|
21511
|
+
|
|
21512
|
+
// src/commands/commit/pushCommit.ts
|
|
21513
|
+
import { execSync as execSync27 } from "child_process";
|
|
21492
21514
|
var HEADS_PREFIX = "refs/heads/";
|
|
21493
21515
|
function pushCommit(trunkMode) {
|
|
21494
21516
|
const target = pushTargetForRenamedUpstream(trunkMode);
|
|
21495
21517
|
const command = target ? `git push ${target.setUpstream ? "--set-upstream " : ""}${shellQuote(target.remote)} HEAD:${shellQuote(target.branch)}` : "git push";
|
|
21496
|
-
|
|
21518
|
+
execSync27(command, { stdio: "inherit" });
|
|
21497
21519
|
}
|
|
21498
21520
|
function pushTargetForRenamedUpstream(trunkMode) {
|
|
21499
21521
|
const branch2 = gitOrNull2("git symbolic-ref --short HEAD");
|
|
@@ -21517,7 +21539,7 @@ function raiseOwnRemoteBranch(remote, branch2) {
|
|
|
21517
21539
|
}
|
|
21518
21540
|
function gitOrNull2(command) {
|
|
21519
21541
|
try {
|
|
21520
|
-
return
|
|
21542
|
+
return execSync27(command, {
|
|
21521
21543
|
encoding: "utf8",
|
|
21522
21544
|
stdio: ["pipe", "pipe", "pipe"]
|
|
21523
21545
|
}).trim() || null;
|
|
@@ -21535,16 +21557,16 @@ function shouldPull(config) {
|
|
|
21535
21557
|
}
|
|
21536
21558
|
|
|
21537
21559
|
// src/commands/commit/stageAndCommit.ts
|
|
21538
|
-
import { execSync as
|
|
21560
|
+
import { execSync as execSync28 } from "child_process";
|
|
21539
21561
|
function commitStaged(message3) {
|
|
21540
|
-
|
|
21541
|
-
return
|
|
21562
|
+
execSync28(`git commit -m ${shellQuote(message3)}`, { stdio: "inherit" });
|
|
21563
|
+
return execSync28("git rev-parse --short=7 HEAD", {
|
|
21542
21564
|
encoding: "utf8"
|
|
21543
21565
|
}).trim();
|
|
21544
21566
|
}
|
|
21545
21567
|
function stageAndCommit(files, message3) {
|
|
21546
21568
|
const escaped = files.map(shellQuote).join(" ");
|
|
21547
|
-
|
|
21569
|
+
execSync28(`git add ${escaped}`, { stdio: "inherit" });
|
|
21548
21570
|
return commitStaged(message3);
|
|
21549
21571
|
}
|
|
21550
21572
|
|
|
@@ -21554,7 +21576,7 @@ async function execCommit(files, message3, config) {
|
|
|
21554
21576
|
warnIfUnexpectedBranch(config);
|
|
21555
21577
|
const pulled = shouldPull(config);
|
|
21556
21578
|
if (pulled) {
|
|
21557
|
-
|
|
21579
|
+
pullKeepingIndex();
|
|
21558
21580
|
}
|
|
21559
21581
|
abortOnConflicts(files, pulled);
|
|
21560
21582
|
const sha = files.length > 0 ? stageAndCommit(files, message3) : commitStaged(message3);
|
|
@@ -22167,7 +22189,7 @@ function formatResultLine(entry, failing) {
|
|
|
22167
22189
|
// src/commands/complexity/maintainability/getMaintainabilityGitState.ts
|
|
22168
22190
|
import { execSync as execSync30 } from "child_process";
|
|
22169
22191
|
import path34 from "path";
|
|
22170
|
-
function
|
|
22192
|
+
function git3(command) {
|
|
22171
22193
|
return execSync30(command, { encoding: "utf8" });
|
|
22172
22194
|
}
|
|
22173
22195
|
function toAbsolute(root2, repoRelative) {
|
|
@@ -22175,7 +22197,7 @@ function toAbsolute(root2, repoRelative) {
|
|
|
22175
22197
|
}
|
|
22176
22198
|
function collectShrunkFiles(root2) {
|
|
22177
22199
|
const shrunk = /* @__PURE__ */ new Set();
|
|
22178
|
-
const numstat =
|
|
22200
|
+
const numstat = git3("git diff --numstat HEAD").trim();
|
|
22179
22201
|
if (numstat === "") return shrunk;
|
|
22180
22202
|
for (const line of numstat.split("\n")) {
|
|
22181
22203
|
const [addedRaw, removedRaw, ...rest] = line.split(" ");
|
|
@@ -22188,7 +22210,7 @@ function collectShrunkFiles(root2) {
|
|
|
22188
22210
|
return shrunk;
|
|
22189
22211
|
}
|
|
22190
22212
|
function hasNewSourceFile() {
|
|
22191
|
-
const status2 =
|
|
22213
|
+
const status2 = git3("git status --porcelain --untracked-files=all").trim();
|
|
22192
22214
|
if (status2 === "") return false;
|
|
22193
22215
|
for (const line of status2.split("\n")) {
|
|
22194
22216
|
const code = line.slice(0, 2);
|
|
@@ -22200,7 +22222,7 @@ function hasNewSourceFile() {
|
|
|
22200
22222
|
}
|
|
22201
22223
|
function getMaintainabilityGitState() {
|
|
22202
22224
|
try {
|
|
22203
|
-
const root2 =
|
|
22225
|
+
const root2 = git3("git rev-parse --show-toplevel").trim();
|
|
22204
22226
|
return {
|
|
22205
22227
|
shrunkFiles: collectShrunkFiles(root2),
|
|
22206
22228
|
newFileCreated: hasNewSourceFile()
|
|
@@ -23360,14 +23382,14 @@ function loadDevlogEntries(repoName) {
|
|
|
23360
23382
|
return entries;
|
|
23361
23383
|
}
|
|
23362
23384
|
function loadAllDevlogLatestDates() {
|
|
23363
|
-
const
|
|
23385
|
+
const latest2 = /* @__PURE__ */ new Map();
|
|
23364
23386
|
readDevlogFiles((parsed) => {
|
|
23365
|
-
const existing =
|
|
23387
|
+
const existing = latest2.get(parsed.repoTag);
|
|
23366
23388
|
if (!existing || parsed.date > existing) {
|
|
23367
|
-
|
|
23389
|
+
latest2.set(parsed.repoTag, parsed.date);
|
|
23368
23390
|
}
|
|
23369
23391
|
});
|
|
23370
|
-
return
|
|
23392
|
+
return latest2;
|
|
23371
23393
|
}
|
|
23372
23394
|
|
|
23373
23395
|
// src/commands/devlog/shared.ts
|
|
@@ -44391,6 +44413,133 @@ function broadcastSessions(sessions, clients, linkedSessions = [], active) {
|
|
|
44391
44413
|
broadcast(peers, { type: "sessions", sessions: local, active: {} });
|
|
44392
44414
|
}
|
|
44393
44415
|
|
|
44416
|
+
// src/commands/sessions/daemon/lastWriteTimes.ts
|
|
44417
|
+
import { readFile as readFile9 } from "fs/promises";
|
|
44418
|
+
|
|
44419
|
+
// src/commands/sessions/shared/asRecord.ts
|
|
44420
|
+
function asRecord(value) {
|
|
44421
|
+
return value && typeof value === "object" ? value : null;
|
|
44422
|
+
}
|
|
44423
|
+
|
|
44424
|
+
// src/commands/sessions/shared/writtenFilePaths.ts
|
|
44425
|
+
var WRITE_TOOLS = /* @__PURE__ */ new Set(["Write", "Edit", "MultiEdit", "NotebookEdit"]);
|
|
44426
|
+
function writtenFilePaths(entry) {
|
|
44427
|
+
if (entry.type !== "assistant") return [];
|
|
44428
|
+
const content = asRecord(entry.message)?.content;
|
|
44429
|
+
if (!Array.isArray(content)) return [];
|
|
44430
|
+
const paths = [];
|
|
44431
|
+
for (const block of content) {
|
|
44432
|
+
const b = asRecord(block);
|
|
44433
|
+
if (b?.type !== "tool_use" || !WRITE_TOOLS.has(String(b.name))) continue;
|
|
44434
|
+
const input = asRecord(b.input);
|
|
44435
|
+
const path109 = input?.file_path ?? input?.notebook_path;
|
|
44436
|
+
if (typeof path109 === "string") paths.push(path109);
|
|
44437
|
+
}
|
|
44438
|
+
return paths;
|
|
44439
|
+
}
|
|
44440
|
+
|
|
44441
|
+
// src/commands/sessions/daemon/lastWriteTimes.ts
|
|
44442
|
+
function normalise(path109) {
|
|
44443
|
+
return path109.replaceAll("\\", "/");
|
|
44444
|
+
}
|
|
44445
|
+
function latest(current, at2) {
|
|
44446
|
+
return current === void 0 || at2 > current ? at2 : current;
|
|
44447
|
+
}
|
|
44448
|
+
async function lastWriteTimes(transcriptPath2, target) {
|
|
44449
|
+
const text18 = await readFile9(transcriptPath2, "utf8").catch(() => "");
|
|
44450
|
+
const result = {};
|
|
44451
|
+
for (const line of text18.split("\n")) {
|
|
44452
|
+
if (!line.includes('"tool_use"')) continue;
|
|
44453
|
+
let entry;
|
|
44454
|
+
try {
|
|
44455
|
+
entry = JSON.parse(line);
|
|
44456
|
+
} catch {
|
|
44457
|
+
continue;
|
|
44458
|
+
}
|
|
44459
|
+
const at2 = Date.parse(String(entry.timestamp));
|
|
44460
|
+
if (Number.isNaN(at2)) continue;
|
|
44461
|
+
for (const path109 of writtenFilePaths(entry).map(normalise)) {
|
|
44462
|
+
if (path109.endsWith(`/${target.file}`))
|
|
44463
|
+
result.file = latest(result.file, at2);
|
|
44464
|
+
if (path109.includes(`/${target.within}`))
|
|
44465
|
+
result.within = latest(result.within, at2);
|
|
44466
|
+
}
|
|
44467
|
+
}
|
|
44468
|
+
return result;
|
|
44469
|
+
}
|
|
44470
|
+
|
|
44471
|
+
// src/commands/sessions/shared/findTranscriptPathSync.ts
|
|
44472
|
+
import * as fs50 from "fs";
|
|
44473
|
+
import * as path105 from "path";
|
|
44474
|
+
function projectDirForCwd(cwd) {
|
|
44475
|
+
return path105.join(claudeProjectsRoot(), projectSlug(cwd));
|
|
44476
|
+
}
|
|
44477
|
+
function transcriptPathFor(cwd, claudeSessionId) {
|
|
44478
|
+
return path105.join(projectDirForCwd(cwd), `${claudeSessionId}.jsonl`);
|
|
44479
|
+
}
|
|
44480
|
+
function findTranscriptPathSync(cwd, claudeSessionId) {
|
|
44481
|
+
const direct = transcriptPathFor(cwd, claudeSessionId);
|
|
44482
|
+
if (fs50.existsSync(direct)) return direct;
|
|
44483
|
+
const dir = projectDirForCwd(cwd);
|
|
44484
|
+
let files;
|
|
44485
|
+
try {
|
|
44486
|
+
files = fs50.readdirSync(dir);
|
|
44487
|
+
} catch {
|
|
44488
|
+
return null;
|
|
44489
|
+
}
|
|
44490
|
+
for (const file of files) {
|
|
44491
|
+
if (!file.endsWith(".jsonl")) continue;
|
|
44492
|
+
if (headContainsSessionId(path105.join(dir, file), claudeSessionId))
|
|
44493
|
+
return path105.join(dir, file);
|
|
44494
|
+
}
|
|
44495
|
+
return null;
|
|
44496
|
+
}
|
|
44497
|
+
function headContainsSessionId(filePath, claudeSessionId) {
|
|
44498
|
+
let fd;
|
|
44499
|
+
try {
|
|
44500
|
+
fd = fs50.openSync(filePath, "r");
|
|
44501
|
+
const buf = Buffer.alloc(16384);
|
|
44502
|
+
const bytesRead = fs50.readSync(fd, buf, 0, buf.length, 0);
|
|
44503
|
+
return buf.toString("utf8", 0, bytesRead).includes(claudeSessionId);
|
|
44504
|
+
} catch {
|
|
44505
|
+
return false;
|
|
44506
|
+
} finally {
|
|
44507
|
+
if (fd !== void 0) fs50.closeSync(fd);
|
|
44508
|
+
}
|
|
44509
|
+
}
|
|
44510
|
+
|
|
44511
|
+
// src/commands/sessions/daemon/resolveTranscriptPath.ts
|
|
44512
|
+
async function resolveTranscriptPath(session) {
|
|
44513
|
+
if (session.transcriptPath) return session.transcriptPath;
|
|
44514
|
+
if (!session.claudeSessionId) return null;
|
|
44515
|
+
const direct = session.cwd ? findTranscriptPathSync(session.cwd, session.claudeSessionId) : null;
|
|
44516
|
+
const filePath = direct ?? await findSessionJsonlPath(session.claudeSessionId);
|
|
44517
|
+
if (filePath) session.transcriptPath = filePath;
|
|
44518
|
+
return filePath;
|
|
44519
|
+
}
|
|
44520
|
+
|
|
44521
|
+
// src/commands/sessions/daemon/findLastWriter.ts
|
|
44522
|
+
function newest(candidates, key) {
|
|
44523
|
+
return candidates.filter((c) => c[key] !== void 0).sort((a, b) => (b[key] ?? 0) - (a[key] ?? 0))[0];
|
|
44524
|
+
}
|
|
44525
|
+
async function findLastWriter(sessions, target) {
|
|
44526
|
+
const live = [...sessions.values()].filter(
|
|
44527
|
+
(s) => s.pty && s.status !== "done" && s.commandType !== "run"
|
|
44528
|
+
);
|
|
44529
|
+
const candidates = await Promise.all(
|
|
44530
|
+
live.map(async (session) => {
|
|
44531
|
+
const transcript = await resolveTranscriptPath(session);
|
|
44532
|
+
if (!transcript) return { id: session.id };
|
|
44533
|
+
return { id: session.id, ...await lastWriteTimes(transcript, target) };
|
|
44534
|
+
})
|
|
44535
|
+
);
|
|
44536
|
+
const writer = newest(candidates, "file") ?? newest(candidates, "within");
|
|
44537
|
+
daemonLog(
|
|
44538
|
+
`last writer of ${target.file} (within ${target.within}): ${writer ? `session ${writer.id}` : "none"} of ${live.length} live session(s)`
|
|
44539
|
+
);
|
|
44540
|
+
return writer?.id;
|
|
44541
|
+
}
|
|
44542
|
+
|
|
44394
44543
|
// src/commands/sessions/daemon/releaseViewer.ts
|
|
44395
44544
|
function releaseViewer(sessions, viewerId) {
|
|
44396
44545
|
let released = false;
|
|
@@ -44679,6 +44828,15 @@ var SessionIo = class {
|
|
|
44679
44828
|
(target, data) => this.write(target, data, {})
|
|
44680
44829
|
);
|
|
44681
44830
|
}
|
|
44831
|
+
async typePromptToLastWriter(target, text18) {
|
|
44832
|
+
const id = await findLastWriter(this.sessions, target);
|
|
44833
|
+
if (!id)
|
|
44834
|
+
return {
|
|
44835
|
+
refused: `No live Claude session has written ${target.file} or anything in ${target.within}`
|
|
44836
|
+
};
|
|
44837
|
+
const refused = this.typePrompt(id, text18);
|
|
44838
|
+
return refused ? { refused } : id;
|
|
44839
|
+
}
|
|
44682
44840
|
resize(id, cols, rows, viewer) {
|
|
44683
44841
|
resizeSession(this.sessions, id, cols, rows, {
|
|
44684
44842
|
...viewer,
|
|
@@ -44815,26 +44973,26 @@ function sessionBase(id, status2) {
|
|
|
44815
44973
|
}
|
|
44816
44974
|
|
|
44817
44975
|
// src/commands/sessions/daemon/spawnPty.ts
|
|
44818
|
-
import { existsSync as
|
|
44976
|
+
import { existsSync as existsSync88 } from "fs";
|
|
44819
44977
|
import * as pty from "node-pty";
|
|
44820
44978
|
|
|
44821
44979
|
// src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
|
|
44822
|
-
import { chmodSync, existsSync as
|
|
44980
|
+
import { chmodSync, existsSync as existsSync87, statSync as statSync15 } from "fs";
|
|
44823
44981
|
import { createRequire as createRequire3 } from "module";
|
|
44824
|
-
import
|
|
44982
|
+
import path106 from "path";
|
|
44825
44983
|
var require4 = createRequire3(import.meta.url);
|
|
44826
44984
|
var ensured = false;
|
|
44827
44985
|
function ensureSpawnHelperExecutable() {
|
|
44828
44986
|
if (ensured || process.platform !== "darwin") return;
|
|
44829
44987
|
ensured = true;
|
|
44830
|
-
const ptyRoot =
|
|
44831
|
-
const helper =
|
|
44988
|
+
const ptyRoot = path106.join(path106.dirname(require4.resolve("node-pty")), "..");
|
|
44989
|
+
const helper = path106.join(
|
|
44832
44990
|
ptyRoot,
|
|
44833
44991
|
"prebuilds",
|
|
44834
44992
|
`${process.platform}-${process.arch}`,
|
|
44835
44993
|
"spawn-helper"
|
|
44836
44994
|
);
|
|
44837
|
-
if (!
|
|
44995
|
+
if (!existsSync87(helper)) return;
|
|
44838
44996
|
const mode = statSync15(helper).mode;
|
|
44839
44997
|
if ((mode & 73) === 0) chmodSync(helper, mode | 493);
|
|
44840
44998
|
}
|
|
@@ -44890,7 +45048,7 @@ function spawnPty(args, cwd, sessionId, extraEnv) {
|
|
|
44890
45048
|
});
|
|
44891
45049
|
}
|
|
44892
45050
|
function refuseMissingCwd(cwd, sessionId) {
|
|
44893
|
-
if (!cwd ||
|
|
45051
|
+
if (!cwd || existsSync88(cwd)) return;
|
|
44894
45052
|
daemonLog(
|
|
44895
45053
|
`${sessionId ? `session ${sessionId}` : "pty"} not spawned: working directory ${cwd} no longer exists`
|
|
44896
45054
|
);
|
|
@@ -44975,19 +45133,19 @@ function serverRunMeta(runName, cwd) {
|
|
|
44975
45133
|
}
|
|
44976
45134
|
|
|
44977
45135
|
// src/commands/sessions/daemon/readDesignSystemPrompt.ts
|
|
44978
|
-
import * as
|
|
44979
|
-
import * as
|
|
45136
|
+
import * as fs51 from "fs";
|
|
45137
|
+
import * as path107 from "path";
|
|
44980
45138
|
import { fileURLToPath as fileURLToPath10 } from "url";
|
|
44981
45139
|
var __filename5 = fileURLToPath10(import.meta.url);
|
|
44982
|
-
var __dirname6 =
|
|
45140
|
+
var __dirname6 = path107.dirname(__filename5);
|
|
44983
45141
|
function readDesignSystemPrompt() {
|
|
44984
|
-
const promptPath =
|
|
45142
|
+
const promptPath = path107.join(
|
|
44985
45143
|
__dirname6,
|
|
44986
45144
|
"..",
|
|
44987
45145
|
"claude",
|
|
44988
45146
|
"design-system-prompt.md"
|
|
44989
45147
|
);
|
|
44990
|
-
return
|
|
45148
|
+
return fs51.readFileSync(promptPath, "utf8");
|
|
44991
45149
|
}
|
|
44992
45150
|
|
|
44993
45151
|
// src/commands/sessions/daemon/spawnClaude.ts
|
|
@@ -45060,7 +45218,7 @@ function createRunSession(id, { runName, runArgs, cwd, meta }) {
|
|
|
45060
45218
|
}
|
|
45061
45219
|
|
|
45062
45220
|
// src/commands/sessions/daemon/autoUpdate/autoUpdateControl.ts
|
|
45063
|
-
import { existsSync as
|
|
45221
|
+
import { existsSync as existsSync89, rmSync as rmSync11, writeFileSync as writeFileSync54 } from "fs";
|
|
45064
45222
|
var paused;
|
|
45065
45223
|
var wake;
|
|
45066
45224
|
function persist2(value) {
|
|
@@ -45072,7 +45230,7 @@ function persist2(value) {
|
|
|
45072
45230
|
}
|
|
45073
45231
|
var autoUpdateControl = {
|
|
45074
45232
|
paused: () => {
|
|
45075
|
-
paused ??=
|
|
45233
|
+
paused ??= existsSync89(daemonPaths.autoUpdatePaused);
|
|
45076
45234
|
return paused;
|
|
45077
45235
|
},
|
|
45078
45236
|
setPaused: (value) => {
|
|
@@ -45515,17 +45673,17 @@ function setStatus2(session, newStatus) {
|
|
|
45515
45673
|
}
|
|
45516
45674
|
|
|
45517
45675
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
45518
|
-
import { existsSync as
|
|
45676
|
+
import { existsSync as existsSync91 } from "fs";
|
|
45519
45677
|
import { basename as basename31 } from "path";
|
|
45520
45678
|
|
|
45521
45679
|
// src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
|
|
45522
|
-
import { existsSync as
|
|
45523
|
-
import { join as
|
|
45680
|
+
import { existsSync as existsSync90 } from "fs";
|
|
45681
|
+
import { join as join106 } from "path";
|
|
45524
45682
|
|
|
45525
45683
|
// src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
|
|
45526
45684
|
import { statSync as statSync16 } from "fs";
|
|
45527
45685
|
import { rm as rm3 } from "fs/promises";
|
|
45528
|
-
import { join as
|
|
45686
|
+
import { join as join105 } from "path";
|
|
45529
45687
|
async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
45530
45688
|
if (holdsAGitDirectoryRatherThanALink(worktreePath)) {
|
|
45531
45689
|
const refusal = "it is a clone of its own, not a linked worktree";
|
|
@@ -45553,7 +45711,7 @@ async function deleteTreeDirectly(clone, worktreePath, why) {
|
|
|
45553
45711
|
return { removed: true };
|
|
45554
45712
|
}
|
|
45555
45713
|
function holdsAGitDirectoryRatherThanALink(worktreePath) {
|
|
45556
|
-
return statSync16(
|
|
45714
|
+
return statSync16(join105(worktreePath, ".git"), {
|
|
45557
45715
|
throwIfNoEntry: false
|
|
45558
45716
|
})?.isDirectory() === true;
|
|
45559
45717
|
}
|
|
@@ -45589,7 +45747,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
|
|
|
45589
45747
|
);
|
|
45590
45748
|
}
|
|
45591
45749
|
function strandedReason(worktreePath, cause) {
|
|
45592
|
-
if (!
|
|
45750
|
+
if (!existsSync90(join106(worktreePath, ".git")))
|
|
45593
45751
|
return "its .git link is already gone";
|
|
45594
45752
|
if (/not a working tree|not a git repository/i.test(reason2(cause)))
|
|
45595
45753
|
return "git no longer recognises it as a working tree";
|
|
@@ -45641,7 +45799,7 @@ function reason3(error) {
|
|
|
45641
45799
|
|
|
45642
45800
|
// src/commands/sessions/daemon/worktree/reapWorktree.ts
|
|
45643
45801
|
async function reapWorktree(worktreePath, force = false) {
|
|
45644
|
-
if (!
|
|
45802
|
+
if (!existsSync91(worktreePath)) {
|
|
45645
45803
|
forgetWorktree(worktreePath);
|
|
45646
45804
|
daemonLog(
|
|
45647
45805
|
`worktree ${worktreePath} already gone; its record was forgotten`
|
|
@@ -45666,7 +45824,7 @@ async function reapWorktree(worktreePath, force = false) {
|
|
|
45666
45824
|
}
|
|
45667
45825
|
function owningClone(worktreePath) {
|
|
45668
45826
|
const recorded = worktreeAttributionIncludingReaped(worktreePath)?.clone;
|
|
45669
|
-
if (recorded &&
|
|
45827
|
+
if (recorded && existsSync91(recorded)) return recorded;
|
|
45670
45828
|
const detected = mainWorktree(worktreePath);
|
|
45671
45829
|
if (detected) return detected;
|
|
45672
45830
|
daemonLog(
|
|
@@ -45795,12 +45953,12 @@ function closeGateApplies(sessions, session) {
|
|
|
45795
45953
|
}
|
|
45796
45954
|
|
|
45797
45955
|
// src/commands/sessions/daemon/worktree/liveProcessesInTree.ts
|
|
45798
|
-
import { readdirSync as
|
|
45956
|
+
import { readdirSync as readdirSync25, readlinkSync } from "fs";
|
|
45799
45957
|
import { sep as sep4 } from "path";
|
|
45800
45958
|
function liveProcessesInTree(treePath, procRoot = "/proc") {
|
|
45801
45959
|
let entries;
|
|
45802
45960
|
try {
|
|
45803
|
-
entries =
|
|
45961
|
+
entries = readdirSync25(procRoot);
|
|
45804
45962
|
} catch {
|
|
45805
45963
|
return [];
|
|
45806
45964
|
}
|
|
@@ -45867,12 +46025,12 @@ async function closeBlockReason(sessionId, tree) {
|
|
|
45867
46025
|
}
|
|
45868
46026
|
|
|
45869
46027
|
// src/commands/sessions/daemon/worktree/watchGitState.ts
|
|
45870
|
-
import { existsSync as
|
|
46028
|
+
import { existsSync as existsSync92, watch } from "fs";
|
|
45871
46029
|
var DEBOUNCE_MS = 500;
|
|
45872
46030
|
var POLL_MS3 = 3e4;
|
|
45873
46031
|
function watchGitState(cwd, onChange) {
|
|
45874
46032
|
const common = gitCommonDir(cwd);
|
|
45875
|
-
if (!common || !
|
|
46033
|
+
if (!common || !existsSync92(common)) return void 0;
|
|
45876
46034
|
const watchers = [
|
|
45877
46035
|
watchGitDir(common, onChange),
|
|
45878
46036
|
pollGitState(cwd, onChange)
|
|
@@ -46531,10 +46689,10 @@ function emitSessionOutput(session, clients, data) {
|
|
|
46531
46689
|
}
|
|
46532
46690
|
|
|
46533
46691
|
// src/commands/sessions/daemon/exitReason.ts
|
|
46534
|
-
import { existsSync as
|
|
46692
|
+
import { existsSync as existsSync93 } from "fs";
|
|
46535
46693
|
import { resolve as resolve29 } from "path";
|
|
46536
46694
|
function exitDetail(session) {
|
|
46537
|
-
if (session.cwd && !
|
|
46695
|
+
if (session.cwd && !existsSync93(session.cwd))
|
|
46538
46696
|
return `working directory ${session.cwd} no longer exists`;
|
|
46539
46697
|
return missingRunConfigCwd(session);
|
|
46540
46698
|
}
|
|
@@ -46548,7 +46706,7 @@ function missingRunConfigCwd(session) {
|
|
|
46548
46706
|
const config = resolveRunConfig(session.runName, dir);
|
|
46549
46707
|
if (!config?.cwd) return void 0;
|
|
46550
46708
|
const configured = resolve29(runConfigBaseDirFrom(dir), config.cwd);
|
|
46551
|
-
if (
|
|
46709
|
+
if (existsSync93(configured)) return void 0;
|
|
46552
46710
|
return `run config "${config.name}": cwd ${configured} does not exist`;
|
|
46553
46711
|
}
|
|
46554
46712
|
|
|
@@ -46596,7 +46754,7 @@ function handleRefusedRun(session, exitCode, onStatusChange) {
|
|
|
46596
46754
|
}
|
|
46597
46755
|
|
|
46598
46756
|
// src/commands/sessions/daemon/watchActivity.ts
|
|
46599
|
-
import { existsSync as
|
|
46757
|
+
import { existsSync as existsSync94, mkdirSync as mkdirSync36, watch as watch2 } from "fs";
|
|
46600
46758
|
import { dirname as dirname44 } from "path";
|
|
46601
46759
|
|
|
46602
46760
|
// src/commands/sessions/daemon/applyActivityToSession.ts
|
|
@@ -46682,7 +46840,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
|
|
|
46682
46840
|
if (timer) clearTimeout(timer);
|
|
46683
46841
|
timer = setTimeout(read3, DEBOUNCE_MS2);
|
|
46684
46842
|
});
|
|
46685
|
-
if (
|
|
46843
|
+
if (existsSync94(path109)) read3();
|
|
46686
46844
|
}
|
|
46687
46845
|
function refreshActivity(session) {
|
|
46688
46846
|
if (session.commandType !== "assist" || !session.cwd) return;
|
|
@@ -46762,7 +46920,7 @@ function reportSilentFailure(session, clients) {
|
|
|
46762
46920
|
}
|
|
46763
46921
|
|
|
46764
46922
|
// src/commands/sessions/shared/codex/resolveCodexSessionId.ts
|
|
46765
|
-
import * as
|
|
46923
|
+
import * as fs52 from "fs";
|
|
46766
46924
|
var META_LINES = 5;
|
|
46767
46925
|
async function resolveCodexSessionId(cwd, sinceMs) {
|
|
46768
46926
|
if (!cwd) return null;
|
|
@@ -46791,7 +46949,7 @@ async function startedIn(file, cwd, sinceMs) {
|
|
|
46791
46949
|
}
|
|
46792
46950
|
async function touchedSince(file, sinceMs) {
|
|
46793
46951
|
try {
|
|
46794
|
-
return (await
|
|
46952
|
+
return (await fs52.promises.stat(file)).mtimeMs >= sinceMs;
|
|
46795
46953
|
} catch {
|
|
46796
46954
|
return false;
|
|
46797
46955
|
}
|
|
@@ -46825,46 +46983,6 @@ function bindCodexSession(session, notify2) {
|
|
|
46825
46983
|
// src/commands/sessions/daemon/watchTranscript.ts
|
|
46826
46984
|
import { watch as watch3 } from "fs";
|
|
46827
46985
|
|
|
46828
|
-
// src/commands/sessions/shared/findTranscriptPathSync.ts
|
|
46829
|
-
import * as fs52 from "fs";
|
|
46830
|
-
import * as path107 from "path";
|
|
46831
|
-
function projectDirForCwd(cwd) {
|
|
46832
|
-
return path107.join(claudeProjectsRoot(), projectSlug(cwd));
|
|
46833
|
-
}
|
|
46834
|
-
function transcriptPathFor(cwd, claudeSessionId) {
|
|
46835
|
-
return path107.join(projectDirForCwd(cwd), `${claudeSessionId}.jsonl`);
|
|
46836
|
-
}
|
|
46837
|
-
function findTranscriptPathSync(cwd, claudeSessionId) {
|
|
46838
|
-
const direct = transcriptPathFor(cwd, claudeSessionId);
|
|
46839
|
-
if (fs52.existsSync(direct)) return direct;
|
|
46840
|
-
const dir = projectDirForCwd(cwd);
|
|
46841
|
-
let files;
|
|
46842
|
-
try {
|
|
46843
|
-
files = fs52.readdirSync(dir);
|
|
46844
|
-
} catch {
|
|
46845
|
-
return null;
|
|
46846
|
-
}
|
|
46847
|
-
for (const file of files) {
|
|
46848
|
-
if (!file.endsWith(".jsonl")) continue;
|
|
46849
|
-
if (headContainsSessionId(path107.join(dir, file), claudeSessionId))
|
|
46850
|
-
return path107.join(dir, file);
|
|
46851
|
-
}
|
|
46852
|
-
return null;
|
|
46853
|
-
}
|
|
46854
|
-
function headContainsSessionId(filePath, claudeSessionId) {
|
|
46855
|
-
let fd;
|
|
46856
|
-
try {
|
|
46857
|
-
fd = fs52.openSync(filePath, "r");
|
|
46858
|
-
const buf = Buffer.alloc(16384);
|
|
46859
|
-
const bytesRead = fs52.readSync(fd, buf, 0, buf.length, 0);
|
|
46860
|
-
return buf.toString("utf8", 0, bytesRead).includes(claudeSessionId);
|
|
46861
|
-
} catch {
|
|
46862
|
-
return false;
|
|
46863
|
-
} finally {
|
|
46864
|
-
if (fd !== void 0) fs52.closeSync(fd);
|
|
46865
|
-
}
|
|
46866
|
-
}
|
|
46867
|
-
|
|
46868
46986
|
// src/commands/sessions/daemon/ensureProjectDirExists.ts
|
|
46869
46987
|
import { mkdirSync as mkdirSync37 } from "fs";
|
|
46870
46988
|
function ensureProjectDirExists(dir, sessionId) {
|
|
@@ -46913,16 +47031,16 @@ function lastDecisiveIndex(events) {
|
|
|
46913
47031
|
var INTERRUPT_PREFIX = "[Request interrupted";
|
|
46914
47032
|
var TASK_NOTIFICATION = "<task-notification>";
|
|
46915
47033
|
function normalizeUser(entry) {
|
|
46916
|
-
const content =
|
|
47034
|
+
const content = asRecord2(entry.message)?.content;
|
|
46917
47035
|
if (typeof content === "string") return normalizeUserText(content);
|
|
46918
47036
|
if (!Array.isArray(content)) return { kind: "user" };
|
|
46919
|
-
if (content.length === 1 &&
|
|
46920
|
-
return normalizeUserText(
|
|
47037
|
+
if (content.length === 1 && asRecord2(content[0])?.type === "text")
|
|
47038
|
+
return normalizeUserText(asRecord2(content[0])?.text);
|
|
46921
47039
|
const toolResultIds = [];
|
|
46922
47040
|
let hasInterrupt = false;
|
|
46923
47041
|
let hasNonToolResult = false;
|
|
46924
47042
|
for (const block of content) {
|
|
46925
|
-
const b =
|
|
47043
|
+
const b = asRecord2(block);
|
|
46926
47044
|
if (!b) continue;
|
|
46927
47045
|
if (b.type === "tool_result") {
|
|
46928
47046
|
if (typeof b.tool_use_id === "string") toolResultIds.push(b.tool_use_id);
|
|
@@ -46936,7 +47054,7 @@ function normalizeUser(entry) {
|
|
|
46936
47054
|
if (hasNonToolResult) return { kind: "user" };
|
|
46937
47055
|
return { kind: "toolResult", ids: toolResultIds };
|
|
46938
47056
|
}
|
|
46939
|
-
function
|
|
47057
|
+
function asRecord2(value) {
|
|
46940
47058
|
return value && typeof value === "object" ? value : null;
|
|
46941
47059
|
}
|
|
46942
47060
|
function normalizeUserText(text18) {
|
|
@@ -46960,13 +47078,13 @@ function normalizeEntry(entry) {
|
|
|
46960
47078
|
return null;
|
|
46961
47079
|
}
|
|
46962
47080
|
function normalizeAssistant(entry) {
|
|
46963
|
-
const message3 =
|
|
47081
|
+
const message3 = asRecord3(entry.message);
|
|
46964
47082
|
const stopReason = typeof message3?.stop_reason === "string" ? message3.stop_reason : null;
|
|
46965
47083
|
const content = message3?.content;
|
|
46966
47084
|
const toolUses = [];
|
|
46967
47085
|
if (Array.isArray(content))
|
|
46968
47086
|
for (const block of content) {
|
|
46969
|
-
const b =
|
|
47087
|
+
const b = asRecord3(block);
|
|
46970
47088
|
if (b?.type === "tool_use")
|
|
46971
47089
|
toolUses.push({
|
|
46972
47090
|
id: typeof b.id === "string" ? b.id : "",
|
|
@@ -46975,7 +47093,7 @@ function normalizeAssistant(entry) {
|
|
|
46975
47093
|
}
|
|
46976
47094
|
return { kind: "assistant", stopReason, toolUses };
|
|
46977
47095
|
}
|
|
46978
|
-
function
|
|
47096
|
+
function asRecord3(value) {
|
|
46979
47097
|
return value && typeof value === "object" ? value : null;
|
|
46980
47098
|
}
|
|
46981
47099
|
|
|
@@ -47028,15 +47146,15 @@ function renderUserPrompt(entry, maxLength = MAX_LENGTH) {
|
|
|
47028
47146
|
return message3 ? cap(message3, maxLength) : void 0;
|
|
47029
47147
|
}
|
|
47030
47148
|
function isTaskNotification(entry) {
|
|
47031
|
-
return
|
|
47149
|
+
return asRecord4(entry.origin)?.kind === "task-notification";
|
|
47032
47150
|
}
|
|
47033
47151
|
function promptTextOrNull(entry) {
|
|
47034
|
-
const content =
|
|
47152
|
+
const content = asRecord4(entry.message)?.content;
|
|
47035
47153
|
if (typeof content === "string") return isInterrupt(content) ? null : content;
|
|
47036
47154
|
if (!Array.isArray(content)) return null;
|
|
47037
47155
|
const parts = [];
|
|
47038
47156
|
for (const block of content) {
|
|
47039
|
-
const b =
|
|
47157
|
+
const b = asRecord4(block);
|
|
47040
47158
|
if (b?.type !== "text") continue;
|
|
47041
47159
|
const text18 = typeof b.text === "string" ? b.text : "";
|
|
47042
47160
|
if (isInterrupt(text18)) return null;
|
|
@@ -47050,7 +47168,7 @@ function cap(message3, maxLength) {
|
|
|
47050
47168
|
function isInterrupt(value) {
|
|
47051
47169
|
return value.trimStart().startsWith(INTERRUPT_PREFIX2);
|
|
47052
47170
|
}
|
|
47053
|
-
function
|
|
47171
|
+
function asRecord4(value) {
|
|
47054
47172
|
return value && typeof value === "object" ? value : null;
|
|
47055
47173
|
}
|
|
47056
47174
|
|
|
@@ -47137,16 +47255,6 @@ function transcriptTailFingerprint(entries) {
|
|
|
47137
47255
|
return null;
|
|
47138
47256
|
}
|
|
47139
47257
|
|
|
47140
|
-
// src/commands/sessions/daemon/resolveTranscriptPath.ts
|
|
47141
|
-
async function resolveTranscriptPath(session) {
|
|
47142
|
-
if (session.transcriptPath) return session.transcriptPath;
|
|
47143
|
-
if (!session.claudeSessionId) return null;
|
|
47144
|
-
const direct = session.cwd ? findTranscriptPathSync(session.cwd, session.claudeSessionId) : null;
|
|
47145
|
-
const filePath = direct ?? await findSessionJsonlPath(session.claudeSessionId);
|
|
47146
|
-
if (filePath) session.transcriptPath = filePath;
|
|
47147
|
-
return filePath;
|
|
47148
|
-
}
|
|
47149
|
-
|
|
47150
47258
|
// src/commands/sessions/daemon/reconcileTranscriptStatus.ts
|
|
47151
47259
|
function updateLastUserMessage(session, entries, notify2) {
|
|
47152
47260
|
const message3 = extractLastUserMessage(entries);
|
|
@@ -48328,22 +48436,17 @@ function daemonRestartPrompt(backgroundTaskIds) {
|
|
|
48328
48436
|
return `${preamble} It killed ${backgroundTaskIds.length} background task(s) that were still running (${backgroundTaskIds.join(", ")}); their output files end where the kill landed, with no exit code. Treat them as killed by the restart, not as interrupted by the user, and restart any of them that should still be running.`;
|
|
48329
48437
|
}
|
|
48330
48438
|
|
|
48331
|
-
// src/commands/sessions/shared/asRecord.ts
|
|
48332
|
-
function asRecord4(value) {
|
|
48333
|
-
return value && typeof value === "object" ? value : null;
|
|
48334
|
-
}
|
|
48335
|
-
|
|
48336
48439
|
// src/commands/sessions/shared/deliberatelyStoppedTaskIds.ts
|
|
48337
48440
|
var STOP_TOOLS = /* @__PURE__ */ new Set(["KillShell", "KillBash", "TaskStop"]);
|
|
48338
48441
|
function deliberatelyStoppedTaskIds(entry) {
|
|
48339
48442
|
if (entry.type !== "assistant") return [];
|
|
48340
|
-
const content =
|
|
48443
|
+
const content = asRecord(entry.message)?.content;
|
|
48341
48444
|
if (!Array.isArray(content)) return [];
|
|
48342
48445
|
const ids = [];
|
|
48343
48446
|
for (const block of content) {
|
|
48344
|
-
const b =
|
|
48447
|
+
const b = asRecord(block);
|
|
48345
48448
|
if (b?.type !== "tool_use" || !STOP_TOOLS.has(String(b.name))) continue;
|
|
48346
|
-
const input =
|
|
48449
|
+
const input = asRecord(b.input);
|
|
48347
48450
|
const id = input?.task_id ?? input?.shell_id ?? input?.bash_id;
|
|
48348
48451
|
if (typeof id === "string") ids.push(id);
|
|
48349
48452
|
}
|
|
@@ -48365,7 +48468,7 @@ function notifiedTasks(entry) {
|
|
|
48365
48468
|
return tasks;
|
|
48366
48469
|
}
|
|
48367
48470
|
function taskNotificationText(entry) {
|
|
48368
|
-
const content =
|
|
48471
|
+
const content = asRecord(entry.message)?.content ?? entry.content;
|
|
48369
48472
|
return typeof content === "string" && content.includes("<task-notification>") ? content : void 0;
|
|
48370
48473
|
}
|
|
48371
48474
|
|
|
@@ -48393,7 +48496,7 @@ function killedTaskIds(entry) {
|
|
|
48393
48496
|
return notifiedTasks(entry).filter(({ status: status2 }) => status2 && KILLED_STATUSES.has(status2)).map(({ id }) => id);
|
|
48394
48497
|
}
|
|
48395
48498
|
function startedTaskId(entry) {
|
|
48396
|
-
const result =
|
|
48499
|
+
const result = asRecord(entry.toolUseResult);
|
|
48397
48500
|
return typeof result?.backgroundTaskId === "string" ? result.backgroundTaskId : void 0;
|
|
48398
48501
|
}
|
|
48399
48502
|
function selfFinishedTaskIds(entry) {
|
|
@@ -50845,6 +50948,21 @@ var handleTypePrompt = (client, m, d) => {
|
|
|
50845
50948
|
});
|
|
50846
50949
|
};
|
|
50847
50950
|
|
|
50951
|
+
// src/commands/sessions/daemon/handleTypePromptToWriter.ts
|
|
50952
|
+
var handleTypePromptToWriter = (client, m, d) => {
|
|
50953
|
+
const target = { file: String(d.file), within: String(d.within) };
|
|
50954
|
+
daemonLog(`type-prompt-to-writer received: file=${target.file}`);
|
|
50955
|
+
m.io.typePromptToLastWriter(target, String(d.text ?? "")).then((result) => {
|
|
50956
|
+
if (typeof result !== "string")
|
|
50957
|
+
daemonLog(`type-prompt-to-writer refused: ${result.refused}`);
|
|
50958
|
+
sendTo(client, {
|
|
50959
|
+
type: "type-prompt-result",
|
|
50960
|
+
ok: typeof result === "string",
|
|
50961
|
+
message: typeof result === "string" ? `Sent to assist session ${result}, the last to write ${target.file}` : result.refused
|
|
50962
|
+
});
|
|
50963
|
+
});
|
|
50964
|
+
};
|
|
50965
|
+
|
|
50848
50966
|
// src/commands/sessions/shared/parseTranscript.ts
|
|
50849
50967
|
import * as fs57 from "fs";
|
|
50850
50968
|
|
|
@@ -51177,6 +51295,7 @@ var messageHandlers = {
|
|
|
51177
51295
|
"codex-usage": handleCodexUsage,
|
|
51178
51296
|
...viewerHandlers,
|
|
51179
51297
|
"type-prompt": handleTypePrompt,
|
|
51298
|
+
"type-prompt-to-writer": handleTypePromptToWriter,
|
|
51180
51299
|
retry: routed((client, m, d) => {
|
|
51181
51300
|
const conflict = m.retrySession(d.sessionId, d.replace === true);
|
|
51182
51301
|
if (conflict)
|