@cmmd-center/forge 0.13.92 → 0.13.94

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";
@@ -26794,12 +26794,12 @@ function encodeCmmdRuntimeThreadWorkspaceMetadata(workspace) {
26794
26794
  }
26795
26795
  //#endregion
26796
26796
  //#region ../../packages/contracts/src/cmmdRuntimeToolActivity.ts
26797
- function isRecord$24(value) {
26797
+ function isRecord$25(value) {
26798
26798
  return value !== null && typeof value === "object" && !Array.isArray(value);
26799
26799
  }
26800
26800
  function encodeCmmdRuntimeToolActivityPayload(kind, payload) {
26801
26801
  return {
26802
- ...isRecord$24(payload) ? payload : { sourcePayload: payload },
26802
+ ...isRecord$25(payload) ? payload : { sourcePayload: payload },
26803
26803
  forgeToolActivity: {
26804
26804
  schemaVersion: 1,
26805
26805
  source: "native",
@@ -26822,7 +26822,7 @@ const WORKTREE_LAUNCH_ACTIVITY_KINDS = new Set([
26822
26822
  ]);
26823
26823
  function encodeCmmdRuntimeWorktreeLaunchActivityPayload(kind, payload) {
26824
26824
  return {
26825
- ...isRecord$24(payload) ? payload : { sourcePayload: payload },
26825
+ ...isRecord$25(payload) ? payload : { sourcePayload: payload },
26826
26826
  forgeWorktreeLaunchActivity: {
26827
26827
  schemaVersion: 1,
26828
26828
  source: "native",
@@ -26842,7 +26842,7 @@ function isCmmdRuntimeWorktreeLaunchActivityKind(kind) {
26842
26842
  const CMMD_RUNTIME_PLAN_ACTIVITY_KIND = "turn.plan.updated";
26843
26843
  function encodeCmmdRuntimePlanActivityPayload(kind, payload) {
26844
26844
  return {
26845
- ...isRecord$24(payload) ? payload : { sourcePayload: payload },
26845
+ ...isRecord$25(payload) ? payload : { sourcePayload: payload },
26846
26846
  forgePlanActivity: {
26847
26847
  schemaVersion: 1,
26848
26848
  source: "native",
@@ -26851,15 +26851,15 @@ function encodeCmmdRuntimePlanActivityPayload(kind, payload) {
26851
26851
  };
26852
26852
  }
26853
26853
  function decodeCmmdRuntimePlanActivity(payload) {
26854
- if (!isRecord$24(payload)) return null;
26854
+ if (!isRecord$25(payload)) return null;
26855
26855
  const metadata = payload["forgePlanActivity"];
26856
- if (!isRecord$24(metadata)) return null;
26856
+ if (!isRecord$25(metadata)) return null;
26857
26857
  if (metadata["schemaVersion"] !== 1 || metadata["source"] !== "native" || metadata["kind"] !== "turn.plan.updated") return null;
26858
26858
  const rawPlan = payload["plan"];
26859
26859
  return {
26860
26860
  kind: CMMD_RUNTIME_PLAN_ACTIVITY_KIND,
26861
26861
  plan: Array.isArray(rawPlan) ? rawPlan.flatMap((entry) => {
26862
- if (!isRecord$24(entry)) return [];
26862
+ if (!isRecord$25(entry)) return [];
26863
26863
  const step = entry["step"];
26864
26864
  const status = entry["status"];
26865
26865
  if (typeof step !== "string" || step.trim().length === 0) return [];
@@ -30875,13 +30875,13 @@ async function completePendingDesktopRelayIdentityRotation(input) {
30875
30875
  }
30876
30876
  //#endregion
30877
30877
  //#region ../../packages/relay-host/src/internal/desktopRelayJws.ts
30878
- function isRecord$23(value) {
30878
+ function isRecord$24(value) {
30879
30879
  return typeof value === "object" && value !== null && !Array.isArray(value);
30880
30880
  }
30881
30881
  function decodeBase64UrlJson$1(value) {
30882
30882
  try {
30883
30883
  const decoded = JSON.parse(Buffer.from(value, "base64url").toString("utf8"));
30884
- return isRecord$23(decoded) ? decoded : null;
30884
+ return isRecord$24(decoded) ? decoded : null;
30885
30885
  } catch {
30886
30886
  return null;
30887
30887
  }
@@ -31035,11 +31035,11 @@ var DesktopRelayControlPlaneError = class extends Error {
31035
31035
  this.name = "DesktopRelayControlPlaneError";
31036
31036
  }
31037
31037
  };
31038
- function isRecord$22(value) {
31038
+ function isRecord$23(value) {
31039
31039
  return typeof value === "object" && value !== null && !Array.isArray(value);
31040
31040
  }
31041
31041
  function parseErrorPayload(value) {
31042
- return isRecord$22(value) ? value : {};
31042
+ return isRecord$23(value) ? value : {};
31043
31043
  }
31044
31044
  function messageFromErrorPayload(payload, fallback) {
31045
31045
  return typeof payload.error === "string" && payload.error.trim().length > 0 ? payload.error.trim() : fallback;
@@ -31137,7 +31137,7 @@ async function postControlPlane(input) {
31137
31137
  const errorPayload = parseErrorPayload(payload);
31138
31138
  throw new DesktopRelayControlPlaneError(typeof errorPayload.code === "string" && errorPayload.code.trim().length > 0 ? errorPayload.code.trim() : `CMMD_HTTP_${response.status}`, messageFromErrorPayload(errorPayload, `CMMD relay request failed (${response.status}).`), response.status === 408 || response.status === 429 || response.status >= 500);
31139
31139
  }
31140
- if (!isRecord$22(payload) || !("data" in payload)) throw new DesktopRelayControlPlaneError("CONTROL_PLANE_INVALID_RESPONSE", "CMMD returned an invalid Forge relay response.", false);
31140
+ if (!isRecord$23(payload) || !("data" in payload)) throw new DesktopRelayControlPlaneError("CONTROL_PLANE_INVALID_RESPONSE", "CMMD returned an invalid Forge relay response.", false);
31141
31141
  return payload.data;
31142
31142
  }
31143
31143
  function resolveRegisteredDevice(input) {
@@ -50632,7 +50632,7 @@ function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
50632
50632
  const min = forceColor || 0;
50633
50633
  if (env.TERM === "dumb") return min;
50634
50634
  if (process$1.platform === "win32") {
50635
- const osRelease = $U.release().split(".");
50635
+ const osRelease = os.release().split(".");
50636
50636
  if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
50637
50637
  return 1;
50638
50638
  }
@@ -53075,7 +53075,7 @@ var require_ProcessDetector = /* @__PURE__ */ __commonJSMin(((exports) => {
53075
53075
  exports.processDetector = void 0;
53076
53076
  const api_1 = (init_esm$1(), __toCommonJS(esm_exports$1));
53077
53077
  const semconv_1 = require_semconv$1();
53078
- const os$3 = __require("os");
53078
+ const os$4 = __require("os");
53079
53079
  /**
53080
53080
  * ProcessDetector will be used to detect the resources related current process running
53081
53081
  * and being instrumented from the NodeJS Process module.
@@ -53097,7 +53097,7 @@ var require_ProcessDetector = /* @__PURE__ */ __commonJSMin(((exports) => {
53097
53097
  };
53098
53098
  if (process.argv.length > 1) attributes[semconv_1.ATTR_PROCESS_COMMAND] = process.argv[1];
53099
53099
  try {
53100
- const userInfo = os$3.userInfo();
53100
+ const userInfo = os$4.userInfo();
53101
53101
  attributes[semconv_1.ATTR_PROCESS_OWNER] = userInfo.username;
53102
53102
  } catch (e) {
53103
53103
  api_1.diag.debug(`error obtaining process owner: ${e}`);
@@ -66020,7 +66020,7 @@ function normalizeNumberish(value) {
66020
66020
  }
66021
66021
  //#endregion
66022
66022
  //#region package.json
66023
- var version$1 = "0.13.92";
66023
+ var version$1 = "0.13.94";
66024
66024
  //#endregion
66025
66025
  //#region src/sentry.ts
66026
66026
  const SERVER_APP_NAME = "forge-server";
@@ -66636,17 +66636,17 @@ function readCmmdAvatarUrl(raw) {
66636
66636
  }
66637
66637
  //#endregion
66638
66638
  //#region src/cmmdIdentity.ts
66639
- function readTrimmedString$2(value) {
66639
+ function readTrimmedString$3(value) {
66640
66640
  return typeof value === "string" ? value.trim() || null : null;
66641
66641
  }
66642
66642
  function asRecord$14(value) {
66643
66643
  return value && typeof value === "object" ? value : null;
66644
66644
  }
66645
66645
  function readDirectPlanLabelFromRecord(obj) {
66646
- return readTrimmedString$2(obj["planLabel"]) ?? readTrimmedString$2(obj["plan_label"]) ?? readTrimmedString$2(obj["planName"]) ?? readTrimmedString$2(obj["plan_name"]) ?? readTrimmedString$2(obj["subscriptionPlan"]) ?? readTrimmedString$2(obj["subscription_plan"]) ?? readTrimmedString$2(obj["billingPlan"]) ?? readTrimmedString$2(obj["billing_plan"]);
66646
+ return readTrimmedString$3(obj["planLabel"]) ?? readTrimmedString$3(obj["plan_label"]) ?? readTrimmedString$3(obj["planName"]) ?? readTrimmedString$3(obj["plan_name"]) ?? readTrimmedString$3(obj["subscriptionPlan"]) ?? readTrimmedString$3(obj["subscription_plan"]) ?? readTrimmedString$3(obj["billingPlan"]) ?? readTrimmedString$3(obj["billing_plan"]);
66647
66647
  }
66648
66648
  function readNestedPlanLabelFromRecord(obj) {
66649
- return readDirectPlanLabelFromRecord(obj) ?? readTrimmedString$2(obj["displayName"]) ?? readTrimmedString$2(obj["display_name"]) ?? readTrimmedString$2(obj["name"]) ?? readTrimmedString$2(obj["label"]) ?? readTrimmedString$2(obj["tier"]);
66649
+ return readDirectPlanLabelFromRecord(obj) ?? readTrimmedString$3(obj["displayName"]) ?? readTrimmedString$3(obj["display_name"]) ?? readTrimmedString$3(obj["name"]) ?? readTrimmedString$3(obj["label"]) ?? readTrimmedString$3(obj["tier"]);
66650
66650
  }
66651
66651
  function readCmmdPlanLabel(obj) {
66652
66652
  const direct = readDirectPlanLabelFromRecord(obj);
@@ -70470,11 +70470,23 @@ function createCloudflareTurnIceServerResolver(options) {
70470
70470
  //#region src/http.ts
70471
70471
  const PROJECT_FAVICON_CACHE_CONTROL = "public, max-age=3600";
70472
70472
  const PROJECT_FAVICON_MISS_CACHE_CONTROL = "public, max-age=300";
70473
+ /**
70474
+ * Origins allowed to embed Forge's SPA (CMMD /forge iframe). Docs keep their
70475
+ * own CSP with frame-ancestors 'none'. Do not put a broad * here.
70476
+ */
70477
+ const CMMD_FRAME_ANCESTORS = [
70478
+ "https://cmmd.ai",
70479
+ "https://*.cmmd.ai",
70480
+ "http://127.0.0.1:3015",
70481
+ "http://localhost:3015",
70482
+ "http://127.0.0.1:3000",
70483
+ "http://localhost:3000"
70484
+ ];
70473
70485
  const BROWSER_DOCUMENT_SECURITY_HEADERS = {
70474
70486
  "permissions-policy": "camera=(), microphone=(), geolocation=()",
70475
70487
  "referrer-policy": "no-referrer",
70476
70488
  "x-content-type-options": "nosniff",
70477
- "x-frame-options": "DENY"
70489
+ "content-security-policy": `frame-ancestors ${CMMD_FRAME_ANCESTORS.join(" ")}`
70478
70490
  };
70479
70491
  const STATIC_IMMUTABLE_CACHE_CONTROL = "public, max-age=31536000, immutable";
70480
70492
  const STATIC_REVALIDATE_CACHE_CONTROL = "no-cache";
@@ -70496,19 +70508,31 @@ function normalizeConfiguredCorsOrigin(value) {
70496
70508
  const CONFIGURED_CORS_ORIGINS = [normalizeConfiguredCorsOrigin(process.env.VITE_DEV_SERVER_URL), normalizeConfiguredCorsOrigin(process.env.FORGE_EXTRA_CORS_ORIGIN)].filter((origin) => origin !== void 0);
70497
70509
  const ALLOWED_CORS_ORIGINS = new Set([
70498
70510
  "http://localhost:3000",
70511
+ "http://localhost:3015",
70499
70512
  "http://localhost:5733",
70500
70513
  "http://localhost:13773",
70501
70514
  "http://localhost:5173",
70502
70515
  "http://127.0.0.1:3000",
70516
+ "http://127.0.0.1:3015",
70503
70517
  "http://127.0.0.1:5733",
70504
70518
  "http://127.0.0.1:13773",
70505
70519
  "http://127.0.0.1:5173",
70520
+ "https://cmmd.ai",
70506
70521
  "https://forge-cloud.cmmd.ai",
70507
70522
  "forge://app",
70508
70523
  ...CONFIGURED_CORS_ORIGINS
70509
70524
  ]);
70525
+ function isCmmdAiCorsOrigin(origin) {
70526
+ try {
70527
+ const url = new URL(origin);
70528
+ if (url.protocol !== "https:") return false;
70529
+ return url.hostname === "cmmd.ai" || url.hostname.endsWith(".cmmd.ai");
70530
+ } catch {
70531
+ return false;
70532
+ }
70533
+ }
70510
70534
  function isAllowedCorsOrigin(origin) {
70511
- return ALLOWED_CORS_ORIGINS.has(origin);
70535
+ return ALLOWED_CORS_ORIGINS.has(origin) || isCmmdAiCorsOrigin(origin);
70512
70536
  }
70513
70537
  const browserApiCorsLayer = middleware(cors({
70514
70538
  allowedOrigins: isAllowedCorsOrigin,
@@ -71606,7 +71630,7 @@ const EMPTY_PARSED_ERROR = {
71606
71630
  function asRecord$13(value) {
71607
71631
  return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
71608
71632
  }
71609
- function readTrimmedString$1(value) {
71633
+ function readTrimmedString$2(value) {
71610
71634
  return (typeof value === "string" ? value.trim() : "") || null;
71611
71635
  }
71612
71636
  function readErrorEnvelope(record) {
@@ -71615,7 +71639,7 @@ function readErrorEnvelope(record) {
71615
71639
  function readUpstreamErrorCode(body) {
71616
71640
  const record = asRecord$13(body);
71617
71641
  if (record === null) return null;
71618
- return readTrimmedString$1(record["code"]) ?? readTrimmedString$1(readErrorEnvelope(record)?.["code"]);
71642
+ return readTrimmedString$2(record["code"]) ?? readTrimmedString$2(readErrorEnvelope(record)?.["code"]);
71619
71643
  }
71620
71644
  function readErrorMessage$2(raw) {
71621
71645
  const record = asRecord$13(raw);
@@ -72856,12 +72880,12 @@ function resolveDesktopRelayControlPlaneTarget(path, configuredRuntimeId) {
72856
72880
  code: "RELAY_OPERATION_DENIED"
72857
72881
  };
72858
72882
  }
72859
- function isRecord$21(value) {
72883
+ function isRecord$22(value) {
72860
72884
  return typeof value === "object" && value !== null && !Array.isArray(value);
72861
72885
  }
72862
72886
  function relayControlPlaneBodyMatchesRuntime(path, body, configuredRuntimeId) {
72863
72887
  if (path !== "/api/forge/context/devices/register") return true;
72864
- if (!isRecord$21(body) || !isRecord$21(body.runtime)) return false;
72888
+ if (!isRecord$22(body) || !isRecord$22(body.runtime)) return false;
72865
72889
  return body.runtime.runtimeId === configuredRuntimeId;
72866
72890
  }
72867
72891
  /** Matches the client id `connect login` used, so CMMD accepts the refresh. */
@@ -72876,7 +72900,7 @@ function forbiddenResponse() {
72876
72900
  return errorResponse(403, "RELAY_BRIDGE_FORBIDDEN", "Desktop relay bridge access denied.");
72877
72901
  }
72878
72902
  function relayProxyErrorResponse(error) {
72879
- if (error instanceof CmmdProxyRequestError && isRecord$21(error.body)) {
72903
+ if (error instanceof CmmdProxyRequestError && isRecord$22(error.body)) {
72880
72904
  const code = typeof error.body.code === "string" ? error.body.code : error.code;
72881
72905
  const message = typeof error.body.error === "string" ? error.body.error : error.detail;
72882
72906
  return errorResponse(error.status >= 500 ? 502 : error.status, code, message ?? "CMMD relay coordination failed.");
@@ -76066,7 +76090,7 @@ var require_node_gyp_build = /* @__PURE__ */ __commonJSMin(((exports, module) =>
76066
76090
  var fs$6 = __require("fs");
76067
76091
  var path$5 = __require("path");
76068
76092
  var url$1 = __require("url");
76069
- var os$2 = __require("os");
76093
+ var os$3 = __require("os");
76070
76094
  var runtimeRequire = typeof __webpack_require__ === "function" ? __non_webpack_require__ : __require;
76071
76095
  var vars = process.config && process.config.variables || {};
76072
76096
  var prebuildsOnly = !!process.env.PREBUILDS_ONLY;
@@ -76074,8 +76098,8 @@ var require_node_gyp_build = /* @__PURE__ */ __commonJSMin(((exports, module) =>
76074
76098
  var abi = versions.modules;
76075
76099
  if (versions.deno || process.isBun) abi = "unsupported";
76076
76100
  var runtime = isElectron() ? "electron" : isNwjs() ? "node-webkit" : "node";
76077
- var arch = process.env.npm_config_arch || os$2.arch();
76078
- var platform = process.env.npm_config_platform || os$2.platform();
76101
+ var arch = process.env.npm_config_arch || os$3.arch();
76102
+ var platform = process.env.npm_config_platform || os$3.platform();
76079
76103
  var libc = process.env.LIBC || (isMusl(platform) ? "musl" : "glibc");
76080
76104
  var armv = process.env.ARM_VERSION || (arch === "arm64" ? "8" : vars.arm_version) || "";
76081
76105
  var uv = (versions.uv || "").split(".")[0];
@@ -93919,7 +93943,7 @@ const launchDetached = (launch) => gen(function* () {
93919
93943
  });
93920
93944
  const OpenLive = effect(Open, gen(function* () {
93921
93945
  const open = yield* tryPromise({
93922
- try: () => import("./open-2-reBrpv.mjs"),
93946
+ try: () => import("./open-yHTUkd2Y.mjs"),
93923
93947
  catch: (cause) => new OpenError$1({
93924
93948
  message: "failed to load browser opener",
93925
93949
  cause
@@ -95499,7 +95523,7 @@ const REPLICA_THREAD_STATUSES = [
95499
95523
  ];
95500
95524
  //#endregion
95501
95525
  //#region src/runtimeReplication/replicaDecodeModel.ts
95502
- function isRecord$20(value) {
95526
+ function isRecord$21(value) {
95503
95527
  return typeof value === "object" && value !== null && !Array.isArray(value);
95504
95528
  }
95505
95529
  function isNonBlankString(value) {
@@ -95519,7 +95543,7 @@ function nullableInteger(value) {
95519
95543
  return value === null || typeof value === "number" && Number.isSafeInteger(value);
95520
95544
  }
95521
95545
  function unwrapEnvelope(payload, expectedDomain) {
95522
- if (!isRecord$20(payload) || !isRecord$20(payload.meta) || !isRecord$20(payload.data)) return null;
95546
+ if (!isRecord$21(payload) || !isRecord$21(payload.meta) || !isRecord$21(payload.data)) return null;
95523
95547
  const { domain, timestamp, version } = payload.meta;
95524
95548
  if (!isNonBlankString(domain) || expectedDomain !== void 0 && domain !== expectedDomain || version !== "1.0" || !isIsoDateTime(timestamp)) return null;
95525
95549
  return payload.data;
@@ -95532,12 +95556,12 @@ function hasValidRuntimeIdentity(value) {
95532
95556
  ].includes(String(value.runtimeKind)) && typeof value.displayName === "string" && typeof value.status === "string";
95533
95557
  }
95534
95558
  function decodeRuntime$1(value) {
95535
- if (!isRecord$20(value) || !hasValidRuntimeIdentity(value)) return null;
95536
- if (!nullableString(value.endpointUrl) || value.endpointUrl !== null && !URL.canParse(value.endpointUrl) || !nullableInteger(value.deviceId) || !nullableString(value.workspaceRoot) || !nullableString(value.githubRepoFullName) || !(value.lastSeenAt === null || isIsoDateTime(value.lastSeenAt)) || !(value.metadata === void 0 || value.metadata === null || isRecord$20(value.metadata))) return null;
95559
+ if (!isRecord$21(value) || !hasValidRuntimeIdentity(value)) return null;
95560
+ if (!nullableString(value.endpointUrl) || value.endpointUrl !== null && !URL.canParse(value.endpointUrl) || !nullableInteger(value.deviceId) || !nullableString(value.workspaceRoot) || !nullableString(value.githubRepoFullName) || !(value.lastSeenAt === null || isIsoDateTime(value.lastSeenAt)) || !(value.metadata === void 0 || value.metadata === null || isRecord$21(value.metadata))) return null;
95537
95561
  return value;
95538
95562
  }
95539
95563
  function decodeProject(value) {
95540
- if (!isRecord$20(value) || !isNonBlankString(value.projectId) || typeof value.title !== "string" || !nullableString(value.githubRepoFullName) || !nullableString(value.branch)) return null;
95564
+ if (!isRecord$21(value) || !isNonBlankString(value.projectId) || typeof value.title !== "string" || !nullableString(value.githubRepoFullName) || !nullableString(value.branch)) return null;
95541
95565
  return {
95542
95566
  projectId: value.projectId,
95543
95567
  title: value.title,
@@ -95546,11 +95570,11 @@ function decodeProject(value) {
95546
95570
  };
95547
95571
  }
95548
95572
  function decodeThread$1(value) {
95549
- if (!isRecord$20(value) || !isNonBlankString(value.threadId) || typeof value.title !== "string" || !isReplicaThreadStatus(value.status) || !nullableString(value.model) || !nullableString(value.branch) || !(value.lastActivityAt === null || isIsoDateTime(value.lastActivityAt)) || !(value.metadata === void 0 || value.metadata === null || isRecord$20(value.metadata))) return null;
95573
+ if (!isRecord$21(value) || !isNonBlankString(value.threadId) || typeof value.title !== "string" || !isReplicaThreadStatus(value.status) || !nullableString(value.model) || !nullableString(value.branch) || !(value.lastActivityAt === null || isIsoDateTime(value.lastActivityAt)) || !(value.metadata === void 0 || value.metadata === null || isRecord$21(value.metadata))) return null;
95550
95574
  return value;
95551
95575
  }
95552
95576
  function decodeSummary(value) {
95553
- if (!isRecord$20(value) || !nullableString(value.conversationId)) return null;
95577
+ if (!isRecord$21(value) || !nullableString(value.conversationId)) return null;
95554
95578
  const project = decodeProject(value.project);
95555
95579
  const thread = decodeThread$1(value.thread);
95556
95580
  return project === null || thread === null ? null : {
@@ -95661,7 +95685,7 @@ function isNonNegativeInt(value) {
95661
95685
  /** `usage` is null for an Unreported turn, otherwise exactly the five buckets. */
95662
95686
  function isValidTurnUsageTokens(value) {
95663
95687
  if (value === null) return true;
95664
- if (!isRecord$20(value)) return false;
95688
+ if (!isRecord$21(value)) return false;
95665
95689
  return turnUsageTokenKeys.every((key) => isNonNegativeInt(value[key])) && Object.keys(value).every((key) => turnUsageTokenKeys.includes(key));
95666
95690
  }
95667
95691
  /** The row itself: no text, no status, and the turn it belongs to. */
@@ -95670,7 +95694,7 @@ function hasValidTurnUsageEnvelope(value) {
95670
95694
  }
95671
95695
  /** What the row records: who ran it, what it spent, and what it says of itself. */
95672
95696
  function hasValidTurnUsageRecord(payload) {
95673
- return isRecord$20(payload) && isNonBlankString(payload.provider) && isNonBlankString(payload.model) && "usage" in payload && isValidTurnUsageTokens(payload.usage) && hasValidTurnUsageAttribution(payload);
95697
+ return isRecord$21(payload) && isNonBlankString(payload.provider) && isNonBlankString(payload.model) && "usage" in payload && isValidTurnUsageTokens(payload.usage) && hasValidTurnUsageAttribution(payload);
95674
95698
  }
95675
95699
  /** A turn_usage row: no text, no status, and its record in `payload`. */
95676
95700
  function hasValidTurnUsagePayload(value) {
@@ -95707,7 +95731,7 @@ function hasValidEventPayload(value) {
95707
95731
  return isNonBlankString(value.text) && value.status === null;
95708
95732
  }
95709
95733
  function decodeEvent$1(value) {
95710
- if (!isRecord$20(value) || !hasValidEventFields(value) || !hasValidEventPayload(value)) return null;
95734
+ if (!isRecord$21(value) || !hasValidEventFields(value) || !hasValidEventPayload(value)) return null;
95711
95735
  return value;
95712
95736
  }
95713
95737
  function decodeEvents(data) {
@@ -95728,11 +95752,11 @@ function decodeReplicaThreadDetail(payload) {
95728
95752
  const thread = decodeThread$1(data.thread);
95729
95753
  const reachability = decodeReachability(data.reachability);
95730
95754
  const events = decodeEvents(data);
95731
- if (runtime === null || project === null || thread === null || reachability === null || events === null || !isRecord$20(data.execution) || typeof data.execution.available !== "boolean" || ![
95755
+ if (runtime === null || project === null || thread === null || reachability === null || events === null || !isRecord$21(data.execution) || typeof data.execution.available !== "boolean" || ![
95732
95756
  null,
95733
95757
  "runtime_offline",
95734
95758
  "runtime_unavailable"
95735
- ].includes(data.execution.reason) || (data.execution.available ? data.execution.reason !== null : data.execution.reason === null) || !isRecord$20(data.replication) || data.replication.protocolVersion !== 2 || !isNonBlankString(data.replication.generationId) || !Number.isSafeInteger(data.replication.acknowledgedSequence) || Number(data.replication.acknowledgedSequence) < 0 || !isNonBlankString(data.replication.headHash)) return null;
95759
+ ].includes(data.execution.reason) || (data.execution.available ? data.execution.reason !== null : data.execution.reason === null) || !isRecord$21(data.replication) || data.replication.protocolVersion !== 2 || !isNonBlankString(data.replication.generationId) || !Number.isSafeInteger(data.replication.acknowledgedSequence) || Number(data.replication.acknowledgedSequence) < 0 || !isNonBlankString(data.replication.headHash)) return null;
95736
95760
  return {
95737
95761
  conversationId: data.conversationId,
95738
95762
  runtime,
@@ -96807,7 +96831,7 @@ function resolveRuntimeReplicationRuntimeId(config) {
96807
96831
  }
96808
96832
  //#endregion
96809
96833
  //#region src/usage/providerTokenBuckets.ts
96810
- function isRecord$19(value) {
96834
+ function isRecord$20(value) {
96811
96835
  return typeof value === "object" && value !== null && !Array.isArray(value);
96812
96836
  }
96813
96837
  function count(record, ...keys) {
@@ -96828,7 +96852,7 @@ function reportedOrNull(tokens) {
96828
96852
  * the app server sends camelCase.
96829
96853
  */
96830
96854
  function codexTokenBuckets(value) {
96831
- if (!isRecord$19(value)) return null;
96855
+ if (!isRecord$20(value)) return null;
96832
96856
  const inputTokens = count(value, "input_tokens", "inputTokens");
96833
96857
  const cachedInputTokens = count(value, "cached_input_tokens", "cachedInputTokens");
96834
96858
  const cacheCreationTokens = count(value, "cache_write_input_tokens", "cacheWriteInputTokens");
@@ -96847,7 +96871,7 @@ function codexTokenBuckets(value) {
96847
96871
  * tokens into output and does not break them out, so reasoning stays zero.
96848
96872
  */
96849
96873
  function claudeTokenBuckets(value) {
96850
- if (!isRecord$19(value)) return null;
96874
+ if (!isRecord$20(value)) return null;
96851
96875
  return reportedOrNull({
96852
96876
  uncachedInputTokens: count(value, "input_tokens", "inputTokens"),
96853
96877
  cachedInputTokens: count(value, "cache_read_input_tokens", "cacheReadInputTokens"),
@@ -98018,7 +98042,7 @@ const replicaTurnStatuses = new Set([
98018
98042
  "cancelled",
98019
98043
  "interrupted"
98020
98044
  ]);
98021
- function isRecord$18(value) {
98045
+ function isRecord$19(value) {
98022
98046
  return typeof value === "object" && value !== null && !Array.isArray(value);
98023
98047
  }
98024
98048
  function replicaSourceSequence(value) {
@@ -98031,7 +98055,7 @@ function replicaSourceTurn(sourceTurnId) {
98031
98055
  return typeof sourceTurnId === "string" && sourceTurnId.length > 0 ? { turnId: sourceTurnId } : {};
98032
98056
  }
98033
98057
  function replicaActivitySource(activity) {
98034
- if (!activity.kind.startsWith("replica.") || !isRecord$18(activity.payload)) return null;
98058
+ if (!activity.kind.startsWith("replica.") || !isRecord$19(activity.payload)) return null;
98035
98059
  const sourceSequence = replicaSourceSequence(activity.sequence);
98036
98060
  const eventId = replicaSourceEventId(activity.payload.sourceEventId);
98037
98061
  if (sourceSequence === null || eventId === null) return null;
@@ -98044,7 +98068,7 @@ function replicaActivitySource(activity) {
98044
98068
  }
98045
98069
  function replicaSummaryEvent(activity, source) {
98046
98070
  if (activity.kind !== "replica.activity_summary" && activity.kind !== "replica.error_summary") return null;
98047
- const sourceText = isRecord$18(activity.payload) ? activity.payload.text : null;
98071
+ const sourceText = isRecord$19(activity.payload) ? activity.payload.text : null;
98048
98072
  return {
98049
98073
  sourceSequence: source.sourceSequence,
98050
98074
  event: {
@@ -98057,7 +98081,7 @@ function replicaSummaryEvent(activity, source) {
98057
98081
  };
98058
98082
  }
98059
98083
  function replicaTurnEvent(activity, source) {
98060
- const status = isRecord$18(activity.payload) ? activity.payload.status : null;
98084
+ const status = isRecord$19(activity.payload) ? activity.payload.status : null;
98061
98085
  if (activity.kind !== "replica.turn_status" || !replicaTurnStatuses.has(status)) return null;
98062
98086
  return {
98063
98087
  sourceSequence: source.sourceSequence,
@@ -98071,7 +98095,7 @@ function replicaTurnEvent(activity, source) {
98071
98095
  };
98072
98096
  }
98073
98097
  function replicaToolCallEvent(activity, source) {
98074
- if (activity.kind !== "replica.tool_call" || !isRecord$18(activity.payload)) return null;
98098
+ if (activity.kind !== "replica.tool_call" || !isRecord$19(activity.payload)) return null;
98075
98099
  const sourceText = activity.payload.text;
98076
98100
  const status = activity.payload.status;
98077
98101
  if (typeof sourceText !== "string" || typeof status !== "string") return null;
@@ -98089,9 +98113,9 @@ function replicaToolCallEvent(activity, source) {
98089
98113
  };
98090
98114
  }
98091
98115
  function replicaTurnUsageEvent(activity, source) {
98092
- if (activity.kind !== "replica.turn_usage" || !isRecord$18(activity.payload)) return null;
98116
+ if (activity.kind !== "replica.turn_usage" || !isRecord$19(activity.payload)) return null;
98093
98117
  const usage = activity.payload.payload;
98094
- if (!("turnId" in source.turn) || !isRecord$18(usage)) return null;
98118
+ if (!("turnId" in source.turn) || !isRecord$19(usage)) return null;
98095
98119
  const provider = usage.provider;
98096
98120
  const model = usage.model;
98097
98121
  if (typeof provider !== "string" || typeof model !== "string" || !("usage" in usage)) return null;
@@ -99014,9 +99038,9 @@ function isUsageSessionLookupRuntimeNotFound(error) {
99014
99038
  async function isRuntimeNotFoundResponse(response) {
99015
99039
  if (response.status !== 404) return false;
99016
99040
  const body = await response.json().catch(() => null);
99017
- return isRecord$17(body) && body["code"] === "RUNTIME_NOT_FOUND";
99041
+ return isRecord$18(body) && body["code"] === "RUNTIME_NOT_FOUND";
99018
99042
  }
99019
- function isRecord$17(value) {
99043
+ function isRecord$18(value) {
99020
99044
  return typeof value === "object" && value !== null;
99021
99045
  }
99022
99046
  /**
@@ -99028,11 +99052,11 @@ function isRecord$17(value) {
99028
99052
  * no count on the page saying so.
99029
99053
  */
99030
99054
  function decodeHeldSessions(body) {
99031
- const held = isRecord$17(body) && isRecord$17(body["data"]) ? body["data"]["held"] : void 0;
99055
+ const held = isRecord$18(body) && isRecord$18(body["data"]) ? body["data"]["held"] : void 0;
99032
99056
  if (!Array.isArray(held)) throw new Error("The usage session lookup returned an invalid body.");
99033
99057
  return held.map((row) => {
99034
- const providerSessionId = isRecord$17(row) ? row["providerSessionId"] : void 0;
99035
- const runtimeId = isRecord$17(row) ? row["runtimeId"] : void 0;
99058
+ const providerSessionId = isRecord$18(row) ? row["providerSessionId"] : void 0;
99059
+ const runtimeId = isRecord$18(row) ? row["runtimeId"] : void 0;
99036
99060
  if (typeof providerSessionId !== "string" || typeof runtimeId !== "string") throw new Error("The usage session lookup returned an invalid held row.");
99037
99061
  return {
99038
99062
  providerSessionId,
@@ -101842,7 +101866,7 @@ function emptyConfig(source, path) {
101842
101866
  issues: []
101843
101867
  };
101844
101868
  }
101845
- function isRecord$16(value) {
101869
+ function isRecord$17(value) {
101846
101870
  return typeof value === "object" && value !== null && !Array.isArray(value);
101847
101871
  }
101848
101872
  function stringArray(value) {
@@ -101870,7 +101894,7 @@ function terminalsFromValue(value) {
101870
101894
  name: `Terminal ${index + 1}`,
101871
101895
  command: terminal.trim()
101872
101896
  }];
101873
- if (!isRecord$16(terminal)) return [];
101897
+ if (!isRecord$17(terminal)) return [];
101874
101898
  const command = typeof terminal.command === "string" ? terminal.command.trim() : "";
101875
101899
  if (!command) return [];
101876
101900
  return [{
@@ -101909,7 +101933,7 @@ function readConfigFile(source, path) {
101909
101933
  }]
101910
101934
  };
101911
101935
  }
101912
- if (!isRecord$16(parsed)) return {
101936
+ if (!isRecord$17(parsed)) return {
101913
101937
  ...emptyConfig(source, path),
101914
101938
  issues: [{
101915
101939
  severity: "blocked",
@@ -103123,7 +103147,7 @@ const CLAUDE_IDENTITY_KEYS = new Set([
103123
103147
  "credentialGenerationId"
103124
103148
  ]);
103125
103149
  const CLAUDE_IDENTITY_OPTIONAL_KEYS = new Set(["providerAccountIdentity"]);
103126
- function isRecord$15(value) {
103150
+ function isRecord$16(value) {
103127
103151
  return typeof value === "object" && value !== null && !Array.isArray(value);
103128
103152
  }
103129
103153
  function isStrictRfc3339DateTime(value) {
@@ -103152,7 +103176,7 @@ function hasAllowedKeys(value, required, optional) {
103152
103176
  return keys.every((key) => required.has(key) || optional.has(key)) && [...required].every((key) => keys.includes(key));
103153
103177
  }
103154
103178
  function parseDeliveryIdentity(value, provider) {
103155
- if (!isRecord$15(value)) return null;
103179
+ if (!isRecord$16(value)) return null;
103156
103180
  if (provider === "openai") return parseCodexDeliveryIdentity(value);
103157
103181
  if (provider === "anthropic") return parseClaudeDeliveryIdentity(value);
103158
103182
  return null;
@@ -103187,7 +103211,7 @@ function parseClaudeDeliveryIdentity(value) {
103187
103211
  };
103188
103212
  }
103189
103213
  function parseProviderRuntimeDeliveryReceipt(value, expected) {
103190
- if (!isRecord$15(value) || !hasExactKeys$2(value, RECEIPT_KEYS)) return null;
103214
+ if (!isRecord$16(value) || !hasExactKeys$2(value, RECEIPT_KEYS)) return null;
103191
103215
  const identity = parseDeliveryIdentity(value.identity, expected.provider);
103192
103216
  if (!identity || typeof value.receiptId !== "string" || value.receiptId.length === 0 || value.receiptId.length > 256 || value.runtimeId !== expected.runtimeId || value.machineId !== expected.machineId || value.credentialEpoch !== expected.credentialEpoch || !Number.isInteger(value.credentialEpoch) || value.credentialEpoch < 0 || !isStrictRfc3339DateTime(value.issuedAt) || value.expiresAt !== expected.expiresAt || value.expiresAt !== null && !isStrictRfc3339DateTime(value.expiresAt)) return null;
103193
103217
  return {
@@ -103209,8 +103233,8 @@ function providerDeliveryBindingFromReceipt(receipt) {
103209
103233
  };
103210
103234
  }
103211
103235
  function readProviderDeliveryBinding(value) {
103212
- if (!isRecord$15(value) || !hasExactKeys$2(value, BINDING_KEYS)) return null;
103213
- const identityProvider = isRecord$15(value.identity) ? value.identity.provider : void 0;
103236
+ if (!isRecord$16(value) || !hasExactKeys$2(value, BINDING_KEYS)) return null;
103237
+ const identityProvider = isRecord$16(value.identity) ? value.identity.provider : void 0;
103214
103238
  const tokenProvider = identityProvider === "codex" ? "openai" : identityProvider === "claude" ? "anthropic" : null;
103215
103239
  if (!tokenProvider) return null;
103216
103240
  const identity = parseDeliveryIdentity(value.identity, tokenProvider);
@@ -150594,12 +150618,12 @@ function decodeProviderKind(providerName, operation) {
150594
150618
  detail: `Unknown persisted provider '${providerName}'.`
150595
150619
  }));
150596
150620
  }
150597
- function isRecord$14(value) {
150621
+ function isRecord$15(value) {
150598
150622
  return value !== null && typeof value === "object" && !Array.isArray(value);
150599
150623
  }
150600
150624
  function mergeRuntimePayload(existing, next) {
150601
150625
  if (next === void 0) return existing ?? null;
150602
- if (isRecord$14(existing) && isRecord$14(next)) return {
150626
+ if (isRecord$15(existing) && isRecord$15(next)) return {
150603
150627
  ...existing,
150604
150628
  ...next
150605
150629
  };
@@ -152616,7 +152640,7 @@ const PAGINATION_KEYS = new Set([
152616
152640
  "total",
152617
152641
  "hasMore"
152618
152642
  ]);
152619
- function isRecord$13(value) {
152643
+ function isRecord$14(value) {
152620
152644
  return typeof value === "object" && value !== null && !Array.isArray(value);
152621
152645
  }
152622
152646
  function hasOnlyKeys(value, allowed) {
@@ -152629,17 +152653,17 @@ function isRfc3339(value) {
152629
152653
  return typeof value === "string" && RFC3339.test(value) && Number.isFinite(Date.parse(value));
152630
152654
  }
152631
152655
  function isEnvelopeMeta(value) {
152632
- if (!isRecord$13(value) || !hasExactKeys$1(value, META_KEYS)) return false;
152656
+ if (!isRecord$14(value) || !hasExactKeys$1(value, META_KEYS)) return false;
152633
152657
  return typeof value.domain === "string" && value.domain.length > 0 && isRfc3339(value.timestamp) && typeof value.version === "string" && value.version.length > 0;
152634
152658
  }
152635
152659
  function isPagination(value) {
152636
- if (!isRecord$13(value) || !hasExactKeys$1(value, PAGINATION_KEYS)) return false;
152660
+ if (!isRecord$14(value) || !hasExactKeys$1(value, PAGINATION_KEYS)) return false;
152637
152661
  return Number.isInteger(value.page) && value.page >= 0 && Number.isInteger(value.limit) && value.limit >= 0 && Number.isInteger(value.total) && value.total >= 0 && typeof value.hasMore === "boolean";
152638
152662
  }
152639
152663
  function readLocalProviderAccountId(authJson) {
152640
152664
  try {
152641
152665
  const value = JSON.parse(authJson);
152642
- if (!isRecord$13(value) || value.auth_mode !== "chatgpt" || !isRecord$13(value.tokens)) return null;
152666
+ if (!isRecord$14(value) || value.auth_mode !== "chatgpt" || !isRecord$14(value.tokens)) return null;
152643
152667
  const providerAccountId = value.tokens.account_id;
152644
152668
  if (typeof providerAccountId !== "string") return null;
152645
152669
  const normalized = providerAccountId.trim();
@@ -152652,13 +152676,13 @@ function resolveLocalAuthJsonPath(homePath) {
152652
152676
  return join(homePath?.trim() || process.env.CODEX_HOME?.trim() || join(homedir(), ".codex"), "auth.json");
152653
152677
  }
152654
152678
  function parseCodexAccountIdentityEnvelope(value) {
152655
- if (!isRecord$13(value) || !hasOnlyKeys(value, ENVELOPE_KEYS)) return null;
152679
+ if (!isRecord$14(value) || !hasOnlyKeys(value, ENVELOPE_KEYS)) return null;
152656
152680
  if (!("data" in value) || !("meta" in value) || !isEnvelopeMeta(value.meta)) return null;
152657
152681
  if (value.pagination !== void 0 && !isPagination(value.pagination)) return null;
152658
152682
  return readCodexAccountIdentity(value.data);
152659
152683
  }
152660
152684
  function readCodexAccountIdentity(value) {
152661
- if (!isRecord$13(value) || !hasExactKeys$1(value, IDENTITY_KEYS)) return null;
152685
+ if (!isRecord$14(value) || !hasExactKeys$1(value, IDENTITY_KEYS)) return null;
152662
152686
  if (value.kind !== "provider_account" || value.provider !== "codex" || typeof value.providerAccountIdentity !== "string" || !PROVIDER_ACCOUNT_IDENTITY$1.test(value.providerAccountIdentity)) return null;
152663
152687
  return {
152664
152688
  kind: "provider_account",
@@ -191877,7 +191901,7 @@ var Vce = {
191877
191901
  function Ve() {
191878
191902
  return Vce;
191879
191903
  }
191880
- var Us = $U.homedir(), lk = $U.tmpdir(), { env: Vc } = process$1, Yce = (e) => {
191904
+ var Us = os.homedir(), lk = os.tmpdir(), { env: Vc } = process$1, Yce = (e) => {
191881
191905
  let t = path.join(Us, "Library");
191882
191906
  return {
191883
191907
  data: path.join(t, "Application Support", e),
@@ -202077,12 +202101,12 @@ function qZ(e, t) {
202077
202101
  }
202078
202102
  return n;
202079
202103
  }
202080
- var os$1 = "https://code.claude.com/docs/en", kKe = [
202104
+ var os$2 = "https://code.claude.com/docs/en", kKe = [
202081
202105
  {
202082
202106
  matches: (e) => e.path === "permissions.defaultMode" && e.code === "invalid_value",
202083
202107
  tip: {
202084
202108
  suggestion: "Valid modes: \"acceptEdits\" (ask before file changes), \"plan\" (analysis only), \"bypassPermissions\" (auto-accept all), or \"default\" (standard behavior)",
202085
- docLink: `${os$1}/iam#permission-modes`
202109
+ docLink: `${os$2}/iam#permission-modes`
202086
202110
  }
202087
202111
  },
202088
202112
  {
@@ -202097,7 +202121,7 @@ var os$1 = "https://code.claude.com/docs/en", kKe = [
202097
202121
  matches: (e) => e.path.startsWith("env.") && e.code === "invalid_type",
202098
202122
  tip: {
202099
202123
  suggestion: "Environment variables must be strings. Wrap numbers and booleans in quotes. Example: \"DEBUG\": \"true\", \"PORT\": \"3000\"",
202100
- docLink: `${os$1}/settings#environment-variables`
202124
+ docLink: `${os$2}/settings#environment-variables`
202101
202125
  }
202102
202126
  },
202103
202127
  {
@@ -202108,14 +202132,14 @@ var os$1 = "https://code.claude.com/docs/en", kKe = [
202108
202132
  matches: (e) => e.path.startsWith("hooks.") && e.code === "invalid_key",
202109
202133
  tip: {
202110
202134
  suggestion: "Not a recognized hook event. Common events: PreToolUse, PostToolUse, UserPromptSubmit, SessionStart, SessionEnd, Stop. Check spelling and capitalization.",
202111
- docLink: `${os$1}/hooks`
202135
+ docLink: `${os$2}/hooks`
202112
202136
  }
202113
202137
  },
202114
202138
  {
202115
202139
  matches: (e) => /\.hooks\.\d+\.command$/.test(e.path) && e.code === "invalid_type" && e.received === "undefined",
202116
202140
  tip: {
202117
202141
  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\"}.",
202118
- docLink: `${os$1}/hooks#exec-form-and-shell-form`
202142
+ docLink: `${os$2}/hooks#exec-form-and-shell-form`
202119
202143
  }
202120
202144
  },
202121
202145
  {
@@ -202130,7 +202154,7 @@ var os$1 = "https://code.claude.com/docs/en", kKe = [
202130
202154
  matches: (e) => e.code === "unrecognized_keys",
202131
202155
  tip: {
202132
202156
  suggestion: "Check for typos or refer to the documentation for valid fields",
202133
- docLink: `${os$1}/settings`
202157
+ docLink: `${os$2}/settings`
202134
202158
  }
202135
202159
  },
202136
202160
  {
@@ -202145,13 +202169,13 @@ var os$1 = "https://code.claude.com/docs/en", kKe = [
202145
202169
  matches: (e) => e.path === "permissions.additionalDirectories" && e.code === "invalid_type",
202146
202170
  tip: {
202147
202171
  suggestion: "Must be an array of directory paths. Example: [\"~/projects\", \"/tmp/workspace\"]. You can also use --add-dir flag or /add-dir command",
202148
- docLink: `${os$1}/iam#working-directories`
202172
+ docLink: `${os$2}/iam#working-directories`
202149
202173
  }
202150
202174
  }
202151
202175
  ], AKe = {
202152
- permissions: `${os$1}/iam#configuring-permissions`,
202153
- env: `${os$1}/settings#environment-variables`,
202154
- hooks: `${os$1}/hooks`
202176
+ permissions: `${os$2}/iam#configuring-permissions`,
202177
+ env: `${os$2}/settings#environment-variables`,
202178
+ hooks: `${os$2}/hooks`
202155
202179
  };
202156
202180
  function GZ(e) {
202157
202181
  let t = kKe.find((r) => r.matches(e));
@@ -212273,7 +212297,7 @@ const MAX_WORKER_PLAN_ITEMS = 5;
212273
212297
  function asRecord$10(value) {
212274
212298
  return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
212275
212299
  }
212276
- function readTrimmedString(value) {
212300
+ function readTrimmedString$1(value) {
212277
212301
  return typeof value === "string" ? value.trim() : void 0;
212278
212302
  }
212279
212303
  function isValidWorkerSlug(value) {
@@ -212287,9 +212311,9 @@ function isValidWorkerSummary(value) {
212287
212311
  }
212288
212312
  function decodeWorkerPlanItem(value) {
212289
212313
  const item = asRecord$10(value);
212290
- const slug = readTrimmedString(item?.slug);
212291
- const title = readTrimmedString(item?.title);
212292
- const summary = readTrimmedString(item?.summary);
212314
+ const slug = readTrimmedString$1(item?.slug);
212315
+ const title = readTrimmedString$1(item?.title);
212316
+ const summary = readTrimmedString$1(item?.summary);
212293
212317
  if (!isValidWorkerSlug(slug)) return void 0;
212294
212318
  if (!isValidWorkerTitle(title)) return void 0;
212295
212319
  if (!isValidWorkerSummary(summary)) return void 0;
@@ -214548,8 +214572,8 @@ function cliSelectsOsStore(input) {
214548
214572
  if (input.env[CLAUDE_FORCE_OS_CREDENTIAL_STORE_ENV] === "1") return true;
214549
214573
  const config = readConfig(input);
214550
214574
  if (config === null) return false;
214551
- const features = isRecord$12(config.parsed) ? config.parsed[CACHED_FEATURES_KEY] : void 0;
214552
- const flag = isRecord$12(features) ? features[OS_STORE_FLAG_KEY] : void 0;
214575
+ const features = isRecord$13(config.parsed) ? config.parsed[CACHED_FEATURES_KEY] : void 0;
214576
+ const flag = isRecord$13(features) ? features[OS_STORE_FLAG_KEY] : void 0;
214553
214577
  return typeof flag === "boolean" ? flag : null;
214554
214578
  }
214555
214579
  /**
@@ -214577,7 +214601,7 @@ function hasSessionBus(input) {
214577
214601
  const runtimeDirectory = input.env.XDG_RUNTIME_DIR?.trim();
214578
214602
  return runtimeDirectory ? input.fileExists(join(runtimeDirectory, "bus")) : false;
214579
214603
  }
214580
- function isRecord$12(value) {
214604
+ function isRecord$13(value) {
214581
214605
  return typeof value === "object" && value !== null && !Array.isArray(value);
214582
214606
  }
214583
214607
  //#endregion
@@ -215501,7 +215525,7 @@ function createCodewebAgentTokenMintClient(input) {
215501
215525
  }
215502
215526
  function parseMintResponse(httpStatus, body) {
215503
215527
  if (httpStatus === 404) return { status: "unknown_identity" };
215504
- if (!isRecord$11(body)) return { status: "unavailable" };
215528
+ if (!isRecord$12(body)) return { status: "unavailable" };
215505
215529
  if (body["status"] === "minted" && typeof body["token"] === "string") return {
215506
215530
  status: "minted",
215507
215531
  token: body["token"]
@@ -215513,7 +215537,7 @@ function parseMintResponse(httpStatus, body) {
215513
215537
  };
215514
215538
  return { status: "unavailable" };
215515
215539
  }
215516
- function isRecord$11(value) {
215540
+ function isRecord$12(value) {
215517
215541
  return typeof value === "object" && value !== null;
215518
215542
  }
215519
215543
  //#endregion
@@ -222584,7 +222608,7 @@ function deriveToolActivityPresentation(input) {
222584
222608
  }
222585
222609
  //#endregion
222586
222610
  //#region src/provider/acp/AcpRuntimeModel.ts
222587
- function isRecord$10(value) {
222611
+ function isRecord$11(value) {
222588
222612
  return typeof value === "object" && value !== null && !Array.isArray(value);
222589
222613
  }
222590
222614
  function extractModelConfigId(sessionResponse) {
@@ -222656,7 +222680,7 @@ function extractCommandFromTitle(title) {
222656
222680
  return /`([^`]+)`/.exec(title)?.[1]?.trim() || void 0;
222657
222681
  }
222658
222682
  function extractToolCallCommand(rawInput, title) {
222659
- if (isRecord$10(rawInput)) {
222683
+ if (isRecord$11(rawInput)) {
222660
222684
  const directCommand = normalizeCommandValue(rawInput.command);
222661
222685
  if (directCommand) return directCommand;
222662
222686
  const executable = typeof rawInput.executable === "string" ? rawInput.executable.trim() : "";
@@ -224513,11 +224537,11 @@ function settlePendingApprovalsAsCancelled(pendingApprovals) {
224513
224537
  function settlePendingUserInputsAsEmptyAnswers(pendingUserInputs) {
224514
224538
  return forEach(Array.from(pendingUserInputs.values()), (pending) => succeed$3(pending.answers, {}).pipe(ignore), { discard: true });
224515
224539
  }
224516
- function isRecord$9(value) {
224540
+ function isRecord$10(value) {
224517
224541
  return typeof value === "object" && value !== null && !Array.isArray(value);
224518
224542
  }
224519
224543
  function parseCursorResume(raw) {
224520
- if (!isRecord$9(raw)) return void 0;
224544
+ if (!isRecord$10(raw)) return void 0;
224521
224545
  if (raw.schemaVersion !== CURSOR_RESUME_VERSION) return void 0;
224522
224546
  if (typeof raw.sessionId !== "string" || !raw.sessionId.trim()) return void 0;
224523
224547
  return { sessionId: raw.sessionId.trim() };
@@ -234057,7 +234081,7 @@ function readinessData(value) {
234057
234081
  return decodeClaudeRuntimeReadiness(value.data);
234058
234082
  }
234059
234083
  function decodeClaudeRuntimeReadiness(value) {
234060
- if (!isRecord$8(value) || !hasValidClaudeRuntimeReadinessFields(value)) throw new ClaudeRuntimeReadinessError(CLAUDE_READINESS_COPY.unavailable);
234084
+ if (!isRecord$9(value) || !hasValidClaudeRuntimeReadinessFields(value)) throw new ClaudeRuntimeReadinessError(CLAUDE_READINESS_COPY.unavailable);
234061
234085
  return value;
234062
234086
  }
234063
234087
  function hasValidClaudeRuntimeReadinessFields(value) {
@@ -234066,7 +234090,7 @@ function hasValidClaudeRuntimeReadinessFields(value) {
234066
234090
  function isNullableString$1(value) {
234067
234091
  return value === null || typeof value === "string";
234068
234092
  }
234069
- function isRecord$8(value) {
234093
+ function isRecord$9(value) {
234070
234094
  return typeof value === "object" && value !== null && !Array.isArray(value);
234071
234095
  }
234072
234096
  function isRuntimeTicketSession(sessionId) {
@@ -242093,6 +242117,12 @@ function isAgentBrowserBoundedControlCommand(command) {
242093
242117
  default: return false;
242094
242118
  }
242095
242119
  }
242120
+ /**
242121
+ * Applies a control command to the snapshot taken before it was sent, used
242122
+ * when the control channel timed out and no ack arrived. Only viewport
242123
+ * changes are knowable locally; every other command leaves the snapshot as
242124
+ * it was.
242125
+ */
242096
242126
  function snapshotAfterTimedOutControl(snapshot, command) {
242097
242127
  switch (command.type) {
242098
242128
  case "setViewport": return {
@@ -270684,7 +270714,7 @@ var import_multicast_dns = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMi
270684
270714
  var dgram = __require("dgram");
270685
270715
  var thunky = require_thunky();
270686
270716
  var events = __require("events");
270687
- var os = __require("os");
270717
+ var os$1 = __require("os");
270688
270718
  var noop = function() {};
270689
270719
  module.exports = function(opts) {
270690
270720
  if (!opts) opts = {};
@@ -270815,14 +270845,14 @@ var import_multicast_dns = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMi
270815
270845
  return that;
270816
270846
  };
270817
270847
  function defaultInterface() {
270818
- var networks = os.networkInterfaces();
270848
+ var networks = os$1.networkInterfaces();
270819
270849
  var names = Object.keys(networks);
270820
270850
  for (var i = 0; i < names.length; i++) {
270821
270851
  var net = networks[names[i]];
270822
270852
  for (var j = 0; j < net.length; j++) {
270823
270853
  var iface = net[j];
270824
270854
  if (isIPv4(iface.family) && !iface.internal) {
270825
- if (os.platform() === "darwin" && names[i] === "en0") return iface.address;
270855
+ if (os$1.platform() === "darwin" && names[i] === "en0") return iface.address;
270826
270856
  return "0.0.0.0";
270827
270857
  }
270828
270858
  }
@@ -270830,7 +270860,7 @@ var import_multicast_dns = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMi
270830
270860
  return "127.0.0.1";
270831
270861
  }
270832
270862
  function allInterfaces() {
270833
- var networks = os.networkInterfaces();
270863
+ var networks = os$1.networkInterfaces();
270834
270864
  var names = Object.keys(networks);
270835
270865
  var res = [];
270836
270866
  for (var i = 0; i < names.length; i++) {
@@ -288488,7 +288518,7 @@ function renderPipelineWorkerTaskPacket(input) {
288488
288518
  "Recommended loop: forge-fix"
288489
288519
  ].join("\n\n");
288490
288520
  }
288491
- function isRecord$7(value) {
288521
+ function isRecord$8(value) {
288492
288522
  return value !== null && typeof value === "object" && !Array.isArray(value);
288493
288523
  }
288494
288524
  function nonEmptyStrings(value) {
@@ -288602,7 +288632,7 @@ function decodeStatefulGoldenPath(value, index, errors) {
288602
288632
  };
288603
288633
  }
288604
288634
  function decodeGoldenPath(value, index, errors) {
288605
- if (!isRecord$7(value)) {
288635
+ if (!isRecord$8(value)) {
288606
288636
  errors.push(`workers[${index}].goldenPath must be an object`);
288607
288637
  return null;
288608
288638
  }
@@ -288612,7 +288642,7 @@ function decodeGoldenPath(value, index, errors) {
288612
288642
  return null;
288613
288643
  }
288614
288644
  function decodeWorker(value, index, errors) {
288615
- if (!isRecord$7(value)) {
288645
+ if (!isRecord$8(value)) {
288616
288646
  errors.push(`workers[${index}] must be an object`);
288617
288647
  return null;
288618
288648
  }
@@ -288672,7 +288702,7 @@ function decodeLegacyFileScopes(value, index, errors) {
288672
288702
  return scopes.map(normalizeScope);
288673
288703
  }
288674
288704
  function decodeLegacyWorker(value, index, errors) {
288675
- if (!isRecord$7(value)) {
288705
+ if (!isRecord$8(value)) {
288676
288706
  errors.push(`workers[${index}] must be an object`);
288677
288707
  return null;
288678
288708
  }
@@ -288734,7 +288764,7 @@ function validateMode(mode, riskLevel, workers, errors) {
288734
288764
  }
288735
288765
  function decodePipelineWorkerPlan(value) {
288736
288766
  const errors = [];
288737
- if (!isRecord$7(value)) return {
288767
+ if (!isRecord$8(value)) return {
288738
288768
  ok: false,
288739
288769
  errors: ["worker plan must be an object"]
288740
288770
  };
@@ -289606,7 +289636,7 @@ var ApprovedWorkerPlanInvariantError = class extends Error {
289606
289636
  this.name = "ApprovedWorkerPlanInvariantError";
289607
289637
  }
289608
289638
  };
289609
- function isRecord$6(value) {
289639
+ function isRecord$7(value) {
289610
289640
  return typeof value === "object" && value !== null;
289611
289641
  }
289612
289642
  function exactPositiveInteger(value) {
@@ -289621,7 +289651,7 @@ function assertApprovedWorkerIdentity(worker, expected) {
289621
289651
  if (worker.id !== expected.workerThreadId || worker.kind !== "worker" || worker.parentThreadId !== expected.masterThreadId || worker.projectId !== expected.projectId || worker.anchorKind !== "task" || worker.anchorCmmdId !== expected.taskId || worker.branch !== expected.branch || worker.worktreePath !== expected.worktreePath) throw new ApprovedWorkerPlanInvariantError(`Existing worker '${expected.workerThreadId}' does not match the approved plan identity.`);
289622
289652
  }
289623
289653
  function activityMatchesPrompt(thread, kind, promptId) {
289624
- return thread.activities.some((activity) => activity.kind === kind && isRecord$6(activity.payload) && activity.payload["promptId"] === promptId);
289654
+ return thread.activities.some((activity) => activity.kind === kind && isRecord$7(activity.payload) && activity.payload["promptId"] === promptId);
289625
289655
  }
289626
289656
  function workerIdentity(prompt, slug) {
289627
289657
  const token = createHash("sha256").update(`${prompt.masterThreadId}\n${prompt.promptId}\n${slug}`).digest("hex").slice(0, 24);
@@ -299205,7 +299235,7 @@ function resolveBuildCommitFromEnv(env) {
299205
299235
  * environment descriptor down instead of reporting an honest "unknown".
299206
299236
  */
299207
299237
  function readBakedBuildCommit() {
299208
- return "00cc2d653acc035bf8de4ed64006a9af5c4d6362";
299238
+ return "bb958274b2ec30ab04e69fa421419a546b6490de";
299209
299239
  }
299210
299240
  async function resolveServerBuildCommit(input) {
299211
299241
  if (isFullCommitSha(input.baked)) return input.baked;
@@ -299426,6 +299456,219 @@ const ServerEnvironmentLive = effect(ServerEnvironment, fn$1("makeServerEnvironm
299426
299456
  };
299427
299457
  })());
299428
299458
  //#endregion
299459
+ //#region src/auth/http/cmmdEmbedExchange.ts
299460
+ function oauthSubjectForUserId(userId) {
299461
+ return `user:${userId}`;
299462
+ }
299463
+ const EmbedExchangeInput = Struct({ code: String$1 });
299464
+ function isRecord$6(value) {
299465
+ return typeof value === "object" && value !== null;
299466
+ }
299467
+ function readTrimmedString(value) {
299468
+ if (typeof value !== "string") return void 0;
299469
+ const trimmed = value.trim();
299470
+ return trimmed.length > 0 ? trimmed : void 0;
299471
+ }
299472
+ function readFiniteNumber(value) {
299473
+ return typeof value === "number" && Number.isFinite(value) ? value : null;
299474
+ }
299475
+ function identityFromRedeemed(redeemed) {
299476
+ return normalizeCmmdUserIdentity(redeemed.user) ?? {
299477
+ id: String(redeemed.userId),
299478
+ firstName: null,
299479
+ lastName: null,
299480
+ email: `user-${redeemed.userId}@embed.local`,
299481
+ username: redeemed.displayName?.trim() || `user-${redeemed.userId}`
299482
+ };
299483
+ }
299484
+ function optionalRedeemedFields(body) {
299485
+ const refreshToken = readTrimmedString(body.refreshToken);
299486
+ const displayName = typeof body.displayName === "string" ? body.displayName : void 0;
299487
+ const forgeOwnerAssertion = readTrimmedString(body.forgeOwnerAssertion);
299488
+ const sessionGrant = readTrimmedString(body.sessionGrant);
299489
+ const sessionGrantExpiresAt = typeof body.sessionGrantExpiresAt === "string" ? body.sessionGrantExpiresAt : void 0;
299490
+ return {
299491
+ ...refreshToken !== void 0 ? { refreshToken } : {},
299492
+ ...displayName !== void 0 ? { displayName } : {},
299493
+ ...forgeOwnerAssertion !== void 0 ? { forgeOwnerAssertion } : {},
299494
+ ...sessionGrant !== void 0 ? { sessionGrant } : {},
299495
+ ...sessionGrantExpiresAt !== void 0 ? { sessionGrantExpiresAt } : {}
299496
+ };
299497
+ }
299498
+ function readRedeemedEmbedHandoff(body) {
299499
+ if (!isRecord$6(body)) return null;
299500
+ const accessToken = readTrimmedString(body.accessToken);
299501
+ const mcpToken = readTrimmedString(body.mcpToken);
299502
+ const organizationId = readFiniteNumber(body.organizationId);
299503
+ const userId = readFiniteNumber(body.userId);
299504
+ if (accessToken === void 0 || mcpToken === void 0 || accessToken.length < 24 || mcpToken.length < 24 || organizationId === null || userId === null) return null;
299505
+ return {
299506
+ accessToken,
299507
+ mcpToken,
299508
+ organizationId,
299509
+ userId,
299510
+ user: body.user,
299511
+ ...optionalRedeemedFields(body)
299512
+ };
299513
+ }
299514
+ function redeemEmbedCodeWithCmmd(code) {
299515
+ return tryPromise({
299516
+ try: () => fetch(resolveCommandAppEndpoint("/api/forge/embed/handoff/redeem"), {
299517
+ method: "POST",
299518
+ headers: { "content-type": "application/json" },
299519
+ body: JSON.stringify({ code })
299520
+ }),
299521
+ catch: (cause) => new AuthError({
299522
+ message: "Failed to redeem the CMMD embed handoff with CMMD.",
299523
+ status: 500,
299524
+ cause
299525
+ })
299526
+ }).pipe(flatMap((response) => tryPromise({
299527
+ try: async () => {
299528
+ const text = await response.text();
299529
+ let json = null;
299530
+ if (text.length > 0) try {
299531
+ json = JSON.parse(text);
299532
+ } catch {
299533
+ json = null;
299534
+ }
299535
+ return {
299536
+ ok: response.ok,
299537
+ status: response.status,
299538
+ json
299539
+ };
299540
+ },
299541
+ catch: (cause) => new AuthError({
299542
+ message: "Failed to read the CMMD embed handoff response.",
299543
+ status: 500,
299544
+ cause
299545
+ })
299546
+ })), flatMap(({ ok, status, json }) => {
299547
+ if (!ok) return fail(new AuthError({
299548
+ message: status === 400 || status === 401 || status === 404 ? "CMMD embed handoff code is invalid or expired." : "CMMD rejected the embed handoff redeem.",
299549
+ status: status === 400 || status === 401 || status === 404 ? 401 : 500
299550
+ }));
299551
+ const redeemed = readRedeemedEmbedHandoff(json);
299552
+ if (!redeemed) return fail(new AuthError({
299553
+ message: "CMMD returned an incomplete embed handoff payload.",
299554
+ status: 500
299555
+ }));
299556
+ return succeed(redeemed);
299557
+ }));
299558
+ }
299559
+ function persistLocalEmbedSession(input) {
299560
+ return gen(function* () {
299561
+ yield* setCommandAccessTokenForSession(input.sessionId, input.redeemed.mcpToken).pipe(mapError((cause) => new AuthError({
299562
+ message: "Failed to persist CMMD access token.",
299563
+ status: 500,
299564
+ cause
299565
+ })));
299566
+ yield* setCommandJwtForSession(input.sessionId, input.redeemed.accessToken, input.redeemed.refreshToken ? { refreshToken: input.redeemed.refreshToken } : {}).pipe(mapError((cause) => new AuthError({
299567
+ message: "Failed to persist CMMD JWT.",
299568
+ status: 500,
299569
+ cause
299570
+ })));
299571
+ const identity = identityFromRedeemed(input.redeemed);
299572
+ yield* setCmmdUserIdentityForSession(input.sessionId, identity).pipe(mapError((cause) => new AuthError({
299573
+ message: "Failed to persist CMMD identity.",
299574
+ status: 500,
299575
+ cause
299576
+ })));
299577
+ return identity;
299578
+ });
299579
+ }
299580
+ const authCmmdEmbedExchangeRouteLayer = add$1("POST", "/api/auth/cmmd-embed/exchange", gen(function* () {
299581
+ const request = yield* HttpServerRequest;
299582
+ const limited = rateLimitOrRespond({
299583
+ routeClass: "auth-bootstrap",
299584
+ clientKey: clientKeyFromRequest(request)
299585
+ });
299586
+ if (limited) return limited;
299587
+ const code = (yield* schemaBodyJson(EmbedExchangeInput).pipe(mapError((cause) => new AuthError({
299588
+ message: "Invalid CMMD embed handoff payload.",
299589
+ status: 400,
299590
+ cause
299591
+ })))).code.trim();
299592
+ if (code.length < 16) return yield* new AuthError({
299593
+ message: "Invalid CMMD embed handoff code.",
299594
+ status: 401
299595
+ });
299596
+ const redeemed = yield* redeemEmbedCodeWithCmmd(code);
299597
+ const serverAuth = yield* ServerAuth;
299598
+ const sessions = yield* SessionCredentialService;
299599
+ if (serverAuth.isForgeCloudShell?.() === true) {
299600
+ const assertionToken = redeemed.forgeOwnerAssertion?.trim();
299601
+ const sessionGrant = redeemed.sessionGrant?.trim();
299602
+ if (!assertionToken || !sessionGrant) return yield* new AuthError({
299603
+ message: "CMMD embed handoff did not include Forge Cloud owner credentials.",
299604
+ status: 500
299605
+ });
299606
+ const assertion = yield* validateCloudOwnerCallbackAssertion({
299607
+ serverAuth,
299608
+ assertionToken,
299609
+ authenticatedUserId: redeemed.userId
299610
+ });
299611
+ if (!assertion) return yield* new AuthError({
299612
+ message: "CMMD embed handoff owner assertion was rejected.",
299613
+ status: 401
299614
+ });
299615
+ const identity = identityFromRedeemed(redeemed);
299616
+ yield* persistCloudOwnerArtifacts({
299617
+ assertion,
299618
+ accessToken: redeemed.mcpToken,
299619
+ identity,
299620
+ jwtToken: redeemed.accessToken,
299621
+ refreshToken: redeemed.refreshToken,
299622
+ sessionGrant,
299623
+ sessionGrantExpiresAt: redeemed.sessionGrantExpiresAt
299624
+ });
299625
+ let response = yield* jsonUnsafe({
299626
+ authenticated: true,
299627
+ organizationId: redeemed.organizationId,
299628
+ cloudShell: true
299629
+ }, { status: 200 }).pipe(setCookie(FORGE_CLOUD_OWNER_ASSERTION_COOKIE, assertion.token, cloudOwnerAssertionCookieOptions(assertion)));
299630
+ const grantExpiresAt = redeemed.sessionGrantExpiresAt ? new Date(redeemed.sessionGrantExpiresAt) : new Date(Date.now() + 2160 * 60 * 60 * 1e3);
299631
+ response = yield* response.pipe(setCookie(FORGE_CLOUD_SESSION_GRANT_COOKIE, sessionGrant, cloudOwnerSessionGrantCookieOptions({
299632
+ token: sessionGrant,
299633
+ expiresAt: grantExpiresAt
299634
+ })));
299635
+ return response;
299636
+ }
299637
+ const issued = yield* sessions.issue({
299638
+ method: "browser-session-cookie",
299639
+ role: "owner",
299640
+ subject: oauthSubjectForUserId(redeemed.userId),
299641
+ client: deriveAuthClientMetadata({
299642
+ request,
299643
+ label: "CMMD embed"
299644
+ })
299645
+ }).pipe(mapError((cause) => new AuthError({
299646
+ message: "Failed to issue authenticated session.",
299647
+ cause
299648
+ })));
299649
+ const cmmdIdentity = yield* persistLocalEmbedSession({
299650
+ sessionId: issued.sessionId,
299651
+ redeemed
299652
+ });
299653
+ if (redeemed.sessionGrant) yield* setCommandSessionGrantForSession(issued.sessionId, redeemed.sessionGrant).pipe(ignore({ log: false }));
299654
+ const secure = shouldUseSecureCookie(forgePublicUrlForRequest(request));
299655
+ return yield* jsonUnsafe({
299656
+ authenticated: true,
299657
+ role: issued.role,
299658
+ sessionMethod: issued.method,
299659
+ expiresAt: toUtc(issued.expiresAt),
299660
+ cmmdIdentity,
299661
+ organizationId: redeemed.organizationId,
299662
+ cloudShell: false
299663
+ }, { status: 200 }).pipe(setCookie(sessions.cookieName, issued.token, {
299664
+ expires: toDate(issued.expiresAt),
299665
+ httpOnly: true,
299666
+ path: "/",
299667
+ sameSite: "lax",
299668
+ secure
299669
+ }));
299670
+ }).pipe(catchTag("AuthError", (error) => respondToAuthError(error))));
299671
+ //#endregion
299429
299672
  //#region src/auth/http/cloudOwnerDeviceSession.ts
299430
299673
  /**
299431
299674
  * Native OAuth clients allowed to redeem a Forge Cloud session grant through
@@ -299569,7 +299812,10 @@ const cloudOwnerSessionRevokeRouteLayer = add$1("POST", "/api/auth/cloud/session
299569
299812
  const SCALAR_API_REFERENCE_URL = "https://cdn.jsdelivr.net/npm/@scalar/api-reference@1.64.1";
299570
299813
  const SCALAR_API_REFERENCE_INTEGRITY = "sha384-SmFRDuBBmEoCbbBCTcn8/+cIQONyH0xgOKpsp6OttBlI8uG9uc6iAO8SonYQ3e1W";
299571
299814
  const API_DOCS_SECURITY_HEADERS = {
299572
- ...BROWSER_DOCUMENT_SECURITY_HEADERS,
299815
+ "permissions-policy": BROWSER_DOCUMENT_SECURITY_HEADERS["permissions-policy"],
299816
+ "referrer-policy": BROWSER_DOCUMENT_SECURITY_HEADERS["referrer-policy"],
299817
+ "x-content-type-options": BROWSER_DOCUMENT_SECURITY_HEADERS["x-content-type-options"],
299818
+ "x-frame-options": "DENY",
299573
299819
  "content-security-policy": [
299574
299820
  "default-src 'none'",
299575
299821
  "script-src 'self' https://cdn.jsdelivr.net",
@@ -322990,7 +323236,7 @@ const MiscRuntimeLayerLive = mergeAll(AnalyticsServiceLayerLive, OpenLive, Serve
322990
323236
  const RuntimeDependenciesWithoutPullRequestsLive = ReactorLayerLive.pipe(provideMerge(CheckpointingLayerLive), provideMerge(GitLayerLive), provideMerge(OrchestrationLayerLive), provideMerge(ProviderLayerLive), provideMerge(TerminalLayerLive), provideMerge(AgentBrowserManagerLive), provideMerge(mergeAll(ThreadDevRuntimeLive, DevTunnelLive.pipe(provide$1(ThreadDevRuntimeLive)))), provideMerge(PersistenceLayerLive), provideMerge(KeybindingsLive), provideMerge(ProviderRegistryLive), provideMerge(mergeAll(ServerSettingsLive, UsageServiceLive.pipe(provide$1(ServerSettingsLive), provide$1(UsageSessionLookupLive), provide$1(UsageRecordedSourceLive.pipe(provide$1(OrchestrationLayerLive), provide$1(RuntimeReplicationOutboxLive), provide$1(ProviderSessionRuntimeRepositoryLive), provide$1(TextGenerationSessionRepositoryLive)))))), provideMerge(WorkspaceLayerLive), provideMerge(WorkspaceReadinessStateLive), provideMerge(ProjectFaviconResolverLive), provideMerge(RepositoryIdentityResolverLive), provideMerge(ServerEnvironmentLive), provideMerge(AuthLayerLive), provideMerge(ServerSecretStoreLayerLive), provideMerge(mergeAll(CloudRedisCoordinationLive, CloudStateSyncLive.pipe(provide$1(PersistenceLayerLive)))), provideMerge(MiscRuntimeLayerLive));
322991
323237
  const RuntimeDependenciesLive = pullRequestServiceFactoryLayer.pipe(provideMerge(RuntimeDependenciesWithoutPullRequestsLive), provideMerge(cmmdProjectIdentityResolverLive.pipe(provide$1(RuntimeDependenciesWithoutPullRequestsLive))), provideMerge(pullRequestProviderRuntimeLive));
322992
323238
  const RuntimeServicesLive = ServerRuntimeStartupLive.pipe(provideMerge(RuntimeDependenciesLive));
322993
- const makeRoutesLayer = mergeAll(attachmentUploadRouteLayer, authBearerBootstrapRouteLayer, authBootstrapRouteLayer, authCommandBearerBootstrapRouteLayer, authCommandBootstrapRouteLayer, authOAuthTokenExchangeRouteLayer, authWebSocketTicketRouteLayer, authCmmdOAuthDeviceRouteLayer, authCmmdOAuthTokenRouteLayer, authCmmdPasswordTokenRouteLayer, authClientsRevokeOthersRouteLayer, authClientsRevokeRouteLayer, authClientsRouteLayer, authLogoutRouteLayer, authPairingLinksRevokeRouteLayer, authPairingLinksRouteLayer, authPairingCredentialRouteLayer, authSessionRenewRouteLayer, authSessionRouteLayer, authWebSocketTokenRouteLayer, authWebLoginRouteLayer, authWebCallbackRouteLayer, cloudOwnerSessionRedeemRouteLayer, cloudOwnerSessionRevokeRouteLayer, desktopLocalWebBridgePublishRouteLayer, desktopLocalWebBridgeBootstrapRouteLayer, desktopRelayControlPlaneRouteLayer, apiDocsHtmlRouteLayer, apiDocsOpenApiRouteLayer, pulseSignalStateListRouteLayer, pulseSignalStateUpsertRouteLayer, cmmdProfileRouteLayer, ...cmmdProxyRouteLayers, cmmdWorkIntakeRouteLayer, cmmdWsTokenRouteLayer, cmmdGetProjectCommentsRouteLayer, cmmdAddProjectCommentRouteLayer, cmmdUpdateProjectRouteLayer, cmmdUploadTaskAttachmentRouteLayer, cmmdUpdateTaskCommentRouteLayer, cmmdListWorkspaceMembersRouteLayer, cmmdAddProjectMemberRouteLayer, cmmdUpdateProjectAgentMemberAvatarRouteLayer, runtimeReplicationStatusRouteLayer, cmmdRefreshProviderUsageRouteLayer, cmmdForgeCloudProjectsListRouteLayer, cmmdForgeCloudProjectsEventsRouteLayer, cmmdForgeEnvironmentsEventsRouteLayer, cmmdForgeRuntimesEnsureRouteLayer, cmmdForgeRuntimesConnectRouteLayer, ownerRuntimeCodexReadinessRouteLayer, cmmdForgeRuntimesStatusRouteLayer, cmmdForgeRuntimesStartRouteLayer, cmmdForgeRuntimesStopRouteLayer, cmmdForgeRuntimesRecycleRouteLayer, cmmdForgeRuntimesUpdateCommitRouteLayer, cmmdForgeRuntimesDestroyRouteLayer, mobileProviderCatalogRouteLayer, attachmentsRouteLayer, orchestrationDispatchRouteLayer, orchestrationCmmdWorkRunEventRouteLayer, orchestrationAutomationStartThreadRouteLayer, orchestrationAutomationRebindRouteLayer, orchestrationAutomationTerminalReconcileRouteLayer, mobileGitRunStackedActionRouteLayer, pullRequestDiffRouteLayer, orchestrationSnapshotRouteLayer, orchestrationThreadSnapshotRouteLayer, localAutomationListRouteLayer, localAutomationCreateRouteLayer, localAutomationUpdateRouteLayer, localAutomationDeleteRouteLayer, localAutomationRunRouteLayer, otlpTracesProxyRouteLayer, devTunnelProxyRouteLayer, devTunnelLocalPortProxyRouteLayer, projectFaviconRouteLayer, serverEnvironmentRouteLayer, browserWebRtcReadinessRouteLayer, staticAndDevRouteLayer, githubStatusRouteLayer, githubAuthorizeUrlRouteLayer, githubDisconnectRouteLayer, githubReposRouteLayer, githubCloneRouteLayer, githubCloneJobStartRouteLayer, githubCloneJobStatusRouteLayer, githubRefreshCredentialsRouteLayer, githubToolConfirmationApproveRouteLayer, projectLinkGetRouteLayer, projectLinkListRouteLayer, projectLinkSetRouteLayer, projectLinkDeleteRouteLayer, cmmdWorkspacesRouteLayer, cmmdCampaignsRouteLayer, cmmdProjectLinksRouteLayer, cmmdEnsureGitHubProjectContextRouteLayer, cmmdProjectRepositoryEnsureRouteLayer, cmmdProjectsGetRouteLayer, cmmdProjectsCreateRouteLayer, workspaceReadinessRouteLayer, runtimeLivenessRouteLayer, runtimeFilesystemHealthRouteLayer, claudeNativeGenerationProofRouteLayer, claudeUsageRouteLayer, codexRuntimeProviderReadinessRouteLayer, runtimeDiagnosticsRouteLayer, cloudFoldersRouteLayer, cloudProjectCreateRouteLayer, gitUrlCloneRouteLayer, websocketRpcRouteLayer).pipe(provide$1(browserApiCorsLayer));
323239
+ const makeRoutesLayer = mergeAll(attachmentUploadRouteLayer, authBearerBootstrapRouteLayer, authBootstrapRouteLayer, authCommandBearerBootstrapRouteLayer, authCommandBootstrapRouteLayer, authCmmdEmbedExchangeRouteLayer, authOAuthTokenExchangeRouteLayer, authWebSocketTicketRouteLayer, authCmmdOAuthDeviceRouteLayer, authCmmdOAuthTokenRouteLayer, authCmmdPasswordTokenRouteLayer, authClientsRevokeOthersRouteLayer, authClientsRevokeRouteLayer, authClientsRouteLayer, authLogoutRouteLayer, authPairingLinksRevokeRouteLayer, authPairingLinksRouteLayer, authPairingCredentialRouteLayer, authSessionRenewRouteLayer, authSessionRouteLayer, authWebSocketTokenRouteLayer, authWebLoginRouteLayer, authWebCallbackRouteLayer, cloudOwnerSessionRedeemRouteLayer, cloudOwnerSessionRevokeRouteLayer, desktopLocalWebBridgePublishRouteLayer, desktopLocalWebBridgeBootstrapRouteLayer, desktopRelayControlPlaneRouteLayer, apiDocsHtmlRouteLayer, apiDocsOpenApiRouteLayer, pulseSignalStateListRouteLayer, pulseSignalStateUpsertRouteLayer, cmmdProfileRouteLayer, ...cmmdProxyRouteLayers, cmmdWorkIntakeRouteLayer, cmmdWsTokenRouteLayer, cmmdGetProjectCommentsRouteLayer, cmmdAddProjectCommentRouteLayer, cmmdUpdateProjectRouteLayer, cmmdUploadTaskAttachmentRouteLayer, cmmdUpdateTaskCommentRouteLayer, cmmdListWorkspaceMembersRouteLayer, cmmdAddProjectMemberRouteLayer, cmmdUpdateProjectAgentMemberAvatarRouteLayer, runtimeReplicationStatusRouteLayer, cmmdRefreshProviderUsageRouteLayer, cmmdForgeCloudProjectsListRouteLayer, cmmdForgeCloudProjectsEventsRouteLayer, cmmdForgeEnvironmentsEventsRouteLayer, cmmdForgeRuntimesEnsureRouteLayer, cmmdForgeRuntimesConnectRouteLayer, ownerRuntimeCodexReadinessRouteLayer, cmmdForgeRuntimesStatusRouteLayer, cmmdForgeRuntimesStartRouteLayer, cmmdForgeRuntimesStopRouteLayer, cmmdForgeRuntimesRecycleRouteLayer, cmmdForgeRuntimesUpdateCommitRouteLayer, cmmdForgeRuntimesDestroyRouteLayer, mobileProviderCatalogRouteLayer, attachmentsRouteLayer, orchestrationDispatchRouteLayer, orchestrationCmmdWorkRunEventRouteLayer, orchestrationAutomationStartThreadRouteLayer, orchestrationAutomationRebindRouteLayer, orchestrationAutomationTerminalReconcileRouteLayer, mobileGitRunStackedActionRouteLayer, pullRequestDiffRouteLayer, orchestrationSnapshotRouteLayer, orchestrationThreadSnapshotRouteLayer, localAutomationListRouteLayer, localAutomationCreateRouteLayer, localAutomationUpdateRouteLayer, localAutomationDeleteRouteLayer, localAutomationRunRouteLayer, otlpTracesProxyRouteLayer, devTunnelProxyRouteLayer, devTunnelLocalPortProxyRouteLayer, projectFaviconRouteLayer, serverEnvironmentRouteLayer, browserWebRtcReadinessRouteLayer, staticAndDevRouteLayer, githubStatusRouteLayer, githubAuthorizeUrlRouteLayer, githubDisconnectRouteLayer, githubReposRouteLayer, githubCloneRouteLayer, githubCloneJobStartRouteLayer, githubCloneJobStatusRouteLayer, githubRefreshCredentialsRouteLayer, githubToolConfirmationApproveRouteLayer, projectLinkGetRouteLayer, projectLinkListRouteLayer, projectLinkSetRouteLayer, projectLinkDeleteRouteLayer, cmmdWorkspacesRouteLayer, cmmdCampaignsRouteLayer, cmmdProjectLinksRouteLayer, cmmdEnsureGitHubProjectContextRouteLayer, cmmdProjectRepositoryEnsureRouteLayer, cmmdProjectsGetRouteLayer, cmmdProjectsCreateRouteLayer, workspaceReadinessRouteLayer, runtimeLivenessRouteLayer, runtimeFilesystemHealthRouteLayer, claudeNativeGenerationProofRouteLayer, claudeUsageRouteLayer, codexRuntimeProviderReadinessRouteLayer, runtimeDiagnosticsRouteLayer, cloudFoldersRouteLayer, cloudProjectCreateRouteLayer, gitUrlCloneRouteLayer, websocketRpcRouteLayer).pipe(provide$1(browserApiCorsLayer));
322994
323240
  const runServer = launch$1(unwrap(gen(function* () {
322995
323241
  const config = yield* ServerConfig;
322996
323242
  fixPath({ preferProcessPath: config.forgeCmmdRuntimeMode === true });
@@ -323922,7 +324168,7 @@ const connectLoginCommand = make$34("login", {
323922
324168
  })).json();
323923
324169
  },
323924
324170
  openBrowser: async (url) => {
323925
- const open = (await import("./open-2-reBrpv.mjs")).default;
324171
+ const open = (await import("./open-yHTUkd2Y.mjs")).default;
323926
324172
  await open(url);
323927
324173
  return true;
323928
324174
  },