codex-overleaf-link 2.3.1 → 2.3.2

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 (33) hide show
  1. package/README.md +23 -23
  2. package/extension/bootstrap/manifest.template.json +1 -1
  3. package/extension/src/content/assetTransferBroker.js +169 -0
  4. package/extension/src/content/contentRuntime.js +27 -1
  5. package/extension/src/content/generated/content.bundle.js +551 -65
  6. package/extension/src/content/generated/content.bundle.meta.json +6 -3
  7. package/extension/src/content/legacyGlobalRegistry.js +3 -0
  8. package/extension/src/content/modelPicker.js +2 -2
  9. package/extension/src/content/modelPickerSupport.js +3 -3
  10. package/extension/src/content/pageBridgeClient.js +1 -0
  11. package/extension/src/content/runResultActions.js +114 -0
  12. package/extension/src/content/runTimelineView.js +17 -0
  13. package/extension/src/content/sessionForkController.js +120 -0
  14. package/extension/src/content/writebackController.js +3 -0
  15. package/extension/src/content/writebackOrchestrator.js +3 -1
  16. package/extension/src/page/binaryAssetUploader.js +343 -0
  17. package/extension/src/page/trackedChangesLifecycle.js +2 -0
  18. package/extension/src/pageBridge.js +30 -1
  19. package/extension/src/shared/compatibility.js +4 -2
  20. package/extension/src/shared/i18n.js +16 -0
  21. package/extension/src/shared/models.js +13 -2
  22. package/extension/src/shared/pageRpcContract.js +5 -1
  23. package/extension/src/shared/sessionState.js +12 -4
  24. package/extension/src/shared/storageDb.js +1 -1
  25. package/extension/src/shared/storageRunActions.js +11 -1
  26. package/extension/styles/panel.css +61 -0
  27. package/native-host/src/codexModels.js +6 -2
  28. package/native-host/src/codexSessionRunner.js +5 -1
  29. package/native-host/src/codexThreadFork.js +103 -0
  30. package/native-host/src/mirrorWorkspace.js +5 -19
  31. package/native-host/src/nativeAssetTransfer.js +183 -0
  32. package/native-host/src/taskRunnerRuntime.js +22 -0
  33. package/package.json +1 -1
@@ -4168,6 +4168,14 @@ ${block}`;
4168
4168
  deleteSessionHistoryFailedToast: "Deleted this plugin session, but the matching plugin-local Codex thread history was not fully cleared: {message}",
4169
4169
  deleteSessionNoThreadToast: "Deleted this plugin session. This old session had no identifiable local Codex thread history, so no local history was cleared.",
4170
4170
  deleteSessionDoneToast: "Deleted this plugin session.",
4171
+ forkRunTitle: "Fork a new conversation from this turn",
4172
+ forkRunUnavailable: "This turn cannot be forked because its Codex thread position is unavailable.",
4173
+ forkRunFailed: "Could not fork this conversation.",
4174
+ forkRunDone: "Forked conversation created.",
4175
+ forkSessionTitle: "{title} (fork)",
4176
+ copyConclusionTitle: "Copy conclusion",
4177
+ copyConclusionDone: "Conclusion copied",
4178
+ copyConclusionFailed: "Could not copy conclusion",
4171
4179
  modeSwitchFailedToast: "Could not switch mode: {message}",
4172
4180
  diffAccepted: "Accepted",
4173
4181
  diffRejected: "Rejected",
@@ -4680,6 +4688,14 @@ ${block}`;
4680
4688
  deleteSessionHistoryFailedToast: "\u5DF2\u5220\u9664\u8FD9\u4E2A\u63D2\u4EF6\u4F1A\u8BDD\uFF0C\u4F46\u5BF9\u5E94\u7684\u63D2\u4EF6\u672C\u5730 Codex \u7EBF\u7A0B\u5386\u53F2\u6CA1\u6709\u6E05\u7406\u5B8C\u6210\uFF1A{message}",
4681
4689
  deleteSessionNoThreadToast: "\u5DF2\u5220\u9664\u8FD9\u4E2A\u63D2\u4EF6\u4F1A\u8BDD\uFF1B\u8FD9\u4E2A\u65E7\u4F1A\u8BDD\u6CA1\u6709\u53EF\u8BC6\u522B\u7684\u672C\u5730 Codex \u7EBF\u7A0B\u5386\u53F2\uFF0C\u672A\u6E05\u7406\u672C\u5730\u5386\u53F2\u3002",
4682
4690
  deleteSessionDoneToast: "\u5DF2\u5220\u9664\u8FD9\u4E2A\u63D2\u4EF6\u4F1A\u8BDD\u3002",
4691
+ forkRunTitle: "\u4ECE\u6B64\u8F6E\u5206\u53C9\u4E00\u4E2A\u65B0\u5BF9\u8BDD",
4692
+ forkRunUnavailable: "\u8BE5\u8F6E\u7F3A\u5C11\u53EF\u5B9A\u4F4D\u7684 Codex thread \u8282\u70B9\uFF0C\u65E0\u6CD5\u5206\u53C9\u3002",
4693
+ forkRunFailed: "\u65E0\u6CD5\u5206\u53C9\u6B64\u5BF9\u8BDD\u3002",
4694
+ forkRunDone: "\u5DF2\u521B\u5EFA\u5206\u53C9\u5BF9\u8BDD\u3002",
4695
+ forkSessionTitle: "{title}\uFF08\u5206\u53C9\uFF09",
4696
+ copyConclusionTitle: "\u590D\u5236\u7ED3\u8BBA",
4697
+ copyConclusionDone: "\u5DF2\u590D\u5236\u7ED3\u8BBA",
4698
+ copyConclusionFailed: "\u65E0\u6CD5\u590D\u5236\u7ED3\u8BBA",
4683
4699
  modeSwitchFailedToast: "\u5207\u6362\u6A21\u5F0F\u5931\u8D25\uFF1A{message}",
4684
4700
  diffAccepted: "\u5DF2\u63A5\u53D7",
4685
4701
  diffRejected: "\u5DF2\u62D2\u7EDD",
@@ -5193,18 +5209,27 @@ ${block}`;
5193
5209
  const normalized = {
5194
5210
  id,
5195
5211
  label,
5196
- reasoningEfforts: Array.isArray(model?.reasoningEfforts) ? model.reasoningEfforts.slice() : [],
5212
+ reasoningEfforts: normalizeReasoningEfforts(model?.reasoningEfforts),
5197
5213
  reasoningPresentation: typeof model?.reasoningPresentation === "string" ? model.reasoningPresentation : "",
5198
5214
  speedTiers: normalizeSpeedTiers(model?.speedTiers)
5199
5215
  };
5200
5216
  if (Object.prototype.hasOwnProperty.call(Object(model), "defaultReasoningEffort")) {
5201
- normalized.defaultReasoningEffort = model.defaultReasoningEffort;
5217
+ normalized.defaultReasoningEffort = normalizeReasoningEffort(model.defaultReasoningEffort);
5202
5218
  }
5203
5219
  if (Object.prototype.hasOwnProperty.call(Object(model), "defaultSpeedTier")) {
5204
5220
  normalized.defaultSpeedTier = model.defaultSpeedTier;
5205
5221
  }
5206
5222
  return normalized;
5207
5223
  }
5224
+ function normalizeReasoningEfforts(reasoningEfforts) {
5225
+ if (!Array.isArray(reasoningEfforts)) {
5226
+ return [];
5227
+ }
5228
+ return Array.from(new Set(reasoningEfforts.map(normalizeReasoningEffort).filter(Boolean)));
5229
+ }
5230
+ function normalizeReasoningEffort(reasoningEffort) {
5231
+ return normalizeModelId(reasoningEffort);
5232
+ }
5208
5233
  function normalizeSpeedTiers(speedTiers) {
5209
5234
  if (!Array.isArray(speedTiers)) {
5210
5235
  return ["standard"];
@@ -7856,7 +7881,7 @@ ${block}`;
7856
7881
  customInstructionsByProject: {}
7857
7882
  };
7858
7883
  const VALID_MODES = /* @__PURE__ */ new Set(["ask", "auto"]);
7859
- const VALID_REASONING = /* @__PURE__ */ new Set(["none", "minimal", "low", "medium", "high", "xhigh"]);
7884
+ const VALID_REASONING = /* @__PURE__ */ new Set(["none", "minimal", "low", "medium", "high", "xhigh", "max", "ultra"]);
7860
7885
  const VALID_SPEED_TIERS = /* @__PURE__ */ new Set(["standard", "fast"]);
7861
7886
  const VALID_LOCALES = /* @__PURE__ */ new Set(["en", "zh"]);
7862
7887
  const VALID_EVENT_STATUSES = /* @__PURE__ */ new Set(["info", "running", "completed", "failed", "warning", "blocked", "skipped", "pending"]);
@@ -7925,9 +7950,7 @@ ${block}`;
7925
7950
  ...input
7926
7951
  };
7927
7952
  state.mode = normalizeMode(state.mode);
7928
- if (!VALID_REASONING.has(state.reasoningEffort)) {
7929
- state.reasoningEffort = DEFAULT_PANEL_STATE.reasoningEffort;
7930
- }
7953
+ state.reasoningEffort = normalizeReasoning(state.reasoningEffort);
7931
7954
  if (!VALID_SPEED_TIERS.has(state.speedTier)) {
7932
7955
  state.speedTier = DEFAULT_PANEL_STATE.speedTier;
7933
7956
  }
@@ -8009,6 +8032,8 @@ ${block}`;
8009
8032
  focusFiles: normalizeFocusFiles(session.focusFiles),
8010
8033
  projectReferenceFiles: normalizeProjectReferenceFiles(session.projectReferenceFiles),
8011
8034
  codexThreadId: typeof session.codexThreadId === "string" ? session.codexThreadId : "",
8035
+ forkedFromSessionId: typeof session.forkedFromSessionId === "string" ? session.forkedFromSessionId : "",
8036
+ forkedFromRunId: typeof session.forkedFromRunId === "string" ? session.forkedFromRunId : "",
8012
8037
  pendingInputs: normalizePendingInputs(
8013
8038
  session.pendingInputs,
8014
8039
  options2.restoreRunningRuns === true,
@@ -8111,6 +8136,8 @@ ${block}`;
8111
8136
  focusFiles: normalizeFocusFiles(overrides.focusFiles),
8112
8137
  projectReferenceFiles: normalizeProjectReferenceFiles(overrides.projectReferenceFiles),
8113
8138
  codexThreadId: typeof overrides.codexThreadId === "string" ? overrides.codexThreadId : "",
8139
+ forkedFromSessionId: typeof overrides.forkedFromSessionId === "string" ? overrides.forkedFromSessionId : "",
8140
+ forkedFromRunId: typeof overrides.forkedFromRunId === "string" ? overrides.forkedFromRunId : "",
8114
8141
  pendingInputs: normalizePendingInputs(overrides.pendingInputs)
8115
8142
  };
8116
8143
  }
@@ -8342,6 +8369,8 @@ ${block}`;
8342
8369
  undoStatus: sanitizeAssistantVisibleText(run.undoStatus),
8343
8370
  nativeRequestId: sanitizeAssistantVisibleText(run.nativeRequestId),
8344
8371
  codexTurnId: sanitizeAssistantVisibleText(run.codexTurnId),
8372
+ forkSnapshot: run.forkSnapshot === true,
8373
+ forkSourceRunId: sanitizeAssistantVisibleText(run.forkSourceRunId),
8345
8374
  nativeEventSeq: Number.isFinite(Number(run.nativeEventSeq)) ? Number(run.nativeEventSeq) : 0,
8346
8375
  queueItemId: sanitizeAssistantVisibleText(run.queueItemId),
8347
8376
  interruptedDraft: run.interruptedDraft ? sanitizeAssistantVisibleValue(run.interruptedDraft) : void 0
@@ -8717,6 +8746,8 @@ ${block}`;
8717
8746
  focusFiles: normalizeFocusFiles(session.focusFiles),
8718
8747
  projectReferenceFiles: normalizeProjectReferenceFiles(session.projectReferenceFiles),
8719
8748
  codexThreadId: typeof session.codexThreadId === "string" ? session.codexThreadId : "",
8749
+ forkedFromSessionId: normalizeTextField(session.forkedFromSessionId, 160),
8750
+ forkedFromRunId: normalizeTextField(session.forkedFromRunId, 160),
8720
8751
  pendingInputs: normalizePendingInputs(session.pendingInputs)
8721
8752
  };
8722
8753
  if (typeof session.lastActivityAt === "string" && session.lastActivityAt) {
@@ -8789,6 +8820,8 @@ ${block}`;
8789
8820
  undoStatus: summarizeTextForStorage(run.undoStatus, "undo status"),
8790
8821
  nativeRequestId: normalizeTextField(run.nativeRequestId, 160),
8791
8822
  codexTurnId: normalizeTextField(run.codexTurnId, 160),
8823
+ forkSnapshot: run.forkSnapshot === true,
8824
+ forkSourceRunId: normalizeTextField(run.forkSourceRunId, 160),
8792
8825
  nativeEventSeq: Number.isFinite(Number(run.nativeEventSeq)) ? Number(run.nativeEventSeq) : 0,
8793
8826
  queueItemId: normalizeTextField(run.queueItemId, 160)
8794
8827
  };
@@ -9336,8 +9369,9 @@ ${block}`;
9336
9369
  function hasReloadableRunActionPayload(run) {
9337
9370
  var trackedStatus = run && run.trackedChangeStatus;
9338
9371
  var trackedLifecycle = (trackedStatus === "pending" || trackedStatus === "needs_review") && Array.isArray(run.undoTrackedChanges) && run.undoTrackedChanges.length > 0 && Array.isArray(run.undoExpectedFiles) && run.undoExpectedFiles.length > 0 && Array.isArray(run.appliedOperations) && run.appliedOperations.length > 0;
9372
+ var reviewingEditorUndo = trackedStatus !== "accepted" && trackedStatus !== "rejected" && run && run.undoStatus !== "applied" && run.executionSnapshot && run.executionSnapshot.requireReviewing === true && Array.isArray(run.undoExpectedFiles) && run.undoExpectedFiles.length > 0 && Array.isArray(run.appliedOperations) && run.appliedOperations.length > 0;
9339
9373
  var legacyUndo = Array.isArray(run && run.undoOperations) && run.undoOperations.length > 0;
9340
- return trackedLifecycle || legacyUndo;
9374
+ return trackedLifecycle || reviewingEditorUndo || legacyUndo;
9341
9375
  }
9342
9376
  function compactRunActionPayload(run, keepActionPayload) {
9343
9377
  var empty = emptyActionPayload();
@@ -9935,6 +9969,7 @@ ${block}`;
9935
9969
  speedTier: typeof state.speedTier === "string" ? state.speedTier : "",
9936
9970
  mode: normalizeCurrentMode(state.mode),
9937
9971
  locale: typeof state.locale === "string" ? state.locale : "",
9972
+ theme: state.theme === "light" || state.theme === "auto" ? state.theme : "dark",
9938
9973
  requireReviewing: state.requireReviewing !== false,
9939
9974
  autoRecompile: state.autoRecompile !== false,
9940
9975
  loadCodexLocalSkills: state.loadCodexLocalSkills !== false,
@@ -11333,7 +11368,7 @@ ${block}`;
11333
11368
  const MIN_NATIVE_VERSION = "1.0.0";
11334
11369
  const MIN_COMPATIBLE_NATIVE_VERSION = "1.0.0";
11335
11370
  const MIN_COMPATIBLE_EXTENSION_VERSION = "1.0.0";
11336
- const BUILD_TARGET_VERSION = "2.3.1";
11371
+ const BUILD_TARGET_VERSION = "2.3.2";
11337
11372
  const DEFAULT_CHROME_EXTENSION_ID = "illdpneeeopfffmiepaejglgmhpmdhdc";
11338
11373
  const REQUIRED_CAPABILITIES = Object.freeze([
11339
11374
  "bridgePing",
@@ -11347,7 +11382,9 @@ ${block}`;
11347
11382
  "historyClearPlugin",
11348
11383
  "localSkills",
11349
11384
  "mirrorSensitiveScan",
11350
- "providerProfiles"
11385
+ "providerProfiles",
11386
+ "assetTransfer",
11387
+ "threadFork"
11351
11388
  ]);
11352
11389
  const UPDATE_AVAILABLE_CAPABILITIES = Object.freeze([
11353
11390
  "bridgePing",
@@ -11634,7 +11671,7 @@ ${block}`;
11634
11671
  if (root) root.CodexOverleafPageRpcContract = api;
11635
11672
  })(typeof window !== "undefined" ? window : typeof globalThis !== "undefined" ? globalThis : this, function() {
11636
11673
  "use strict";
11637
- var REVISION = "2026-07-31-page-rpc-contract-v14";
11674
+ var REVISION = "2026-08-04-page-rpc-contract-v15";
11638
11675
  var METHODS = freezeCatalog({
11639
11676
  initializeCapability: entry("bridge.initialize", "control", "none", "default", false, "none"),
11640
11677
  probe: entry("bridge.probe", "read", "none", "default", false, "safe"),
@@ -11646,6 +11683,10 @@ ${block}`;
11646
11683
  ensureReviewing: entry("reviewing.enable", "page_state", "optional", "default", true, "idempotent"),
11647
11684
  ensureEditing: entry("reviewing.disable", "page_state", "optional", "default", true, "idempotent"),
11648
11685
  applyOperations: entry("document.write", "document", "required", "writeback", true, "no_retry"),
11686
+ binaryUploadBegin: entry("asset.stage", "cache", "required", "default", false, "no_retry"),
11687
+ binaryUploadAppend: entry("asset.stage", "cache", "none", "writeback", true, "no_retry"),
11688
+ binaryUploadCommit: entry("asset.write", "document", "required", "writeback", true, "no_retry"),
11689
+ binaryUploadAbort: entry("asset.stage", "cache", "none", "default", false, "idempotent"),
11649
11690
  jumpToPosition: entry("editor.navigate", "navigation", "required", "default", false, "idempotent"),
11650
11691
  rejectTrackedChanges: entry("tracked_changes.reject", "document", "required", "lifecycle", true, "no_retry"),
11651
11692
  acceptTrackedChanges: entry("tracked_changes.accept", "document", "required", "lifecycle", true, "no_retry"),
@@ -13015,6 +13056,7 @@ ${block}`;
13015
13056
  ["src/page/overleafProjectSnapshot.js", "codex-overleaf-project-snapshot-script"],
13016
13057
  ["src/page/pageBridgeCapability.js", "codex-overleaf-page-bridge-capability-script"],
13017
13058
  ["src/page/treeOperations.js", "codex-overleaf-tree-operations-script", true],
13059
+ ["src/page/binaryAssetUploader.js", "codex-overleaf-binary-asset-uploader-script", true],
13018
13060
  ["src/page/snapshotRouter.js", "codex-overleaf-snapshot-router-script"],
13019
13061
  ["src/page/writeGuard.js", "codex-overleaf-write-guard-script", true],
13020
13062
  ["src/page/trackedChangesLifecycle.js", "codex-overleaf-tracked-changes-lifecycle-script", true],
@@ -13490,6 +13532,9 @@ ${block}`;
13490
13532
  type: change.type,
13491
13533
  path: change.path,
13492
13534
  contentBase64: change.contentBase64 || "",
13535
+ assetRef: change.assetRef && typeof change.assetRef === "object" ? { ...change.assetRef } : void 0,
13536
+ sha256: change.sha256 || change.assetRef?.sha256 || "",
13537
+ mimeType: change.mimeType || change.assetRef?.mimeType || "",
13493
13538
  size: Number.isFinite(Number(change.size)) ? Number(change.size) : void 0,
13494
13539
  previousExists: change.previousExists === true,
13495
13540
  previousKind: change.previousKind || "",
@@ -13736,6 +13781,168 @@ ${block}`;
13736
13781
  });
13737
13782
  }).call(globalThis, void 0, void 0, void 0);
13738
13783
  (function runClassicContentModule43(module, exports, require2) {
13784
+ (function initCodexOverleafAssetTransferBroker(root, factory) {
13785
+ const api = factory();
13786
+ if (typeof module === "object" && module.exports) module.exports = api;
13787
+ if (root) root.CodexOverleafAssetTransferBroker = api;
13788
+ })(typeof window !== "undefined" ? window : globalThis, function assetTransferBrokerFactory() {
13789
+ "use strict";
13790
+ const BINARY_TYPES = /* @__PURE__ */ new Set(["binary-create", "overwrite-binary"]);
13791
+ function create(deps = {}) {
13792
+ const { callPageBridge, sendBackgroundNative } = deps;
13793
+ async function applyOperations(input = {}) {
13794
+ const results = [];
13795
+ let textBatch = [];
13796
+ async function flushTextBatch() {
13797
+ if (!textBatch.length) return;
13798
+ results.push(await callPageBridge("applyOperations", {
13799
+ operations: textBatch,
13800
+ baseFiles: input.baseFiles || [],
13801
+ requireReviewing: input.requireReviewing === true,
13802
+ requireEditing: input.requireEditing === true,
13803
+ runProjectId: input.runProjectId || ""
13804
+ }));
13805
+ textBatch = [];
13806
+ }
13807
+ for (const operation of Array.isArray(input.operations) ? input.operations : []) {
13808
+ if (!BINARY_TYPES.has(operation?.type)) {
13809
+ textBatch.push(operation);
13810
+ continue;
13811
+ }
13812
+ await flushTextBatch();
13813
+ results.push(await applyBinaryOperation(operation, input));
13814
+ }
13815
+ await flushTextBatch();
13816
+ return mergeApplyResults(results);
13817
+ }
13818
+ async function applyBinaryOperation(operation, input) {
13819
+ const transferId = `asset_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 10)}`;
13820
+ const assetRef = operation.assetRef || null;
13821
+ const safeOperation = sanitizeOperation(operation);
13822
+ let pageBegun = false;
13823
+ try {
13824
+ const begin = await callPageBridge("binaryUploadBegin", {
13825
+ transferId,
13826
+ path: operation.path,
13827
+ size: Number(operation.size || assetRef?.size || 0),
13828
+ sha256: assetRef?.sha256 || operation.sha256 || "",
13829
+ mimeType: assetRef?.mimeType || operation.mimeType || "application/octet-stream",
13830
+ overwrite: operation.type === "overwrite-binary",
13831
+ runProjectId: input.runProjectId || ""
13832
+ });
13833
+ if (!begin?.ok) throw responseError(begin, "binary_upload_begin_failed");
13834
+ pageBegun = true;
13835
+ if (assetRef?.token) {
13836
+ await streamNativeAsset(assetRef, transferId, input.runProjectId || "");
13837
+ } else if (typeof operation.contentBase64 === "string" && operation.contentBase64) {
13838
+ const append = await callPageBridge("binaryUploadAppend", {
13839
+ transferId,
13840
+ offset: 0,
13841
+ contentBase64: operation.contentBase64,
13842
+ runProjectId: input.runProjectId || ""
13843
+ });
13844
+ if (!append?.ok) throw responseError(append, "binary_upload_chunk_failed");
13845
+ } else {
13846
+ throw codedError("binary_asset_payload_missing", "Binary asset payload is unavailable.");
13847
+ }
13848
+ const committed = await callPageBridge("binaryUploadCommit", {
13849
+ transferId,
13850
+ runProjectId: input.runProjectId || ""
13851
+ });
13852
+ if (!committed?.ok) throw responseError(committed, committed?.code || "binary_upload_failed");
13853
+ return { ok: true, applied: [{ operation: safeOperation, result: committed }], skipped: [] };
13854
+ } catch (error) {
13855
+ if (pageBegun) {
13856
+ await callPageBridge("binaryUploadAbort", { transferId, runProjectId: input.runProjectId || "" }).catch(() => null);
13857
+ }
13858
+ const code = error.code || "binary_upload_failed";
13859
+ return {
13860
+ ok: false,
13861
+ applied: [],
13862
+ skipped: [{
13863
+ operation: safeOperation,
13864
+ path: operation.path,
13865
+ result: {
13866
+ ok: false,
13867
+ code,
13868
+ reason: error.message || "Binary asset upload failed.",
13869
+ changedDocument: false,
13870
+ failure: { code, stage: "write", file: operation.path, changedDocument: false }
13871
+ }
13872
+ }]
13873
+ };
13874
+ } finally {
13875
+ if (assetRef?.token) {
13876
+ await sendBackgroundNative({ method: "asset.release", params: { token: assetRef.token } }).catch(() => null);
13877
+ }
13878
+ }
13879
+ }
13880
+ async function streamNativeAsset(assetRef, transferId, runProjectId) {
13881
+ let offset = 0;
13882
+ while (offset < Number(assetRef.size || 0)) {
13883
+ const response = await sendBackgroundNative({
13884
+ method: "asset.readChunk",
13885
+ params: { token: assetRef.token, offset, length: assetRef.chunkSize || 196608 }
13886
+ });
13887
+ if (!response?.ok) throw responseError(response, response?.error?.code || "asset_chunk_read_failed");
13888
+ const chunk = response.result || {};
13889
+ if (chunk.offset !== offset || typeof chunk.contentBase64 !== "string" || chunk.nextOffset <= offset) {
13890
+ throw codedError("asset_chunk_sequence_invalid", "Native asset chunks arrived out of sequence.");
13891
+ }
13892
+ const appended = await callPageBridge("binaryUploadAppend", {
13893
+ transferId,
13894
+ offset,
13895
+ contentBase64: chunk.contentBase64,
13896
+ runProjectId
13897
+ });
13898
+ if (!appended?.ok) throw responseError(appended, appended?.code || "binary_upload_chunk_failed");
13899
+ offset = chunk.nextOffset;
13900
+ if (chunk.eof) break;
13901
+ }
13902
+ if (offset !== Number(assetRef.size || 0)) {
13903
+ throw codedError("asset_transfer_incomplete", "Native asset transfer ended before the expected size.");
13904
+ }
13905
+ }
13906
+ return { applyOperations };
13907
+ }
13908
+ function mergeApplyResults(results) {
13909
+ const merged = { ok: true, applied: [], skipped: [], trackedChanges: [] };
13910
+ for (const result of results) {
13911
+ merged.applied.push(...Array.isArray(result?.applied) ? result.applied : []);
13912
+ merged.skipped.push(...Array.isArray(result?.skipped) ? result.skipped : []);
13913
+ merged.trackedChanges.push(...Array.isArray(result?.trackedChanges) ? result.trackedChanges : []);
13914
+ if (result?.ok !== true) merged.ok = false;
13915
+ }
13916
+ if (merged.skipped.length) merged.ok = false;
13917
+ return merged;
13918
+ }
13919
+ function sanitizeOperation(operation) {
13920
+ const { contentBase64, assetRef, ...safe } = operation || {};
13921
+ if (assetRef) {
13922
+ safe.asset = {
13923
+ path: assetRef.path || safe.path,
13924
+ size: assetRef.size,
13925
+ sha256: assetRef.sha256,
13926
+ mimeType: assetRef.mimeType
13927
+ };
13928
+ }
13929
+ return safe;
13930
+ }
13931
+ function responseError(response, fallbackCode) {
13932
+ return codedError(
13933
+ response?.code || response?.error?.code || fallbackCode,
13934
+ response?.reason || response?.error?.message || response?.error || "Asset transfer failed."
13935
+ );
13936
+ }
13937
+ function codedError(code, message) {
13938
+ const error = new Error(String(message || code));
13939
+ error.code = code;
13940
+ return error;
13941
+ }
13942
+ return { create, mergeApplyResults };
13943
+ });
13944
+ }).call(globalThis, void 0, void 0, void 0);
13945
+ (function runClassicContentModule44(module, exports, require2) {
13739
13946
  (function initCodexOverleafReviewHunks(root, factory) {
13740
13947
  if (typeof module === "object" && module.exports) {
13741
13948
  module.exports = factory();
@@ -13954,7 +14161,7 @@ ${block}`;
13954
14161
  };
13955
14162
  });
13956
14163
  }).call(globalThis, void 0, void 0, void 0);
13957
- (function runClassicContentModule44(module, exports, require2) {
14164
+ (function runClassicContentModule45(module, exports, require2) {
13958
14165
  (function initCodexOverleafDiffReviewPanel(root, factory) {
13959
14166
  if (typeof module === "object" && module.exports) {
13960
14167
  module.exports = factory(require2("./reviewHunks"));
@@ -14681,7 +14888,7 @@ ${block}`;
14681
14888
  };
14682
14889
  });
14683
14890
  }).call(globalThis, void 0, void 0, void 0);
14684
- (function runClassicContentModule45(module, exports, require2) {
14891
+ (function runClassicContentModule46(module, exports, require2) {
14685
14892
  (function initCodexOverleafContextTray(root, factory) {
14686
14893
  if (typeof module === "object" && module.exports) {
14687
14894
  module.exports = factory(require2("../shared/projectFiles"));
@@ -15429,7 +15636,7 @@ ${block}`;
15429
15636
  };
15430
15637
  });
15431
15638
  }).call(globalThis, void 0, void 0, void 0);
15432
- (function runClassicContentModule46(module, exports, require2) {
15639
+ (function runClassicContentModule47(module, exports, require2) {
15433
15640
  (function initCodexOverleafLocalSkillsPanel(root, factory) {
15434
15641
  if (typeof module === "object" && module.exports) {
15435
15642
  module.exports = factory();
@@ -15660,7 +15867,7 @@ ${block}`;
15660
15867
  };
15661
15868
  });
15662
15869
  }).call(globalThis, void 0, void 0, void 0);
15663
- (function runClassicContentModule47(module, exports, require2) {
15870
+ (function runClassicContentModule48(module, exports, require2) {
15664
15871
  (function initCodexOverleafRunController(root, factory) {
15665
15872
  if (typeof module === "object" && module.exports) {
15666
15873
  module.exports = factory();
@@ -15862,7 +16069,7 @@ ${block}`;
15862
16069
  };
15863
16070
  });
15864
16071
  }).call(globalThis, void 0, void 0, void 0);
15865
- (function runClassicContentModule48(module, exports, require2) {
16072
+ (function runClassicContentModule49(module, exports, require2) {
15866
16073
  (function initCodexOverleafMirrorHealth(root, factory) {
15867
16074
  if (typeof module === "object" && module.exports) {
15868
16075
  module.exports = factory();
@@ -15946,7 +16153,7 @@ ${block}`;
15946
16153
  };
15947
16154
  });
15948
16155
  }).call(globalThis, void 0, void 0, void 0);
15949
- (function runClassicContentModule49(module, exports, require2) {
16156
+ (function runClassicContentModule50(module, exports, require2) {
15950
16157
  (function initCodexOverleafOtWarmMirrorController(root, factory) {
15951
16158
  if (typeof module === "object" && module.exports) {
15952
16159
  module.exports = factory();
@@ -16099,7 +16306,7 @@ ${block}`;
16099
16306
  };
16100
16307
  });
16101
16308
  }).call(globalThis, void 0, void 0, void 0);
16102
- (function runClassicContentModule50(module, exports, require2) {
16309
+ (function runClassicContentModule51(module, exports, require2) {
16103
16310
  (function initComposerAttachments(global) {
16104
16311
  "use strict";
16105
16312
  function createComposerAttachmentController(options2 = {}) {
@@ -16559,7 +16766,7 @@ ${block}`;
16559
16766
  };
16560
16767
  })(window);
16561
16768
  }).call(globalThis, void 0, void 0, void 0);
16562
- (function runClassicContentModule51(module, exports, require2) {
16769
+ (function runClassicContentModule52(module, exports, require2) {
16563
16770
  (function initCodexOverleafPanelRenderer() {
16564
16771
  "use strict";
16565
16772
  const ROOT_CLASS = "codex-overleaf-panel-mounted";
@@ -16879,7 +17086,7 @@ ${block}`;
16879
17086
  };
16880
17087
  })();
16881
17088
  }).call(globalThis, void 0, void 0, void 0);
16882
- (function runClassicContentModule52(module, exports, require2) {
17089
+ (function runClassicContentModule53(module, exports, require2) {
16883
17090
  (function initCodexOverleafSessionPanel() {
16884
17091
  "use strict";
16885
17092
  function create(options2 = {}) {
@@ -17115,7 +17322,7 @@ ${block}`;
17115
17322
  };
17116
17323
  })();
17117
17324
  }).call(globalThis, void 0, void 0, void 0);
17118
- (function runClassicContentModule53(module, exports, require2) {
17325
+ (function runClassicContentModule54(module, exports, require2) {
17119
17326
  (function initCodexOverleafSettingsPanel() {
17120
17327
  "use strict";
17121
17328
  function codexIcon(name) {
@@ -17630,7 +17837,7 @@ ${block}`;
17630
17837
  };
17631
17838
  })();
17632
17839
  }).call(globalThis, void 0, void 0, void 0);
17633
- (function runClassicContentModule54(module, exports, require2) {
17840
+ (function runClassicContentModule55(module, exports, require2) {
17634
17841
  (function initCodexOverleafProviderSettingsDialog() {
17635
17842
  "use strict";
17636
17843
  const CODEX_BLOSSOM_PATH = "M13.798 23.976a5.7 5.7 0 0 1-2.26-.456 6.1 6.1 0 0 1-1.903-1.27 5.7 5.7 0 0 1-1.88.311 5.75 5.75 0 0 1-2.95-.79 6.2 6.2 0 0 1-2.188-2.159q-.81-1.366-.809-3.045 0-.695.19-1.51a6.4 6.4 0 0 1-1.475-2.038A5.95 5.95 0 0 1 0 10.573Q0 9.278.547 8.08q.547-1.2 1.523-2.062a5.5 5.5 0 0 1 2.307-1.223A5.7 5.7 0 0 1 5.472 2.35 6.1 6.1 0 0 1 7.565.623 5.8 5.8 0 0 1 10.206 0q1.19 0 2.26.456a6.1 6.1 0 0 1 1.903 1.27 5.7 5.7 0 0 1 1.88-.311q1.594 0 2.95.79a6 6 0 0 1 2.165 2.159q.832 1.366.832 3.045 0 .695-.19 1.51a6.3 6.3 0 0 1 1.475 2.062q.523 1.15.523 2.422a5.9 5.9 0 0 1-.547 2.493q-.547 1.2-1.546 2.086a5.4 5.4 0 0 1-2.284 1.199 5.56 5.56 0 0 1-1.118 2.445 5.9 5.9 0 0 1-2.07 1.727 5.8 5.8 0 0 1-2.64.623m-5.876-2.997q1.19 0 2.07-.504l4.472-2.589a.53.53 0 0 0 .238-.455v-2.062L8.945 18.7a.96.96 0 0 1-1.047 0l-4.496-2.613a.7.7 0 0 1-.024.168v.287q0 1.224.571 2.254a4.24 4.24 0 0 0 1.642 1.583q1.047.6 2.331.599m.238-3.908a.6.6 0 0 0 .262.072q.118 0 .238-.072l1.784-1.031-5.734-3.357q-.522-.312-.523-.935V6.545a4.3 4.3 0 0 0-1.903 1.63 4.25 4.25 0 0 0-.714 2.398q0 1.176.595 2.254.594 1.08 1.546 1.63zm5.638 5.323q1.26 0 2.284-.576a4.3 4.3 0 0 0 1.618-1.582q.595-1.008.595-2.254v-5.179a.47.47 0 0 0-.238-.431l-1.808-1.055v6.689q0 .624-.524.935l-4.496 2.613a4.3 4.3 0 0 0 2.57.84m.904-8.776v-3.26l-2.688-1.535-2.712 1.535v3.26l2.712 1.535zM7.756 5.97q0-.623.523-.935l4.496-2.613a4.3 4.3 0 0 0-2.569-.84q-1.26 0-2.284.576A4.3 4.3 0 0 0 6.304 3.74q-.57 1.008-.57 2.254v5.155q0 .287.237.455l1.785 1.055zM19.84 17.43a4.16 4.16 0 0 0 1.88-1.63 4.33 4.33 0 0 0 .713-2.397q0-1.176-.595-2.254-.594-1.08-1.546-1.63l-4.449-2.59q-.143-.096-.261-.072a.46.46 0 0 0-.238.072L13.56 7.936l5.758 3.38a.9.9 0 0 1 .38.384q.143.216.143.528zM15.059 5.25q.524-.335 1.047 0l4.52 2.662V7.48q0-1.15-.57-2.181A4.14 4.14 0 0 0 18.46 3.62q-1.023-.623-2.379-.623-1.19 0-2.07.503L9.54 6.09a.53.53 0 0 0-.238.455v2.062z";
@@ -18550,7 +18757,7 @@ ${block}`;
18550
18757
  window.CodexOverleafProviderSettingsDialog = { create, getFooterActionState };
18551
18758
  })();
18552
18759
  }).call(globalThis, void 0, void 0, void 0);
18553
- (function runClassicContentModule55(module, exports, require2) {
18760
+ (function runClassicContentModule56(module, exports, require2) {
18554
18761
  (function initCodexOverleafProjectProviderSelection() {
18555
18762
  "use strict";
18556
18763
  function create(deps = {}) {
@@ -18607,7 +18814,7 @@ ${block}`;
18607
18814
  window.CodexOverleafProjectProviderSelection = { create };
18608
18815
  })();
18609
18816
  }).call(globalThis, void 0, void 0, void 0);
18610
- (function runClassicContentModule56(module, exports, require2) {
18817
+ (function runClassicContentModule57(module, exports, require2) {
18611
18818
  (function initCodexOverleafProviderSettingsCoordinator() {
18612
18819
  "use strict";
18613
18820
  function create(options2 = {}) {
@@ -19200,7 +19407,7 @@ ${block}`;
19200
19407
  window.CodexOverleafProviderSettingsCoordinator = { create };
19201
19408
  })();
19202
19409
  }).call(globalThis, void 0, void 0, void 0);
19203
- (function runClassicContentModule57(module, exports, require2) {
19410
+ (function runClassicContentModule58(module, exports, require2) {
19204
19411
  (function initCodexOverleafSessionPersistence(root, factory) {
19205
19412
  if (typeof module === "object" && module.exports) {
19206
19413
  module.exports = factory(require2("../shared/storageMigration"));
@@ -19294,7 +19501,7 @@ ${block}`;
19294
19501
  };
19295
19502
  });
19296
19503
  }).call(globalThis, void 0, void 0, void 0);
19297
- (function runClassicContentModule58(module, exports, require2) {
19504
+ (function runClassicContentModule59(module, exports, require2) {
19298
19505
  (function(root, factory) {
19299
19506
  var api = factory();
19300
19507
  if (typeof module === "object" && module.exports) module.exports = api;
@@ -19398,7 +19605,7 @@ ${block}`;
19398
19605
  return Object.freeze({ persistPanelState });
19399
19606
  });
19400
19607
  }).call(globalThis, void 0, void 0, void 0);
19401
- (function runClassicContentModule59(module, exports, require2) {
19608
+ (function runClassicContentModule60(module, exports, require2) {
19402
19609
  (function(root, factory) {
19403
19610
  var api = factory();
19404
19611
  if (typeof module === "object" && module.exports) module.exports = api;
@@ -19443,7 +19650,7 @@ ${block}`;
19443
19650
  return Object.freeze({ create });
19444
19651
  });
19445
19652
  }).call(globalThis, void 0, void 0, void 0);
19446
- (function runClassicContentModule60(module, exports, require2) {
19653
+ (function runClassicContentModule61(module, exports, require2) {
19447
19654
  (function(root, factory) {
19448
19655
  if (typeof module === "object" && module.exports) {
19449
19656
  module.exports = factory(
@@ -19538,7 +19745,7 @@ ${block}`;
19538
19745
  });
19539
19746
  });
19540
19747
  }).call(globalThis, void 0, void 0, void 0);
19541
- (function runClassicContentModule61(module, exports, require2) {
19748
+ (function runClassicContentModule62(module, exports, require2) {
19542
19749
  (function initCodexOverleafDiagnosticsPanel() {
19543
19750
  "use strict";
19544
19751
  function create(options2 = {}) {
@@ -19966,7 +20173,7 @@ ${block}`;
19966
20173
  };
19967
20174
  })();
19968
20175
  }).call(globalThis, void 0, void 0, void 0);
19969
- (function runClassicContentModule62(module, exports, require2) {
20176
+ (function runClassicContentModule63(module, exports, require2) {
19970
20177
  (function initCodexOverleafRunQueueScheduler(root, factory) {
19971
20178
  if (typeof module === "object" && module.exports) {
19972
20179
  module.exports = factory(require2("../shared/runInputQueue"));
@@ -20294,7 +20501,7 @@ ${block}`;
20294
20501
  return { create, createCoordinator };
20295
20502
  });
20296
20503
  }).call(globalThis, void 0, void 0, void 0);
20297
- (function runClassicContentModule63(module, exports, require2) {
20504
+ (function runClassicContentModule64(module, exports, require2) {
20298
20505
  (function initCodexOverleafActiveTurnControl(root, factory) {
20299
20506
  if (typeof module === "object" && module.exports) {
20300
20507
  module.exports = factory();
@@ -20463,7 +20670,7 @@ ${block}`;
20463
20670
  return { create };
20464
20671
  });
20465
20672
  }).call(globalThis, void 0, void 0, void 0);
20466
- (function runClassicContentModule64(module, exports, require2) {
20673
+ (function runClassicContentModule65(module, exports, require2) {
20467
20674
  (function initCodexOverleafPendingInputView(root, factory) {
20468
20675
  if (typeof module === "object" && module.exports) {
20469
20676
  module.exports = factory();
@@ -20554,7 +20761,7 @@ ${block}`;
20554
20761
  return { create };
20555
20762
  });
20556
20763
  }).call(globalThis, void 0, void 0, void 0);
20557
- (function runClassicContentModule65(module, exports, require2) {
20764
+ (function runClassicContentModule66(module, exports, require2) {
20558
20765
  (function initCodexOverleafComposerPanel() {
20559
20766
  "use strict";
20560
20767
  function create(options2 = {}) {
@@ -20813,7 +21020,7 @@ ${block}`;
20813
21020
  };
20814
21021
  })();
20815
21022
  }).call(globalThis, void 0, void 0, void 0);
20816
- (function runClassicContentModule66(module, exports, require2) {
21023
+ (function runClassicContentModule67(module, exports, require2) {
20817
21024
  (function initCodexOverleafTheme(root, factory) {
20818
21025
  if (typeof module === "object" && module.exports) {
20819
21026
  module.exports = factory();
@@ -20881,7 +21088,7 @@ ${block}`;
20881
21088
  };
20882
21089
  });
20883
21090
  }).call(globalThis, void 0, void 0, void 0);
20884
- (function runClassicContentModule67(module, exports, require2) {
21091
+ (function runClassicContentModule68(module, exports, require2) {
20885
21092
  !(function(e, t) {
20886
21093
  "object" == typeof exports && "object" == typeof module ? module.exports = t() : "function" == typeof define && define.amd ? define([], t) : "object" == typeof exports ? exports.katex = t() : e.katex = t();
20887
21094
  })("undefined" != typeof self ? self : this, function() {
@@ -24301,7 +24508,7 @@ ${block}`;
24301
24508
  })();
24302
24509
  });
24303
24510
  }).call(globalThis, void 0, void 0, void 0);
24304
- (function runClassicContentModule68(module, exports, require2) {
24511
+ (function runClassicContentModule69(module, exports, require2) {
24305
24512
  !(function(t, e) {
24306
24513
  "object" == typeof exports && "undefined" != typeof module ? module.exports = e() : "function" == typeof define && define.amd ? define([], e) : (t = "undefined" != typeof globalThis ? globalThis : t || self).markdownit = e();
24307
24514
  })(this, function() {
@@ -26373,7 +26580,7 @@ ${block}`;
26373
26580
  }, Ke;
26374
26581
  });
26375
26582
  }).call(globalThis, void 0, void 0, void 0);
26376
- (function runClassicContentModule69(module, exports, require2) {
26583
+ (function runClassicContentModule70(module, exports, require2) {
26377
26584
  (function initCodexOverleafMathText(root) {
26378
26585
  "use strict";
26379
26586
  const DELIMITERS = Object.freeze([
@@ -26758,7 +26965,7 @@ ${block}`;
26758
26965
  }
26759
26966
  })(typeof window !== "undefined" ? window : globalThis);
26760
26967
  }).call(globalThis, void 0, void 0, void 0);
26761
- (function runClassicContentModule70(module, exports, require2) {
26968
+ (function runClassicContentModule71(module, exports, require2) {
26762
26969
  (function initCodexOverleafMarkdownDomRenderer(root, factory) {
26763
26970
  const api = factory();
26764
26971
  if (typeof module === "object" && module.exports) {
@@ -27186,7 +27393,7 @@ ${block}`;
27186
27393
  };
27187
27394
  });
27188
27395
  }).call(globalThis, void 0, void 0, void 0);
27189
- (function runClassicContentModule71(module, exports, require2) {
27396
+ (function runClassicContentModule72(module, exports, require2) {
27190
27397
  (function initCodexOverleafMarkdownText() {
27191
27398
  "use strict";
27192
27399
  function create(deps = {}) {
@@ -27813,7 +28020,7 @@ ${block}`;
27813
28020
  window.CodexOverleafMarkdownText = { create };
27814
28021
  })();
27815
28022
  }).call(globalThis, void 0, void 0, void 0);
27816
- (function runClassicContentModule72(module, exports, require2) {
28023
+ (function runClassicContentModule73(module, exports, require2) {
27817
28024
  (function initCodexOverleafDiagnosticsController() {
27818
28025
  "use strict";
27819
28026
  function create(deps = {}) {
@@ -28382,7 +28589,7 @@ ${block}`;
28382
28589
  window.CodexOverleafDiagnosticsController = { create };
28383
28590
  })();
28384
28591
  }).call(globalThis, void 0, void 0, void 0);
28385
- (function runClassicContentModule73(module, exports, require2) {
28592
+ (function runClassicContentModule74(module, exports, require2) {
28386
28593
  (function initCodexOverleafRunGuidanceView() {
28387
28594
  "use strict";
28388
28595
  const LEGACY_GUIDANCE_TITLES = /* @__PURE__ */ new Set([
@@ -28422,7 +28629,7 @@ ${block}`;
28422
28629
  };
28423
28630
  })();
28424
28631
  }).call(globalThis, void 0, void 0, void 0);
28425
- (function runClassicContentModule74(module, exports, require2) {
28632
+ (function runClassicContentModule75(module, exports, require2) {
28426
28633
  (function initCodexOverleafRunGuidanceController() {
28427
28634
  "use strict";
28428
28635
  function create(deps = {}) {
@@ -28485,12 +28692,118 @@ ${block}`;
28485
28692
  window.CodexOverleafRunGuidanceController = { create };
28486
28693
  })();
28487
28694
  }).call(globalThis, void 0, void 0, void 0);
28488
- (function runClassicContentModule75(module, exports, require2) {
28695
+ (function runClassicContentModule76(module, exports, require2) {
28696
+ (function initCodexOverleafRunResultActions(root, factory) {
28697
+ const api = factory();
28698
+ if (typeof module === "object" && module.exports) module.exports = api;
28699
+ if (root) root.CodexOverleafRunResultActions = api;
28700
+ })(typeof window !== "undefined" ? window : globalThis, function runResultActionsFactory() {
28701
+ "use strict";
28702
+ function create(deps = {}) {
28703
+ const {
28704
+ tr,
28705
+ getLocale,
28706
+ forkRunFromNode,
28707
+ document: documentRef = globalThis.document,
28708
+ navigator: navigatorRef = globalThis.navigator
28709
+ } = deps;
28710
+ function configureResultActions(root, run) {
28711
+ const actions = root.querySelector(".run-result-actions");
28712
+ const reports = root.querySelectorAll(".run-completion-report");
28713
+ const report = reports[reports.length - 1];
28714
+ if (!actions || !report) return;
28715
+ report.append(actions);
28716
+ actions.hidden = false;
28717
+ configureCopyButton(root);
28718
+ configureForkButton(root, run);
28719
+ configureCompletedTime(actions, run);
28720
+ }
28721
+ function configureForkButton(root, run) {
28722
+ const existing = root.querySelector("[data-run-fork]");
28723
+ const button = existing.cloneNode(true);
28724
+ existing.replaceWith(button);
28725
+ const available = run.forkSnapshot !== true && run.status !== "running" && Boolean(run.codexTurnId) && typeof forkRunFromNode === "function";
28726
+ button.hidden = false;
28727
+ button.disabled = !available;
28728
+ button.title = tr(available ? "forkRunTitle" : "forkRunUnavailable");
28729
+ button.setAttribute("aria-label", button.title);
28730
+ button.innerHTML = '<svg viewBox="0 0 20 20" aria-hidden="true"><path d="M3 10h3.5c3.5 0 4.2-4 7.5-4h2m-2.5-2.5L16 6l-2.5 2.5M6.5 10c3.5 0 4.2 4 7.5 4h2m-2.5-2.5L16 14l-2.5 2.5"/></svg>';
28731
+ if (!available) return;
28732
+ button.addEventListener("click", async (event) => {
28733
+ event.stopPropagation();
28734
+ button.disabled = true;
28735
+ button.classList.add("is-running");
28736
+ try {
28737
+ await forkRunFromNode(run.id);
28738
+ } catch (_error) {
28739
+ button.disabled = false;
28740
+ button.classList.remove("is-running");
28741
+ }
28742
+ });
28743
+ }
28744
+ function configureCompletedTime(actions, run) {
28745
+ const target = actions.querySelector("[data-run-completed-time]");
28746
+ const finishedAt = String(run.finishedAt || "").trim();
28747
+ const date = finishedAt ? new Date(finishedAt) : null;
28748
+ if (!target || !date || !Number.isFinite(date.getTime())) return;
28749
+ target.hidden = false;
28750
+ target.textContent = new Intl.DateTimeFormat(getLocale(), {
28751
+ hour: "2-digit",
28752
+ minute: "2-digit"
28753
+ }).format(date);
28754
+ target.title = date.toLocaleString(getLocale());
28755
+ }
28756
+ function configureCopyButton(root) {
28757
+ const existing = root.querySelector("[data-run-copy]");
28758
+ const button = existing.cloneNode(true);
28759
+ existing.replaceWith(button);
28760
+ const finalAnswer = root.querySelector(".run-completion-report .run-final-answer");
28761
+ const copyText = String(finalAnswer?.innerText || finalAnswer?.textContent || "").trim();
28762
+ button.hidden = false;
28763
+ button.disabled = !copyText;
28764
+ button.title = tr("copyConclusionTitle");
28765
+ button.setAttribute("aria-label", button.title);
28766
+ button.innerHTML = '<svg viewBox="0 0 20 20" aria-hidden="true"><rect x="6.5" y="6.5" width="9" height="9" rx="2"/><path d="M13.5 6.5V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v6.5a2 2 0 0 0 2 2h1.5"/></svg>';
28767
+ if (!copyText) return;
28768
+ button.addEventListener("click", async (event) => {
28769
+ event.stopPropagation();
28770
+ try {
28771
+ await writeClipboardText(copyText);
28772
+ button.title = tr("copyConclusionDone");
28773
+ } catch (_error) {
28774
+ button.title = tr("copyConclusionFailed");
28775
+ }
28776
+ button.setAttribute("aria-label", button.title);
28777
+ });
28778
+ }
28779
+ async function writeClipboardText(text) {
28780
+ if (navigatorRef?.clipboard?.writeText) {
28781
+ await navigatorRef.clipboard.writeText(text);
28782
+ return;
28783
+ }
28784
+ const textarea = documentRef.createElement("textarea");
28785
+ textarea.value = text;
28786
+ textarea.setAttribute("readonly", "");
28787
+ textarea.style.position = "fixed";
28788
+ textarea.style.opacity = "0";
28789
+ documentRef.body.append(textarea);
28790
+ textarea.select();
28791
+ const copied = documentRef.execCommand("copy");
28792
+ textarea.remove();
28793
+ if (!copied) throw new Error("clipboard_copy_failed");
28794
+ }
28795
+ return Object.freeze({ configureResultActions });
28796
+ }
28797
+ return Object.freeze({ create });
28798
+ });
28799
+ }).call(globalThis, void 0, void 0, void 0);
28800
+ (function runClassicContentModule77(module, exports, require2) {
28489
28801
  (function initCodexOverleafRunTimelineView() {
28490
28802
  "use strict";
28491
28803
  function create(deps = {}) {
28492
28804
  const {
28493
28805
  RunGuidanceView,
28806
+ RunResultActions,
28494
28807
  tr,
28495
28808
  tx,
28496
28809
  getLocale,
@@ -28772,6 +29085,11 @@ ${block}`;
28772
29085
  </summary>
28773
29086
  </details>
28774
29087
  <div class="run-activity-list" data-run-events></div>
29088
+ <div class="run-result-actions" hidden>
29089
+ <button type="button" class="run-copy-action" data-run-copy hidden></button>
29090
+ <button type="button" class="run-fork-action" data-run-fork hidden></button>
29091
+ <span class="run-completed-time" data-run-completed-time hidden></span>
29092
+ </div>
28775
29093
  <div class="run-report" data-run-report aria-live="polite" hidden></div>
28776
29094
  </div>
28777
29095
  `;
@@ -28820,6 +29138,7 @@ ${block}`;
28820
29138
  events.append(renderRunEvent(event));
28821
29139
  }
28822
29140
  }
29141
+ RunResultActions.configureResultActions(root, run);
28823
29142
  configureAcceptButton(root, run);
28824
29143
  configureUndoButton(root, run);
28825
29144
  return root;
@@ -29257,6 +29576,10 @@ ${conclusion}` : `${label} ${conclusion}`;
29257
29576
  const existing = root.querySelector("[data-run-undo]");
29258
29577
  const button = existing.cloneNode(true);
29259
29578
  existing.replaceWith(button);
29579
+ if (run.forkSnapshot === true) {
29580
+ button.hidden = true;
29581
+ return;
29582
+ }
29260
29583
  if (isTrackedChangeLifecycleRun(run)) {
29261
29584
  configureLifecycleUndoButton(button, run);
29262
29585
  return;
@@ -29325,6 +29648,10 @@ ${conclusion}` : `${label} ${conclusion}`;
29325
29648
  const existing = root.querySelector("[data-run-accept]");
29326
29649
  const button = existing.cloneNode(true);
29327
29650
  existing.replaceWith(button);
29651
+ if (run.forkSnapshot === true) {
29652
+ button.hidden = true;
29653
+ return;
29654
+ }
29328
29655
  if (!isTrackedChangeLifecycleRun(run)) {
29329
29656
  button.hidden = true;
29330
29657
  return;
@@ -29439,7 +29766,7 @@ ${conclusion}` : `${label} ${conclusion}`;
29439
29766
  window.CodexOverleafRunTimelineView = { create };
29440
29767
  })();
29441
29768
  }).call(globalThis, void 0, void 0, void 0);
29442
- (function runClassicContentModule76(module, exports, require2) {
29769
+ (function runClassicContentModule78(module, exports, require2) {
29443
29770
  (function initCodexOverleafProjectSettingsCoordinator() {
29444
29771
  "use strict";
29445
29772
  function create(deps = {}) {
@@ -29766,7 +30093,7 @@ ${conclusion}` : `${label} ${conclusion}`;
29766
30093
  window.CodexOverleafProjectSettingsCoordinator = { create };
29767
30094
  })();
29768
30095
  }).call(globalThis, void 0, void 0, void 0);
29769
- (function runClassicContentModule77(module, exports, require2) {
30096
+ (function runClassicContentModule79(module, exports, require2) {
29770
30097
  (function initCodexOverleafSessionMenuView() {
29771
30098
  "use strict";
29772
30099
  function create(deps = {}) {
@@ -29971,7 +30298,7 @@ ${conclusion}` : `${label} ${conclusion}`;
29971
30298
  window.CodexOverleafSessionMenuView = { create };
29972
30299
  })();
29973
30300
  }).call(globalThis, void 0, void 0, void 0);
29974
- (function runClassicContentModule78(module, exports, require2) {
30301
+ (function runClassicContentModule80(module, exports, require2) {
29975
30302
  (function initCodexOverleafSessionManager() {
29976
30303
  "use strict";
29977
30304
  function create(deps = {}) {
@@ -30230,7 +30557,136 @@ ${conclusion}` : `${label} ${conclusion}`;
30230
30557
  window.CodexOverleafSessionManager = { create };
30231
30558
  })();
30232
30559
  }).call(globalThis, void 0, void 0, void 0);
30233
- (function runClassicContentModule79(module, exports, require2) {
30560
+ (function runClassicContentModule81(module, exports, require2) {
30561
+ (function initCodexOverleafSessionForkController(root, factory) {
30562
+ const api = factory();
30563
+ if (typeof module === "object" && module.exports) module.exports = api;
30564
+ if (root) root.CodexOverleafSessionForkController = api;
30565
+ })(typeof window !== "undefined" ? window : globalThis, function sessionForkControllerFactory() {
30566
+ "use strict";
30567
+ function create(deps = {}) {
30568
+ const {
30569
+ SessionState,
30570
+ getState,
30571
+ setState,
30572
+ sendBackgroundNative,
30573
+ saveState,
30574
+ applyStateToPanel,
30575
+ showPluginToast,
30576
+ tr
30577
+ } = deps;
30578
+ async function forkRunFromNode(runId) {
30579
+ const previousState = getState();
30580
+ const source = findSource(previousState, runId);
30581
+ if (!source) return failFork("session_fork_source_missing", tr("forkRunUnavailable"));
30582
+ const { session, run, runIndex } = source;
30583
+ if (run.status === "running" || !session.codexThreadId || !run.codexTurnId) {
30584
+ return failFork("session_fork_unavailable", tr("forkRunUnavailable"));
30585
+ }
30586
+ const response = await sendBackgroundNative({
30587
+ method: "codex.thread.fork",
30588
+ params: {
30589
+ threadId: session.codexThreadId,
30590
+ lastTurnId: run.codexTurnId,
30591
+ speedTier: session.speedTier,
30592
+ loadCodexLocalSkills: previousState.loadCodexLocalSkills !== false,
30593
+ loadCodexOverleafSkills: previousState.loadCodexOverleafSkills !== false
30594
+ }
30595
+ });
30596
+ if (!response?.ok || !response.result?.threadId) {
30597
+ return failFork(response?.error?.code || "session_fork_failed", response?.error?.message || tr("forkRunFailed"));
30598
+ }
30599
+ const copiedRuns = session.runs.slice(0, runIndex + 1).map(copyRunSnapshot);
30600
+ const titleBase = String(session.title || copiedRuns[0]?.task || tr("newSessionFallback")).trim();
30601
+ const forkTitle = buildUniqueForkTitle(previousState.sessions, titleBase);
30602
+ const forked = SessionState.createSession({
30603
+ title: forkTitle,
30604
+ titleSource: "manual",
30605
+ runs: copiedRuns,
30606
+ task: "",
30607
+ mode: session.mode,
30608
+ providerId: session.providerId,
30609
+ model: session.model,
30610
+ reasoningEffort: session.reasoningEffort,
30611
+ speedTier: session.speedTier,
30612
+ requireReviewing: session.requireReviewing,
30613
+ focusFiles: session.focusFiles,
30614
+ projectReferenceFiles: session.projectReferenceFiles,
30615
+ codexThreadId: response.result.threadId,
30616
+ pendingInputs: [],
30617
+ forkedFromSessionId: session.id,
30618
+ forkedFromRunId: run.id
30619
+ });
30620
+ setState(SessionState.normalizePanelState({
30621
+ ...previousState,
30622
+ sessions: [...previousState.sessions || [], forked],
30623
+ activeSessionId: forked.id
30624
+ }));
30625
+ try {
30626
+ await saveState();
30627
+ } catch (error) {
30628
+ setState(previousState);
30629
+ await sendBackgroundNative({
30630
+ method: "codex.history.clearPlugin",
30631
+ params: { sessionId: forked.id, threadId: response.result.threadId }
30632
+ }).catch(() => null);
30633
+ showPluginToast(error.message || tr("forkRunFailed"), { status: "failed", sticky: true });
30634
+ throw error;
30635
+ }
30636
+ applyStateToPanel();
30637
+ showPluginToast(tr("forkRunDone"), { status: "completed" });
30638
+ return forked;
30639
+ }
30640
+ function failFork(code, message) {
30641
+ showPluginToast(message, { status: "failed", sticky: true });
30642
+ throw codedError(code, message);
30643
+ }
30644
+ return { forkRunFromNode };
30645
+ }
30646
+ function buildUniqueForkTitle(sessions = [], sourceTitle = "") {
30647
+ const fallback = String(sourceTitle || "New Session").trim() || "New Session";
30648
+ const baseTitle = fallback.replace(/\s+\(fork\)$/i, "").replace(/\s+\(\d+\)$/, "").trim() || fallback;
30649
+ const usedTitles = new Set((sessions || []).map((session) => String(session?.title || "").trim()));
30650
+ let index = 1;
30651
+ while (usedTitles.has(`${baseTitle} (${index})`)) index += 1;
30652
+ return `${baseTitle} (${index})`;
30653
+ }
30654
+ function findSource(state, runId) {
30655
+ for (const session of state?.sessions || []) {
30656
+ const runIndex = (session.runs || []).findIndex((run) => run.id === runId);
30657
+ if (runIndex >= 0) return { session, run: session.runs[runIndex], runIndex };
30658
+ }
30659
+ return null;
30660
+ }
30661
+ function copyRunSnapshot(run) {
30662
+ const copy = JSON.parse(JSON.stringify(run || {}));
30663
+ return {
30664
+ ...copy,
30665
+ id: `fork_${String(copy.id || "run")}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 7)}`,
30666
+ forkSnapshot: true,
30667
+ forkSourceRunId: String(copy.id || ""),
30668
+ attachments: [],
30669
+ appliedOperations: [],
30670
+ undoOperations: [],
30671
+ undoBaseFiles: [],
30672
+ undoTrackedChanges: [],
30673
+ undoExpectedFiles: [],
30674
+ undoStatus: "",
30675
+ trackedChangeStatus: "",
30676
+ nativeRequestId: "",
30677
+ queueItemId: "",
30678
+ interruptedDraft: void 0
30679
+ };
30680
+ }
30681
+ function codedError(code, message) {
30682
+ const error = new Error(message);
30683
+ error.code = code;
30684
+ return error;
30685
+ }
30686
+ return { copyRunSnapshot, create };
30687
+ });
30688
+ }).call(globalThis, void 0, void 0, void 0);
30689
+ (function runClassicContentModule82(module, exports, require2) {
30234
30690
  (function initCodexOverleafApplyResultFormatters() {
30235
30691
  "use strict";
30236
30692
  function create(deps = {}) {
@@ -30550,7 +31006,7 @@ ${conclusion}` : `${label} ${conclusion}`;
30550
31006
  window.CodexOverleafApplyResultFormatters = { create };
30551
31007
  })();
30552
31008
  }).call(globalThis, void 0, void 0, void 0);
30553
- (function runClassicContentModule80(module, exports, require2) {
31009
+ (function runClassicContentModule83(module, exports, require2) {
30554
31010
  (function initCodexOverleafModelPickerSupport(root, factory) {
30555
31011
  if (typeof module === "object" && module.exports) {
30556
31012
  module.exports = factory(require2("../shared/models"));
@@ -30567,7 +31023,7 @@ ${conclusion}` : `${label} ${conclusion}`;
30567
31023
  return tiers.includes("standard") ? tiers : ["standard", ...tiers];
30568
31024
  }
30569
31025
  function normalizeReasoningEffortsForSelect(efforts) {
30570
- const allowed = /* @__PURE__ */ new Set(["none", "minimal", "low", "medium", "high", "xhigh"]);
31026
+ const allowed = /* @__PURE__ */ new Set(["none", "minimal", "low", "medium", "high", "xhigh", "max", "ultra"]);
30571
31027
  return Array.from(new Set((Array.isArray(efforts) ? efforts : []).map((effort) => normalizeModelOptionId(effort)).filter((effort) => allowed.has(effort))));
30572
31028
  }
30573
31029
  function formatCompactModelLabel(label) {
@@ -30625,12 +31081,12 @@ ${conclusion}` : `${label} ${conclusion}`;
30625
31081
  const normalized = {
30626
31082
  id,
30627
31083
  label: typeof model?.label === "string" && model.label.length > 0 ? model.label : id,
30628
- reasoningEfforts: Array.isArray(model?.reasoningEfforts) ? model.reasoningEfforts.slice() : [],
31084
+ reasoningEfforts: normalizeReasoningEffortsForSelect(model?.reasoningEfforts),
30629
31085
  reasoningPresentation: typeof model?.reasoningPresentation === "string" ? model.reasoningPresentation : "",
30630
31086
  speedTiers: normalizeSpeedTiersForSelect(model?.speedTiers)
30631
31087
  };
30632
31088
  if (Object.prototype.hasOwnProperty.call(Object(model), "defaultReasoningEffort")) {
30633
- normalized.defaultReasoningEffort = model.defaultReasoningEffort;
31089
+ normalized.defaultReasoningEffort = normalizeModelOptionId(model.defaultReasoningEffort);
30634
31090
  }
30635
31091
  if (Object.prototype.hasOwnProperty.call(Object(model), "defaultSpeedTier")) {
30636
31092
  normalized.defaultSpeedTier = model.defaultSpeedTier;
@@ -30651,7 +31107,7 @@ ${conclusion}` : `${label} ${conclusion}`;
30651
31107
  return api;
30652
31108
  });
30653
31109
  }).call(globalThis, void 0, void 0, void 0);
30654
- (function runClassicContentModule81(module, exports, require2) {
31110
+ (function runClassicContentModule84(module, exports, require2) {
30655
31111
  (function initCodexOverleafModelPicker() {
30656
31112
  "use strict";
30657
31113
  function create(deps = {}) {
@@ -31057,7 +31513,7 @@ ${conclusion}` : `${label} ${conclusion}`;
31057
31513
  if (effort === "none") return tx("Off", "\u5173\u95ED");
31058
31514
  if (effort === "xhigh") return "Max";
31059
31515
  }
31060
- const labels = getLocale() === "zh" ? { none: "\u5173\u95ED", minimal: "\u6700\u5C0F", low: "\u4F4E", medium: "\u4E2D", high: "\u9AD8", xhigh: "\u8D85\u9AD8" } : { none: "Off", minimal: "Minimal", low: "Low", medium: "Medium", high: "High", xhigh: "XHigh" };
31516
+ const labels = getLocale() === "zh" ? { none: "\u5173\u95ED", minimal: "\u6700\u5C0F", low: "\u4F4E", medium: "\u4E2D", high: "\u9AD8", xhigh: "\u8D85\u9AD8", max: "\u6700\u5927", ultra: "\u6781\u9650" } : { none: "Off", minimal: "Minimal", low: "Low", medium: "Medium", high: "High", xhigh: "XHigh", max: "Max", ultra: "Ultra" };
31061
31517
  return labels[effort] || effort || "";
31062
31518
  }
31063
31519
  function resolveSelectedModel() {
@@ -31129,7 +31585,7 @@ ${conclusion}` : `${label} ${conclusion}`;
31129
31585
  window.CodexOverleafModelPicker = { create };
31130
31586
  })();
31131
31587
  }).call(globalThis, void 0, void 0, void 0);
31132
- (function runClassicContentModule82(module, exports, require2) {
31588
+ (function runClassicContentModule85(module, exports, require2) {
31133
31589
  (function initCodexOverleafProjectSessionCleanup() {
31134
31590
  "use strict";
31135
31591
  const FRESH_RUNNING_WINDOW_MS = 30 * 60 * 1e3;
@@ -31229,7 +31685,7 @@ ${conclusion}` : `${label} ${conclusion}`;
31229
31685
  window.CodexOverleafProjectSessionCleanup = { create };
31230
31686
  })();
31231
31687
  }).call(globalThis, void 0, void 0, void 0);
31232
- (function runClassicContentModule83(module, exports, require2) {
31688
+ (function runClassicContentModule86(module, exports, require2) {
31233
31689
  (function initCodexOverleafRecentProjects() {
31234
31690
  "use strict";
31235
31691
  function create(deps = {}) {
@@ -32155,7 +32611,7 @@ ${conclusion}` : `${label} ${conclusion}`;
32155
32611
  window.CodexOverleafRecentProjects = { create };
32156
32612
  })();
32157
32613
  }).call(globalThis, void 0, void 0, void 0);
32158
- (function runClassicContentModule84(module, exports, require2) {
32614
+ (function runClassicContentModule87(module, exports, require2) {
32159
32615
  (function initCodexOverleafOtWarmMirror() {
32160
32616
  "use strict";
32161
32617
  function create(deps = {}) {
@@ -33010,7 +33466,7 @@ ${conclusion}` : `${label} ${conclusion}`;
33010
33466
  window.CodexOverleafOtWarmMirror = { create };
33011
33467
  })();
33012
33468
  }).call(globalThis, void 0, void 0, void 0);
33013
- (function runClassicContentModule85(module, exports, require2) {
33469
+ (function runClassicContentModule88(module, exports, require2) {
33014
33470
  (function initCodexOverleafWritebackOrchestrator() {
33015
33471
  "use strict";
33016
33472
  let tr;
@@ -33059,6 +33515,7 @@ ${conclusion}` : `${label} ${conclusion}`;
33059
33515
  let onMirrorRefreshSettled;
33060
33516
  let writebackSettlement;
33061
33517
  let injectedWritebackSettlement;
33518
+ let assetTransferBroker;
33062
33519
  function buildSettlement(input = {}) {
33063
33520
  return writebackSettlement?.settle instanceof Function ? writebackSettlement.settle(input) : null;
33064
33521
  }
@@ -33263,7 +33720,7 @@ ${conclusion}` : `${label} ${conclusion}`;
33263
33720
  })
33264
33721
  };
33265
33722
  }
33266
- const applied = operations.length ? mergeApplyResultSkipped(await callPageBridge("applyOperations", {
33723
+ const applied = operations.length ? mergeApplyResultSkipped(await assetTransferBroker.applyOperations({
33267
33724
  operations,
33268
33725
  baseFiles: project?.files || [],
33269
33726
  requireReviewing: runRequireReviewing,
@@ -33752,6 +34209,7 @@ ${tx("Writeback note: Codex could not confirm any Overleaf write result entries,
33752
34209
  getState,
33753
34210
  getCurrentRunView
33754
34211
  } = deps);
34212
+ assetTransferBroker = deps.assetTransferBroker;
33755
34213
  onMirrorRefreshSettled = deps.onMirrorRefreshSettled;
33756
34214
  writebackSettlement = deps.writebackSettlement;
33757
34215
  compileAdapter = deps.compileAdapter;
@@ -33764,7 +34222,7 @@ ${tx("Writeback note: Codex could not confirm any Overleaf write result entries,
33764
34222
  window.CodexOverleafWritebackOrchestrator = { create };
33765
34223
  })();
33766
34224
  }).call(globalThis, void 0, void 0, void 0);
33767
- (function runClassicContentModule86(module, exports, require2) {
34225
+ (function runClassicContentModule89(module, exports, require2) {
33768
34226
  (function initCodexOverleafRunSettlementPersistence(root, factory) {
33769
34227
  const api = factory();
33770
34228
  if (typeof module === "object" && module.exports) module.exports = api;
@@ -33807,7 +34265,7 @@ ${tx("Writeback note: Codex could not confirm any Overleaf write result entries,
33807
34265
  return Object.freeze({ create });
33808
34266
  });
33809
34267
  }).call(globalThis, void 0, void 0, void 0);
33810
- (function runClassicContentModule87(module, exports, require2) {
34268
+ (function runClassicContentModule90(module, exports, require2) {
33811
34269
  (function initPostNavigationSettlementPersistence(root, factory) {
33812
34270
  const api = factory();
33813
34271
  if (typeof module === "object" && module.exports) module.exports = api;
@@ -33899,7 +34357,7 @@ ${tx("Writeback note: Codex could not confirm any Overleaf write result entries,
33899
34357
  return Object.freeze({ persist, persistRequired });
33900
34358
  });
33901
34359
  }).call(globalThis, void 0, void 0, void 0);
33902
- (function runClassicContentModule88(module, exports, require2) {
34360
+ (function runClassicContentModule91(module, exports, require2) {
33903
34361
  (function initCodexOverleafPanelMaintenance() {
33904
34362
  "use strict";
33905
34363
  function create(deps = {}) {
@@ -34215,7 +34673,7 @@ ${tx("Writeback note: Codex could not confirm any Overleaf write result entries,
34215
34673
  window.CodexOverleafPanelMaintenance = { create };
34216
34674
  })();
34217
34675
  }).call(globalThis, void 0, void 0, void 0);
34218
- (function runClassicContentModule89(module, exports, require2) {
34676
+ (function runClassicContentModule92(module, exports, require2) {
34219
34677
  (function initCodexOverleafUpdateIdle(root) {
34220
34678
  "use strict";
34221
34679
  function create(options2 = {}) {
@@ -34283,7 +34741,7 @@ ${tx("Writeback note: Codex could not confirm any Overleaf write result entries,
34283
34741
  root.CodexOverleafUpdateIdle = Object.freeze({ create });
34284
34742
  })(typeof window !== "undefined" ? window : globalThis);
34285
34743
  }).call(globalThis, void 0, void 0, void 0);
34286
- (function runClassicContentModule90(module, exports, require2) {
34744
+ (function runClassicContentModule93(module, exports, require2) {
34287
34745
  (function initCodexOverleafUpdateNotice(root, factory) {
34288
34746
  if (typeof module === "object" && module.exports) {
34289
34747
  module.exports = factory(require2("../shared/managedUpdateProjection"));
@@ -34727,7 +35185,7 @@ ${tx("Writeback note: Codex could not confirm any Overleaf write result entries,
34727
35185
  return Object.freeze({ mount });
34728
35186
  });
34729
35187
  }).call(globalThis, void 0, void 0, void 0);
34730
- (function runClassicContentModule91(module, exports, require2) {
35188
+ (function runClassicContentModule94(module, exports, require2) {
34731
35189
  (function initCodexOverleafContentRuntime(root) {
34732
35190
  "use strict";
34733
35191
  function init(dependencies2) {
@@ -35099,8 +35557,26 @@ ${tx("Writeback note: Codex could not confirm any Overleaf write result entries,
35099
35557
  openProjectFileForFailure,
35100
35558
  openStorageSettings
35101
35559
  } = panelMaintenance;
35560
+ const sessionForkController = Modules.SessionForkController.create({
35561
+ SessionState: Modules.SessionState,
35562
+ getState: () => state,
35563
+ setState: (next) => {
35564
+ state = next;
35565
+ },
35566
+ sendBackgroundNative,
35567
+ saveState,
35568
+ applyStateToPanel,
35569
+ showPluginToast,
35570
+ tr
35571
+ });
35572
+ const runResultActions = Modules.RunResultActions.create({
35573
+ tr,
35574
+ getLocale,
35575
+ forkRunFromNode: sessionForkController.forkRunFromNode
35576
+ });
35102
35577
  const runTimelineView = Modules.RunTimelineView.create({
35103
35578
  RunGuidanceView: Modules.RunGuidanceView,
35579
+ RunResultActions: runResultActions,
35104
35580
  tr,
35105
35581
  tx,
35106
35582
  getLocale,
@@ -35211,6 +35687,7 @@ ${tx("Writeback note: Codex could not confirm any Overleaf write result entries,
35211
35687
  getCurrentProjectId,
35212
35688
  saveStateSoon
35213
35689
  });
35690
+ const assetTransferBroker = Modules.AssetTransferBroker.create({ callPageBridge, sendBackgroundNative });
35214
35691
  const writebackOrchestrator = Modules.WritebackOrchestrator.create({
35215
35692
  tr,
35216
35693
  tx,
@@ -35250,6 +35727,7 @@ ${tx("Writeback note: Codex could not confirm any Overleaf write result entries,
35250
35727
  confirmBinaryOperations,
35251
35728
  filterSyncChangesByOperations,
35252
35729
  writebackController,
35730
+ assetTransferBroker,
35253
35731
  writebackSettlement: WritebackSettlement,
35254
35732
  compileAdapter: Modules.CompileAdapter,
35255
35733
  RUN_SNAPSHOT_ZIP_TIMEOUT_MS,
@@ -39416,6 +39894,7 @@ ${tx("Writeback note: Codex could not confirm any Overleaf write result entries,
39416
39894
  speedTier: prefs.speedTier || "",
39417
39895
  mode: prefs.mode || "",
39418
39896
  locale: prefs.locale || "",
39897
+ theme: ["dark", "light", "auto"].includes(prefs.theme) ? prefs.theme : "dark",
39419
39898
  requireReviewing: prefs.requireReviewing !== false,
39420
39899
  autoRecompile: prefs.autoRecompile !== false,
39421
39900
  loadCodexLocalSkills: prefs.loadCodexLocalSkills !== false,
@@ -39463,6 +39942,7 @@ ${tx("Writeback note: Codex could not confirm any Overleaf write result entries,
39463
39942
  reasoningEffort: fallback.reasoningEffort || "",
39464
39943
  speedTier: fallback.speedTier || "",
39465
39944
  locale: fallback.locale || "",
39945
+ theme: ["dark", "light", "auto"].includes(fallback.theme) ? fallback.theme : "dark",
39466
39946
  requireReviewing: fallback.requireReviewing !== false,
39467
39947
  autoOpen: fallback.autoOpen !== false,
39468
39948
  loadCodexLocalSkills: fallback.loadCodexLocalSkills !== false,
@@ -39725,7 +40205,10 @@ ${tx("Writeback note: Codex could not confirm any Overleaf write result entries,
39725
40205
  saveStateSoon();
39726
40206
  return;
39727
40207
  }
39728
- if (event?.target?.matches?.("[data-speed]")) renderReasoningOptions(getRenderedModelEntries());
40208
+ if (event?.target?.matches?.("[data-speed]")) {
40209
+ state.speedTier = event.target.value || "standard";
40210
+ renderReasoningOptions(getRenderedModelEntries());
40211
+ }
39729
40212
  renderSpeedOptions(getRenderedModelEntries());
39730
40213
  readPanelInputs();
39731
40214
  renderModelConfigChoices();
@@ -41473,7 +41956,7 @@ Reason: ${item.reason || "No reason provided"}`),
41473
41956
  root.CodexOverleafContentRuntime = { init };
41474
41957
  })(typeof window !== "undefined" ? window : globalThis);
41475
41958
  }).call(globalThis, void 0, void 0, void 0);
41476
- (function runClassicContentModule92(module, exports, require2) {
41959
+ (function runClassicContentModule95(module, exports, require2) {
41477
41960
  (function initCodexOverleafLegacyGlobalRegistry(root, factory) {
41478
41961
  "use strict";
41479
41962
  const api = factory();
@@ -41489,6 +41972,7 @@ Reason: ${item.reason || "No reason provided"}`),
41489
41972
  "ActiveTurnControl",
41490
41973
  "AgentTranscript",
41491
41974
  "ApplyResultFormatters",
41975
+ "AssetTransferBroker",
41492
41976
  "AuditRecords",
41493
41977
  "Compatibility",
41494
41978
  "ComposerAttachments",
@@ -41527,12 +42011,14 @@ Reason: ${item.reason || "No reason provided"}`),
41527
42011
  "RunGuidanceController",
41528
42012
  "RunInputQueue",
41529
42013
  "RunQueueScheduler",
42014
+ "RunResultActions",
41530
42015
  "RunSettlementPersistence",
41531
42016
  "RunTimelineView",
41532
42017
  "ScopedPersistenceCoordinator",
41533
42018
  "ScopedPersistenceTransaction",
41534
42019
  "SensitiveScan",
41535
42020
  "SessionManager",
42021
+ "SessionForkController",
41536
42022
  "SessionPanel",
41537
42023
  "SessionPersistence",
41538
42024
  "SessionState",