@cmmd-center/forge 0.13.13 → 0.13.14

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/bin.cjs CHANGED
@@ -66380,7 +66380,7 @@ function normalizeNumberish(value) {
66380
66380
  }
66381
66381
  //#endregion
66382
66382
  //#region package.json
66383
- var version$1 = "0.13.13";
66383
+ var version$1 = "0.13.14";
66384
66384
  //#endregion
66385
66385
  //#region src/sentry.ts
66386
66386
  const SERVER_APP_NAME = "forge-server";
@@ -215938,6 +215938,7 @@ function buildClaudeSessionContext(input) {
215938
215938
  pendingUserInputs: input.pendingUserInputs,
215939
215939
  turns: [],
215940
215940
  inFlightTools: input.inFlightTools,
215941
+ taskPlan: makeClaudeTaskPlanState(),
215941
215942
  turnState: void 0,
215942
215943
  lastKnownContextWindow: void 0,
215943
215944
  lastKnownTokenUsage: void 0,
@@ -216447,6 +216448,7 @@ function classifyToolItemType(toolName) {
216447
216448
  if (normalized.includes("agent")) return "collab_agent_tool_call";
216448
216449
  if (normalized === "task" || normalized === "agent" || normalized.includes("subagent") || normalized.includes("sub-agent")) return "collab_agent_tool_call";
216449
216450
  if (normalized.includes("bash") || normalized.includes("command") || normalized.includes("shell") || normalized.includes("terminal")) return "command_execution";
216451
+ if (isTaskBookkeepingTool(normalized)) return "dynamic_tool_call";
216450
216452
  if (normalized.includes("edit") || normalized.includes("write") || normalized.includes("file") || normalized.includes("patch") || normalized.includes("replace") || normalized.includes("create") || normalized.includes("delete")) return "file_change";
216451
216453
  if (normalized.includes("browser")) return "browser_automation";
216452
216454
  if (normalized.includes("mcp")) return "mcp_tool_call";
@@ -216466,6 +216468,88 @@ function classifyRequestType(toolName) {
216466
216468
  function isTodoTool(toolName) {
216467
216469
  return toolName.toLowerCase().includes("todowrite");
216468
216470
  }
216471
+ function makeClaudeTaskPlanState() {
216472
+ return {
216473
+ entries: [],
216474
+ createsByToolUseId: /* @__PURE__ */ new Map()
216475
+ };
216476
+ }
216477
+ function taskPlanToolFor(toolName) {
216478
+ const normalized = toolName.toLowerCase();
216479
+ if (normalized === "taskcreate") return "TaskCreate";
216480
+ if (normalized === "taskupdate") return "TaskUpdate";
216481
+ }
216482
+ /** Task bookkeeping tools (create, update, list, get) are not file changes. */
216483
+ function isTaskBookkeepingTool(normalizedToolName) {
216484
+ return /^task(create|update|list|get)$/.test(normalizedToolName);
216485
+ }
216486
+ function taskPlanStatus(value) {
216487
+ return value === "completed" ? "completed" : value === "in_progress" ? "inProgress" : "pending";
216488
+ }
216489
+ function taskPlanSnapshot(state) {
216490
+ return state.entries.map((entry) => ({
216491
+ step: entry.step,
216492
+ status: entry.status
216493
+ }));
216494
+ }
216495
+ /**
216496
+ * Applies one TaskCreate or TaskUpdate input to the session's task list and
216497
+ * returns the plan to publish, or null when the input carries nothing yet.
216498
+ * Input JSON streams in pieces, so the same tool use can arrive more than once;
216499
+ * creates are keyed by tool use id so a repeat updates the entry in place.
216500
+ */
216501
+ function applyTaskPlanToolInput(state, tool, toolUseId, input) {
216502
+ if (tool === "TaskCreate") {
216503
+ const subject = typeof input.subject === "string" ? input.subject.trim() : "";
216504
+ const existing = state.createsByToolUseId.get(toolUseId);
216505
+ if (existing) {
216506
+ if (subject.length > 0) existing.step = subject;
216507
+ return taskPlanSnapshot(state);
216508
+ }
216509
+ const entry = {
216510
+ id: void 0,
216511
+ step: subject.length > 0 ? subject : "Task",
216512
+ status: taskPlanStatus(input.status)
216513
+ };
216514
+ state.entries.push(entry);
216515
+ state.createsByToolUseId.set(toolUseId, entry);
216516
+ return taskPlanSnapshot(state);
216517
+ }
216518
+ const taskId = typeof input.taskId === "string" ? input.taskId.trim() : typeof input.taskId === "number" ? String(input.taskId) : "";
216519
+ if (taskId.length === 0) return null;
216520
+ let entry = state.entries.find((candidate) => candidate.id === taskId);
216521
+ if (!entry) {
216522
+ const position = Number.parseInt(taskId, 10);
216523
+ const candidate = Number.isInteger(position) ? state.entries[position - 1] : void 0;
216524
+ if (candidate && candidate.id === void 0) {
216525
+ candidate.id = taskId;
216526
+ entry = candidate;
216527
+ }
216528
+ }
216529
+ if (input.status === "deleted") {
216530
+ if (entry) state.entries.splice(state.entries.indexOf(entry), 1);
216531
+ return taskPlanSnapshot(state);
216532
+ }
216533
+ if (!entry) {
216534
+ entry = {
216535
+ id: taskId,
216536
+ step: `Task #${taskId}`,
216537
+ status: "pending"
216538
+ };
216539
+ state.entries.push(entry);
216540
+ }
216541
+ if (typeof input.subject === "string" && input.subject.trim().length > 0) entry.step = input.subject.trim();
216542
+ if (input.status !== void 0) entry.status = taskPlanStatus(input.status);
216543
+ return taskPlanSnapshot(state);
216544
+ }
216545
+ const TASK_CREATE_RESULT_ID = /Task #(\S+) created/;
216546
+ /** Binds the id Claude Code assigned in the TaskCreate result to the entry. */
216547
+ function bindTaskPlanCreateResult(state, toolUseId, resultText) {
216548
+ const entry = state.createsByToolUseId.get(toolUseId);
216549
+ if (!entry || entry.id !== void 0) return;
216550
+ const match = TASK_CREATE_RESULT_ID.exec(resultText);
216551
+ if (match?.[1]) entry.id = match[1];
216552
+ }
216469
216553
  function extractPlanStepsFromTodoInput(input) {
216470
216554
  const todos = input.todos;
216471
216555
  if (!Array.isArray(todos) || todos.length === 0) return null;
@@ -217183,9 +217267,9 @@ const makeClaudeAdapter = require_Schema$1.fn("makeClaudeAdapter")(function* (op
217183
217267
  }
217184
217268
  });
217185
217269
  });
217186
- const emitPlanUpdateFromToolInput = require_Schema$1.fn("emitPlanUpdateFromToolInput")(function* (context, toolName, parsedInput) {
217187
- if (!isTodoTool(toolName)) return;
217188
- const planSteps = extractPlanStepsFromTodoInput(parsedInput);
217270
+ const emitPlanUpdateFromToolInput = require_Schema$1.fn("emitPlanUpdateFromToolInput")(function* (context, toolName, toolUseId, parsedInput) {
217271
+ const taskPlanTool = taskPlanToolFor(toolName);
217272
+ const planSteps = taskPlanTool ? applyTaskPlanToolInput(context.taskPlan, taskPlanTool, toolUseId, parsedInput) : isTodoTool(toolName) ? extractPlanStepsFromTodoInput(parsedInput) : null;
217189
217273
  if (!planSteps || planSteps.length === 0) return;
217190
217274
  const planStamp = yield* makeEventStamp();
217191
217275
  yield* offerRuntimeEvent({
@@ -217243,7 +217327,7 @@ const makeClaudeAdapter = require_Schema$1.fn("makeClaudeAdapter")(function* (op
217243
217327
  };
217244
217328
  context.inFlightTools.set(event.index, nextTool);
217245
217329
  yield* emitToolInputUpdated(context, message, nextTool);
217246
- if (state.parsedInput) yield* emitPlanUpdateFromToolInput(context, nextTool.toolName, state.parsedInput);
217330
+ if (state.parsedInput) yield* emitPlanUpdateFromToolInput(context, nextTool.toolName, nextTool.itemId, state.parsedInput);
217247
217331
  });
217248
217332
  const handleContentBlockDeltaEvent = require_Schema$1.fn("handleContentBlockDeltaEvent")(function* (context, message, event) {
217249
217333
  yield* handleTextOrThinkingDelta(context, message, event);
@@ -217296,6 +217380,7 @@ const makeClaudeAdapter = require_Schema$1.fn("makeClaudeAdapter")(function* (op
217296
217380
  if (!toolEntry) continue;
217297
217381
  const [index, tool] = toolEntry;
217298
217382
  const itemStatus = toolResult.isError ? "failed" : "completed";
217383
+ if (taskPlanToolFor(tool.toolName) === "TaskCreate" && !toolResult.isError) bindTaskPlanCreateResult(context.taskPlan, tool.itemId, toolResult.text);
217299
217384
  const toolData = {
217300
217385
  toolName: tool.toolName,
217301
217386
  input: tool.input,
@@ -298458,7 +298543,7 @@ function resolveBuildCommitFromEnv(env) {
298458
298543
  * environment descriptor down instead of reporting an honest "unknown".
298459
298544
  */
298460
298545
  function readBakedBuildCommit() {
298461
- return "81ce9360f406bcb5ae9fbdc9f90dd55d33f25f0c";
298546
+ return "dea91e954d3d2f23154802ae304412fabe90dbbd";
298462
298547
  }
298463
298548
  async function resolveServerBuildCommit(input) {
298464
298549
  if (isFullCommitSha(input.baked)) return input.baked;
package/dist/bin.mjs CHANGED
@@ -22,7 +22,7 @@ import { createCipheriv, createDecipheriv, createHash, createHmac, createPublicK
22
22
  import * as FS$1 from "node:fs";
23
23
  import fs, { accessSync, chmodSync, constants, createReadStream, existsSync, mkdirSync, mkdtempSync, promises, readFile, readFileSync, readdir, readdirSync, realpathSync, rmSync, statSync, unlinkSync, writeFileSync } from "node:fs";
24
24
  import * as NodeOS from "node:os";
25
- import os, { homedir, networkInterfaces, tmpdir } from "node:os";
25
+ import $U, { homedir, networkInterfaces, tmpdir } from "node:os";
26
26
  import * as Path$1 from "node:path";
27
27
  import path, { basename, delimiter, dirname, extname, isAbsolute, join, posix, relative, resolve, sep } from "node:path";
28
28
  import { pathToFileURL } from "node:url";
@@ -50697,7 +50697,7 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
50697
50697
  const min = forceColor || 0;
50698
50698
  if (env.TERM === "dumb") return min;
50699
50699
  if (process$1.platform === "win32") {
50700
- const osRelease = os.release().split(".");
50700
+ const osRelease = $U.release().split(".");
50701
50701
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
50702
50702
  return 1;
50703
50703
  }
@@ -53140,7 +53140,7 @@ var require_ProcessDetector = /* @__PURE__ */ __commonJSMin(((exports) => {
53140
53140
  exports.processDetector = void 0;
53141
53141
  const api_1 = (init_esm$1(), __toCommonJS(esm_exports$1));
53142
53142
  const semconv_1 = require_semconv$1();
53143
- const os$4 = __require("os");
53143
+ const os$3 = __require("os");
53144
53144
  /**
53145
53145
  * ProcessDetector will be used to detect the resources related current process running
53146
53146
  * and being instrumented from the NodeJS Process module.
@@ -53162,7 +53162,7 @@ var require_ProcessDetector = /* @__PURE__ */ __commonJSMin(((exports) => {
53162
53162
  };
53163
53163
  if (process.argv.length > 1) attributes[semconv_1.ATTR_PROCESS_COMMAND] = process.argv[1];
53164
53164
  try {
53165
- const userInfo = os$4.userInfo();
53165
+ const userInfo = os$3.userInfo();
53166
53166
  attributes[semconv_1.ATTR_PROCESS_OWNER] = userInfo.username;
53167
53167
  } catch (e) {
53168
53168
  api_1.diag.debug(`error obtaining process owner: ${e}`);
@@ -66085,7 +66085,7 @@ function normalizeNumberish(value) {
66085
66085
  }
66086
66086
  //#endregion
66087
66087
  //#region package.json
66088
- var version$1 = "0.13.13";
66088
+ var version$1 = "0.13.14";
66089
66089
  //#endregion
66090
66090
  //#region src/sentry.ts
66091
66091
  const SERVER_APP_NAME = "forge-server";
@@ -75698,7 +75698,7 @@ var require_node_gyp_build = /* @__PURE__ */ __commonJSMin(((exports, module) =>
75698
75698
  var fs$6 = __require("fs");
75699
75699
  var path$5 = __require("path");
75700
75700
  var url$1 = __require("url");
75701
- var os$3 = __require("os");
75701
+ var os$2 = __require("os");
75702
75702
  var runtimeRequire = typeof __webpack_require__ === "function" ? __non_webpack_require__ : __require;
75703
75703
  var vars = process.config && process.config.variables || {};
75704
75704
  var prebuildsOnly = !!process.env.PREBUILDS_ONLY;
@@ -75706,8 +75706,8 @@ var require_node_gyp_build = /* @__PURE__ */ __commonJSMin(((exports, module) =>
75706
75706
  var abi = versions.modules;
75707
75707
  if (versions.deno || process.isBun) abi = "unsupported";
75708
75708
  var runtime = isElectron() ? "electron" : isNwjs() ? "node-webkit" : "node";
75709
- var arch = process.env.npm_config_arch || os$3.arch();
75710
- var platform = process.env.npm_config_platform || os$3.platform();
75709
+ var arch = process.env.npm_config_arch || os$2.arch();
75710
+ var platform = process.env.npm_config_platform || os$2.platform();
75711
75711
  var libc = process.env.LIBC || (isMusl(platform) ? "musl" : "glibc");
75712
75712
  var armv = process.env.ARM_VERSION || (arch === "arm64" ? "8" : vars.arm_version) || "";
75713
75713
  var uv = (versions.uv || "").split(".")[0];
@@ -93889,7 +93889,7 @@ const launchDetached = (launch) => gen(function* () {
93889
93889
  });
93890
93890
  const OpenLive = effect(Open, gen(function* () {
93891
93891
  const open = yield* tryPromise({
93892
- try: () => import("./open-FIgTDosf.mjs"),
93892
+ try: () => import("./open-D8mGyWmt.mjs"),
93893
93893
  catch: (cause) => new OpenError$1({
93894
93894
  message: "failed to load browser opener",
93895
93895
  cause
@@ -191252,7 +191252,7 @@ var Vce = {
191252
191252
  function Ve() {
191253
191253
  return Vce;
191254
191254
  }
191255
- var Us = os.homedir(), lk = os.tmpdir(), { env: Vc } = process$1, Yce = (e) => {
191255
+ var Us = $U.homedir(), lk = $U.tmpdir(), { env: Vc } = process$1, Yce = (e) => {
191256
191256
  let t = path.join(Us, "Library");
191257
191257
  return {
191258
191258
  data: path.join(t, "Application Support", e),
@@ -201452,12 +201452,12 @@ function qZ(e, t) {
201452
201452
  }
201453
201453
  return n;
201454
201454
  }
201455
- var os$2 = "https://code.claude.com/docs/en", kKe = [
201455
+ var os$1 = "https://code.claude.com/docs/en", kKe = [
201456
201456
  {
201457
201457
  matches: (e) => e.path === "permissions.defaultMode" && e.code === "invalid_value",
201458
201458
  tip: {
201459
201459
  suggestion: "Valid modes: \"acceptEdits\" (ask before file changes), \"plan\" (analysis only), \"bypassPermissions\" (auto-accept all), or \"default\" (standard behavior)",
201460
- docLink: `${os$2}/iam#permission-modes`
201460
+ docLink: `${os$1}/iam#permission-modes`
201461
201461
  }
201462
201462
  },
201463
201463
  {
@@ -201472,7 +201472,7 @@ var os$2 = "https://code.claude.com/docs/en", kKe = [
201472
201472
  matches: (e) => e.path.startsWith("env.") && e.code === "invalid_type",
201473
201473
  tip: {
201474
201474
  suggestion: "Environment variables must be strings. Wrap numbers and booleans in quotes. Example: \"DEBUG\": \"true\", \"PORT\": \"3000\"",
201475
- docLink: `${os$2}/settings#environment-variables`
201475
+ docLink: `${os$1}/settings#environment-variables`
201476
201476
  }
201477
201477
  },
201478
201478
  {
@@ -201483,14 +201483,14 @@ var os$2 = "https://code.claude.com/docs/en", kKe = [
201483
201483
  matches: (e) => e.path.startsWith("hooks.") && e.code === "invalid_key",
201484
201484
  tip: {
201485
201485
  suggestion: "Not a recognized hook event. Common events: PreToolUse, PostToolUse, UserPromptSubmit, SessionStart, SessionEnd, Stop. Check spelling and capitalization.",
201486
- docLink: `${os$2}/hooks`
201486
+ docLink: `${os$1}/hooks`
201487
201487
  }
201488
201488
  },
201489
201489
  {
201490
201490
  matches: (e) => /\.hooks\.\d+\.command$/.test(e.path) && e.code === "invalid_type" && e.received === "undefined",
201491
201491
  tip: {
201492
201492
  suggestion: "Command hooks require `command`. For exec form (no shell), set `command` to the executable and `args` to its arguments: {\"type\": \"command\", \"command\": \"echo\", \"args\": [\"hi\"]}. For shell form, set `command` to the full shell string: {\"type\": \"command\", \"command\": \"echo hi\"}.",
201493
- docLink: `${os$2}/hooks#exec-form-and-shell-form`
201493
+ docLink: `${os$1}/hooks#exec-form-and-shell-form`
201494
201494
  }
201495
201495
  },
201496
201496
  {
@@ -201505,7 +201505,7 @@ var os$2 = "https://code.claude.com/docs/en", kKe = [
201505
201505
  matches: (e) => e.code === "unrecognized_keys",
201506
201506
  tip: {
201507
201507
  suggestion: "Check for typos or refer to the documentation for valid fields",
201508
- docLink: `${os$2}/settings`
201508
+ docLink: `${os$1}/settings`
201509
201509
  }
201510
201510
  },
201511
201511
  {
@@ -201520,13 +201520,13 @@ var os$2 = "https://code.claude.com/docs/en", kKe = [
201520
201520
  matches: (e) => e.path === "permissions.additionalDirectories" && e.code === "invalid_type",
201521
201521
  tip: {
201522
201522
  suggestion: "Must be an array of directory paths. Example: [\"~/projects\", \"/tmp/workspace\"]. You can also use --add-dir flag or /add-dir command",
201523
- docLink: `${os$2}/iam#working-directories`
201523
+ docLink: `${os$1}/iam#working-directories`
201524
201524
  }
201525
201525
  }
201526
201526
  ], AKe = {
201527
- permissions: `${os$2}/iam#configuring-permissions`,
201528
- env: `${os$2}/settings#environment-variables`,
201529
- hooks: `${os$2}/hooks`
201527
+ permissions: `${os$1}/iam#configuring-permissions`,
201528
+ env: `${os$1}/settings#environment-variables`,
201529
+ hooks: `${os$1}/hooks`
201530
201530
  };
201531
201531
  function GZ(e) {
201532
201532
  let t = kKe.find((r) => r.matches(e));
@@ -215508,6 +215508,7 @@ function buildClaudeSessionContext(input) {
215508
215508
  pendingUserInputs: input.pendingUserInputs,
215509
215509
  turns: [],
215510
215510
  inFlightTools: input.inFlightTools,
215511
+ taskPlan: makeClaudeTaskPlanState(),
215511
215512
  turnState: void 0,
215512
215513
  lastKnownContextWindow: void 0,
215513
215514
  lastKnownTokenUsage: void 0,
@@ -216017,6 +216018,7 @@ function classifyToolItemType(toolName) {
216017
216018
  if (normalized.includes("agent")) return "collab_agent_tool_call";
216018
216019
  if (normalized === "task" || normalized === "agent" || normalized.includes("subagent") || normalized.includes("sub-agent")) return "collab_agent_tool_call";
216019
216020
  if (normalized.includes("bash") || normalized.includes("command") || normalized.includes("shell") || normalized.includes("terminal")) return "command_execution";
216021
+ if (isTaskBookkeepingTool(normalized)) return "dynamic_tool_call";
216020
216022
  if (normalized.includes("edit") || normalized.includes("write") || normalized.includes("file") || normalized.includes("patch") || normalized.includes("replace") || normalized.includes("create") || normalized.includes("delete")) return "file_change";
216021
216023
  if (normalized.includes("browser")) return "browser_automation";
216022
216024
  if (normalized.includes("mcp")) return "mcp_tool_call";
@@ -216036,6 +216038,88 @@ function classifyRequestType(toolName) {
216036
216038
  function isTodoTool(toolName) {
216037
216039
  return toolName.toLowerCase().includes("todowrite");
216038
216040
  }
216041
+ function makeClaudeTaskPlanState() {
216042
+ return {
216043
+ entries: [],
216044
+ createsByToolUseId: /* @__PURE__ */ new Map()
216045
+ };
216046
+ }
216047
+ function taskPlanToolFor(toolName) {
216048
+ const normalized = toolName.toLowerCase();
216049
+ if (normalized === "taskcreate") return "TaskCreate";
216050
+ if (normalized === "taskupdate") return "TaskUpdate";
216051
+ }
216052
+ /** Task bookkeeping tools (create, update, list, get) are not file changes. */
216053
+ function isTaskBookkeepingTool(normalizedToolName) {
216054
+ return /^task(create|update|list|get)$/.test(normalizedToolName);
216055
+ }
216056
+ function taskPlanStatus(value) {
216057
+ return value === "completed" ? "completed" : value === "in_progress" ? "inProgress" : "pending";
216058
+ }
216059
+ function taskPlanSnapshot(state) {
216060
+ return state.entries.map((entry) => ({
216061
+ step: entry.step,
216062
+ status: entry.status
216063
+ }));
216064
+ }
216065
+ /**
216066
+ * Applies one TaskCreate or TaskUpdate input to the session's task list and
216067
+ * returns the plan to publish, or null when the input carries nothing yet.
216068
+ * Input JSON streams in pieces, so the same tool use can arrive more than once;
216069
+ * creates are keyed by tool use id so a repeat updates the entry in place.
216070
+ */
216071
+ function applyTaskPlanToolInput(state, tool, toolUseId, input) {
216072
+ if (tool === "TaskCreate") {
216073
+ const subject = typeof input.subject === "string" ? input.subject.trim() : "";
216074
+ const existing = state.createsByToolUseId.get(toolUseId);
216075
+ if (existing) {
216076
+ if (subject.length > 0) existing.step = subject;
216077
+ return taskPlanSnapshot(state);
216078
+ }
216079
+ const entry = {
216080
+ id: void 0,
216081
+ step: subject.length > 0 ? subject : "Task",
216082
+ status: taskPlanStatus(input.status)
216083
+ };
216084
+ state.entries.push(entry);
216085
+ state.createsByToolUseId.set(toolUseId, entry);
216086
+ return taskPlanSnapshot(state);
216087
+ }
216088
+ const taskId = typeof input.taskId === "string" ? input.taskId.trim() : typeof input.taskId === "number" ? String(input.taskId) : "";
216089
+ if (taskId.length === 0) return null;
216090
+ let entry = state.entries.find((candidate) => candidate.id === taskId);
216091
+ if (!entry) {
216092
+ const position = Number.parseInt(taskId, 10);
216093
+ const candidate = Number.isInteger(position) ? state.entries[position - 1] : void 0;
216094
+ if (candidate && candidate.id === void 0) {
216095
+ candidate.id = taskId;
216096
+ entry = candidate;
216097
+ }
216098
+ }
216099
+ if (input.status === "deleted") {
216100
+ if (entry) state.entries.splice(state.entries.indexOf(entry), 1);
216101
+ return taskPlanSnapshot(state);
216102
+ }
216103
+ if (!entry) {
216104
+ entry = {
216105
+ id: taskId,
216106
+ step: `Task #${taskId}`,
216107
+ status: "pending"
216108
+ };
216109
+ state.entries.push(entry);
216110
+ }
216111
+ if (typeof input.subject === "string" && input.subject.trim().length > 0) entry.step = input.subject.trim();
216112
+ if (input.status !== void 0) entry.status = taskPlanStatus(input.status);
216113
+ return taskPlanSnapshot(state);
216114
+ }
216115
+ const TASK_CREATE_RESULT_ID = /Task #(\S+) created/;
216116
+ /** Binds the id Claude Code assigned in the TaskCreate result to the entry. */
216117
+ function bindTaskPlanCreateResult(state, toolUseId, resultText) {
216118
+ const entry = state.createsByToolUseId.get(toolUseId);
216119
+ if (!entry || entry.id !== void 0) return;
216120
+ const match = TASK_CREATE_RESULT_ID.exec(resultText);
216121
+ if (match?.[1]) entry.id = match[1];
216122
+ }
216039
216123
  function extractPlanStepsFromTodoInput(input) {
216040
216124
  const todos = input.todos;
216041
216125
  if (!Array.isArray(todos) || todos.length === 0) return null;
@@ -216752,9 +216836,9 @@ const makeClaudeAdapter = fn$1("makeClaudeAdapter")(function* (options) {
216752
216836
  }
216753
216837
  });
216754
216838
  });
216755
- const emitPlanUpdateFromToolInput = fn$1("emitPlanUpdateFromToolInput")(function* (context, toolName, parsedInput) {
216756
- if (!isTodoTool(toolName)) return;
216757
- const planSteps = extractPlanStepsFromTodoInput(parsedInput);
216839
+ const emitPlanUpdateFromToolInput = fn$1("emitPlanUpdateFromToolInput")(function* (context, toolName, toolUseId, parsedInput) {
216840
+ const taskPlanTool = taskPlanToolFor(toolName);
216841
+ const planSteps = taskPlanTool ? applyTaskPlanToolInput(context.taskPlan, taskPlanTool, toolUseId, parsedInput) : isTodoTool(toolName) ? extractPlanStepsFromTodoInput(parsedInput) : null;
216758
216842
  if (!planSteps || planSteps.length === 0) return;
216759
216843
  const planStamp = yield* makeEventStamp();
216760
216844
  yield* offerRuntimeEvent({
@@ -216812,7 +216896,7 @@ const makeClaudeAdapter = fn$1("makeClaudeAdapter")(function* (options) {
216812
216896
  };
216813
216897
  context.inFlightTools.set(event.index, nextTool);
216814
216898
  yield* emitToolInputUpdated(context, message, nextTool);
216815
- if (state.parsedInput) yield* emitPlanUpdateFromToolInput(context, nextTool.toolName, state.parsedInput);
216899
+ if (state.parsedInput) yield* emitPlanUpdateFromToolInput(context, nextTool.toolName, nextTool.itemId, state.parsedInput);
216816
216900
  });
216817
216901
  const handleContentBlockDeltaEvent = fn$1("handleContentBlockDeltaEvent")(function* (context, message, event) {
216818
216902
  yield* handleTextOrThinkingDelta(context, message, event);
@@ -216865,6 +216949,7 @@ const makeClaudeAdapter = fn$1("makeClaudeAdapter")(function* (options) {
216865
216949
  if (!toolEntry) continue;
216866
216950
  const [index, tool] = toolEntry;
216867
216951
  const itemStatus = toolResult.isError ? "failed" : "completed";
216952
+ if (taskPlanToolFor(tool.toolName) === "TaskCreate" && !toolResult.isError) bindTaskPlanCreateResult(context.taskPlan, tool.itemId, toolResult.text);
216868
216953
  const toolData = {
216869
216954
  toolName: tool.toolName,
216870
216955
  input: tool.input,
@@ -268751,7 +268836,7 @@ var import_multicast_dns = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMi
268751
268836
  var dgram = __require("dgram");
268752
268837
  var thunky = require_thunky();
268753
268838
  var events = __require("events");
268754
- var os$1 = __require("os");
268839
+ var os = __require("os");
268755
268840
  var noop = function() {};
268756
268841
  module.exports = function(opts) {
268757
268842
  if (!opts) opts = {};
@@ -268882,14 +268967,14 @@ var import_multicast_dns = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMi
268882
268967
  return that;
268883
268968
  };
268884
268969
  function defaultInterface() {
268885
- var networks = os$1.networkInterfaces();
268970
+ var networks = os.networkInterfaces();
268886
268971
  var names = Object.keys(networks);
268887
268972
  for (var i = 0; i < names.length; i++) {
268888
268973
  var net = networks[names[i]];
268889
268974
  for (var j = 0; j < net.length; j++) {
268890
268975
  var iface = net[j];
268891
268976
  if (isIPv4(iface.family) && !iface.internal) {
268892
- if (os$1.platform() === "darwin" && names[i] === "en0") return iface.address;
268977
+ if (os.platform() === "darwin" && names[i] === "en0") return iface.address;
268893
268978
  return "0.0.0.0";
268894
268979
  }
268895
268980
  }
@@ -268897,7 +268982,7 @@ var import_multicast_dns = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMi
268897
268982
  return "127.0.0.1";
268898
268983
  }
268899
268984
  function allInterfaces() {
268900
- var networks = os$1.networkInterfaces();
268985
+ var networks = os.networkInterfaces();
268901
268986
  var names = Object.keys(networks);
268902
268987
  var res = [];
268903
268988
  for (var i = 0; i < names.length; i++) {
@@ -297890,7 +297975,7 @@ function resolveBuildCommitFromEnv(env) {
297890
297975
  * environment descriptor down instead of reporting an honest "unknown".
297891
297976
  */
297892
297977
  function readBakedBuildCommit() {
297893
- return "81ce9360f406bcb5ae9fbdc9f90dd55d33f25f0c";
297978
+ return "dea91e954d3d2f23154802ae304412fabe90dbbd";
297894
297979
  }
297895
297980
  async function resolveServerBuildCommit(input) {
297896
297981
  if (isFullCommitSha(input.baked)) return input.baked;
@@ -322219,7 +322304,7 @@ const connectLoginCommand = make$34("login", {
322219
322304
  })).json();
322220
322305
  },
322221
322306
  openBrowser: async (url) => {
322222
- const open = (await import("./open-FIgTDosf.mjs")).default;
322307
+ const open = (await import("./open-D8mGyWmt.mjs")).default;
322223
322308
  await open(url);
322224
322309
  return true;
322225
322310
  },
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ha as t,Mi as n,Ua as r,Wa as i}from"./Stream-mUTFnSY9.js";import{Do as a,Fn as o,Hc as s,Hr as c,Qr as l,Rr as u,Sr as d,Tn as f,Xr as p,_o as m,_r as h,aa as g,ac as _,d as v,fn as y,fr as b,gr as x,i as S,jn as C,l as w,m as T,n as E,oc as D,qt as O,r as k,rc as A,tc as j,u as M,zr as N}from"./DiffPanelShell-BhokrrDZ.js";import{Tn as P}from"./CompositeItem-DEIBUHJR.js";import{a as F,c as I,f as L,i as R,l as z,m as B,n as V,o as H,p as U,r as W,s as G,t as K}from"./Virtualizer-i6HiQ7Qm.js";import{Dn as q,at as J,it as ee}from"./src-BU7yHzO9.js";import{a as te,c as ne,d as re,h as ie,i as ae,l as oe,m as se,n as ce,o as Y,p as le,r as ue,s as de,t as fe,u as pe}from"./DiffPanel.logic-B9AWYFxE.js";var X=e(i(),1),me=typeof window>`u`?X.useEffect:X.useLayoutEffect;function he({fileDiff:e,options:t,editorOptions:n,lineAnnotations:r,selectedLines:i,prerenderedHTML:a,metrics:o,hasGutterRenderUtility:s,hasCustomHeader:c,disableWorkerPool:l,edit:u}){let d=V(),f=i!==void 0,p=(0,X.useContext)(S),m=M(),h=(0,X.useRef)(null),g=v(n=>{if(n!=null){if(h.current!=null)throw Error(`useFileDiffInstance: An instance should not already exist when a node is created`);d==null?h.current=new re(Z({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),l?void 0:p,!0):h.current=new pe(Z({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),d,o,l?void 0:p,!0),h.current.hydrate({fileDiff:e,fileContainer:n,lineAnnotations:r,prerenderedHTML:a})}else{if(h.current==null)throw Error(`useFileDiffInstance: A FileDiff instance should exist when unmounting`);h.current.cleanUp(),h.current=null}});return me(()=>{let{current:n}=h;if(n==null)return;let a=Z({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),o=a!==void 0&&!O(n.options,a);n.setOptions(a),n.render({forceRender:o,fileDiff:e,lineAnnotations:r}),i!==void 0&&n.setSelectedLines(i)}),me(()=>{if(u&&h.current!=null){if(m===void 0)throw Error(`FileDiff: EditContext is not attached`);let e=m(n??{});if(e==null)throw Error(`FileDiff: EditProvider.createEditor must return an editor instance`);try{return e.edit(h.current)}catch(t){throw e.cleanUp(),t}}},[u]),{ref:g,getHoveredLine:(0,X.useCallback)(()=>h.current?.getHoveredLine(),[])}}function Z({options:e,controlledSelection:t,hasCustomHeader:n,hasGutterRenderUtility:r}){return t||r||n?{...e,controlledSelection:t,renderCustomHeader:n?w:e?.renderCustomHeader,renderGutterUtility:r?w:e?.renderGutterUtility}:e}var Q=r();function ge({fileDiff:e,options:t,editorOptions:n,metrics:r,lineAnnotations:i,selectedLines:a,className:o,style:s,prerenderedHTML:c,renderAnnotation:l,renderCustomHeader:u,renderHeaderPrefix:d,renderHeaderFilenameSuffix:f,renderHeaderMetadata:p,renderGutterUtility:m,disableWorkerPool:h=!1,edit:g=!1}){let{ref:_,getHoveredLine:v}=he({fileDiff:e,options:t,editorOptions:n,metrics:r,lineAnnotations:i,selectedLines:a,prerenderedHTML:c,hasGutterRenderUtility:m!=null,hasCustomHeader:u!=null,disableWorkerPool:h,edit:g});return(0,Q.jsx)(y,{ref:_,className:o,style:s,children:W(oe({fileDiff:e,renderCustomHeader:u,renderHeaderPrefix:d,renderHeaderFilenameSuffix:f,renderHeaderMetadata:p,renderAnnotation:l,renderGutterUtility:m,lineAnnotations:i,getHoveredLine:v}),c)})}var $=t();function _e(e){return e.fromTurnCount===0?q(ee)({threadId:e.threadId,toTurnCount:e.toTurnCount}).pipe(n(e=>({kind:`fullThreadDiff`,input:e}))):q(J)({threadId:e.threadId,fromTurnCount:e.fromTurnCount,toTurnCount:e.toTurnCount}).pipe(n(e=>({kind:`turnDiff`,input:e})))}function ve(e){return e instanceof Error?e.message:typeof e==`string`?e:``}function ye(e){let t=ve(e).trim();if(t.length===0)return`Failed to load checkpoint diff.`;let n=t.toLowerCase();if(n.includes(`not a git repository`))return`Turn diffs are unavailable because this project is not a git repository.`;if(n.includes(`checkpoint unavailable for thread`)||n.includes(`checkpoint invariant violation`)){let e=t.indexOf(`:`);if(e>=0){let n=t.slice(e+1).trim();if(n.length>0)return n}}return t}function be(e){let t=ve(e).toLowerCase();return t.includes(`exceeds current turn count`)||t.includes(`checkpoint is unavailable for turn`)||t.includes(`filesystem checkpoint is unavailable`)}function xe(e){let t=_e(e);return _({queryKey:g.checkpointDiff(e),queryFn:async({signal:n})=>{if(!e.environmentId||!e.threadId||t._tag===`None`)throw Error(`Checkpoint diff is unavailable.`);let r=c(e.environmentId);try{return t.value.kind===`fullThreadDiff`?await r.orchestration.getFullThreadDiff(t.value.input,{signal:n}):await r.orchestration.getTurnDiff(t.value.input,{signal:n})}catch(e){throw Error(ye(e),{cause:e})}},enabled:(e.enabled??!0)&&!!e.environmentId&&!!e.threadId&&t._tag===`Some`,staleTime:1/0,retry:(e,t)=>be(t)?e<12:e<3,retryDelay:(e,t)=>be(t)?Math.min(5e3,250*2**(e-1)):Math.min(1e3,100*2**(e-1))})}function Se(e){if(!(!e.canScrollLeft&&!e.canScrollRight))return{maskImage:`linear-gradient(to right, ${e.canScrollLeft?`transparent 24px, black 72px`:`black`}, ${e.canScrollRight?`black calc(100% - 72px), transparent calc(100% - 24px)`:`black`})`}}function Ce(e){return e instanceof Error?e.message:e?`Failed to load checkpoint diff.`:null}function we(e){return{environmentId:e.environmentId??null,threadId:e.threadId,fromTurnCount:e.range?.fromTurnCount??null,toTurnCount:e.range?.toTurnCount??null,cacheScope:e.selectedTurnId?`turn:${e.selectedTurnId}`:e.conversationCacheScope,enabled:e.enabled}}function Te(){let e=(0,$.c)(8),t=(0,X.useRef)(null),[n,r]=(0,X.useState)(!1),[i,a]=(0,X.useState)(!1),o;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>{let e=t.current;if(!e){r(!1),a(!1);return}let n=de({scrollLeft:e.scrollLeft,scrollWidth:e.scrollWidth,clientWidth:e.clientWidth});r(n.canScrollLeft),a(n.canScrollRight)},e[0]=o):o=e[0];let s=o,c;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=e=>{t.current?.scrollBy({left:e,behavior:`smooth`})},e[1]=c):c=e[1];let l=c,u;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=e=>{let n=t.current;n&&ne({scrollWidth:n.scrollWidth,clientWidth:n.clientWidth,deltaX:e.deltaX,deltaY:e.deltaY})&&(e.preventDefault(),n.scrollBy({left:e.deltaY,behavior:`auto`}))},e[2]=u):u=e[2];let d=u,f,p;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>{let e=t.current;if(!e)return;let n=window.requestAnimationFrame(s),r=()=>s();e.addEventListener(`scroll`,r,{passive:!0});let i=new ResizeObserver(()=>s());return i.observe(e),()=>{window.cancelAnimationFrame(n),e.removeEventListener(`scroll`,r),i.disconnect()}},p=[s],e[3]=f,e[4]=p):(f=e[3],p=e[4]),(0,X.useEffect)(f,p);let m;return e[5]!==n||e[6]!==i?(m={ref:t,canScrollLeft:n,canScrollRight:i,scrollBy:l,onWheel:d,remeasure:s},e[5]=n,e[6]=i,e[7]=m):m=e[7],m}function Ee(e,t){let n=(0,$.c)(5),r;n[0]===e.current?r=n[1]:(r=()=>{(e.current?.querySelector(`[data-turn-chip-selected='true']`))?.scrollIntoView({block:`nearest`,inline:`nearest`,behavior:`smooth`})},n[0]=e.current,n[1]=r);let i;n[2]!==e||n[3]!==t?(i=[e,t],n[2]=e,n[3]=t,n[4]=i):i=n[4],(0,X.useEffect)(r,i)}var De=`
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ha as t,Mi as n,Ua as r,Wa as i}from"./Stream-mUTFnSY9.js";import{Do as a,Fn as o,Hc as s,Hr as c,Qr as l,Rr as u,Sr as d,Tn as f,Xr as p,_o as m,_r as h,aa as g,ac as _,d as v,fn as y,fr as b,gr as x,i as S,jn as C,l as w,m as T,n as E,oc as D,qt as O,r as k,rc as A,tc as j,u as M,zr as N}from"./DiffPanelShell-3EpWEr7p.js";import{Tn as P}from"./CompositeItem-DEIBUHJR.js";import{a as F,c as I,f as L,i as R,l as z,m as B,n as V,o as H,p as U,r as W,s as G,t as K}from"./Virtualizer-DCt36RGD.js";import{Dn as q,at as J,it as ee}from"./src-BU7yHzO9.js";import{a as te,c as ne,d as re,h as ie,i as ae,l as oe,m as se,n as ce,o as Y,p as le,r as ue,s as de,t as fe,u as pe}from"./DiffPanel.logic-BXQ1C0-e.js";var X=e(i(),1),me=typeof window>`u`?X.useEffect:X.useLayoutEffect;function he({fileDiff:e,options:t,editorOptions:n,lineAnnotations:r,selectedLines:i,prerenderedHTML:a,metrics:o,hasGutterRenderUtility:s,hasCustomHeader:c,disableWorkerPool:l,edit:u}){let d=V(),f=i!==void 0,p=(0,X.useContext)(S),m=M(),h=(0,X.useRef)(null),g=v(n=>{if(n!=null){if(h.current!=null)throw Error(`useFileDiffInstance: An instance should not already exist when a node is created`);d==null?h.current=new re(Z({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),l?void 0:p,!0):h.current=new pe(Z({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),d,o,l?void 0:p,!0),h.current.hydrate({fileDiff:e,fileContainer:n,lineAnnotations:r,prerenderedHTML:a})}else{if(h.current==null)throw Error(`useFileDiffInstance: A FileDiff instance should exist when unmounting`);h.current.cleanUp(),h.current=null}});return me(()=>{let{current:n}=h;if(n==null)return;let a=Z({controlledSelection:f,hasCustomHeader:c,hasGutterRenderUtility:s,options:t}),o=a!==void 0&&!O(n.options,a);n.setOptions(a),n.render({forceRender:o,fileDiff:e,lineAnnotations:r}),i!==void 0&&n.setSelectedLines(i)}),me(()=>{if(u&&h.current!=null){if(m===void 0)throw Error(`FileDiff: EditContext is not attached`);let e=m(n??{});if(e==null)throw Error(`FileDiff: EditProvider.createEditor must return an editor instance`);try{return e.edit(h.current)}catch(t){throw e.cleanUp(),t}}},[u]),{ref:g,getHoveredLine:(0,X.useCallback)(()=>h.current?.getHoveredLine(),[])}}function Z({options:e,controlledSelection:t,hasCustomHeader:n,hasGutterRenderUtility:r}){return t||r||n?{...e,controlledSelection:t,renderCustomHeader:n?w:e?.renderCustomHeader,renderGutterUtility:r?w:e?.renderGutterUtility}:e}var Q=r();function ge({fileDiff:e,options:t,editorOptions:n,metrics:r,lineAnnotations:i,selectedLines:a,className:o,style:s,prerenderedHTML:c,renderAnnotation:l,renderCustomHeader:u,renderHeaderPrefix:d,renderHeaderFilenameSuffix:f,renderHeaderMetadata:p,renderGutterUtility:m,disableWorkerPool:h=!1,edit:g=!1}){let{ref:_,getHoveredLine:v}=he({fileDiff:e,options:t,editorOptions:n,metrics:r,lineAnnotations:i,selectedLines:a,prerenderedHTML:c,hasGutterRenderUtility:m!=null,hasCustomHeader:u!=null,disableWorkerPool:h,edit:g});return(0,Q.jsx)(y,{ref:_,className:o,style:s,children:W(oe({fileDiff:e,renderCustomHeader:u,renderHeaderPrefix:d,renderHeaderFilenameSuffix:f,renderHeaderMetadata:p,renderAnnotation:l,renderGutterUtility:m,lineAnnotations:i,getHoveredLine:v}),c)})}var $=t();function _e(e){return e.fromTurnCount===0?q(ee)({threadId:e.threadId,toTurnCount:e.toTurnCount}).pipe(n(e=>({kind:`fullThreadDiff`,input:e}))):q(J)({threadId:e.threadId,fromTurnCount:e.fromTurnCount,toTurnCount:e.toTurnCount}).pipe(n(e=>({kind:`turnDiff`,input:e})))}function ve(e){return e instanceof Error?e.message:typeof e==`string`?e:``}function ye(e){let t=ve(e).trim();if(t.length===0)return`Failed to load checkpoint diff.`;let n=t.toLowerCase();if(n.includes(`not a git repository`))return`Turn diffs are unavailable because this project is not a git repository.`;if(n.includes(`checkpoint unavailable for thread`)||n.includes(`checkpoint invariant violation`)){let e=t.indexOf(`:`);if(e>=0){let n=t.slice(e+1).trim();if(n.length>0)return n}}return t}function be(e){let t=ve(e).toLowerCase();return t.includes(`exceeds current turn count`)||t.includes(`checkpoint is unavailable for turn`)||t.includes(`filesystem checkpoint is unavailable`)}function xe(e){let t=_e(e);return _({queryKey:g.checkpointDiff(e),queryFn:async({signal:n})=>{if(!e.environmentId||!e.threadId||t._tag===`None`)throw Error(`Checkpoint diff is unavailable.`);let r=c(e.environmentId);try{return t.value.kind===`fullThreadDiff`?await r.orchestration.getFullThreadDiff(t.value.input,{signal:n}):await r.orchestration.getTurnDiff(t.value.input,{signal:n})}catch(e){throw Error(ye(e),{cause:e})}},enabled:(e.enabled??!0)&&!!e.environmentId&&!!e.threadId&&t._tag===`Some`,staleTime:1/0,retry:(e,t)=>be(t)?e<12:e<3,retryDelay:(e,t)=>be(t)?Math.min(5e3,250*2**(e-1)):Math.min(1e3,100*2**(e-1))})}function Se(e){if(!(!e.canScrollLeft&&!e.canScrollRight))return{maskImage:`linear-gradient(to right, ${e.canScrollLeft?`transparent 24px, black 72px`:`black`}, ${e.canScrollRight?`black calc(100% - 72px), transparent calc(100% - 24px)`:`black`})`}}function Ce(e){return e instanceof Error?e.message:e?`Failed to load checkpoint diff.`:null}function we(e){return{environmentId:e.environmentId??null,threadId:e.threadId,fromTurnCount:e.range?.fromTurnCount??null,toTurnCount:e.range?.toTurnCount??null,cacheScope:e.selectedTurnId?`turn:${e.selectedTurnId}`:e.conversationCacheScope,enabled:e.enabled}}function Te(){let e=(0,$.c)(8),t=(0,X.useRef)(null),[n,r]=(0,X.useState)(!1),[i,a]=(0,X.useState)(!1),o;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>{let e=t.current;if(!e){r(!1),a(!1);return}let n=de({scrollLeft:e.scrollLeft,scrollWidth:e.scrollWidth,clientWidth:e.clientWidth});r(n.canScrollLeft),a(n.canScrollRight)},e[0]=o):o=e[0];let s=o,c;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=e=>{t.current?.scrollBy({left:e,behavior:`smooth`})},e[1]=c):c=e[1];let l=c,u;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=e=>{let n=t.current;n&&ne({scrollWidth:n.scrollWidth,clientWidth:n.clientWidth,deltaX:e.deltaX,deltaY:e.deltaY})&&(e.preventDefault(),n.scrollBy({left:e.deltaY,behavior:`auto`}))},e[2]=u):u=e[2];let d=u,f,p;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>{let e=t.current;if(!e)return;let n=window.requestAnimationFrame(s),r=()=>s();e.addEventListener(`scroll`,r,{passive:!0});let i=new ResizeObserver(()=>s());return i.observe(e),()=>{window.cancelAnimationFrame(n),e.removeEventListener(`scroll`,r),i.disconnect()}},p=[s],e[3]=f,e[4]=p):(f=e[3],p=e[4]),(0,X.useEffect)(f,p);let m;return e[5]!==n||e[6]!==i?(m={ref:t,canScrollLeft:n,canScrollRight:i,scrollBy:l,onWheel:d,remeasure:s},e[5]=n,e[6]=i,e[7]=m):m=e[7],m}function Ee(e,t){let n=(0,$.c)(5),r;n[0]===e.current?r=n[1]:(r=()=>{(e.current?.querySelector(`[data-turn-chip-selected='true']`))?.scrollIntoView({block:`nearest`,inline:`nearest`,behavior:`smooth`})},n[0]=e.current,n[1]=r);let i;n[2]!==e||n[3]!==t?(i=[e,t],n[2]=e,n[3]=t,n[4]=i):i=n[4],(0,X.useEffect)(r,i)}var De=`
2
2
  [data-diffs-header],
3
3
  [data-diff],
4
4
  [data-file],
@@ -61,4 +61,4 @@ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{Ha as t,Mi as n,Ua as
61
61
  text-decoration-color: currentColor;
62
62
  }
63
63
  `;function Oe(e){let t=(0,$.c)(44),{mode:n}=e,r=n===void 0?`inline`:n,{resolvedTheme:i}=x(),a=h(),[s,c]=(0,X.useState)(`stacked`),[l,u]=(0,X.useState)(a.diffWordWrap),p=(0,X.useRef)(null),m=(0,X.useRef)(!1),g=Te(),{activeCwd:_,activeThread:v,bodyState:y,diffOpen:b,inferredCheckpointTurnCountByTurnId:S,orderedTurnDiffSummaries:C,renderableFiles:w,renderablePatch:T,selectedFilePath:E,selectedTurn:D,selectedTurnId:O}=Le(i),M,P;t[0]!==b||t[1]!==a.diffWordWrap?(M=()=>{b&&!m.current&&u(a.diffWordWrap),m.current=b},P=[b,a.diffWordWrap],t[0]=b,t[1]=a.diffWordWrap,t[2]=M,t[3]=P):(M=t[2],P=t[3]),(0,X.useEffect)(M,P);let F;t[4]===E?F=t[5]:(F=()=>{!E||!p.current||Array.from(p.current.querySelectorAll(`[data-diff-file-path]`)).find(e=>e.dataset.diffFilePath===E)?.scrollIntoView({block:`nearest`})},t[4]=E,t[5]=F);let I;t[6]!==w||t[7]!==E?(I=[E,w],t[6]=w,t[7]=E,t[8]=I):I=t[8],(0,X.useEffect)(F,I);let L;t[9]===_?L=t[10]:(L=e=>{let t=d();if(!t)return;let n=_?f(e,_):e;N(t,n).catch(ke)},t[9]=_,t[10]=L);let R=L,z;t[11]===v?z=t[12]:(z=e=>{v&&o.getState().openDiff(A(j(v.environmentId,v.id)),e)},t[11]=v,t[12]=z);let B=z,V;t[13]===v?V=t[14]:(V=()=>{v&&o.getState().openDiff(A(j(v.environmentId,v.id)))},t[13]=v,t[14]=V);let H=V,U;t[15]===g.remeasure?U=t[16]:(U=()=>{let e=window.requestAnimationFrame(g.remeasure);return()=>window.cancelAnimationFrame(e)},t[15]=g.remeasure,t[16]=U);let W;t[17]!==C||t[18]!==O||t[19]!==g.remeasure?(W=[C,O,g.remeasure],t[17]=C,t[18]=O,t[19]=g.remeasure,t[20]=W):W=t[20],(0,X.useEffect)(U,W),Ee(g.ref,D?.turnId??O);let G;t[21]!==s||t[22]!==l||t[23]!==S||t[24]!==C||t[25]!==B||t[26]!==H||t[27]!==D||t[28]!==O||t[29]!==a||t[30]!==g?(G=(0,Q.jsx)(Ae,{diffRenderMode:s,diffWordWrap:l,inferredCheckpointTurnCountByTurnId:S,orderedTurnDiffSummaries:C,selectTurn:B,selectWholeConversation:H,selectedTurn:D,selectedTurnId:O,setDiffRenderMode:c,setDiffWordWrap:u,settings:a,turnStrip:g}),t[21]=s,t[22]=l,t[23]=S,t[24]=C,t[25]=B,t[26]=H,t[27]=D,t[28]=O,t[29]=a,t[30]=g,t[31]=G):G=t[31];let K=G,q;t[32]!==y||t[33]!==s||t[34]!==l||t[35]!==R||t[36]!==w||t[37]!==T||t[38]!==i?(q=(0,Q.jsx)(je,{bodyState:y,diffRenderMode:s,diffWordWrap:l,openDiffFileInEditor:R,patchViewportRef:p,renderableFiles:w,renderablePatch:T,resolvedTheme:i}),t[32]=y,t[33]=s,t[34]=l,t[35]=R,t[36]=w,t[37]=T,t[38]=i,t[39]=q):q=t[39];let J;return t[40]!==K||t[41]!==r||t[42]!==q?(J=(0,Q.jsx)(k,{mode:r,header:K,children:q}),t[40]=K,t[41]=r,t[42]=q,t[43]=J):J=t[43],J}function ke(e){console.warn(`Failed to open diff file in editor.`,e)}function Ae(e){let t=(0,$.c)(59),{diffRenderMode:n,diffWordWrap:r,inferredCheckpointTurnCountByTurnId:i,orderedTurnDiffSummaries:a,selectTurn:o,selectWholeConversation:s,selectedTurn:c,selectedTurnId:l,setDiffRenderMode:u,setDiffWordWrap:d,settings:f,turnStrip:p}=e,m,h;t[0]===p?(m=t[1],h=t[2]):(m=(0,Q.jsx)(Be,{direction:`left`,strip:p}),h=(0,Q.jsx)(Be,{direction:`right`,strip:p}),t[0]=p,t[1]=m,t[2]=h);let g=p.ref,_;t[3]!==p.canScrollLeft||t[4]!==p.canScrollRight?(_=Se({canScrollLeft:p.canScrollLeft,canScrollRight:p.canScrollRight}),t[3]=p.canScrollLeft,t[4]=p.canScrollRight,t[5]=_):_=t[5];let v=p.onWheel,y=l===null,b=l===null?`border-border bg-accent text-accent-foreground`:`border-border/70 bg-background/70 text-muted-foreground/80 hover:border-border hover:text-foreground/80`,x;t[6]===b?x=t[7]:(x=P(`rounded-md border px-2 py-1 text-left transition-colors`,b),t[6]=b,t[7]=x);let S;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsx)(`div`,{className:`text-[10px] leading-tight font-medium`,children:`All turns`}),t[8]=S):S=t[8];let C;t[9]===x?C=t[10]:(C=(0,Q.jsx)(`div`,{className:x,children:S}),t[9]=x,t[10]=C);let w;t[11]!==s||t[12]!==C||t[13]!==y?(w=(0,Q.jsx)(`button`,{type:`button`,className:`shrink-0 rounded-md`,onClick:s,"data-turn-chip-selected":y,children:C}),t[11]=s,t[12]=C,t[13]=y,t[14]=w):w=t[14];let T;if(t[15]!==i||t[16]!==a||t[17]!==o||t[18]!==c?.turnId||t[19]!==f){let e;t[21]!==i||t[22]!==o||t[23]!==c?.turnId||t[24]!==f?(e=e=>(0,Q.jsx)(Ve,{summary:e,selected:e.turnId===c?.turnId,turnCount:e.checkpointTurnCount??i[e.turnId],timestampFormat:f.timestampFormat,onSelect:o},e.turnId),t[21]=i,t[22]=o,t[23]=c?.turnId,t[24]=f,t[25]=e):e=t[25],T=a.map(e),t[15]=i,t[16]=a,t[17]=o,t[18]=c?.turnId,t[19]=f,t[20]=T}else T=t[20];let E;t[26]!==w||t[27]!==T||t[28]!==_||t[29]!==p.onWheel||t[30]!==p.ref?(E=(0,Q.jsxs)(`div`,{ref:g,className:`turn-chip-strip flex gap-1 overflow-x-auto px-8 py-0.5`,style:_,onWheel:v,children:[w,T]}),t[26]=w,t[27]=T,t[28]=_,t[29]=p.onWheel,t[30]=p.ref,t[31]=E):E=t[31];let D;t[32]!==m||t[33]!==E||t[34]!==h?(D=(0,Q.jsxs)(`div`,{className:`relative min-w-0 flex-1 [-webkit-app-region:no-drag]`,children:[m,h,E]}),t[32]=m,t[33]=E,t[34]=h,t[35]=D):D=t[35];let O;t[36]===n?O=t[37]:(O=[n],t[36]=n,t[37]=O);let k;t[38]===u?k=t[39]:(k=e=>{let t=e[0];(t===`stacked`||t===`split`)&&u(t)},t[38]=u,t[39]=k);let A;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,Q.jsx)(R,{"aria-label":`Stacked diff view`,value:`stacked`,children:(0,Q.jsx)(se,{className:`size-3`})}),t[40]=A):A=t[40];let j;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(j=(0,Q.jsx)(R,{"aria-label":`Split diff view`,value:`split`,children:(0,Q.jsx)(ie,{className:`size-3`})}),t[41]=j):j=t[41];let M;t[42]!==O||t[43]!==k?(M=(0,Q.jsxs)(F,{className:`shrink-0`,variant:`outline`,size:`xs`,value:O,onValueChange:k,children:[A,j]}),t[42]=O,t[43]=k,t[44]=M):M=t[44];let N=r?`Disable diff line wrapping`:`Enable diff line wrapping`,I=r?`Disable line wrapping`:`Enable line wrapping`,L;t[45]===d?L=t[46]:(L=e=>{d(!!e)},t[45]=d,t[46]=L);let z;t[47]===Symbol.for(`react.memo_cache_sentinel`)?(z=(0,Q.jsx)(le,{className:`size-3`}),t[47]=z):z=t[47];let B;t[48]!==r||t[49]!==N||t[50]!==I||t[51]!==L?(B=(0,Q.jsx)(R,{"aria-label":N,title:I,variant:`outline`,size:`xs`,pressed:r,onPressedChange:L,children:z}),t[48]=r,t[49]=N,t[50]=I,t[51]=L,t[52]=B):B=t[52];let V;t[53]!==M||t[54]!==B?(V=(0,Q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1 [-webkit-app-region:no-drag]`,children:[M,B]}),t[53]=M,t[54]=B,t[55]=V):V=t[55];let H;return t[56]!==D||t[57]!==V?(H=(0,Q.jsxs)(Q.Fragment,{children:[D,V]}),t[56]=D,t[57]=V,t[58]=H):H=t[58],H}function je(e){let t=(0,$.c)(18),{bodyState:n,diffRenderMode:r,diffWordWrap:i,openDiffFileInEditor:a,patchViewportRef:o,renderableFiles:s,renderablePatch:c,resolvedTheme:l}=e;if(n.kind===`no-thread`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(Ne,{children:`Select a thread to inspect turn diffs.`}),t[0]=e):e=t[0],e}if(n.kind===`not-git-repo`){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(Ne,{children:`Turn diffs are unavailable because this project is not a git repository.`}),t[1]=e):e=t[1],e}if(n.kind===`no-completed-turns`){let e;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(Ne,{children:`No completed turns yet.`}),t[2]=e):e=t[2],e}let u;t[3]!==n.error||t[4]!==c?(u=n.error&&!c&&(0,Q.jsx)(`div`,{className:`px-3`,children:(0,Q.jsx)(`p`,{className:`mb-2 text-[11px] text-destructive-foreground`,children:n.error})}),t[3]=n.error,t[4]=c,t[5]=u):u=t[5];let d;t[6]!==n||t[7]!==r||t[8]!==i||t[9]!==a||t[10]!==s||t[11]!==c||t[12]!==l?(d=c?c.kind===`files`?(0,Q.jsx)(K,{className:`diff-render-surface h-full min-h-0 overflow-auto px-2 pb-2`,config:{overscrollSize:600,intersectionObserverMargin:1200},children:s.map(e=>{let t=Y(e),n=`${fe(e)}:${l}`;return(0,Q.jsx)(`div`,{"data-diff-file-path":t,className:`diff-render-file mb-2 rounded-md first:mt-2 last:mb-0`,onClickCapture:e=>{(e.nativeEvent.composedPath?.()??[]).some(Me)&&a(t)},children:(0,Q.jsx)(ge,{fileDiff:e,options:{diffStyle:r===`split`?`split`:`unified`,lineDiffType:`none`,overflow:i?`wrap`:`scroll`,theme:T(l),themeType:l,unsafeCSS:De}})},n)})}):(0,Q.jsx)(`div`,{className:`h-full overflow-auto p-2`,children:(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(`p`,{className:`text-[11px] text-muted-foreground/75`,children:c.reason}),(0,Q.jsx)(`pre`,{className:P(`max-h-[72vh] rounded-md border border-border/70 bg-background/70 p-3 font-mono text-[11px] leading-relaxed text-muted-foreground/90`,i?`overflow-auto whitespace-pre-wrap wrap-break-word`:`overflow-auto`),children:c.text})]})}):(0,Q.jsx)(Re,{bodyState:n}),t[6]=n,t[7]=r,t[8]=i,t[9]=a,t[10]=s,t[11]=c,t[12]=l,t[13]=d):d=t[13];let f;return t[14]!==o||t[15]!==u||t[16]!==d?(f=(0,Q.jsx)(Q.Fragment,{children:(0,Q.jsxs)(`div`,{ref:o,className:`diff-panel-viewport min-h-0 min-w-0 flex-1 overflow-hidden`,children:[u,d]})}),t[14]=o,t[15]=u,t[16]=d,t[17]=f):f=t[17],f}function Me(e){return e instanceof Element&&e.hasAttribute(`data-title`)}function Ne(e){let t=(0,$.c)(2),{children:n}=e,r;return t[0]===n?r=t[1]:(r=(0,Q.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-5 text-center text-xs text-muted-foreground/70`,children:n}),t[0]=n,t[1]=r),r}function Pe(){let e=(0,$.c)(19),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={strict:!1,select:Ie},e[0]=t):t=e[0];let n=s(t),r;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(r={strict:!1,select:Fe},e[1]=r):r=e[1];let i=B(r),o=i.rightPanel===`diff`,c=n?.threadId??null,l,d;e[2]===n?d=e[3]:(d=C(n),e[2]=n,e[3]=d),l=d;let f=a(l),p=He(f),m=f?.worktreePath,h=p?.cwd,g;e[4]!==m||e[5]!==h?(g=I({threadWorktreePath:m,projectCwd:h}),e[4]=m,e[5]=h,e[6]=g):g=e[6];let _=g,v=f?.environmentId??null,y=_??null,b;e[7]!==v||e[8]!==y?(b={environmentId:v,cwd:y},e[7]=v,e[8]=y,e[9]=b):b=e[9];let x=u(b),S;e[10]===x.data?S=e[11]:(S=z(x.data),e[10]=x.data,e[11]=S);let w=S,T;return e[12]!==_||e[13]!==f||e[14]!==c||e[15]!==o||e[16]!==i||e[17]!==w?(T={activeThread:f,activeThreadId:c,activeCwd:_,isGitRepo:w,diffSearch:i,diffOpen:o},e[12]=_,e[13]=f,e[14]=c,e[15]=o,e[16]=i,e[17]=w,e[18]=T):T=e[18],T}function Fe(e){return G(e)}function Ie(e){return p(e)}function Le(e){let{activeThread:t,activeThreadId:n,activeCwd:r,isGitRepo:i,diffSearch:a,diffOpen:o}=Pe(),{turnDiffSummaries:s,inferredCheckpointTurnCountByTurnId:c}=H(t),l=a.diffTurnId??null,u=l===null?null:a.diffFilePath??null,{activeCheckpointRange:d,conversationCacheScope:f,orderedTurnDiffSummaries:p,selectedTurn:m}=(0,X.useMemo)(()=>te({summaries:s,inferredCheckpointTurnCountByTurnId:c,selectedTurnId:l}),[c,l,s]),h=D(xe(we({environmentId:t?.environmentId,threadId:n,range:d,selectedTurnId:m?.turnId,conversationCacheScope:f,enabled:i}))),g=h.isLoading,_=Ce(h.error),v=h.data?.diff,y=typeof v==`string`&&v.trim().length===0,{emptyDiffMessage:b}=(0,X.useMemo)(()=>ae(m),[m]),x=(0,X.useMemo)(()=>ce(v,`diff-panel:${e}`),[e,v]),S=(0,X.useMemo)(()=>Ue(x),[x]);return{activeCwd:r,activeThread:t,bodyState:ue({hasActiveThread:!!t,isGitRepo:i,turnSummaryCount:p.length,checkpointDiffError:_,hasRenderablePatch:!!x,isLoadingCheckpointDiff:g,hasNoNetChanges:y,emptyDiffMessage:b}),diffOpen:o,inferredCheckpointTurnCountByTurnId:c,orderedTurnDiffSummaries:p,renderableFiles:S,renderablePatch:x,selectedFilePath:u,selectedTurn:m,selectedTurnId:l}}function Re(e){let t=(0,$.c)(4),{bodyState:n}=e;if(n.kind===`loading`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(E,{label:`Loading checkpoint diff...`}),t[0]=e):e=t[0],e}let r;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsx)(L,{className:`size-7 text-muted-foreground/25`}),t[1]=r):r=t[1];let i=n.kind===`empty`?n.message:`No diff is available for this range.`,a;return t[2]===i?a=t[3]:(a=(0,Q.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-2 px-5 py-2 text-center`,children:[r,(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground/70`,children:i})]}),t[2]=i,t[3]=a),a}var ze=180;function Be(e){let t=(0,$.c)(14),{direction:n,strip:r}=e,i=n===`left`,a=i?r.canScrollLeft:r.canScrollRight,o=i?U:l,s=i?`left-0`:`right-0`,c=a?`border-border/70 hover:border-border hover:text-foreground`:`cursor-not-allowed border-border/40 text-muted-foreground/40`,u;t[0]!==s||t[1]!==c?(u=P(`absolute top-1/2 z-20 inline-flex size-6 -translate-y-1/2 items-center justify-center rounded-md border bg-background/90 text-muted-foreground transition-colors`,s,c),t[0]=s,t[1]=c,t[2]=u):u=t[2];let d;t[3]!==i||t[4]!==r?(d=()=>r.scrollBy(i?-180:ze),t[3]=i,t[4]=r,t[5]=d):d=t[5];let f=!a,p=`Scroll turn list ${n}`,m;t[6]===o?m=t[7]:(m=(0,Q.jsx)(o,{className:`size-3.5`}),t[6]=o,t[7]=m);let h;return t[8]!==u||t[9]!==d||t[10]!==f||t[11]!==p||t[12]!==m?(h=(0,Q.jsx)(`button`,{type:`button`,className:u,onClick:d,disabled:f,"aria-label":p,children:m}),t[8]=u,t[9]=d,t[10]=f,t[11]=p,t[12]=m,t[13]=h):h=t[13],h}function Ve(e){let t=(0,$.c)(23),{summary:n,selected:r,turnCount:i,timestampFormat:a,onSelect:o}=e,s;t[0]!==o||t[1]!==n.turnId?(s=()=>o(n.turnId),t[0]=o,t[1]=n.turnId,t[2]=s):s=t[2];let c=n.turnId,l=r?`border-border bg-accent text-accent-foreground`:`border-border/70 bg-background/70 text-muted-foreground/80 hover:border-border hover:text-foreground/80`,u;t[3]===l?u=t[4]:(u=P(`rounded-md border px-2 py-1 text-left transition-colors`,l),t[3]=l,t[4]=u);let d=i??`?`,f;t[5]===d?f=t[6]:(f=(0,Q.jsxs)(`span`,{className:`text-[10px] leading-tight font-medium`,children:[`Turn `,d]}),t[5]=d,t[6]=f);let p;t[7]!==n.completedAt||t[8]!==a?(p=b(n.completedAt,a),t[7]=n.completedAt,t[8]=a,t[9]=p):p=t[9];let m;t[10]===p?m=t[11]:(m=(0,Q.jsx)(`span`,{className:`text-[9px] leading-tight opacity-70`,children:p}),t[10]=p,t[11]=m);let h;t[12]!==f||t[13]!==m?(h=(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[f,m]}),t[12]=f,t[13]=m,t[14]=h):h=t[14];let g;t[15]!==u||t[16]!==h?(g=(0,Q.jsx)(`div`,{className:u,children:h}),t[15]=u,t[16]=h,t[17]=g):g=t[17];let _;return t[18]!==r||t[19]!==n.turnId||t[20]!==s||t[21]!==g?(_=(0,Q.jsx)(`button`,{type:`button`,className:`shrink-0 rounded-md`,onClick:s,title:c,"data-turn-chip-selected":r,children:g}),t[18]=r,t[19]=n.turnId,t[20]=s,t[21]=g,t[22]=_):_=t[22],_}function He(e){let t=(0,$.c)(3),n=e?.environmentId,r=e?.projectId,i;return t[0]!==n||t[1]!==r?(i=e=>n&&r?m(e,{environmentId:n,projectId:r}):void 0,t[0]=n,t[1]=r,t[2]=i):i=t[2],a(i)}function Ue(e){return!e||e.kind!==`files`?[]:e.files.toSorted((e,t)=>Y(e).localeCompare(Y(t),void 0,{numeric:!0,sensitivity:`base`}))}export{Oe as default};
64
- //# sourceMappingURL=DiffPanel-cwm7LEtZ.js.map
64
+ //# sourceMappingURL=DiffPanel-P3t5Fq1q.js.map