@cmmd-center/forge 0.13.81 → 0.13.83

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.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 $U, { homedir, networkInterfaces, tmpdir } from "node:os";
26
+ import os, { 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";
@@ -50591,7 +50591,7 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
50591
50591
  const min = forceColor || 0;
50592
50592
  if (env.TERM === "dumb") return min;
50593
50593
  if (process$1.platform === "win32") {
50594
- const osRelease = $U.release().split(".");
50594
+ const osRelease = os.release().split(".");
50595
50595
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
50596
50596
  return 1;
50597
50597
  }
@@ -53034,7 +53034,7 @@ var require_ProcessDetector = /* @__PURE__ */ __commonJSMin(((exports) => {
53034
53034
  exports.processDetector = void 0;
53035
53035
  const api_1 = (init_esm$1(), __toCommonJS(esm_exports$1));
53036
53036
  const semconv_1 = require_semconv$1();
53037
- const os$3 = __require("os");
53037
+ const os$4 = __require("os");
53038
53038
  /**
53039
53039
  * ProcessDetector will be used to detect the resources related current process running
53040
53040
  * and being instrumented from the NodeJS Process module.
@@ -53056,7 +53056,7 @@ var require_ProcessDetector = /* @__PURE__ */ __commonJSMin(((exports) => {
53056
53056
  };
53057
53057
  if (process.argv.length > 1) attributes[semconv_1.ATTR_PROCESS_COMMAND] = process.argv[1];
53058
53058
  try {
53059
- const userInfo = os$3.userInfo();
53059
+ const userInfo = os$4.userInfo();
53060
53060
  attributes[semconv_1.ATTR_PROCESS_OWNER] = userInfo.username;
53061
53061
  } catch (e) {
53062
53062
  api_1.diag.debug(`error obtaining process owner: ${e}`);
@@ -65979,7 +65979,7 @@ function normalizeNumberish(value) {
65979
65979
  }
65980
65980
  //#endregion
65981
65981
  //#region package.json
65982
- var version$1 = "0.13.81";
65982
+ var version$1 = "0.13.83";
65983
65983
  //#endregion
65984
65984
  //#region src/sentry.ts
65985
65985
  const SERVER_APP_NAME = "forge-server";
@@ -76022,7 +76022,7 @@ var require_node_gyp_build = /* @__PURE__ */ __commonJSMin(((exports, module) =>
76022
76022
  var fs$6 = __require("fs");
76023
76023
  var path$5 = __require("path");
76024
76024
  var url$1 = __require("url");
76025
- var os$2 = __require("os");
76025
+ var os$3 = __require("os");
76026
76026
  var runtimeRequire = typeof __webpack_require__ === "function" ? __non_webpack_require__ : __require;
76027
76027
  var vars = process.config && process.config.variables || {};
76028
76028
  var prebuildsOnly = !!process.env.PREBUILDS_ONLY;
@@ -76030,8 +76030,8 @@ var require_node_gyp_build = /* @__PURE__ */ __commonJSMin(((exports, module) =>
76030
76030
  var abi = versions.modules;
76031
76031
  if (versions.deno || process.isBun) abi = "unsupported";
76032
76032
  var runtime = isElectron() ? "electron" : isNwjs() ? "node-webkit" : "node";
76033
- var arch = process.env.npm_config_arch || os$2.arch();
76034
- var platform = process.env.npm_config_platform || os$2.platform();
76033
+ var arch = process.env.npm_config_arch || os$3.arch();
76034
+ var platform = process.env.npm_config_platform || os$3.platform();
76035
76035
  var libc = process.env.LIBC || (isMusl(platform) ? "musl" : "glibc");
76036
76036
  var armv = process.env.ARM_VERSION || (arch === "arm64" ? "8" : vars.arm_version) || "";
76037
76037
  var uv = (versions.uv || "").split(".")[0];
@@ -79845,10 +79845,7 @@ function dedupeChecks(entries) {
79845
79845
  for (const entry of survivors) countsByName.set(entry.check.name, (countsByName.get(entry.check.name) ?? 0) + 1);
79846
79846
  return survivors.map((entry) => {
79847
79847
  const workflowName = entry.workflowName ?? "";
79848
- return workflowName.length > 0 && (countsByName.get(entry.check.name) ?? 0) > 1 ? {
79849
- ...entry.check,
79850
- name: `${workflowName} / ${entry.check.name}`
79851
- } : entry.check;
79848
+ return workflowName.length > 0 && (countsByName.get(entry.check.name) ?? 0) > 1 ? Object.assign({}, entry.check, { name: `${workflowName} / ${entry.check.name}` }) : entry.check;
79852
79849
  });
79853
79850
  }
79854
79851
  //#endregion
@@ -87199,13 +87196,8 @@ const make$21 = gen(function* () {
87199
87196
  author: withAvatar(pullRequest.author, reviewThreads.avatarsByLogin, input.host),
87200
87197
  reviewers: reviewThreads.reviewers,
87201
87198
  reactions: reviewThreads.reactions,
87202
- commits: (reviewThreads.commits.length > 0 ? reviewThreads.commits : pullRequest.commits).map((commit) => ({
87203
- ...commit,
87204
- ...reviewThreads.commitStats.get(commit.oid),
87205
- authors: commit.authors?.map((author) => withAvatar(author, reviewThreads.avatarsByLogin, input.host) ?? author)
87206
- })),
87207
- comments: [...pullRequest.comments, ...reviewThreads.comments].map((comment) => ({
87208
- ...comment,
87199
+ commits: (reviewThreads.commits.length > 0 ? reviewThreads.commits : pullRequest.commits).map((commit) => Object.assign({}, commit, reviewThreads.commitStats.get(commit.oid), { authors: commit.authors?.map((author) => withAvatar(author, reviewThreads.avatarsByLogin, input.host) ?? author) })),
87200
+ comments: [...pullRequest.comments, ...reviewThreads.comments].map((comment) => Object.assign({}, comment, {
87209
87201
  body: comment.kind === "review" && comment.reviewState?.toUpperCase() === "DISMISSED" && rendersEmpty(comment.body) ? reviewThreads.dismissalsByReviewId.get(comment.id) ?? comment.body : comment.body,
87210
87202
  author: withAvatar(comment.author, reviewThreads.avatarsByLogin, input.host),
87211
87203
  reactions: comment.reactions ?? reviewThreads.reactionsById.get(comment.id) ?? []
@@ -93872,7 +93864,7 @@ const launchDetached = (launch) => gen(function* () {
93872
93864
  });
93873
93865
  const OpenLive = effect(Open, gen(function* () {
93874
93866
  const open = yield* tryPromise({
93875
- try: () => import("./open-2-reBrpv.mjs"),
93867
+ try: () => import("./open-yHTUkd2Y.mjs"),
93876
93868
  catch: (cause) => new OpenError$1({
93877
93869
  message: "failed to load browser opener",
93878
93870
  cause
@@ -151361,7 +151353,7 @@ const OPENAI_PROXY_ENV_KEYS = ["OPENAI_API_KEY", "OPENAI_BASE_URL"];
151361
151353
  function personalCodexServedByControlPlane(env = process.env) {
151362
151354
  return env.FORGE_CMMD_RUNTIME_MODE === "true" && env.FORGE_PERSONAL_CODEX_VIA_EGRESS === "true";
151363
151355
  }
151364
- function resolveCodexAccessMode(input) {
151356
+ function resolveCodexAccessMode$1(input) {
151365
151357
  if (clampWorkspaceAccessMode(input.accessMode) === "workspace") return "workspace";
151366
151358
  if (personalCodexServedByControlPlane(input.env ?? process.env)) return "workspace";
151367
151359
  if (!input.hasCodexChatGptLogin()) throw personalCodexAuthError("This runtime is not signed in to ChatGPT. Open Settings > Providers and connect ChatGPT on this runtime.");
@@ -153079,7 +153071,7 @@ var CodexAppServerManager = class extends EventEmitter$1 {
153079
153071
  cwd: resolvedCwd,
153080
153072
  ...codexHomePath ? { homePath: codexHomePath } : {}
153081
153073
  });
153082
- const accessMode = resolveCodexAccessMode({
153074
+ const accessMode = resolveCodexAccessMode$1({
153083
153075
  accessMode: input.accessMode ?? "workspace",
153084
153076
  hasCodexChatGptLogin: () => hasCodexChatGptLogin({
153085
153077
  binaryPath: codexBinaryPath,
@@ -191811,7 +191803,7 @@ var Vce = {
191811
191803
  function Ve() {
191812
191804
  return Vce;
191813
191805
  }
191814
- var Us = $U.homedir(), lk = $U.tmpdir(), { env: Vc } = process$1, Yce = (e) => {
191806
+ var Us = os.homedir(), lk = os.tmpdir(), { env: Vc } = process$1, Yce = (e) => {
191815
191807
  let t = path.join(Us, "Library");
191816
191808
  return {
191817
191809
  data: path.join(t, "Application Support", e),
@@ -202011,12 +202003,12 @@ function qZ(e, t) {
202011
202003
  }
202012
202004
  return n;
202013
202005
  }
202014
- var os$1 = "https://code.claude.com/docs/en", kKe = [
202006
+ var os$2 = "https://code.claude.com/docs/en", kKe = [
202015
202007
  {
202016
202008
  matches: (e) => e.path === "permissions.defaultMode" && e.code === "invalid_value",
202017
202009
  tip: {
202018
202010
  suggestion: "Valid modes: \"acceptEdits\" (ask before file changes), \"plan\" (analysis only), \"bypassPermissions\" (auto-accept all), or \"default\" (standard behavior)",
202019
- docLink: `${os$1}/iam#permission-modes`
202011
+ docLink: `${os$2}/iam#permission-modes`
202020
202012
  }
202021
202013
  },
202022
202014
  {
@@ -202031,7 +202023,7 @@ var os$1 = "https://code.claude.com/docs/en", kKe = [
202031
202023
  matches: (e) => e.path.startsWith("env.") && e.code === "invalid_type",
202032
202024
  tip: {
202033
202025
  suggestion: "Environment variables must be strings. Wrap numbers and booleans in quotes. Example: \"DEBUG\": \"true\", \"PORT\": \"3000\"",
202034
- docLink: `${os$1}/settings#environment-variables`
202026
+ docLink: `${os$2}/settings#environment-variables`
202035
202027
  }
202036
202028
  },
202037
202029
  {
@@ -202042,14 +202034,14 @@ var os$1 = "https://code.claude.com/docs/en", kKe = [
202042
202034
  matches: (e) => e.path.startsWith("hooks.") && e.code === "invalid_key",
202043
202035
  tip: {
202044
202036
  suggestion: "Not a recognized hook event. Common events: PreToolUse, PostToolUse, UserPromptSubmit, SessionStart, SessionEnd, Stop. Check spelling and capitalization.",
202045
- docLink: `${os$1}/hooks`
202037
+ docLink: `${os$2}/hooks`
202046
202038
  }
202047
202039
  },
202048
202040
  {
202049
202041
  matches: (e) => /\.hooks\.\d+\.command$/.test(e.path) && e.code === "invalid_type" && e.received === "undefined",
202050
202042
  tip: {
202051
202043
  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\"}.",
202052
- docLink: `${os$1}/hooks#exec-form-and-shell-form`
202044
+ docLink: `${os$2}/hooks#exec-form-and-shell-form`
202053
202045
  }
202054
202046
  },
202055
202047
  {
@@ -202064,7 +202056,7 @@ var os$1 = "https://code.claude.com/docs/en", kKe = [
202064
202056
  matches: (e) => e.code === "unrecognized_keys",
202065
202057
  tip: {
202066
202058
  suggestion: "Check for typos or refer to the documentation for valid fields",
202067
- docLink: `${os$1}/settings`
202059
+ docLink: `${os$2}/settings`
202068
202060
  }
202069
202061
  },
202070
202062
  {
@@ -202079,13 +202071,13 @@ var os$1 = "https://code.claude.com/docs/en", kKe = [
202079
202071
  matches: (e) => e.path === "permissions.additionalDirectories" && e.code === "invalid_type",
202080
202072
  tip: {
202081
202073
  suggestion: "Must be an array of directory paths. Example: [\"~/projects\", \"/tmp/workspace\"]. You can also use --add-dir flag or /add-dir command",
202082
- docLink: `${os$1}/iam#working-directories`
202074
+ docLink: `${os$2}/iam#working-directories`
202083
202075
  }
202084
202076
  }
202085
202077
  ], AKe = {
202086
- permissions: `${os$1}/iam#configuring-permissions`,
202087
- env: `${os$1}/settings#environment-variables`,
202088
- hooks: `${os$1}/hooks`
202078
+ permissions: `${os$2}/iam#configuring-permissions`,
202079
+ env: `${os$2}/settings#environment-variables`,
202080
+ hooks: `${os$2}/hooks`
202089
202081
  };
202090
202082
  function GZ(e) {
202091
202083
  let t = kKe.find((r) => r.matches(e));
@@ -223029,6 +223021,9 @@ const makeTerminationError = (handle) => match$1(handle.exitCode, {
223029
223021
  });
223030
223022
  //#endregion
223031
223023
  //#region ../../packages/effect-acp/src/client.ts
223024
+ function runNotificationHandlers(registration, notification) {
223025
+ return forEach(registration.handlers, (handler) => handler(notification).pipe(catch_(() => void_$1)), { discard: true });
223026
+ }
223032
223027
  var AcpClient = class extends Service$1()("effect-acp/AcpClient") {};
223033
223028
  const make$12 = fn$1("effect-acp/AcpClient.make")(function* (stdio, options = {}, terminationError) {
223034
223029
  const coreHandlers = {};
@@ -223046,7 +223041,6 @@ const make$12 = fn$1("effect-acp/AcpClient.make")(function* (stdio, options = {}
223046
223041
  const extNotificationHandlers = /* @__PURE__ */ new Map();
223047
223042
  let unknownExtRequestHandler;
223048
223043
  let unknownExtNotificationHandler;
223049
- const runNotificationHandlers = (registration, notification) => forEach(registration.handlers, (handler) => handler(notification).pipe(catch_(() => void_$1)), { discard: true });
223050
223044
  const flushBufferedNotifications = (registration) => suspend$1(() => {
223051
223045
  if (registration.handlers.length === 0 || registration.pending.length === 0) return void_$1;
223052
223046
  return forEach(registration.pending.splice(0, registration.pending.length), (notification) => runNotificationHandlers(registration, notification), { discard: true });
@@ -237256,6 +237250,34 @@ const CodexProviderLive = effect(CodexProvider, gen(function* () {
237256
237250
  //#region src/git/Layers/CodexTextGeneration.ts
237257
237251
  const CODEX_GIT_TEXT_GENERATION_REASONING_EFFORT = "low";
237258
237252
  const CODEX_TIMEOUT_MS = 18e4;
237253
+ const readCodexStreamAsString = (operation, stream) => stream.pipe(decodeText$1(), runFold(() => "", (acc, chunk) => acc + chunk), mapError((cause) => normalizeCliError("codex", operation, cause, "Failed to collect process output")));
237254
+ function buildCodexExecArgs(input) {
237255
+ return [
237256
+ "exec",
237257
+ "--ephemeral",
237258
+ "--skip-git-repo-check",
237259
+ "-s",
237260
+ "read-only",
237261
+ "--model",
237262
+ input.model,
237263
+ "--config",
237264
+ `model_reasoning_effort="${input.reasoningEffort}"`,
237265
+ "--config",
237266
+ `project_doc_max_bytes=${CODEX_PROJECT_DOC_MAX_BYTES}`,
237267
+ ...input.fastMode ? ["--config", `service_tier="fast"`] : [],
237268
+ "--output-schema",
237269
+ input.schemaPath,
237270
+ "--output-last-message",
237271
+ input.outputPath,
237272
+ "--json",
237273
+ ...input.imagePaths.flatMap((imagePath) => ["--image", imagePath]),
237274
+ "-"
237275
+ ];
237276
+ }
237277
+ function resolveCodexAccessMode(configuredAccessMode) {
237278
+ const accessMode = clampWorkspaceAccessMode(configuredAccessMode);
237279
+ return accessMode === "personal" && personalCodexServedByControlPlane() ? "workspace" : accessMode;
237280
+ }
237259
237281
  /**
237260
237282
  * Byte budget Codex spends on `AGENTS.md` when it builds project instructions.
237261
237283
  * The Codex config reference defines `project_doc_max_bytes` as "Maximum bytes
@@ -237277,7 +237299,6 @@ const CodexTextGenerationLive = effect(TextGeneration, gen(function* () {
237277
237299
  const serverConfig = yield* service(ServerConfig);
237278
237300
  const serverSettingsService = yield* service(ServerSettingsService);
237279
237301
  const textGenerationUsage = yield* service(TextGenerationUsage);
237280
- const readStreamAsString = (operation, stream) => stream.pipe(decodeText$1(), runFold(() => "", (acc, chunk) => acc + chunk), mapError((cause) => normalizeCliError("codex", operation, cause, "Failed to collect process output")));
237281
237302
  const writeTempFile = (operation, prefix, content) => {
237282
237303
  return fileSystem.makeTempFileScoped({ prefix: `forge-${prefix}-${process.pid}-${randomUUID()}.tmp` }).pipe(tap((filePath) => fileSystem.writeFileString(filePath, content)), mapError((cause) => new TextGenerationError({
237283
237304
  operation,
@@ -237365,39 +237386,47 @@ const CodexTextGenerationLive = effect(TextGeneration, gen(function* () {
237365
237386
  const outputPath = yield* writeTempFile(operation, "codex-output", "");
237366
237387
  const workingDirectory = yield* makeNeutralWorkingDirectory(operation);
237367
237388
  const codexSettings = yield* map$3(serverSettingsService.getSettings, (settings) => settings.providers.codex).pipe(catch_(() => undefined_));
237368
- const runCodexCommand = fn$1("runCodexJson.runCodexCommand")(function* () {
237389
+ const launchCodexCommand = (command) => gen(function* () {
237390
+ const child = yield* commandSpawner.spawn(command).pipe(mapError((cause) => normalizeCliError("codex", operation, cause, "Failed to spawn Codex CLI process")));
237391
+ const [stdout, stderr, exitCode] = yield* all([
237392
+ readCodexStreamAsString(operation, child.stdout),
237393
+ readCodexStreamAsString(operation, child.stderr),
237394
+ child.exitCode.pipe(mapError((cause) => normalizeCliError("codex", operation, cause, "Failed to read Codex CLI exit code")))
237395
+ ], { concurrency: "unbounded" });
237396
+ if (exitCode === 0) return stdout;
237397
+ const detail = stderr.trim() || stdout.trim();
237398
+ return yield* new TextGenerationError({
237399
+ operation,
237400
+ detail: detail.length > 0 ? `Codex CLI command failed: ${detail}` : `Codex CLI command failed with code ${exitCode}.`
237401
+ });
237402
+ });
237403
+ const resolveCodexCommandTarget = fn$1("runCodexJson.resolveCommandTarget")(function* () {
237369
237404
  const normalizedOptions = normalizeCodexModelOptionsWithCapabilities(getCodexModelCapabilities(modelSelection.model), modelSelection.options);
237370
237405
  const reasoningEffort = modelSelection.options?.reasoningEffort ?? CODEX_GIT_TEXT_GENERATION_REASONING_EFFORT;
237371
- const clampedAccessMode = clampWorkspaceAccessMode(codexSettings?.accessMode ?? "workspace");
237372
- const accessMode = clampedAccessMode === "personal" && personalCodexServedByControlPlane() ? "workspace" : clampedAccessMode;
237373
- const providerProxyToken = yield* resolveCodexProviderProxyToken({
237374
- operation,
237406
+ const accessMode = resolveCodexAccessMode(codexSettings?.accessMode ?? "workspace");
237407
+ return {
237408
+ normalizedOptions,
237409
+ reasoningEffort,
237375
237410
  accessMode,
237411
+ providerProxyToken: yield* resolveCodexProviderProxyToken({
237412
+ operation,
237413
+ accessMode,
237414
+ model: modelSelection.model,
237415
+ ...threadId ? { threadId } : {},
237416
+ authSessionId
237417
+ })
237418
+ };
237419
+ });
237420
+ const runCodexCommand = fn$1("runCodexJson.runCodexCommand")(function* () {
237421
+ const { normalizedOptions, reasoningEffort, accessMode, providerProxyToken } = yield* resolveCodexCommandTarget();
237422
+ return yield* launchCodexCommand(make$48(codexSettings?.binaryPath || "codex", buildCodexExecArgs({
237376
237423
  model: modelSelection.model,
237377
- ...threadId ? { threadId } : {},
237378
- authSessionId
237379
- });
237380
- const command = make$48(codexSettings?.binaryPath || "codex", [
237381
- "exec",
237382
- "--ephemeral",
237383
- "--skip-git-repo-check",
237384
- "-s",
237385
- "read-only",
237386
- "--model",
237387
- modelSelection.model,
237388
- "--config",
237389
- `model_reasoning_effort="${reasoningEffort}"`,
237390
- "--config",
237391
- `project_doc_max_bytes=${CODEX_PROJECT_DOC_MAX_BYTES}`,
237392
- ...normalizedOptions?.fastMode ? ["--config", `service_tier="fast"`] : [],
237393
- "--output-schema",
237424
+ reasoningEffort,
237425
+ fastMode: normalizedOptions?.fastMode,
237394
237426
  schemaPath,
237395
- "--output-last-message",
237396
237427
  outputPath,
237397
- "--json",
237398
- ...imagePaths.flatMap((imagePath) => ["--image", imagePath]),
237399
- "-"
237400
- ], {
237428
+ imagePaths
237429
+ }), {
237401
237430
  env: scrubForgeProviderChildEnvSecrets(buildCodexProcessEnv({
237402
237431
  baseEnv: process.env,
237403
237432
  accessMode,
@@ -237410,23 +237439,7 @@ const CodexTextGenerationLive = effect(TextGeneration, gen(function* () {
237410
237439
  cwd: workingDirectory,
237411
237440
  shell: process.platform === "win32",
237412
237441
  stdin: { stream: encodeText(make$43(prompt)) }
237413
- });
237414
- const child = yield* commandSpawner.spawn(command).pipe(mapError((cause) => normalizeCliError("codex", operation, cause, "Failed to spawn Codex CLI process")));
237415
- const [stdout, stderr, exitCode] = yield* all([
237416
- readStreamAsString(operation, child.stdout),
237417
- readStreamAsString(operation, child.stderr),
237418
- child.exitCode.pipe(mapError((cause) => normalizeCliError("codex", operation, cause, "Failed to read Codex CLI exit code")))
237419
- ], { concurrency: "unbounded" });
237420
- if (exitCode !== 0) {
237421
- const stderrDetail = stderr.trim();
237422
- const stdoutDetail = stdout.trim();
237423
- const detail = stderrDetail.length > 0 ? stderrDetail : stdoutDetail;
237424
- return yield* new TextGenerationError({
237425
- operation,
237426
- detail: detail.length > 0 ? `Codex CLI command failed: ${detail}` : `Codex CLI command failed with code ${exitCode}.`
237427
- });
237428
- }
237429
- return stdout;
237442
+ }));
237430
237443
  });
237431
237444
  const cleanup = all([...[
237432
237445
  schemaPath,
@@ -237565,6 +237578,7 @@ const CodexTextGenerationLive = effect(TextGeneration, gen(function* () {
237565
237578
  * @module ClaudeTextGeneration
237566
237579
  */
237567
237580
  const CLAUDE_TIMEOUT_MS = 18e4;
237581
+ const readClaudeStreamAsString = (operation, stream) => stream.pipe(decodeText$1(), runFold(() => "", (acc, chunk) => acc + chunk), mapError((cause) => normalizeCliError("claude", operation, cause, "Failed to collect process output")));
237568
237582
  /**
237569
237583
  * Schema for the wrapper JSON returned by `claude -p --output-format json`.
237570
237584
  * We only care about `structured_output`.
@@ -237600,7 +237614,6 @@ const ClaudeTextGenerationLive = effect(TextGeneration, gen(function* () {
237600
237614
  ...report.providerSessionId ? { providerSessionId: report.providerSessionId } : {}
237601
237615
  });
237602
237616
  });
237603
- const readStreamAsString = (operation, stream) => stream.pipe(decodeText$1(), runFold(() => "", (acc, chunk) => acc + chunk), mapError((cause) => normalizeCliError("claude", operation, cause, "Failed to collect process output")));
237604
237617
  /**
237605
237618
  * Spawn the Claude CLI with structured JSON output and return the parsed,
237606
237619
  * schema-validated result.
@@ -237633,8 +237646,8 @@ const ClaudeTextGenerationLive = effect(TextGeneration, gen(function* () {
237633
237646
  });
237634
237647
  const child = yield* commandSpawner.spawn(command).pipe(mapError((cause) => normalizeCliError("claude", operation, cause, "Failed to spawn Claude CLI process")));
237635
237648
  const [stdout, stderr, exitCode] = yield* all([
237636
- readStreamAsString(operation, child.stdout),
237637
- readStreamAsString(operation, child.stderr),
237649
+ readClaudeStreamAsString(operation, child.stdout),
237650
+ readClaudeStreamAsString(operation, child.stderr),
237638
237651
  child.exitCode.pipe(mapError((cause) => normalizeCliError("claude", operation, cause, "Failed to read Claude CLI exit code")))
237639
237652
  ], { concurrency: "unbounded" });
237640
237653
  if (exitCode !== 0) {
@@ -238029,6 +238042,21 @@ var TerminalProcessSignalError = class extends TaggedErrorClass()("TerminalProce
238029
238042
  cause: optional$4(Defect),
238030
238043
  signal: Literals(["SIGTERM", "SIGKILL"])
238031
238044
  }) {};
238045
+ function toTerminalHistoryError(operation, threadId, terminalId) {
238046
+ return (cause) => new TerminalHistoryError({
238047
+ operation,
238048
+ threadId,
238049
+ terminalId,
238050
+ cause
238051
+ });
238052
+ }
238053
+ function requireRunningProcess(session) {
238054
+ if (session.process && session.status === "running") return succeed(session.process);
238055
+ return fail(new TerminalNotRunningError({
238056
+ threadId: session.threadId,
238057
+ terminalId: session.terminalId
238058
+ }));
238059
+ }
238032
238060
  const MAX_TERMINAL_CONTROL_RECEIPTS = 256;
238033
238061
  function terminalControlPayloadHash(method, payload) {
238034
238062
  return createHash("sha256").update(method).update("\0").update(payload).digest("base64url");
@@ -238473,12 +238501,6 @@ const makeTerminalManagerWithOptions = fn$1("makeTerminalManagerWithOptions")(fu
238473
238501
  return path.join(logsDir, `${threadPart}_${toSafeTerminalId(terminalId)}.log`);
238474
238502
  };
238475
238503
  const legacyHistoryPath = (threadId) => path.join(logsDir, `${legacySafeThreadId(threadId)}.log`);
238476
- const toTerminalHistoryError = (operation, threadId, terminalId) => (cause) => new TerminalHistoryError({
238477
- operation,
238478
- threadId,
238479
- terminalId,
238480
- cause
238481
- });
238482
238504
  const readManagerState = get$2(managerStateRef);
238483
238505
  const modifyManagerState = (f) => modify$2(managerStateRef, f);
238484
238506
  const getThreadSemaphore = (threadId) => modifyEffect(threadLocksRef, (current) => {
@@ -239135,13 +239157,6 @@ const makeTerminalManagerWithOptions = fn$1("makeTerminalManagerWithOptions")(fu
239135
239157
  transitionReceipts.delete(oldest);
239136
239158
  }
239137
239159
  };
239138
- const requireRunningProcess = (session) => {
239139
- if (session.process && session.status === "running") return succeed(session.process);
239140
- return fail(new TerminalNotRunningError({
239141
- threadId: session.threadId,
239142
- terminalId: session.terminalId
239143
- }));
239144
- };
239145
239160
  const write = fn$1("terminal.write")(function* (input) {
239146
239161
  const terminalId = input.terminalId ?? "default";
239147
239162
  const session = yield* requireSession(input.threadId, terminalId);
@@ -270288,7 +270303,7 @@ var import_multicast_dns = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMi
270288
270303
  var dgram = __require("dgram");
270289
270304
  var thunky = require_thunky();
270290
270305
  var events = __require("events");
270291
- var os = __require("os");
270306
+ var os$1 = __require("os");
270292
270307
  var noop = function() {};
270293
270308
  module.exports = function(opts) {
270294
270309
  if (!opts) opts = {};
@@ -270419,14 +270434,14 @@ var import_multicast_dns = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMi
270419
270434
  return that;
270420
270435
  };
270421
270436
  function defaultInterface() {
270422
- var networks = os.networkInterfaces();
270437
+ var networks = os$1.networkInterfaces();
270423
270438
  var names = Object.keys(networks);
270424
270439
  for (var i = 0; i < names.length; i++) {
270425
270440
  var net = networks[names[i]];
270426
270441
  for (var j = 0; j < net.length; j++) {
270427
270442
  var iface = net[j];
270428
270443
  if (isIPv4(iface.family) && !iface.internal) {
270429
- if (os.platform() === "darwin" && names[i] === "en0") return iface.address;
270444
+ if (os$1.platform() === "darwin" && names[i] === "en0") return iface.address;
270430
270445
  return "0.0.0.0";
270431
270446
  }
270432
270447
  }
@@ -270434,7 +270449,7 @@ var import_multicast_dns = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMi
270434
270449
  return "127.0.0.1";
270435
270450
  }
270436
270451
  function allInterfaces() {
270437
- var networks = os.networkInterfaces();
270452
+ var networks = os$1.networkInterfaces();
270438
270453
  var names = Object.keys(networks);
270439
270454
  var res = [];
270440
270455
  for (var i = 0; i < names.length; i++) {
@@ -292078,7 +292093,7 @@ function mapProviderSessionStatusToOrchestrationStatus(status) {
292078
292093
  }
292079
292094
  }
292080
292095
  const turnStartKeyForEvent = (event) => event.commandId !== null ? `command:${event.commandId}` : `event:${event.eventId}`;
292081
- const serverCommandId$1 = (tag) => CommandId.make(`server:${tag}:${crypto.randomUUID()}`);
292096
+ const serverCommandId$2 = (tag) => CommandId.make(`server:${tag}:${crypto.randomUUID()}`);
292082
292097
  const HANDLED_TURN_START_KEY_MAX = 1e4;
292083
292098
  const HANDLED_TURN_START_KEY_TTL = minutes(30);
292084
292099
  const DEFAULT_RUNTIME_MODE = "full-access";
@@ -292500,7 +292515,7 @@ const ProviderCommandReactorLive = effect(ProviderCommandReactor, gen(function*
292500
292515
  const threadSessionAccountIds = /* @__PURE__ */ new Map();
292501
292516
  const appendProviderFailureActivity = (input) => orchestrationEngine.dispatch({
292502
292517
  type: "thread.activity.append",
292503
- commandId: serverCommandId$1("provider-failure-activity"),
292518
+ commandId: serverCommandId$2("provider-failure-activity"),
292504
292519
  threadId: input.threadId,
292505
292520
  activity: {
292506
292521
  id: EventId.make(crypto.randomUUID()),
@@ -292518,7 +292533,7 @@ const ProviderCommandReactorLive = effect(ProviderCommandReactor, gen(function*
292518
292533
  });
292519
292534
  const setThreadSession = (input) => orchestrationEngine.dispatch({
292520
292535
  type: "thread.session.set",
292521
- commandId: serverCommandId$1("provider-session-set"),
292536
+ commandId: serverCommandId$2("provider-session-set"),
292522
292537
  threadId: input.threadId,
292523
292538
  session: input.session,
292524
292539
  createdAt: input.createdAt
@@ -292550,7 +292565,7 @@ const ProviderCommandReactorLive = effect(ProviderCommandReactor, gen(function*
292550
292565
  const desiredRuntimeMode = thread.runtimeMode;
292551
292566
  const currentProvider = thread.session?.status !== "stopped" && isProviderKind(thread.session?.providerName) ? thread.session.providerName : void 0;
292552
292567
  const requestedModelSelection = options?.modelSelection;
292553
- const threadProvider = currentProvider ?? requestedModelSelection?.provider ?? thread.modelSelection.provider;
292568
+ const threadProvider = requestedModelSelection?.provider ?? currentProvider ?? thread.modelSelection.provider;
292554
292569
  const desiredModelSelection = requestedModelSelection ?? thread.modelSelection;
292555
292570
  const effectiveCwd = resolveThreadWorkspaceCwd({
292556
292571
  thread,
@@ -292801,7 +292816,7 @@ const ProviderCommandReactorLive = effect(ProviderCommandReactor, gen(function*
292801
292816
  });
292802
292817
  yield* orchestrationEngine.dispatch({
292803
292818
  type: "thread.meta.update",
292804
- commandId: serverCommandId$1("worktree-branch-rename"),
292819
+ commandId: serverCommandId$2("worktree-branch-rename"),
292805
292820
  threadId: input.threadId,
292806
292821
  branch: renamed.branch,
292807
292822
  worktreePath: cwd
@@ -292840,7 +292855,7 @@ const ProviderCommandReactorLive = effect(ProviderCommandReactor, gen(function*
292840
292855
  if (!canReplaceThreadTitle(thread.title, input.titleSeed)) return;
292841
292856
  yield* orchestrationEngine.dispatch({
292842
292857
  type: "thread.meta.update",
292843
- commandId: serverCommandId$1("thread-title-rename"),
292858
+ commandId: serverCommandId$2("thread-title-rename"),
292844
292859
  threadId: input.threadId,
292845
292860
  title: generated.title
292846
292861
  });
@@ -292903,7 +292918,7 @@ const ProviderCommandReactorLive = effect(ProviderCommandReactor, gen(function*
292903
292918
  const dispatchThreadTitleRegenerationCompletion = fn$1("dispatchThreadTitleRegenerationCompletion")(function* (input) {
292904
292919
  yield* orchestrationEngine.dispatch({
292905
292920
  type: "thread.title.regeneration.complete",
292906
- commandId: serverCommandId$1("thread-title-regeneration-complete"),
292921
+ commandId: serverCommandId$2("thread-title-regeneration-complete"),
292907
292922
  threadId: input.threadId,
292908
292923
  requestId: input.requestId,
292909
292924
  ...input.title !== void 0 ? { title: input.title } : {}
@@ -293211,7 +293226,7 @@ const ProviderCommandReactorLive = effect(ProviderCommandReactor, gen(function*
293211
293226
  });
293212
293227
  const appendRecoverableTurnStartTimeout = (event) => orchestrationEngine.dispatch({
293213
293228
  type: "thread.activity.append",
293214
- commandId: serverCommandId$1("provider-turn-start-timeout"),
293229
+ commandId: serverCommandId$2("provider-turn-start-timeout"),
293215
293230
  threadId: event.payload.threadId,
293216
293231
  activity: {
293217
293232
  id: EventId.make(crypto.randomUUID()),
@@ -294044,7 +294059,13 @@ function isGitOutputLimitError(error) {
294044
294059
  const text = `${"detail" in error && typeof error.detail === "string" ? error.detail : ""}\n${"message" in error && typeof error.message === "string" ? error.message : ""}`;
294045
294060
  return text.includes("output exceeded") && text.includes("bytes and was truncated");
294046
294061
  }
294047
- const serverCommandId = (tag) => CommandId.make(`server:${tag}:${crypto.randomUUID()}`);
294062
+ const serverCommandId$1 = (tag) => CommandId.make(`server:${tag}:${crypto.randomUUID()}`);
294063
+ function findSessionWithCwd(session) {
294064
+ return session?.cwd ? some({
294065
+ threadId: session.threadId,
294066
+ cwd: session.cwd
294067
+ }) : none$4();
294068
+ }
294048
294069
  const CheckpointReactorLive = effect(CheckpointReactor, gen(function* () {
294049
294070
  const orchestrationEngine = yield* OrchestrationEngineService;
294050
294071
  const providerService = yield* ProviderService;
@@ -294054,7 +294075,7 @@ const CheckpointReactorLive = effect(CheckpointReactor, gen(function* () {
294054
294075
  const gitStatusBroadcaster = yield* GitStatusBroadcaster;
294055
294076
  const appendRevertFailureActivity = (input) => orchestrationEngine.dispatch({
294056
294077
  type: "thread.activity.append",
294057
- commandId: serverCommandId("checkpoint-revert-failure"),
294078
+ commandId: serverCommandId$1("checkpoint-revert-failure"),
294058
294079
  threadId: input.threadId,
294059
294080
  activity: {
294060
294081
  id: EventId.make(crypto.randomUUID()),
@@ -294072,7 +294093,7 @@ const CheckpointReactorLive = effect(CheckpointReactor, gen(function* () {
294072
294093
  });
294073
294094
  const appendCaptureFailureActivity = (input) => orchestrationEngine.dispatch({
294074
294095
  type: "thread.activity.append",
294075
- commandId: serverCommandId("checkpoint-capture-failure"),
294096
+ commandId: serverCommandId$1("checkpoint-capture-failure"),
294076
294097
  threadId: input.threadId,
294077
294098
  activity: {
294078
294099
  id: EventId.make(crypto.randomUUID()),
@@ -294090,7 +294111,7 @@ const CheckpointReactorLive = effect(CheckpointReactor, gen(function* () {
294090
294111
  });
294091
294112
  const appendDiffSummarySkippedActivity = (input) => orchestrationEngine.dispatch({
294092
294113
  type: "thread.activity.append",
294093
- commandId: serverCommandId("checkpoint-diff-summary-skipped"),
294114
+ commandId: serverCommandId$1("checkpoint-diff-summary-skipped"),
294094
294115
  threadId: input.threadId,
294095
294116
  activity: {
294096
294117
  id: EventId.make(crypto.randomUUID()),
@@ -294106,20 +294127,12 @@ const CheckpointReactorLive = effect(CheckpointReactor, gen(function* () {
294106
294127
  const resolveSessionRuntimeForThread = fn$1("resolveSessionRuntimeForThread")(function* (threadId) {
294107
294128
  const thread = (yield* orchestrationEngine.getReadModel()).threads.find((entry) => entry.id === threadId);
294108
294129
  const sessions = yield* providerService.listSessions();
294109
- const findSessionWithCwd = (session) => {
294110
- if (!session?.cwd) return none$4();
294111
- return some({
294112
- threadId: session.threadId,
294113
- cwd: session.cwd
294114
- });
294115
- };
294116
294130
  if (thread) {
294117
294131
  const fromProjected = findSessionWithCwd(sessions.find((session) => session.threadId === thread.id));
294118
294132
  if (isSome(fromProjected)) return fromProjected;
294119
294133
  }
294120
294134
  return none$4();
294121
294135
  });
294122
- const isGitWorkspace = (cwd) => isGitRepository(cwd);
294123
294136
  const resolveCheckpointCwd = fn$1("resolveCheckpointCwd")(function* (input) {
294124
294137
  const fromSession = yield* resolveSessionRuntimeForThread(input.threadId);
294125
294138
  const fromThread = resolveThreadWorkspaceCwd({
@@ -294134,7 +294147,7 @@ const CheckpointReactorLive = effect(CheckpointReactor, gen(function* () {
294134
294147
  onSome: (runtime) => runtime.cwd
294135
294148
  });
294136
294149
  if (!cwd) return;
294137
- if (!isGitWorkspace(cwd)) return;
294150
+ if (!isGitRepository(cwd)) return;
294138
294151
  return cwd;
294139
294152
  });
294140
294153
  const captureAndDispatchCheckpoint = fn$1("captureAndDispatchCheckpoint")(function* (input) {
@@ -294194,7 +294207,7 @@ const CheckpointReactorLive = effect(CheckpointReactor, gen(function* () {
294194
294207
  const assistantMessageId = input.assistantMessageId ?? input.thread.messages.toReversed().find((entry) => entry.role === "assistant" && entry.turnId === input.turnId)?.id ?? MessageId.make(`assistant:${input.turnId}`);
294195
294208
  yield* orchestrationEngine.dispatch({
294196
294209
  type: "thread.turn.diff.complete",
294197
- commandId: serverCommandId("checkpoint-turn-diff-complete"),
294210
+ commandId: serverCommandId$1("checkpoint-turn-diff-complete"),
294198
294211
  threadId: input.threadId,
294199
294212
  turnId: input.turnId,
294200
294213
  completedAt: input.createdAt,
@@ -294223,7 +294236,7 @@ const CheckpointReactorLive = effect(CheckpointReactor, gen(function* () {
294223
294236
  });
294224
294237
  yield* orchestrationEngine.dispatch({
294225
294238
  type: "thread.activity.append",
294226
- commandId: serverCommandId("checkpoint-captured-activity"),
294239
+ commandId: serverCommandId$1("checkpoint-captured-activity"),
294227
294240
  threadId: input.threadId,
294228
294241
  activity: {
294229
294242
  id: EventId.make(crypto.randomUUID()),
@@ -294405,7 +294418,7 @@ const CheckpointReactorLive = effect(CheckpointReactor, gen(function* () {
294405
294418
  }).pipe(catch_(() => void_$1));
294406
294419
  return;
294407
294420
  }
294408
- if (!isGitWorkspace(sessionRuntime.value.cwd)) {
294421
+ if (!isGitRepository(sessionRuntime.value.cwd)) {
294409
294422
  yield* appendRevertFailureActivity({
294410
294423
  threadId: event.payload.threadId,
294411
294424
  turnCount: event.payload.turnCount,
@@ -294461,7 +294474,7 @@ const CheckpointReactorLive = effect(CheckpointReactor, gen(function* () {
294461
294474
  });
294462
294475
  yield* orchestrationEngine.dispatch({
294463
294476
  type: "thread.revert.complete",
294464
- commandId: serverCommandId("checkpoint-revert-complete"),
294477
+ commandId: serverCommandId$1("checkpoint-revert-complete"),
294465
294478
  threadId: event.payload.threadId,
294466
294479
  turnCount: event.payload.turnCount,
294467
294480
  createdAt: now
@@ -298768,7 +298781,7 @@ function resolveBuildCommitFromEnv(env) {
298768
298781
  * environment descriptor down instead of reporting an honest "unknown".
298769
298782
  */
298770
298783
  function readBakedBuildCommit() {
298771
- return "657f7114dd9dda1b9eda0962d4bafff6d35a928b";
298784
+ return "f79faf155154414eb732bc0ef180d7b98f2b7888";
298772
298785
  }
298773
298786
  async function resolveServerBuildCommit(input) {
298774
298787
  if (isFullCommitSha(input.baked)) return input.baked;
@@ -300154,6 +300167,15 @@ var AuthPairingLinkRepository = class extends Service$1()("forge/persistence/Ser
300154
300167
  function toPersistenceSqlOrDecodeError$4(sqlOperation, decodeOperation) {
300155
300168
  return (cause) => isSchemaError(cause) ? toPersistenceDecodeError(decodeOperation)(cause) : toPersistenceSqlError(sqlOperation)(cause);
300156
300169
  }
300170
+ function decodeCredential(row) {
300171
+ return try_({
300172
+ try: () => ({
300173
+ ...row,
300174
+ credential: decodeSensitiveValue("auth-pairing-link", row.credential)
300175
+ }),
300176
+ catch: toPersistenceDecodeDefect("AuthPairingLinkRepository.decryptCredential")
300177
+ });
300178
+ }
300157
300179
  const AuthPairingLinkRepositoryLive = effect(AuthPairingLinkRepository, gen(function* () {
300158
300180
  const sql = yield* SqlClient;
300159
300181
  const StoredCreateAuthPairingLinkInput = Struct({
@@ -300275,13 +300297,6 @@ const AuthPairingLinkRepositoryLive = effect(AuthPairingLinkRepository, gen(func
300275
300297
  WHERE credential_lookup = ${credentialLookup}
300276
300298
  `
300277
300299
  });
300278
- const decodeCredential = (row) => try_({
300279
- try: () => ({
300280
- ...row,
300281
- credential: decodeSensitiveValue("auth-pairing-link", row.credential)
300282
- }),
300283
- catch: toPersistenceDecodeDefect("AuthPairingLinkRepository.decryptCredential")
300284
- });
300285
300300
  const create = (input) => createPairingLinkRow({
300286
300301
  ...input,
300287
300302
  credential: encodeSensitiveValue("auth-pairing-link", input.credential),
@@ -302702,8 +302717,10 @@ const decideOrchestrationCommand = fn$1("decideOrchestrationCommand")(function*
302702
302717
  }
302703
302718
  };
302704
302719
  const shouldUpdateAnchor = targetThread.anchorKind !== nextAnchor.anchorKind || targetThread.anchorCmmdId !== nextAnchor.anchorCmmdId;
302720
+ const providerSwitchSelection = command.modelSelection !== void 0 && command.modelSelection.provider !== targetThread.modelSelection.provider ? command.modelSelection : void 0;
302705
302721
  const accountSelection = turnAccountSelection(targetThread.modelSelection, command.modelSelection);
302706
- if (!shouldUpdateAnchor && !accountSelection) return [userMessageEvent, turnStartRequestedEvent];
302722
+ const turnModelSelection = providerSwitchSelection ?? accountSelection;
302723
+ if (!shouldUpdateAnchor && !turnModelSelection) return [userMessageEvent, turnStartRequestedEvent];
302707
302724
  return [
302708
302725
  {
302709
302726
  ...withEventBase({
@@ -302717,7 +302734,7 @@ const decideOrchestrationCommand = fn$1("decideOrchestrationCommand")(function*
302717
302734
  threadId: command.threadId,
302718
302735
  anchorKind: nextAnchor.anchorKind,
302719
302736
  anchorCmmdId: nextAnchor.anchorCmmdId,
302720
- ...accountSelection ? { modelSelection: accountSelection } : {},
302737
+ ...turnModelSelection ? { modelSelection: turnModelSelection } : {},
302721
302738
  updatedAt: command.createdAt
302722
302739
  }
302723
302740
  },
@@ -313135,14 +313152,8 @@ function buildRuntimeUsageRowBatch(rows, cursor, batchSize = 500) {
313135
313152
  previousHeadHash: cursor.headHash,
313136
313153
  rows: capped.map((row, index) => {
313137
313154
  const sequence = cursor.acknowledgedSequence + 1 + index;
313138
- return {
313139
- ...row,
313140
- sequence,
313141
- payloadHash: hashRuntimeUsageRow({
313142
- ...row,
313143
- sequence
313144
- })
313145
- };
313155
+ const sequencedRow = Object.assign({}, row, { sequence });
313156
+ return Object.assign(sequencedRow, { payloadHash: hashRuntimeUsageRow(sequencedRow) });
313146
313157
  })
313147
313158
  };
313148
313159
  }
@@ -315633,6 +315644,23 @@ const EXECUTABLE_STAGES = [
315633
315644
  ];
315634
315645
  const encoder = new TextEncoder();
315635
315646
  const decoder = new TextDecoder();
315647
+ function decodePersistedReport(item) {
315648
+ let value;
315649
+ try {
315650
+ value = JSON.parse(item.payloadJson);
315651
+ } catch {
315652
+ return null;
315653
+ }
315654
+ if (value === null || typeof value !== "object" || Array.isArray(value)) return null;
315655
+ const report = value;
315656
+ return [
315657
+ report.stage === item.stage,
315658
+ Number.isSafeInteger(report.attempt),
315659
+ (report.attempt ?? 0) > 0,
315660
+ Number.isSafeInteger(report.expectedLockVersion),
315661
+ (report.expectedLockVersion ?? -1) >= 0
315662
+ ].every(Boolean) ? report : null;
315663
+ }
315636
315664
  function isRecord$2(value) {
315637
315665
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
315638
315666
  }
@@ -317074,23 +317102,6 @@ const PipelineRunCoordinatorLive = effect(PipelineRunCoordinator, gen(function*
317074
317102
  })).applied) return yield* coordinatorError("reconcileTerminalHandoff", "PIPELINE_RECONCILE_CONFLICT", "The pipeline binding changed before its terminal state could be reconciled.");
317075
317103
  yield* finalizeTerminalResources(binding, publicationGeneration);
317076
317104
  }).pipe(mapError((cause) => cause instanceof PipelineRunCoordinatorError ? cause : coordinatorError("reconcileTerminalHandoff", "PIPELINE_RECONCILE_FAILED", `Failed to reconcile terminal CMMD run ${input.runId}.`, cause)));
317077
- const decodePersistedReport = (item) => {
317078
- let value;
317079
- try {
317080
- value = JSON.parse(item.payloadJson);
317081
- } catch {
317082
- return null;
317083
- }
317084
- if (value === null || typeof value !== "object" || Array.isArray(value)) return null;
317085
- const report = value;
317086
- return [
317087
- report.stage === item.stage,
317088
- Number.isSafeInteger(report.attempt),
317089
- (report.attempt ?? 0) > 0,
317090
- Number.isSafeInteger(report.expectedLockVersion),
317091
- (report.expectedLockVersion ?? -1) >= 0
317092
- ].every(Boolean) ? report : null;
317093
- };
317094
317105
  const synchronizeNonAppliedReport = (item, binding, authority, reportEpoch, currentEpoch) => gen(function* () {
317095
317106
  const snapshot = yield* client.read({
317096
317107
  runId: item.runId,
@@ -321014,6 +321025,9 @@ function requireMergeValue(value, message) {
321014
321025
  if (value === null || value === void 0) throw new Error(message);
321015
321026
  return value;
321016
321027
  }
321028
+ function serverCommandId(tag) {
321029
+ return CommandId.make(`server:agent-protocol:${tag}:${crypto.randomUUID()}`);
321030
+ }
321017
321031
  const AgentProtocolReactorLive = effect(AgentProtocolReactor, gen(function* () {
321018
321032
  const orchestration = yield* OrchestrationEngineService;
321019
321033
  const projectionSnapshotQuery = yield* ProjectionSnapshotQuery;
@@ -321024,7 +321038,6 @@ const AgentProtocolReactorLive = effect(AgentProtocolReactor, gen(function* () {
321024
321038
  const dispatch = (command) => runPromise(orchestration.dispatch(command).pipe(asVoid));
321025
321039
  const readThread = (threadId) => runPromise(readDurableWorkerDetail(projectionSnapshotQuery, threadId)).then(getOrNull);
321026
321040
  const readProject = (projectId) => runPromise(projectionSnapshotQuery.getProjectShellById(projectId)).then(getOrNull);
321027
- const serverCommandId = (tag) => CommandId.make(`server:agent-protocol:${tag}:${crypto.randomUUID()}`);
321028
321041
  const appendActivity = async (input) => {
321029
321042
  const createdAt = input.createdAt ?? (/* @__PURE__ */ new Date()).toISOString();
321030
321043
  await dispatch({
@@ -323399,7 +323412,7 @@ const connectLoginCommand = make$34("login", {
323399
323412
  })).json();
323400
323413
  },
323401
323414
  openBrowser: async (url) => {
323402
- const open = (await import("./open-2-reBrpv.mjs")).default;
323415
+ const open = (await import("./open-yHTUkd2Y.mjs")).default;
323403
323416
  await open(url);
323404
323417
  return true;
323405
323418
  },