@cmmd-center/forge 0.11.1 → 0.13.0

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 (29) hide show
  1. package/dist/bin.cjs +256 -84
  2. package/dist/bin.mjs +253 -83
  3. package/dist/client/assets/{CanvasPanel-Cogtmutb.js → CanvasPanel-BUdwnabz.js} +2 -2
  4. package/dist/client/assets/{CompositeItem-D6h2WFmU.js → CompositeItem-BxaZQRyb.js} +2 -2
  5. package/dist/client/assets/{DiffPanel-27f3_FPs.js → DiffPanel-BOLibNHF.js} +3 -3
  6. package/dist/client/assets/{DiffPanel.logic-BuQtD_J1.js → DiffPanel.logic-BrRjlJeM.js} +2 -2
  7. package/dist/client/assets/DiffPanelShell-CgycIPfE.js +2531 -0
  8. package/dist/client/assets/{DiffWorkerPoolProvider-K588YXmt.js → DiffWorkerPoolProvider-jWJpEXVo.js} +8 -8
  9. package/dist/client/assets/PullRequestCodePanel-BW7XdaG8.js +5 -0
  10. package/dist/client/assets/{Virtualizer-DMnisVCC.js → Virtualizer-qjNwH1hl.js} +2 -2
  11. package/dist/client/assets/{canvasStateStore-DUZyBLSv.js → canvasStateStore-DDwjZ3AG.js} +2 -2
  12. package/dist/client/assets/{cmmdAuthRedirect-Bkc6Luqb.js → cmmdAuthRedirect-CPfIOB5Y.js} +2 -2
  13. package/dist/client/assets/index-9clxg-cN.js +151 -0
  14. package/dist/client/assets/index-Dk7T0zVg.css +1 -0
  15. package/dist/client/assets/src-dZ5rHSKC.js +3 -0
  16. package/dist/client/assets/{toggle-CWmPePti.js → toggle-Bn-2EZmB.js} +2 -2
  17. package/dist/client/assets/{useTriggerFocusGuards-O7DUCec0.js → useTriggerFocusGuards-DRINKzwL.js} +2 -2
  18. package/dist/client/index.html +11 -11
  19. package/dist/forge-build.json +1 -1
  20. package/dist/runtimeBootstrap.cjs +1 -1
  21. package/dist/runtimeBootstrap.mjs +1 -1
  22. package/dist/{runtimeControlAuthority-BdIovv-r.cjs → runtimeControlAuthority-B3kNmYRT.cjs} +4 -2
  23. package/dist/{runtimeControlAuthority-COHmz_WT.mjs → runtimeControlAuthority-D_zKr_eI.mjs} +4 -2
  24. package/package.json +1 -1
  25. package/dist/client/assets/DiffPanelShell-BvD0Fk5A.js +0 -2531
  26. package/dist/client/assets/PullRequestCodePanel-B4HbAQDj.js +0 -5
  27. package/dist/client/assets/index-BMcOaHS_.css +0 -1
  28. package/dist/client/assets/index-Lfu9WfF1.js +0 -151
  29. package/dist/client/assets/src-BlF9iHm-.js +0 -3
package/dist/bin.cjs CHANGED
@@ -12,7 +12,7 @@ const require_Cache = require("./Cache-CWlxNDbC.cjs");
12
12
  const require_SqlError = require("./SqlError-Bt0Bcd5C.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-BdIovv-r.cjs");
15
+ const require_runtimeControlAuthority = require("./runtimeControlAuthority-B3kNmYRT.cjs");
16
16
  const require_PTY = require("./PTY-BxYDiW3h.cjs");
17
17
  let node_child_process = require("node:child_process");
18
18
  node_child_process = require_chunk.__toESM(node_child_process);
@@ -16544,7 +16544,7 @@ function makeNetServiceShape(createServer = node_net.createServer) {
16544
16544
  }
16545
16545
  //#endregion
16546
16546
  //#region ../../packages/shared/src/releaseInfo.generated.ts
16547
- const FORGE_RELEASE_VERSION = "0.11.0";
16547
+ const FORGE_RELEASE_VERSION = "0.13.0";
16548
16548
  //#endregion
16549
16549
  //#region ../../packages/shared/src/hostProcess.ts
16550
16550
  /**
@@ -18654,6 +18654,43 @@ const TerminalError = require_Schema$1.Union([
18654
18654
  TerminalSignalError
18655
18655
  ]);
18656
18656
  //#endregion
18657
+ //#region ../../packages/contracts/src/projectScriptCommands.ts
18658
+ const ProjectScriptIcon = require_Schema$1.Literals([
18659
+ "play",
18660
+ "test",
18661
+ "lint",
18662
+ "configure",
18663
+ "build",
18664
+ "debug"
18665
+ ]);
18666
+ const ProjectScript = require_Schema$1.Struct({
18667
+ id: TrimmedNonEmptyString,
18668
+ name: TrimmedNonEmptyString,
18669
+ command: TrimmedNonEmptyString,
18670
+ icon: ProjectScriptIcon,
18671
+ runOnWorktreeCreate: require_Schema$1.Boolean
18672
+ });
18673
+ const ProjectScriptUpdateCommand = require_Schema$1.Struct({
18674
+ type: require_Schema$1.Literal("project.script.update"),
18675
+ commandId: CommandId,
18676
+ projectId: ProjectId,
18677
+ mutation: require_Schema$1.Union([
18678
+ require_Schema$1.Struct({
18679
+ kind: require_Schema$1.Literal("add"),
18680
+ script: ProjectScript
18681
+ }),
18682
+ require_Schema$1.Struct({
18683
+ kind: require_Schema$1.Literal("update"),
18684
+ script: ProjectScript,
18685
+ expected: ProjectScript
18686
+ }),
18687
+ require_Schema$1.Struct({
18688
+ kind: require_Schema$1.Literal("remove"),
18689
+ expected: ProjectScript
18690
+ })
18691
+ ])
18692
+ });
18693
+ //#endregion
18657
18694
  //#region ../../packages/contracts/src/model.ts
18658
18695
  const CODEX_REASONING_EFFORT_OPTIONS = [
18659
18696
  "ultra",
@@ -19200,6 +19237,7 @@ const ORCHESTRATION_WS_METHODS = {
19200
19237
  streamTurnDiff: "orchestration.streamTurnDiff",
19201
19238
  streamFullThreadDiff: "orchestration.streamFullThreadDiff",
19202
19239
  replayEvents: "orchestration.replayEvents",
19240
+ getArchivedShellSnapshot: "orchestration.getArchivedShellSnapshot",
19203
19241
  subscribeShell: "orchestration.subscribeShell",
19204
19242
  subscribeThread: "orchestration.subscribeThread"
19205
19243
  };
@@ -19312,21 +19350,6 @@ const UploadChatImageAttachment = require_Schema$1.Struct({
19312
19350
  });
19313
19351
  const ChatAttachment = require_Schema$1.Union([ChatImageAttachment]);
19314
19352
  const UploadChatAttachment = require_Schema$1.Union([UploadChatImageAttachment]);
19315
- const ProjectScriptIcon = require_Schema$1.Literals([
19316
- "play",
19317
- "test",
19318
- "lint",
19319
- "configure",
19320
- "build",
19321
- "debug"
19322
- ]);
19323
- const ProjectScript = require_Schema$1.Struct({
19324
- id: TrimmedNonEmptyString,
19325
- name: TrimmedNonEmptyString,
19326
- command: TrimmedNonEmptyString,
19327
- icon: ProjectScriptIcon,
19328
- runOnWorktreeCreate: require_Schema$1.Boolean
19329
- });
19330
19353
  /**
19331
19354
  * Availability of the project's `workspaceRoot` on the server's filesystem.
19332
19355
  *
@@ -19957,6 +19980,7 @@ const ThreadSessionStopCommand = require_Schema$1.Struct({
19957
19980
  const DispatchableClientOrchestrationCommand = require_Schema$1.Union([
19958
19981
  ProjectCreateCommand,
19959
19982
  ProjectMetaUpdateCommand,
19983
+ ProjectScriptUpdateCommand,
19960
19984
  ProjectDeleteCommand,
19961
19985
  ThreadCreateCommand,
19962
19986
  ThreadDeleteCommand,
@@ -19978,6 +20002,7 @@ const DispatchableClientOrchestrationCommand = require_Schema$1.Union([
19978
20002
  const ClientOrchestrationCommand = require_Schema$1.Union([
19979
20003
  ProjectCreateCommand,
19980
20004
  ProjectMetaUpdateCommand,
20005
+ ProjectScriptUpdateCommand,
19981
20006
  ProjectDeleteCommand,
19982
20007
  ThreadCreateCommand,
19983
20008
  ThreadDeleteCommand,
@@ -20669,6 +20694,10 @@ const OrchestrationRpcSchemas = {
20669
20694
  subscribeShell: {
20670
20695
  input: require_Schema$1.Struct({}),
20671
20696
  output: OrchestrationShellStreamItem
20697
+ },
20698
+ getArchivedShellSnapshot: {
20699
+ input: require_Schema$1.Struct({}),
20700
+ output: OrchestrationShellSnapshot
20672
20701
  }
20673
20702
  };
20674
20703
  var OrchestrationGetSnapshotError = class extends require_Schema$1.TaggedErrorClass()("OrchestrationGetSnapshotError", {
@@ -26564,6 +26593,11 @@ const WsOrchestrationReplayEventsRpc = make$30(ORCHESTRATION_WS_METHODS.replayEv
26564
26593
  success: OrchestrationRpcSchemas.replayEvents.output,
26565
26594
  error: OrchestrationReplayEventsError
26566
26595
  });
26596
+ const WsOrchestrationGetArchivedShellSnapshotRpc = make$30(ORCHESTRATION_WS_METHODS.getArchivedShellSnapshot, {
26597
+ payload: OrchestrationRpcSchemas.getArchivedShellSnapshot.input,
26598
+ success: OrchestrationRpcSchemas.getArchivedShellSnapshot.output,
26599
+ error: OrchestrationGetSnapshotError
26600
+ });
26567
26601
  const WsOrchestrationSubscribeShellRpc = make$30(ORCHESTRATION_WS_METHODS.subscribeShell, {
26568
26602
  payload: OrchestrationRpcSchemas.subscribeShell.input,
26569
26603
  success: OrchestrationRpcSchemas.subscribeShell.output,
@@ -26644,7 +26678,7 @@ const WsRpcGroup = make$29(WsServerGetConfigRpc, WsServerRefreshProvidersRpc, Ws
26644
26678
  payload: UsageSummaryInput,
26645
26679
  success: UsageSummary,
26646
26680
  error: UsageReadError
26647
- }), WsPullRequestsListRpc, WsPullRequestsListStatsRpc, WsPullRequestsDetailRpc, WsPullRequestsActivityRpc, WsPullRequestsThreadCommentsRpc, WsPullRequestsDiffFileContentsRpc, WsPullRequestsRunActionRpc, WsPullRequestsUpdateRpc, WsPullRequestsCommentRpc, WsPullRequestsUpdateCommentRpc, WsPullRequestsSubmitReviewRpc, WsPullRequestsReplyToThreadRpc, WsPullRequestsSetThreadResolutionRpc, WsPullRequestsSetReactionRpc, WsPullRequestsInvalidateRpc, WsPullRequestsReviewerCandidatesRpc, WsPullRequestsRequestReviewersRpc, WsProjectsSearchEntriesRpc, WsProjectsWriteFileRpc, WsProjectCheckoutDeletionPreviewRpc, WsProjectCheckoutDeletionExecuteRpc, WsCodeGraphSummaryRpc, WsCodeGraphNeighborhoodRpc, WsCodeGraphSearchRpc, WsWorkspaceReadFileRpc, WsWorkspaceBeginWriteFileRpc, WsWorkspaceWriteFileChunkRpc, WsWorkspaceCommitWriteFileRpc, WsWorkspaceCancelWriteFileRpc, WsShellOpenInEditorRpc, WsSubscribeGitStatusRpc, WsGitPullRpc, WsGitRefreshStatusRpc, WsGitRunStackedActionRpc, WsGitResolvePullRequestRpc, WsGitPreparePullRequestThreadRpc, WsGitListBranchesRpc, WsVcsListRefsRpc, WsVcsRefreshStatusRpc, WsSubscribeVcsStatusRpc, WsVcsPullRpc, WsVcsCreateWorktreeRpc, WsVcsRemoveWorktreeRpc, WsVcsCreateRefRpc, WsVcsSwitchRefRpc, WsVcsInitRpc, WsGitCreateWorktreeRpc, WsGitRemoveWorktreeRpc, WsGitCreateBranchRpc, WsGitCheckoutRpc, WsGitInitRpc, WsFilesystemBrowseRpc, WsProjectsReadFileRpc, WsReviewGetDiffPreviewRpc, WsCloudListRuntimesRpc, WsTerminalOpenRpc, WsTerminalAttachRpc, WsTerminalWriteRpc, WsTerminalResizeRpc, WsTerminalSignalRpc, WsTerminalClearRpc, WsTerminalRestartRpc, WsTerminalCloseRpc, WsBrowserOpenSessionRpc, WsBrowserListSessionsRpc, WsBrowserCloseSessionRpc, WsBrowserGetSessionRpc, WsBrowserCommandRpc, WsBrowserClearBrowsingDataRpc, WsBrowserAttachDisplayRpc, WsBrowserAddDisplayIceCandidateRpc, WsComputerInputRpc, WsDevTunnelRegisterRpc, WsDevTunnelUnregisterRpc, WsDevTunnelListRpc, WsThreadDevRuntimeGetRpc, WsThreadDevRuntimeAllocatePortRpc, WsThreadDevRuntimeReleaseRpc, WsWorkspaceEnvironmentPreflightRpc, WsWorkspaceEnsureScratchRpc, WsSubscribeTerminalEventsRpc, WsSubscribeTerminalMetadataRpc, WsProjectsListEntriesRpc, WsServerDiscoverSourceControlRpc, WsServerReportClientActivityRpc, WsSubscribeBrowserEventsRpc, WsSubscribeServerConfigRpc, WsSubscribeServerLifecycleRpc, WsSubscribeAuthAccessRpc, WsSubscribeWorkspaceReadinessRpc, WsOrchestrationDispatchCommandRpc, WsOrchestrationGetTurnDiffRpc, WsOrchestrationGetFullThreadDiffRpc, WsOrchestrationStreamTurnDiffRpc, WsOrchestrationStreamFullThreadDiffRpc, WsOrchestrationReplayEventsRpc, WsOrchestrationSubscribeShellRpc, WsOrchestrationSubscribeThreadRpc);
26681
+ }), WsPullRequestsListRpc, WsPullRequestsListStatsRpc, WsPullRequestsDetailRpc, WsPullRequestsActivityRpc, WsPullRequestsThreadCommentsRpc, WsPullRequestsDiffFileContentsRpc, WsPullRequestsRunActionRpc, WsPullRequestsUpdateRpc, WsPullRequestsCommentRpc, WsPullRequestsUpdateCommentRpc, WsPullRequestsSubmitReviewRpc, WsPullRequestsReplyToThreadRpc, WsPullRequestsSetThreadResolutionRpc, WsPullRequestsSetReactionRpc, WsPullRequestsInvalidateRpc, WsPullRequestsReviewerCandidatesRpc, WsPullRequestsRequestReviewersRpc, WsProjectsSearchEntriesRpc, WsProjectsWriteFileRpc, WsProjectCheckoutDeletionPreviewRpc, WsProjectCheckoutDeletionExecuteRpc, WsCodeGraphSummaryRpc, WsCodeGraphNeighborhoodRpc, WsCodeGraphSearchRpc, WsWorkspaceReadFileRpc, WsWorkspaceBeginWriteFileRpc, WsWorkspaceWriteFileChunkRpc, WsWorkspaceCommitWriteFileRpc, WsWorkspaceCancelWriteFileRpc, WsShellOpenInEditorRpc, WsSubscribeGitStatusRpc, WsGitPullRpc, WsGitRefreshStatusRpc, WsGitRunStackedActionRpc, WsGitResolvePullRequestRpc, WsGitPreparePullRequestThreadRpc, WsGitListBranchesRpc, WsVcsListRefsRpc, WsVcsRefreshStatusRpc, WsSubscribeVcsStatusRpc, WsVcsPullRpc, WsVcsCreateWorktreeRpc, WsVcsRemoveWorktreeRpc, WsVcsCreateRefRpc, WsVcsSwitchRefRpc, WsVcsInitRpc, WsGitCreateWorktreeRpc, WsGitRemoveWorktreeRpc, WsGitCreateBranchRpc, WsGitCheckoutRpc, WsGitInitRpc, WsFilesystemBrowseRpc, WsProjectsReadFileRpc, WsReviewGetDiffPreviewRpc, WsCloudListRuntimesRpc, WsTerminalOpenRpc, WsTerminalAttachRpc, WsTerminalWriteRpc, WsTerminalResizeRpc, WsTerminalSignalRpc, WsTerminalClearRpc, WsTerminalRestartRpc, WsTerminalCloseRpc, WsBrowserOpenSessionRpc, WsBrowserListSessionsRpc, WsBrowserCloseSessionRpc, WsBrowserGetSessionRpc, WsBrowserCommandRpc, WsBrowserClearBrowsingDataRpc, WsBrowserAttachDisplayRpc, WsBrowserAddDisplayIceCandidateRpc, WsComputerInputRpc, WsDevTunnelRegisterRpc, WsDevTunnelUnregisterRpc, WsDevTunnelListRpc, WsThreadDevRuntimeGetRpc, WsThreadDevRuntimeAllocatePortRpc, WsThreadDevRuntimeReleaseRpc, WsWorkspaceEnvironmentPreflightRpc, WsWorkspaceEnsureScratchRpc, WsSubscribeTerminalEventsRpc, WsSubscribeTerminalMetadataRpc, WsProjectsListEntriesRpc, WsServerDiscoverSourceControlRpc, WsServerReportClientActivityRpc, WsSubscribeBrowserEventsRpc, WsSubscribeServerConfigRpc, WsSubscribeServerLifecycleRpc, WsSubscribeAuthAccessRpc, WsSubscribeWorkspaceReadinessRpc, WsOrchestrationDispatchCommandRpc, WsOrchestrationGetTurnDiffRpc, WsOrchestrationGetFullThreadDiffRpc, WsOrchestrationStreamTurnDiffRpc, WsOrchestrationStreamFullThreadDiffRpc, WsOrchestrationReplayEventsRpc, WsOrchestrationGetArchivedShellSnapshotRpc, WsOrchestrationSubscribeShellRpc, WsOrchestrationSubscribeThreadRpc);
26648
26682
  const RelayWsRpcGroup = WsRpcGroup.middleware(RelayAuthorizationMiddleware).middleware(RelayDeliveryMiddleware);
26649
26683
  /**
26650
26684
  * The direct-WebSocket mount of the same group, with per-method scope
@@ -31770,6 +31804,11 @@ const RELAY_METHOD_POLICY_BASES = [
31770
31804
  requiredScope: "thread.read",
31771
31805
  deliveryClass: "subscription"
31772
31806
  },
31807
+ {
31808
+ method: ORCHESTRATION_WS_METHODS.getArchivedShellSnapshot,
31809
+ requiredScope: "thread.read",
31810
+ deliveryClass: "read"
31811
+ },
31773
31812
  {
31774
31813
  method: ORCHESTRATION_WS_METHODS.subscribeShell,
31775
31814
  requiredScope: "thread.read",
@@ -31819,6 +31858,10 @@ const relayCommandPolicyByType = {
31819
31858
  requiredScope: "project.write",
31820
31859
  deliveryClass: "idempotent-command"
31821
31860
  },
31861
+ "project.script.update": {
31862
+ requiredScope: "project.write",
31863
+ deliveryClass: "idempotent-command"
31864
+ },
31822
31865
  "project.delete": {
31823
31866
  requiredScope: "project.write",
31824
31867
  deliveryClass: "idempotent-command"
@@ -65798,7 +65841,7 @@ function normalizeNumberish(value) {
65798
65841
  }
65799
65842
  //#endregion
65800
65843
  //#region package.json
65801
- var version$1 = "0.11.1";
65844
+ var version$1 = "0.13.0";
65802
65845
  //#endregion
65803
65846
  //#region src/sentry.ts
65804
65847
  const SERVER_APP_NAME = "forge-server";
@@ -93066,6 +93109,15 @@ async function resolveForgeGitCommit(execImpl = (command, args) => execFileAsync
93066
93109
  return cached$1;
93067
93110
  }
93068
93111
  //#endregion
93112
+ //#region src/environment/serverVersion.ts
93113
+ const installedForgeServerVersion = version$1;
93114
+ const SEMVER_NUMERIC_IDENTIFIER = "(?:0|[1-9][0-9]*)";
93115
+ const SEMVER_PRERELEASE_IDENTIFIER = "(?:0|[1-9][0-9]*|[0-9]*[A-Za-z-][0-9A-Za-z-]*)";
93116
+ const EXACT_FORGE_SERVER_VERSION_PATTERN = new RegExp(`^${SEMVER_NUMERIC_IDENTIFIER}[.]${SEMVER_NUMERIC_IDENTIFIER}[.]${SEMVER_NUMERIC_IDENTIFIER}(?:-${SEMVER_PRERELEASE_IDENTIFIER}(?:[.]${SEMVER_PRERELEASE_IDENTIFIER})*)?(?:[+][0-9A-Za-z-]+(?:[.][0-9A-Za-z-]+)*)?\$`);
93117
+ function isExactForgeServerVersion(value) {
93118
+ return typeof value === "string" && EXACT_FORGE_SERVER_VERSION_PATTERN.test(value);
93119
+ }
93120
+ //#endregion
93069
93121
  //#region src/cmmd/ownerSessionCredential.ts
93070
93122
  /**
93071
93123
  * The signed-in owner's CMMD credential, for the calls a device makes as
@@ -94709,7 +94761,8 @@ const registerCloudRuntimeForReplicaHydration = require_Schema$1.gen(function* (
94709
94761
  credentialEpoch,
94710
94762
  activeTurnCount: 0,
94711
94763
  activeSessionCount: 0,
94712
- ...forgeGitCommit !== void 0 ? { forgeGitCommit } : {}
94764
+ ...forgeGitCommit !== void 0 ? { forgeGitCommit } : {},
94765
+ forgeServerVersion: installedForgeServerVersion
94713
94766
  }),
94714
94767
  catch: (cause) => replicaHydrationFailure("runtime registration heartbeat failed", cause)
94715
94768
  })) === null) return yield* replicaHydrationFailure("runtime control authority is unavailable");
@@ -95994,6 +96047,10 @@ function threadStatus(thread) {
95994
96047
  if (thread.latestTurn) return "running";
95995
96048
  return "active";
95996
96049
  }
96050
+ function threadProviderAccountId(thread) {
96051
+ const selection = thread.modelSelection;
96052
+ return selection && "providerAccountId" in selection ? selection.providerAccountId ?? null : null;
96053
+ }
95997
96054
  function serializeRuntimeInventory(snapshot, providerInventory) {
95998
96055
  const activeProjects = snapshot.projects.filter((project) => project.availability !== "missing");
95999
96056
  const projectIds = new Set(activeProjects.map((project) => project.id));
@@ -96024,6 +96081,7 @@ function serializeRuntimeInventory(snapshot, providerInventory) {
96024
96081
  status: threadStatus(thread),
96025
96082
  model: thread.modelSelection?.model ?? null,
96026
96083
  provider: thread.modelSelection?.provider ?? null,
96084
+ providerAccountId: threadProviderAccountId(thread),
96027
96085
  branch: thread.branch,
96028
96086
  lastActivityAt: thread.latestUserMessageAt ?? thread.updatedAt,
96029
96087
  kind: thread.kind,
@@ -99261,7 +99319,7 @@ var BrowserManager = class extends require_Schema$1.Service()("forge/browser/Ser
99261
99319
  const DEFAULT_PORT_MIN = 5200;
99262
99320
  const DEFAULT_PORT_MAX = 5999;
99263
99321
  var ThreadDevRuntime = class extends require_Schema$1.Service()("forge/threadDevRuntime/ThreadDevRuntime") {};
99264
- function nowIso$4() {
99322
+ function nowIso$5() {
99265
99323
  return (/* @__PURE__ */ new Date()).toISOString();
99266
99324
  }
99267
99325
  function previewUrlForPort(port) {
@@ -99288,7 +99346,7 @@ const ThreadDevRuntimeLive = require_Schema$1.effect(ThreadDevRuntime, require_S
99288
99346
  allocatedPort: port,
99289
99347
  status: "allocated",
99290
99348
  previewUrl: previewUrlForPort(port),
99291
- updatedAt: nowIso$4()
99349
+ updatedAt: nowIso$5()
99292
99350
  };
99293
99351
  yield* require_HttpServer.update(byThreadId, (current) => {
99294
99352
  const next = new Map(current);
@@ -99310,7 +99368,7 @@ const ThreadDevRuntimeLive = require_Schema$1.effect(ThreadDevRuntime, require_S
99310
99368
  next.set(input.threadId, {
99311
99369
  ...existing,
99312
99370
  status: "released",
99313
- updatedAt: nowIso$4()
99371
+ updatedAt: nowIso$5()
99314
99372
  });
99315
99373
  return next;
99316
99374
  });
@@ -99336,7 +99394,7 @@ const ThreadDevRuntimeLive = require_Schema$1.effect(ThreadDevRuntime, require_S
99336
99394
  ...patch.terminalId !== void 0 ? { terminalId: patch.terminalId } : {},
99337
99395
  ...patch.previewUrl !== void 0 ? { previewUrl: patch.previewUrl } : {},
99338
99396
  ...patch.tunnelId !== void 0 ? { tunnelId: patch.tunnelId } : {},
99339
- updatedAt: nowIso$4()
99397
+ updatedAt: nowIso$5()
99340
99398
  };
99341
99399
  yield* require_HttpServer.update(byThreadId, (current) => {
99342
99400
  const next = new Map(current);
@@ -104999,6 +105057,13 @@ const makeWsRpcLayer = (currentSessionId, currentUserId) => WsRpcGroup.toLayer(r
104999
105057
  message: "Failed to replay orchestration events",
105000
105058
  cause
105001
105059
  }))), { "rpc.aggregate": "orchestration" }),
105060
+ [ORCHESTRATION_WS_METHODS.getArchivedShellSnapshot]: (_input) => observeRpcEffect(ORCHESTRATION_WS_METHODS.getArchivedShellSnapshot, require_Schema$1.gen(function* () {
105061
+ yield* startup.awaitCommandReady;
105062
+ return yield* projectionSnapshotQuery.getArchivedShellSnapshot();
105063
+ }).pipe(require_Schema$1.mapError((cause) => new OrchestrationGetSnapshotError({
105064
+ message: "Failed to load archived orchestration shell snapshot",
105065
+ cause
105066
+ }))), { "rpc.aggregate": "orchestration" }),
105002
105067
  [ORCHESTRATION_WS_METHODS.subscribeShell]: (_input) => observeRpcStreamEffect(ORCHESTRATION_WS_METHODS.subscribeShell, require_Schema$1.succeed(makeSnapshotThenLiveStream({
105003
105068
  loadSnapshot: loadInitialShellSnapshot({
105004
105069
  startup,
@@ -210941,6 +211006,11 @@ const PUBLIC_PROVIDER_LEAK_PATTERNS = [
210941
211006
  /https?:\/\/[^\s'"<>)]*(?:apex|deepseek|moonshot|kimi)[^\s'"<>)]*/i
210942
211007
  ];
210943
211008
  const DEFAULT_PUBLIC_PROVIDER_ERROR = "CMMD is temporarily unavailable. Check the workspace AI connection and retry.";
211009
+ function isProviderRateOrQuotaError(message) {
211010
+ if (!message) return false;
211011
+ const normalized = message.toLowerCase();
211012
+ return /\b(rate[\s-]?limit|too\s+many\s+requests|usage[ _-]limit|usage_limit_reached|quota|insufficient_quota)\b/.test(normalized) || /\b429\b/.test(normalized);
211013
+ }
210944
211014
  /**
210945
211015
  * Infer a SAFE, clearer failure category from a (possibly leaky) provider error.
210946
211016
  *
@@ -210956,7 +211026,7 @@ function categorizePublicProviderError(message) {
210956
211026
  if (/\bforge_runtime_stopped\b/.test(m) || /\bthis turn was interrupted because the environment was stopped\b/.test(m)) return "This turn was interrupted because the environment was stopped. Start the environment and retry.";
210957
211027
  if (/\bforge_provider_model_not_allowed\b/.test(m) || /\bnot\s+scoped\s+to\s+the\s+requested\s+model\b/.test(m)) return "The workspace AI credential does not cover the model this turn asked for. Retry, or pick that model for the thread.";
210958
211028
  if (/\bmodel\b[\s\S]*\b(not\s+(found|available|supported)|does\s+not\s+exist|unsupported|invalid|unknown)\b/.test(m) || /\b(unsupported|unknown|invalid)\b[\s\S]*\bmodel\b/.test(m) || /\b(model_not_found|invalid_model|model_not_supported)\b/.test(m)) return "The selected model isn't available right now. Pick a different model and retry.";
210959
- if (/\b(rate[\s-]?limit|too\s+many\s+requests|quota|insufficient_quota)\b/.test(m) || /\b429\b/.test(m)) return "The AI service is rate-limited or out of quota. Wait a moment and retry.";
211029
+ if (isProviderRateOrQuotaError(m)) return "The AI service is rate-limited or out of quota. Wait a moment and retry.";
210960
211030
  if (/\b(unauthorized|forbidden|authentication\s+(failed|error|required)|invalid\s+api\s+key|expired\s+(token|credential))\b/.test(m) || /\b40[13]\b/.test(m)) return "Workspace AI authentication failed. Reconnect the workspace and retry.";
210961
211031
  if (/\b(timed?\s*out|timeout|overloaded|service\s+unavailable)\b/.test(m) || /\b50[234]\b/.test(m)) return "The AI service is temporarily overloaded. Retry in a moment.";
210962
211032
  return null;
@@ -228606,7 +228676,7 @@ const OpenCodeRuntimeLive = require_Schema$1.effect(OpenCodeRuntime, makeOpenCod
228606
228676
  //#endregion
228607
228677
  //#region src/provider/Layers/OpenCodeAdapter.ts
228608
228678
  const PROVIDER$5 = "opencode";
228609
- const nowIso$3 = require_Schema$1.map(require_Schema$1.now, require_Schema$1.formatIso);
228679
+ const nowIso$4 = require_Schema$1.map(require_Schema$1.now, require_Schema$1.formatIso);
228610
228680
  /**
228611
228681
  * Map a tagged OpenCodeRuntimeError produced by {@link runOpenCodeSdk} into
228612
228682
  * the adapter-boundary `ProviderAdapterRequestError`. SDK-method-level call
@@ -228633,7 +228703,7 @@ const toProcessError = (threadId, cause) => new ProviderAdapterProcessError({
228633
228703
  });
228634
228704
  const buildEventBase = (input) => require_Schema$1.gen(function* () {
228635
228705
  const uuid = yield* nextUUIDv4;
228636
- const createdAt = input.createdAt ?? (yield* nowIso$3);
228706
+ const createdAt = input.createdAt ?? (yield* nowIso$4);
228637
228707
  return {
228638
228708
  eventId: EventId.make(uuid),
228639
228709
  provider: PROVIDER$5,
@@ -228792,7 +228862,7 @@ function sessionErrorMessage(error) {
228792
228862
  }
228793
228863
  function updateProviderSession(context, patch, options) {
228794
228864
  return require_Schema$1.gen(function* () {
228795
- const updatedAt = yield* nowIso$3;
228865
+ const updatedAt = yield* nowIso$4;
228796
228866
  const nextSession = {
228797
228867
  ...context.session,
228798
228868
  ...patch,
@@ -228914,7 +228984,7 @@ function makeOpenCodeAdapter(openCodeSettings, options) {
228914
228984
  if (("properties" in event ? event.properties.sessionID : void 0) !== context.openCodeSessionId) return;
228915
228985
  const turnId = context.activeTurnId;
228916
228986
  yield* writeNativeEventBestEffort(context.session.threadId, {
228917
- observedAt: yield* nowIso$3,
228987
+ observedAt: yield* nowIso$4,
228918
228988
  event: {
228919
228989
  provider: PROVIDER$5,
228920
228990
  threadId: context.session.threadId,
@@ -229230,7 +229300,7 @@ function makeOpenCodeAdapter(openCodeSettings, options) {
229230
229300
  yield* require_Schema$1.close(started.sessionScope, require_Schema$1.void_$1).pipe(require_Schema$1.ignore);
229231
229301
  return raceWinner.session;
229232
229302
  }
229233
- const createdAt = yield* nowIso$3;
229303
+ const createdAt = yield* nowIso$4;
229234
229304
  const session = {
229235
229305
  provider: PROVIDER$5,
229236
229306
  status: "ready",
@@ -236029,7 +236099,7 @@ function filterEvents(events, options) {
236029
236099
  });
236030
236100
  return options.limit === void 0 ? filtered : filtered.slice(-options.limit);
236031
236101
  }
236032
- function nowIso$2() {
236102
+ function nowIso$3() {
236033
236103
  return (/* @__PURE__ */ new Date()).toISOString();
236034
236104
  }
236035
236105
  //#endregion
@@ -236044,7 +236114,7 @@ var BrowserActionEventRecorder = class {
236044
236114
  type: "browser.action",
236045
236115
  action,
236046
236116
  ...this.sessionFields(),
236047
- timestamp: nowIso$2()
236117
+ timestamp: nowIso$3()
236048
236118
  });
236049
236119
  }
236050
236120
  async result(action) {
@@ -236053,7 +236123,7 @@ var BrowserActionEventRecorder = class {
236053
236123
  action,
236054
236124
  ok: true,
236055
236125
  ...this.sessionFields(),
236056
- timestamp: nowIso$2()
236126
+ timestamp: nowIso$3()
236057
236127
  });
236058
236128
  }
236059
236129
  async error(action, error) {
@@ -236062,7 +236132,7 @@ var BrowserActionEventRecorder = class {
236062
236132
  action,
236063
236133
  error: error instanceof Error ? error.message : String(error),
236064
236134
  ...this.sessionFields(),
236065
- timestamp: nowIso$2()
236135
+ timestamp: nowIso$3()
236066
236136
  });
236067
236137
  }
236068
236138
  sessionFields() {
@@ -236583,7 +236653,7 @@ var AgentBrowser = class {
236583
236653
  await this.options.events?.record({
236584
236654
  type: "browser.safety.confirmation.requested",
236585
236655
  ...request,
236586
- createdAt: nowIso$2()
236656
+ createdAt: nowIso$3()
236587
236657
  });
236588
236658
  const result = await this.resolveConfirmation(request);
236589
236659
  const approved = typeof result === "boolean" ? result : result.approved;
@@ -236591,7 +236661,7 @@ var AgentBrowser = class {
236591
236661
  type: "browser.safety.confirmation.resolved",
236592
236662
  approved,
236593
236663
  requestId: request.requestId,
236594
- resolvedAt: nowIso$2(),
236664
+ resolvedAt: nowIso$3(),
236595
236665
  ...this.events.sessionFields()
236596
236666
  });
236597
236667
  if (!approved) throw new BrowserSafetyError(decision.reason ?? "Browser action was not confirmed.", action, {
@@ -281946,7 +282016,7 @@ const DEFAULT_AGENT_BROWSER_BRIDGE_CLOSE_TIMEOUT_MS = 3e4;
281946
282016
  const DEFAULT_AGENT_BROWSER_PLAYWRIGHT_BACKEND_CLOSE_TIMEOUT_MS = 1e4;
281947
282017
  const REMOTE_WEBRTC_UNAVAILABLE_DETAIL = "Remote WebRTC browser display is not available: the current Agent Browser runtime exposes tab control but does not provide a media transport.";
281948
282018
  const REMOTE_WEBRTC_RELAY_REQUIRED_DETAIL = "Remote WebRTC browser display requires a TURN relay in cloud mode. Configure FORGE_BROWSER_WEBRTC_ICE_SERVERS with authenticated turn: or turns: URLs.";
281949
- function nowIso$1() {
282019
+ function nowIso$2() {
281950
282020
  return (/* @__PURE__ */ new Date()).toISOString();
281951
282021
  }
281952
282022
  function positiveTimeoutMs(value) {
@@ -282046,12 +282116,12 @@ function snapshotAfterTimedOutControl(snapshot, command) {
282046
282116
  case "setViewport": return {
282047
282117
  ...snapshot,
282048
282118
  viewport: command.viewport,
282049
- updatedAt: nowIso$1()
282119
+ updatedAt: nowIso$2()
282050
282120
  };
282051
282121
  case "resetViewport": return {
282052
282122
  ...snapshot,
282053
282123
  viewport: DEFAULT_AGENT_BROWSER_VIEWPORT,
282054
- updatedAt: nowIso$1()
282124
+ updatedAt: nowIso$2()
282055
282125
  };
282056
282126
  default: return snapshot;
282057
282127
  }
@@ -282497,7 +282567,7 @@ function toStreamEvent(input) {
282497
282567
  userId: BrowserUserId.make(input.userId),
282498
282568
  agentId: input.agentId,
282499
282569
  ...input.controlState ? { sessionEpoch: input.controlState.sessionEpoch } : {},
282500
- createdAt: nowIso$1()
282570
+ createdAt: nowIso$2()
282501
282571
  };
282502
282572
  switch (input.event.type) {
282503
282573
  case "session.started": return {
@@ -282798,7 +282868,7 @@ function createAgentBrowserHostBridgeManager(bridge, options) {
282798
282868
  environmentId: event.input.environmentId ?? DEFAULT_BROWSER_ENVIRONMENT_ID,
282799
282869
  userId: event.input.userId ?? "local-user",
282800
282870
  agentId: null,
282801
- createdAt: nowIso$1(),
282871
+ createdAt: nowIso$2(),
282802
282872
  type: "display.iceCandidate",
282803
282873
  payload: {
282804
282874
  sessionId: event.input.sessionId,
@@ -287567,7 +287637,8 @@ const makeRuntimeDrainReporter = require_Schema$1.gen(function* () {
287567
287637
  ...config,
287568
287638
  activeTurnCount: snapshot.activeTurnCount,
287569
287639
  activeSessionCount: snapshot.activeSessionCount,
287570
- ...forgeGitCommit !== void 0 ? { forgeGitCommit } : {}
287640
+ ...forgeGitCommit !== void 0 ? { forgeGitCommit } : {},
287641
+ forgeServerVersion: installedForgeServerVersion
287571
287642
  });
287572
287643
  });
287573
287644
  const applyControlPlaneState = (runtime) => drainState.applyControlPlaneState({
@@ -294928,7 +294999,7 @@ function resolveBuildCommitFromEnv(env) {
294928
294999
  * environment descriptor down instead of reporting an honest "unknown".
294929
295000
  */
294930
295001
  function readBakedBuildCommit() {
294931
- return "b79da36c868d5629c76dcec88a3326634a02c2c7";
295002
+ return "ebc6c5d85de3dc3324a5054f8f29deb2dd89baa7";
294932
295003
  }
294933
295004
  async function resolveServerBuildCommit(input) {
294934
295005
  if (isFullCommitSha(input.baked)) return input.baked;
@@ -295121,7 +295192,7 @@ const makeServerEnvironment = require_Schema$1.fn("makeServerEnvironment")(funct
295121
295192
  os,
295122
295193
  arch: platformArch()
295123
295194
  },
295124
- serverVersion: version$1,
295195
+ serverVersion: installedForgeServerVersion,
295125
295196
  ...buildCommit !== void 0 ? { buildCommit } : {},
295126
295197
  ...deviceRuntimeId !== void 0 ? { deviceRuntimeId } : {},
295127
295198
  capabilities: {
@@ -298009,6 +298080,52 @@ function toProjectorDecodeError(eventType) {
298009
298080
  });
298010
298081
  }
298011
298082
  //#endregion
298083
+ //#region src/orchestration/deciderEventBase.ts
298084
+ const nowIso$1 = () => (/* @__PURE__ */ new Date()).toISOString();
298085
+ const defaultMetadata = {
298086
+ eventId: crypto.randomUUID(),
298087
+ aggregateKind: "thread",
298088
+ aggregateId: "",
298089
+ occurredAt: nowIso$1(),
298090
+ commandId: null,
298091
+ causationEventId: null,
298092
+ correlationId: null,
298093
+ metadata: {}
298094
+ };
298095
+ function withEventBase(input) {
298096
+ return {
298097
+ ...defaultMetadata,
298098
+ eventId: crypto.randomUUID(),
298099
+ aggregateKind: input.aggregateKind,
298100
+ aggregateId: input.aggregateId,
298101
+ occurredAt: input.occurredAt,
298102
+ commandId: input.commandId,
298103
+ correlationId: input.commandId,
298104
+ metadata: input.metadata ?? {}
298105
+ };
298106
+ }
298107
+ //#endregion
298108
+ //#region src/orchestration/projectScriptMutation.ts
298109
+ function unchanged(a, b) {
298110
+ return a !== void 0 && a.id === b.id && a.name === b.name && a.command === b.command && a.icon === b.icon && a.runOnWorktreeCreate === b.runOnWorktreeCreate;
298111
+ }
298112
+ const applyProjectScriptMutation = require_Schema$1.fn("applyProjectScriptMutation")(function* (scripts, command) {
298113
+ const mutation = command.mutation;
298114
+ const id = mutation.kind === "add" ? mutation.script.id : mutation.expected.id;
298115
+ const existing = scripts.find((script) => script.id === id);
298116
+ if (mutation.kind === "add" ? existing !== void 0 : !unchanged(existing, mutation.expected)) return yield* new OrchestrationCommandInvariantError({
298117
+ commandType: command.type,
298118
+ detail: "This action changed in another window. Reopen it and try again."
298119
+ });
298120
+ if (mutation.kind === "add") return [...scripts, mutation.script];
298121
+ if (mutation.kind === "remove") return scripts.filter((script) => script.id !== id);
298122
+ if (mutation.script.id !== id) return yield* new OrchestrationCommandInvariantError({
298123
+ commandType: command.type,
298124
+ detail: "An action's ID cannot change during an update."
298125
+ });
298126
+ return scripts.map((script) => script.id === id ? mutation.script : script);
298127
+ });
298128
+ //#endregion
298012
298129
  //#region src/orchestration/turnAccountSelection.ts
298013
298130
  /** A per-turn account choice remains local to the thread and cannot change its provider. */
298014
298131
  function turnAccountSelection(current, requested) {
@@ -298065,28 +298182,6 @@ function requireThreadAbsent(input) {
298065
298182
  //#endregion
298066
298183
  //#region src/orchestration/decider.ts
298067
298184
  const nowIso = () => (/* @__PURE__ */ new Date()).toISOString();
298068
- const defaultMetadata = {
298069
- eventId: crypto.randomUUID(),
298070
- aggregateKind: "thread",
298071
- aggregateId: "",
298072
- occurredAt: nowIso(),
298073
- commandId: null,
298074
- causationEventId: null,
298075
- correlationId: null,
298076
- metadata: {}
298077
- };
298078
- function withEventBase(input) {
298079
- return {
298080
- ...defaultMetadata,
298081
- eventId: crypto.randomUUID(),
298082
- aggregateKind: input.aggregateKind,
298083
- aggregateId: input.aggregateId,
298084
- occurredAt: input.occurredAt,
298085
- commandId: input.commandId,
298086
- correlationId: input.commandId,
298087
- metadata: input.metadata ?? {}
298088
- };
298089
- }
298090
298185
  function requireOrdinaryMessageId(commandType, messageId) {
298091
298186
  return isReservedReplicaSourceMessageId(messageId) ? require_Schema$1.fail(new OrchestrationCommandInvariantError({
298092
298187
  commandType,
@@ -298139,6 +298234,22 @@ const decideOrchestrationCommand = require_Schema$1.fn("decideOrchestrationComma
298139
298234
  updatedAt: command.createdAt
298140
298235
  }
298141
298236
  };
298237
+ case "project.script.update": {
298238
+ const scripts = yield* applyProjectScriptMutation((yield* requireProject({
298239
+ readModel,
298240
+ command,
298241
+ projectId: command.projectId
298242
+ })).scripts, command);
298243
+ return yield* decideOrchestrationCommand({
298244
+ readModel,
298245
+ command: {
298246
+ type: "project.meta.update",
298247
+ commandId: command.commandId,
298248
+ projectId: command.projectId,
298249
+ scripts
298250
+ }
298251
+ });
298252
+ }
298142
298253
  case "project.meta.update": {
298143
298254
  yield* requireProject({
298144
298255
  readModel,
@@ -299425,6 +299536,7 @@ function commandToAggregateRef(command) {
299425
299536
  switch (command.type) {
299426
299537
  case "project.create":
299427
299538
  case "project.meta.update":
299539
+ case "project.script.update":
299428
299540
  case "project.delete": return {
299429
299541
  aggregateKind: "project",
299430
299542
  aggregateId: command.projectId
@@ -301910,6 +302022,54 @@ const makeProjectionSnapshotQuery = require_Schema$1.gen(function* () {
301910
302022
  AND deleted_at IS NULL
301911
302023
  AND archived_at IS NULL
301912
302024
  ORDER BY created_at ASC, thread_id ASC
302025
+ `
302026
+ });
302027
+ /**
302028
+ * The archive's own rows.
302029
+ *
302030
+ * `listThreadRows` deliberately carries archived threads too, because the
302031
+ * active list needs `archivedAt` to know what to hide and the web archive
302032
+ * panel filters that same snapshot client side. This query is the opposite
302033
+ * selection, for the clients that ask for the archive directly.
302034
+ */
302035
+ const listArchivedThreadRows = findAll({
302036
+ Request: require_Schema$1.Void,
302037
+ Result: ProjectionThreadDbRowSchema,
302038
+ execute: () => sql`
302039
+ SELECT
302040
+ thread_id AS "threadId",
302041
+ project_id AS "projectId",
302042
+ title,
302043
+ model_selection_json AS "modelSelection",
302044
+ runtime_mode AS "runtimeMode",
302045
+ interaction_mode AS "interactionMode",
302046
+ branch,
302047
+ worktree_path AS "worktreePath",
302048
+ latest_turn_id AS "latestTurnId",
302049
+ created_at AS "createdAt",
302050
+ updated_at AS "updatedAt",
302051
+ archived_at AS "archivedAt",
302052
+ settled_at AS "settledAt",
302053
+ settled_override AS "settledOverride",
302054
+ latest_user_message_at AS "latestUserMessageAt",
302055
+ pending_approval_count AS "pendingApprovalCount",
302056
+ pending_user_input_count AS "pendingUserInputCount",
302057
+ has_actionable_proposed_plan AS "hasActionableProposedPlan",
302058
+ deleted_at AS "deletedAt",
302059
+ kind,
302060
+ parent_thread_id AS "parentThreadId",
302061
+ anchor_kind AS "anchorKind",
302062
+ anchor_cmmd_id AS "anchorCmmdId",
302063
+ linked_pull_request_json AS "linkedPullRequest",
302064
+ status,
302065
+ worker_role AS "workerRole",
302066
+ goal,
302067
+ pending_auto_create_prompt_json AS "pendingAutoCreatePrompt",
302068
+ COALESCE(rate_limit_status_json, '[]') AS "rateLimitStatus"
302069
+ FROM projection_threads
302070
+ WHERE archived_at IS NOT NULL
302071
+ AND deleted_at IS NULL
302072
+ ORDER BY archived_at DESC, thread_id ASC
301913
302073
  `
301914
302074
  });
301915
302075
  const listThreadMessageRows = findAll({
@@ -302564,13 +302724,22 @@ const makeProjectionSnapshotQuery = require_Schema$1.gen(function* () {
302564
302724
  if (isPersistenceError(error)) return error;
302565
302725
  return toPersistenceSqlError("ProjectionSnapshotQuery.getSnapshot:query")(error);
302566
302726
  }));
302567
- const getShellSnapshot = () => {
302727
+ /**
302728
+ * One snapshot assembly, two selections of threads.
302729
+ *
302730
+ * The active list and the archive differ only in which thread rows they
302731
+ * read, so they share this body. Keeping them on one mapper is the point:
302732
+ * FOR-36394 was a projected column that one path carried and another
302733
+ * dropped, and a second hand-copied assembly here would invite the same
302734
+ * failure for anyone who only remembered to update the active list.
302735
+ */
302736
+ const readShellSnapshot = (operation, listThreads) => {
302568
302737
  return sql.withTransaction(require_Schema$1.all([
302569
- listProjectRows(void 0).pipe(require_Schema$1.mapError(toPersistenceSqlOrDecodeError("ProjectionSnapshotQuery.getShellSnapshot:listProjects:query", "ProjectionSnapshotQuery.getShellSnapshot:listProjects:decodeRows"))),
302570
- listThreadRows(void 0).pipe(require_Schema$1.mapError(toPersistenceSqlOrDecodeError("ProjectionSnapshotQuery.getShellSnapshot:listThreads:query", "ProjectionSnapshotQuery.getShellSnapshot:listThreads:decodeRows"))),
302571
- listThreadSessionRows(void 0).pipe(require_Schema$1.mapError(toPersistenceSqlOrDecodeError("ProjectionSnapshotQuery.getShellSnapshot:listThreadSessions:query", "ProjectionSnapshotQuery.getShellSnapshot:listThreadSessions:decodeRows"))),
302572
- listLatestTurnRows(void 0).pipe(require_Schema$1.mapError(toPersistenceSqlOrDecodeError("ProjectionSnapshotQuery.getShellSnapshot:listLatestTurns:query", "ProjectionSnapshotQuery.getShellSnapshot:listLatestTurns:decodeRows"))),
302573
- listProjectionStateRows(void 0).pipe(require_Schema$1.mapError(toPersistenceSqlOrDecodeError("ProjectionSnapshotQuery.getShellSnapshot:listProjectionState:query", "ProjectionSnapshotQuery.getShellSnapshot:listProjectionState:decodeRows")))
302738
+ listProjectRows(void 0).pipe(require_Schema$1.mapError(toPersistenceSqlOrDecodeError(`ProjectionSnapshotQuery.${operation}:listProjects:query`, `ProjectionSnapshotQuery.${operation}:listProjects:decodeRows`))),
302739
+ listThreads(void 0).pipe(require_Schema$1.mapError(toPersistenceSqlOrDecodeError(`ProjectionSnapshotQuery.${operation}:listThreads:query`, `ProjectionSnapshotQuery.${operation}:listThreads:decodeRows`))),
302740
+ listThreadSessionRows(void 0).pipe(require_Schema$1.mapError(toPersistenceSqlOrDecodeError(`ProjectionSnapshotQuery.${operation}:listThreadSessions:query`, `ProjectionSnapshotQuery.${operation}:listThreadSessions:decodeRows`))),
302741
+ listLatestTurnRows(void 0).pipe(require_Schema$1.mapError(toPersistenceSqlOrDecodeError(`ProjectionSnapshotQuery.${operation}:listLatestTurns:query`, `ProjectionSnapshotQuery.${operation}:listLatestTurns:decodeRows`))),
302742
+ listProjectionStateRows(void 0).pipe(require_Schema$1.mapError(toPersistenceSqlOrDecodeError(`ProjectionSnapshotQuery.${operation}:listProjectionState:query`, `ProjectionSnapshotQuery.${operation}:listProjectionState:decodeRows`)))
302574
302743
  ])).pipe(require_Schema$1.flatMap(([projectRows, threadRows, sessionRows, latestTurnRows, stateRows]) => require_Schema$1.gen(function* () {
302575
302744
  let updatedAt = null;
302576
302745
  for (const row of projectRows) updatedAt = maxIso(updatedAt, row.updatedAt);
@@ -302591,12 +302760,14 @@ const makeProjectionSnapshotQuery = require_Schema$1.gen(function* () {
302591
302760
  projects: projectRows.filter((row) => row.deletedAt === null).map((row) => mapProjectShellRow(row, repositoryIdentities.get(row.projectId) ?? null, projectAvailabilities.get(row.projectId) ?? "unknown")),
302592
302761
  threads: threadShells.filter((thread) => projectIds.has(thread.projectId)),
302593
302762
  updatedAt: updatedAt ?? (/* @__PURE__ */ new Date(0)).toISOString()
302594
- }).pipe(require_Schema$1.mapError(toPersistenceDecodeError("ProjectionSnapshotQuery.getShellSnapshot:decodeShellSnapshot")));
302763
+ }).pipe(require_Schema$1.mapError(toPersistenceDecodeError(`ProjectionSnapshotQuery.${operation}:decodeShellSnapshot`)));
302595
302764
  })), require_Schema$1.mapError((error) => {
302596
302765
  if (isPersistenceError(error)) return error;
302597
- return toPersistenceSqlError("ProjectionSnapshotQuery.getShellSnapshot:query")(error);
302766
+ return toPersistenceSqlError(`ProjectionSnapshotQuery.${operation}:query`)(error);
302598
302767
  }));
302599
302768
  };
302769
+ const getShellSnapshot = () => readShellSnapshot("getShellSnapshot", listThreadRows);
302770
+ const getArchivedShellSnapshot = () => readShellSnapshot("getArchivedShellSnapshot", listArchivedThreadRows);
302600
302771
  const listActiveWorkerShells = () => sql.withTransaction(require_Schema$1.all([
302601
302772
  listActiveWorkerThreadRows(void 0).pipe(require_Schema$1.mapError(toPersistenceSqlOrDecodeError("ProjectionSnapshotQuery.listActiveWorkerShells:listThreads:query", "ProjectionSnapshotQuery.listActiveWorkerShells:listThreads:decodeRows"))),
302602
302773
  listActiveWorkerSessionRows(void 0).pipe(require_Schema$1.mapError(toPersistenceSqlOrDecodeError("ProjectionSnapshotQuery.listActiveWorkerShells:listThreadSessions:query", "ProjectionSnapshotQuery.listActiveWorkerShells:listThreadSessions:decodeRows"))),
@@ -302764,6 +302935,7 @@ const makeProjectionSnapshotQuery = require_Schema$1.gen(function* () {
302764
302935
  return {
302765
302936
  getSnapshot,
302766
302937
  getShellSnapshot,
302938
+ getArchivedShellSnapshot,
302767
302939
  listActiveWorkerShells,
302768
302940
  listStaleRunningSessionShells,
302769
302941
  getCounts,
@@ -306785,7 +306957,6 @@ const cmmdUpdateProjectAgentMemberAvatarRouteLayer = registerProxyRoute({
306785
306957
  });
306786
306958
  //#endregion
306787
306959
  //#region src/command/runtimeProviderAuthorityUpgradeModel.ts
306788
- const GIT_COMMIT = /^[0-9a-f]{40}$/u;
306789
306960
  const AUTHORITY_UPGRADE_OPERATION_KEYS = new Set([
306790
306961
  "operationId",
306791
306962
  "runtimeId",
@@ -306795,7 +306966,7 @@ const AUTHORITY_UPGRADE_OPERATION_KEYS = new Set([
306795
306966
  "attemptCount",
306796
306967
  "expectedCredentialEpoch",
306797
306968
  "resultingCredentialEpoch",
306798
- "targetForgeGitCommit",
306969
+ "targetForgeServerVersion",
306799
306970
  "retryAt",
306800
306971
  "completedAt",
306801
306972
  "failureCode"
@@ -306863,7 +307034,7 @@ function parseRuntimeAuthorityUpgradeOperation(value, expected) {
306863
307034
  Number.isSafeInteger(operation.attemptCount) && operation.attemptCount >= 0,
306864
307035
  operation.expectedCredentialEpoch === 0,
306865
307036
  operation.resultingCredentialEpoch === 1,
306866
- typeof operation.targetForgeGitCommit === "string" && GIT_COMMIT.test(operation.targetForgeGitCommit),
307037
+ isExactForgeServerVersion(operation.targetForgeServerVersion),
306867
307038
  isNullableDateTime(operation.retryAt),
306868
307039
  isNullableDateTime(operation.completedAt),
306869
307040
  operation.failureCode === null || typeof operation.failureCode === "string",
@@ -306880,6 +307051,7 @@ function isLegacyRuntimeConnection(value, expectedRuntimeId) {
306880
307051
  runtime.brokerAuthorityAttestedImageRef === null,
306881
307052
  runtime.brokerAuthorityAttestedImageVersion === null,
306882
307053
  runtime.brokerAuthorityAttestedForgeGitCommit === null,
307054
+ runtime.brokerAuthorityAttestedForgeServerVersion === null,
306883
307055
  runtime.brokerAuthorityAttestedMachineId === null,
306884
307056
  runtime.brokerAuthorityAttestedCredentialEpoch === null,
306885
307057
  runtime.brokerAuthorityAttestedAt === null
@@ -307043,13 +307215,13 @@ function hasTrustedRuntimeRoute(url, trustedBase) {
307043
307215
  const relativePath = url.pathname.slice(trustedPrefix.length);
307044
307216
  return url.origin === trustedBase.origin && url.username === "" && url.password === "" && url.port === "" && url.search === "" && url.hash === "" && url.pathname.startsWith(`${trustedPrefix}/r/`) && RUNTIME_ROUTE_PATH.test(relativePath);
307045
307217
  }
307046
- function hasExactRuntimeConnectionFields(data, runtime, expectedRuntimeId, expectedAttestedForgeGitCommit) {
307047
- return runtime.runtimeId === expectedRuntimeId && runtime.runtimeCapabilityMode === "exact_machine_v2" && isNonEmptyString(runtime.brokerAuthorityAttestedMachineId) && isSafeCredentialEpoch(runtime.brokerAuthorityAttestedCredentialEpoch) && (expectedAttestedForgeGitCommit === void 0 || runtime.brokerAuthorityAttestedForgeGitCommit === expectedAttestedForgeGitCommit) && isNonEmptyString(data.httpBaseUrl) && isNonEmptyString(data.bearerToken);
307218
+ function hasExactRuntimeConnectionFields(data, runtime, expectedRuntimeId, expectedAttestedForgeServerVersion) {
307219
+ return runtime.runtimeId === expectedRuntimeId && runtime.runtimeCapabilityMode === "exact_machine_v2" && isNonEmptyString(runtime.brokerAuthorityAttestedMachineId) && isSafeCredentialEpoch(runtime.brokerAuthorityAttestedCredentialEpoch) && (expectedAttestedForgeServerVersion === void 0 || runtime.brokerAuthorityAttestedForgeServerVersion === expectedAttestedForgeServerVersion) && isNonEmptyString(data.httpBaseUrl) && isNonEmptyString(data.bearerToken);
307048
307220
  }
307049
- function parseRuntimeConnection(value, expectedRuntimeId, trustedRuntimeRouterBaseUrl, expectedAttestedForgeGitCommit) {
307221
+ function parseRuntimeConnection(value, expectedRuntimeId, trustedRuntimeRouterBaseUrl, expectedAttestedForgeServerVersion) {
307050
307222
  const data = asRecord$1(unwrapData(value));
307051
307223
  const runtime = asRecord$1(data?.runtime);
307052
- if (!data || !runtime || !hasExactRuntimeConnectionFields(data, runtime, expectedRuntimeId, expectedAttestedForgeGitCommit)) return null;
307224
+ if (!data || !runtime || !hasExactRuntimeConnectionFields(data, runtime, expectedRuntimeId, expectedAttestedForgeServerVersion)) return null;
307053
307225
  const trustedBase = parseTrustedRuntimeRouterBaseUrl(trustedRuntimeRouterBaseUrl);
307054
307226
  if (!trustedBase) return null;
307055
307227
  let httpBaseUrl;
@@ -307229,7 +307401,7 @@ function classifyInitialConnection(outcome, runtimeId, trustedRuntimeRouterBaseU
307229
307401
  }
307230
307402
  };
307231
307403
  }
307232
- function reconnectExactRuntime(input, targetForgeGitCommit) {
307404
+ function reconnectExactRuntime(input, targetForgeServerVersion) {
307233
307405
  return require_Schema$1.gen(function* () {
307234
307406
  const connectPath = `/api/forge/context/runtimes/${encodeURIComponent(input.runtimeId)}/connect`;
307235
307407
  const reconnected = yield* postRuntimeProviderCmmd({
@@ -307246,7 +307418,7 @@ function reconnectExactRuntime(input, targetForgeGitCommit) {
307246
307418
  error: reconnected.error,
307247
307419
  stage: "reconnect"
307248
307420
  };
307249
- const exact = parseRuntimeConnection(reconnected.value, input.runtimeId, input.trustedRuntimeRouterBaseUrl, targetForgeGitCommit);
307421
+ const exact = parseRuntimeConnection(reconnected.value, input.runtimeId, input.trustedRuntimeRouterBaseUrl, targetForgeServerVersion);
307250
307422
  return exact ? {
307251
307423
  ok: true,
307252
307424
  value: exact
@@ -307257,7 +307429,7 @@ function reconnectExactRuntime(input, targetForgeGitCommit) {
307257
307429
  });
307258
307430
  }
307259
307431
  function resolveOperation(input, operation) {
307260
- return operation.status === "completed" ? reconnectExactRuntime(input, operation.targetForgeGitCommit) : require_Schema$1.succeed(pendingOperation(operation));
307432
+ return operation.status === "completed" ? reconnectExactRuntime(input, operation.targetForgeServerVersion) : require_Schema$1.succeed(pendingOperation(operation));
307261
307433
  }
307262
307434
  function beginExactRuntimeConnection(input) {
307263
307435
  return require_Schema$1.gen(function* () {