@cmmd-center/forge 0.10.12 → 0.10.14

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 (55) hide show
  1. package/dist/{BunHttpServer-CjwNydcy.cjs → BunHttpServer-BhE7Szci.cjs} +6 -6
  2. package/dist/{BunHttpServer-GM72b26K.mjs → BunHttpServer-VI75aqJw.mjs} +6 -6
  3. package/dist/{BunPTY-B4Ra6mph.cjs → BunPTY-86ttlTi6.cjs} +3 -3
  4. package/dist/{BunPTY-C_ONQ8rt.mjs → BunPTY-oVISucl_.mjs} +3 -3
  5. package/dist/{BunServices-CUeOgVUt.cjs → BunServices-BwE9KexF.cjs} +3 -3
  6. package/dist/{BunServices-B-6JkR0Q.mjs → BunServices-D0JTDujL.mjs} +3 -3
  7. package/dist/{Cache-D56wNKiH.cjs → Cache-CWlxNDbC.cjs} +6 -6
  8. package/dist/{Cache-da-A9JAa.mjs → Cache-p0X77SKw.mjs} +3 -3
  9. package/dist/{Config-D0zF6ChD.mjs → Config-AqUR_lhX.mjs} +2 -2
  10. package/dist/{Config-e5bi-5Ut.cjs → Config-CkEzdD9L.cjs} +2 -2
  11. package/dist/{HttpServer-B-QOc7bR.cjs → HttpServer-DGoLR-kU.cjs} +4 -4
  12. package/dist/{HttpServer-HhjqDZlB.mjs → HttpServer-DNGCTTdk.mjs} +3 -3
  13. package/dist/{NodeHttpServer-Cy1XvkSE.cjs → NodeHttpServer-BPjxt_DT.cjs} +7 -7
  14. package/dist/{NodeHttpServer-DmEyd0J4.mjs → NodeHttpServer-Dw7ivXfX.mjs} +7 -7
  15. package/dist/{NodePTY-DU_KoZdd.mjs → NodePTY-CVH2yNYl.mjs} +4 -4
  16. package/dist/{NodePTY-wATyTf3M.cjs → NodePTY-Cps0jsDA.cjs} +4 -4
  17. package/dist/{NodeServices-DeNLW36O.mjs → NodeServices-CBNXOYLG.mjs} +3 -3
  18. package/dist/{NodeServices-pfwgkiUu.cjs → NodeServices-Cw6SxEbl.cjs} +3 -3
  19. package/dist/{NodeServices-BqfcuvmN.cjs → NodeServices-Ddr-tYRu.cjs} +1 -1
  20. package/dist/{NodeSqliteClient-PZ6NN2gq.cjs → NodeSqliteClient-CmxPzcBf.cjs} +7 -7
  21. package/dist/{NodeSqliteClient-BqUcml1B.mjs → NodeSqliteClient-DGInbxQ3.mjs} +6 -6
  22. package/dist/{NodeTerminal-DfKMT-mE.cjs → NodeTerminal-5iWbO0B2.cjs} +6 -6
  23. package/dist/{NodeTerminal-DBDxXuu0.mjs → NodeTerminal-BEGtoMSS.mjs} +3 -3
  24. package/dist/{PTY-DB-DmqyE.cjs → PTY-BxYDiW3h.cjs} +2 -2
  25. package/dist/{PTY-DdjcAGrF.mjs → PTY-rIPf52QR.mjs} +2 -2
  26. package/dist/{Path-CHDjKLrB.cjs → Path-Be7zSwar.cjs} +281 -54
  27. package/dist/{Path-B0vKGzx2.mjs → Path-C6Zb2WHp.mjs} +271 -58
  28. package/dist/{Schema-BK7-mN_J.mjs → Schema-CJyk7ah1.mjs} +65 -3
  29. package/dist/{Schema-Cf_uEUQU.cjs → Schema-dLi7Qssy.cjs} +76 -2
  30. package/dist/{SqlError-Du_dEWbw.cjs → SqlError-Bt0Bcd5C.cjs} +4 -4
  31. package/dist/{SqlError-LFObCDir.mjs → SqlError-cyJT2IRY.mjs} +3 -3
  32. package/dist/{SqliteClient-D4Srj6O8.cjs → SqliteClient-B08FzZM4.cjs} +6 -6
  33. package/dist/{SqliteClient-DdItRZUr.mjs → SqliteClient-CIsITMoQ.mjs} +5 -5
  34. package/dist/bin.cjs +164 -70
  35. package/dist/bin.mjs +291 -197
  36. package/dist/client/assets/{CanvasPanel-mbL7UwXT.js → CanvasPanel-Cogtmutb.js} +2 -2
  37. package/dist/client/assets/{CompositeItem-Dm91tFrl.js → CompositeItem-D6h2WFmU.js} +2 -2
  38. package/dist/client/assets/{DiffPanel-Wf-m_tDJ.js → DiffPanel-Bnkifxef.js} +3 -3
  39. package/dist/client/assets/{DiffPanel.logic-Bvxf3m-9.js → DiffPanel.logic-Bk4d9mRT.js} +2 -2
  40. package/dist/client/assets/{DiffPanelShell-Cs-XLDgV.js → DiffPanelShell-D_nSDbjF.js} +104 -104
  41. package/dist/client/assets/{DiffWorkerPoolProvider-KeQJ1rQG.js → DiffWorkerPoolProvider-BO-u17g1.js} +9 -9
  42. package/dist/client/assets/{PullRequestCodePanel-BtdEznt0.js → PullRequestCodePanel-Bbuxcu5g.js} +3 -3
  43. package/dist/client/assets/{Virtualizer-C4HGxrvR.js → Virtualizer-BxZHsCOD.js} +2 -2
  44. package/dist/client/assets/{canvasStateStore-CqQQvGP5.js → canvasStateStore-DUZyBLSv.js} +2 -2
  45. package/dist/client/assets/{cmmdAuthRedirect-Dm6mOZMB.js → cmmdAuthRedirect-Bkc6Luqb.js} +2 -2
  46. package/dist/client/assets/{index-CUmbThfW.css → index-BMcOaHS_.css} +1 -1
  47. package/dist/client/assets/{index-DOFEIuQg.js → index-BeMh8T3m.js} +59 -59
  48. package/dist/client/assets/src-BlF9iHm-.js +3 -0
  49. package/dist/client/assets/{toggle-dld7kzOP.js → toggle-CWmPePti.js} +2 -2
  50. package/dist/client/assets/{useTriggerFocusGuards-DPZ1smix.js → useTriggerFocusGuards-O7DUCec0.js} +2 -2
  51. package/dist/client/index.html +11 -11
  52. package/dist/forge-build.json +1 -1
  53. package/dist/{open-D8mGyWmt.mjs → open-FIgTDosf.mjs} +3 -3
  54. package/package.json +1 -1
  55. package/dist/client/assets/src-BOr7-dep.js +0 -3
package/dist/bin.cjs CHANGED
@@ -2,18 +2,18 @@
2
2
 
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
4
  const require_chunk = require("./chunk-BhaIgcZK.cjs");
5
- const require_Schema$1 = require("./Schema-Cf_uEUQU.cjs");
6
- const require_Path = require("./Path-CHDjKLrB.cjs");
7
- const require_NodeTerminal = require("./NodeTerminal-DfKMT-mE.cjs");
8
- const require_NodeServices = require("./NodeServices-pfwgkiUu.cjs");
9
- const require_HttpServer = require("./HttpServer-B-QOc7bR.cjs");
10
- const require_Config = require("./Config-e5bi-5Ut.cjs");
11
- const require_Cache = require("./Cache-D56wNKiH.cjs");
12
- const require_SqlError = require("./SqlError-Du_dEWbw.cjs");
5
+ const require_Schema$1 = require("./Schema-dLi7Qssy.cjs");
6
+ const require_Path = require("./Path-Be7zSwar.cjs");
7
+ const require_NodeTerminal = require("./NodeTerminal-5iWbO0B2.cjs");
8
+ const require_NodeServices = require("./NodeServices-Cw6SxEbl.cjs");
9
+ const require_HttpServer = require("./HttpServer-DGoLR-kU.cjs");
10
+ const require_Config = require("./Config-CkEzdD9L.cjs");
11
+ const require_Cache = require("./Cache-CWlxNDbC.cjs");
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
15
  const require_runtimeControlAuthority = require("./runtimeControlAuthority-BdIovv-r.cjs");
16
- const require_PTY = require("./PTY-DB-DmqyE.cjs");
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);
19
19
  let node_stream = require("node:stream");
@@ -18674,16 +18674,81 @@ const CLAUDE_CODE_EFFORT_OPTIONS = [
18674
18674
  const CODEX_DEFAULT_MODEL = "gpt-6-astra";
18675
18675
  const CODEX_SPARK_MODEL = "gpt-5.3-codex-spark";
18676
18676
  const CLAUDE_DEFAULT_MODEL = "claude-fable-5-1";
18677
- const CodexModelOptions = require_Schema$1.Struct({
18677
+ /**
18678
+ * Generic option value carried by ACP-based provider adapters (cursor, opencode).
18679
+ * Used to pass per-turn options like reasoning effort or thinking toggles to
18680
+ * the agent without baking them into model-specific schemas.
18681
+ *
18682
+ * Mirrors t3code's @t3tools/contracts ProviderOptionSelection — required by
18683
+ * the ported ACP runtime (apps/server/src/provider/acp/*) so cursor + opencode
18684
+ * adapters can carry user-selected reasoning levels through the session.
18685
+ */
18686
+ const ProviderOptionSelectionValue = require_Schema$1.Union([TrimmedNonEmptyString, require_Schema$1.Boolean]);
18687
+ const ProviderOptionSelection = require_Schema$1.Struct({
18688
+ id: TrimmedNonEmptyString,
18689
+ value: ProviderOptionSelectionValue
18690
+ });
18691
+ /**
18692
+ * The object form on its own, exported so callers that need the individual
18693
+ * field schemas can reach them. The exported `CodexModelOptions` below is a
18694
+ * union and has no `.fields`.
18695
+ */
18696
+ const CodexModelOptionsObject = require_Schema$1.Struct({
18678
18697
  reasoningEffort: require_Schema$1.optional(require_Schema$1.Literals(CODEX_REASONING_EFFORT_OPTIONS)),
18679
18698
  fastMode: require_Schema$1.optional(require_Schema$1.Boolean)
18680
18699
  });
18681
- const ClaudeModelOptions = require_Schema$1.Struct({
18700
+ /** The object form on its own; see {@link CodexModelOptionsObject}. */
18701
+ const ClaudeModelOptionsObject = require_Schema$1.Struct({
18682
18702
  thinking: require_Schema$1.optional(require_Schema$1.Boolean),
18683
18703
  effort: require_Schema$1.optional(require_Schema$1.Literals(CLAUDE_CODE_EFFORT_OPTIONS)),
18684
18704
  fastMode: require_Schema$1.optional(require_Schema$1.Boolean),
18685
18705
  contextWindow: require_Schema$1.optional(require_Schema$1.String)
18686
18706
  });
18707
+ /**
18708
+ * `[{ id, value }]` folded into `{ [id]: value }`.
18709
+ *
18710
+ * Duplicate ids keep the last, which is what an object literal would have done
18711
+ * had the sender used one.
18712
+ */
18713
+ function selectionArrayToRecord(selections) {
18714
+ const record = {};
18715
+ for (const { id, value } of selections) record[id] = value;
18716
+ return record;
18717
+ }
18718
+ function recordToSelectionArray(value) {
18719
+ if (typeof value !== "object" || value === null) return [];
18720
+ return Object.entries(value).flatMap(([id, entry]) => typeof entry === "string" || typeof entry === "boolean" ? [{
18721
+ id,
18722
+ value: entry
18723
+ }] : []);
18724
+ }
18725
+ /**
18726
+ * Also accept the option array that t3code-derived clients send.
18727
+ *
18728
+ * Forge's own surfaces send `{ reasoningEffort: "high" }`. The vendored mobile
18729
+ * client encodes the same choice as `[{ id: "reasoningEffort", value: "high" }]`,
18730
+ * its canonical shape, and the two contract packages never compare notes. So a
18731
+ * person picking a reasoning effort on the phone produced a `startTurn` payload
18732
+ * the server refused outright with "Expected object, got [...]" — not a dropped
18733
+ * option, a turn that never ran at all.
18734
+ *
18735
+ * Tolerated here rather than changed in the vendored encoder: this accepts both
18736
+ * shapes from any client, while `@t3tools/contracts` keeps the canonical form
18737
+ * it shares with upstream. The array is normalised into the object the provider
18738
+ * adapters already read, so nothing downstream learns a second shape.
18739
+ *
18740
+ * The object member stays first because it is what every Forge surface sends.
18741
+ * `Schema.Struct` rejects an array outright rather than decoding it to an empty
18742
+ * object, so an array falls through to the member built for it.
18743
+ */
18744
+ const CodexModelOptions = require_Schema$1.Union([CodexModelOptionsObject, require_Schema$1.ArraySchema(ProviderOptionSelection).pipe(require_Schema$1.decodeTo(CodexModelOptionsObject, require_Schema$1.transformOrFail({
18745
+ decode: (selections) => require_Schema$1.succeed(selectionArrayToRecord(selections)),
18746
+ encode: (value) => require_Schema$1.succeed(recordToSelectionArray(value))
18747
+ })))]);
18748
+ const ClaudeModelOptions = require_Schema$1.Union([ClaudeModelOptionsObject, require_Schema$1.ArraySchema(ProviderOptionSelection).pipe(require_Schema$1.decodeTo(ClaudeModelOptionsObject, require_Schema$1.transformOrFail({
18749
+ decode: (selections) => require_Schema$1.succeed(selectionArrayToRecord(selections)),
18750
+ encode: (value) => require_Schema$1.succeed(recordToSelectionArray(value))
18751
+ })))]);
18687
18752
  require_Schema$1.Struct({
18688
18753
  codex: require_Schema$1.optional(CodexModelOptions),
18689
18754
  claudeAgent: require_Schema$1.optional(ClaudeModelOptions),
@@ -18710,20 +18775,6 @@ const ModelCapabilities = require_Schema$1.Struct({
18710
18775
  contextWindowOptions: require_Schema$1.ArraySchema(ContextWindowOption),
18711
18776
  promptInjectedEffortLevels: require_Schema$1.ArraySchema(TrimmedNonEmptyString)
18712
18777
  });
18713
- /**
18714
- * Generic option value carried by ACP-based provider adapters (cursor, opencode).
18715
- * Used to pass per-turn options like reasoning effort or thinking toggles to
18716
- * the agent without baking them into model-specific schemas.
18717
- *
18718
- * Mirrors t3code's @t3tools/contracts ProviderOptionSelection — required by
18719
- * the ported ACP runtime (apps/server/src/provider/acp/*) so cursor + opencode
18720
- * adapters can carry user-selected reasoning levels through the session.
18721
- */
18722
- const ProviderOptionSelectionValue = require_Schema$1.Union([TrimmedNonEmptyString, require_Schema$1.Boolean]);
18723
- const ProviderOptionSelection = require_Schema$1.Struct({
18724
- id: TrimmedNonEmptyString,
18725
- value: ProviderOptionSelectionValue
18726
- });
18727
18778
  function effortLabel(value) {
18728
18779
  switch (value) {
18729
18780
  case "xhigh": return "Extra High";
@@ -22376,14 +22427,14 @@ var ServerSettingsError = class extends require_Schema$1.TaggedErrorClass()("Ser
22376
22427
  ...DEFAULT_CLIENT_SETTINGS
22377
22428
  });
22378
22429
  const CodexModelOptionsPatch = require_Schema$1.Struct({
22379
- reasoningEffort: require_Schema$1.optionalKey(CodexModelOptions.fields.reasoningEffort),
22380
- fastMode: require_Schema$1.optionalKey(CodexModelOptions.fields.fastMode)
22430
+ reasoningEffort: require_Schema$1.optionalKey(CodexModelOptionsObject.fields.reasoningEffort),
22431
+ fastMode: require_Schema$1.optionalKey(CodexModelOptionsObject.fields.fastMode)
22381
22432
  });
22382
22433
  const ClaudeModelOptionsPatch = require_Schema$1.Struct({
22383
- thinking: require_Schema$1.optionalKey(ClaudeModelOptions.fields.thinking),
22384
- effort: require_Schema$1.optionalKey(ClaudeModelOptions.fields.effort),
22385
- fastMode: require_Schema$1.optionalKey(ClaudeModelOptions.fields.fastMode),
22386
- contextWindow: require_Schema$1.optionalKey(ClaudeModelOptions.fields.contextWindow)
22434
+ thinking: require_Schema$1.optionalKey(ClaudeModelOptionsObject.fields.thinking),
22435
+ effort: require_Schema$1.optionalKey(ClaudeModelOptionsObject.fields.effort),
22436
+ fastMode: require_Schema$1.optionalKey(ClaudeModelOptionsObject.fields.fastMode),
22437
+ contextWindow: require_Schema$1.optionalKey(ClaudeModelOptionsObject.fields.contextWindow)
22387
22438
  });
22388
22439
  const ModelSelectionPatch = require_Schema$1.Union([require_Schema$1.Struct({
22389
22440
  provider: require_Schema$1.optionalKey(require_Schema$1.Literal("codex")),
@@ -65724,7 +65775,7 @@ function normalizeNumberish(value) {
65724
65775
  }
65725
65776
  //#endregion
65726
65777
  //#region package.json
65727
- var version$1 = "0.10.12";
65778
+ var version$1 = "0.10.14";
65728
65779
  //#endregion
65729
65780
  //#region src/sentry.ts
65730
65781
  const SERVER_APP_NAME = "forge-server";
@@ -75358,7 +75409,7 @@ const makeNoSerialization = /* @__PURE__ */ require_Schema$1.fnUntraced(function
75358
75409
  const services = yield* require_Schema$1.context();
75359
75410
  const scope = require_Schema$1.get(services, require_Schema$1.Scope);
75360
75411
  const trackFiber = require_Path.runIn(require_Schema$1.forkUnsafe(scope, "parallel"));
75361
- const concurrencySemaphore = concurrency === "unbounded" ? void 0 : yield* require_Path.make$4(concurrency);
75412
+ const concurrencySemaphore = concurrency === "unbounded" ? void 0 : yield* require_Path.make$5(concurrency);
75362
75413
  const clients = /* @__PURE__ */ new Map();
75363
75414
  let isShutdown = false;
75364
75415
  const shutdownLatch = require_Path.makeUnsafe$1(false);
@@ -75767,7 +75818,7 @@ const toHttpEffectWebsocket = /* @__PURE__ */ require_Schema$1.fnUntraced(functi
75767
75818
  });
75768
75819
  const makeSocketProtocol = /* @__PURE__ */ require_Schema$1.gen(function* () {
75769
75820
  const serialization = yield* RpcSerialization;
75770
- const disconnects = yield* require_Path.make$5();
75821
+ const disconnects = yield* require_Path.make$6();
75771
75822
  let clientId = 0;
75772
75823
  const clients = /* @__PURE__ */ new Map();
75773
75824
  const clientIds = /* @__PURE__ */ new Set();
@@ -82957,7 +83008,7 @@ const makeServerSettings = require_Schema$1.gen(function* () {
82957
83008
  const { settingsPath } = yield* ServerConfig;
82958
83009
  const fs = yield* require_Path.FileSystem;
82959
83010
  const pathService = yield* require_Path.Path;
82960
- const writeSemaphore = yield* require_Path.make$4(1);
83011
+ const writeSemaphore = yield* require_Path.make$5(1);
82961
83012
  const cacheKey = "settings";
82962
83013
  const changesPubSub = yield* require_Path.unbounded$1();
82963
83014
  const startedRef = yield* require_HttpServer.make$3(false);
@@ -91805,7 +91856,7 @@ const makeKeybindings = require_Schema$1.gen(function* () {
91805
91856
  const { keybindingsConfigPath } = yield* ServerConfig;
91806
91857
  const fs = yield* require_Path.FileSystem;
91807
91858
  const path = yield* require_Path.Path;
91808
- const upsertSemaphore = yield* require_Path.make$4(1);
91859
+ const upsertSemaphore = yield* require_Path.make$5(1);
91809
91860
  const resolvedConfigCacheKey = "resolved";
91810
91861
  const changesPubSub = yield* require_Path.unbounded$1();
91811
91862
  const startedRef = yield* require_HttpServer.make$3(false);
@@ -97710,7 +97761,7 @@ const make$15 = (hooks) => require_Schema$1.gen(function* () {
97710
97761
  const selfRuntimeId = resolveRuntimeReplicationRuntimeId(config);
97711
97762
  const scanScope = yield* require_Schema$1.make$3("sequential");
97712
97763
  yield* require_Schema$1.addFinalizer(() => require_Schema$1.close(scanScope, require_Schema$1.void_$1));
97713
- const scanSemaphore = yield* require_Path.make$4(1);
97764
+ const scanSemaphore = yield* require_Path.make$5(1);
97714
97765
  const inFlight = /* @__PURE__ */ new Map();
97715
97766
  const ratesCachePath = path.join(config.stateDir, RATES_CACHE_FILE);
97716
97767
  const scanCachePath = path.join(config.stateDir, SCAN_CACHE_FILE);
@@ -98647,7 +98698,7 @@ const makeWorkspaceBulkTransfer = (options = {}) => require_Schema$1.gen(functio
98647
98698
  const workspacePaths = yield* WorkspacePaths;
98648
98699
  const workspaceEntries = yield* WorkspaceEntries;
98649
98700
  const fault = options.fault ?? (() => require_Schema$1.void_);
98650
- const transferLocks = yield* require_Schema$1.forEach(Array.from({ length: TRANSFER_LOCK_STRIPE_COUNT }), () => require_Path.make$4(1));
98701
+ const transferLocks = yield* require_Schema$1.forEach(Array.from({ length: TRANSFER_LOCK_STRIPE_COUNT }), () => require_Path.make$5(1));
98651
98702
  const withTransferLock = (transferId, effect) => transferLocks[transferLockStripe(transferId)].withPermit(effect);
98652
98703
  const findTransfer = (transferId) => sql`
98653
98704
  SELECT transfer_id AS "transferId", workspace_root AS "workspaceRoot",
@@ -116506,8 +116557,8 @@ require_Schema$1.effectDiscard(runMigrations());
116506
116557
  //#endregion
116507
116558
  //#region src/persistence/Layers/Sqlite.ts
116508
116559
  const defaultSqliteClientLoaders = {
116509
- bun: () => Promise.resolve().then(() => require("./SqliteClient-D4Srj6O8.cjs")),
116510
- node: () => Promise.resolve().then(() => require("./NodeSqliteClient-PZ6NN2gq.cjs"))
116560
+ bun: () => Promise.resolve().then(() => require("./SqliteClient-B08FzZM4.cjs")),
116561
+ node: () => Promise.resolve().then(() => require("./NodeSqliteClient-CmxPzcBf.cjs"))
116511
116562
  };
116512
116563
  const makeRuntimeSqliteLayer = require_Schema$1.fn("makeRuntimeSqliteLayer")(function* (config) {
116513
116564
  const loader = defaultSqliteClientLoaders[process.versions.bun !== void 0 ? "bun" : "node"];
@@ -150144,6 +150195,23 @@ function issueCmmdLocalUserProviderEgressCredential(input) {
150144
150195
  });
150145
150196
  }
150146
150197
  //#endregion
150198
+ //#region src/provider/codexAccountTransition.ts
150199
+ function explicitProviderAccountTransition(fromAccountId, toAccountId) {
150200
+ if (!fromAccountId || !toAccountId || fromAccountId === toAccountId) return void 0;
150201
+ return {
150202
+ fromAccountId,
150203
+ toAccountId
150204
+ };
150205
+ }
150206
+ function permitsCodexAccountTransition(input) {
150207
+ const { transition, requestedAccountId, prior, current } = input;
150208
+ if (!transition || transition.fromAccountId === transition.toAccountId || transition.toAccountId !== requestedAccountId || prior.identity.kind !== "provider_account" || current.identity.kind !== "provider_account" || prior.identity.provider !== "codex" || current.identity.provider !== "codex") return false;
150209
+ return providerDeliveryBindingsEqual({
150210
+ ...prior,
150211
+ identity: current.identity
150212
+ }, current);
150213
+ }
150214
+ //#endregion
150147
150215
  //#region src/providerAuth/codexLocalAccountIdentity.ts
150148
150216
  const ACCOUNT_IDENTITY_PATH = "/api/forge/context/providers/codex/account-identity";
150149
150217
  const PROVIDER_ACCOUNT_IDENTITY$1 = /^pai_v1_[A-Za-z0-9_-]{43}$/;
@@ -150641,7 +150709,12 @@ var CodexAppServerManager = class extends node_events.EventEmitter {
150641
150709
  const rawPriorDeliveryBinding = input.resumeCursor.providerDeliveryBinding;
150642
150710
  const priorDeliveryBinding = readProviderDeliveryBinding(rawPriorDeliveryBinding);
150643
150711
  if (rawPriorDeliveryBinding !== void 0 && rawPriorDeliveryBinding !== null && !priorDeliveryBinding) throw new Error("Existing Codex history cannot resume because its persisted delivered provider account binding is unreadable.");
150644
- if (priorDeliveryBinding && !providerDeliveryBindingsEqual(priorDeliveryBinding, currentDeliveryBinding)) throw new Error("Existing Codex history cannot resume because the delivered provider account changed.");
150712
+ if (priorDeliveryBinding && !providerDeliveryBindingsEqual(priorDeliveryBinding, currentDeliveryBinding) && !permitsCodexAccountTransition({
150713
+ transition: input.accountTransition,
150714
+ requestedAccountId: input.providerAccountId,
150715
+ prior: priorDeliveryBinding,
150716
+ current: currentDeliveryBinding
150717
+ })) throw new Error("Existing Codex history cannot resume because the delivered provider account changed.");
150645
150718
  }
150646
150719
  const initialResumeCursor = initialCodexResumeCursor({
150647
150720
  resumeCursor: input.resumeCursor,
@@ -210790,6 +210863,7 @@ const makeCodexAdapter = require_Schema$1.fn("makeCodexAdapter")(function* (opti
210790
210863
  ...browserToolEnvironmentId !== void 0 ? { environmentId: browserToolEnvironmentId } : {}
210791
210864
  };
210792
210865
  const managerInput = {
210866
+ ...input.accountTransition ? { accountTransition: input.accountTransition } : {},
210793
210867
  threadId: input.threadId,
210794
210868
  provider: "codex",
210795
210869
  ...input.cwd !== void 0 ? { cwd: input.cwd } : {},
@@ -211120,7 +211194,7 @@ function withoutInheritedAnthropicCredentials(env, options) {
211120
211194
  //#endregion
211121
211195
  //#region src/provider/makeManagedServerProvider.ts
211122
211196
  const makeManagedServerProvider = require_Schema$1.fn("makeManagedServerProvider")(function* (input) {
211123
- const refreshSemaphore = yield* require_Path.make$4(1);
211197
+ const refreshSemaphore = yield* require_Path.make$5(1);
211124
211198
  const changesPubSub = yield* require_Schema$1.acquireRelease(require_Path.unbounded$1(), require_Path.shutdown$1);
211125
211199
  const initialSettings = yield* input.getSettings;
211126
211200
  const initialSnapshot = input.initialSnapshot(initialSettings);
@@ -220860,7 +220934,7 @@ function makeCursorAdapter(cursorSettings, options) {
220860
220934
  const getThreadSemaphore = (threadId) => modifyEffect(threadLocksRef, (current) => {
220861
220935
  const existing = require_Schema$1.fromNullishOr(current.get(threadId));
220862
220936
  return require_Schema$1.match$2(existing, {
220863
- onNone: () => require_Path.make$4(1).pipe(require_Schema$1.map((semaphore) => {
220937
+ onNone: () => require_Path.make$5(1).pipe(require_Schema$1.map((semaphore) => {
220864
220938
  const next = new Map(current);
220865
220939
  next.set(threadId, semaphore);
220866
220940
  return [semaphore, next];
@@ -229270,6 +229344,8 @@ const makeProviderService = require_Schema$1.fn("makeProviderService")(function*
229270
229344
  const canonicalEventLogger = options?.canonicalEventLogger ?? (options?.canonicalEventLogPath !== void 0 ? yield* makeEventNdjsonLogger(options.canonicalEventLogPath, { stream: "canonical" }) : void 0);
229271
229345
  const registry = yield* ProviderAdapterRegistry;
229272
229346
  const directory = yield* ProviderSessionDirectory;
229347
+ const sessionLocks = yield* require_Path.make$3({ lookup: (_threadId) => require_Path.make$5(1) });
229348
+ const withSessionLock = (threadId, effect) => require_Path.get$1(sessionLocks, threadId).pipe(require_Schema$1.flatMap((lock) => lock.withPermit(effect)), require_Schema$1.scoped);
229273
229349
  const runtimeEventPubSub = yield* require_Path.unbounded$1();
229274
229350
  const assertProviderExecutable = options?.assertProviderExecutable ?? (() => require_Schema$1.succeed(null));
229275
229351
  const assertCurrentProviderDelivery = require_Schema$1.fn("assertCurrentProviderDelivery")(function* (input) {
@@ -229444,18 +229520,19 @@ const makeProviderService = require_Schema$1.fn("makeProviderService")(function*
229444
229520
  "provider.runtime_mode": input.runtimeMode
229445
229521
  });
229446
229522
  const persistedBinding = require_Schema$1.getOrUndefined$1(yield* directory.getBinding(threadId));
229447
- yield* assertProviderAccountBoundary({
229523
+ const adapter = yield* registry.getByProvider(effectiveProvider);
229524
+ const priorAccountId = readPersistedProviderAccountId(persistedBinding?.runtimePayload);
229525
+ const requestedAccountId = readProviderAccountIdFromModelSelection(input.modelSelection);
229526
+ if (effectiveProvider !== "codex" || persistedBinding?.provider !== effectiveProvider || (yield* adapter.hasSession(threadId))) yield* assertProviderAccountBoundary({
229448
229527
  operation: "ProviderService.startSession",
229449
229528
  threadId,
229450
- persistedAccountId: readPersistedProviderAccountId(persistedBinding?.runtimePayload),
229451
- requestedAccountId: readProviderAccountIdFromModelSelection(input.modelSelection)
229529
+ persistedAccountId: priorAccountId,
229530
+ requestedAccountId
229452
229531
  });
229453
- const effectiveResumeCursor = input.resumeCursor ?? (persistedBinding?.provider === effectiveProvider ? persistedBinding.resumeCursor : void 0);
229454
- const adapter = yield* registry.getByProvider(effectiveProvider);
229455
229532
  const boundResumeCursor = yield* bindProviderDeliveryToResumeCursor({
229456
229533
  operation: "ProviderService.startSession",
229457
229534
  provider: effectiveProvider,
229458
- resumeCursor: effectiveResumeCursor,
229535
+ resumeCursor: input.resumeCursor ?? (persistedBinding?.provider === effectiveProvider ? persistedBinding.resumeCursor : void 0),
229459
229536
  currentBinding: yield* assertProviderExecutable({
229460
229537
  threadId,
229461
229538
  provider: effectiveProvider,
@@ -229464,6 +229541,7 @@ const makeProviderService = require_Schema$1.fn("makeProviderService")(function*
229464
229541
  });
229465
229542
  const session = yield* adapter.startSession({
229466
229543
  ...input,
229544
+ accountTransition: explicitProviderAccountTransition(priorAccountId, requestedAccountId),
229467
229545
  ...boundResumeCursor !== void 0 ? { resumeCursor: boundResumeCursor } : {}
229468
229546
  });
229469
229547
  if (session.provider !== adapter.provider) return yield* toValidationError("ProviderService.startSession", `Adapter/provider mismatch: requested '${adapter.provider}', received '${session.provider}'.`);
@@ -229765,15 +229843,15 @@ const makeProviderService = require_Schema$1.fn("makeProviderService")(function*
229765
229843
  });
229766
229844
  yield* require_Schema$1.addFinalizer(() => require_Schema$1.catch_(runStopAll(), (cause) => require_Schema$1.logWarning("failed to stop provider service", { cause })));
229767
229845
  return {
229768
- startSession,
229769
- sendTurn,
229770
- interruptTurn,
229771
- respondToRequest,
229772
- respondToUserInput,
229773
- stopSession,
229846
+ startSession: (threadId, input) => withSessionLock(threadId, startSession(threadId, input)),
229847
+ sendTurn: (input) => withSessionLock(input?.threadId, sendTurn(input)),
229848
+ interruptTurn: (input) => withSessionLock(input?.threadId, interruptTurn(input)),
229849
+ respondToRequest: (input) => withSessionLock(input?.threadId, respondToRequest(input)),
229850
+ respondToUserInput: (input) => withSessionLock(input?.threadId, respondToUserInput(input)),
229851
+ stopSession: (input) => withSessionLock(input?.threadId, stopSession(input)),
229774
229852
  listSessions,
229775
229853
  getCapabilities,
229776
- rollbackConversation,
229854
+ rollbackConversation: (input) => withSessionLock(input?.threadId, rollbackConversation(input)),
229777
229855
  get streamEvents() {
229778
229856
  return require_Path.fromPubSub(runtimeEventPubSub);
229779
229857
  }
@@ -231020,7 +231098,7 @@ const createTrace2Monitor = require_Schema$1.fn("createTrace2Monitor")(function*
231020
231098
  });
231021
231099
  }
231022
231100
  });
231023
- const readTraceDelta = (yield* require_Path.make$4(1)).withPermit(fs.readFileString(traceFilePath).pipe(require_Schema$1.flatMap((contents) => require_Schema$1.uninterruptible(require_HttpServer.modify(traceTailState, ({ processedChars, remainder }) => {
231101
+ const readTraceDelta = (yield* require_Path.make$5(1)).withPermit(fs.readFileString(traceFilePath).pipe(require_Schema$1.flatMap((contents) => require_Schema$1.uninterruptible(require_HttpServer.modify(traceTailState, ({ processedChars, remainder }) => {
231024
231102
  if (contents.length <= processedChars) return [[], {
231025
231103
  processedChars,
231026
231104
  remainder
@@ -234639,7 +234717,7 @@ const makeTerminalManagerWithOptions = require_Schema$1.fn("makeTerminalManagerW
234639
234717
  const getThreadSemaphore = (threadId) => modifyEffect(threadLocksRef, (current) => {
234640
234718
  const existing = require_Schema$1.fromNullishOr(current.get(threadId));
234641
234719
  return require_Schema$1.match$2(existing, {
234642
- onNone: () => require_Path.make$4(1).pipe(require_Schema$1.map((semaphore) => {
234720
+ onNone: () => require_Path.make$5(1).pipe(require_Schema$1.map((semaphore) => {
234643
234721
  const next = new Map(current);
234644
234722
  next.set(threadId, semaphore);
234645
234723
  return [semaphore, next];
@@ -285797,7 +285875,7 @@ const make$10 = require_Schema$1.gen(function* () {
285797
285875
  const runtimeContext = yield* require_Schema$1.context();
285798
285876
  const runPromise = require_Schema$1.runPromiseWith(runtimeContext);
285799
285877
  const eventState = makeApprovedWorkerPlanEventState();
285800
- const reconcileSemaphore = yield* require_Path.make$4(1);
285878
+ const reconcileSemaphore = yield* require_Path.make$5(1);
285801
285879
  const dispatch = (command) => runPromise(orchestration.dispatch(command).pipe(require_Schema$1.asVoid));
285802
285880
  const readMasterContext = async (prompt) => {
285803
285881
  const thread = require_Schema$1.getOrNull(await runPromise(readDurableWorkerDetail(projectionSnapshotQuery, ThreadId.make(prompt.masterThreadId))));
@@ -287193,7 +287271,7 @@ const makeRuntimeDrainReporter = require_Schema$1.gen(function* () {
287193
287271
  const providerService = yield* ProviderService;
287194
287272
  const serverConfig = yield* ServerConfig;
287195
287273
  const spriteTaskHoldReactor = yield* SpriteTaskHoldReactor;
287196
- const reportSemaphore = yield* require_Path.make$4(1);
287274
+ const reportSemaphore = yield* require_Path.make$5(1);
287197
287275
  let heartbeatSilent = false;
287198
287276
  const postHeartbeat = (config, snapshot) => require_Schema$1.promise(async () => {
287199
287277
  const forgeGitCommit = await resolveForgeGitCommit();
@@ -293990,7 +294068,7 @@ function resolveBuildCommitFromEnv(env) {
293990
294068
  * environment descriptor down instead of reporting an honest "unknown".
293991
294069
  */
293992
294070
  function readBakedBuildCommit() {
293993
- return "4c61547a96474064b48ee5bee21db4e726e14fb8";
294071
+ return "fe3ee5efe095539824d092372a8dde00f1e2f98c";
293994
294072
  }
293995
294073
  async function resolveServerBuildCommit(input) {
293996
294074
  if (isFullCommitSha(input.baked)) return input.baked;
@@ -297071,6 +297149,19 @@ function toProjectorDecodeError(eventType) {
297071
297149
  });
297072
297150
  }
297073
297151
  //#endregion
297152
+ //#region src/orchestration/turnAccountSelection.ts
297153
+ /** A per-turn account choice remains local to the thread and cannot change its provider. */
297154
+ function turnAccountSelection(current, requested) {
297155
+ if (!requested || requested.provider !== current.provider) return void 0;
297156
+ if (requested.provider !== "codex" && requested.provider !== "claudeAgent") return void 0;
297157
+ const currentAccountId = "providerAccountId" in current ? current.providerAccountId : void 0;
297158
+ if (requested.providerAccountId === void 0 || requested.providerAccountId === currentAccountId) return void 0;
297159
+ return {
297160
+ ...current,
297161
+ providerAccountId: requested.providerAccountId
297162
+ };
297163
+ }
297164
+ //#endregion
297074
297165
  //#region src/orchestration/commandInvariants.ts
297075
297166
  function invariantError(commandType, detail) {
297076
297167
  return new OrchestrationCommandInvariantError({
@@ -297609,7 +297700,9 @@ const decideOrchestrationCommand = require_Schema$1.fn("decideOrchestrationComma
297609
297700
  createdAt: command.createdAt
297610
297701
  }
297611
297702
  };
297612
- if (!(targetThread.anchorKind !== nextAnchor.anchorKind || targetThread.anchorCmmdId !== nextAnchor.anchorCmmdId)) return [userMessageEvent, turnStartRequestedEvent];
297703
+ const shouldUpdateAnchor = targetThread.anchorKind !== nextAnchor.anchorKind || targetThread.anchorCmmdId !== nextAnchor.anchorCmmdId;
297704
+ const accountSelection = turnAccountSelection(targetThread.modelSelection, command.modelSelection);
297705
+ if (!shouldUpdateAnchor && !accountSelection) return [userMessageEvent, turnStartRequestedEvent];
297613
297706
  return [
297614
297707
  {
297615
297708
  ...withEventBase({
@@ -297623,6 +297716,7 @@ const decideOrchestrationCommand = require_Schema$1.fn("decideOrchestrationComma
297623
297716
  threadId: command.threadId,
297624
297717
  anchorKind: nextAnchor.anchorKind,
297625
297718
  anchorCmmdId: nextAnchor.anchorCmmdId,
297719
+ ...accountSelection ? { modelSelection: accountSelection } : {},
297626
297720
  updatedAt: command.createdAt
297627
297721
  }
297628
297722
  },
@@ -311039,7 +311133,7 @@ const makePipelineRunCoordinator = require_Schema$1.gen(function* () {
311039
311133
  preparation: preparedHandoff.providerAuthorityPreparation
311040
311134
  });
311041
311135
  const acceptingHeartbeatRef = yield* require_HttpServer.make$3(true);
311042
- const heartbeatPublicationSemaphore = yield* require_Path.make$4(1);
311136
+ const heartbeatPublicationSemaphore = yield* require_Path.make$5(1);
311043
311137
  if ((yield* store.getByRunId(input.runId)) !== null) return yield* coordinatorError("registerHandoff", "PIPELINE_HANDOFF_ALREADY_BOUND", "The CMMD run already has a Forge task thread and must use the authority rebind contract.");
311044
311138
  const snapshot = preparedHandoff.snapshot;
311045
311139
  const readModel = yield* orchestration.getReadModel();
@@ -314925,7 +315019,7 @@ function makeProjectLeadSchedulerLive(options = {}) {
314925
315019
  return require_Schema$1.effect(ProjectLeadScheduler, require_Schema$1.gen(function* () {
314926
315020
  const client = yield* ProjectLeadControllerClient;
314927
315021
  const dispatcher = yield* ProjectLeadReservationDispatcher;
314928
- const semaphore = yield* require_Path.make$4(1);
315022
+ const semaphore = yield* require_Path.make$5(1);
314929
315023
  const leaseSeconds = options.leaseSeconds ?? DEFAULT_LEASE_SECONDS;
314930
315024
  const batchSize = options.batchSize ?? DEFAULT_BATCH_SIZE;
314931
315025
  const projectLimit = options.projectLimit ?? DEFAULT_PROJECT_LIMIT;
@@ -316944,13 +317038,13 @@ const gitUrlCloneRouteLayer = add$1("POST", "/api/cloud/git/clone-url", require_
316944
317038
  //#endregion
316945
317039
  //#region src/server.ts
316946
317040
  const PtyAdapterLive = require_Schema$1.unwrap(require_Schema$1.gen(function* () {
316947
- if (typeof Bun !== "undefined") return (yield* require_Schema$1.promise(() => Promise.resolve().then(() => require("./BunPTY-B4Ra6mph.cjs")))).layer;
316948
- else return (yield* require_Schema$1.promise(() => Promise.resolve().then(() => require("./NodePTY-wATyTf3M.cjs")))).layer;
317041
+ if (typeof Bun !== "undefined") return (yield* require_Schema$1.promise(() => Promise.resolve().then(() => require("./BunPTY-86ttlTi6.cjs")))).layer;
317042
+ else return (yield* require_Schema$1.promise(() => Promise.resolve().then(() => require("./NodePTY-Cps0jsDA.cjs")))).layer;
316949
317043
  }));
316950
317044
  const HttpServerLive = require_Schema$1.unwrap(require_Schema$1.gen(function* () {
316951
317045
  const config = yield* ServerConfig;
316952
- if (typeof Bun !== "undefined") return (yield* require_Schema$1.promise(() => Promise.resolve().then(() => require("./BunHttpServer-CjwNydcy.cjs")))).layer(bunHttpServerOptions(config));
316953
- const [NodeHttpServer, NodeHttp] = yield* require_Schema$1.all([require_Schema$1.promise(() => Promise.resolve().then(() => require("./NodeHttpServer-Cy1XvkSE.cjs"))), require_Schema$1.promise(() => import("node:http"))]);
317046
+ if (typeof Bun !== "undefined") return (yield* require_Schema$1.promise(() => Promise.resolve().then(() => require("./BunHttpServer-BhE7Szci.cjs")))).layer(bunHttpServerOptions(config));
317047
+ const [NodeHttpServer, NodeHttp] = yield* require_Schema$1.all([require_Schema$1.promise(() => Promise.resolve().then(() => require("./NodeHttpServer-BPjxt_DT.cjs"))), require_Schema$1.promise(() => import("node:http"))]);
316954
317048
  return NodeHttpServer.layer(NodeHttp.createServer, {
316955
317049
  host: config.host,
316956
317050
  port: config.port
@@ -316958,10 +317052,10 @@ const HttpServerLive = require_Schema$1.unwrap(require_Schema$1.gen(function* ()
316958
317052
  }));
316959
317053
  const PlatformServicesLive = require_Schema$1.unwrap(require_Schema$1.gen(function* () {
316960
317054
  if (typeof Bun !== "undefined") {
316961
- const { layer } = yield* require_Schema$1.promise(() => Promise.resolve().then(() => require("./BunServices-CUeOgVUt.cjs")));
317055
+ const { layer } = yield* require_Schema$1.promise(() => Promise.resolve().then(() => require("./BunServices-BwE9KexF.cjs")));
316962
317056
  return layer;
316963
317057
  } else {
316964
- const { layer } = yield* require_Schema$1.promise(() => Promise.resolve().then(() => require("./NodeServices-BqfcuvmN.cjs")));
317058
+ const { layer } = yield* require_Schema$1.promise(() => Promise.resolve().then(() => require("./NodeServices-Ddr-tYRu.cjs")));
316965
317059
  return layer;
316966
317060
  }
316967
317061
  }));