@cmmd-center/forge 0.13.34 → 0.13.36

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
@@ -17173,6 +17173,15 @@ const MODEL_SLUG_ALIASES_BY_PROVIDER = {
17173
17173
  cursor: {},
17174
17174
  opencode: {}
17175
17175
  };
17176
+ const PROVIDER_DISPLAY_NAMES = {
17177
+ codex: "Codex",
17178
+ claudeAgent: "Claude",
17179
+ ollama: "Ollama",
17180
+ cmmd: "CMMD",
17181
+ apex: "CMMD",
17182
+ cursor: "Cursor",
17183
+ opencode: "OpenCode"
17184
+ };
17176
17185
  /**
17177
17186
  * The ACCOUNT brand a user signs in with — not always the agent's name.
17178
17187
  *
@@ -66232,7 +66241,7 @@ function normalizeNumberish(value) {
66232
66241
  }
66233
66242
  //#endregion
66234
66243
  //#region package.json
66235
- var version$1 = "0.13.34";
66244
+ var version$1 = "0.13.36";
66236
66245
  //#endregion
66237
66246
  //#region src/sentry.ts
66238
66247
  const SERVER_APP_NAME = "forge-server";
@@ -297748,7 +297757,7 @@ function resolveBuildCommitFromEnv(env) {
297748
297757
  * environment descriptor down instead of reporting an honest "unknown".
297749
297758
  */
297750
297759
  function readBakedBuildCommit() {
297751
- return "21ea16bac0a1c8802338343c335f10d8c12b279e";
297760
+ return "2c43e54e27936ac7a4bbab36530923d86423b85d";
297752
297761
  }
297753
297762
  async function resolveServerBuildCommit(input) {
297754
297763
  if (isFullCommitSha(input.baked)) return input.baked;
@@ -307080,6 +307089,34 @@ function computeNextLocalAutomationRunAt(input, from = /* @__PURE__ */ new Date(
307080
307089
  return nextCalendarRun(input, from).toISOString();
307081
307090
  }
307082
307091
  //#endregion
307092
+ //#region src/localAutomations/runVerdict.ts
307093
+ const withheld = (reason, sentence, detail) => ({
307094
+ state: "withheld",
307095
+ reason,
307096
+ ...detail !== void 0 ? { detail } : {},
307097
+ sentence
307098
+ });
307099
+ const notInstalledSentence = (providerKind) => `${PROVIDER_DISPLAY_NAMES[providerKind]} is not installed on this Environment.`;
307100
+ /**
307101
+ * Whether a trigger configured for `providerKind` may execute on this
307102
+ * Environment now, judged from the published provider snapshots alone.
307103
+ *
307104
+ * A provider absent from the snapshots is Not on this Environment: the
307105
+ * registry carries one snapshot per provider Layer this build ships, so an
307106
+ * absence is the build saying it cannot run the provider. (The Shell needs a
307107
+ * `hasLiveInventory` flag to tell an absent row from no inventory at all; the
307108
+ * server's own inventory is live by construction.)
307109
+ */
307110
+ function resolveTriggerRunVerdict(input) {
307111
+ const snapshot = input.snapshots.find((entry) => entry.provider === input.provider);
307112
+ if (snapshot === void 0) return withheld("not-on-this-environment", notInstalledSentence(input.provider));
307113
+ if (snapshot.unavailableReason === "unbuilt") return withheld("unbuilt", "Coming soon.");
307114
+ const hasProxiedCredential = snapshot.auth.provenance?.credentialScope === "proxied";
307115
+ if (snapshot.installed && snapshot.auth.status === "unauthenticated" && !hasProxiedCredential) return withheld("not-usable", `Connect ${PROVIDER_DISPLAY_NAMES[input.provider]} in Settings to use these models.`, "no-connection");
307116
+ if (!isServerProviderExecutable(snapshot)) return withheld("not-on-this-environment", notInstalledSentence(input.provider));
307117
+ return { state: "usable" };
307118
+ }
307119
+ //#endregion
307083
307120
  //#region src/localAutomations/http.ts
307084
307121
  const LocalAutomationCreatePayload = require_Schema$1.Struct({
307085
307122
  name: require_Schema$1.String,
@@ -307155,7 +307192,7 @@ function applyAutomationPatch(current, patch, updatedAt) {
307155
307192
  nextRunAt: nextRunAtAfterPatch(current, next, patch, updatedAt)
307156
307193
  };
307157
307194
  }
307158
- function createRunRecord(automation, triggerType, now) {
307195
+ function createRunRecord(automation, triggerType, now, definitionProvider) {
307159
307196
  return {
307160
307197
  id: crypto.randomUUID(),
307161
307198
  automationId: automation.id,
@@ -307172,17 +307209,49 @@ function createRunRecord(automation, triggerType, now) {
307172
307209
  definitionPrompt: automation.prompt,
307173
307210
  definitionProjectName: automation.projectName,
307174
307211
  definitionUpdatedAt: automation.updatedAt,
307175
- definitionProvider: DEFAULT_PROVIDER_KIND,
307176
- definitionModel: DEFAULT_MODEL_BY_PROVIDER[DEFAULT_PROVIDER_KIND],
307212
+ definitionProvider,
307213
+ definitionModel: DEFAULT_MODEL_BY_PROVIDER[definitionProvider],
307177
307214
  definitionRuntimeMode: DEFAULT_RUNTIME_MODE$2,
307178
307215
  definitionInteractionMode: DEFAULT_PROVIDER_INTERACTION_MODE,
307179
307216
  dispatchAttempts: 0,
307180
307217
  nextDispatchAt: null
307181
307218
  };
307182
307219
  }
307183
- const dispatchLocalAutomationRun = (repository, orchestrationEngine, automation, triggerType) => require_Schema$1.gen(function* () {
307220
+ const dispatchLocalAutomationRun = (repository, orchestrationEngine, resolveProviderSnapshots, automation, triggerType) => require_Schema$1.gen(function* () {
307184
307221
  const now = (/* @__PURE__ */ new Date()).toISOString();
307185
- const run = createRunRecord(automation, triggerType, now);
307222
+ const definitionProvider = DEFAULT_PROVIDER_KIND;
307223
+ const run = createRunRecord(automation, triggerType, now, definitionProvider);
307224
+ const verdict = resolveTriggerRunVerdict({
307225
+ provider: definitionProvider,
307226
+ snapshots: yield* resolveProviderSnapshots()
307227
+ });
307228
+ if (verdict.state === "withheld") {
307229
+ const skippedAt = (/* @__PURE__ */ new Date()).toISOString();
307230
+ yield* repository.insertRun({
307231
+ ...run,
307232
+ status: "failed",
307233
+ threadId: null,
307234
+ error: verdict.sentence,
307235
+ startedAt: null,
307236
+ completedAt: skippedAt,
307237
+ updatedAt: skippedAt
307238
+ });
307239
+ yield* repository.upsert({
307240
+ ...automation,
307241
+ lastRunAt: skippedAt,
307242
+ updatedAt: skippedAt
307243
+ });
307244
+ yield* require_Schema$1.logWarning("local automation trigger skipped: provider cannot run", {
307245
+ automationId: automation.id,
307246
+ runId: run.id,
307247
+ provider: definitionProvider,
307248
+ reason: verdict.reason
307249
+ });
307250
+ return {
307251
+ runId: run.id,
307252
+ threadId: null
307253
+ };
307254
+ }
307186
307255
  yield* repository.insertRun(run);
307187
307256
  yield* repository.upsert({
307188
307257
  ...automation,
@@ -307228,7 +307297,8 @@ const dispatchLocalAutomationRun = (repository, orchestrationEngine, automation,
307228
307297
  const runLocalAutomation = (automation, triggerType) => require_Schema$1.gen(function* () {
307229
307298
  const repository = yield* LocalAutomationRepository;
307230
307299
  const orchestrationEngine = yield* OrchestrationEngineService;
307231
- return yield* (yield* ServerRuntimeStartup).enqueueCommand(dispatchLocalAutomationRun(repository, orchestrationEngine, automation, triggerType));
307300
+ const providerRegistry = yield* ProviderRegistry;
307301
+ return yield* (yield* ServerRuntimeStartup).enqueueCommand(dispatchLocalAutomationRun(repository, orchestrationEngine, () => providerRegistry.getProviders, automation, triggerType));
307232
307302
  });
307233
307303
  const claimDueLocalAutomationOccurrences = (repository, dueAt) => require_Schema$1.gen(function* () {
307234
307304
  const due = yield* repository.listDue({ dueAt });
@@ -307297,13 +307367,36 @@ const QueuedDispatchSnapshot = require_Schema$1.Struct({
307297
307367
  function queuedDispatchSnapshot(run) {
307298
307368
  return require_Schema$1.decodeUnknownSync(QueuedDispatchSnapshot)(run);
307299
307369
  }
307300
- const dispatchQueuedLocalAutomationRuns = (repository, orchestrationEngine) => require_Schema$1.gen(function* () {
307370
+ const dispatchQueuedLocalAutomationRuns = (repository, orchestrationEngine, resolveProviderSnapshots) => require_Schema$1.gen(function* () {
307301
307371
  const queued = yield* repository.listQueuedScheduledRuns({
307302
307372
  limit: 50,
307303
307373
  dueAt: (/* @__PURE__ */ new Date()).toISOString()
307304
307374
  });
307375
+ const snapshots = yield* resolveProviderSnapshots();
307305
307376
  yield* require_Schema$1.forEach(queued, (run) => require_Schema$1.gen(function* () {
307306
307377
  const snapshot = queuedDispatchSnapshot(run);
307378
+ const verdict = resolveTriggerRunVerdict({
307379
+ provider: snapshot.definitionProvider,
307380
+ snapshots
307381
+ });
307382
+ if (verdict.state === "withheld") {
307383
+ const skippedAt = (/* @__PURE__ */ new Date()).toISOString();
307384
+ yield* repository.completeRun({
307385
+ id: run.id,
307386
+ status: "failed",
307387
+ threadId: null,
307388
+ error: verdict.sentence,
307389
+ completedAt: skippedAt,
307390
+ updatedAt: skippedAt
307391
+ });
307392
+ yield* require_Schema$1.logWarning("queued local automation run skipped: provider cannot run", {
307393
+ automationId: run.automationId,
307394
+ runId: run.id,
307395
+ provider: snapshot.definitionProvider,
307396
+ reason: verdict.reason
307397
+ });
307398
+ return;
307399
+ }
307307
307400
  const result = yield* dispatchAutomationStartThread(orchestrationEngine, {
307308
307401
  automationRunId: run.id,
307309
307402
  title: snapshot.definitionName,
@@ -307455,9 +307548,11 @@ const LocalAutomationSchedulerLive = require_Schema$1.effectDiscard(require_Sche
307455
307548
  const startup = yield* ServerRuntimeStartup;
307456
307549
  const tick = require_Schema$1.gen(function* () {
307457
307550
  const dueAt = (/* @__PURE__ */ new Date()).toISOString();
307458
- yield* dispatchQueuedLocalAutomationRuns(repository, orchestrationEngine);
307551
+ const providerRegistry = yield* ProviderRegistry;
307552
+ const resolveSnapshots = () => providerRegistry.getProviders;
307553
+ yield* dispatchQueuedLocalAutomationRuns(repository, orchestrationEngine, resolveSnapshots);
307459
307554
  yield* claimDueLocalAutomationOccurrences(repository, dueAt);
307460
- yield* dispatchQueuedLocalAutomationRuns(repository, orchestrationEngine);
307555
+ yield* dispatchQueuedLocalAutomationRuns(repository, orchestrationEngine, resolveSnapshots);
307461
307556
  }).pipe(require_Schema$1.catchCause((cause) => require_Schema$1.hasInterrupts(cause) ? require_Schema$1.failCause(cause) : require_Schema$1.logError("local automation scheduler failed", { cause })));
307462
307557
  yield* require_Schema$1.forkScoped(startup.awaitCommandReady.pipe(require_Schema$1.andThen(require_Schema$1.forever(tick.pipe(require_Schema$1.andThen(require_Schema$1.sleep("60 seconds")))))));
307463
307558
  }));
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";
@@ -17136,6 +17136,15 @@ const MODEL_SLUG_ALIASES_BY_PROVIDER = {
17136
17136
  cursor: {},
17137
17137
  opencode: {}
17138
17138
  };
17139
+ const PROVIDER_DISPLAY_NAMES = {
17140
+ codex: "Codex",
17141
+ claudeAgent: "Claude",
17142
+ ollama: "Ollama",
17143
+ cmmd: "CMMD",
17144
+ apex: "CMMD",
17145
+ cursor: "Cursor",
17146
+ opencode: "OpenCode"
17147
+ };
17139
17148
  /**
17140
17149
  * The ACCOUNT brand a user signs in with — not always the agent's name.
17141
17150
  *
@@ -50549,7 +50558,7 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
50549
50558
  const min = forceColor || 0;
50550
50559
  if (env.TERM === "dumb") return min;
50551
50560
  if (process$1.platform === "win32") {
50552
- const osRelease = os.release().split(".");
50561
+ const osRelease = $U.release().split(".");
50553
50562
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
50554
50563
  return 1;
50555
50564
  }
@@ -52992,7 +53001,7 @@ var require_ProcessDetector = /* @__PURE__ */ __commonJSMin(((exports) => {
52992
53001
  exports.processDetector = void 0;
52993
53002
  const api_1 = (init_esm$1(), __toCommonJS(esm_exports$1));
52994
53003
  const semconv_1 = require_semconv$1();
52995
- const os$4 = __require("os");
53004
+ const os$3 = __require("os");
52996
53005
  /**
52997
53006
  * ProcessDetector will be used to detect the resources related current process running
52998
53007
  * and being instrumented from the NodeJS Process module.
@@ -53014,7 +53023,7 @@ var require_ProcessDetector = /* @__PURE__ */ __commonJSMin(((exports) => {
53014
53023
  };
53015
53024
  if (process.argv.length > 1) attributes[semconv_1.ATTR_PROCESS_COMMAND] = process.argv[1];
53016
53025
  try {
53017
- const userInfo = os$4.userInfo();
53026
+ const userInfo = os$3.userInfo();
53018
53027
  attributes[semconv_1.ATTR_PROCESS_OWNER] = userInfo.username;
53019
53028
  } catch (e) {
53020
53029
  api_1.diag.debug(`error obtaining process owner: ${e}`);
@@ -65937,7 +65946,7 @@ function normalizeNumberish(value) {
65937
65946
  }
65938
65947
  //#endregion
65939
65948
  //#region package.json
65940
- var version$1 = "0.13.34";
65949
+ var version$1 = "0.13.36";
65941
65950
  //#endregion
65942
65951
  //#region src/sentry.ts
65943
65952
  const SERVER_APP_NAME = "forge-server";
@@ -75819,7 +75828,7 @@ var require_node_gyp_build = /* @__PURE__ */ __commonJSMin(((exports, module) =>
75819
75828
  var fs$6 = __require("fs");
75820
75829
  var path$5 = __require("path");
75821
75830
  var url$1 = __require("url");
75822
- var os$3 = __require("os");
75831
+ var os$2 = __require("os");
75823
75832
  var runtimeRequire = typeof __webpack_require__ === "function" ? __non_webpack_require__ : __require;
75824
75833
  var vars = process.config && process.config.variables || {};
75825
75834
  var prebuildsOnly = !!process.env.PREBUILDS_ONLY;
@@ -75827,8 +75836,8 @@ var require_node_gyp_build = /* @__PURE__ */ __commonJSMin(((exports, module) =>
75827
75836
  var abi = versions.modules;
75828
75837
  if (versions.deno || process.isBun) abi = "unsupported";
75829
75838
  var runtime = isElectron() ? "electron" : isNwjs() ? "node-webkit" : "node";
75830
- var arch = process.env.npm_config_arch || os$3.arch();
75831
- var platform = process.env.npm_config_platform || os$3.platform();
75839
+ var arch = process.env.npm_config_arch || os$2.arch();
75840
+ var platform = process.env.npm_config_platform || os$2.platform();
75832
75841
  var libc = process.env.LIBC || (isMusl(platform) ? "musl" : "glibc");
75833
75842
  var armv = process.env.ARM_VERSION || (arch === "arm64" ? "8" : vars.arm_version) || "";
75834
75843
  var uv = (versions.uv || "").split(".")[0];
@@ -93516,7 +93525,7 @@ const launchDetached = (launch) => gen(function* () {
93516
93525
  });
93517
93526
  const OpenLive = effect(Open, gen(function* () {
93518
93527
  const open = yield* tryPromise({
93519
- try: () => import("./open-yHTUkd2Y.mjs"),
93528
+ try: () => import("./open-2-reBrpv.mjs"),
93520
93529
  catch: (cause) => new OpenError$1({
93521
93530
  message: "failed to load browser opener",
93522
93531
  cause
@@ -190992,7 +191001,7 @@ var Vce = {
190992
191001
  function Ve() {
190993
191002
  return Vce;
190994
191003
  }
190995
- var Us = os.homedir(), lk = os.tmpdir(), { env: Vc } = process$1, Yce = (e) => {
191004
+ var Us = $U.homedir(), lk = $U.tmpdir(), { env: Vc } = process$1, Yce = (e) => {
190996
191005
  let t = path.join(Us, "Library");
190997
191006
  return {
190998
191007
  data: path.join(t, "Application Support", e),
@@ -201192,12 +201201,12 @@ function qZ(e, t) {
201192
201201
  }
201193
201202
  return n;
201194
201203
  }
201195
- var os$2 = "https://code.claude.com/docs/en", kKe = [
201204
+ var os$1 = "https://code.claude.com/docs/en", kKe = [
201196
201205
  {
201197
201206
  matches: (e) => e.path === "permissions.defaultMode" && e.code === "invalid_value",
201198
201207
  tip: {
201199
201208
  suggestion: "Valid modes: \"acceptEdits\" (ask before file changes), \"plan\" (analysis only), \"bypassPermissions\" (auto-accept all), or \"default\" (standard behavior)",
201200
- docLink: `${os$2}/iam#permission-modes`
201209
+ docLink: `${os$1}/iam#permission-modes`
201201
201210
  }
201202
201211
  },
201203
201212
  {
@@ -201212,7 +201221,7 @@ var os$2 = "https://code.claude.com/docs/en", kKe = [
201212
201221
  matches: (e) => e.path.startsWith("env.") && e.code === "invalid_type",
201213
201222
  tip: {
201214
201223
  suggestion: "Environment variables must be strings. Wrap numbers and booleans in quotes. Example: \"DEBUG\": \"true\", \"PORT\": \"3000\"",
201215
- docLink: `${os$2}/settings#environment-variables`
201224
+ docLink: `${os$1}/settings#environment-variables`
201216
201225
  }
201217
201226
  },
201218
201227
  {
@@ -201223,14 +201232,14 @@ var os$2 = "https://code.claude.com/docs/en", kKe = [
201223
201232
  matches: (e) => e.path.startsWith("hooks.") && e.code === "invalid_key",
201224
201233
  tip: {
201225
201234
  suggestion: "Not a recognized hook event. Common events: PreToolUse, PostToolUse, UserPromptSubmit, SessionStart, SessionEnd, Stop. Check spelling and capitalization.",
201226
- docLink: `${os$2}/hooks`
201235
+ docLink: `${os$1}/hooks`
201227
201236
  }
201228
201237
  },
201229
201238
  {
201230
201239
  matches: (e) => /\.hooks\.\d+\.command$/.test(e.path) && e.code === "invalid_type" && e.received === "undefined",
201231
201240
  tip: {
201232
201241
  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\"}.",
201233
- docLink: `${os$2}/hooks#exec-form-and-shell-form`
201242
+ docLink: `${os$1}/hooks#exec-form-and-shell-form`
201234
201243
  }
201235
201244
  },
201236
201245
  {
@@ -201245,7 +201254,7 @@ var os$2 = "https://code.claude.com/docs/en", kKe = [
201245
201254
  matches: (e) => e.code === "unrecognized_keys",
201246
201255
  tip: {
201247
201256
  suggestion: "Check for typos or refer to the documentation for valid fields",
201248
- docLink: `${os$2}/settings`
201257
+ docLink: `${os$1}/settings`
201249
201258
  }
201250
201259
  },
201251
201260
  {
@@ -201260,13 +201269,13 @@ var os$2 = "https://code.claude.com/docs/en", kKe = [
201260
201269
  matches: (e) => e.path === "permissions.additionalDirectories" && e.code === "invalid_type",
201261
201270
  tip: {
201262
201271
  suggestion: "Must be an array of directory paths. Example: [\"~/projects\", \"/tmp/workspace\"]. You can also use --add-dir flag or /add-dir command",
201263
- docLink: `${os$2}/iam#working-directories`
201272
+ docLink: `${os$1}/iam#working-directories`
201264
201273
  }
201265
201274
  }
201266
201275
  ], AKe = {
201267
- permissions: `${os$2}/iam#configuring-permissions`,
201268
- env: `${os$2}/settings#environment-variables`,
201269
- hooks: `${os$2}/hooks`
201276
+ permissions: `${os$1}/iam#configuring-permissions`,
201277
+ env: `${os$1}/settings#environment-variables`,
201278
+ hooks: `${os$1}/hooks`
201270
201279
  };
201271
201280
  function GZ(e) {
201272
201281
  let t = kKe.find((r) => r.matches(e));
@@ -269172,7 +269181,7 @@ var import_multicast_dns = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMi
269172
269181
  var dgram = __require("dgram");
269173
269182
  var thunky = require_thunky();
269174
269183
  var events = __require("events");
269175
- var os$1 = __require("os");
269184
+ var os = __require("os");
269176
269185
  var noop = function() {};
269177
269186
  module.exports = function(opts) {
269178
269187
  if (!opts) opts = {};
@@ -269303,14 +269312,14 @@ var import_multicast_dns = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMi
269303
269312
  return that;
269304
269313
  };
269305
269314
  function defaultInterface() {
269306
- var networks = os$1.networkInterfaces();
269315
+ var networks = os.networkInterfaces();
269307
269316
  var names = Object.keys(networks);
269308
269317
  for (var i = 0; i < names.length; i++) {
269309
269318
  var net = networks[names[i]];
269310
269319
  for (var j = 0; j < net.length; j++) {
269311
269320
  var iface = net[j];
269312
269321
  if (isIPv4(iface.family) && !iface.internal) {
269313
- if (os$1.platform() === "darwin" && names[i] === "en0") return iface.address;
269322
+ if (os.platform() === "darwin" && names[i] === "en0") return iface.address;
269314
269323
  return "0.0.0.0";
269315
269324
  }
269316
269325
  }
@@ -269318,7 +269327,7 @@ var import_multicast_dns = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMi
269318
269327
  return "127.0.0.1";
269319
269328
  }
269320
269329
  function allInterfaces() {
269321
- var networks = os$1.networkInterfaces();
269330
+ var networks = os.networkInterfaces();
269322
269331
  var names = Object.keys(networks);
269323
269332
  var res = [];
269324
269333
  for (var i = 0; i < names.length; i++) {
@@ -297179,7 +297188,7 @@ function resolveBuildCommitFromEnv(env) {
297179
297188
  * environment descriptor down instead of reporting an honest "unknown".
297180
297189
  */
297181
297190
  function readBakedBuildCommit() {
297182
- return "21ea16bac0a1c8802338343c335f10d8c12b279e";
297191
+ return "2c43e54e27936ac7a4bbab36530923d86423b85d";
297183
297192
  }
297184
297193
  async function resolveServerBuildCommit(input) {
297185
297194
  if (isFullCommitSha(input.baked)) return input.baked;
@@ -306443,6 +306452,34 @@ function computeNextLocalAutomationRunAt(input, from = /* @__PURE__ */ new Date(
306443
306452
  return nextCalendarRun(input, from).toISOString();
306444
306453
  }
306445
306454
  //#endregion
306455
+ //#region src/localAutomations/runVerdict.ts
306456
+ const withheld = (reason, sentence, detail) => ({
306457
+ state: "withheld",
306458
+ reason,
306459
+ ...detail !== void 0 ? { detail } : {},
306460
+ sentence
306461
+ });
306462
+ const notInstalledSentence = (providerKind) => `${PROVIDER_DISPLAY_NAMES[providerKind]} is not installed on this Environment.`;
306463
+ /**
306464
+ * Whether a trigger configured for `providerKind` may execute on this
306465
+ * Environment now, judged from the published provider snapshots alone.
306466
+ *
306467
+ * A provider absent from the snapshots is Not on this Environment: the
306468
+ * registry carries one snapshot per provider Layer this build ships, so an
306469
+ * absence is the build saying it cannot run the provider. (The Shell needs a
306470
+ * `hasLiveInventory` flag to tell an absent row from no inventory at all; the
306471
+ * server's own inventory is live by construction.)
306472
+ */
306473
+ function resolveTriggerRunVerdict(input) {
306474
+ const snapshot = input.snapshots.find((entry) => entry.provider === input.provider);
306475
+ if (snapshot === void 0) return withheld("not-on-this-environment", notInstalledSentence(input.provider));
306476
+ if (snapshot.unavailableReason === "unbuilt") return withheld("unbuilt", "Coming soon.");
306477
+ const hasProxiedCredential = snapshot.auth.provenance?.credentialScope === "proxied";
306478
+ if (snapshot.installed && snapshot.auth.status === "unauthenticated" && !hasProxiedCredential) return withheld("not-usable", `Connect ${PROVIDER_DISPLAY_NAMES[input.provider]} in Settings to use these models.`, "no-connection");
306479
+ if (!isServerProviderExecutable(snapshot)) return withheld("not-on-this-environment", notInstalledSentence(input.provider));
306480
+ return { state: "usable" };
306481
+ }
306482
+ //#endregion
306446
306483
  //#region src/localAutomations/http.ts
306447
306484
  const LocalAutomationCreatePayload = Struct({
306448
306485
  name: String$1,
@@ -306518,7 +306555,7 @@ function applyAutomationPatch(current, patch, updatedAt) {
306518
306555
  nextRunAt: nextRunAtAfterPatch(current, next, patch, updatedAt)
306519
306556
  };
306520
306557
  }
306521
- function createRunRecord(automation, triggerType, now) {
306558
+ function createRunRecord(automation, triggerType, now, definitionProvider) {
306522
306559
  return {
306523
306560
  id: crypto.randomUUID(),
306524
306561
  automationId: automation.id,
@@ -306535,17 +306572,49 @@ function createRunRecord(automation, triggerType, now) {
306535
306572
  definitionPrompt: automation.prompt,
306536
306573
  definitionProjectName: automation.projectName,
306537
306574
  definitionUpdatedAt: automation.updatedAt,
306538
- definitionProvider: DEFAULT_PROVIDER_KIND,
306539
- definitionModel: DEFAULT_MODEL_BY_PROVIDER[DEFAULT_PROVIDER_KIND],
306575
+ definitionProvider,
306576
+ definitionModel: DEFAULT_MODEL_BY_PROVIDER[definitionProvider],
306540
306577
  definitionRuntimeMode: DEFAULT_RUNTIME_MODE$2,
306541
306578
  definitionInteractionMode: DEFAULT_PROVIDER_INTERACTION_MODE,
306542
306579
  dispatchAttempts: 0,
306543
306580
  nextDispatchAt: null
306544
306581
  };
306545
306582
  }
306546
- const dispatchLocalAutomationRun = (repository, orchestrationEngine, automation, triggerType) => gen(function* () {
306583
+ const dispatchLocalAutomationRun = (repository, orchestrationEngine, resolveProviderSnapshots, automation, triggerType) => gen(function* () {
306547
306584
  const now = (/* @__PURE__ */ new Date()).toISOString();
306548
- const run = createRunRecord(automation, triggerType, now);
306585
+ const definitionProvider = DEFAULT_PROVIDER_KIND;
306586
+ const run = createRunRecord(automation, triggerType, now, definitionProvider);
306587
+ const verdict = resolveTriggerRunVerdict({
306588
+ provider: definitionProvider,
306589
+ snapshots: yield* resolveProviderSnapshots()
306590
+ });
306591
+ if (verdict.state === "withheld") {
306592
+ const skippedAt = (/* @__PURE__ */ new Date()).toISOString();
306593
+ yield* repository.insertRun({
306594
+ ...run,
306595
+ status: "failed",
306596
+ threadId: null,
306597
+ error: verdict.sentence,
306598
+ startedAt: null,
306599
+ completedAt: skippedAt,
306600
+ updatedAt: skippedAt
306601
+ });
306602
+ yield* repository.upsert({
306603
+ ...automation,
306604
+ lastRunAt: skippedAt,
306605
+ updatedAt: skippedAt
306606
+ });
306607
+ yield* logWarning$1("local automation trigger skipped: provider cannot run", {
306608
+ automationId: automation.id,
306609
+ runId: run.id,
306610
+ provider: definitionProvider,
306611
+ reason: verdict.reason
306612
+ });
306613
+ return {
306614
+ runId: run.id,
306615
+ threadId: null
306616
+ };
306617
+ }
306549
306618
  yield* repository.insertRun(run);
306550
306619
  yield* repository.upsert({
306551
306620
  ...automation,
@@ -306591,7 +306660,8 @@ const dispatchLocalAutomationRun = (repository, orchestrationEngine, automation,
306591
306660
  const runLocalAutomation = (automation, triggerType) => gen(function* () {
306592
306661
  const repository = yield* LocalAutomationRepository;
306593
306662
  const orchestrationEngine = yield* OrchestrationEngineService;
306594
- return yield* (yield* ServerRuntimeStartup).enqueueCommand(dispatchLocalAutomationRun(repository, orchestrationEngine, automation, triggerType));
306663
+ const providerRegistry = yield* ProviderRegistry;
306664
+ return yield* (yield* ServerRuntimeStartup).enqueueCommand(dispatchLocalAutomationRun(repository, orchestrationEngine, () => providerRegistry.getProviders, automation, triggerType));
306595
306665
  });
306596
306666
  const claimDueLocalAutomationOccurrences = (repository, dueAt) => gen(function* () {
306597
306667
  yield* forEach(yield* repository.listDue({ dueAt }), (automation) => {
@@ -306659,12 +306729,36 @@ const QueuedDispatchSnapshot = Struct({
306659
306729
  function queuedDispatchSnapshot(run) {
306660
306730
  return decodeUnknownSync(QueuedDispatchSnapshot)(run);
306661
306731
  }
306662
- const dispatchQueuedLocalAutomationRuns = (repository, orchestrationEngine) => gen(function* () {
306663
- yield* forEach(yield* repository.listQueuedScheduledRuns({
306732
+ const dispatchQueuedLocalAutomationRuns = (repository, orchestrationEngine, resolveProviderSnapshots) => gen(function* () {
306733
+ const queued = yield* repository.listQueuedScheduledRuns({
306664
306734
  limit: 50,
306665
306735
  dueAt: (/* @__PURE__ */ new Date()).toISOString()
306666
- }), (run) => gen(function* () {
306736
+ });
306737
+ const snapshots = yield* resolveProviderSnapshots();
306738
+ yield* forEach(queued, (run) => gen(function* () {
306667
306739
  const snapshot = queuedDispatchSnapshot(run);
306740
+ const verdict = resolveTriggerRunVerdict({
306741
+ provider: snapshot.definitionProvider,
306742
+ snapshots
306743
+ });
306744
+ if (verdict.state === "withheld") {
306745
+ const skippedAt = (/* @__PURE__ */ new Date()).toISOString();
306746
+ yield* repository.completeRun({
306747
+ id: run.id,
306748
+ status: "failed",
306749
+ threadId: null,
306750
+ error: verdict.sentence,
306751
+ completedAt: skippedAt,
306752
+ updatedAt: skippedAt
306753
+ });
306754
+ yield* logWarning$1("queued local automation run skipped: provider cannot run", {
306755
+ automationId: run.automationId,
306756
+ runId: run.id,
306757
+ provider: snapshot.definitionProvider,
306758
+ reason: verdict.reason
306759
+ });
306760
+ return;
306761
+ }
306668
306762
  const result = yield* dispatchAutomationStartThread(orchestrationEngine, {
306669
306763
  automationRunId: run.id,
306670
306764
  title: snapshot.definitionName,
@@ -306815,9 +306909,11 @@ const LocalAutomationSchedulerLive = effectDiscard(gen(function* () {
306815
306909
  const startup = yield* ServerRuntimeStartup;
306816
306910
  const tick = gen(function* () {
306817
306911
  const dueAt = (/* @__PURE__ */ new Date()).toISOString();
306818
- yield* dispatchQueuedLocalAutomationRuns(repository, orchestrationEngine);
306912
+ const providerRegistry = yield* ProviderRegistry;
306913
+ const resolveSnapshots = () => providerRegistry.getProviders;
306914
+ yield* dispatchQueuedLocalAutomationRuns(repository, orchestrationEngine, resolveSnapshots);
306819
306915
  yield* claimDueLocalAutomationOccurrences(repository, dueAt);
306820
- yield* dispatchQueuedLocalAutomationRuns(repository, orchestrationEngine);
306916
+ yield* dispatchQueuedLocalAutomationRuns(repository, orchestrationEngine, resolveSnapshots);
306821
306917
  }).pipe(catchCause((cause) => hasInterrupts(cause) ? failCause$1(cause) : logError("local automation scheduler failed", { cause })));
306822
306918
  yield* forkScoped(startup.awaitCommandReady.pipe(andThen(forever$1(tick.pipe(andThen(sleep$4("60 seconds")))))));
306823
306919
  }));
@@ -321693,7 +321789,7 @@ const connectLoginCommand = make$34("login", {
321693
321789
  })).json();
321694
321790
  },
321695
321791
  openBrowser: async (url) => {
321696
- const open = (await import("./open-yHTUkd2Y.mjs")).default;
321792
+ const open = (await import("./open-2-reBrpv.mjs")).default;
321697
321793
  await open(url);
321698
321794
  return true;
321699
321795
  },
@@ -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{Fn as a,Hc as o,Hr as s,Kc as c,Qr as l,Rr as u,Sr as d,Tn as f,Wc as p,Xr as m,_r as h,d as g,fn as _,fr as v,gr as y,i as b,is as x,jn as S,kl 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-Cehr3KPQ.js";import{hn as P}from"./CompositeItem-BuglG3oi.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-Gi0gZkkp.js";import{Dn as q,at as J,it as ee}from"./src-DVtrA7UW.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-zSJ7Ltiu.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)(b),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:_,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:v,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)(_,{ref:v,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 c({queryKey:M.checkpointDiff(e),queryFn:async({signal:n})=>{if(!e.environmentId||!e.threadId||t._tag===`None`)throw Error(`Checkpoint diff is unavailable.`);let r=s(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{Fn as a,Hc as o,Hr as s,Kc as c,Qr as l,Rr as u,Sr as d,Tn as f,Wc as p,Xr as m,_r as h,d as g,fn as _,fr as v,gr as y,i as b,is as x,jn as S,kl 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-ri9akc4C.js";import{hn as P}from"./CompositeItem-BuglG3oi.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-C0JGiYGF.js";import{Dn as q,at as J,it as ee}from"./src-DVtrA7UW.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-B1eti1Tk.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)(b),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:_,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:v,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)(_,{ref:v,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 c({queryKey:M.checkpointDiff(e),queryFn:async({signal:n})=>{if(!e.environmentId||!e.threadId||t._tag===`None`)throw Error(`Checkpoint diff is unavailable.`);let r=s(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}=y(),s=h(),[c,l]=(0,X.useState)(`stacked`),[u,m]=(0,X.useState)(s.diffWordWrap),g=(0,X.useRef)(null),_=(0,X.useRef)(!1),v=Te(),{activeCwd:b,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]!==s.diffWordWrap?(M=()=>{C&&!_.current&&m(s.diffWordWrap),_.current=C},P=[C,s.diffWordWrap],t[0]=C,t[1]=s.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||!g.current||Array.from(g.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]===b?L=t[10]:(L=e=>{let t=d();if(!t)return;let n=b?f(e,b):e;N(t,n).catch(ke)},t[9]=b,t[10]=L);let R=L,z;t[11]===x?z=t[12]:(z=e=>{x&&a.getState().openDiff(p(o(x.environmentId,x.id)),e)},t[11]=x,t[12]=z);let B=z,V;t[13]===x?V=t[14]:(V=()=>{x&&a.getState().openDiff(p(o(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]!==s||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:m,settings:s,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]=s,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:g,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=C(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),a=i.rightPanel===`diff`,o=n?.threadId??null,s,c;e[2]===n?c=e[3]:(c=S(n),e[2]=n,e[3]=c),s=c;let l=E(s),d=He(l),f=l?.worktreePath,p=d?.cwd,m;e[4]!==f||e[5]!==p?(m=I({threadWorktreePath:f,projectCwd:p}),e[4]=f,e[5]=p,e[6]=m):m=e[6];let h=m,g=l?.environmentId??null,_=h??null,v;e[7]!==g||e[8]!==_?(v={environmentId:g,cwd:_},e[7]=g,e[8]=_,e[9]=v):v=e[9];let y=u(v),b;e[10]===y.data?b=e[11]:(b=z(y.data),e[10]=y.data,e[11]=b);let x=b,w;return e[12]!==h||e[13]!==l||e[14]!==o||e[15]!==a||e[16]!==i||e[17]!==x?(w={activeThread:l,activeThreadId:o,activeCwd:h,isGitRepo:x,diffSearch:i,diffOpen:a},e[12]=h,e[13]=l,e[14]=o,e[15]=a,e[16]=i,e[17]=x,e[18]=w):w=e[18],w}function Fe(e){return G(e)}function Ie(e){return m(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=O(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)(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: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=v(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?x(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-swp7aRub.js.map
64
+ //# sourceMappingURL=DiffPanel-Sde1CySn.js.map