@cmmd-center/forge 0.9.11 → 0.9.13

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.
Files changed (27) hide show
  1. package/dist/bin.cjs +65 -19
  2. package/dist/bin.mjs +65 -19
  3. package/dist/client/assets/{CanvasPanel-CNtJjkFi.js → CanvasPanel-Dc8j2ouo.js} +2 -2
  4. package/dist/client/assets/{CompositeItem-BYLWaYF6.js → CompositeItem-Cn5DdObI.js} +2 -2
  5. package/dist/client/assets/{DiffPanel-BilYcllQ.js → DiffPanel-CRdkVPEz.js} +3 -3
  6. package/dist/client/assets/{DiffPanel.logic-Caky6F_f.js → DiffPanel.logic-BIPcNz_o.js} +2 -2
  7. package/dist/client/assets/DiffPanelShell-tIdXu7mn.js +2531 -0
  8. package/dist/client/assets/{DiffWorkerPoolProvider-CTUAka0e.js → DiffWorkerPoolProvider-DuP7DBdu.js} +9 -9
  9. package/dist/client/assets/PullRequestCodePanel-BID-ZM7w.js +5 -0
  10. package/dist/client/assets/{Virtualizer-CFg_81uW.js → Virtualizer-DeKxnAeU.js} +2 -2
  11. package/dist/client/assets/{canvasStateStore-BdDORpO9.js → canvasStateStore-Dlm4tanv.js} +2 -2
  12. package/dist/client/assets/{cmmdAuthRedirect-CrxxHqHr.js → cmmdAuthRedirect-C1FjO86g.js} +2 -2
  13. package/dist/client/assets/index-4a61qSZ4.css +1 -0
  14. package/dist/client/assets/{index-BUY6pZDx.js → index-BtUnlnWs.js} +59 -59
  15. package/dist/client/assets/src-DljvAdHI.js +3 -0
  16. package/dist/client/assets/{toggle-BUlphA25.js → toggle-It2CvaLA.js} +2 -2
  17. package/dist/client/assets/{useTriggerFocusGuards-D2jbdUMe.js → useTriggerFocusGuards-DfUh9uvu.js} +2 -2
  18. package/dist/client/index.html +11 -11
  19. package/dist/runtimeBootstrap.cjs +1 -1
  20. package/dist/runtimeBootstrap.mjs +1 -1
  21. package/dist/{runtimeControlAuthority-SNBF5Mjy.cjs → runtimeControlAuthority-45DPznyK.cjs} +6 -7
  22. package/dist/{runtimeControlAuthority-L85w5RTn.mjs → runtimeControlAuthority-akIBTI-S.mjs} +6 -7
  23. package/package.json +1 -1
  24. package/dist/client/assets/DiffPanelShell-DXP_jwHj.js +0 -2531
  25. package/dist/client/assets/PullRequestCodePanel-4bf4PYHp.js +0 -5
  26. package/dist/client/assets/index-BydoCpMZ.css +0 -1
  27. package/dist/client/assets/src-Dqe_-4FQ.js +0 -3
package/dist/bin.cjs CHANGED
@@ -12,7 +12,7 @@ const require_Cache = require("./Cache-U1fkdGvV.cjs");
12
12
  const require_SqlError = require("./SqlError-CSsHBaKF.cjs");
13
13
  const require_Mime = require("./Mime-Bilnh8zE.cjs");
14
14
  const require_esm = require("./esm-BZhXwX5p.cjs");
15
- const require_runtimeControlAuthority = require("./runtimeControlAuthority-SNBF5Mjy.cjs");
15
+ const require_runtimeControlAuthority = require("./runtimeControlAuthority-45DPznyK.cjs");
16
16
  const require_PTY = require("./PTY-CNa0j0w2.cjs");
17
17
  let node_child_process = require("node:child_process");
18
18
  node_child_process = require_chunk.__toESM(node_child_process);
@@ -65123,7 +65123,7 @@ function normalizeNumberish(value) {
65123
65123
  }
65124
65124
  //#endregion
65125
65125
  //#region package.json
65126
- var version$1 = "0.9.11";
65126
+ var version$1 = "0.9.13";
65127
65127
  //#endregion
65128
65128
  //#region src/sentry.ts
65129
65129
  const SERVER_APP_NAME = "forge-server";
@@ -85575,7 +85575,7 @@ function isBrokerScope(scope) {
85575
85575
  return brokerScopes.has(scope);
85576
85576
  }
85577
85577
  function hasSameExactIdentity(authority, claims) {
85578
- return authority.orgId === claims.orgId && authority.userId === claims.userId && authority.projectId === claims.projectId && authority.runtimeId === claims.runtimeId && authority.machineId === claims.machineId && authority.credentialEpoch === claims.credentialEpoch;
85578
+ return authority.orgId === claims.orgId && authority.userId === claims.userId && authority.runtimeId === claims.runtimeId && authority.machineId === claims.machineId && authority.credentialEpoch === claims.credentialEpoch;
85579
85579
  }
85580
85580
  function firstSessionAuthority(sessionAuthorities) {
85581
85581
  if (!sessionAuthorities) return void 0;
@@ -85609,7 +85609,6 @@ function recordRuntimeBrokerAuthority(input) {
85609
85609
  token: input.token,
85610
85610
  orgId: claims.orgId,
85611
85611
  userId: claims.userId,
85612
- projectId: claims.projectId,
85613
85612
  runtimeId: claims.runtimeId,
85614
85613
  machineId: claims.machineId,
85615
85614
  credentialEpoch: claims.credentialEpoch,
@@ -97154,6 +97153,7 @@ const runClaudeLogout = (runtime) => new Promise((resolve, reject) => {
97154
97153
  const execFileAsync$4 = (0, node_util.promisify)(node_child_process.execFile);
97155
97154
  const USAGE_ARGS = [
97156
97155
  "--safe-mode",
97156
+ "--no-session-persistence",
97157
97157
  "-p",
97158
97158
  "/usage",
97159
97159
  "--output-format",
@@ -97221,7 +97221,7 @@ function zonedDateTimeToUtc(input) {
97221
97221
  }
97222
97222
  }
97223
97223
  function parseResetAt(value, now) {
97224
- const match = /^(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{1,2}) at (\d{1,2})(?::(\d{2}))?(am|pm) \(([^)]+)\)$/.exec(value);
97224
+ const match = /^(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{1,2})(?:,| at) (\d{1,2})(?::(\d{2}))?(am|pm) \(([^)]+)\)$/.exec(value);
97225
97225
  if (!match) return null;
97226
97226
  const month = MONTH_BY_NAME[match[1]];
97227
97227
  if (month === void 0) return null;
@@ -224916,6 +224916,9 @@ function isMissingGitCwdError(error) {
224916
224916
  const normalized = `${error.detail}\n${error.message}`.toLowerCase();
224917
224917
  return normalized.includes("no such file or directory") || normalized.includes("notfound: filesystem.access") || normalized.includes("enoent") || normalized.includes("not a directory");
224918
224918
  }
224919
+ function isUnregisteredWorktreeError(error) {
224920
+ return `${error.detail}\n${error.message}`.toLowerCase().includes("is not a working tree");
224921
+ }
224919
224922
  function toGitCommandError(input, detail) {
224920
224923
  return (cause) => require_Schema$1.is(GitCommandError)(cause) ? cause : new GitCommandError({
224921
224924
  operation: input.operation,
@@ -225315,6 +225318,20 @@ const makeGitCore = require_Schema$1.fn("makeGitCore")(function* (options) {
225315
225318
  if (firstRemote) return firstRemote;
225316
225319
  return yield* createGitCommandError("GitCore.resolvePrimaryRemoteName", cwd, ["remote"], "No git remote is configured for this repository.");
225317
225320
  });
225321
+ const resolveNormalizedPrimaryRemoteUrl = require_Schema$1.fn("resolveNormalizedPrimaryRemoteUrl")(function* (cwd) {
225322
+ const remoteName = yield* resolvePrimaryRemoteName(cwd);
225323
+ const remoteUrl = yield* runGitStdout("GitCore.resolvePrimaryRemoteUrl", cwd, [
225324
+ "remote",
225325
+ "get-url",
225326
+ remoteName
225327
+ ]).pipe(require_Schema$1.map((stdout) => normalizeRemoteUrl(stdout)));
225328
+ if (remoteUrl.length > 0) return remoteUrl;
225329
+ return yield* createGitCommandError("GitCore.resolvePrimaryRemoteUrl", cwd, [
225330
+ "remote",
225331
+ "get-url",
225332
+ remoteName
225333
+ ], `Remote '${remoteName}' has no URL.`);
225334
+ });
225318
225335
  const resolvePushRemoteName = require_Schema$1.fn("resolvePushRemoteName")(function* (cwd, branch) {
225319
225336
  const branchPushRemote = yield* runGitStdout("GitCore.resolvePushRemoteName.branchPushRemote", cwd, [
225320
225337
  "config",
@@ -225986,10 +226003,33 @@ const makeGitCore = require_Schema$1.fn("makeGitCore")(function* (options) {
225986
226003
  const args = ["worktree", "remove"];
225987
226004
  if (input.force) args.push("--force");
225988
226005
  args.push(input.path);
225989
- yield* executeGit("GitCore.removeWorktree", input.cwd, args, {
226006
+ const executeRemoval = (cwd, removalArgs) => executeGit("GitCore.removeWorktree", cwd, removalArgs, {
225990
226007
  timeoutMs: 15e3,
225991
226008
  fallbackErrorMessage: "git worktree remove failed"
225992
- }).pipe(require_Schema$1.mapError((error) => createGitCommandError("GitCore.removeWorktree", input.cwd, args, `${commandLabel(args)} failed (cwd: ${input.cwd}): ${error.message}`, error)));
226009
+ }).pipe(require_Schema$1.mapError((error) => createGitCommandError("GitCore.removeWorktree", cwd, removalArgs, `${commandLabel(removalArgs)} failed (cwd: ${cwd}): ${error.message}`, error)), require_Schema$1.asVoid);
226010
+ yield* executeRemoval(input.cwd, args).pipe(require_Schema$1.catch_((originalError) => {
226011
+ if (!input.force || !isUnregisteredWorktreeError(originalError)) return require_Schema$1.fail(originalError);
226012
+ return require_Schema$1.gen(function* () {
226013
+ const targetExists = yield* require_Schema$1.option(fileSystem.exists(input.path));
226014
+ if (require_Schema$1.isNone(targetExists)) return yield* originalError;
226015
+ if (!targetExists.value) return;
226016
+ const ownerContext = yield* require_Schema$1.option(require_Schema$1.all({
226017
+ callerRemoteUrl: resolveNormalizedPrimaryRemoteUrl(input.cwd),
226018
+ targetRemoteUrl: resolveNormalizedPrimaryRemoteUrl(input.path),
226019
+ targetGitCommonDir: resolveGitCommonDir(input.path)
226020
+ }));
226021
+ if (require_Schema$1.isNone(ownerContext) || ownerContext.value.callerRemoteUrl !== ownerContext.value.targetRemoteUrl) return yield* originalError;
226022
+ const ownerArgs = [
226023
+ "--git-dir",
226024
+ ownerContext.value.targetGitCommonDir,
226025
+ "worktree",
226026
+ "remove",
226027
+ "--force",
226028
+ input.path
226029
+ ];
226030
+ yield* executeRemoval(input.cwd, ownerArgs);
226031
+ });
226032
+ }));
225993
226033
  });
225994
226034
  const pruneWorktrees = require_Schema$1.fn("pruneWorktrees")(function* (cwd) {
225995
226035
  yield* executeGit("GitCore.pruneWorktrees", cwd, [
@@ -280383,7 +280423,7 @@ function currentGrantClaimsForRefresh(input) {
280383
280423
  });
280384
280424
  }
280385
280425
  function sameRuntimeOwnership(currentClaims, refreshedClaims) {
280386
- return refreshedClaims.orgId === currentClaims.orgId && refreshedClaims.userId === currentClaims.userId && refreshedClaims.projectId === currentClaims.projectId;
280426
+ return refreshedClaims.orgId === currentClaims.orgId && refreshedClaims.userId === currentClaims.userId;
280387
280427
  }
280388
280428
  function sameScopeSet(left, right) {
280389
280429
  const leftScopes = new Set(left);
@@ -290138,11 +290178,10 @@ function readCmmdRuntimeAuthConfig(serverConfig) {
290138
290178
  serverConfig.forgeCmmdRuntimePublicKey,
290139
290179
  serverConfig.forgeCmmdRuntimeId,
290140
290180
  serverConfig.forgeCmmdRuntimeOrgId,
290141
- serverConfig.forgeCmmdRuntimeUserId,
290142
- serverConfig.forgeCmmdRuntimeProjectId
290181
+ serverConfig.forgeCmmdRuntimeUserId
290143
290182
  ].map((value) => value?.trim() ?? "");
290144
290183
  if (required.some((value) => value.length === 0)) return null;
290145
- const [publicKeyPem, runtimeId, orgId, userId, projectId] = required;
290184
+ const [publicKeyPem, runtimeId, orgId, userId] = required;
290146
290185
  const machineId = serverConfig.forgeCmmdRuntimeMachineId?.trim();
290147
290186
  const credentialEpoch = serverConfig.forgeCmmdRuntimeCredentialEpoch;
290148
290187
  const brokerIdentity = classifyRuntimeBrokerIdentity({
@@ -290156,7 +290195,6 @@ function readCmmdRuntimeAuthConfig(serverConfig) {
290156
290195
  runtimeId,
290157
290196
  orgId,
290158
290197
  userId,
290159
- projectId,
290160
290198
  ...brokerIdentity.mode === "exact" ? {
290161
290199
  machineId: brokerIdentity.machineId,
290162
290200
  credentialEpoch: brokerIdentity.credentialEpoch
@@ -298659,9 +298697,10 @@ const cmmdForgeCloudProjectRemovalReceiptRouteLayer = registerProxyRoute({
298659
298697
  });
298660
298698
  const FORGE_RUNTIMES_POLL_INTERVAL = require_Schema$1.seconds(5);
298661
298699
  const FORGE_RUNTIMES_KEEPALIVE_INTERVAL = require_Schema$1.seconds(25);
298662
- function encodeForgeCloudProjectsFrame(projects, capacity = null) {
298700
+ function encodeForgeCloudProjectsFrame(projects, environments, capacity = null) {
298663
298701
  return new TextEncoder().encode(`event: cloud-projects\ndata: ${JSON.stringify({
298664
298702
  projects,
298703
+ environments,
298665
298704
  capacity
298666
298705
  })}\n\n`);
298667
298706
  }
@@ -298705,7 +298744,10 @@ function makeFetchCloudProjectsFrameEffect(upstreamUrl, accessToken) {
298705
298744
  }
298706
298745
  const json = await res.json();
298707
298746
  const unwrapped = json && typeof json === "object" && "data" in json && json["data"] ? json["data"] : json;
298708
- return encodeForgeCloudProjectsFrame(Array.isArray(unwrapped?.["projects"]) ? unwrapped["projects"] : [], unwrapped?.["capacity"] ?? null);
298747
+ const projects = unwrapped?.["projects"];
298748
+ const environments = unwrapped?.["environments"];
298749
+ if (!Array.isArray(projects) || !Array.isArray(environments)) return null;
298750
+ return encodeForgeCloudProjectsFrame(projects, environments, unwrapped?.["capacity"] ?? null);
298709
298751
  })).pipe(require_Schema$1.catch_(() => require_Schema$1.succeed(null)));
298710
298752
  }
298711
298753
  const cmmdForgeCloudProjectsEventsRouteLayer = add$1("GET", "/api/cmmd/forge-cloud-projects/events", require_Schema$1.gen(function* () {
@@ -305298,21 +305340,27 @@ function invalidAuthority(message, cause) {
305298
305340
  ...cause === void 0 ? {} : { cause }
305299
305341
  });
305300
305342
  }
305343
+ /**
305344
+ * There is no project in a runtime's identity. A runtime serves every project
305345
+ * of one user, so a project id neither identifies it nor narrows it. Everything
305346
+ * here stays required: without a key, org, user, runtime, machine and epoch
305347
+ * there is nothing to verify a provider ticket against, and refusing is the
305348
+ * only safe answer.
305349
+ */
305301
305350
  function resolveExactRuntimeIdentity(config) {
305302
305351
  const identity = {
305303
305352
  publicKeyPem: config.forgeCmmdRuntimePublicKey?.trim(),
305304
305353
  orgId: config.forgeCmmdRuntimeOrgId?.trim(),
305305
305354
  userId: config.forgeCmmdRuntimeUserId?.trim(),
305306
- projectId: config.forgeCmmdRuntimeProjectId?.trim(),
305307
305355
  runtimeId: config.forgeCmmdRuntimeId?.trim(),
305308
305356
  machineId: config.forgeCmmdRuntimeMachineId?.trim(),
305309
305357
  credentialEpoch: config.forgeCmmdRuntimeCredentialEpoch
305310
305358
  };
305311
- if (!identity.publicKeyPem || !identity.orgId || !identity.userId || !identity.projectId || !identity.runtimeId || !identity.machineId || identity.credentialEpoch === void 0) throw invalidAuthority("The exact CMMD runtime identity is not configured.");
305359
+ if (!identity.publicKeyPem || !identity.orgId || !identity.userId || !identity.runtimeId || !identity.machineId || identity.credentialEpoch === void 0) throw invalidAuthority("The exact CMMD runtime identity is not configured.");
305312
305360
  return identity;
305313
305361
  }
305314
305362
  function assertAutomationAuthorityMatchesRuntime(authority, identity) {
305315
- if (String(authority.organizationId) !== identity.orgId || String(authority.projectId) !== identity.projectId || authority.runtimeId !== identity.runtimeId) throw invalidAuthority("The automation authority does not match this runtime.");
305363
+ if (String(authority.organizationId) !== identity.orgId || authority.runtimeId !== identity.runtimeId) throw invalidAuthority("The automation authority does not match this runtime.");
305316
305364
  }
305317
305365
  function verifyProviderAuthority(heartbeat, identity) {
305318
305366
  const descriptor = heartbeat.providerAuthority;
@@ -309516,7 +309564,6 @@ const completeClaudeReadinessExpectations = (config) => {
309516
309564
  runtimeId: config.forgeCmmdRuntimeId?.trim() ?? "",
309517
309565
  orgId: config.forgeCmmdRuntimeOrgId?.trim() ?? "",
309518
309566
  userId: config.forgeCmmdRuntimeUserId?.trim() ?? "",
309519
- projectId: config.forgeCmmdRuntimeProjectId?.trim() ?? "",
309520
309567
  machineId: config.forgeCmmdRuntimeMachineId?.trim() ?? "",
309521
309568
  credentialEpoch: config.forgeCmmdRuntimeCredentialEpoch
309522
309569
  };
@@ -309545,7 +309592,6 @@ const claudeNativeGenerationProofRouteLayer = add$1("GET", "/api/runtime/provide
309545
309592
  runtimeId: required.runtimeId,
309546
309593
  orgId: required.orgId,
309547
309594
  userId: required.userId,
309548
- projectId: required.projectId,
309549
309595
  machineId: required.machineId,
309550
309596
  credentialEpoch: required.credentialEpoch
309551
309597
  });
package/dist/bin.mjs CHANGED
@@ -11,7 +11,7 @@ import { a as make$48, i as keys, n as getOption, o as makeWith$1, r as invalida
11
11
  import { S as layer$9, _ as defaultEscape, a as DeadlockError, b as makeCompiler$1, c as SqlError, d as UnknownError, g as custom, h as make$49, i as ConstraintError, l as SqlSyntaxError, m as SqlClient, n as AuthorizationError, o as LockTimeoutError, r as ConnectionError, s as SerializationError, t as AuthenticationError, u as StatementTimeoutError, v as defaultTransforms, y as fragment } from "./SqlError-B2g5pJux.mjs";
12
12
  import { r as wrapper_default, t as Mime_default } from "./Mime-Dq9IoNiV.mjs";
13
13
  import { a as diag, c as SpanKind$1, d as TraceFlags, f as ROOT_CONTEXT, i as propagation, l as isSpanContextValid, m as DiagLogLevel, n as init_esm$1, o as context$1, p as createContextKey, r as trace, s as SpanStatusCode, t as esm_exports$1 } from "./esm-wLIF-u3N.mjs";
14
- import { a as verifyCmmdAuthRuntimeTicket, c as verifyCmmdRuntimeTicketRefreshProof, d as createReadOnceFileTokenAccessor, i as sendRuntimeControlHeartbeat, l as runtimeGrantToken, n as bootstrapRuntimeControlAuthorityFromNarrowGrant, o as verifyCmmdClaudeReadinessTicket, r as readRuntimeControlAuthority, s as verifyCmmdRuntimeTicket, t as bootstrapRuntimeControlAuthority, u as setRuntimeGrantToken } from "./runtimeControlAuthority-L85w5RTn.mjs";
14
+ import { a as verifyCmmdAuthRuntimeTicket, c as verifyCmmdRuntimeTicketRefreshProof, d as createReadOnceFileTokenAccessor, i as sendRuntimeControlHeartbeat, l as runtimeGrantToken, n as bootstrapRuntimeControlAuthorityFromNarrowGrant, o as verifyCmmdClaudeReadinessTicket, r as readRuntimeControlAuthority, s as verifyCmmdRuntimeTicket, t as bootstrapRuntimeControlAuthority, u as setRuntimeGrantToken } from "./runtimeControlAuthority-akIBTI-S.mjs";
15
15
  import { n as PtySpawnError, t as PtyAdapter } from "./PTY-Cx_YKiEO.mjs";
16
16
  import { createRequire } from "node:module";
17
17
  import * as HE from "node:child_process";
@@ -64870,7 +64870,7 @@ function normalizeNumberish(value) {
64870
64870
  }
64871
64871
  //#endregion
64872
64872
  //#region package.json
64873
- var version$1 = "0.9.11";
64873
+ var version$1 = "0.9.13";
64874
64874
  //#endregion
64875
64875
  //#region src/sentry.ts
64876
64876
  const SERVER_APP_NAME = "forge-server";
@@ -85267,7 +85267,7 @@ function isBrokerScope(scope) {
85267
85267
  return brokerScopes.has(scope);
85268
85268
  }
85269
85269
  function hasSameExactIdentity(authority, claims) {
85270
- return authority.orgId === claims.orgId && authority.userId === claims.userId && authority.projectId === claims.projectId && authority.runtimeId === claims.runtimeId && authority.machineId === claims.machineId && authority.credentialEpoch === claims.credentialEpoch;
85270
+ return authority.orgId === claims.orgId && authority.userId === claims.userId && authority.runtimeId === claims.runtimeId && authority.machineId === claims.machineId && authority.credentialEpoch === claims.credentialEpoch;
85271
85271
  }
85272
85272
  function firstSessionAuthority(sessionAuthorities) {
85273
85273
  if (!sessionAuthorities) return void 0;
@@ -85301,7 +85301,6 @@ function recordRuntimeBrokerAuthority(input) {
85301
85301
  token: input.token,
85302
85302
  orgId: claims.orgId,
85303
85303
  userId: claims.userId,
85304
- projectId: claims.projectId,
85305
85304
  runtimeId: claims.runtimeId,
85306
85305
  machineId: claims.machineId,
85307
85306
  credentialEpoch: claims.credentialEpoch,
@@ -96826,6 +96825,7 @@ const runClaudeLogout = (runtime) => new Promise((resolve, reject) => {
96826
96825
  const execFileAsync$4 = promisify$1(execFile);
96827
96826
  const USAGE_ARGS = [
96828
96827
  "--safe-mode",
96828
+ "--no-session-persistence",
96829
96829
  "-p",
96830
96830
  "/usage",
96831
96831
  "--output-format",
@@ -96893,7 +96893,7 @@ function zonedDateTimeToUtc(input) {
96893
96893
  }
96894
96894
  }
96895
96895
  function parseResetAt(value, now) {
96896
- const match = /^(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{1,2}) at (\d{1,2})(?::(\d{2}))?(am|pm) \(([^)]+)\)$/.exec(value);
96896
+ const match = /^(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{1,2})(?:,| at) (\d{1,2})(?::(\d{2}))?(am|pm) \(([^)]+)\)$/.exec(value);
96897
96897
  if (!match) return null;
96898
96898
  const month = MONTH_BY_NAME[match[1]];
96899
96899
  if (month === void 0) return null;
@@ -224525,6 +224525,9 @@ function isMissingGitCwdError(error) {
224525
224525
  const normalized = `${error.detail}\n${error.message}`.toLowerCase();
224526
224526
  return normalized.includes("no such file or directory") || normalized.includes("notfound: filesystem.access") || normalized.includes("enoent") || normalized.includes("not a directory");
224527
224527
  }
224528
+ function isUnregisteredWorktreeError(error) {
224529
+ return `${error.detail}\n${error.message}`.toLowerCase().includes("is not a working tree");
224530
+ }
224528
224531
  function toGitCommandError(input, detail) {
224529
224532
  return (cause) => is$1(GitCommandError)(cause) ? cause : new GitCommandError({
224530
224533
  operation: input.operation,
@@ -224920,6 +224923,20 @@ const GitCoreLive = effect(GitCore, fn$1("makeGitCore")(function* (options) {
224920
224923
  if (firstRemote) return firstRemote;
224921
224924
  return yield* createGitCommandError("GitCore.resolvePrimaryRemoteName", cwd, ["remote"], "No git remote is configured for this repository.");
224922
224925
  });
224926
+ const resolveNormalizedPrimaryRemoteUrl = fn$1("resolveNormalizedPrimaryRemoteUrl")(function* (cwd) {
224927
+ const remoteName = yield* resolvePrimaryRemoteName(cwd);
224928
+ const remoteUrl = yield* runGitStdout("GitCore.resolvePrimaryRemoteUrl", cwd, [
224929
+ "remote",
224930
+ "get-url",
224931
+ remoteName
224932
+ ]).pipe(map$3((stdout) => normalizeRemoteUrl(stdout)));
224933
+ if (remoteUrl.length > 0) return remoteUrl;
224934
+ return yield* createGitCommandError("GitCore.resolvePrimaryRemoteUrl", cwd, [
224935
+ "remote",
224936
+ "get-url",
224937
+ remoteName
224938
+ ], `Remote '${remoteName}' has no URL.`);
224939
+ });
224923
224940
  const resolvePushRemoteName = fn$1("resolvePushRemoteName")(function* (cwd, branch) {
224924
224941
  const branchPushRemote = yield* runGitStdout("GitCore.resolvePushRemoteName.branchPushRemote", cwd, [
224925
224942
  "config",
@@ -225591,10 +225608,33 @@ const GitCoreLive = effect(GitCore, fn$1("makeGitCore")(function* (options) {
225591
225608
  const args = ["worktree", "remove"];
225592
225609
  if (input.force) args.push("--force");
225593
225610
  args.push(input.path);
225594
- yield* executeGit("GitCore.removeWorktree", input.cwd, args, {
225611
+ const executeRemoval = (cwd, removalArgs) => executeGit("GitCore.removeWorktree", cwd, removalArgs, {
225595
225612
  timeoutMs: 15e3,
225596
225613
  fallbackErrorMessage: "git worktree remove failed"
225597
- }).pipe(mapError((error) => createGitCommandError("GitCore.removeWorktree", input.cwd, args, `${commandLabel(args)} failed (cwd: ${input.cwd}): ${error.message}`, error)));
225614
+ }).pipe(mapError((error) => createGitCommandError("GitCore.removeWorktree", cwd, removalArgs, `${commandLabel(removalArgs)} failed (cwd: ${cwd}): ${error.message}`, error)), asVoid);
225615
+ yield* executeRemoval(input.cwd, args).pipe(catch_((originalError) => {
225616
+ if (!input.force || !isUnregisteredWorktreeError(originalError)) return fail(originalError);
225617
+ return gen(function* () {
225618
+ const targetExists = yield* option(fileSystem.exists(input.path));
225619
+ if (isNone(targetExists)) return yield* originalError;
225620
+ if (!targetExists.value) return;
225621
+ const ownerContext = yield* option(all({
225622
+ callerRemoteUrl: resolveNormalizedPrimaryRemoteUrl(input.cwd),
225623
+ targetRemoteUrl: resolveNormalizedPrimaryRemoteUrl(input.path),
225624
+ targetGitCommonDir: resolveGitCommonDir(input.path)
225625
+ }));
225626
+ if (isNone(ownerContext) || ownerContext.value.callerRemoteUrl !== ownerContext.value.targetRemoteUrl) return yield* originalError;
225627
+ const ownerArgs = [
225628
+ "--git-dir",
225629
+ ownerContext.value.targetGitCommonDir,
225630
+ "worktree",
225631
+ "remove",
225632
+ "--force",
225633
+ input.path
225634
+ ];
225635
+ yield* executeRemoval(input.cwd, ownerArgs);
225636
+ });
225637
+ }));
225598
225638
  });
225599
225639
  const pruneWorktrees = fn$1("pruneWorktrees")(function* (cwd) {
225600
225640
  yield* executeGit("GitCore.pruneWorktrees", cwd, [
@@ -279940,7 +279980,7 @@ function currentGrantClaimsForRefresh(input) {
279940
279980
  });
279941
279981
  }
279942
279982
  function sameRuntimeOwnership(currentClaims, refreshedClaims) {
279943
- return refreshedClaims.orgId === currentClaims.orgId && refreshedClaims.userId === currentClaims.userId && refreshedClaims.projectId === currentClaims.projectId;
279983
+ return refreshedClaims.orgId === currentClaims.orgId && refreshedClaims.userId === currentClaims.userId;
279944
279984
  }
279945
279985
  function sameScopeSet(left, right) {
279946
279986
  const leftScopes = new Set(left);
@@ -289628,11 +289668,10 @@ function readCmmdRuntimeAuthConfig(serverConfig) {
289628
289668
  serverConfig.forgeCmmdRuntimePublicKey,
289629
289669
  serverConfig.forgeCmmdRuntimeId,
289630
289670
  serverConfig.forgeCmmdRuntimeOrgId,
289631
- serverConfig.forgeCmmdRuntimeUserId,
289632
- serverConfig.forgeCmmdRuntimeProjectId
289671
+ serverConfig.forgeCmmdRuntimeUserId
289633
289672
  ].map((value) => value?.trim() ?? "");
289634
289673
  if (required.some((value) => value.length === 0)) return null;
289635
- const [publicKeyPem, runtimeId, orgId, userId, projectId] = required;
289674
+ const [publicKeyPem, runtimeId, orgId, userId] = required;
289636
289675
  const machineId = serverConfig.forgeCmmdRuntimeMachineId?.trim();
289637
289676
  const credentialEpoch = serverConfig.forgeCmmdRuntimeCredentialEpoch;
289638
289677
  const brokerIdentity = classifyRuntimeBrokerIdentity({
@@ -289646,7 +289685,6 @@ function readCmmdRuntimeAuthConfig(serverConfig) {
289646
289685
  runtimeId,
289647
289686
  orgId,
289648
289687
  userId,
289649
- projectId,
289650
289688
  ...brokerIdentity.mode === "exact" ? {
289651
289689
  machineId: brokerIdentity.machineId,
289652
289690
  credentialEpoch: brokerIdentity.credentialEpoch
@@ -298089,9 +298127,10 @@ const cmmdForgeCloudProjectRemovalReceiptRouteLayer = registerProxyRoute({
298089
298127
  });
298090
298128
  const FORGE_RUNTIMES_POLL_INTERVAL = seconds(5);
298091
298129
  const FORGE_RUNTIMES_KEEPALIVE_INTERVAL = seconds(25);
298092
- function encodeForgeCloudProjectsFrame(projects, capacity = null) {
298130
+ function encodeForgeCloudProjectsFrame(projects, environments, capacity = null) {
298093
298131
  return new TextEncoder().encode(`event: cloud-projects\ndata: ${JSON.stringify({
298094
298132
  projects,
298133
+ environments,
298095
298134
  capacity
298096
298135
  })}\n\n`);
298097
298136
  }
@@ -298135,7 +298174,10 @@ function makeFetchCloudProjectsFrameEffect(upstreamUrl, accessToken) {
298135
298174
  }
298136
298175
  const json = await res.json();
298137
298176
  const unwrapped = json && typeof json === "object" && "data" in json && json["data"] ? json["data"] : json;
298138
- return encodeForgeCloudProjectsFrame(Array.isArray(unwrapped?.["projects"]) ? unwrapped["projects"] : [], unwrapped?.["capacity"] ?? null);
298177
+ const projects = unwrapped?.["projects"];
298178
+ const environments = unwrapped?.["environments"];
298179
+ if (!Array.isArray(projects) || !Array.isArray(environments)) return null;
298180
+ return encodeForgeCloudProjectsFrame(projects, environments, unwrapped?.["capacity"] ?? null);
298139
298181
  })).pipe(catch_(() => succeed(null)));
298140
298182
  }
298141
298183
  const cmmdForgeCloudProjectsEventsRouteLayer = add$1("GET", "/api/cmmd/forge-cloud-projects/events", gen(function* () {
@@ -304697,21 +304739,27 @@ function invalidAuthority(message, cause) {
304697
304739
  ...cause === void 0 ? {} : { cause }
304698
304740
  });
304699
304741
  }
304742
+ /**
304743
+ * There is no project in a runtime's identity. A runtime serves every project
304744
+ * of one user, so a project id neither identifies it nor narrows it. Everything
304745
+ * here stays required: without a key, org, user, runtime, machine and epoch
304746
+ * there is nothing to verify a provider ticket against, and refusing is the
304747
+ * only safe answer.
304748
+ */
304700
304749
  function resolveExactRuntimeIdentity(config) {
304701
304750
  const identity = {
304702
304751
  publicKeyPem: config.forgeCmmdRuntimePublicKey?.trim(),
304703
304752
  orgId: config.forgeCmmdRuntimeOrgId?.trim(),
304704
304753
  userId: config.forgeCmmdRuntimeUserId?.trim(),
304705
- projectId: config.forgeCmmdRuntimeProjectId?.trim(),
304706
304754
  runtimeId: config.forgeCmmdRuntimeId?.trim(),
304707
304755
  machineId: config.forgeCmmdRuntimeMachineId?.trim(),
304708
304756
  credentialEpoch: config.forgeCmmdRuntimeCredentialEpoch
304709
304757
  };
304710
- if (!identity.publicKeyPem || !identity.orgId || !identity.userId || !identity.projectId || !identity.runtimeId || !identity.machineId || identity.credentialEpoch === void 0) throw invalidAuthority("The exact CMMD runtime identity is not configured.");
304758
+ if (!identity.publicKeyPem || !identity.orgId || !identity.userId || !identity.runtimeId || !identity.machineId || identity.credentialEpoch === void 0) throw invalidAuthority("The exact CMMD runtime identity is not configured.");
304711
304759
  return identity;
304712
304760
  }
304713
304761
  function assertAutomationAuthorityMatchesRuntime(authority, identity) {
304714
- if (String(authority.organizationId) !== identity.orgId || String(authority.projectId) !== identity.projectId || authority.runtimeId !== identity.runtimeId) throw invalidAuthority("The automation authority does not match this runtime.");
304762
+ if (String(authority.organizationId) !== identity.orgId || authority.runtimeId !== identity.runtimeId) throw invalidAuthority("The automation authority does not match this runtime.");
304715
304763
  }
304716
304764
  function verifyProviderAuthority(heartbeat, identity) {
304717
304765
  const descriptor = heartbeat.providerAuthority;
@@ -308901,7 +308949,6 @@ const completeClaudeReadinessExpectations = (config) => {
308901
308949
  runtimeId: config.forgeCmmdRuntimeId?.trim() ?? "",
308902
308950
  orgId: config.forgeCmmdRuntimeOrgId?.trim() ?? "",
308903
308951
  userId: config.forgeCmmdRuntimeUserId?.trim() ?? "",
308904
- projectId: config.forgeCmmdRuntimeProjectId?.trim() ?? "",
308905
308952
  machineId: config.forgeCmmdRuntimeMachineId?.trim() ?? "",
308906
308953
  credentialEpoch: config.forgeCmmdRuntimeCredentialEpoch
308907
308954
  };
@@ -308930,7 +308977,6 @@ const claudeNativeGenerationProofRouteLayer = add$1("GET", "/api/runtime/provide
308930
308977
  runtimeId: required.runtimeId,
308931
308978
  orgId: required.orgId,
308932
308979
  userId: required.userId,
308933
- projectId: required.projectId,
308934
308980
  machineId: required.machineId,
308935
308981
  credentialEpoch: required.credentialEpoch
308936
308982
  });