@kw-yeh/vibeflow 4.11.60 → 4.11.61

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/vibeflow.mjs CHANGED
@@ -211,7 +211,7 @@ var init_pty = __esm({
211
211
  this.scrollbacks.set(key, cur.length > MAX_SCROLLBACK ? cur.slice(-MAX_SCROLLBACK) : cur);
212
212
  }
213
213
  async start(key, options) {
214
- const { cwd, command, onExit, cols = 80, rows = 24, fresh = false } = options;
214
+ const { cwd, command, onExit, fresh = false } = options;
215
215
  const running = this.sessions.get(key);
216
216
  if (running && !command && !fresh && running.cwd === cwd) {
217
217
  running.onExit = onExit;
@@ -221,6 +221,8 @@ var init_pty = __esm({
221
221
  const clearScrollback = Boolean(command) || fresh;
222
222
  const scrollback = clearScrollback ? null : this.scrollbacks.get(key) ?? null;
223
223
  if (clearScrollback) this.scrollbacks.delete(key);
224
+ const cols = options.cols ?? running?.proc.cols ?? 80;
225
+ const rows = options.rows ?? running?.proc.rows ?? 24;
224
226
  this.killNow(key);
225
227
  const shell = defaultShell();
226
228
  const proc = nodePty.spawn(shell, shellArgs(shell, command), {
@@ -421,7 +423,10 @@ var init_tmux_backend = __esm({
421
423
  return stdout.split("\n").map((line) => line.trim()).filter((name) => name.startsWith("vf-")).map((name) => name.slice(3));
422
424
  }
423
425
  async start(key, options) {
424
- const { cwd, command, onExit, cols = 80, rows = 24, fresh = false } = options;
426
+ const { cwd, command, onExit, fresh = false } = options;
427
+ const previous = this.clients.get(key)?.proc;
428
+ const cols = options.cols ?? previous?.cols ?? 80;
429
+ const rows = options.rows ?? previous?.rows ?? 24;
425
430
  this.ensureFiles();
426
431
  const name = this.sessionName(key);
427
432
  const alive = await this.isAlive(key);
@@ -772,7 +777,7 @@ function buildAgentCommand(task, systemPrompt, opts, workspacePath) {
772
777
  const role = task.role === "master" ? masterSystemPrompt({ canWrite, autoMode: opts?.autoMode === true }) : task.masterId ? slaveSystemPrompt({ canWrite }) : null;
773
778
  const sys = task.masterId && task.role !== "master" ? role ?? "" : role ? [custom, role].filter(Boolean).join("\n\n") : custom;
774
779
  const includeTaskPrompt = opts?.includeTaskPrompt !== false;
775
- const prompt = includeTaskPrompt && !opts?.resume ? buildPrompt(task, opts?.preface) : "";
780
+ const prompt = includeTaskPrompt && !opts?.resume ? opts?.continuation ?? buildPrompt(task, opts?.preface) : "";
776
781
  const sessionId = agent === "claude" && includeTaskPrompt ? executorSessionId(task.id, task.runId) : void 0;
777
782
  return boardEnvPrefix(task, opts, workspacePath) + assembleCommand(
778
783
  agent,
@@ -1110,6 +1115,17 @@ function reduceClaudeLine(state, line) {
1110
1115
  function claudeUsageTotal(state) {
1111
1116
  return { ...Object.values(state.usageById).reduce(addUsage, emptyUsage()), turns: state.turns };
1112
1117
  }
1118
+ function claudeLastReply(lines) {
1119
+ for (let i = lines.length - 1; i >= 0; i -= 1) {
1120
+ const entry = parseLine(lines[i]);
1121
+ if (!entry || entry.type !== "assistant" || entry.isSidechain) continue;
1122
+ const message2 = entry.message;
1123
+ const content = Array.isArray(message2?.content) ? message2.content : [];
1124
+ const text = content.filter((b) => b?.type === "text" && typeof b.text === "string").map((b) => b.text.trim()).filter(Boolean).join("\n\n");
1125
+ if (text) return text;
1126
+ }
1127
+ return void 0;
1128
+ }
1113
1129
  function initialCodexState() {
1114
1130
  return { todos: null, usage: emptyUsage(), activity: { state: "unknown" } };
1115
1131
  }
@@ -1257,11 +1273,11 @@ var init_progress = __esm({
1257
1273
 
1258
1274
  // packages/tui/src/task-form.ts
1259
1275
  import { spawnSync as spawnSync2 } from "child_process";
1260
- import fs28 from "fs";
1276
+ import fs29 from "fs";
1261
1277
  import os10 from "os";
1262
1278
  import path30 from "path";
1263
1279
  import React, { useEffect, useRef, useState } from "react";
1264
- import { Box, Text, render as render2, useApp, useInput } from "ink";
1280
+ import { Box, Text, render as render3, useApp, useInput } from "ink";
1265
1281
  function newFormState(defaultAutoMode, agents) {
1266
1282
  const agentCli = agents && agents.length > 0 && !agents.some((a) => a.id === "claude") ? agents[0].id : "claude";
1267
1283
  return {
@@ -1396,17 +1412,17 @@ function editorCommand(env, platform) {
1396
1412
  return env.VISUAL?.trim() || env.EDITOR?.trim() || (platform === "win32" ? "notepad" : "vi");
1397
1413
  }
1398
1414
  function editInEditor(text) {
1399
- const dir = fs28.mkdtempSync(path30.join(os10.tmpdir(), "vibeflow-"));
1415
+ const dir = fs29.mkdtempSync(path30.join(os10.tmpdir(), "vibeflow-"));
1400
1416
  const file = path30.join(dir, "description.md");
1401
1417
  try {
1402
- fs28.writeFileSync(file, text);
1418
+ fs29.writeFileSync(file, text);
1403
1419
  const cmd = editorCommand(process.env, process.platform);
1404
1420
  const r = spawnSync2(`${cmd} "${file}"`, { stdio: "inherit", shell: true });
1405
1421
  if (r.error) return { error: `\u7121\u6CD5\u555F\u52D5\u7DE8\u8F2F\u5668\uFF08${cmd}\uFF09\uFF1A${r.error.message}` };
1406
1422
  if (r.status !== 0) return { error: `\u7DE8\u8F2F\u5668\uFF08${cmd}\uFF09\u7D50\u675F\u78BC ${r.status}\uFF0C\u63CF\u8FF0\u672A\u8B8A\u66F4` };
1407
- return { text: fs28.readFileSync(file, "utf8").replace(/\r?\n$/, "") };
1423
+ return { text: fs29.readFileSync(file, "utf8").replace(/\r?\n$/, "") };
1408
1424
  } finally {
1409
- fs28.rmSync(dir, { recursive: true, force: true });
1425
+ fs29.rmSync(dir, { recursive: true, force: true });
1410
1426
  }
1411
1427
  }
1412
1428
  function cycle(list, current, step) {
@@ -1480,7 +1496,7 @@ function FormView({ api, ctx, initial, initialFocus, initialMessage, pristine, o
1480
1496
  if (value2) setProject(path30.resolve(value2.replace(/^~(?=$|\/)/, os10.homedir())));
1481
1497
  } else if (editing === "attachments" && value2) {
1482
1498
  const file = path30.resolve(value2.replace(/^~(?=$|\/)/, os10.homedir()));
1483
- if (!fs28.existsSync(file) || !fs28.statSync(file).isFile()) {
1499
+ if (!fs29.existsSync(file) || !fs29.statSync(file).isFile()) {
1484
1500
  setMessage(`\u627E\u4E0D\u5230\u6A94\u6848\uFF1A${file}`);
1485
1501
  return;
1486
1502
  }
@@ -1649,7 +1665,7 @@ function FormView({ api, ctx, initial, initialFocus, initialMessage, pristine, o
1649
1665
  function showForm(api, ctx, initial, pristine, initialFocus = 0, initialMessage) {
1650
1666
  return new Promise((resolve) => {
1651
1667
  let result = { type: "cancel" };
1652
- const instance = render2(
1668
+ const instance = render3(
1653
1669
  h(FormView, { api, ctx, initial, initialFocus, initialMessage, pristine, onResult: (r) => result = r }),
1654
1670
  { exitOnCtrlC: false }
1655
1671
  );
@@ -1734,7 +1750,7 @@ __export(src_exports, {
1734
1750
  import { spawnSync as spawnSync3 } from "child_process";
1735
1751
  import path31 from "path";
1736
1752
  import React2, { useEffect as useEffect2, useState as useState2 } from "react";
1737
- import { Box as Box2, Text as Text2, render as render3, useApp as useApp2, useInput as useInput2, useStdout } from "ink";
1753
+ import { Box as Box2, Text as Text2, render as render4, useApp as useApp2, useInput as useInput2, useStdout } from "ink";
1738
1754
  function findDetachKey(text) {
1739
1755
  const plain = text.indexOf(DETACH_KEY);
1740
1756
  const m = /\x1b\[\d+;\d+;29;1;\d+;\d+_/.exec(text);
@@ -2005,7 +2021,7 @@ function BoardView({ opts, initial, initialMessage, onAction }) {
2005
2021
  function showBoard(opts, initial, initialMessage) {
2006
2022
  return new Promise((resolve) => {
2007
2023
  let result = { action: { type: "quit" }, sel: initial };
2008
- const instance = render3(
2024
+ const instance = render4(
2009
2025
  h2(BoardView, {
2010
2026
  opts,
2011
2027
  initial,
@@ -2162,7 +2178,7 @@ var init_src = __esm({
2162
2178
  });
2163
2179
 
2164
2180
  // packages/cli/src/main.ts
2165
- import fs29 from "fs";
2181
+ import fs30 from "fs";
2166
2182
  import path32 from "path";
2167
2183
  import { fileURLToPath as fileURLToPath2 } from "url";
2168
2184
  import { parseArgs as parseArgs2 } from "node:util";
@@ -2694,6 +2710,13 @@ function createBridge(t) {
2694
2710
  updateTask: (payload) => t.invoke("vibeflow:updateTask", payload),
2695
2711
  /** Move a Backlog card to In Progress and start its agent on the host. */
2696
2712
  startTask: (taskId) => t.invoke("vibeflow:startTask", taskId),
2713
+ /**
2714
+ * Carry a running card on in a new agent session. It starts from a brief core
2715
+ * builds from the card's own facts, not from the old conversation; `force`
2716
+ * interrupts an agent that is still working. Refusals carry a code
2717
+ * (`NOT_IN_PROGRESS`, `NOT_LAUNCHED`, `NO_WORKTREE`, `AGENT_BUSY`, `ALREADY_CONTINUING`).
2718
+ */
2719
+ continueTask: (payload) => t.invoke("vibeflow:continueTask", payload),
2697
2720
  /** Cards as a master sees them; filter by master or a single card. */
2698
2721
  taskSummaries: (filter) => t.invoke("task:summaries", filter),
2699
2722
  /** Type a message into another card's agent: a master to its cards, a card to its master. */
@@ -2898,11 +2921,6 @@ function spawnHelperFixCommand(failures) {
2898
2921
  // packages/cli/src/task-command.ts
2899
2922
  import { parseArgs } from "node:util";
2900
2923
 
2901
- // packages/core/src/tasks.ts
2902
- import path13 from "path";
2903
- import { randomUUID as randomUUID2 } from "crypto";
2904
- import fs10 from "fs/promises";
2905
-
2906
2924
  // packages/core/src/branch-name.ts
2907
2925
  import os2 from "os";
2908
2926
 
@@ -2983,7 +3001,8 @@ ${description ?? ""}`;
2983
3001
  if (slug) return `${branchPrefix(title, description)}/${slug}`;
2984
3002
  return null;
2985
3003
  }
2986
- async function translateTitleToSlug(title) {
3004
+ var NON_ASCII_LETTER_RE = new RegExp("(?![\\x00-\\x7F])\\p{L}", "u");
3005
+ var claudeTitleTranslator = async (title) => {
2987
3006
  const prompt = `Translate this software task title into a short English git branch slug: 2-6 lowercase words joined by hyphens, no prefix, no quotes, no explanation. Output ONLY the slug.
2988
3007
  Title: ${title}`;
2989
3008
  try {
@@ -2999,15 +3018,25 @@ Title: ${title}`;
2999
3018
  } catch {
3000
3019
  return null;
3001
3020
  }
3002
- }
3003
- async function generateBranchName(title, description) {
3021
+ };
3022
+ async function generateBranchName(title, description, translate) {
3004
3023
  const local = buildCandidateBranch(title, description);
3005
3024
  if (local) return local;
3006
- const translated = await translateTitleToSlug(title);
3007
- if (translated) return `${branchPrefix(title, description)}/${translated}`;
3025
+ if (!translate || !NON_ASCII_LETTER_RE.test(title)) return null;
3026
+ try {
3027
+ const translated = await translate(title);
3028
+ const slug = translated ? slugify(translated) : null;
3029
+ if (slug) return `${branchPrefix(title, description)}/${slug}`;
3030
+ } catch {
3031
+ }
3008
3032
  return null;
3009
3033
  }
3010
3034
 
3035
+ // packages/core/src/tasks.ts
3036
+ import path13 from "path";
3037
+ import { randomUUID as randomUUID2 } from "crypto";
3038
+ import fs10 from "fs/promises";
3039
+
3011
3040
  // packages/core/src/git.ts
3012
3041
  import { execFile as execFile5 } from "child_process";
3013
3042
  import { promisify as promisify2 } from "util";
@@ -4426,12 +4455,13 @@ async function captureTaskOutcome(worktreePath, baseBranch) {
4426
4455
  capturedAt: Date.now()
4427
4456
  };
4428
4457
  }
4429
- async function getPrStatus(worktreePath) {
4458
+ async function getPrStatus(worktreePath, timeoutMs) {
4430
4459
  try {
4431
4460
  const { stdout } = await pexec2(
4432
4461
  "gh",
4433
4462
  ["pr", "view", "--json", "url,number,state"],
4434
- { cwd: worktreePath, env: execEnv() }
4463
+ // A lookup that outlives its caller must not keep the worktree open as a process's cwd.
4464
+ { cwd: worktreePath, env: execEnv(), ...timeoutMs ? { timeout: timeoutMs } : {} }
4435
4465
  );
4436
4466
  const parsed = JSON.parse(stdout.toString().trim());
4437
4467
  if (parsed.url) return parsed;
@@ -4490,11 +4520,11 @@ ${commits || "(none)"}`,
4490
4520
  "",
4491
4521
  "Output ONLY the commit message text, nothing else. Start directly with [What]."
4492
4522
  ].join("\n");
4493
- const cliFlags = {
4494
- claude: ["-p"],
4495
- codex: ["-p"]
4523
+ const cliArgs = {
4524
+ claude: ["-p", "--model", "haiku"],
4525
+ codex: ["exec", "--model", "gpt-5.6-luna", "--sandbox", "read-only", "-"]
4496
4526
  };
4497
- const flags = cliFlags[agentCli] ?? ["-p"];
4527
+ const flags = cliArgs[agentCli] ?? ["-p"];
4498
4528
  const bin = agentCli;
4499
4529
  const stdout = await runAgentPrint(bin, flags, prompt, { cwd: worktreePath });
4500
4530
  const result = stdout.trim();
@@ -4580,7 +4610,7 @@ async function assertDirectory(dir) {
4580
4610
  throw taskError(`\u627E\u4E0D\u5230\u8CC7\u6599\u593E\uFF1A${dir}`, "WORK_DIR_NOT_FOUND");
4581
4611
  }
4582
4612
  }
4583
- async function createTaskFromInput(input) {
4613
+ async function createTaskFromInput(input, options = {}) {
4584
4614
  if (input.role === "master") return createMasterTask(input);
4585
4615
  const projectPath = input.projectPath;
4586
4616
  if (!projectPath) throw taskError("\u5C1A\u672A\u9078\u64C7\u5C08\u6848\u8CC7\u6599\u593E", "PROJECT_NOT_FOUND");
@@ -4609,7 +4639,7 @@ async function createTaskFromInput(input) {
4609
4639
  if (explicitBranch) {
4610
4640
  await assertBranchAvailable(projectPath, workspacePath, explicitBranch);
4611
4641
  }
4612
- const branch = explicitBranch ?? await generateBranchName(input.title, input.description);
4642
+ const branch = explicitBranch ?? await generateBranchName(input.title, input.description, options.translateTitle);
4613
4643
  const draft = {
4614
4644
  id: taskId,
4615
4645
  title: input.title.trim() || `Task ${taskId}`,
@@ -4956,6 +4986,12 @@ task update options:
4956
4986
  task start / list / show / send (need the running VibeFlow host):
4957
4987
  start --task <id> Move a Backlog card to In Progress and start its agent,
4958
4988
  the same as dragging it in the app
4989
+ start --task <id> --new-session [--force]
4990
+ An In Progress card that has run carries on in a NEW agent
4991
+ session: it starts from a short brief (card text, branch and
4992
+ PR state, todos, the last reply), not the old conversation,
4993
+ and its usage so far is kept. Nothing the card produced is
4994
+ touched. --force interrupts an agent that is still working
4959
4995
  list [--master <id>] Every card, or one master's cards, with column, whether
4960
4996
  its agent is running, todo progress, activity and PR
4961
4997
  show --task <id> The same summary for one card
@@ -5045,6 +5081,7 @@ async function taskCommand(argv) {
5045
5081
  text: { type: "string" },
5046
5082
  from: { type: "string" },
5047
5083
  force: { type: "boolean" },
5084
+ "new-session": { type: "boolean" },
5048
5085
  "store-path": { type: "string" },
5049
5086
  profile: { type: "string" },
5050
5087
  help: { type: "boolean", short: "h" }
@@ -5074,6 +5111,8 @@ async function taskCommand(argv) {
5074
5111
  if (!task2) fail("TASK_NOT_FOUND", `Task not found: ${taskId}`);
5075
5112
  return { taskId, path: addTaskArtifact(task2, values.file) };
5076
5113
  }
5114
+ if (values["new-session"] && sub !== "start") fail("INVALID_ARGUMENT", "--new-session only goes with task start");
5115
+ if (sub === "start" && values.force && !values["new-session"]) fail("INVALID_ARGUMENT", "--force goes with task start --new-session");
5077
5116
  if (HOST_COMMANDS.includes(sub)) return hostCommand(sub, values, storePath);
5078
5117
  if (sub === "update") {
5079
5118
  if (!values.task) fail("MISSING_ARGUMENT", "Missing required arguments: --task");
@@ -5142,7 +5181,7 @@ async function taskCommand(argv) {
5142
5181
  autoMode: values["auto-mode"] ? values["auto-mode"] === "on" : void 0,
5143
5182
  attachments,
5144
5183
  storePath
5145
- });
5184
+ }, { translateTitle: claudeTitleTranslator });
5146
5185
  return {
5147
5186
  storePath: resolvedPath,
5148
5187
  task: {
@@ -5172,6 +5211,15 @@ async function hostCommand(sub, values, storePath) {
5172
5211
  if (!lock) fail("HOST_NOT_RUNNING", `No VibeFlow host is running for ${storePath}. Start it with \`vibeflow\` first.`);
5173
5212
  const remote = connectToHost(lock);
5174
5213
  try {
5214
+ if (sub === "start" && values["new-session"]) {
5215
+ try {
5216
+ const { task } = await remote.api.continueTask({ taskId: values.task, force: values.force === true });
5217
+ return { task: { id: task.id, title: task.title, worktreePath: task.worktreePath ?? null }, newSession: true };
5218
+ } catch (err) {
5219
+ const e = err;
5220
+ fail(e.code ?? "HOST_ERROR", e.message ?? String(err));
5221
+ }
5222
+ }
5175
5223
  if (sub === "start") {
5176
5224
  const { task } = await remote.api.startTask(values.task);
5177
5225
  return { task: { id: task.id, title: task.title, worktreePath: task.worktreePath ?? null } };
@@ -5198,7 +5246,7 @@ async function hostCommand(sub, values, storePath) {
5198
5246
  }
5199
5247
 
5200
5248
  // packages/cli/src/host.ts
5201
- import fs26 from "fs";
5249
+ import fs27 from "fs";
5202
5250
  import path28 from "path";
5203
5251
  import { randomBytes as randomBytes2 } from "crypto";
5204
5252
 
@@ -5737,7 +5785,7 @@ async function syncBuiltinsAtStartup() {
5737
5785
  }
5738
5786
 
5739
5787
  // packages/core/src/service.ts
5740
- import fs22 from "fs";
5788
+ import fs23 from "fs";
5741
5789
 
5742
5790
  // packages/core/src/terminal-files.ts
5743
5791
  import { constants } from "fs";
@@ -6636,7 +6684,7 @@ ${children(item).map((child) => render(child)).join("").trimEnd()}
6636
6684
  if (type === "listItem") return body();
6637
6685
  if (type === "table") {
6638
6686
  const rows = children(item).map((row) => {
6639
- const cells = children(record(row) ?? {}).map((cell) => render(cell).trim().replace(/\|/g, "\\|").replace(/\n+/g, " "));
6687
+ const cells = children(record(row) ?? {}).map((cell2) => render(cell2).trim().replace(/\|/g, "\\|").replace(/\n+/g, " "));
6640
6688
  return `| ${cells.join(" | ")} |`;
6641
6689
  });
6642
6690
  if (rows.length === 0) return "";
@@ -7754,25 +7802,151 @@ function createProgressTracker(opts) {
7754
7802
  };
7755
7803
  }
7756
7804
 
7757
- // packages/core/src/inbox.ts
7805
+ // packages/core/src/continuation.ts
7758
7806
  init_launch();
7807
+ init_progress();
7759
7808
  import fs21 from "fs";
7809
+ var MAX_BRIEF_CHARS = 8e3;
7810
+ var MAX_REPLY_CHARS = 2e3;
7811
+ var MAX_DESCRIPTION_CHARS = 4e3;
7812
+ var TAIL_BYTES = 256 * 1024;
7813
+ var CUT = "\u2026\uFF08\u5DF2\u622A\u65B7\uFF09";
7814
+ var LIMITS = [
7815
+ { reply: MAX_REPLY_CHARS, commits: 20, files: 30, todos: 40, cards: 30 },
7816
+ { reply: 800, commits: 10, files: 15, todos: 25, cards: 20 },
7817
+ { reply: 0, commits: 5, files: 8, todos: 15, cards: 10 },
7818
+ { reply: 0, commits: 0, files: 0, todos: 8, cards: 5 }
7819
+ ];
7820
+ function clipText(text, max) {
7821
+ return text.length <= max ? text : `${text.slice(0, Math.max(0, max - CUT.length)).trimEnd()}${CUT}`;
7822
+ }
7823
+ function more(total, shown) {
7824
+ return total > shown ? [` - \u2026\uFF08\u9084\u6709 ${total - shown} \u9805\u672A\u5217\u51FA\uFF09`] : [];
7825
+ }
7826
+ function gitSection(git2, limits) {
7827
+ const lines = ["", "## \u5206\u652F\u8207\u7A0B\u5F0F\u78BC", `- \u5206\u652F\uFF1A\`${git2.branch}\`${git2.baseBranch ? `\uFF0Cbase\uFF1A\`${git2.baseBranch}\`` : ""}`];
7828
+ lines.push(
7829
+ git2.unpushed === null ? "- push \u72C0\u614B\uFF1A\u9019\u500B\u5206\u652F\u9084\u6C92\u6709 upstream\uFF08\u5F9E\u672A push\uFF09" : git2.unpushed > 0 ? `- push \u72C0\u614B\uFF1A\u9818\u5148 upstream ${git2.unpushed} \u500B commit\uFF0C\u5C1A\u672A push` : "- push \u72C0\u614B\uFF1A\u8207 upstream \u540C\u6B65"
7830
+ );
7831
+ if (git2.commits.length === 0) {
7832
+ lines.push("- \u9019\u500B\u5206\u652F\u9084\u6C92\u6709 commit");
7833
+ } else if (limits.commits > 0) {
7834
+ lines.push(`- \`base..HEAD\` \u7684 commit\uFF08\u65B0\u5230\u820A\uFF0C\u5171 ${git2.commits.length} \u7B46\uFF09\uFF1A`);
7835
+ for (const c of git2.commits.slice(0, limits.commits)) lines.push(` - \`${c.shortSha}\` ${c.subject}`);
7836
+ lines.push(...more(git2.commits.length, limits.commits));
7837
+ } else {
7838
+ lines.push(`- \`base..HEAD\` \u5171 ${git2.commits.length} \u7B46 commit\uFF08\u7528 git log \u67E5\u770B\uFF09`);
7839
+ }
7840
+ if (git2.uncommitted.length === 0) {
7841
+ lines.push("- \u6C92\u6709\u672A commit \u7684\u8B8A\u66F4");
7842
+ } else if (limits.files > 0) {
7843
+ lines.push(`- \u672A commit \u7684\u8B8A\u66F4\uFF08${git2.uncommitted.length} \u500B\u6A94\u6848\uFF09\uFF1A`);
7844
+ for (const f of git2.uncommitted.slice(0, limits.files)) lines.push(` - \`${f.status}\` ${f.path}`);
7845
+ lines.push(...more(git2.uncommitted.length, limits.files));
7846
+ } else {
7847
+ lines.push(`- \u6709 ${git2.uncommitted.length} \u500B\u6A94\u6848\u672A commit\uFF08\u7528 git status \u67E5\u770B\uFF09`);
7848
+ }
7849
+ return lines;
7850
+ }
7851
+ function prSection(pr) {
7852
+ return [
7853
+ "",
7854
+ "## PR",
7855
+ pr ? `- #${pr.number} ${pr.state} ${pr.url}` : "- PR \u72C0\u614B\u672A\u77E5\uFF08\u5C1A\u672A\u958B PR\uFF0C\u6216 `gh` \u7121\u6CD5\u4F7F\u7528\u3001\u903E\u6642\uFF09"
7856
+ ];
7857
+ }
7858
+ var TODO_MARK = { completed: "[x]", in_progress: "[~]", pending: "[ ]" };
7859
+ function todoSection(todos, limit) {
7860
+ const lines = ["", "## \u524D\u4E00\u500B session \u7684 todo"];
7861
+ for (const t of todos.slice(0, limit)) lines.push(`- ${TODO_MARK[t.status]} ${t.content}`);
7862
+ if (todos.length > limit) lines.push(`- \u2026\uFF08\u9084\u6709 ${todos.length - limit} \u9805\u672A\u5217\u51FA\uFF09`);
7863
+ return lines;
7864
+ }
7865
+ function replySection(reply, limit) {
7866
+ return ["", "## \u524D\u4E00\u500B session \u7684\u6700\u5F8C\u4E00\u5247\u56DE\u8986", ...clipText(reply, limit).split("\n").map((l) => `> ${l}`)];
7867
+ }
7868
+ var cell = (text) => text.replace(/\|/g, "\\|").replace(/\s+/g, " ");
7869
+ function cardSection(cards, limit) {
7870
+ const lines = ["", "## \u5E95\u4E0B\u7684\u5361\u7247", "| id | \u6A19\u984C | \u6B04\u4F4D | \u57F7\u884C\u4E2D | todo | PR |", "| --- | --- | --- | --- | --- | --- |"];
7871
+ for (const c of cards.slice(0, limit)) {
7872
+ const todos = c.todos ? `${c.todos.done}/${c.todos.total}` : "-";
7873
+ const pr = c.pr ? `#${c.pr.number} ${c.pr.state}` : "-";
7874
+ lines.push(`| ${c.id} | ${cell(c.title)} | ${c.column} | ${c.running ? "\u662F" : "\u5426"} | ${todos} | ${pr} |`);
7875
+ }
7876
+ if (cards.length > limit) lines.push(`\uFF08\u9084\u6709 ${cards.length - limit} \u5F35\u672A\u5217\u51FA\uFF0C\u7528 task list \u67E5\u770B\uFF09`);
7877
+ return lines;
7878
+ }
7879
+ function render2(head, facts, limits) {
7880
+ const lines = [
7881
+ head,
7882
+ "",
7883
+ "\u9019\u662F\u540C\u4E00\u5F35\u5361\u7684\u65B0 session\uFF1A\u524D\u4E00\u500B session \u5DF2\u7D50\u675F\uFF0C\u5B83\u7684\u5C0D\u8A71\u4F60\u770B\u4E0D\u5230\u3002\u4EE5\u4E0B\u662F\u63A5\u7E8C\u6240\u9700\u7684\u4E8B\u5BE6\uFF1B\u539F\u672C\u7684\u6A94\u6848\u3001\u5206\u652F\u8207\u8B8A\u66F4\u90FD\u9084\u5728\u539F\u8655\uFF0C\u6C92\u6709\u4EFB\u4F55\u6771\u897F\u88AB\u4E1F\u68C4\u3002"
7884
+ ];
7885
+ if (facts.git) lines.push(...gitSection(facts.git, limits));
7886
+ if (facts.pr !== void 0) lines.push(...prSection(facts.pr));
7887
+ if (facts.todos?.length) lines.push(...todoSection(facts.todos, limits.todos));
7888
+ if (facts.lastReply && limits.reply > 0) lines.push(...replySection(facts.lastReply, limits.reply));
7889
+ if (facts.cards) lines.push(...cardSection(facts.cards, limits.cards));
7890
+ lines.push(
7891
+ "",
7892
+ "## \u63A5\u7E8C\u6307\u793A",
7893
+ facts.cards ? "\u5148\u78BA\u8A8D\u5E95\u4E0B\u5361\u7247\u7684\u76EE\u524D\u72C0\u614B\uFF1B\u6709\u9700\u8981\u4F60\u8655\u7406\u7684\u5C31\u63A5\u8457\u8655\u7406\uFF0C\u6C92\u6709\u5C31\u7C21\u77ED\u56DE\u5831\u6574\u9AD4\u72C0\u614B\uFF0C\u7136\u5F8C\u7B49\u5F85\u6307\u793A\u3002" : "\u5148\u78BA\u8A8D git status \u8207 PR \u72C0\u614B\uFF1B\u6709\u672A\u5B8C\u6210\u7684 todo \u5C31\u63A5\u8457\u505A\uFF0C\u6C92\u6709\u5C31\u7C21\u77ED\u56DE\u5831\u76EE\u524D\u72C0\u614B\uFF0C\u7136\u5F8C\u7B49\u5F85\u6307\u793A\u3002"
7894
+ );
7895
+ return lines.join("\n");
7896
+ }
7897
+ function buildContinuationPrompt(facts) {
7898
+ const description = facts.description?.trim();
7899
+ const head = buildPrompt({
7900
+ title: facts.title,
7901
+ description: description ? clipText(description, MAX_DESCRIPTION_CHARS) : void 0
7902
+ });
7903
+ for (const limits of LIMITS) {
7904
+ const text = render2(head, facts, limits);
7905
+ if (text.length <= MAX_BRIEF_CHARS) return text;
7906
+ }
7907
+ return clipText(render2(head, facts, LIMITS[LIMITS.length - 1]), MAX_BRIEF_CHARS);
7908
+ }
7909
+ function readLastClaudeReply(file, maxChars) {
7910
+ let fd;
7911
+ try {
7912
+ fd = fs21.openSync(file, "r");
7913
+ const size = fs21.fstatSync(fd).size;
7914
+ const start = Math.max(0, size - TAIL_BYTES);
7915
+ const buf = Buffer.alloc(size - start);
7916
+ fs21.readSync(fd, buf, 0, buf.length, start);
7917
+ let text = buf.toString("utf8");
7918
+ if (start > 0) {
7919
+ const newline = text.indexOf("\n");
7920
+ text = newline === -1 ? "" : text.slice(newline + 1);
7921
+ }
7922
+ const reply = claudeLastReply(text.split("\n").filter((l) => l.trim()));
7923
+ return reply ? clipText(reply, maxChars) : void 0;
7924
+ } catch {
7925
+ return void 0;
7926
+ } finally {
7927
+ if (fd !== void 0) fs21.closeSync(fd);
7928
+ }
7929
+ }
7930
+
7931
+ // packages/core/src/inbox.ts
7932
+ init_launch();
7933
+ import fs22 from "fs";
7760
7934
  import path23 from "path";
7761
7935
  var seq = 0;
7762
7936
  function inboxDir(worktreePath) {
7763
7937
  return path23.join(worktreePath, INBOX_DIR);
7764
7938
  }
7765
7939
  function inboxReady(dir) {
7766
- return fs21.existsSync(path23.join(dir, INBOX_READY_FILE));
7940
+ return fs22.existsSync(path23.join(dir, INBOX_READY_FILE));
7767
7941
  }
7768
7942
  function prepareInbox(dir) {
7769
- fs21.mkdirSync(dir, { recursive: true });
7770
- fs21.writeFileSync(path23.join(dir, ".gitignore"), "*\n");
7771
- fs21.rmSync(path23.join(dir, INBOX_READY_FILE), { force: true });
7943
+ fs22.mkdirSync(dir, { recursive: true });
7944
+ fs22.writeFileSync(path23.join(dir, ".gitignore"), "*\n");
7945
+ fs22.rmSync(path23.join(dir, INBOX_READY_FILE), { force: true });
7772
7946
  }
7773
7947
  function messageNames(dir) {
7774
7948
  try {
7775
- return fs21.readdirSync(dir).filter((n) => !n.startsWith(".")).sort();
7949
+ return fs22.readdirSync(dir).filter((n) => !n.startsWith(".")).sort();
7776
7950
  } catch {
7777
7951
  return [];
7778
7952
  }
@@ -7781,23 +7955,23 @@ function pendingMessages(dir) {
7781
7955
  return messageNames(dir).length;
7782
7956
  }
7783
7957
  function postMessage(dir, text) {
7784
- fs21.mkdirSync(dir, { recursive: true });
7958
+ fs22.mkdirSync(dir, { recursive: true });
7785
7959
  const name = `${String(Date.now()).padStart(13, "0")}-${String(seq++ % 1e6).padStart(6, "0")}`;
7786
7960
  const tmp = path23.join(dir, `.tmp-${name}`);
7787
- fs21.writeFileSync(tmp, text);
7788
- fs21.renameSync(tmp, path23.join(dir, name));
7961
+ fs22.writeFileSync(tmp, text);
7962
+ fs22.renameSync(tmp, path23.join(dir, name));
7789
7963
  }
7790
7964
  function takeMessages(dir) {
7791
7965
  const texts = [];
7792
7966
  for (const name of messageNames(dir)) {
7793
7967
  const claimed = path23.join(dir, `.host-${name}`);
7794
7968
  try {
7795
- fs21.renameSync(path23.join(dir, name), claimed);
7969
+ fs22.renameSync(path23.join(dir, name), claimed);
7796
7970
  } catch {
7797
7971
  continue;
7798
7972
  }
7799
- texts.push(fs21.readFileSync(claimed, "utf8"));
7800
- fs21.rmSync(claimed, { force: true });
7973
+ texts.push(fs22.readFileSync(claimed, "utf8"));
7974
+ fs22.rmSync(claimed, { force: true });
7801
7975
  }
7802
7976
  return texts;
7803
7977
  }
@@ -8073,6 +8247,8 @@ function obj(value, name) {
8073
8247
  if (!value || typeof value !== "object" || Array.isArray(value)) invalid(`${name} must be an object`);
8074
8248
  return value;
8075
8249
  }
8250
+ var PR_LOOKUP_MS = 5e3;
8251
+ var lookUpPr = (worktreePath) => getPrStatus(worktreePath, PR_LOOKUP_MS);
8076
8252
  var LIBRARY_KINDS2 = ["skill", "prompt", "script"];
8077
8253
  var AGENT_IDS2 = ["claude", "codex"];
8078
8254
  var COLUMNS = ["backlog", "in_progress", "done"];
@@ -8110,7 +8286,7 @@ function validBoard(value) {
8110
8286
  }
8111
8287
  return next;
8112
8288
  }
8113
- function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatus, acliRunner, jiraAuthStatus, modelCatalog, jevRouter }) {
8289
+ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatus, acliRunner, jiraAuthStatus, modelCatalog, jevRouter, titleTranslator, prStatus = lookUpPr }) {
8114
8290
  const sink = bus.sink();
8115
8291
  const models = modelCatalog ?? createModelCatalog({ version });
8116
8292
  const router = jevRouter ?? createJevRouter({ getApiKey: readJevApiKey });
@@ -8202,6 +8378,99 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
8202
8378
  if (!wasTracking) progress.untrack(task.id);
8203
8379
  return snapshot?.totalUsage ?? task.usage;
8204
8380
  }
8381
+ const continuing = /* @__PURE__ */ new Set();
8382
+ function executorTranscript(task) {
8383
+ if (!task.worktreePath) return void 0;
8384
+ const file = `${executorSessionId(task.id, task.runId)}.jsonl`;
8385
+ let resolved = task.worktreePath;
8386
+ try {
8387
+ resolved = fs23.realpathSync(task.worktreePath);
8388
+ } catch {
8389
+ }
8390
+ for (const cwd of /* @__PURE__ */ new Set([task.worktreePath, resolved])) {
8391
+ const candidate = path24.join(claudeProjectDir(home, cwd), file);
8392
+ if (fs23.existsSync(candidate)) return candidate;
8393
+ }
8394
+ return void 0;
8395
+ }
8396
+ async function continuationFacts(task) {
8397
+ trackProgress(task);
8398
+ const todos = progress.snapshot(task.id)?.todos;
8399
+ const transcript = taskAgent(task) === "claude" ? executorTranscript(task) : void 0;
8400
+ const lastReply = transcript ? readLastClaudeReply(transcript, MAX_REPLY_CHARS) : void 0;
8401
+ const facts = {
8402
+ title: task.title,
8403
+ description: task.description,
8404
+ ...todos?.length ? { todos } : {},
8405
+ ...lastReply ? { lastReply } : {}
8406
+ };
8407
+ if (isMasterTask(task)) {
8408
+ facts.cards = (await summarizeTasks({ masterId: task.id })).map((c) => ({
8409
+ id: c.id,
8410
+ title: c.title,
8411
+ column: c.column,
8412
+ running: c.running,
8413
+ ...c.todos ? { todos: { done: c.todos.done, total: c.todos.total } } : {},
8414
+ ...c.pr ? { pr: { number: c.pr.number, state: c.pr.state } } : {}
8415
+ }));
8416
+ return facts;
8417
+ }
8418
+ const worktree = gitWorktree(task);
8419
+ if (!worktree) return facts;
8420
+ const [commits, uncommitted, unpushed, pr] = await Promise.all([
8421
+ getBranchCommits(worktree, task.baseBranch ?? "main").catch(() => null),
8422
+ collectWorkingEntries(worktree).catch(() => null),
8423
+ git(worktree, ["rev-list", "--count", "@{u}..HEAD"]).then((n) => Number.parseInt(n, 10) || 0, () => null),
8424
+ prStatus(worktree).catch(() => null)
8425
+ ]);
8426
+ if (commits || uncommitted) {
8427
+ facts.git = {
8428
+ branch: task.branch,
8429
+ ...task.baseBranch ? { baseBranch: task.baseBranch } : {},
8430
+ commits: (commits?.commits ?? []).map((c) => ({ shortSha: c.shortSha, subject: c.subject })),
8431
+ uncommitted: (uncommitted ?? []).map((e) => ({ path: e.path, status: e.status })),
8432
+ unpushed
8433
+ };
8434
+ }
8435
+ facts.pr = pr;
8436
+ return facts;
8437
+ }
8438
+ async function continueTask(taskId, force) {
8439
+ const task = requireTask(taskId);
8440
+ if (continuing.has(task.id)) throw coded2("ALREADY_CONTINUING", "\u9019\u5F35\u5361\u6B63\u5728\u63DB\u65B0 session");
8441
+ const column = columnOf(task.id);
8442
+ if (column !== "in_progress") throw coded2("NOT_IN_PROGRESS", `\u53EA\u6709 In Progress \u7684\u5361\u7247\u53EF\u4EE5\u63DB\u65B0 session\uFF08\u76EE\u524D\u5728 ${column}\uFF09`);
8443
+ if (!task.launchedAt) throw coded2("NOT_LAUNCHED", "\u9019\u5F35\u5361\u9084\u6C92\u6709\u57F7\u884C\u904E\uFF0C\u8ACB\u76F4\u63A5\u555F\u52D5");
8444
+ if (!task.worktreePath) throw coded2("NO_WORKTREE", "\u9019\u5F35\u5361\u6C92\u6709 worktree");
8445
+ continuing.add(task.id);
8446
+ try {
8447
+ if (!force && await sessions.isAlive(task.id)) {
8448
+ trackProgress(task);
8449
+ const activity = agentActivity(task.id);
8450
+ if (activity?.state === "working" || isBlocked(activity)) {
8451
+ throw coded2("AGENT_BUSY", "agent \u6B63\u5728\u57F7\u884C\u6216\u7B49\u5F85\u6B0A\u9650\u78BA\u8A8D\uFF1B\u52A0\u4E0A force \u624D\u6703\u4E2D\u65B7\u5B83\u4E26\u63DB\u65B0 session");
8452
+ }
8453
+ }
8454
+ const brief = buildContinuationPrompt(await continuationFacts(task));
8455
+ const usage = usageThroughCurrentRun(task);
8456
+ updateTask(task.id, { runId: randomUUID5(), launchedAt: Date.now(), ...usage ? { usage } : {} });
8457
+ resetSubAgents(task.worktreePath);
8458
+ bus.emit("subagents:update", { taskId: task.id, subAgents: [] });
8459
+ const next = requireTask(task.id);
8460
+ try {
8461
+ await startTaskSession(next, next.id, { taskId: next.id, launch: {} }, brief);
8462
+ } catch (err) {
8463
+ updateTask(task.id, { runId: task.runId, launchedAt: task.launchedAt, usage: task.usage });
8464
+ trackProgress(findTask(task.id) ?? task);
8465
+ bus.emit("state:changed", getState());
8466
+ throw err;
8467
+ }
8468
+ bus.emit("state:changed", getState());
8469
+ return { state: getState(), task: findTask(task.id) ?? next };
8470
+ } finally {
8471
+ continuing.delete(task.id);
8472
+ }
8473
+ }
8205
8474
  try {
8206
8475
  for (const task of getState().board.in_progress) trackProgress(task);
8207
8476
  } catch {
@@ -8263,12 +8532,12 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
8263
8532
  function settledRoute(task) {
8264
8533
  return task.jevRoute?.status === "routing" ? void 0 : task.jevRoute;
8265
8534
  }
8266
- async function launchCommand(task, intent) {
8535
+ async function launchCommand(task, intent, continuation) {
8267
8536
  const settings = getSettings();
8268
8537
  const library = await libraryLaunchInfo(task.worktreePath);
8269
8538
  const boardCli = await boardCliLaunchInfo();
8270
8539
  let route = settledRoute(task);
8271
- const needsRoute = !taskModel(task) || task.effort === "auto";
8540
+ const needsRoute = !continuation && (!taskModel(task) || task.effort === "auto");
8272
8541
  if (needsRoute && !intent.resume && intent.includeTaskPrompt !== false) {
8273
8542
  let pending = routing.get(task.id);
8274
8543
  if (!pending) {
@@ -8305,7 +8574,8 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
8305
8574
  library: library ?? void 0,
8306
8575
  boardCli,
8307
8576
  autoMode: task.autoMode ?? settings.autoMode,
8308
- preface
8577
+ preface,
8578
+ continuation
8309
8579
  },
8310
8580
  task.workspacePath
8311
8581
  );
@@ -8372,7 +8642,7 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
8372
8642
  authStatus: jiraAuthStatus ?? (() => getJiraAuthStatus(acliRunner)),
8373
8643
  pointFields: () => getSettings().jira?.storyPointsFields?.length ? getSettings().jira.storyPointsFields : DEFAULT_POINT_FIELDS
8374
8644
  });
8375
- async function startTaskSession(requested, key, p) {
8645
+ async function startTaskSession(requested, key, p, continuation) {
8376
8646
  const pending = provisioning.get(requested.id);
8377
8647
  const task = p.launch ? await ensureProvisioned(requested) : pending ? await pending : requested;
8378
8648
  const cwd = task.worktreePath;
@@ -8384,7 +8654,7 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
8384
8654
  if (intent.resume && await sessions.isAlive(key)) {
8385
8655
  fresh = false;
8386
8656
  } else {
8387
- command = (await launchCommand(task, intent)).replace(/\r$/, "");
8657
+ command = (await launchCommand(task, intent, continuation)).replace(/\r$/, "");
8388
8658
  if (key === task.id) prepareInbox(inboxDir(cwd));
8389
8659
  }
8390
8660
  }
@@ -8564,7 +8834,7 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
8564
8834
  // `vibeflow open <path>` while a host runs: only the host writes the store.
8565
8835
  "projects:record": (projectPath) => {
8566
8836
  const p = path24.resolve(str(projectPath, "projectPath"));
8567
- if (!fs22.existsSync(p) || !fs22.statSync(p).isDirectory()) invalid(`not a directory: ${p}`);
8837
+ if (!fs23.existsSync(p) || !fs23.statSync(p).isDirectory()) invalid(`not a directory: ${p}`);
8568
8838
  recordRecentProject(getStore(), p);
8569
8839
  return listRecentProjects(getStore());
8570
8840
  },
@@ -8599,7 +8869,7 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
8599
8869
  attachments: p.attachments,
8600
8870
  github: p.github,
8601
8871
  jira: p.jira
8602
- });
8872
+ }, { translateTitle: titleTranslator });
8603
8873
  return { state: getState(), task };
8604
8874
  },
8605
8875
  "vibeflow:removeTask": (taskId) => {
@@ -8748,6 +9018,14 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
8748
9018
  await startTaskSession(started, task.id, { taskId: task.id, launch: {} });
8749
9019
  return { state: getState(), task: findTask(task.id) ?? started };
8750
9020
  },
9021
+ // A running card carries on in a new agent session: same worktree and branch,
9022
+ // nothing discarded, first message built by core from the card's own facts.
9023
+ // Only an id and `force` come from the client — never the brief's text.
9024
+ "vibeflow:continueTask": async (payload) => {
9025
+ const p = obj(payload, "payload");
9026
+ if (p.force !== void 0 && typeof p.force !== "boolean") invalid("force must be a boolean");
9027
+ return continueTask(str(p.taskId, "taskId"), p.force === true);
9028
+ },
8751
9029
  // Every card on the board, or one master's cards, as the CLI and a master's
8752
9030
  // agent read them.
8753
9031
  "task:summaries": (payload) => {
@@ -8801,7 +9079,7 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
8801
9079
  } else {
8802
9080
  cwd = os9.homedir();
8803
9081
  }
8804
- if (!path24.isAbsolute(cwd) || !fs22.existsSync(cwd) || !fs22.statSync(cwd).isDirectory()) {
9082
+ if (!path24.isAbsolute(cwd) || !fs23.existsSync(cwd) || !fs23.statSync(cwd).isDirectory()) {
8805
9083
  invalid("terminal directory must be an existing absolute directory");
8806
9084
  }
8807
9085
  const title = (typeof p.title === "string" ? p.title.trim() : "") || saved?.title || (projectPath ? path24.basename(projectPath) : "~");
@@ -8879,7 +9157,7 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
8879
9157
  "claude:sessionExists": (taskId) => {
8880
9158
  const task = requireTask(taskId);
8881
9159
  if (!task.worktreePath) return false;
8882
- return fs22.existsSync(claudeSessionFile(task.worktreePath, executorSessionId(task.id, task.runId)));
9160
+ return fs23.existsSync(claudeSessionFile(task.worktreePath, executorSessionId(task.id, task.runId)));
8883
9161
  },
8884
9162
  "sessions:list": async () => {
8885
9163
  const keys = await sessions.list();
@@ -8968,7 +9246,7 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
8968
9246
  const task = requireTask(taskId);
8969
9247
  if (!task.worktreePath || !task.workspacePath) return "task has no worktree";
8970
9248
  const dir = agentArtifactsPath(task.workspacePath, task.worktreePath);
8971
- if (!fs22.existsSync(dir)) return "artifacts directory does not exist yet";
9249
+ if (!fs23.existsSync(dir)) return "artifacts directory does not exist yet";
8972
9250
  return getPlatform().openPath(dir);
8973
9251
  },
8974
9252
  "board:getCliLaunchInfo": () => boardCliLaunchInfo(),
@@ -9099,10 +9377,10 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
9099
9377
  }
9100
9378
  await removeTaskWorktree(task);
9101
9379
  if (task.workspacePath) {
9102
- fs22.rmSync(taskAttachmentStagingPath(task.workspacePath, task.id), { recursive: true, force: true });
9380
+ fs23.rmSync(taskAttachmentStagingPath(task.workspacePath, task.id), { recursive: true, force: true });
9103
9381
  }
9104
9382
  if (isMasterTask(task) && task.workspacePath) {
9105
- fs22.rmSync(task.workspacePath, { recursive: true, force: true });
9383
+ fs23.rmSync(task.workspacePath, { recursive: true, force: true });
9106
9384
  }
9107
9385
  clearConversation(task.id);
9108
9386
  removeTask(task.id);
@@ -9157,7 +9435,7 @@ function createCore({ sessions, bus, version, homeDir, ghRunner, githubAuthStatu
9157
9435
  watchStore() {
9158
9436
  const file = path24.basename(getStorePath());
9159
9437
  let debounce = null;
9160
- storeWatcher = fs22.watch(path24.dirname(getStorePath()), (_event, filename) => {
9438
+ storeWatcher = fs23.watch(path24.dirname(getStorePath()), (_event, filename) => {
9161
9439
  if (filename !== file) return;
9162
9440
  if (debounce) clearTimeout(debounce);
9163
9441
  debounce = setTimeout(() => {
@@ -9194,7 +9472,7 @@ function createSessionBackend(sink, choice) {
9194
9472
  }
9195
9473
 
9196
9474
  // packages/core/src/web-server.ts
9197
- import fs23 from "fs";
9475
+ import fs24 from "fs";
9198
9476
  import http from "http";
9199
9477
  import path25 from "path";
9200
9478
  import { timingSafeEqual } from "crypto";
@@ -9258,7 +9536,7 @@ function resolveStatic(root, urlPath) {
9258
9536
  const full = path25.resolve(base2, c);
9259
9537
  if (full !== base2 && !full.startsWith(base2 + path25.sep)) return null;
9260
9538
  try {
9261
- if (fs23.statSync(full).isFile()) return full;
9539
+ if (fs24.statSync(full).isFile()) return full;
9262
9540
  } catch {
9263
9541
  }
9264
9542
  }
@@ -9332,7 +9610,7 @@ async function startWebServer(options) {
9332
9610
  res.end();
9333
9611
  return;
9334
9612
  }
9335
- fs23.createReadStream(file).pipe(res);
9613
+ fs24.createReadStream(file).pipe(res);
9336
9614
  }
9337
9615
  const wss = new WebSocketServer({ noServer: true, maxPayload: MAX_PAYLOAD });
9338
9616
  function reject(socket, status, reason) {
@@ -9431,7 +9709,7 @@ Content-Length: 0\r
9431
9709
  }
9432
9710
 
9433
9711
  // packages/cli/src/update-command.ts
9434
- import fs24 from "node:fs";
9712
+ import fs25 from "node:fs";
9435
9713
  import path26 from "node:path";
9436
9714
  import { spawnSync } from "node:child_process";
9437
9715
  function npmRunner(args, inherit) {
@@ -9444,7 +9722,7 @@ function npmRunner(args, inherit) {
9444
9722
  }
9445
9723
  function packageName(packageRoot) {
9446
9724
  try {
9447
- const pkg = JSON.parse(fs24.readFileSync(path26.join(packageRoot, "package.json"), "utf8"));
9725
+ const pkg = JSON.parse(fs25.readFileSync(path26.join(packageRoot, "package.json"), "utf8"));
9448
9726
  if (typeof pkg.name !== "string") return null;
9449
9727
  return /^(?:@[a-z0-9][a-z0-9._-]*\/)?[a-z0-9][a-z0-9._-]*$/i.test(pkg.name) ? pkg.name : null;
9450
9728
  } catch {
@@ -9472,7 +9750,7 @@ function runUpdate(options) {
9472
9750
  }
9473
9751
  try {
9474
9752
  const globalPackage = path26.join(String(root.stdout).trim(), ...name.split("/"));
9475
- if (fs24.lstatSync(globalPackage).isSymbolicLink() || fs24.realpathSync(globalPackage) !== fs24.realpathSync(packageRoot)) {
9753
+ if (fs25.lstatSync(globalPackage).isSymbolicLink() || fs25.realpathSync(globalPackage) !== fs25.realpathSync(packageRoot)) {
9476
9754
  error("vibeflow update \u53EA\u9069\u7528\u65BC\u5168\u57DF npm \u5B89\u88DD\uFF1B\u76EE\u524D\u57F7\u884C\u7684\u5957\u4EF6\u4F86\u81EA\u5176\u4ED6\u4F4D\u7F6E\u3002");
9477
9755
  return 1;
9478
9756
  }
@@ -9617,7 +9895,7 @@ async function openUpdateTerminal(platform = process.platform, run3 = launch) {
9617
9895
  }
9618
9896
 
9619
9897
  // packages/cli/src/self-update.ts
9620
- import fs25 from "node:fs";
9898
+ import fs26 from "node:fs";
9621
9899
  import path27 from "node:path";
9622
9900
  import { execFile as execFile10 } from "node:child_process";
9623
9901
  import { promisify as promisify7 } from "node:util";
@@ -9627,7 +9905,7 @@ var PROBE_RETRY_MS = 3e4;
9627
9905
  var HOST_TOKEN_ENV = "VIBEFLOW_HOST_TOKEN";
9628
9906
  function readInstalledVersion(packageRoot) {
9629
9907
  try {
9630
- const pkg = JSON.parse(fs25.readFileSync(path27.join(packageRoot, "package.json"), "utf8"));
9908
+ const pkg = JSON.parse(fs26.readFileSync(path27.join(packageRoot, "package.json"), "utf8"));
9631
9909
  return typeof pkg.version === "string" ? pkg.version : null;
9632
9910
  } catch {
9633
9911
  return null;
@@ -9720,7 +9998,7 @@ async function startHost(options) {
9720
9998
  prefer: options.backend,
9721
9999
  stateDir: options.userDataDir
9722
10000
  });
9723
- const core = createCore({ sessions, bus, version: options.version });
10001
+ const core = createCore({ sessions, bus, version: options.version, titleTranslator: claudeTitleTranslator });
9724
10002
  let updateTimer = null;
9725
10003
  let installTimer = null;
9726
10004
  const packageRoot = options.cliEntry ? path28.dirname(path28.dirname(options.cliEntry)) : null;
@@ -9811,11 +10089,11 @@ function loginUrl(lock, pathname = "/home/") {
9811
10089
  return `http://127.0.0.1:${lock.port}${pathname}?token=${encodeURIComponent(lock.token)}`;
9812
10090
  }
9813
10091
  function isWebDir(dir) {
9814
- return fs26.existsSync(path28.join(dir, "home", "index.html"));
10092
+ return fs27.existsSync(path28.join(dir, "home", "index.html"));
9815
10093
  }
9816
10094
 
9817
10095
  // packages/cli/src/doctor.ts
9818
- import fs27 from "fs";
10096
+ import fs28 from "fs";
9819
10097
  import path29 from "path";
9820
10098
  import { execFile as execFile11 } from "child_process";
9821
10099
  import { promisify as promisify8 } from "util";
@@ -9956,10 +10234,10 @@ async function runDoctor(options) {
9956
10234
  });
9957
10235
  }
9958
10236
  try {
9959
- fs27.mkdirSync(options.userDataDir, { recursive: true });
10237
+ fs28.mkdirSync(options.userDataDir, { recursive: true });
9960
10238
  const probe = path29.join(options.userDataDir, `.doctor-${process.pid}`);
9961
- fs27.writeFileSync(probe, "");
9962
- fs27.rmSync(probe);
10239
+ fs28.writeFileSync(probe, "");
10240
+ fs28.rmSync(probe);
9963
10241
  checks.push({ id: "data", name: "\u8CC7\u6599\u76EE\u9304", level: "ok", detail: options.userDataDir });
9964
10242
  } catch (err) {
9965
10243
  checks.push({
@@ -10031,7 +10309,7 @@ function detectLayout() {
10031
10309
  }
10032
10310
  function readVersion(pkgPath) {
10033
10311
  try {
10034
- return JSON.parse(fs29.readFileSync(pkgPath, "utf8")).version;
10312
+ return JSON.parse(fs30.readFileSync(pkgPath, "utf8")).version;
10035
10313
  } catch {
10036
10314
  return "0.0.0";
10037
10315
  }
@@ -10270,7 +10548,7 @@ async function cmdOpen(values, target, layout, userDataDir) {
10270
10548
  return 1;
10271
10549
  }
10272
10550
  const dir = path32.resolve(target);
10273
- if (!fs29.existsSync(dir) || !fs29.statSync(dir).isDirectory()) {
10551
+ if (!fs30.existsSync(dir) || !fs30.statSync(dir).isDirectory()) {
10274
10552
  console.error(`\u4E0D\u662F\u8CC7\u6599\u593E\uFF1A${dir}`);
10275
10553
  return 1;
10276
10554
  }