@cmmd-center/forge 0.13.65 → 0.13.67

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
@@ -26977,6 +26977,24 @@ const RelayWsRpcGroup = WsRpcGroup.middleware(RelayAuthorizationMiddleware).midd
26977
26977
  */
26978
26978
  const SessionWsRpcGroup = WsRpcGroup.middleware(SessionAuthorizationMiddleware);
26979
26979
  //#endregion
26980
+ //#region ../../packages/contracts/src/cmmdRuntimeSpriteIdentity.ts
26981
+ function nonEmptyString$3(value) {
26982
+ return typeof value === "string" && value.length > 0 ? value : null;
26983
+ }
26984
+ /**
26985
+ * Resolve the operational Sprite name for provision / connect / readiness gates.
26986
+ *
26987
+ * @see CmmdRuntimeSpriteIdentitySource for the dual-contract rules.
26988
+ */
26989
+ function resolveCmmdRuntimeSpriteName(runtime) {
26990
+ if (Object.hasOwn(runtime, "spriteName")) return nonEmptyString$3(runtime.spriteName);
26991
+ return nonEmptyString$3(runtime.flyMachineId);
26992
+ }
26993
+ /** True when the payload carries an operational Sprite name after dual-read. */
26994
+ function hasCmmdRuntimeSpriteIdentity(runtime) {
26995
+ return resolveCmmdRuntimeSpriteName(runtime) !== null;
26996
+ }
26997
+ //#endregion
26980
26998
  //#region ../../packages/contracts/src/cmmdRuntimeThreadLifecycle.ts
26981
26999
  const FORGE_LIFECYCLE_METADATA_KEY = "forgeLifecycle";
26982
27000
  const FORGE_LIFECYCLE_SCHEMA_VERSION = 1;
@@ -66257,7 +66275,7 @@ function normalizeNumberish(value) {
66257
66275
  }
66258
66276
  //#endregion
66259
66277
  //#region package.json
66260
- var version$1 = "0.13.65";
66278
+ var version$1 = "0.13.67";
66261
66279
  //#endregion
66262
66280
  //#region src/sentry.ts
66263
66281
  const SERVER_APP_NAME = "forge-server";
@@ -94812,7 +94830,7 @@ var SpriteTaskHoldReactor = class extends require_Schema$1.Service()("forge/orch
94812
94830
  //#endregion
94813
94831
  //#region src/orchestration/bootstrapLaunch.ts
94814
94832
  /**
94815
- * The entry point for launching a thread: a bootstrap turn start, held awake.
94833
+ * Holds every turn start awake until the provider reports that the turn started.
94816
94834
  *
94817
94835
  * A launch creates the thread, adds the worktree and starts the setup script before the first
94818
94836
  * provider event exists, so no turn hold covers it. On a sprite with nothing connected that
@@ -94836,6 +94854,15 @@ const withLaunchHold = (threadId, launch) => require_Schema$1.gen(function* () {
94836
94854
  });
94837
94855
  /** `dispatchBootstrapTurnStart` from `bootstrapDispatch.ts`, with the launch held awake. */
94838
94856
  const dispatchBootstrapTurnStart = (input, command) => withLaunchHold(String(command.threadId), dispatchBootstrapTurnStart$1(input, command));
94857
+ /** Holds a plain turn start until the reactor can hand the hold to the provider turn. */
94858
+ const dispatchTurnStartHeld = (engine, command) => withLaunchHold(String(command.threadId), engine.dispatch(command));
94859
+ /**
94860
+ * Dispatches a command that is not a bootstrap launch. An interrupt goes through the bootstrap
94861
+ * interrupt path, a turn start is held awake until the provider reports that it started, and
94862
+ * every other command reaches the engine unchanged. The websocket and the http route both call
94863
+ * this, so the hold rule has one definition.
94864
+ */
94865
+ const dispatchCommandHeld = (engine, command) => command.type === "thread.turn.interrupt" ? interruptBootstrapTurnStart(engine, command) : command.type === "thread.turn.start" ? dispatchTurnStartHeld(engine, command) : engine.dispatch(command);
94839
94866
  //#endregion
94840
94867
  //#region src/orchestration/Services/OrchestrationEngine.ts
94841
94868
  /**
@@ -107400,7 +107427,7 @@ const makeWsRpcLayer = (currentSessionId, currentUserId) => WsRpcGroup.toLayer(r
107400
107427
  git,
107401
107428
  gitStatusBroadcaster,
107402
107429
  projectSetupScriptRunner
107403
- }, normalizedCommand) : (normalizedCommand.type === "thread.turn.interrupt" ? interruptBootstrapTurnStart(orchestrationEngine, normalizedCommand) : orchestrationEngine.dispatch(normalizedCommand)).pipe(require_Schema$1.mapError((cause) => toDispatchCommandError(cause, "Failed to dispatch orchestration command")));
107430
+ }, normalizedCommand) : dispatchCommandHeld(orchestrationEngine, normalizedCommand).pipe(require_Schema$1.mapError((cause) => toDispatchCommandError(cause, "Failed to dispatch orchestration command")));
107404
107431
  return startup.enqueueCommand(dispatchEffect).pipe(require_Schema$1.mapError((cause) => toDispatchCommandError(cause, "Failed to dispatch orchestration command")));
107405
107432
  };
107406
107433
  const loadServerConfig = require_Schema$1.gen(function* () {
@@ -151623,7 +151650,9 @@ const SERVER_ONLY_PROVIDER_CHILD_ENV_KEYS = new Set([
151623
151650
  "FORGE_CMMD_RUNTIME_PUBLIC_KEY",
151624
151651
  "FORGE_PROVIDER_PROXY_URL",
151625
151652
  "FORGE_PROXY_HMAC_SECRET",
151626
- "FORGE_PPROXY_HMAC_SECRET"
151653
+ "FORGE_PPROXY_HMAC_SECRET",
151654
+ "SPRITE_API_TOKEN",
151655
+ "SPRITES_TOKEN"
151627
151656
  ]);
151628
151657
  function scrubForgeProviderChildEnvSecrets(env) {
151629
151658
  const scrubbed = { ...env };
@@ -294180,7 +294209,7 @@ const CheckpointReactorLive = require_Schema$1.effect(CheckpointReactor, make$7)
294180
294209
  * release it. The budget is what stops that hold from keeping the sprite billing.
294181
294210
  */
294182
294211
  const LAUNCH_HOLD_MAX_REFRESHES = 10;
294183
- /** The hold id of a thread's launch. One launch per thread, so the thread names it. */
294212
+ /** The hold id of a pending turn start. The thread names it until turn.started arrives. */
294184
294213
  const launchHoldId = (threadId) => `launch-${threadId}`;
294185
294214
  const make$6 = require_Schema$1.gen(function* () {
294186
294215
  const providerService = yield* ProviderService;
@@ -298380,7 +298409,7 @@ function resolveBuildCommitFromEnv(env) {
298380
298409
  * environment descriptor down instead of reporting an honest "unknown".
298381
298410
  */
298382
298411
  function readBakedBuildCommit() {
298383
- return "06c11aad2e4673f13061c7bed6d0a4cb63ff8122";
298412
+ return "6271419f1f7ae1b4b230a3a057e99636794e247c";
298384
298413
  }
298385
298414
  async function resolveServerBuildCommit(input) {
298386
298415
  if (isFullCommitSha(input.baked)) return input.baked;
@@ -307418,7 +307447,7 @@ const orchestrationDispatchRouteLayer = add$1("POST", "/api/orchestration/dispat
307418
307447
  }).pipe(require_Schema$1.mapError((cause) => new OrchestrationDispatchCommandError({
307419
307448
  message: "Failed to dispatch orchestration command.",
307420
307449
  cause
307421
- }))) : (normalizedCommand.type === "thread.turn.interrupt" ? interruptBootstrapTurnStart(orchestrationEngine, normalizedCommand) : orchestrationEngine.dispatch(normalizedCommand)).pipe(require_Schema$1.mapError((cause) => new OrchestrationDispatchCommandError({
307450
+ }))) : dispatchCommandHeld(orchestrationEngine, normalizedCommand).pipe(require_Schema$1.mapError((cause) => new OrchestrationDispatchCommandError({
307422
307451
  message: "Failed to dispatch orchestration command.",
307423
307452
  cause
307424
307453
  })));
@@ -311053,7 +311082,10 @@ function isLegacyRuntimeConnection(value, expectedRuntimeId) {
311053
311082
  return [
311054
311083
  runtime.runtimeId === expectedRuntimeId,
311055
311084
  runtime.runtimeCapabilityMode === "legacy_env",
311056
- isNonEmptyString$1(runtime.flyMachineId),
311085
+ hasCmmdRuntimeSpriteIdentity({
311086
+ ...Object.hasOwn(runtime, "spriteName") ? { spriteName: typeof runtime.spriteName === "string" ? runtime.spriteName : null } : {},
311087
+ ...Object.hasOwn(runtime, "flyMachineId") ? { flyMachineId: typeof runtime.flyMachineId === "string" ? runtime.flyMachineId : null } : {}
311088
+ }),
311057
311089
  !Object.hasOwn(runtime, "brokerAuthorityAttestedForgeGitCommit"),
311058
311090
  runtime.brokerAuthorityAttestedImageRef === null,
311059
311091
  runtime.brokerAuthorityAttestedImageVersion === null,
@@ -321168,7 +321200,7 @@ const execFilePromise = (0, node_util.promisify)(node_child_process.execFile);
321168
321200
  const COMMAND_TIMEOUT_MS = 15e3;
321169
321201
  const MAX_COMMAND_OUTPUT_BYTES = 32e3;
321170
321202
  const MAX_PROCESSES = 80;
321171
- const sanitizeRuntimeDiagnosticText = (value) => value.replace(/\b(OPENAI_API_KEY|ANTHROPIC_API_KEY|ANTHROPIC_AUTH_TOKEN|FLY_ACCESS_TOKEN|FLY_API_TOKEN|GITHUB_TOKEN|FORGE_CMMD_RUNTIME_GRANT_TOKEN|FORGE_NPM_PROXY_TOKEN|FORGE_PROXY_HMAC_SECRET|FORGE_PPROXY_HMAC_SECRET|CMMD_FORGE_RUNTIME_TICKET_PRIVATE_KEY|CMMD_FORGE_RUNTIME_BROWSER_WEBRTC_ICE_SERVERS)=\S+/g, "$1=[redacted]").replace(/\bforge_proxy_[A-Za-z0-9._-]+/g, "forge_proxy_[redacted]").replace(/\bcmmd_provider_[A-Za-z0-9._-]+/g, "cmmd_provider_[redacted]").replace(/\bruntime-grant\.[A-Za-z0-9._-]+/g, "runtime-grant.[redacted]").replace(/\b(sk|ghp|github_pat)_[A-Za-z0-9._-]+/g, "$1_[redacted]").replace(/\bsk-[A-Za-z0-9._-]+/g, "sk-[redacted]");
321203
+ const sanitizeRuntimeDiagnosticText = (value) => value.replace(/\b(OPENAI_API_KEY|ANTHROPIC_API_KEY|ANTHROPIC_AUTH_TOKEN|FLY_ACCESS_TOKEN|FLY_API_TOKEN|SPRITES_TOKEN|SPRITE_API_TOKEN|GITHUB_TOKEN|FORGE_CMMD_RUNTIME_GRANT_TOKEN|FORGE_NPM_PROXY_TOKEN|FORGE_PROXY_HMAC_SECRET|FORGE_PPROXY_HMAC_SECRET|CMMD_FORGE_RUNTIME_TICKET_PRIVATE_KEY|CMMD_FORGE_RUNTIME_BROWSER_WEBRTC_ICE_SERVERS)=\S+/g, "$1=[redacted]").replace(/\bforge_proxy_[A-Za-z0-9._-]+/g, "forge_proxy_[redacted]").replace(/\bcmmd_provider_[A-Za-z0-9._-]+/g, "cmmd_provider_[redacted]").replace(/\bruntime-grant\.[A-Za-z0-9._-]+/g, "runtime-grant.[redacted]").replace(/\b(sk|ghp|github_pat)_[A-Za-z0-9._-]+/g, "$1_[redacted]").replace(/\bsk-[A-Za-z0-9._-]+/g, "sk-[redacted]");
321172
321204
  const sanitizeRuntimeDiagnosticValue = (value) => {
321173
321205
  const trimmed = value?.trim();
321174
321206
  if (!trimmed) return void 0;
@@ -321215,16 +321247,15 @@ const parseProcessList = (output) => output.split("\n").map((line) => line.trim(
321215
321247
  if (!Number.isFinite(pid) || !Number.isFinite(ppid) || !stat || !command) return void 0;
321216
321248
  const cpuPercent = parseMeasurement(cpuRaw);
321217
321249
  const rssKb = parseMeasurement(rssRaw);
321218
- const measurements = {};
321219
- if (cpuPercent !== null) measurements.cpuPercent = cpuPercent;
321220
- if (rssKb !== null) measurements.rssKb = rssKb;
321221
- return {
321250
+ const parsed = {
321222
321251
  pid,
321223
321252
  ppid,
321224
321253
  stat: sanitizeRuntimeDiagnosticText(stat),
321225
- command: sanitizeRuntimeDiagnosticText(command),
321226
- ...measurements
321254
+ command: sanitizeRuntimeDiagnosticText(command)
321227
321255
  };
321256
+ if (cpuPercent !== null) parsed.cpuPercent = cpuPercent;
321257
+ if (rssKb !== null) parsed.rssKb = rssKb;
321258
+ return parsed;
321228
321259
  }).filter((process) => process !== void 0).slice(0, MAX_PROCESSES);
321229
321260
  /**
321230
321261
  * The process tree, or the reason there isn't one.
package/dist/bin.mjs CHANGED
@@ -23,7 +23,7 @@ import { createCipheriv, createDecipheriv, createHash, createHmac, createPublicK
23
23
  import * as FS$1 from "node:fs";
24
24
  import fs, { accessSync, chmodSync, constants, createReadStream, existsSync, mkdirSync, mkdtempSync, promises, readFile, readFileSync, readdir, readdirSync, realpathSync, rmSync, statSync, unlinkSync, writeFileSync } from "node:fs";
25
25
  import * as NodeOS from "node:os";
26
- import os, { homedir, networkInterfaces, tmpdir } from "node:os";
26
+ import $U, { homedir, networkInterfaces, tmpdir } from "node:os";
27
27
  import * as Path$1 from "node:path";
28
28
  import path, { basename, delimiter, dirname, extname, isAbsolute, join, posix, relative, resolve, sep } from "node:path";
29
29
  import { pathToFileURL } from "node:url";
@@ -26689,6 +26689,24 @@ const RelayWsRpcGroup = WsRpcGroup.middleware(RelayAuthorizationMiddleware).midd
26689
26689
  */
26690
26690
  const SessionWsRpcGroup = WsRpcGroup.middleware(SessionAuthorizationMiddleware);
26691
26691
  //#endregion
26692
+ //#region ../../packages/contracts/src/cmmdRuntimeSpriteIdentity.ts
26693
+ function nonEmptyString$3(value) {
26694
+ return typeof value === "string" && value.length > 0 ? value : null;
26695
+ }
26696
+ /**
26697
+ * Resolve the operational Sprite name for provision / connect / readiness gates.
26698
+ *
26699
+ * @see CmmdRuntimeSpriteIdentitySource for the dual-contract rules.
26700
+ */
26701
+ function resolveCmmdRuntimeSpriteName(runtime) {
26702
+ if (Object.hasOwn(runtime, "spriteName")) return nonEmptyString$3(runtime.spriteName);
26703
+ return nonEmptyString$3(runtime.flyMachineId);
26704
+ }
26705
+ /** True when the payload carries an operational Sprite name after dual-read. */
26706
+ function hasCmmdRuntimeSpriteIdentity(runtime) {
26707
+ return resolveCmmdRuntimeSpriteName(runtime) !== null;
26708
+ }
26709
+ //#endregion
26692
26710
  //#region ../../packages/contracts/src/cmmdRuntimeThreadLifecycle.ts
26693
26711
  const FORGE_LIFECYCLE_METADATA_KEY = "forgeLifecycle";
26694
26712
  const FORGE_LIFECYCLE_SCHEMA_VERSION = 1;
@@ -50573,7 +50591,7 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
50573
50591
  const min = forceColor || 0;
50574
50592
  if (env.TERM === "dumb") return min;
50575
50593
  if (process$1.platform === "win32") {
50576
- const osRelease = os.release().split(".");
50594
+ const osRelease = $U.release().split(".");
50577
50595
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
50578
50596
  return 1;
50579
50597
  }
@@ -53016,7 +53034,7 @@ var require_ProcessDetector = /* @__PURE__ */ __commonJSMin(((exports) => {
53016
53034
  exports.processDetector = void 0;
53017
53035
  const api_1 = (init_esm$1(), __toCommonJS(esm_exports$1));
53018
53036
  const semconv_1 = require_semconv$1();
53019
- const os$4 = __require("os");
53037
+ const os$3 = __require("os");
53020
53038
  /**
53021
53039
  * ProcessDetector will be used to detect the resources related current process running
53022
53040
  * and being instrumented from the NodeJS Process module.
@@ -53038,7 +53056,7 @@ var require_ProcessDetector = /* @__PURE__ */ __commonJSMin(((exports) => {
53038
53056
  };
53039
53057
  if (process.argv.length > 1) attributes[semconv_1.ATTR_PROCESS_COMMAND] = process.argv[1];
53040
53058
  try {
53041
- const userInfo = os$4.userInfo();
53059
+ const userInfo = os$3.userInfo();
53042
53060
  attributes[semconv_1.ATTR_PROCESS_OWNER] = userInfo.username;
53043
53061
  } catch (e) {
53044
53062
  api_1.diag.debug(`error obtaining process owner: ${e}`);
@@ -65961,7 +65979,7 @@ function normalizeNumberish(value) {
65961
65979
  }
65962
65980
  //#endregion
65963
65981
  //#region package.json
65964
- var version$1 = "0.13.65";
65982
+ var version$1 = "0.13.67";
65965
65983
  //#endregion
65966
65984
  //#region src/sentry.ts
65967
65985
  const SERVER_APP_NAME = "forge-server";
@@ -75844,7 +75862,7 @@ var require_node_gyp_build = /* @__PURE__ */ __commonJSMin(((exports, module) =>
75844
75862
  var fs$6 = __require("fs");
75845
75863
  var path$5 = __require("path");
75846
75864
  var url$1 = __require("url");
75847
- var os$3 = __require("os");
75865
+ var os$2 = __require("os");
75848
75866
  var runtimeRequire = typeof __webpack_require__ === "function" ? __non_webpack_require__ : __require;
75849
75867
  var vars = process.config && process.config.variables || {};
75850
75868
  var prebuildsOnly = !!process.env.PREBUILDS_ONLY;
@@ -75852,8 +75870,8 @@ var require_node_gyp_build = /* @__PURE__ */ __commonJSMin(((exports, module) =>
75852
75870
  var abi = versions.modules;
75853
75871
  if (versions.deno || process.isBun) abi = "unsupported";
75854
75872
  var runtime = isElectron() ? "electron" : isNwjs() ? "node-webkit" : "node";
75855
- var arch = process.env.npm_config_arch || os$3.arch();
75856
- var platform = process.env.npm_config_platform || os$3.platform();
75873
+ var arch = process.env.npm_config_arch || os$2.arch();
75874
+ var platform = process.env.npm_config_platform || os$2.platform();
75857
75875
  var libc = process.env.LIBC || (isMusl(platform) ? "musl" : "glibc");
75858
75876
  var armv = process.env.ARM_VERSION || (arch === "arm64" ? "8" : vars.arm_version) || "";
75859
75877
  var uv = (versions.uv || "").split(".")[0];
@@ -93662,7 +93680,7 @@ const launchDetached = (launch) => gen(function* () {
93662
93680
  });
93663
93681
  const OpenLive = effect(Open, gen(function* () {
93664
93682
  const open = yield* tryPromise({
93665
- try: () => import("./open-yHTUkd2Y.mjs"),
93683
+ try: () => import("./open-2-reBrpv.mjs"),
93666
93684
  catch: (cause) => new OpenError$1({
93667
93685
  message: "failed to load browser opener",
93668
93686
  cause
@@ -94448,7 +94466,7 @@ var SpriteTaskHoldReactor = class extends Service$1()("forge/orchestration/Servi
94448
94466
  //#endregion
94449
94467
  //#region src/orchestration/bootstrapLaunch.ts
94450
94468
  /**
94451
- * The entry point for launching a thread: a bootstrap turn start, held awake.
94469
+ * Holds every turn start awake until the provider reports that the turn started.
94452
94470
  *
94453
94471
  * A launch creates the thread, adds the worktree and starts the setup script before the first
94454
94472
  * provider event exists, so no turn hold covers it. On a sprite with nothing connected that
@@ -94472,6 +94490,15 @@ const withLaunchHold = (threadId, launch) => gen(function* () {
94472
94490
  });
94473
94491
  /** `dispatchBootstrapTurnStart` from `bootstrapDispatch.ts`, with the launch held awake. */
94474
94492
  const dispatchBootstrapTurnStart = (input, command) => withLaunchHold(String(command.threadId), dispatchBootstrapTurnStart$1(input, command));
94493
+ /** Holds a plain turn start until the reactor can hand the hold to the provider turn. */
94494
+ const dispatchTurnStartHeld = (engine, command) => withLaunchHold(String(command.threadId), engine.dispatch(command));
94495
+ /**
94496
+ * Dispatches a command that is not a bootstrap launch. An interrupt goes through the bootstrap
94497
+ * interrupt path, a turn start is held awake until the provider reports that it started, and
94498
+ * every other command reaches the engine unchanged. The websocket and the http route both call
94499
+ * this, so the hold rule has one definition.
94500
+ */
94501
+ const dispatchCommandHeld = (engine, command) => command.type === "thread.turn.interrupt" ? interruptBootstrapTurnStart(engine, command) : command.type === "thread.turn.start" ? dispatchTurnStartHeld(engine, command) : engine.dispatch(command);
94475
94502
  //#endregion
94476
94503
  //#region src/orchestration/Services/OrchestrationEngine.ts
94477
94504
  /**
@@ -106994,7 +107021,7 @@ const makeWsRpcLayer = (currentSessionId, currentUserId) => WsRpcGroup.toLayer(g
106994
107021
  git,
106995
107022
  gitStatusBroadcaster,
106996
107023
  projectSetupScriptRunner
106997
- }, normalizedCommand) : (normalizedCommand.type === "thread.turn.interrupt" ? interruptBootstrapTurnStart(orchestrationEngine, normalizedCommand) : orchestrationEngine.dispatch(normalizedCommand)).pipe(mapError((cause) => toDispatchCommandError(cause, "Failed to dispatch orchestration command")));
107024
+ }, normalizedCommand) : dispatchCommandHeld(orchestrationEngine, normalizedCommand).pipe(mapError((cause) => toDispatchCommandError(cause, "Failed to dispatch orchestration command")));
106998
107025
  return startup.enqueueCommand(dispatchEffect).pipe(mapError((cause) => toDispatchCommandError(cause, "Failed to dispatch orchestration command")));
106999
107026
  };
107000
107027
  const loadServerConfig = gen(function* () {
@@ -151196,7 +151223,9 @@ const SERVER_ONLY_PROVIDER_CHILD_ENV_KEYS = new Set([
151196
151223
  "FORGE_CMMD_RUNTIME_PUBLIC_KEY",
151197
151224
  "FORGE_PROVIDER_PROXY_URL",
151198
151225
  "FORGE_PROXY_HMAC_SECRET",
151199
- "FORGE_PPROXY_HMAC_SECRET"
151226
+ "FORGE_PPROXY_HMAC_SECRET",
151227
+ "SPRITE_API_TOKEN",
151228
+ "SPRITES_TOKEN"
151200
151229
  ]);
151201
151230
  function scrubForgeProviderChildEnvSecrets(env) {
151202
151231
  const scrubbed = { ...env };
@@ -191540,7 +191569,7 @@ var Vce = {
191540
191569
  function Ve() {
191541
191570
  return Vce;
191542
191571
  }
191543
- var Us = os.homedir(), lk = os.tmpdir(), { env: Vc } = process$1, Yce = (e) => {
191572
+ var Us = $U.homedir(), lk = $U.tmpdir(), { env: Vc } = process$1, Yce = (e) => {
191544
191573
  let t = path.join(Us, "Library");
191545
191574
  return {
191546
191575
  data: path.join(t, "Application Support", e),
@@ -201740,12 +201769,12 @@ function qZ(e, t) {
201740
201769
  }
201741
201770
  return n;
201742
201771
  }
201743
- var os$2 = "https://code.claude.com/docs/en", kKe = [
201772
+ var os$1 = "https://code.claude.com/docs/en", kKe = [
201744
201773
  {
201745
201774
  matches: (e) => e.path === "permissions.defaultMode" && e.code === "invalid_value",
201746
201775
  tip: {
201747
201776
  suggestion: "Valid modes: \"acceptEdits\" (ask before file changes), \"plan\" (analysis only), \"bypassPermissions\" (auto-accept all), or \"default\" (standard behavior)",
201748
- docLink: `${os$2}/iam#permission-modes`
201777
+ docLink: `${os$1}/iam#permission-modes`
201749
201778
  }
201750
201779
  },
201751
201780
  {
@@ -201760,7 +201789,7 @@ var os$2 = "https://code.claude.com/docs/en", kKe = [
201760
201789
  matches: (e) => e.path.startsWith("env.") && e.code === "invalid_type",
201761
201790
  tip: {
201762
201791
  suggestion: "Environment variables must be strings. Wrap numbers and booleans in quotes. Example: \"DEBUG\": \"true\", \"PORT\": \"3000\"",
201763
- docLink: `${os$2}/settings#environment-variables`
201792
+ docLink: `${os$1}/settings#environment-variables`
201764
201793
  }
201765
201794
  },
201766
201795
  {
@@ -201771,14 +201800,14 @@ var os$2 = "https://code.claude.com/docs/en", kKe = [
201771
201800
  matches: (e) => e.path.startsWith("hooks.") && e.code === "invalid_key",
201772
201801
  tip: {
201773
201802
  suggestion: "Not a recognized hook event. Common events: PreToolUse, PostToolUse, UserPromptSubmit, SessionStart, SessionEnd, Stop. Check spelling and capitalization.",
201774
- docLink: `${os$2}/hooks`
201803
+ docLink: `${os$1}/hooks`
201775
201804
  }
201776
201805
  },
201777
201806
  {
201778
201807
  matches: (e) => /\.hooks\.\d+\.command$/.test(e.path) && e.code === "invalid_type" && e.received === "undefined",
201779
201808
  tip: {
201780
201809
  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\"}.",
201781
- docLink: `${os$2}/hooks#exec-form-and-shell-form`
201810
+ docLink: `${os$1}/hooks#exec-form-and-shell-form`
201782
201811
  }
201783
201812
  },
201784
201813
  {
@@ -201793,7 +201822,7 @@ var os$2 = "https://code.claude.com/docs/en", kKe = [
201793
201822
  matches: (e) => e.code === "unrecognized_keys",
201794
201823
  tip: {
201795
201824
  suggestion: "Check for typos or refer to the documentation for valid fields",
201796
- docLink: `${os$2}/settings`
201825
+ docLink: `${os$1}/settings`
201797
201826
  }
201798
201827
  },
201799
201828
  {
@@ -201808,13 +201837,13 @@ var os$2 = "https://code.claude.com/docs/en", kKe = [
201808
201837
  matches: (e) => e.path === "permissions.additionalDirectories" && e.code === "invalid_type",
201809
201838
  tip: {
201810
201839
  suggestion: "Must be an array of directory paths. Example: [\"~/projects\", \"/tmp/workspace\"]. You can also use --add-dir flag or /add-dir command",
201811
- docLink: `${os$2}/iam#working-directories`
201840
+ docLink: `${os$1}/iam#working-directories`
201812
201841
  }
201813
201842
  }
201814
201843
  ], AKe = {
201815
- permissions: `${os$2}/iam#configuring-permissions`,
201816
- env: `${os$2}/settings#environment-variables`,
201817
- hooks: `${os$2}/hooks`
201844
+ permissions: `${os$1}/iam#configuring-permissions`,
201845
+ env: `${os$1}/settings#environment-variables`,
201846
+ hooks: `${os$1}/hooks`
201818
201847
  };
201819
201848
  function GZ(e) {
201820
201849
  let t = kKe.find((r) => r.matches(e));
@@ -269766,7 +269795,7 @@ var import_multicast_dns = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMi
269766
269795
  var dgram = __require("dgram");
269767
269796
  var thunky = require_thunky();
269768
269797
  var events = __require("events");
269769
- var os$1 = __require("os");
269798
+ var os = __require("os");
269770
269799
  var noop = function() {};
269771
269800
  module.exports = function(opts) {
269772
269801
  if (!opts) opts = {};
@@ -269897,14 +269926,14 @@ var import_multicast_dns = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMi
269897
269926
  return that;
269898
269927
  };
269899
269928
  function defaultInterface() {
269900
- var networks = os$1.networkInterfaces();
269929
+ var networks = os.networkInterfaces();
269901
269930
  var names = Object.keys(networks);
269902
269931
  for (var i = 0; i < names.length; i++) {
269903
269932
  var net = networks[names[i]];
269904
269933
  for (var j = 0; j < net.length; j++) {
269905
269934
  var iface = net[j];
269906
269935
  if (isIPv4(iface.family) && !iface.internal) {
269907
- if (os$1.platform() === "darwin" && names[i] === "en0") return iface.address;
269936
+ if (os.platform() === "darwin" && names[i] === "en0") return iface.address;
269908
269937
  return "0.0.0.0";
269909
269938
  }
269910
269939
  }
@@ -269912,7 +269941,7 @@ var import_multicast_dns = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMi
269912
269941
  return "127.0.0.1";
269913
269942
  }
269914
269943
  function allInterfaces() {
269915
- var networks = os$1.networkInterfaces();
269944
+ var networks = os.networkInterfaces();
269916
269945
  var names = Object.keys(networks);
269917
269946
  var res = [];
269918
269947
  for (var i = 0; i < names.length; i++) {
@@ -293656,7 +293685,7 @@ const CheckpointReactorLive = effect(CheckpointReactor, gen(function* () {
293656
293685
  * release it. The budget is what stops that hold from keeping the sprite billing.
293657
293686
  */
293658
293687
  const LAUNCH_HOLD_MAX_REFRESHES = 10;
293659
- /** The hold id of a thread's launch. One launch per thread, so the thread names it. */
293688
+ /** The hold id of a pending turn start. The thread names it until turn.started arrives. */
293660
293689
  const launchHoldId = (threadId) => `launch-${threadId}`;
293661
293690
  const SpriteTaskHoldReactorLive = effect(SpriteTaskHoldReactor, gen(function* () {
293662
293691
  const providerService = yield* ProviderService;
@@ -297825,7 +297854,7 @@ function resolveBuildCommitFromEnv(env) {
297825
297854
  * environment descriptor down instead of reporting an honest "unknown".
297826
297855
  */
297827
297856
  function readBakedBuildCommit() {
297828
- return "06c11aad2e4673f13061c7bed6d0a4cb63ff8122";
297857
+ return "6271419f1f7ae1b4b230a3a057e99636794e247c";
297829
297858
  }
297830
297859
  async function resolveServerBuildCommit(input) {
297831
297860
  if (isFullCommitSha(input.baked)) return input.baked;
@@ -306798,7 +306827,7 @@ const orchestrationDispatchRouteLayer = add$1("POST", "/api/orchestration/dispat
306798
306827
  }).pipe(mapError((cause) => new OrchestrationDispatchCommandError({
306799
306828
  message: "Failed to dispatch orchestration command.",
306800
306829
  cause
306801
- }))) : (normalizedCommand.type === "thread.turn.interrupt" ? interruptBootstrapTurnStart(orchestrationEngine, normalizedCommand) : orchestrationEngine.dispatch(normalizedCommand)).pipe(mapError((cause) => new OrchestrationDispatchCommandError({
306830
+ }))) : dispatchCommandHeld(orchestrationEngine, normalizedCommand).pipe(mapError((cause) => new OrchestrationDispatchCommandError({
306802
306831
  message: "Failed to dispatch orchestration command.",
306803
306832
  cause
306804
306833
  })));
@@ -310426,7 +310455,10 @@ function isLegacyRuntimeConnection(value, expectedRuntimeId) {
310426
310455
  return [
310427
310456
  runtime.runtimeId === expectedRuntimeId,
310428
310457
  runtime.runtimeCapabilityMode === "legacy_env",
310429
- isNonEmptyString$1(runtime.flyMachineId),
310458
+ hasCmmdRuntimeSpriteIdentity({
310459
+ ...Object.hasOwn(runtime, "spriteName") ? { spriteName: typeof runtime.spriteName === "string" ? runtime.spriteName : null } : {},
310460
+ ...Object.hasOwn(runtime, "flyMachineId") ? { flyMachineId: typeof runtime.flyMachineId === "string" ? runtime.flyMachineId : null } : {}
310461
+ }),
310430
310462
  !Object.hasOwn(runtime, "brokerAuthorityAttestedForgeGitCommit"),
310431
310463
  runtime.brokerAuthorityAttestedImageRef === null,
310432
310464
  runtime.brokerAuthorityAttestedImageVersion === null,
@@ -320498,7 +320530,7 @@ const execFilePromise = promisify$1(execFile);
320498
320530
  const COMMAND_TIMEOUT_MS = 15e3;
320499
320531
  const MAX_COMMAND_OUTPUT_BYTES = 32e3;
320500
320532
  const MAX_PROCESSES = 80;
320501
- const sanitizeRuntimeDiagnosticText = (value) => value.replace(/\b(OPENAI_API_KEY|ANTHROPIC_API_KEY|ANTHROPIC_AUTH_TOKEN|FLY_ACCESS_TOKEN|FLY_API_TOKEN|GITHUB_TOKEN|FORGE_CMMD_RUNTIME_GRANT_TOKEN|FORGE_NPM_PROXY_TOKEN|FORGE_PROXY_HMAC_SECRET|FORGE_PPROXY_HMAC_SECRET|CMMD_FORGE_RUNTIME_TICKET_PRIVATE_KEY|CMMD_FORGE_RUNTIME_BROWSER_WEBRTC_ICE_SERVERS)=\S+/g, "$1=[redacted]").replace(/\bforge_proxy_[A-Za-z0-9._-]+/g, "forge_proxy_[redacted]").replace(/\bcmmd_provider_[A-Za-z0-9._-]+/g, "cmmd_provider_[redacted]").replace(/\bruntime-grant\.[A-Za-z0-9._-]+/g, "runtime-grant.[redacted]").replace(/\b(sk|ghp|github_pat)_[A-Za-z0-9._-]+/g, "$1_[redacted]").replace(/\bsk-[A-Za-z0-9._-]+/g, "sk-[redacted]");
320533
+ const sanitizeRuntimeDiagnosticText = (value) => value.replace(/\b(OPENAI_API_KEY|ANTHROPIC_API_KEY|ANTHROPIC_AUTH_TOKEN|FLY_ACCESS_TOKEN|FLY_API_TOKEN|SPRITES_TOKEN|SPRITE_API_TOKEN|GITHUB_TOKEN|FORGE_CMMD_RUNTIME_GRANT_TOKEN|FORGE_NPM_PROXY_TOKEN|FORGE_PROXY_HMAC_SECRET|FORGE_PPROXY_HMAC_SECRET|CMMD_FORGE_RUNTIME_TICKET_PRIVATE_KEY|CMMD_FORGE_RUNTIME_BROWSER_WEBRTC_ICE_SERVERS)=\S+/g, "$1=[redacted]").replace(/\bforge_proxy_[A-Za-z0-9._-]+/g, "forge_proxy_[redacted]").replace(/\bcmmd_provider_[A-Za-z0-9._-]+/g, "cmmd_provider_[redacted]").replace(/\bruntime-grant\.[A-Za-z0-9._-]+/g, "runtime-grant.[redacted]").replace(/\b(sk|ghp|github_pat)_[A-Za-z0-9._-]+/g, "$1_[redacted]").replace(/\bsk-[A-Za-z0-9._-]+/g, "sk-[redacted]");
320502
320534
  const sanitizeRuntimeDiagnosticValue = (value) => {
320503
320535
  const trimmed = value?.trim();
320504
320536
  if (!trimmed) return void 0;
@@ -320545,16 +320577,15 @@ const parseProcessList = (output) => output.split("\n").map((line) => line.trim(
320545
320577
  if (!Number.isFinite(pid) || !Number.isFinite(ppid) || !stat || !command) return void 0;
320546
320578
  const cpuPercent = parseMeasurement(cpuRaw);
320547
320579
  const rssKb = parseMeasurement(rssRaw);
320548
- const measurements = {};
320549
- if (cpuPercent !== null) measurements.cpuPercent = cpuPercent;
320550
- if (rssKb !== null) measurements.rssKb = rssKb;
320551
- return {
320580
+ const parsed = {
320552
320581
  pid,
320553
320582
  ppid,
320554
320583
  stat: sanitizeRuntimeDiagnosticText(stat),
320555
- command: sanitizeRuntimeDiagnosticText(command),
320556
- ...measurements
320584
+ command: sanitizeRuntimeDiagnosticText(command)
320557
320585
  };
320586
+ if (cpuPercent !== null) parsed.cpuPercent = cpuPercent;
320587
+ if (rssKb !== null) parsed.rssKb = rssKb;
320588
+ return parsed;
320558
320589
  }).filter((process) => process !== void 0).slice(0, MAX_PROCESSES);
320559
320590
  /**
320560
320591
  * The process tree, or the reason there isn't one.
@@ -322421,7 +322452,7 @@ const connectLoginCommand = make$34("login", {
322421
322452
  })).json();
322422
322453
  },
322423
322454
  openBrowser: async (url) => {
322424
- const open = (await import("./open-yHTUkd2Y.mjs")).default;
322455
+ const open = (await import("./open-2-reBrpv.mjs")).default;
322425
322456
  await open(url);
322426
322457
  return true;
322427
322458
  },
@@ -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{Al as a,Fn as o,Gc as s,Hr as c,Jc as l,Qr as u,Rr as d,Sr as f,Tn as p,Uc as m,Xr as h,_r as g,d as _,fn as v,fr as y,gr as b,i as x,is as S,jn as C,l as w,m as T,ms as E,n as D,qc as O,qt as k,r as A,u as j,za as M,zr as N}from"./DiffPanelShell-DH6nYRyX.js";import{hn as P}from"./CompositeItem-BsSeqHOM.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-CPNxYGbV.js";import{Dn as q,at as J,it as ee}from"./src-IM0FnQax.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-DkmY3FZZ.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)(x),m=j(),h=(0,X.useRef)(null),g=_(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&&!k(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:y}=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)(v,{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:y}),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 O({queryKey:M.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{Al as a,Fn as o,Gc as s,Hr as c,Jc as l,Qr as u,Rr as d,Sr as f,Tn as p,Uc as m,Xr as h,_r as g,d as _,fn as v,fr as y,gr as b,i as x,is as S,jn as C,l as w,m as T,ms as E,n as D,qc as O,qt as k,r as A,u as j,za as M,zr as N}from"./DiffPanelShell-Cjla62Mi.js";import{hn as P}from"./CompositeItem-BsSeqHOM.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-BgwL24RP.js";import{Dn as q,at as J,it as ee}from"./src-IM0FnQax.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-Cyd4VDhl.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)(x),m=j(),h=(0,X.useRef)(null),g=_(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&&!k(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:y}=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)(v,{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:y}),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 O({queryKey:M.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}=b(),a=g(),[c,l]=(0,X.useState)(`stacked`),[u,d]=(0,X.useState)(a.diffWordWrap),h=(0,X.useRef)(null),_=(0,X.useRef)(!1),v=Te(),{activeCwd:y,activeThread:x,bodyState:S,diffOpen:C,inferredCheckpointTurnCountByTurnId:w,orderedTurnDiffSummaries:T,renderableFiles:E,renderablePatch:D,selectedFilePath:O,selectedTurn:k,selectedTurnId:j}=Le(i),M,P;t[0]!==C||t[1]!==a.diffWordWrap?(M=()=>{C&&!_.current&&d(a.diffWordWrap),_.current=C},P=[C,a.diffWordWrap],t[0]=C,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]===O?F=t[5]:(F=()=>{!O||!h.current||Array.from(h.current.querySelectorAll(`[data-diff-file-path]`)).find(e=>e.dataset.diffFilePath===O)?.scrollIntoView({block:`nearest`})},t[4]=O,t[5]=F);let I;t[6]!==E||t[7]!==O?(I=[O,E],t[6]=E,t[7]=O,t[8]=I):I=t[8],(0,X.useEffect)(F,I);let L;t[9]===y?L=t[10]:(L=e=>{let t=f();if(!t)return;let n=y?p(e,y):e;N(t,n).catch(ke)},t[9]=y,t[10]=L);let R=L,z;t[11]===x?z=t[12]:(z=e=>{x&&o.getState().openDiff(s(m(x.environmentId,x.id)),e)},t[11]=x,t[12]=z);let B=z,V;t[13]===x?V=t[14]:(V=()=>{x&&o.getState().openDiff(s(m(x.environmentId,x.id)))},t[13]=x,t[14]=V);let H=V,U;t[15]===v.remeasure?U=t[16]:(U=()=>{let e=window.requestAnimationFrame(v.remeasure);return()=>window.cancelAnimationFrame(e)},t[15]=v.remeasure,t[16]=U);let W;t[17]!==T||t[18]!==j||t[19]!==v.remeasure?(W=[T,j,v.remeasure],t[17]=T,t[18]=j,t[19]=v.remeasure,t[20]=W):W=t[20],(0,X.useEffect)(U,W),Ee(v.ref,k?.turnId??j);let G;t[21]!==c||t[22]!==u||t[23]!==w||t[24]!==T||t[25]!==B||t[26]!==H||t[27]!==k||t[28]!==j||t[29]!==a||t[30]!==v?(G=(0,Q.jsx)(Ae,{diffRenderMode:c,diffWordWrap:u,inferredCheckpointTurnCountByTurnId:w,orderedTurnDiffSummaries:T,selectTurn:B,selectWholeConversation:H,selectedTurn:k,selectedTurnId:j,setDiffRenderMode:l,setDiffWordWrap:d,settings:a,turnStrip:v}),t[21]=c,t[22]=u,t[23]=w,t[24]=T,t[25]=B,t[26]=H,t[27]=k,t[28]=j,t[29]=a,t[30]=v,t[31]=G):G=t[31];let K=G,q;t[32]!==S||t[33]!==c||t[34]!==u||t[35]!==R||t[36]!==E||t[37]!==D||t[38]!==i?(q=(0,Q.jsx)(je,{bodyState:S,diffRenderMode:c,diffWordWrap:u,openDiffFileInEditor:R,patchViewportRef:h,renderableFiles:E,renderablePatch:D,resolvedTheme:i}),t[32]=S,t[33]=c,t[34]=u,t[35]=R,t[36]=E,t[37]=D,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)(A,{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=a(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`,s=n?.threadId??null,c,l;e[2]===n?l=e[3]:(l=C(n),e[2]=n,e[3]=l),c=l;let u=E(c),f=He(u),p=u?.worktreePath,m=f?.cwd,h;e[4]!==p||e[5]!==m?(h=I({threadWorktreePath:p,projectCwd:m}),e[4]=p,e[5]=m,e[6]=h):h=e[6];let g=h,_=u?.environmentId??null,v=g??null,y;e[7]!==_||e[8]!==v?(y={environmentId:_,cwd:v},e[7]=_,e[8]=v,e[9]=y):y=e[9];let b=d(y),x;e[10]===b.data?x=e[11]:(x=z(b.data),e[10]=b.data,e[11]=x);let S=x,w;return e[12]!==g||e[13]!==u||e[14]!==s||e[15]!==o||e[16]!==i||e[17]!==S?(w={activeThread:u,activeThreadId:s,activeCwd:g,isGitRepo:S,diffSearch:i,diffOpen:o},e[12]=g,e[13]=u,e[14]=s,e[15]=o,e[16]=i,e[17]=S,e[18]=w):w=e[18],w}function Fe(e){return G(e)}function Ie(e){return h(e)}function Le(e){let{activeThread:t,activeThreadId:n,activeCwd:r,isGitRepo:i,diffSearch:a,diffOpen:o}=Pe(),{turnDiffSummaries:s,inferredCheckpointTurnCountByTurnId:c}=H(t),u=a.diffTurnId??null,d=u===null?null:a.diffFilePath??null,{activeCheckpointRange:f,conversationCacheScope:p,orderedTurnDiffSummaries:m,selectedTurn:h}=(0,X.useMemo)(()=>te({summaries:s,inferredCheckpointTurnCountByTurnId:c,selectedTurnId:u}),[c,u,s]),g=l(xe(we({environmentId:t?.environmentId,threadId:n,range:f,selectedTurnId:h?.turnId,conversationCacheScope:p,enabled:i}))),_=g.isLoading,v=Ce(g.error),y=g.data?.diff,b=typeof y==`string`&&y.trim().length===0,{emptyDiffMessage:x}=(0,X.useMemo)(()=>ae(h),[h]),S=(0,X.useMemo)(()=>ce(y,`diff-panel:${e}`),[e,y]),C=(0,X.useMemo)(()=>Ue(S),[S]);return{activeCwd:r,activeThread:t,bodyState:ue({hasActiveThread:!!t,isGitRepo:i,turnSummaryCount:m.length,checkpointDiffError:v,hasRenderablePatch:!!S,isLoadingCheckpointDiff:_,hasNoNetChanges:b,emptyDiffMessage:x}),diffOpen:o,inferredCheckpointTurnCountByTurnId:c,orderedTurnDiffSummaries:m,renderableFiles:C,renderablePatch:S,selectedFilePath:d,selectedTurn:h,selectedTurnId:u}}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)(D,{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:u,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`,l;t[0]!==s||t[1]!==c?(l=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]=l):l=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]!==l||t[9]!==d||t[10]!==f||t[11]!==p||t[12]!==m?(h=(0,Q.jsx)(`button`,{type:`button`,className:l,onClick:d,disabled:f,"aria-label":p,children:m}),t[8]=l,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=y(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?S(e,{environmentId:n,projectId:r}):void 0,t[0]=n,t[1]=r,t[2]=i):i=t[2],E(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-DUE5CUPF.js.map
64
+ //# sourceMappingURL=DiffPanel-XwwjXG29.js.map