codex-overleaf-link 2.3.1 → 2.3.3

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 (39) 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 +28 -1
  5. package/extension/src/content/generated/content.bundle.js +630 -68
  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/markdownDomRenderer.js +70 -0
  9. package/extension/src/content/modelPicker.js +2 -2
  10. package/extension/src/content/modelPickerSupport.js +3 -3
  11. package/extension/src/content/pageBridgeClient.js +1 -0
  12. package/extension/src/content/pendingInputView.js +16 -3
  13. package/extension/src/content/providerSettingsDialog.js +1 -0
  14. package/extension/src/content/runResultActions.js +114 -0
  15. package/extension/src/content/runTimelineView.js +20 -0
  16. package/extension/src/content/sessionForkController.js +120 -0
  17. package/extension/src/content/writebackController.js +3 -0
  18. package/extension/src/content/writebackOrchestrator.js +3 -1
  19. package/extension/src/page/binaryAssetUploader.js +343 -0
  20. package/extension/src/page/trackedChangesLifecycle.js +2 -0
  21. package/extension/src/pageBridge.js +30 -1
  22. package/extension/src/shared/compatibility.js +4 -2
  23. package/extension/src/shared/i18n.js +16 -0
  24. package/extension/src/shared/models.js +13 -2
  25. package/extension/src/shared/pageRpcContract.js +5 -1
  26. package/extension/src/shared/sessionState.js +12 -4
  27. package/extension/src/shared/storageDb.js +1 -1
  28. package/extension/src/shared/storageRunActions.js +11 -1
  29. package/extension/styles/panel.css +232 -31
  30. package/native-host/src/codexModels.js +6 -2
  31. package/native-host/src/codexRuntimeIdentity.js +79 -4
  32. package/native-host/src/codexSessionRunner.js +5 -1
  33. package/native-host/src/codexThreadFork.js +103 -0
  34. package/native-host/src/mirrorWorkspace.js +5 -19
  35. package/native-host/src/nativeAssetTransfer.js +183 -0
  36. package/native-host/src/nativeEnvironment.js +4 -1
  37. package/native-host/src/taskRunnerRuntime.js +22 -0
  38. package/native-host/src/textPatch.js +707 -259
  39. 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.3";
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";
@@ -18528,6 +18735,7 @@ ${block}`;
18528
18735
  return;
18529
18736
  }
18530
18737
  const style = instance.document.defaultView.getComputedStyle(panel);
18738
+ instance.root.dataset.theme = panel.dataset.theme === "light" ? "light" : "dark";
18531
18739
  instance.root.style.setProperty("--provider-panel-bg", style.backgroundColor || "#151716");
18532
18740
  instance.root.style.setProperty("--provider-panel-color", style.color || "#eceeea");
18533
18741
  }
@@ -18550,7 +18758,7 @@ ${block}`;
18550
18758
  window.CodexOverleafProviderSettingsDialog = { create, getFooterActionState };
18551
18759
  })();
18552
18760
  }).call(globalThis, void 0, void 0, void 0);
18553
- (function runClassicContentModule55(module, exports, require2) {
18761
+ (function runClassicContentModule56(module, exports, require2) {
18554
18762
  (function initCodexOverleafProjectProviderSelection() {
18555
18763
  "use strict";
18556
18764
  function create(deps = {}) {
@@ -18607,7 +18815,7 @@ ${block}`;
18607
18815
  window.CodexOverleafProjectProviderSelection = { create };
18608
18816
  })();
18609
18817
  }).call(globalThis, void 0, void 0, void 0);
18610
- (function runClassicContentModule56(module, exports, require2) {
18818
+ (function runClassicContentModule57(module, exports, require2) {
18611
18819
  (function initCodexOverleafProviderSettingsCoordinator() {
18612
18820
  "use strict";
18613
18821
  function create(options2 = {}) {
@@ -19200,7 +19408,7 @@ ${block}`;
19200
19408
  window.CodexOverleafProviderSettingsCoordinator = { create };
19201
19409
  })();
19202
19410
  }).call(globalThis, void 0, void 0, void 0);
19203
- (function runClassicContentModule57(module, exports, require2) {
19411
+ (function runClassicContentModule58(module, exports, require2) {
19204
19412
  (function initCodexOverleafSessionPersistence(root, factory) {
19205
19413
  if (typeof module === "object" && module.exports) {
19206
19414
  module.exports = factory(require2("../shared/storageMigration"));
@@ -19294,7 +19502,7 @@ ${block}`;
19294
19502
  };
19295
19503
  });
19296
19504
  }).call(globalThis, void 0, void 0, void 0);
19297
- (function runClassicContentModule58(module, exports, require2) {
19505
+ (function runClassicContentModule59(module, exports, require2) {
19298
19506
  (function(root, factory) {
19299
19507
  var api = factory();
19300
19508
  if (typeof module === "object" && module.exports) module.exports = api;
@@ -19398,7 +19606,7 @@ ${block}`;
19398
19606
  return Object.freeze({ persistPanelState });
19399
19607
  });
19400
19608
  }).call(globalThis, void 0, void 0, void 0);
19401
- (function runClassicContentModule59(module, exports, require2) {
19609
+ (function runClassicContentModule60(module, exports, require2) {
19402
19610
  (function(root, factory) {
19403
19611
  var api = factory();
19404
19612
  if (typeof module === "object" && module.exports) module.exports = api;
@@ -19443,7 +19651,7 @@ ${block}`;
19443
19651
  return Object.freeze({ create });
19444
19652
  });
19445
19653
  }).call(globalThis, void 0, void 0, void 0);
19446
- (function runClassicContentModule60(module, exports, require2) {
19654
+ (function runClassicContentModule61(module, exports, require2) {
19447
19655
  (function(root, factory) {
19448
19656
  if (typeof module === "object" && module.exports) {
19449
19657
  module.exports = factory(
@@ -19538,7 +19746,7 @@ ${block}`;
19538
19746
  });
19539
19747
  });
19540
19748
  }).call(globalThis, void 0, void 0, void 0);
19541
- (function runClassicContentModule61(module, exports, require2) {
19749
+ (function runClassicContentModule62(module, exports, require2) {
19542
19750
  (function initCodexOverleafDiagnosticsPanel() {
19543
19751
  "use strict";
19544
19752
  function create(options2 = {}) {
@@ -19966,7 +20174,7 @@ ${block}`;
19966
20174
  };
19967
20175
  })();
19968
20176
  }).call(globalThis, void 0, void 0, void 0);
19969
- (function runClassicContentModule62(module, exports, require2) {
20177
+ (function runClassicContentModule63(module, exports, require2) {
19970
20178
  (function initCodexOverleafRunQueueScheduler(root, factory) {
19971
20179
  if (typeof module === "object" && module.exports) {
19972
20180
  module.exports = factory(require2("../shared/runInputQueue"));
@@ -20294,7 +20502,7 @@ ${block}`;
20294
20502
  return { create, createCoordinator };
20295
20503
  });
20296
20504
  }).call(globalThis, void 0, void 0, void 0);
20297
- (function runClassicContentModule63(module, exports, require2) {
20505
+ (function runClassicContentModule64(module, exports, require2) {
20298
20506
  (function initCodexOverleafActiveTurnControl(root, factory) {
20299
20507
  if (typeof module === "object" && module.exports) {
20300
20508
  module.exports = factory();
@@ -20463,7 +20671,7 @@ ${block}`;
20463
20671
  return { create };
20464
20672
  });
20465
20673
  }).call(globalThis, void 0, void 0, void 0);
20466
- (function runClassicContentModule64(module, exports, require2) {
20674
+ (function runClassicContentModule65(module, exports, require2) {
20467
20675
  (function initCodexOverleafPendingInputView(root, factory) {
20468
20676
  if (typeof module === "object" && module.exports) {
20469
20677
  module.exports = factory();
@@ -20480,10 +20688,17 @@ ${block}`;
20480
20688
  }
20481
20689
  container.replaceChildren();
20482
20690
  container.hidden = !items.length;
20691
+ if (!items.length) {
20692
+ return;
20693
+ }
20483
20694
  for (const item of items) {
20484
20695
  const row = document.createElement("article");
20485
20696
  row.className = "codex-pending-input";
20486
20697
  row.dataset.status = item.status || "queued";
20698
+ const marker = document.createElement("span");
20699
+ marker.className = "codex-pending-input-marker";
20700
+ marker.setAttribute("aria-hidden", "true");
20701
+ marker.append(createIcon("queue"));
20487
20702
  const copy = document.createElement("div");
20488
20703
  copy.className = "codex-pending-input-copy";
20489
20704
  const status = document.createElement("span");
@@ -20492,7 +20707,10 @@ ${block}`;
20492
20707
  const text = document.createElement("span");
20493
20708
  text.className = "codex-pending-input-text";
20494
20709
  text.textContent = item.text;
20495
- copy.append(status, text);
20710
+ copy.append(text);
20711
+ if (item.status && item.status !== "queued") {
20712
+ copy.append(status);
20713
+ }
20496
20714
  const actions = document.createElement("div");
20497
20715
  actions.className = "codex-pending-input-actions";
20498
20716
  if (item.status === "paused") {
@@ -20516,7 +20734,8 @@ ${block}`;
20516
20734
  remove.disabled = item.status === "steering" || item.status === "executing";
20517
20735
  text.title = item.text;
20518
20736
  actions.append(remove);
20519
- row.append(copy, actions);
20737
+ row.setAttribute("aria-label", `${status.textContent || options2.tr?.("queuedInputQueued") || "Queued"}: ${item.text}`);
20738
+ row.append(marker, copy, actions);
20520
20739
  container.append(row);
20521
20740
  }
20522
20741
  }
@@ -20543,7 +20762,7 @@ ${block}`;
20543
20762
  svg.setAttribute("viewBox", "0 0 20 20");
20544
20763
  svg.setAttribute("aria-hidden", "true");
20545
20764
  svg.setAttribute("focusable", "false");
20546
- const paths = icon === "guide" ? ["M4 4.5v4a4 4 0 0 0 4 4h7", "m12 9 3.5 3.5L12 16"] : ["M6 6h8", "M8 6V4.5h4V6", "m7.2 8 0.6 7.5h4.4l.6-7.5"];
20765
+ const paths = icon === "guide" ? ["M4 4.5v4a4 4 0 0 0 4 4h7", "m12 9 3.5 3.5L12 16"] : icon === "queue" ? ["M4 5.5h12", "M4 10h12", "M4 14.5h8"] : ["M6 6h8", "M8 6V4.5h4V6", "m7.2 8 0.6 7.5h4.4l.6-7.5"];
20547
20766
  for (const value of paths) {
20548
20767
  const path = document.createElementNS("http://www.w3.org/2000/svg", "path");
20549
20768
  path.setAttribute("d", value);
@@ -20554,7 +20773,7 @@ ${block}`;
20554
20773
  return { create };
20555
20774
  });
20556
20775
  }).call(globalThis, void 0, void 0, void 0);
20557
- (function runClassicContentModule65(module, exports, require2) {
20776
+ (function runClassicContentModule66(module, exports, require2) {
20558
20777
  (function initCodexOverleafComposerPanel() {
20559
20778
  "use strict";
20560
20779
  function create(options2 = {}) {
@@ -20813,7 +21032,7 @@ ${block}`;
20813
21032
  };
20814
21033
  })();
20815
21034
  }).call(globalThis, void 0, void 0, void 0);
20816
- (function runClassicContentModule66(module, exports, require2) {
21035
+ (function runClassicContentModule67(module, exports, require2) {
20817
21036
  (function initCodexOverleafTheme(root, factory) {
20818
21037
  if (typeof module === "object" && module.exports) {
20819
21038
  module.exports = factory();
@@ -20881,7 +21100,7 @@ ${block}`;
20881
21100
  };
20882
21101
  });
20883
21102
  }).call(globalThis, void 0, void 0, void 0);
20884
- (function runClassicContentModule67(module, exports, require2) {
21103
+ (function runClassicContentModule68(module, exports, require2) {
20885
21104
  !(function(e, t) {
20886
21105
  "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
21106
  })("undefined" != typeof self ? self : this, function() {
@@ -24301,7 +24520,7 @@ ${block}`;
24301
24520
  })();
24302
24521
  });
24303
24522
  }).call(globalThis, void 0, void 0, void 0);
24304
- (function runClassicContentModule68(module, exports, require2) {
24523
+ (function runClassicContentModule69(module, exports, require2) {
24305
24524
  !(function(t, e) {
24306
24525
  "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
24526
  })(this, function() {
@@ -26373,7 +26592,7 @@ ${block}`;
26373
26592
  }, Ke;
26374
26593
  });
26375
26594
  }).call(globalThis, void 0, void 0, void 0);
26376
- (function runClassicContentModule69(module, exports, require2) {
26595
+ (function runClassicContentModule70(module, exports, require2) {
26377
26596
  (function initCodexOverleafMathText(root) {
26378
26597
  "use strict";
26379
26598
  const DELIMITERS = Object.freeze([
@@ -26758,7 +26977,7 @@ ${block}`;
26758
26977
  }
26759
26978
  })(typeof window !== "undefined" ? window : globalThis);
26760
26979
  }).call(globalThis, void 0, void 0, void 0);
26761
- (function runClassicContentModule70(module, exports, require2) {
26980
+ (function runClassicContentModule71(module, exports, require2) {
26762
26981
  (function initCodexOverleafMarkdownDomRenderer(root, factory) {
26763
26982
  const api = factory();
26764
26983
  if (typeof module === "object" && module.exports) {
@@ -27178,15 +27397,75 @@ ${block}`;
27178
27397
  error.code = code;
27179
27398
  return error;
27180
27399
  }
27400
+ function decorateCompletionReport(container, options2 = {}) {
27401
+ const tx = typeof options2.tx === "function" ? options2.tx : (en) => en;
27402
+ const document2 = container?.ownerDocument || globalThis.document;
27403
+ if (!container || !document2) return;
27404
+ for (const block of Array.from(container.children || [])) {
27405
+ const textNode = Array.from(block.childNodes || []).find((node) => node?.nodeType === 3 && String(node.textContent || "").trim());
27406
+ if (!textNode) continue;
27407
+ const text = String(textNode.textContent || "");
27408
+ const match = text.match(/^(\s*)(Conclusion:|结论:|Changes:|修改:)(\s*)/);
27409
+ if (!match || !textNode.parentNode) continue;
27410
+ const label = document2.createElement("span");
27411
+ label.className = "run-system-label";
27412
+ label.dataset.systemLabel = ["Conclusion:", "\u7ED3\u8BBA\uFF1A"].includes(match[2]) ? "conclusion" : "changes";
27413
+ label.textContent = `${match[2]}${match[3]}`;
27414
+ textNode.textContent = `${match[1]}${text.slice(match[0].length)}`;
27415
+ textNode.parentNode.insertBefore(label, textNode);
27416
+ }
27417
+ decorateChangeReceipts(container, document2, tx);
27418
+ }
27419
+ function decorateChangeReceipts(container, document2, tx) {
27420
+ const label = container.querySelector?.('.run-system-label[data-system-label="changes"]');
27421
+ const list = label?.closest?.("p")?.nextElementSibling;
27422
+ if (!list || !["UL", "OL"].includes(list.tagName)) return;
27423
+ const receipts = [];
27424
+ for (const item of Array.from(list.children || [])) {
27425
+ const original = String(item.textContent || "").trim();
27426
+ const match = original.match(/^(.+?):\s+(edit|create|rename|move|delete)(?:\s+\((.+)\))?$/i) || original.match(/^(.+?):\s*(编辑|新建|重命名|移动|删除)(?:((.+)))?$/);
27427
+ if (!match) return;
27428
+ receipts.push({ item, original, file: match[1], operation: match[2] });
27429
+ }
27430
+ if (!receipts.length) return;
27431
+ const syncedFiles = new Set(receipts.map((receipt) => receipt.file)).size;
27432
+ const summary = document2.createElement("div");
27433
+ summary.className = "run-change-summary";
27434
+ const check = document2.createElement("span");
27435
+ check.className = "run-change-summary__check";
27436
+ check.setAttribute("aria-hidden", "true");
27437
+ check.textContent = "\u2713";
27438
+ const text = document2.createElement("span");
27439
+ text.textContent = tx(
27440
+ `${syncedFiles} ${syncedFiles === 1 ? "file" : "files"} synced`,
27441
+ `\u5DF2\u540C\u6B65 ${syncedFiles} \u4E2A\u6587\u4EF6`
27442
+ );
27443
+ summary.append(check, text);
27444
+ list.parentNode?.insertBefore(summary, list);
27445
+ list.classList.add("run-change-receipts");
27446
+ for (const receipt of receipts) {
27447
+ const file = document2.createElement("span");
27448
+ file.className = "run-change-receipt__file";
27449
+ file.textContent = receipt.file;
27450
+ const operation = document2.createElement("span");
27451
+ operation.className = "run-change-receipt__operation";
27452
+ operation.textContent = receipt.operation;
27453
+ receipt.item.classList.add("run-change-receipt");
27454
+ receipt.item.setAttribute("aria-label", receipt.original);
27455
+ receipt.item.title = receipt.original;
27456
+ receipt.item.replaceChildren(file, operation);
27457
+ }
27458
+ }
27181
27459
  return {
27182
27460
  DEFAULT_LIMITS,
27183
27461
  countTokens,
27462
+ decorateCompletionReport,
27184
27463
  renderMarkdown,
27185
27464
  stripEmptyHtmlComments
27186
27465
  };
27187
27466
  });
27188
27467
  }).call(globalThis, void 0, void 0, void 0);
27189
- (function runClassicContentModule71(module, exports, require2) {
27468
+ (function runClassicContentModule72(module, exports, require2) {
27190
27469
  (function initCodexOverleafMarkdownText() {
27191
27470
  "use strict";
27192
27471
  function create(deps = {}) {
@@ -27813,7 +28092,7 @@ ${block}`;
27813
28092
  window.CodexOverleafMarkdownText = { create };
27814
28093
  })();
27815
28094
  }).call(globalThis, void 0, void 0, void 0);
27816
- (function runClassicContentModule72(module, exports, require2) {
28095
+ (function runClassicContentModule73(module, exports, require2) {
27817
28096
  (function initCodexOverleafDiagnosticsController() {
27818
28097
  "use strict";
27819
28098
  function create(deps = {}) {
@@ -28382,7 +28661,7 @@ ${block}`;
28382
28661
  window.CodexOverleafDiagnosticsController = { create };
28383
28662
  })();
28384
28663
  }).call(globalThis, void 0, void 0, void 0);
28385
- (function runClassicContentModule73(module, exports, require2) {
28664
+ (function runClassicContentModule74(module, exports, require2) {
28386
28665
  (function initCodexOverleafRunGuidanceView() {
28387
28666
  "use strict";
28388
28667
  const LEGACY_GUIDANCE_TITLES = /* @__PURE__ */ new Set([
@@ -28422,7 +28701,7 @@ ${block}`;
28422
28701
  };
28423
28702
  })();
28424
28703
  }).call(globalThis, void 0, void 0, void 0);
28425
- (function runClassicContentModule74(module, exports, require2) {
28704
+ (function runClassicContentModule75(module, exports, require2) {
28426
28705
  (function initCodexOverleafRunGuidanceController() {
28427
28706
  "use strict";
28428
28707
  function create(deps = {}) {
@@ -28485,12 +28764,118 @@ ${block}`;
28485
28764
  window.CodexOverleafRunGuidanceController = { create };
28486
28765
  })();
28487
28766
  }).call(globalThis, void 0, void 0, void 0);
28488
- (function runClassicContentModule75(module, exports, require2) {
28767
+ (function runClassicContentModule76(module, exports, require2) {
28768
+ (function initCodexOverleafRunResultActions(root, factory) {
28769
+ const api = factory();
28770
+ if (typeof module === "object" && module.exports) module.exports = api;
28771
+ if (root) root.CodexOverleafRunResultActions = api;
28772
+ })(typeof window !== "undefined" ? window : globalThis, function runResultActionsFactory() {
28773
+ "use strict";
28774
+ function create(deps = {}) {
28775
+ const {
28776
+ tr,
28777
+ getLocale,
28778
+ forkRunFromNode,
28779
+ document: documentRef = globalThis.document,
28780
+ navigator: navigatorRef = globalThis.navigator
28781
+ } = deps;
28782
+ function configureResultActions(root, run) {
28783
+ const actions = root.querySelector(".run-result-actions");
28784
+ const reports = root.querySelectorAll(".run-completion-report");
28785
+ const report = reports[reports.length - 1];
28786
+ if (!actions || !report) return;
28787
+ report.append(actions);
28788
+ actions.hidden = false;
28789
+ configureCopyButton(root);
28790
+ configureForkButton(root, run);
28791
+ configureCompletedTime(actions, run);
28792
+ }
28793
+ function configureForkButton(root, run) {
28794
+ const existing = root.querySelector("[data-run-fork]");
28795
+ const button = existing.cloneNode(true);
28796
+ existing.replaceWith(button);
28797
+ const available = run.forkSnapshot !== true && run.status !== "running" && Boolean(run.codexTurnId) && typeof forkRunFromNode === "function";
28798
+ button.hidden = false;
28799
+ button.disabled = !available;
28800
+ button.title = tr(available ? "forkRunTitle" : "forkRunUnavailable");
28801
+ button.setAttribute("aria-label", button.title);
28802
+ 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>';
28803
+ if (!available) return;
28804
+ button.addEventListener("click", async (event) => {
28805
+ event.stopPropagation();
28806
+ button.disabled = true;
28807
+ button.classList.add("is-running");
28808
+ try {
28809
+ await forkRunFromNode(run.id);
28810
+ } catch (_error) {
28811
+ button.disabled = false;
28812
+ button.classList.remove("is-running");
28813
+ }
28814
+ });
28815
+ }
28816
+ function configureCompletedTime(actions, run) {
28817
+ const target = actions.querySelector("[data-run-completed-time]");
28818
+ const finishedAt = String(run.finishedAt || "").trim();
28819
+ const date = finishedAt ? new Date(finishedAt) : null;
28820
+ if (!target || !date || !Number.isFinite(date.getTime())) return;
28821
+ target.hidden = false;
28822
+ target.textContent = new Intl.DateTimeFormat(getLocale(), {
28823
+ hour: "2-digit",
28824
+ minute: "2-digit"
28825
+ }).format(date);
28826
+ target.title = date.toLocaleString(getLocale());
28827
+ }
28828
+ function configureCopyButton(root) {
28829
+ const existing = root.querySelector("[data-run-copy]");
28830
+ const button = existing.cloneNode(true);
28831
+ existing.replaceWith(button);
28832
+ const finalAnswer = root.querySelector(".run-completion-report .run-final-answer");
28833
+ const copyText = String(finalAnswer?.innerText || finalAnswer?.textContent || "").trim();
28834
+ button.hidden = false;
28835
+ button.disabled = !copyText;
28836
+ button.title = tr("copyConclusionTitle");
28837
+ button.setAttribute("aria-label", button.title);
28838
+ 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>';
28839
+ if (!copyText) return;
28840
+ button.addEventListener("click", async (event) => {
28841
+ event.stopPropagation();
28842
+ try {
28843
+ await writeClipboardText(copyText);
28844
+ button.title = tr("copyConclusionDone");
28845
+ } catch (_error) {
28846
+ button.title = tr("copyConclusionFailed");
28847
+ }
28848
+ button.setAttribute("aria-label", button.title);
28849
+ });
28850
+ }
28851
+ async function writeClipboardText(text) {
28852
+ if (navigatorRef?.clipboard?.writeText) {
28853
+ await navigatorRef.clipboard.writeText(text);
28854
+ return;
28855
+ }
28856
+ const textarea = documentRef.createElement("textarea");
28857
+ textarea.value = text;
28858
+ textarea.setAttribute("readonly", "");
28859
+ textarea.style.position = "fixed";
28860
+ textarea.style.opacity = "0";
28861
+ documentRef.body.append(textarea);
28862
+ textarea.select();
28863
+ const copied = documentRef.execCommand("copy");
28864
+ textarea.remove();
28865
+ if (!copied) throw new Error("clipboard_copy_failed");
28866
+ }
28867
+ return Object.freeze({ configureResultActions });
28868
+ }
28869
+ return Object.freeze({ create });
28870
+ });
28871
+ }).call(globalThis, void 0, void 0, void 0);
28872
+ (function runClassicContentModule77(module, exports, require2) {
28489
28873
  (function initCodexOverleafRunTimelineView() {
28490
28874
  "use strict";
28491
28875
  function create(deps = {}) {
28492
28876
  const {
28493
28877
  RunGuidanceView,
28878
+ RunResultActions,
28494
28879
  tr,
28495
28880
  tx,
28496
28881
  getLocale,
@@ -28507,6 +28892,7 @@ ${block}`;
28507
28892
  cssEscape,
28508
28893
  renderMarkdownInlineText,
28509
28894
  renderMarkdownBlockText,
28895
+ decorateCompletionReport,
28510
28896
  sanitizeAssistantVisibleText,
28511
28897
  sanitizeAssistantVisibleValue,
28512
28898
  stripEmptyHtmlCommentPlaceholders = (value) => value,
@@ -28772,6 +29158,11 @@ ${block}`;
28772
29158
  </summary>
28773
29159
  </details>
28774
29160
  <div class="run-activity-list" data-run-events></div>
29161
+ <div class="run-result-actions" hidden>
29162
+ <button type="button" class="run-copy-action" data-run-copy hidden></button>
29163
+ <button type="button" class="run-fork-action" data-run-fork hidden></button>
29164
+ <span class="run-completed-time" data-run-completed-time hidden></span>
29165
+ </div>
28775
29166
  <div class="run-report" data-run-report aria-live="polite" hidden></div>
28776
29167
  </div>
28777
29168
  `;
@@ -28820,6 +29211,7 @@ ${block}`;
28820
29211
  events.append(renderRunEvent(event));
28821
29212
  }
28822
29213
  }
29214
+ RunResultActions.configureResultActions(root, run);
28823
29215
  configureAcceptButton(root, run);
28824
29216
  configureUndoButton(root, run);
28825
29217
  return root;
@@ -29081,6 +29473,7 @@ ${lines}`
29081
29473
  }
29082
29474
  if (mainSections.length) {
29083
29475
  renderMarkdownBlockText(main, mainSections.join("\n\n"));
29476
+ decorateCompletionReport(main, { tx });
29084
29477
  report.append(main);
29085
29478
  }
29086
29479
  appendCompletionMetaBlock(report, structured.meta);
@@ -29094,6 +29487,7 @@ ${lines}`
29094
29487
  const body = document.createElement("div");
29095
29488
  body.className = "run-final-answer";
29096
29489
  renderMarkdownBlockText(body, split.body || flatText);
29490
+ decorateCompletionReport(body, { tx });
29097
29491
  report.append(body);
29098
29492
  appendCompileFix(report);
29099
29493
  appendRejectedRedo(report);
@@ -29257,6 +29651,10 @@ ${conclusion}` : `${label} ${conclusion}`;
29257
29651
  const existing = root.querySelector("[data-run-undo]");
29258
29652
  const button = existing.cloneNode(true);
29259
29653
  existing.replaceWith(button);
29654
+ if (run.forkSnapshot === true) {
29655
+ button.hidden = true;
29656
+ return;
29657
+ }
29260
29658
  if (isTrackedChangeLifecycleRun(run)) {
29261
29659
  configureLifecycleUndoButton(button, run);
29262
29660
  return;
@@ -29325,6 +29723,10 @@ ${conclusion}` : `${label} ${conclusion}`;
29325
29723
  const existing = root.querySelector("[data-run-accept]");
29326
29724
  const button = existing.cloneNode(true);
29327
29725
  existing.replaceWith(button);
29726
+ if (run.forkSnapshot === true) {
29727
+ button.hidden = true;
29728
+ return;
29729
+ }
29328
29730
  if (!isTrackedChangeLifecycleRun(run)) {
29329
29731
  button.hidden = true;
29330
29732
  return;
@@ -29439,7 +29841,7 @@ ${conclusion}` : `${label} ${conclusion}`;
29439
29841
  window.CodexOverleafRunTimelineView = { create };
29440
29842
  })();
29441
29843
  }).call(globalThis, void 0, void 0, void 0);
29442
- (function runClassicContentModule76(module, exports, require2) {
29844
+ (function runClassicContentModule78(module, exports, require2) {
29443
29845
  (function initCodexOverleafProjectSettingsCoordinator() {
29444
29846
  "use strict";
29445
29847
  function create(deps = {}) {
@@ -29766,7 +30168,7 @@ ${conclusion}` : `${label} ${conclusion}`;
29766
30168
  window.CodexOverleafProjectSettingsCoordinator = { create };
29767
30169
  })();
29768
30170
  }).call(globalThis, void 0, void 0, void 0);
29769
- (function runClassicContentModule77(module, exports, require2) {
30171
+ (function runClassicContentModule79(module, exports, require2) {
29770
30172
  (function initCodexOverleafSessionMenuView() {
29771
30173
  "use strict";
29772
30174
  function create(deps = {}) {
@@ -29971,7 +30373,7 @@ ${conclusion}` : `${label} ${conclusion}`;
29971
30373
  window.CodexOverleafSessionMenuView = { create };
29972
30374
  })();
29973
30375
  }).call(globalThis, void 0, void 0, void 0);
29974
- (function runClassicContentModule78(module, exports, require2) {
30376
+ (function runClassicContentModule80(module, exports, require2) {
29975
30377
  (function initCodexOverleafSessionManager() {
29976
30378
  "use strict";
29977
30379
  function create(deps = {}) {
@@ -30230,7 +30632,136 @@ ${conclusion}` : `${label} ${conclusion}`;
30230
30632
  window.CodexOverleafSessionManager = { create };
30231
30633
  })();
30232
30634
  }).call(globalThis, void 0, void 0, void 0);
30233
- (function runClassicContentModule79(module, exports, require2) {
30635
+ (function runClassicContentModule81(module, exports, require2) {
30636
+ (function initCodexOverleafSessionForkController(root, factory) {
30637
+ const api = factory();
30638
+ if (typeof module === "object" && module.exports) module.exports = api;
30639
+ if (root) root.CodexOverleafSessionForkController = api;
30640
+ })(typeof window !== "undefined" ? window : globalThis, function sessionForkControllerFactory() {
30641
+ "use strict";
30642
+ function create(deps = {}) {
30643
+ const {
30644
+ SessionState,
30645
+ getState,
30646
+ setState,
30647
+ sendBackgroundNative,
30648
+ saveState,
30649
+ applyStateToPanel,
30650
+ showPluginToast,
30651
+ tr
30652
+ } = deps;
30653
+ async function forkRunFromNode(runId) {
30654
+ const previousState = getState();
30655
+ const source = findSource(previousState, runId);
30656
+ if (!source) return failFork("session_fork_source_missing", tr("forkRunUnavailable"));
30657
+ const { session, run, runIndex } = source;
30658
+ if (run.status === "running" || !session.codexThreadId || !run.codexTurnId) {
30659
+ return failFork("session_fork_unavailable", tr("forkRunUnavailable"));
30660
+ }
30661
+ const response = await sendBackgroundNative({
30662
+ method: "codex.thread.fork",
30663
+ params: {
30664
+ threadId: session.codexThreadId,
30665
+ lastTurnId: run.codexTurnId,
30666
+ speedTier: session.speedTier,
30667
+ loadCodexLocalSkills: previousState.loadCodexLocalSkills !== false,
30668
+ loadCodexOverleafSkills: previousState.loadCodexOverleafSkills !== false
30669
+ }
30670
+ });
30671
+ if (!response?.ok || !response.result?.threadId) {
30672
+ return failFork(response?.error?.code || "session_fork_failed", response?.error?.message || tr("forkRunFailed"));
30673
+ }
30674
+ const copiedRuns = session.runs.slice(0, runIndex + 1).map(copyRunSnapshot);
30675
+ const titleBase = String(session.title || copiedRuns[0]?.task || tr("newSessionFallback")).trim();
30676
+ const forkTitle = buildUniqueForkTitle(previousState.sessions, titleBase);
30677
+ const forked = SessionState.createSession({
30678
+ title: forkTitle,
30679
+ titleSource: "manual",
30680
+ runs: copiedRuns,
30681
+ task: "",
30682
+ mode: session.mode,
30683
+ providerId: session.providerId,
30684
+ model: session.model,
30685
+ reasoningEffort: session.reasoningEffort,
30686
+ speedTier: session.speedTier,
30687
+ requireReviewing: session.requireReviewing,
30688
+ focusFiles: session.focusFiles,
30689
+ projectReferenceFiles: session.projectReferenceFiles,
30690
+ codexThreadId: response.result.threadId,
30691
+ pendingInputs: [],
30692
+ forkedFromSessionId: session.id,
30693
+ forkedFromRunId: run.id
30694
+ });
30695
+ setState(SessionState.normalizePanelState({
30696
+ ...previousState,
30697
+ sessions: [...previousState.sessions || [], forked],
30698
+ activeSessionId: forked.id
30699
+ }));
30700
+ try {
30701
+ await saveState();
30702
+ } catch (error) {
30703
+ setState(previousState);
30704
+ await sendBackgroundNative({
30705
+ method: "codex.history.clearPlugin",
30706
+ params: { sessionId: forked.id, threadId: response.result.threadId }
30707
+ }).catch(() => null);
30708
+ showPluginToast(error.message || tr("forkRunFailed"), { status: "failed", sticky: true });
30709
+ throw error;
30710
+ }
30711
+ applyStateToPanel();
30712
+ showPluginToast(tr("forkRunDone"), { status: "completed" });
30713
+ return forked;
30714
+ }
30715
+ function failFork(code, message) {
30716
+ showPluginToast(message, { status: "failed", sticky: true });
30717
+ throw codedError(code, message);
30718
+ }
30719
+ return { forkRunFromNode };
30720
+ }
30721
+ function buildUniqueForkTitle(sessions = [], sourceTitle = "") {
30722
+ const fallback = String(sourceTitle || "New Session").trim() || "New Session";
30723
+ const baseTitle = fallback.replace(/\s+\(fork\)$/i, "").replace(/\s+\(\d+\)$/, "").trim() || fallback;
30724
+ const usedTitles = new Set((sessions || []).map((session) => String(session?.title || "").trim()));
30725
+ let index = 1;
30726
+ while (usedTitles.has(`${baseTitle} (${index})`)) index += 1;
30727
+ return `${baseTitle} (${index})`;
30728
+ }
30729
+ function findSource(state, runId) {
30730
+ for (const session of state?.sessions || []) {
30731
+ const runIndex = (session.runs || []).findIndex((run) => run.id === runId);
30732
+ if (runIndex >= 0) return { session, run: session.runs[runIndex], runIndex };
30733
+ }
30734
+ return null;
30735
+ }
30736
+ function copyRunSnapshot(run) {
30737
+ const copy = JSON.parse(JSON.stringify(run || {}));
30738
+ return {
30739
+ ...copy,
30740
+ id: `fork_${String(copy.id || "run")}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 7)}`,
30741
+ forkSnapshot: true,
30742
+ forkSourceRunId: String(copy.id || ""),
30743
+ attachments: [],
30744
+ appliedOperations: [],
30745
+ undoOperations: [],
30746
+ undoBaseFiles: [],
30747
+ undoTrackedChanges: [],
30748
+ undoExpectedFiles: [],
30749
+ undoStatus: "",
30750
+ trackedChangeStatus: "",
30751
+ nativeRequestId: "",
30752
+ queueItemId: "",
30753
+ interruptedDraft: void 0
30754
+ };
30755
+ }
30756
+ function codedError(code, message) {
30757
+ const error = new Error(message);
30758
+ error.code = code;
30759
+ return error;
30760
+ }
30761
+ return { copyRunSnapshot, create };
30762
+ });
30763
+ }).call(globalThis, void 0, void 0, void 0);
30764
+ (function runClassicContentModule82(module, exports, require2) {
30234
30765
  (function initCodexOverleafApplyResultFormatters() {
30235
30766
  "use strict";
30236
30767
  function create(deps = {}) {
@@ -30550,7 +31081,7 @@ ${conclusion}` : `${label} ${conclusion}`;
30550
31081
  window.CodexOverleafApplyResultFormatters = { create };
30551
31082
  })();
30552
31083
  }).call(globalThis, void 0, void 0, void 0);
30553
- (function runClassicContentModule80(module, exports, require2) {
31084
+ (function runClassicContentModule83(module, exports, require2) {
30554
31085
  (function initCodexOverleafModelPickerSupport(root, factory) {
30555
31086
  if (typeof module === "object" && module.exports) {
30556
31087
  module.exports = factory(require2("../shared/models"));
@@ -30567,7 +31098,7 @@ ${conclusion}` : `${label} ${conclusion}`;
30567
31098
  return tiers.includes("standard") ? tiers : ["standard", ...tiers];
30568
31099
  }
30569
31100
  function normalizeReasoningEffortsForSelect(efforts) {
30570
- const allowed = /* @__PURE__ */ new Set(["none", "minimal", "low", "medium", "high", "xhigh"]);
31101
+ const allowed = /* @__PURE__ */ new Set(["none", "minimal", "low", "medium", "high", "xhigh", "max", "ultra"]);
30571
31102
  return Array.from(new Set((Array.isArray(efforts) ? efforts : []).map((effort) => normalizeModelOptionId(effort)).filter((effort) => allowed.has(effort))));
30572
31103
  }
30573
31104
  function formatCompactModelLabel(label) {
@@ -30625,12 +31156,12 @@ ${conclusion}` : `${label} ${conclusion}`;
30625
31156
  const normalized = {
30626
31157
  id,
30627
31158
  label: typeof model?.label === "string" && model.label.length > 0 ? model.label : id,
30628
- reasoningEfforts: Array.isArray(model?.reasoningEfforts) ? model.reasoningEfforts.slice() : [],
31159
+ reasoningEfforts: normalizeReasoningEffortsForSelect(model?.reasoningEfforts),
30629
31160
  reasoningPresentation: typeof model?.reasoningPresentation === "string" ? model.reasoningPresentation : "",
30630
31161
  speedTiers: normalizeSpeedTiersForSelect(model?.speedTiers)
30631
31162
  };
30632
31163
  if (Object.prototype.hasOwnProperty.call(Object(model), "defaultReasoningEffort")) {
30633
- normalized.defaultReasoningEffort = model.defaultReasoningEffort;
31164
+ normalized.defaultReasoningEffort = normalizeModelOptionId(model.defaultReasoningEffort);
30634
31165
  }
30635
31166
  if (Object.prototype.hasOwnProperty.call(Object(model), "defaultSpeedTier")) {
30636
31167
  normalized.defaultSpeedTier = model.defaultSpeedTier;
@@ -30651,7 +31182,7 @@ ${conclusion}` : `${label} ${conclusion}`;
30651
31182
  return api;
30652
31183
  });
30653
31184
  }).call(globalThis, void 0, void 0, void 0);
30654
- (function runClassicContentModule81(module, exports, require2) {
31185
+ (function runClassicContentModule84(module, exports, require2) {
30655
31186
  (function initCodexOverleafModelPicker() {
30656
31187
  "use strict";
30657
31188
  function create(deps = {}) {
@@ -31057,7 +31588,7 @@ ${conclusion}` : `${label} ${conclusion}`;
31057
31588
  if (effort === "none") return tx("Off", "\u5173\u95ED");
31058
31589
  if (effort === "xhigh") return "Max";
31059
31590
  }
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" };
31591
+ 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
31592
  return labels[effort] || effort || "";
31062
31593
  }
31063
31594
  function resolveSelectedModel() {
@@ -31129,7 +31660,7 @@ ${conclusion}` : `${label} ${conclusion}`;
31129
31660
  window.CodexOverleafModelPicker = { create };
31130
31661
  })();
31131
31662
  }).call(globalThis, void 0, void 0, void 0);
31132
- (function runClassicContentModule82(module, exports, require2) {
31663
+ (function runClassicContentModule85(module, exports, require2) {
31133
31664
  (function initCodexOverleafProjectSessionCleanup() {
31134
31665
  "use strict";
31135
31666
  const FRESH_RUNNING_WINDOW_MS = 30 * 60 * 1e3;
@@ -31229,7 +31760,7 @@ ${conclusion}` : `${label} ${conclusion}`;
31229
31760
  window.CodexOverleafProjectSessionCleanup = { create };
31230
31761
  })();
31231
31762
  }).call(globalThis, void 0, void 0, void 0);
31232
- (function runClassicContentModule83(module, exports, require2) {
31763
+ (function runClassicContentModule86(module, exports, require2) {
31233
31764
  (function initCodexOverleafRecentProjects() {
31234
31765
  "use strict";
31235
31766
  function create(deps = {}) {
@@ -32155,7 +32686,7 @@ ${conclusion}` : `${label} ${conclusion}`;
32155
32686
  window.CodexOverleafRecentProjects = { create };
32156
32687
  })();
32157
32688
  }).call(globalThis, void 0, void 0, void 0);
32158
- (function runClassicContentModule84(module, exports, require2) {
32689
+ (function runClassicContentModule87(module, exports, require2) {
32159
32690
  (function initCodexOverleafOtWarmMirror() {
32160
32691
  "use strict";
32161
32692
  function create(deps = {}) {
@@ -33010,7 +33541,7 @@ ${conclusion}` : `${label} ${conclusion}`;
33010
33541
  window.CodexOverleafOtWarmMirror = { create };
33011
33542
  })();
33012
33543
  }).call(globalThis, void 0, void 0, void 0);
33013
- (function runClassicContentModule85(module, exports, require2) {
33544
+ (function runClassicContentModule88(module, exports, require2) {
33014
33545
  (function initCodexOverleafWritebackOrchestrator() {
33015
33546
  "use strict";
33016
33547
  let tr;
@@ -33059,6 +33590,7 @@ ${conclusion}` : `${label} ${conclusion}`;
33059
33590
  let onMirrorRefreshSettled;
33060
33591
  let writebackSettlement;
33061
33592
  let injectedWritebackSettlement;
33593
+ let assetTransferBroker;
33062
33594
  function buildSettlement(input = {}) {
33063
33595
  return writebackSettlement?.settle instanceof Function ? writebackSettlement.settle(input) : null;
33064
33596
  }
@@ -33263,7 +33795,7 @@ ${conclusion}` : `${label} ${conclusion}`;
33263
33795
  })
33264
33796
  };
33265
33797
  }
33266
- const applied = operations.length ? mergeApplyResultSkipped(await callPageBridge("applyOperations", {
33798
+ const applied = operations.length ? mergeApplyResultSkipped(await assetTransferBroker.applyOperations({
33267
33799
  operations,
33268
33800
  baseFiles: project?.files || [],
33269
33801
  requireReviewing: runRequireReviewing,
@@ -33752,6 +34284,7 @@ ${tx("Writeback note: Codex could not confirm any Overleaf write result entries,
33752
34284
  getState,
33753
34285
  getCurrentRunView
33754
34286
  } = deps);
34287
+ assetTransferBroker = deps.assetTransferBroker;
33755
34288
  onMirrorRefreshSettled = deps.onMirrorRefreshSettled;
33756
34289
  writebackSettlement = deps.writebackSettlement;
33757
34290
  compileAdapter = deps.compileAdapter;
@@ -33764,7 +34297,7 @@ ${tx("Writeback note: Codex could not confirm any Overleaf write result entries,
33764
34297
  window.CodexOverleafWritebackOrchestrator = { create };
33765
34298
  })();
33766
34299
  }).call(globalThis, void 0, void 0, void 0);
33767
- (function runClassicContentModule86(module, exports, require2) {
34300
+ (function runClassicContentModule89(module, exports, require2) {
33768
34301
  (function initCodexOverleafRunSettlementPersistence(root, factory) {
33769
34302
  const api = factory();
33770
34303
  if (typeof module === "object" && module.exports) module.exports = api;
@@ -33807,7 +34340,7 @@ ${tx("Writeback note: Codex could not confirm any Overleaf write result entries,
33807
34340
  return Object.freeze({ create });
33808
34341
  });
33809
34342
  }).call(globalThis, void 0, void 0, void 0);
33810
- (function runClassicContentModule87(module, exports, require2) {
34343
+ (function runClassicContentModule90(module, exports, require2) {
33811
34344
  (function initPostNavigationSettlementPersistence(root, factory) {
33812
34345
  const api = factory();
33813
34346
  if (typeof module === "object" && module.exports) module.exports = api;
@@ -33899,7 +34432,7 @@ ${tx("Writeback note: Codex could not confirm any Overleaf write result entries,
33899
34432
  return Object.freeze({ persist, persistRequired });
33900
34433
  });
33901
34434
  }).call(globalThis, void 0, void 0, void 0);
33902
- (function runClassicContentModule88(module, exports, require2) {
34435
+ (function runClassicContentModule91(module, exports, require2) {
33903
34436
  (function initCodexOverleafPanelMaintenance() {
33904
34437
  "use strict";
33905
34438
  function create(deps = {}) {
@@ -34215,7 +34748,7 @@ ${tx("Writeback note: Codex could not confirm any Overleaf write result entries,
34215
34748
  window.CodexOverleafPanelMaintenance = { create };
34216
34749
  })();
34217
34750
  }).call(globalThis, void 0, void 0, void 0);
34218
- (function runClassicContentModule89(module, exports, require2) {
34751
+ (function runClassicContentModule92(module, exports, require2) {
34219
34752
  (function initCodexOverleafUpdateIdle(root) {
34220
34753
  "use strict";
34221
34754
  function create(options2 = {}) {
@@ -34283,7 +34816,7 @@ ${tx("Writeback note: Codex could not confirm any Overleaf write result entries,
34283
34816
  root.CodexOverleafUpdateIdle = Object.freeze({ create });
34284
34817
  })(typeof window !== "undefined" ? window : globalThis);
34285
34818
  }).call(globalThis, void 0, void 0, void 0);
34286
- (function runClassicContentModule90(module, exports, require2) {
34819
+ (function runClassicContentModule93(module, exports, require2) {
34287
34820
  (function initCodexOverleafUpdateNotice(root, factory) {
34288
34821
  if (typeof module === "object" && module.exports) {
34289
34822
  module.exports = factory(require2("../shared/managedUpdateProjection"));
@@ -34727,7 +35260,7 @@ ${tx("Writeback note: Codex could not confirm any Overleaf write result entries,
34727
35260
  return Object.freeze({ mount });
34728
35261
  });
34729
35262
  }).call(globalThis, void 0, void 0, void 0);
34730
- (function runClassicContentModule91(module, exports, require2) {
35263
+ (function runClassicContentModule94(module, exports, require2) {
34731
35264
  (function initCodexOverleafContentRuntime(root) {
34732
35265
  "use strict";
34733
35266
  function init(dependencies2) {
@@ -35099,8 +35632,26 @@ ${tx("Writeback note: Codex could not confirm any Overleaf write result entries,
35099
35632
  openProjectFileForFailure,
35100
35633
  openStorageSettings
35101
35634
  } = panelMaintenance;
35635
+ const sessionForkController = Modules.SessionForkController.create({
35636
+ SessionState: Modules.SessionState,
35637
+ getState: () => state,
35638
+ setState: (next) => {
35639
+ state = next;
35640
+ },
35641
+ sendBackgroundNative,
35642
+ saveState,
35643
+ applyStateToPanel,
35644
+ showPluginToast,
35645
+ tr
35646
+ });
35647
+ const runResultActions = Modules.RunResultActions.create({
35648
+ tr,
35649
+ getLocale,
35650
+ forkRunFromNode: sessionForkController.forkRunFromNode
35651
+ });
35102
35652
  const runTimelineView = Modules.RunTimelineView.create({
35103
35653
  RunGuidanceView: Modules.RunGuidanceView,
35654
+ RunResultActions: runResultActions,
35104
35655
  tr,
35105
35656
  tx,
35106
35657
  getLocale,
@@ -35117,6 +35668,7 @@ ${tx("Writeback note: Codex could not confirm any Overleaf write result entries,
35117
35668
  cssEscape,
35118
35669
  renderMarkdownInlineText,
35119
35670
  renderMarkdownBlockText,
35671
+ decorateCompletionReport: Modules.MarkdownDomRenderer.decorateCompletionReport,
35120
35672
  sanitizeAssistantVisibleText,
35121
35673
  sanitizeAssistantVisibleValue,
35122
35674
  buildMarkdownInlineNodes,
@@ -35211,6 +35763,7 @@ ${tx("Writeback note: Codex could not confirm any Overleaf write result entries,
35211
35763
  getCurrentProjectId,
35212
35764
  saveStateSoon
35213
35765
  });
35766
+ const assetTransferBroker = Modules.AssetTransferBroker.create({ callPageBridge, sendBackgroundNative });
35214
35767
  const writebackOrchestrator = Modules.WritebackOrchestrator.create({
35215
35768
  tr,
35216
35769
  tx,
@@ -35250,6 +35803,7 @@ ${tx("Writeback note: Codex could not confirm any Overleaf write result entries,
35250
35803
  confirmBinaryOperations,
35251
35804
  filterSyncChangesByOperations,
35252
35805
  writebackController,
35806
+ assetTransferBroker,
35253
35807
  writebackSettlement: WritebackSettlement,
35254
35808
  compileAdapter: Modules.CompileAdapter,
35255
35809
  RUN_SNAPSHOT_ZIP_TIMEOUT_MS,
@@ -39416,6 +39970,7 @@ ${tx("Writeback note: Codex could not confirm any Overleaf write result entries,
39416
39970
  speedTier: prefs.speedTier || "",
39417
39971
  mode: prefs.mode || "",
39418
39972
  locale: prefs.locale || "",
39973
+ theme: ["dark", "light", "auto"].includes(prefs.theme) ? prefs.theme : "dark",
39419
39974
  requireReviewing: prefs.requireReviewing !== false,
39420
39975
  autoRecompile: prefs.autoRecompile !== false,
39421
39976
  loadCodexLocalSkills: prefs.loadCodexLocalSkills !== false,
@@ -39463,6 +40018,7 @@ ${tx("Writeback note: Codex could not confirm any Overleaf write result entries,
39463
40018
  reasoningEffort: fallback.reasoningEffort || "",
39464
40019
  speedTier: fallback.speedTier || "",
39465
40020
  locale: fallback.locale || "",
40021
+ theme: ["dark", "light", "auto"].includes(fallback.theme) ? fallback.theme : "dark",
39466
40022
  requireReviewing: fallback.requireReviewing !== false,
39467
40023
  autoOpen: fallback.autoOpen !== false,
39468
40024
  loadCodexLocalSkills: fallback.loadCodexLocalSkills !== false,
@@ -39725,7 +40281,10 @@ ${tx("Writeback note: Codex could not confirm any Overleaf write result entries,
39725
40281
  saveStateSoon();
39726
40282
  return;
39727
40283
  }
39728
- if (event?.target?.matches?.("[data-speed]")) renderReasoningOptions(getRenderedModelEntries());
40284
+ if (event?.target?.matches?.("[data-speed]")) {
40285
+ state.speedTier = event.target.value || "standard";
40286
+ renderReasoningOptions(getRenderedModelEntries());
40287
+ }
39729
40288
  renderSpeedOptions(getRenderedModelEntries());
39730
40289
  readPanelInputs();
39731
40290
  renderModelConfigChoices();
@@ -41473,7 +42032,7 @@ Reason: ${item.reason || "No reason provided"}`),
41473
42032
  root.CodexOverleafContentRuntime = { init };
41474
42033
  })(typeof window !== "undefined" ? window : globalThis);
41475
42034
  }).call(globalThis, void 0, void 0, void 0);
41476
- (function runClassicContentModule92(module, exports, require2) {
42035
+ (function runClassicContentModule95(module, exports, require2) {
41477
42036
  (function initCodexOverleafLegacyGlobalRegistry(root, factory) {
41478
42037
  "use strict";
41479
42038
  const api = factory();
@@ -41489,6 +42048,7 @@ Reason: ${item.reason || "No reason provided"}`),
41489
42048
  "ActiveTurnControl",
41490
42049
  "AgentTranscript",
41491
42050
  "ApplyResultFormatters",
42051
+ "AssetTransferBroker",
41492
42052
  "AuditRecords",
41493
42053
  "Compatibility",
41494
42054
  "ComposerAttachments",
@@ -41527,12 +42087,14 @@ Reason: ${item.reason || "No reason provided"}`),
41527
42087
  "RunGuidanceController",
41528
42088
  "RunInputQueue",
41529
42089
  "RunQueueScheduler",
42090
+ "RunResultActions",
41530
42091
  "RunSettlementPersistence",
41531
42092
  "RunTimelineView",
41532
42093
  "ScopedPersistenceCoordinator",
41533
42094
  "ScopedPersistenceTransaction",
41534
42095
  "SensitiveScan",
41535
42096
  "SessionManager",
42097
+ "SessionForkController",
41536
42098
  "SessionPanel",
41537
42099
  "SessionPersistence",
41538
42100
  "SessionState",