@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.mjs CHANGED
@@ -11,7 +11,7 @@ import { a as make$51, 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$52, 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-cyJT2IRY.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 verifyCmmdRuntimeTicket, d as setRuntimeGrantToken, f as createReadOnceFileTokenAccessor, i as sendRuntimeControlHeartbeat, l as verifyCmmdRuntimeTicketRefreshProof, n as bootstrapRuntimeControlAuthorityFromNarrowGrant, o as verifyCmmdClaudeReadinessTicket, r as readRuntimeControlAuthority, s as verifyCmmdClaudeUsageTicket, t as bootstrapRuntimeControlAuthority, u as runtimeGrantToken } from "./runtimeControlAuthority-COHmz_WT.mjs";
14
+ import { a as verifyCmmdAuthRuntimeTicket, c as verifyCmmdRuntimeTicket, d as setRuntimeGrantToken, f as createReadOnceFileTokenAccessor, i as sendRuntimeControlHeartbeat, l as verifyCmmdRuntimeTicketRefreshProof, n as bootstrapRuntimeControlAuthorityFromNarrowGrant, o as verifyCmmdClaudeReadinessTicket, r as readRuntimeControlAuthority, s as verifyCmmdClaudeUsageTicket, t as bootstrapRuntimeControlAuthority, u as runtimeGrantToken } from "./runtimeControlAuthority-D_zKr_eI.mjs";
15
15
  import { n as PtySpawnError, t as PtyAdapter } from "./PTY-rIPf52QR.mjs";
16
16
  import { createRequire } from "node:module";
17
17
  import * as HE from "node:child_process";
@@ -16520,7 +16520,7 @@ function makeNetServiceShape(createServer = Net.createServer) {
16520
16520
  }
16521
16521
  //#endregion
16522
16522
  //#region ../../packages/shared/src/releaseInfo.generated.ts
16523
- const FORGE_RELEASE_VERSION = "0.11.0";
16523
+ const FORGE_RELEASE_VERSION = "0.13.0";
16524
16524
  //#endregion
16525
16525
  //#region ../../packages/shared/src/hostProcess.ts
16526
16526
  /**
@@ -18580,6 +18580,40 @@ const TerminalError = Union([
18580
18580
  TerminalControlSequenceError,
18581
18581
  TerminalSignalError
18582
18582
  ]);
18583
+ const ProjectScript = Struct({
18584
+ id: TrimmedNonEmptyString,
18585
+ name: TrimmedNonEmptyString,
18586
+ command: TrimmedNonEmptyString,
18587
+ icon: Literals([
18588
+ "play",
18589
+ "test",
18590
+ "lint",
18591
+ "configure",
18592
+ "build",
18593
+ "debug"
18594
+ ]),
18595
+ runOnWorktreeCreate: Boolean$1
18596
+ });
18597
+ const ProjectScriptUpdateCommand = Struct({
18598
+ type: Literal("project.script.update"),
18599
+ commandId: CommandId,
18600
+ projectId: ProjectId,
18601
+ mutation: Union([
18602
+ Struct({
18603
+ kind: Literal("add"),
18604
+ script: ProjectScript
18605
+ }),
18606
+ Struct({
18607
+ kind: Literal("update"),
18608
+ script: ProjectScript,
18609
+ expected: ProjectScript
18610
+ }),
18611
+ Struct({
18612
+ kind: Literal("remove"),
18613
+ expected: ProjectScript
18614
+ })
18615
+ ])
18616
+ });
18583
18617
  //#endregion
18584
18618
  //#region ../../packages/contracts/src/model.ts
18585
18619
  const CODEX_REASONING_EFFORT_OPTIONS = [
@@ -19116,6 +19150,7 @@ const ORCHESTRATION_WS_METHODS = {
19116
19150
  streamTurnDiff: "orchestration.streamTurnDiff",
19117
19151
  streamFullThreadDiff: "orchestration.streamFullThreadDiff",
19118
19152
  replayEvents: "orchestration.replayEvents",
19153
+ getArchivedShellSnapshot: "orchestration.getArchivedShellSnapshot",
19119
19154
  subscribeShell: "orchestration.subscribeShell",
19120
19155
  subscribeThread: "orchestration.subscribeThread"
19121
19156
  };
@@ -19221,20 +19256,6 @@ const UploadChatImageAttachment = Struct({
19221
19256
  });
19222
19257
  const ChatAttachment = Union([ChatImageAttachment]);
19223
19258
  const UploadChatAttachment = Union([UploadChatImageAttachment]);
19224
- const ProjectScript = Struct({
19225
- id: TrimmedNonEmptyString,
19226
- name: TrimmedNonEmptyString,
19227
- command: TrimmedNonEmptyString,
19228
- icon: Literals([
19229
- "play",
19230
- "test",
19231
- "lint",
19232
- "configure",
19233
- "build",
19234
- "debug"
19235
- ]),
19236
- runOnWorktreeCreate: Boolean$1
19237
- });
19238
19259
  /**
19239
19260
  * Availability of the project's `workspaceRoot` on the server's filesystem.
19240
19261
  *
@@ -19864,6 +19885,7 @@ const ThreadSessionStopCommand = Struct({
19864
19885
  const DispatchableClientOrchestrationCommand = Union([
19865
19886
  ProjectCreateCommand,
19866
19887
  ProjectMetaUpdateCommand,
19888
+ ProjectScriptUpdateCommand,
19867
19889
  ProjectDeleteCommand,
19868
19890
  ThreadCreateCommand,
19869
19891
  ThreadDeleteCommand,
@@ -19885,6 +19907,7 @@ const DispatchableClientOrchestrationCommand = Union([
19885
19907
  const ClientOrchestrationCommand = Union([
19886
19908
  ProjectCreateCommand,
19887
19909
  ProjectMetaUpdateCommand,
19910
+ ProjectScriptUpdateCommand,
19888
19911
  ProjectDeleteCommand,
19889
19912
  ThreadCreateCommand,
19890
19913
  ThreadDeleteCommand,
@@ -20551,6 +20574,10 @@ const OrchestrationRpcSchemas = {
20551
20574
  subscribeShell: {
20552
20575
  input: Struct({}),
20553
20576
  output: OrchestrationShellStreamItem
20577
+ },
20578
+ getArchivedShellSnapshot: {
20579
+ input: Struct({}),
20580
+ output: OrchestrationShellSnapshot
20554
20581
  }
20555
20582
  };
20556
20583
  var OrchestrationGetSnapshotError = class extends TaggedErrorClass()("OrchestrationGetSnapshotError", {
@@ -26292,6 +26319,11 @@ const WsOrchestrationReplayEventsRpc = make$30(ORCHESTRATION_WS_METHODS.replayEv
26292
26319
  success: OrchestrationRpcSchemas.replayEvents.output,
26293
26320
  error: OrchestrationReplayEventsError
26294
26321
  });
26322
+ const WsOrchestrationGetArchivedShellSnapshotRpc = make$30(ORCHESTRATION_WS_METHODS.getArchivedShellSnapshot, {
26323
+ payload: OrchestrationRpcSchemas.getArchivedShellSnapshot.input,
26324
+ success: OrchestrationRpcSchemas.getArchivedShellSnapshot.output,
26325
+ error: OrchestrationGetSnapshotError
26326
+ });
26295
26327
  const WsOrchestrationSubscribeShellRpc = make$30(ORCHESTRATION_WS_METHODS.subscribeShell, {
26296
26328
  payload: OrchestrationRpcSchemas.subscribeShell.input,
26297
26329
  success: OrchestrationRpcSchemas.subscribeShell.output,
@@ -26372,7 +26404,7 @@ const WsRpcGroup = make$29(WsServerGetConfigRpc, WsServerRefreshProvidersRpc, Ws
26372
26404
  payload: UsageSummaryInput,
26373
26405
  success: UsageSummary,
26374
26406
  error: UsageReadError
26375
- }), 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);
26407
+ }), 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);
26376
26408
  const RelayWsRpcGroup = WsRpcGroup.middleware(RelayAuthorizationMiddleware).middleware(RelayDeliveryMiddleware);
26377
26409
  /**
26378
26410
  * The direct-WebSocket mount of the same group, with per-method scope
@@ -31490,6 +31522,11 @@ const RELAY_METHOD_POLICY_BASES = [
31490
31522
  requiredScope: "thread.read",
31491
31523
  deliveryClass: "subscription"
31492
31524
  },
31525
+ {
31526
+ method: ORCHESTRATION_WS_METHODS.getArchivedShellSnapshot,
31527
+ requiredScope: "thread.read",
31528
+ deliveryClass: "read"
31529
+ },
31493
31530
  {
31494
31531
  method: ORCHESTRATION_WS_METHODS.subscribeShell,
31495
31532
  requiredScope: "thread.read",
@@ -31539,6 +31576,10 @@ const relayCommandPolicyByType = {
31539
31576
  requiredScope: "project.write",
31540
31577
  deliveryClass: "idempotent-command"
31541
31578
  },
31579
+ "project.script.update": {
31580
+ requiredScope: "project.write",
31581
+ deliveryClass: "idempotent-command"
31582
+ },
31542
31583
  "project.delete": {
31543
31584
  requiredScope: "project.write",
31544
31585
  deliveryClass: "idempotent-command"
@@ -65518,7 +65559,7 @@ function normalizeNumberish(value) {
65518
65559
  }
65519
65560
  //#endregion
65520
65561
  //#region package.json
65521
- var version$1 = "0.11.1";
65562
+ var version$1 = "0.13.0";
65522
65563
  //#endregion
65523
65564
  //#region src/sentry.ts
65524
65565
  const SERVER_APP_NAME = "forge-server";
@@ -92723,6 +92764,15 @@ async function resolveForgeGitCommit(execImpl = (command, args) => execFileAsync
92723
92764
  }
92724
92765
  return cached$1;
92725
92766
  }
92767
+ //#endregion
92768
+ //#region src/environment/serverVersion.ts
92769
+ const installedForgeServerVersion = version$1;
92770
+ const SEMVER_NUMERIC_IDENTIFIER = "(?:0|[1-9][0-9]*)";
92771
+ const SEMVER_PRERELEASE_IDENTIFIER = "(?:0|[1-9][0-9]*|[0-9]*[A-Za-z-][0-9A-Za-z-]*)";
92772
+ 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-]+)*)?\$`);
92773
+ function isExactForgeServerVersion(value) {
92774
+ return typeof value === "string" && EXACT_FORGE_SERVER_VERSION_PATTERN.test(value);
92775
+ }
92726
92776
  const decodeSessions = decodeUnknownSync(ArraySchema(Struct({
92727
92777
  sessionId: AuthSessionId,
92728
92778
  subject: String$1
@@ -94337,7 +94387,8 @@ const registerCloudRuntimeForReplicaHydration = gen(function* () {
94337
94387
  credentialEpoch,
94338
94388
  activeTurnCount: 0,
94339
94389
  activeSessionCount: 0,
94340
- ...forgeGitCommit !== void 0 ? { forgeGitCommit } : {}
94390
+ ...forgeGitCommit !== void 0 ? { forgeGitCommit } : {},
94391
+ forgeServerVersion: installedForgeServerVersion
94341
94392
  }),
94342
94393
  catch: (cause) => replicaHydrationFailure("runtime registration heartbeat failed", cause)
94343
94394
  })) === null) return yield* replicaHydrationFailure("runtime control authority is unavailable");
@@ -95621,6 +95672,10 @@ function threadStatus(thread) {
95621
95672
  if (thread.latestTurn) return "running";
95622
95673
  return "active";
95623
95674
  }
95675
+ function threadProviderAccountId(thread) {
95676
+ const selection = thread.modelSelection;
95677
+ return selection && "providerAccountId" in selection ? selection.providerAccountId ?? null : null;
95678
+ }
95624
95679
  function serializeRuntimeInventory(snapshot, providerInventory) {
95625
95680
  const activeProjects = snapshot.projects.filter((project) => project.availability !== "missing");
95626
95681
  const projectIds = new Set(activeProjects.map((project) => project.id));
@@ -95651,6 +95706,7 @@ function serializeRuntimeInventory(snapshot, providerInventory) {
95651
95706
  status: threadStatus(thread),
95652
95707
  model: thread.modelSelection?.model ?? null,
95653
95708
  provider: thread.modelSelection?.provider ?? null,
95709
+ providerAccountId: threadProviderAccountId(thread),
95654
95710
  branch: thread.branch,
95655
95711
  lastActivityAt: thread.latestUserMessageAt ?? thread.updatedAt,
95656
95712
  kind: thread.kind,
@@ -98882,7 +98938,7 @@ var BrowserManager = class extends Service$1()("forge/browser/Services/Manager/B
98882
98938
  const DEFAULT_PORT_MIN = 5200;
98883
98939
  const DEFAULT_PORT_MAX = 5999;
98884
98940
  var ThreadDevRuntime = class extends Service$1()("forge/threadDevRuntime/ThreadDevRuntime") {};
98885
- function nowIso$4() {
98941
+ function nowIso$5() {
98886
98942
  return (/* @__PURE__ */ new Date()).toISOString();
98887
98943
  }
98888
98944
  function previewUrlForPort(port) {
@@ -98909,7 +98965,7 @@ const ThreadDevRuntimeLive = effect(ThreadDevRuntime, gen(function* () {
98909
98965
  allocatedPort: port,
98910
98966
  status: "allocated",
98911
98967
  previewUrl: previewUrlForPort(port),
98912
- updatedAt: nowIso$4()
98968
+ updatedAt: nowIso$5()
98913
98969
  };
98914
98970
  yield* update$4(byThreadId, (current) => {
98915
98971
  const next = new Map(current);
@@ -98931,7 +98987,7 @@ const ThreadDevRuntimeLive = effect(ThreadDevRuntime, gen(function* () {
98931
98987
  next.set(input.threadId, {
98932
98988
  ...existing,
98933
98989
  status: "released",
98934
- updatedAt: nowIso$4()
98990
+ updatedAt: nowIso$5()
98935
98991
  });
98936
98992
  return next;
98937
98993
  });
@@ -98957,7 +99013,7 @@ const ThreadDevRuntimeLive = effect(ThreadDevRuntime, gen(function* () {
98957
99013
  ...patch.terminalId !== void 0 ? { terminalId: patch.terminalId } : {},
98958
99014
  ...patch.previewUrl !== void 0 ? { previewUrl: patch.previewUrl } : {},
98959
99015
  ...patch.tunnelId !== void 0 ? { tunnelId: patch.tunnelId } : {},
98960
- updatedAt: nowIso$4()
99016
+ updatedAt: nowIso$5()
98961
99017
  };
98962
99018
  yield* update$4(byThreadId, (current) => {
98963
99019
  const next = new Map(current);
@@ -104615,6 +104671,13 @@ const makeWsRpcLayer = (currentSessionId, currentUserId) => WsRpcGroup.toLayer(g
104615
104671
  message: "Failed to replay orchestration events",
104616
104672
  cause
104617
104673
  }))), { "rpc.aggregate": "orchestration" }),
104674
+ [ORCHESTRATION_WS_METHODS.getArchivedShellSnapshot]: (_input) => observeRpcEffect(ORCHESTRATION_WS_METHODS.getArchivedShellSnapshot, gen(function* () {
104675
+ yield* startup.awaitCommandReady;
104676
+ return yield* projectionSnapshotQuery.getArchivedShellSnapshot();
104677
+ }).pipe(mapError((cause) => new OrchestrationGetSnapshotError({
104678
+ message: "Failed to load archived orchestration shell snapshot",
104679
+ cause
104680
+ }))), { "rpc.aggregate": "orchestration" }),
104618
104681
  [ORCHESTRATION_WS_METHODS.subscribeShell]: (_input) => observeRpcStreamEffect(ORCHESTRATION_WS_METHODS.subscribeShell, succeed(makeSnapshotThenLiveStream({
104619
104682
  loadSnapshot: loadInitialShellSnapshot({
104620
104683
  startup,
@@ -210534,6 +210597,11 @@ const PUBLIC_PROVIDER_LEAK_PATTERNS = [
210534
210597
  /https?:\/\/[^\s'"<>)]*(?:apex|deepseek|moonshot|kimi)[^\s'"<>)]*/i
210535
210598
  ];
210536
210599
  const DEFAULT_PUBLIC_PROVIDER_ERROR = "CMMD is temporarily unavailable. Check the workspace AI connection and retry.";
210600
+ function isProviderRateOrQuotaError(message) {
210601
+ if (!message) return false;
210602
+ const normalized = message.toLowerCase();
210603
+ 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);
210604
+ }
210537
210605
  /**
210538
210606
  * Infer a SAFE, clearer failure category from a (possibly leaky) provider error.
210539
210607
  *
@@ -210549,7 +210617,7 @@ function categorizePublicProviderError(message) {
210549
210617
  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.";
210550
210618
  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.";
210551
210619
  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.";
210552
- 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.";
210620
+ if (isProviderRateOrQuotaError(m)) return "The AI service is rate-limited or out of quota. Wait a moment and retry.";
210553
210621
  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.";
210554
210622
  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.";
210555
210623
  return null;
@@ -228180,7 +228248,7 @@ const OpenCodeRuntimeLive = effect(OpenCodeRuntime, makeOpenCodeRuntime).pipe(pr
228180
228248
  //#endregion
228181
228249
  //#region src/provider/Layers/OpenCodeAdapter.ts
228182
228250
  const PROVIDER$5 = "opencode";
228183
- const nowIso$3 = map$3(now, formatIso);
228251
+ const nowIso$4 = map$3(now, formatIso);
228184
228252
  /**
228185
228253
  * Map a tagged OpenCodeRuntimeError produced by {@link runOpenCodeSdk} into
228186
228254
  * the adapter-boundary `ProviderAdapterRequestError`. SDK-method-level call
@@ -228207,7 +228275,7 @@ const toProcessError = (threadId, cause) => new ProviderAdapterProcessError({
228207
228275
  });
228208
228276
  const buildEventBase = (input) => gen(function* () {
228209
228277
  const uuid = yield* nextUUIDv4;
228210
- const createdAt = input.createdAt ?? (yield* nowIso$3);
228278
+ const createdAt = input.createdAt ?? (yield* nowIso$4);
228211
228279
  return {
228212
228280
  eventId: EventId.make(uuid),
228213
228281
  provider: PROVIDER$5,
@@ -228366,7 +228434,7 @@ function sessionErrorMessage(error) {
228366
228434
  }
228367
228435
  function updateProviderSession(context, patch, options) {
228368
228436
  return gen(function* () {
228369
- const updatedAt = yield* nowIso$3;
228437
+ const updatedAt = yield* nowIso$4;
228370
228438
  const nextSession = {
228371
228439
  ...context.session,
228372
228440
  ...patch,
@@ -228488,7 +228556,7 @@ function makeOpenCodeAdapter(openCodeSettings, options) {
228488
228556
  if (("properties" in event ? event.properties.sessionID : void 0) !== context.openCodeSessionId) return;
228489
228557
  const turnId = context.activeTurnId;
228490
228558
  yield* writeNativeEventBestEffort(context.session.threadId, {
228491
- observedAt: yield* nowIso$3,
228559
+ observedAt: yield* nowIso$4,
228492
228560
  event: {
228493
228561
  provider: PROVIDER$5,
228494
228562
  threadId: context.session.threadId,
@@ -228804,7 +228872,7 @@ function makeOpenCodeAdapter(openCodeSettings, options) {
228804
228872
  yield* close(started.sessionScope, void_$3).pipe(ignore);
228805
228873
  return raceWinner.session;
228806
228874
  }
228807
- const createdAt = yield* nowIso$3;
228875
+ const createdAt = yield* nowIso$4;
228808
228876
  const session = {
228809
228877
  provider: PROVIDER$5,
228810
228878
  status: "ready",
@@ -235568,7 +235636,7 @@ function filterEvents(events, options) {
235568
235636
  });
235569
235637
  return options.limit === void 0 ? filtered : filtered.slice(-options.limit);
235570
235638
  }
235571
- function nowIso$2() {
235639
+ function nowIso$3() {
235572
235640
  return (/* @__PURE__ */ new Date()).toISOString();
235573
235641
  }
235574
235642
  //#endregion
@@ -235583,7 +235651,7 @@ var BrowserActionEventRecorder = class {
235583
235651
  type: "browser.action",
235584
235652
  action,
235585
235653
  ...this.sessionFields(),
235586
- timestamp: nowIso$2()
235654
+ timestamp: nowIso$3()
235587
235655
  });
235588
235656
  }
235589
235657
  async result(action) {
@@ -235592,7 +235660,7 @@ var BrowserActionEventRecorder = class {
235592
235660
  action,
235593
235661
  ok: true,
235594
235662
  ...this.sessionFields(),
235595
- timestamp: nowIso$2()
235663
+ timestamp: nowIso$3()
235596
235664
  });
235597
235665
  }
235598
235666
  async error(action, error) {
@@ -235601,7 +235669,7 @@ var BrowserActionEventRecorder = class {
235601
235669
  action,
235602
235670
  error: error instanceof Error ? error.message : String(error),
235603
235671
  ...this.sessionFields(),
235604
- timestamp: nowIso$2()
235672
+ timestamp: nowIso$3()
235605
235673
  });
235606
235674
  }
235607
235675
  sessionFields() {
@@ -236122,7 +236190,7 @@ var AgentBrowser = class {
236122
236190
  await this.options.events?.record({
236123
236191
  type: "browser.safety.confirmation.requested",
236124
236192
  ...request,
236125
- createdAt: nowIso$2()
236193
+ createdAt: nowIso$3()
236126
236194
  });
236127
236195
  const result = await this.resolveConfirmation(request);
236128
236196
  const approved = typeof result === "boolean" ? result : result.approved;
@@ -236130,7 +236198,7 @@ var AgentBrowser = class {
236130
236198
  type: "browser.safety.confirmation.resolved",
236131
236199
  approved,
236132
236200
  requestId: request.requestId,
236133
- resolvedAt: nowIso$2(),
236201
+ resolvedAt: nowIso$3(),
236134
236202
  ...this.events.sessionFields()
236135
236203
  });
236136
236204
  if (!approved) throw new BrowserSafetyError(decision.reason ?? "Browser action was not confirmed.", action, {
@@ -281482,7 +281550,7 @@ const DEFAULT_AGENT_BROWSER_BRIDGE_CLOSE_TIMEOUT_MS = 3e4;
281482
281550
  const DEFAULT_AGENT_BROWSER_PLAYWRIGHT_BACKEND_CLOSE_TIMEOUT_MS = 1e4;
281483
281551
  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.";
281484
281552
  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.";
281485
- function nowIso$1() {
281553
+ function nowIso$2() {
281486
281554
  return (/* @__PURE__ */ new Date()).toISOString();
281487
281555
  }
281488
281556
  function positiveTimeoutMs(value) {
@@ -281582,12 +281650,12 @@ function snapshotAfterTimedOutControl(snapshot, command) {
281582
281650
  case "setViewport": return {
281583
281651
  ...snapshot,
281584
281652
  viewport: command.viewport,
281585
- updatedAt: nowIso$1()
281653
+ updatedAt: nowIso$2()
281586
281654
  };
281587
281655
  case "resetViewport": return {
281588
281656
  ...snapshot,
281589
281657
  viewport: DEFAULT_AGENT_BROWSER_VIEWPORT,
281590
- updatedAt: nowIso$1()
281658
+ updatedAt: nowIso$2()
281591
281659
  };
281592
281660
  default: return snapshot;
281593
281661
  }
@@ -282033,7 +282101,7 @@ function toStreamEvent(input) {
282033
282101
  userId: BrowserUserId.make(input.userId),
282034
282102
  agentId: input.agentId,
282035
282103
  ...input.controlState ? { sessionEpoch: input.controlState.sessionEpoch } : {},
282036
- createdAt: nowIso$1()
282104
+ createdAt: nowIso$2()
282037
282105
  };
282038
282106
  switch (input.event.type) {
282039
282107
  case "session.started": return {
@@ -282334,7 +282402,7 @@ function createAgentBrowserHostBridgeManager(bridge, options) {
282334
282402
  environmentId: event.input.environmentId ?? DEFAULT_BROWSER_ENVIRONMENT_ID,
282335
282403
  userId: event.input.userId ?? "local-user",
282336
282404
  agentId: null,
282337
- createdAt: nowIso$1(),
282405
+ createdAt: nowIso$2(),
282338
282406
  type: "display.iceCandidate",
282339
282407
  payload: {
282340
282408
  sessionId: event.input.sessionId,
@@ -287071,7 +287139,8 @@ const makeRuntimeDrainReporter = gen(function* () {
287071
287139
  ...config,
287072
287140
  activeTurnCount: snapshot.activeTurnCount,
287073
287141
  activeSessionCount: snapshot.activeSessionCount,
287074
- ...forgeGitCommit !== void 0 ? { forgeGitCommit } : {}
287142
+ ...forgeGitCommit !== void 0 ? { forgeGitCommit } : {},
287143
+ forgeServerVersion: installedForgeServerVersion
287075
287144
  });
287076
287145
  });
287077
287146
  const applyControlPlaneState = (runtime) => drainState.applyControlPlaneState({
@@ -294380,7 +294449,7 @@ function resolveBuildCommitFromEnv(env) {
294380
294449
  * environment descriptor down instead of reporting an honest "unknown".
294381
294450
  */
294382
294451
  function readBakedBuildCommit() {
294383
- return "b79da36c868d5629c76dcec88a3326634a02c2c7";
294452
+ return "ebc6c5d85de3dc3324a5054f8f29deb2dd89baa7";
294384
294453
  }
294385
294454
  async function resolveServerBuildCommit(input) {
294386
294455
  if (isFullCommitSha(input.baked)) return input.baked;
@@ -294572,7 +294641,7 @@ const ServerEnvironmentLive = effect(ServerEnvironment, fn$1("makeServerEnvironm
294572
294641
  os,
294573
294642
  arch: platformArch()
294574
294643
  },
294575
- serverVersion: version$1,
294644
+ serverVersion: installedForgeServerVersion,
294576
294645
  ...buildCommit !== void 0 ? { buildCommit } : {},
294577
294646
  ...deviceRuntimeId !== void 0 ? { deviceRuntimeId } : {},
294578
294647
  capabilities: {
@@ -297441,6 +297510,52 @@ function toProjectorDecodeError(eventType) {
297441
297510
  });
297442
297511
  }
297443
297512
  //#endregion
297513
+ //#region src/orchestration/deciderEventBase.ts
297514
+ const nowIso$1 = () => (/* @__PURE__ */ new Date()).toISOString();
297515
+ const defaultMetadata = {
297516
+ eventId: crypto.randomUUID(),
297517
+ aggregateKind: "thread",
297518
+ aggregateId: "",
297519
+ occurredAt: nowIso$1(),
297520
+ commandId: null,
297521
+ causationEventId: null,
297522
+ correlationId: null,
297523
+ metadata: {}
297524
+ };
297525
+ function withEventBase(input) {
297526
+ return {
297527
+ ...defaultMetadata,
297528
+ eventId: crypto.randomUUID(),
297529
+ aggregateKind: input.aggregateKind,
297530
+ aggregateId: input.aggregateId,
297531
+ occurredAt: input.occurredAt,
297532
+ commandId: input.commandId,
297533
+ correlationId: input.commandId,
297534
+ metadata: input.metadata ?? {}
297535
+ };
297536
+ }
297537
+ //#endregion
297538
+ //#region src/orchestration/projectScriptMutation.ts
297539
+ function unchanged(a, b) {
297540
+ return a !== void 0 && a.id === b.id && a.name === b.name && a.command === b.command && a.icon === b.icon && a.runOnWorktreeCreate === b.runOnWorktreeCreate;
297541
+ }
297542
+ const applyProjectScriptMutation = fn$1("applyProjectScriptMutation")(function* (scripts, command) {
297543
+ const mutation = command.mutation;
297544
+ const id = mutation.kind === "add" ? mutation.script.id : mutation.expected.id;
297545
+ const existing = scripts.find((script) => script.id === id);
297546
+ if (mutation.kind === "add" ? existing !== void 0 : !unchanged(existing, mutation.expected)) return yield* new OrchestrationCommandInvariantError({
297547
+ commandType: command.type,
297548
+ detail: "This action changed in another window. Reopen it and try again."
297549
+ });
297550
+ if (mutation.kind === "add") return [...scripts, mutation.script];
297551
+ if (mutation.kind === "remove") return scripts.filter((script) => script.id !== id);
297552
+ if (mutation.script.id !== id) return yield* new OrchestrationCommandInvariantError({
297553
+ commandType: command.type,
297554
+ detail: "An action's ID cannot change during an update."
297555
+ });
297556
+ return scripts.map((script) => script.id === id ? mutation.script : script);
297557
+ });
297558
+ //#endregion
297444
297559
  //#region src/orchestration/turnAccountSelection.ts
297445
297560
  /** A per-turn account choice remains local to the thread and cannot change its provider. */
297446
297561
  function turnAccountSelection(current, requested) {
@@ -297497,28 +297612,6 @@ function requireThreadAbsent(input) {
297497
297612
  //#endregion
297498
297613
  //#region src/orchestration/decider.ts
297499
297614
  const nowIso = () => (/* @__PURE__ */ new Date()).toISOString();
297500
- const defaultMetadata = {
297501
- eventId: crypto.randomUUID(),
297502
- aggregateKind: "thread",
297503
- aggregateId: "",
297504
- occurredAt: nowIso(),
297505
- commandId: null,
297506
- causationEventId: null,
297507
- correlationId: null,
297508
- metadata: {}
297509
- };
297510
- function withEventBase(input) {
297511
- return {
297512
- ...defaultMetadata,
297513
- eventId: crypto.randomUUID(),
297514
- aggregateKind: input.aggregateKind,
297515
- aggregateId: input.aggregateId,
297516
- occurredAt: input.occurredAt,
297517
- commandId: input.commandId,
297518
- correlationId: input.commandId,
297519
- metadata: input.metadata ?? {}
297520
- };
297521
- }
297522
297615
  function requireOrdinaryMessageId(commandType, messageId) {
297523
297616
  return isReservedReplicaSourceMessageId(messageId) ? fail(new OrchestrationCommandInvariantError({
297524
297617
  commandType,
@@ -297571,6 +297664,22 @@ const decideOrchestrationCommand = fn$1("decideOrchestrationCommand")(function*
297571
297664
  updatedAt: command.createdAt
297572
297665
  }
297573
297666
  };
297667
+ case "project.script.update": {
297668
+ const scripts = yield* applyProjectScriptMutation((yield* requireProject({
297669
+ readModel,
297670
+ command,
297671
+ projectId: command.projectId
297672
+ })).scripts, command);
297673
+ return yield* decideOrchestrationCommand({
297674
+ readModel,
297675
+ command: {
297676
+ type: "project.meta.update",
297677
+ commandId: command.commandId,
297678
+ projectId: command.projectId,
297679
+ scripts
297680
+ }
297681
+ });
297682
+ }
297574
297683
  case "project.meta.update": {
297575
297684
  yield* requireProject({
297576
297685
  readModel,
@@ -298857,6 +298966,7 @@ function commandToAggregateRef(command) {
298857
298966
  switch (command.type) {
298858
298967
  case "project.create":
298859
298968
  case "project.meta.update":
298969
+ case "project.script.update":
298860
298970
  case "project.delete": return {
298861
298971
  aggregateKind: "project",
298862
298972
  aggregateId: command.projectId
@@ -301321,6 +301431,54 @@ const OrchestrationInfrastructureLayerLive = mergeAll(effect(ProjectionSnapshotQ
301321
301431
  AND deleted_at IS NULL
301322
301432
  AND archived_at IS NULL
301323
301433
  ORDER BY created_at ASC, thread_id ASC
301434
+ `
301435
+ });
301436
+ /**
301437
+ * The archive's own rows.
301438
+ *
301439
+ * `listThreadRows` deliberately carries archived threads too, because the
301440
+ * active list needs `archivedAt` to know what to hide and the web archive
301441
+ * panel filters that same snapshot client side. This query is the opposite
301442
+ * selection, for the clients that ask for the archive directly.
301443
+ */
301444
+ const listArchivedThreadRows = findAll({
301445
+ Request: Void,
301446
+ Result: ProjectionThreadDbRowSchema,
301447
+ execute: () => sql`
301448
+ SELECT
301449
+ thread_id AS "threadId",
301450
+ project_id AS "projectId",
301451
+ title,
301452
+ model_selection_json AS "modelSelection",
301453
+ runtime_mode AS "runtimeMode",
301454
+ interaction_mode AS "interactionMode",
301455
+ branch,
301456
+ worktree_path AS "worktreePath",
301457
+ latest_turn_id AS "latestTurnId",
301458
+ created_at AS "createdAt",
301459
+ updated_at AS "updatedAt",
301460
+ archived_at AS "archivedAt",
301461
+ settled_at AS "settledAt",
301462
+ settled_override AS "settledOverride",
301463
+ latest_user_message_at AS "latestUserMessageAt",
301464
+ pending_approval_count AS "pendingApprovalCount",
301465
+ pending_user_input_count AS "pendingUserInputCount",
301466
+ has_actionable_proposed_plan AS "hasActionableProposedPlan",
301467
+ deleted_at AS "deletedAt",
301468
+ kind,
301469
+ parent_thread_id AS "parentThreadId",
301470
+ anchor_kind AS "anchorKind",
301471
+ anchor_cmmd_id AS "anchorCmmdId",
301472
+ linked_pull_request_json AS "linkedPullRequest",
301473
+ status,
301474
+ worker_role AS "workerRole",
301475
+ goal,
301476
+ pending_auto_create_prompt_json AS "pendingAutoCreatePrompt",
301477
+ COALESCE(rate_limit_status_json, '[]') AS "rateLimitStatus"
301478
+ FROM projection_threads
301479
+ WHERE archived_at IS NOT NULL
301480
+ AND deleted_at IS NULL
301481
+ ORDER BY archived_at DESC, thread_id ASC
301324
301482
  `
301325
301483
  });
301326
301484
  const listThreadMessageRows = findAll({
@@ -301975,13 +302133,22 @@ const OrchestrationInfrastructureLayerLive = mergeAll(effect(ProjectionSnapshotQ
301975
302133
  if (isPersistenceError(error)) return error;
301976
302134
  return toPersistenceSqlError("ProjectionSnapshotQuery.getSnapshot:query")(error);
301977
302135
  }));
301978
- const getShellSnapshot = () => {
302136
+ /**
302137
+ * One snapshot assembly, two selections of threads.
302138
+ *
302139
+ * The active list and the archive differ only in which thread rows they
302140
+ * read, so they share this body. Keeping them on one mapper is the point:
302141
+ * FOR-36394 was a projected column that one path carried and another
302142
+ * dropped, and a second hand-copied assembly here would invite the same
302143
+ * failure for anyone who only remembered to update the active list.
302144
+ */
302145
+ const readShellSnapshot = (operation, listThreads) => {
301979
302146
  return sql.withTransaction(all([
301980
- listProjectRows(void 0).pipe(mapError(toPersistenceSqlOrDecodeError("ProjectionSnapshotQuery.getShellSnapshot:listProjects:query", "ProjectionSnapshotQuery.getShellSnapshot:listProjects:decodeRows"))),
301981
- listThreadRows(void 0).pipe(mapError(toPersistenceSqlOrDecodeError("ProjectionSnapshotQuery.getShellSnapshot:listThreads:query", "ProjectionSnapshotQuery.getShellSnapshot:listThreads:decodeRows"))),
301982
- listThreadSessionRows(void 0).pipe(mapError(toPersistenceSqlOrDecodeError("ProjectionSnapshotQuery.getShellSnapshot:listThreadSessions:query", "ProjectionSnapshotQuery.getShellSnapshot:listThreadSessions:decodeRows"))),
301983
- listLatestTurnRows(void 0).pipe(mapError(toPersistenceSqlOrDecodeError("ProjectionSnapshotQuery.getShellSnapshot:listLatestTurns:query", "ProjectionSnapshotQuery.getShellSnapshot:listLatestTurns:decodeRows"))),
301984
- listProjectionStateRows(void 0).pipe(mapError(toPersistenceSqlOrDecodeError("ProjectionSnapshotQuery.getShellSnapshot:listProjectionState:query", "ProjectionSnapshotQuery.getShellSnapshot:listProjectionState:decodeRows")))
302147
+ listProjectRows(void 0).pipe(mapError(toPersistenceSqlOrDecodeError(`ProjectionSnapshotQuery.${operation}:listProjects:query`, `ProjectionSnapshotQuery.${operation}:listProjects:decodeRows`))),
302148
+ listThreads(void 0).pipe(mapError(toPersistenceSqlOrDecodeError(`ProjectionSnapshotQuery.${operation}:listThreads:query`, `ProjectionSnapshotQuery.${operation}:listThreads:decodeRows`))),
302149
+ listThreadSessionRows(void 0).pipe(mapError(toPersistenceSqlOrDecodeError(`ProjectionSnapshotQuery.${operation}:listThreadSessions:query`, `ProjectionSnapshotQuery.${operation}:listThreadSessions:decodeRows`))),
302150
+ listLatestTurnRows(void 0).pipe(mapError(toPersistenceSqlOrDecodeError(`ProjectionSnapshotQuery.${operation}:listLatestTurns:query`, `ProjectionSnapshotQuery.${operation}:listLatestTurns:decodeRows`))),
302151
+ listProjectionStateRows(void 0).pipe(mapError(toPersistenceSqlOrDecodeError(`ProjectionSnapshotQuery.${operation}:listProjectionState:query`, `ProjectionSnapshotQuery.${operation}:listProjectionState:decodeRows`)))
301985
302152
  ])).pipe(flatMap(([projectRows, threadRows, sessionRows, latestTurnRows, stateRows]) => gen(function* () {
301986
302153
  let updatedAt = null;
301987
302154
  for (const row of projectRows) updatedAt = maxIso(updatedAt, row.updatedAt);
@@ -302002,12 +302169,14 @@ const OrchestrationInfrastructureLayerLive = mergeAll(effect(ProjectionSnapshotQ
302002
302169
  projects: projectRows.filter((row) => row.deletedAt === null).map((row) => mapProjectShellRow(row, repositoryIdentities.get(row.projectId) ?? null, projectAvailabilities.get(row.projectId) ?? "unknown")),
302003
302170
  threads: threadShells.filter((thread) => projectIds.has(thread.projectId)),
302004
302171
  updatedAt: updatedAt ?? (/* @__PURE__ */ new Date(0)).toISOString()
302005
- }).pipe(mapError(toPersistenceDecodeError("ProjectionSnapshotQuery.getShellSnapshot:decodeShellSnapshot")));
302172
+ }).pipe(mapError(toPersistenceDecodeError(`ProjectionSnapshotQuery.${operation}:decodeShellSnapshot`)));
302006
302173
  })), mapError((error) => {
302007
302174
  if (isPersistenceError(error)) return error;
302008
- return toPersistenceSqlError("ProjectionSnapshotQuery.getShellSnapshot:query")(error);
302175
+ return toPersistenceSqlError(`ProjectionSnapshotQuery.${operation}:query`)(error);
302009
302176
  }));
302010
302177
  };
302178
+ const getShellSnapshot = () => readShellSnapshot("getShellSnapshot", listThreadRows);
302179
+ const getArchivedShellSnapshot = () => readShellSnapshot("getArchivedShellSnapshot", listArchivedThreadRows);
302011
302180
  const listActiveWorkerShells = () => sql.withTransaction(all([
302012
302181
  listActiveWorkerThreadRows(void 0).pipe(mapError(toPersistenceSqlOrDecodeError("ProjectionSnapshotQuery.listActiveWorkerShells:listThreads:query", "ProjectionSnapshotQuery.listActiveWorkerShells:listThreads:decodeRows"))),
302013
302182
  listActiveWorkerSessionRows(void 0).pipe(mapError(toPersistenceSqlOrDecodeError("ProjectionSnapshotQuery.listActiveWorkerShells:listThreadSessions:query", "ProjectionSnapshotQuery.listActiveWorkerShells:listThreadSessions:decodeRows"))),
@@ -302174,6 +302343,7 @@ const OrchestrationInfrastructureLayerLive = mergeAll(effect(ProjectionSnapshotQ
302174
302343
  return {
302175
302344
  getSnapshot,
302176
302345
  getShellSnapshot,
302346
+ getArchivedShellSnapshot,
302177
302347
  listActiveWorkerShells,
302178
302348
  listStaleRunningSessionShells,
302179
302349
  getCounts,
@@ -306163,7 +306333,6 @@ const cmmdUpdateProjectAgentMemberAvatarRouteLayer = registerProxyRoute({
306163
306333
  });
306164
306334
  //#endregion
306165
306335
  //#region src/command/runtimeProviderAuthorityUpgradeModel.ts
306166
- const GIT_COMMIT = /^[0-9a-f]{40}$/u;
306167
306336
  const AUTHORITY_UPGRADE_OPERATION_KEYS = new Set([
306168
306337
  "operationId",
306169
306338
  "runtimeId",
@@ -306173,7 +306342,7 @@ const AUTHORITY_UPGRADE_OPERATION_KEYS = new Set([
306173
306342
  "attemptCount",
306174
306343
  "expectedCredentialEpoch",
306175
306344
  "resultingCredentialEpoch",
306176
- "targetForgeGitCommit",
306345
+ "targetForgeServerVersion",
306177
306346
  "retryAt",
306178
306347
  "completedAt",
306179
306348
  "failureCode"
@@ -306241,7 +306410,7 @@ function parseRuntimeAuthorityUpgradeOperation(value, expected) {
306241
306410
  Number.isSafeInteger(operation.attemptCount) && operation.attemptCount >= 0,
306242
306411
  operation.expectedCredentialEpoch === 0,
306243
306412
  operation.resultingCredentialEpoch === 1,
306244
- typeof operation.targetForgeGitCommit === "string" && GIT_COMMIT.test(operation.targetForgeGitCommit),
306413
+ isExactForgeServerVersion(operation.targetForgeServerVersion),
306245
306414
  isNullableDateTime(operation.retryAt),
306246
306415
  isNullableDateTime(operation.completedAt),
306247
306416
  operation.failureCode === null || typeof operation.failureCode === "string",
@@ -306258,6 +306427,7 @@ function isLegacyRuntimeConnection(value, expectedRuntimeId) {
306258
306427
  runtime.brokerAuthorityAttestedImageRef === null,
306259
306428
  runtime.brokerAuthorityAttestedImageVersion === null,
306260
306429
  runtime.brokerAuthorityAttestedForgeGitCommit === null,
306430
+ runtime.brokerAuthorityAttestedForgeServerVersion === null,
306261
306431
  runtime.brokerAuthorityAttestedMachineId === null,
306262
306432
  runtime.brokerAuthorityAttestedCredentialEpoch === null,
306263
306433
  runtime.brokerAuthorityAttestedAt === null
@@ -306421,13 +306591,13 @@ function hasTrustedRuntimeRoute(url, trustedBase) {
306421
306591
  const relativePath = url.pathname.slice(trustedPrefix.length);
306422
306592
  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);
306423
306593
  }
306424
- function hasExactRuntimeConnectionFields(data, runtime, expectedRuntimeId, expectedAttestedForgeGitCommit) {
306425
- 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);
306594
+ function hasExactRuntimeConnectionFields(data, runtime, expectedRuntimeId, expectedAttestedForgeServerVersion) {
306595
+ 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);
306426
306596
  }
306427
- function parseRuntimeConnection(value, expectedRuntimeId, trustedRuntimeRouterBaseUrl, expectedAttestedForgeGitCommit) {
306597
+ function parseRuntimeConnection(value, expectedRuntimeId, trustedRuntimeRouterBaseUrl, expectedAttestedForgeServerVersion) {
306428
306598
  const data = asRecord$1(unwrapData(value));
306429
306599
  const runtime = asRecord$1(data?.runtime);
306430
- if (!data || !runtime || !hasExactRuntimeConnectionFields(data, runtime, expectedRuntimeId, expectedAttestedForgeGitCommit)) return null;
306600
+ if (!data || !runtime || !hasExactRuntimeConnectionFields(data, runtime, expectedRuntimeId, expectedAttestedForgeServerVersion)) return null;
306431
306601
  const trustedBase = parseTrustedRuntimeRouterBaseUrl(trustedRuntimeRouterBaseUrl);
306432
306602
  if (!trustedBase) return null;
306433
306603
  let httpBaseUrl;
@@ -306607,7 +306777,7 @@ function classifyInitialConnection(outcome, runtimeId, trustedRuntimeRouterBaseU
306607
306777
  }
306608
306778
  };
306609
306779
  }
306610
- function reconnectExactRuntime(input, targetForgeGitCommit) {
306780
+ function reconnectExactRuntime(input, targetForgeServerVersion) {
306611
306781
  return gen(function* () {
306612
306782
  const connectPath = `/api/forge/context/runtimes/${encodeURIComponent(input.runtimeId)}/connect`;
306613
306783
  const reconnected = yield* postRuntimeProviderCmmd({
@@ -306624,7 +306794,7 @@ function reconnectExactRuntime(input, targetForgeGitCommit) {
306624
306794
  error: reconnected.error,
306625
306795
  stage: "reconnect"
306626
306796
  };
306627
- const exact = parseRuntimeConnection(reconnected.value, input.runtimeId, input.trustedRuntimeRouterBaseUrl, targetForgeGitCommit);
306797
+ const exact = parseRuntimeConnection(reconnected.value, input.runtimeId, input.trustedRuntimeRouterBaseUrl, targetForgeServerVersion);
306628
306798
  return exact ? {
306629
306799
  ok: true,
306630
306800
  value: exact
@@ -306635,7 +306805,7 @@ function reconnectExactRuntime(input, targetForgeGitCommit) {
306635
306805
  });
306636
306806
  }
306637
306807
  function resolveOperation(input, operation) {
306638
- return operation.status === "completed" ? reconnectExactRuntime(input, operation.targetForgeGitCommit) : succeed(pendingOperation(operation));
306808
+ return operation.status === "completed" ? reconnectExactRuntime(input, operation.targetForgeServerVersion) : succeed(pendingOperation(operation));
306639
306809
  }
306640
306810
  function beginExactRuntimeConnection(input) {
306641
306811
  return gen(function* () {