codex-overleaf-link 2.4.1 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (324) hide show
  1. package/README.md +272 -314
  2. package/README.zh-CN.md +287 -329
  3. package/extension/bootstrap/background.js +47 -10
  4. package/extension/bootstrap/manifest.template.json +9 -4
  5. package/extension/bootstrap/popup.html +10 -16
  6. package/extension/bootstrap/update.js +25 -2
  7. package/extension/runtime-manifest.json +3 -1
  8. package/extension/src/background.js +28 -3
  9. package/extension/src/backgroundSharedSessions.js +380 -0
  10. package/extension/src/backgroundUpdateCoordinator.js +442 -379
  11. package/extension/src/content/activeTurnControl.js +8 -0
  12. package/extension/src/content/assetTransferBroker.js +186 -12
  13. package/extension/src/content/changeHistoryView.js +175 -0
  14. package/extension/src/content/composerAttachments.js +24 -22
  15. package/extension/src/content/composerPanel.js +23 -8
  16. package/extension/src/content/contentRuntime.js +507 -507
  17. package/extension/src/content/diagnosticsController.js +1 -2
  18. package/extension/src/content/diagnosticsExport.js +222 -0
  19. package/extension/src/content/diagnosticsPanel.js +48 -19
  20. package/extension/src/content/diffReviewPanel.js +8 -5
  21. package/extension/src/content/generated/content.bundle.js +8330 -1349
  22. package/extension/src/content/generated/content.bundle.meta.json +22 -3
  23. package/extension/src/content/legacyGlobalRegistry.js +19 -1
  24. package/extension/src/content/localSkillsPanel.js +42 -7
  25. package/extension/src/content/markdownDomRenderer.js +9 -4
  26. package/extension/src/content/modelPicker.js +1 -1
  27. package/extension/src/content/pageBridgeClient.js +18 -3
  28. package/extension/src/content/panelMaintenance.js +48 -121
  29. package/extension/src/content/panelRenderer.js +4 -0
  30. package/extension/src/content/pendingInputView.js +109 -76
  31. package/extension/src/content/providerSettingsCoordinator.js +17 -6
  32. package/extension/src/content/providerSettingsDialog.js +661 -108
  33. package/extension/src/content/recentProjects.js +10 -1
  34. package/extension/src/content/runActivitySummary.js +631 -0
  35. package/extension/src/content/runController.js +3 -1
  36. package/extension/src/content/runFailureNotice.js +14 -1
  37. package/extension/src/content/runGuidanceController.js +4 -3
  38. package/extension/src/content/runPresence.js +306 -0
  39. package/extension/src/content/runQueueScheduler.js +2 -1
  40. package/extension/src/content/runResultActions.js +123 -3
  41. package/extension/src/content/runTimelineView.js +186 -154
  42. package/extension/src/content/selectionContextView.js +300 -0
  43. package/extension/src/content/sessionPersistence.js +6 -1
  44. package/extension/src/content/settingsPanel.js +77 -52
  45. package/extension/src/content/settingsWorkbench.js +374 -0
  46. package/extension/src/content/sharedSessionViewSync.js +72 -0
  47. package/extension/src/content/subagentActivityView.js +195 -0
  48. package/extension/src/content/trackedChangeCaptureController.js +7 -3
  49. package/extension/src/content/updateNotice.js +121 -50
  50. package/extension/src/content/writebackController.js +257 -0
  51. package/extension/src/content/writebackOrchestrator.js +146 -141
  52. package/extension/src/content/writebackPlan.js +231 -0
  53. package/extension/src/content/writebackRecovery.js +122 -0
  54. package/extension/src/content/writingStyleSettings.js +576 -0
  55. package/extension/src/content/writtenChangesView.js +152 -0
  56. package/extension/src/page/binaryAssetUploader.js +97 -19
  57. package/extension/src/page/overleafProjectSnapshot.js +1 -0
  58. package/extension/src/page/referenceProjects.js +148 -0
  59. package/extension/src/page/saveState.js +14 -2
  60. package/extension/src/page/snapshotRouter.js +44 -13
  61. package/extension/src/page/textCoordinates.js +102 -0
  62. package/extension/src/page/textFileCreator.js +350 -59
  63. package/extension/src/page/trackedChangeCapture.js +42 -56
  64. package/extension/src/page/trackedChangeOwnership.js +198 -0
  65. package/extension/src/page/trackedChangeReplay.js +164 -0
  66. package/extension/src/page/trackedChangesLifecycle.js +135 -149
  67. package/extension/src/page/treeOperations.js +26 -2
  68. package/extension/src/page/writebackReceiptJournal.js +112 -0
  69. package/extension/src/page/writebackRouter.js +175 -135
  70. package/extension/src/pageBridge.js +56 -101
  71. package/extension/src/popup.js +203 -59
  72. package/extension/src/shared/agentTranscript.js +18 -4
  73. package/extension/src/shared/auditRecords.js +71 -0
  74. package/extension/src/shared/changeHistoryModel.js +94 -0
  75. package/extension/src/shared/compatibility.js +1 -1
  76. package/extension/src/shared/compileAdapter.js +42 -0
  77. package/extension/src/shared/failureReasons.js +20 -0
  78. package/extension/src/shared/globalPreferences.js +1 -1
  79. package/extension/src/shared/i18n.js +93 -25
  80. package/extension/src/shared/managedUpdateProjection.js +6 -3
  81. package/extension/src/shared/pageRpcContract.js +7 -1
  82. package/extension/src/shared/providerProfiles.js +109 -0
  83. package/extension/src/shared/runActivityModel.js +361 -0
  84. package/extension/src/shared/runExecutionSnapshot.js +8 -2
  85. package/extension/src/shared/runExecutionSnapshotCodec.js +16 -4
  86. package/extension/src/shared/scopedPersistenceBrowserAdapter.js +6 -3
  87. package/extension/src/shared/selectionContext.js +28 -0
  88. package/extension/src/shared/sessionState.js +97 -6
  89. package/extension/src/shared/sharedSessionBridge.js +288 -0
  90. package/extension/src/shared/storageDb.js +22 -55
  91. package/extension/src/shared/storageMigration.js +3 -0
  92. package/extension/src/shared/storageRunActions.js +10 -4
  93. package/extension/src/shared/storageValuePruning.js +40 -0
  94. package/extension/src/shared/subagentActivityModel.js +174 -0
  95. package/extension/src/shared/undoOperations.js +87 -0
  96. package/extension/src/shared/updateConsent.js +37 -8
  97. package/extension/src/shared/writebackIntent.js +62 -0
  98. package/extension/src/shared/writebackSettlement.js +29 -10
  99. package/extension/src/shared/writingStyle.js +33 -0
  100. package/extension/styles/panel.css +1972 -384
  101. package/extension/styles/popup.css +110 -0
  102. package/native-host/src/anthropicBridgeRequest.js +2 -1
  103. package/native-host/src/codexModelRecovery.js +107 -0
  104. package/native-host/src/codexPromptAssembly.js +2 -0
  105. package/native-host/src/codexProviderLaunch.js +3 -3
  106. package/native-host/src/codexRuntimeIdentity.js +1 -0
  107. package/native-host/src/codexSessionRunner.js +106 -140
  108. package/native-host/src/codexSessionTiming.js +3 -0
  109. package/native-host/src/managedInstall.js +5 -4
  110. package/native-host/src/nativeEnvironment.js +70 -0
  111. package/native-host/src/nativeQuotas.js +15 -8
  112. package/native-host/src/overleafWorkspaceRules.js +16 -0
  113. package/native-host/src/processStopBarrier.js +80 -0
  114. package/native-host/src/providerModelCatalog.js +4 -3
  115. package/native-host/src/providerProfile.js +13 -1
  116. package/native-host/src/providerReasoning.js +9 -5
  117. package/native-host/src/providerStore.js +4 -0
  118. package/native-host/src/releaseTransport.js +14 -5
  119. package/native-host/src/selectionScope.js +58 -0
  120. package/native-host/src/skills/parallel-subagents/SKILL.md +31 -3
  121. package/native-host/src/skills/writing-style-builder/SKILL.md +146 -0
  122. package/native-host/src/subagentBroker.js +102 -98
  123. package/native-host/src/subagentTelemetry.js +316 -0
  124. package/native-host/src/subagentWorkspace.js +103 -0
  125. package/native-host/src/subagentWorkspacePath.js +31 -0
  126. package/native-host/src/taskRunnerRuntime.js +55 -5
  127. package/native-host/src/turnAttachments.js +113 -0
  128. package/native-host/src/updateManager.js +122 -12
  129. package/native-host/src/updateNetworkControl.js +75 -0
  130. package/native-host/src/updateTrust.js +21 -2
  131. package/native-host/src/vendor/pdfjs/LICENSE +177 -0
  132. package/native-host/src/vendor/pdfjs/SOURCE.txt +3 -0
  133. package/native-host/src/vendor/pdfjs/cmaps/78-EUC-H.bcmap +0 -0
  134. package/native-host/src/vendor/pdfjs/cmaps/78-EUC-V.bcmap +0 -0
  135. package/native-host/src/vendor/pdfjs/cmaps/78-H.bcmap +0 -0
  136. package/native-host/src/vendor/pdfjs/cmaps/78-RKSJ-H.bcmap +0 -0
  137. package/native-host/src/vendor/pdfjs/cmaps/78-RKSJ-V.bcmap +0 -0
  138. package/native-host/src/vendor/pdfjs/cmaps/78-V.bcmap +0 -0
  139. package/native-host/src/vendor/pdfjs/cmaps/78ms-RKSJ-H.bcmap +0 -0
  140. package/native-host/src/vendor/pdfjs/cmaps/78ms-RKSJ-V.bcmap +0 -0
  141. package/native-host/src/vendor/pdfjs/cmaps/83pv-RKSJ-H.bcmap +0 -0
  142. package/native-host/src/vendor/pdfjs/cmaps/90ms-RKSJ-H.bcmap +0 -0
  143. package/native-host/src/vendor/pdfjs/cmaps/90ms-RKSJ-V.bcmap +0 -0
  144. package/native-host/src/vendor/pdfjs/cmaps/90msp-RKSJ-H.bcmap +0 -0
  145. package/native-host/src/vendor/pdfjs/cmaps/90msp-RKSJ-V.bcmap +0 -0
  146. package/native-host/src/vendor/pdfjs/cmaps/90pv-RKSJ-H.bcmap +0 -0
  147. package/native-host/src/vendor/pdfjs/cmaps/90pv-RKSJ-V.bcmap +0 -0
  148. package/native-host/src/vendor/pdfjs/cmaps/Add-H.bcmap +0 -0
  149. package/native-host/src/vendor/pdfjs/cmaps/Add-RKSJ-H.bcmap +0 -0
  150. package/native-host/src/vendor/pdfjs/cmaps/Add-RKSJ-V.bcmap +0 -0
  151. package/native-host/src/vendor/pdfjs/cmaps/Add-V.bcmap +0 -0
  152. package/native-host/src/vendor/pdfjs/cmaps/Adobe-CNS1-0.bcmap +0 -0
  153. package/native-host/src/vendor/pdfjs/cmaps/Adobe-CNS1-1.bcmap +0 -0
  154. package/native-host/src/vendor/pdfjs/cmaps/Adobe-CNS1-2.bcmap +0 -0
  155. package/native-host/src/vendor/pdfjs/cmaps/Adobe-CNS1-3.bcmap +0 -0
  156. package/native-host/src/vendor/pdfjs/cmaps/Adobe-CNS1-4.bcmap +0 -0
  157. package/native-host/src/vendor/pdfjs/cmaps/Adobe-CNS1-5.bcmap +0 -0
  158. package/native-host/src/vendor/pdfjs/cmaps/Adobe-CNS1-6.bcmap +0 -0
  159. package/native-host/src/vendor/pdfjs/cmaps/Adobe-CNS1-UCS2.bcmap +0 -0
  160. package/native-host/src/vendor/pdfjs/cmaps/Adobe-GB1-0.bcmap +0 -0
  161. package/native-host/src/vendor/pdfjs/cmaps/Adobe-GB1-1.bcmap +0 -0
  162. package/native-host/src/vendor/pdfjs/cmaps/Adobe-GB1-2.bcmap +0 -0
  163. package/native-host/src/vendor/pdfjs/cmaps/Adobe-GB1-3.bcmap +0 -0
  164. package/native-host/src/vendor/pdfjs/cmaps/Adobe-GB1-4.bcmap +0 -0
  165. package/native-host/src/vendor/pdfjs/cmaps/Adobe-GB1-5.bcmap +0 -0
  166. package/native-host/src/vendor/pdfjs/cmaps/Adobe-GB1-UCS2.bcmap +0 -0
  167. package/native-host/src/vendor/pdfjs/cmaps/Adobe-Japan1-0.bcmap +0 -0
  168. package/native-host/src/vendor/pdfjs/cmaps/Adobe-Japan1-1.bcmap +0 -0
  169. package/native-host/src/vendor/pdfjs/cmaps/Adobe-Japan1-2.bcmap +0 -0
  170. package/native-host/src/vendor/pdfjs/cmaps/Adobe-Japan1-3.bcmap +0 -0
  171. package/native-host/src/vendor/pdfjs/cmaps/Adobe-Japan1-4.bcmap +0 -0
  172. package/native-host/src/vendor/pdfjs/cmaps/Adobe-Japan1-5.bcmap +0 -0
  173. package/native-host/src/vendor/pdfjs/cmaps/Adobe-Japan1-6.bcmap +0 -0
  174. package/native-host/src/vendor/pdfjs/cmaps/Adobe-Japan1-UCS2.bcmap +0 -0
  175. package/native-host/src/vendor/pdfjs/cmaps/Adobe-Korea1-0.bcmap +0 -0
  176. package/native-host/src/vendor/pdfjs/cmaps/Adobe-Korea1-1.bcmap +0 -0
  177. package/native-host/src/vendor/pdfjs/cmaps/Adobe-Korea1-2.bcmap +0 -0
  178. package/native-host/src/vendor/pdfjs/cmaps/Adobe-Korea1-UCS2.bcmap +0 -0
  179. package/native-host/src/vendor/pdfjs/cmaps/B5-H.bcmap +0 -0
  180. package/native-host/src/vendor/pdfjs/cmaps/B5-V.bcmap +0 -0
  181. package/native-host/src/vendor/pdfjs/cmaps/B5pc-H.bcmap +0 -0
  182. package/native-host/src/vendor/pdfjs/cmaps/B5pc-V.bcmap +0 -0
  183. package/native-host/src/vendor/pdfjs/cmaps/CNS-EUC-H.bcmap +0 -0
  184. package/native-host/src/vendor/pdfjs/cmaps/CNS-EUC-V.bcmap +0 -0
  185. package/native-host/src/vendor/pdfjs/cmaps/CNS1-H.bcmap +0 -0
  186. package/native-host/src/vendor/pdfjs/cmaps/CNS1-V.bcmap +0 -0
  187. package/native-host/src/vendor/pdfjs/cmaps/CNS2-H.bcmap +0 -0
  188. package/native-host/src/vendor/pdfjs/cmaps/CNS2-V.bcmap +3 -0
  189. package/native-host/src/vendor/pdfjs/cmaps/ETHK-B5-H.bcmap +0 -0
  190. package/native-host/src/vendor/pdfjs/cmaps/ETHK-B5-V.bcmap +0 -0
  191. package/native-host/src/vendor/pdfjs/cmaps/ETen-B5-H.bcmap +0 -0
  192. package/native-host/src/vendor/pdfjs/cmaps/ETen-B5-V.bcmap +0 -0
  193. package/native-host/src/vendor/pdfjs/cmaps/ETenms-B5-H.bcmap +3 -0
  194. package/native-host/src/vendor/pdfjs/cmaps/ETenms-B5-V.bcmap +0 -0
  195. package/native-host/src/vendor/pdfjs/cmaps/EUC-H.bcmap +0 -0
  196. package/native-host/src/vendor/pdfjs/cmaps/EUC-V.bcmap +0 -0
  197. package/native-host/src/vendor/pdfjs/cmaps/Ext-H.bcmap +0 -0
  198. package/native-host/src/vendor/pdfjs/cmaps/Ext-RKSJ-H.bcmap +0 -0
  199. package/native-host/src/vendor/pdfjs/cmaps/Ext-RKSJ-V.bcmap +0 -0
  200. package/native-host/src/vendor/pdfjs/cmaps/Ext-V.bcmap +0 -0
  201. package/native-host/src/vendor/pdfjs/cmaps/GB-EUC-H.bcmap +0 -0
  202. package/native-host/src/vendor/pdfjs/cmaps/GB-EUC-V.bcmap +0 -0
  203. package/native-host/src/vendor/pdfjs/cmaps/GB-H.bcmap +4 -0
  204. package/native-host/src/vendor/pdfjs/cmaps/GB-V.bcmap +0 -0
  205. package/native-host/src/vendor/pdfjs/cmaps/GBK-EUC-H.bcmap +0 -0
  206. package/native-host/src/vendor/pdfjs/cmaps/GBK-EUC-V.bcmap +0 -0
  207. package/native-host/src/vendor/pdfjs/cmaps/GBK2K-H.bcmap +0 -0
  208. package/native-host/src/vendor/pdfjs/cmaps/GBK2K-V.bcmap +0 -0
  209. package/native-host/src/vendor/pdfjs/cmaps/GBKp-EUC-H.bcmap +0 -0
  210. package/native-host/src/vendor/pdfjs/cmaps/GBKp-EUC-V.bcmap +0 -0
  211. package/native-host/src/vendor/pdfjs/cmaps/GBT-EUC-H.bcmap +0 -0
  212. package/native-host/src/vendor/pdfjs/cmaps/GBT-EUC-V.bcmap +0 -0
  213. package/native-host/src/vendor/pdfjs/cmaps/GBT-H.bcmap +0 -0
  214. package/native-host/src/vendor/pdfjs/cmaps/GBT-V.bcmap +0 -0
  215. package/native-host/src/vendor/pdfjs/cmaps/GBTpc-EUC-H.bcmap +0 -0
  216. package/native-host/src/vendor/pdfjs/cmaps/GBTpc-EUC-V.bcmap +0 -0
  217. package/native-host/src/vendor/pdfjs/cmaps/GBpc-EUC-H.bcmap +0 -0
  218. package/native-host/src/vendor/pdfjs/cmaps/GBpc-EUC-V.bcmap +0 -0
  219. package/native-host/src/vendor/pdfjs/cmaps/H.bcmap +0 -0
  220. package/native-host/src/vendor/pdfjs/cmaps/HKdla-B5-H.bcmap +0 -0
  221. package/native-host/src/vendor/pdfjs/cmaps/HKdla-B5-V.bcmap +0 -0
  222. package/native-host/src/vendor/pdfjs/cmaps/HKdlb-B5-H.bcmap +0 -0
  223. package/native-host/src/vendor/pdfjs/cmaps/HKdlb-B5-V.bcmap +0 -0
  224. package/native-host/src/vendor/pdfjs/cmaps/HKgccs-B5-H.bcmap +0 -0
  225. package/native-host/src/vendor/pdfjs/cmaps/HKgccs-B5-V.bcmap +0 -0
  226. package/native-host/src/vendor/pdfjs/cmaps/HKm314-B5-H.bcmap +0 -0
  227. package/native-host/src/vendor/pdfjs/cmaps/HKm314-B5-V.bcmap +0 -0
  228. package/native-host/src/vendor/pdfjs/cmaps/HKm471-B5-H.bcmap +0 -0
  229. package/native-host/src/vendor/pdfjs/cmaps/HKm471-B5-V.bcmap +0 -0
  230. package/native-host/src/vendor/pdfjs/cmaps/HKscs-B5-H.bcmap +0 -0
  231. package/native-host/src/vendor/pdfjs/cmaps/HKscs-B5-V.bcmap +0 -0
  232. package/native-host/src/vendor/pdfjs/cmaps/Hankaku.bcmap +0 -0
  233. package/native-host/src/vendor/pdfjs/cmaps/Hiragana.bcmap +0 -0
  234. package/native-host/src/vendor/pdfjs/cmaps/KSC-EUC-H.bcmap +0 -0
  235. package/native-host/src/vendor/pdfjs/cmaps/KSC-EUC-V.bcmap +0 -0
  236. package/native-host/src/vendor/pdfjs/cmaps/KSC-H.bcmap +0 -0
  237. package/native-host/src/vendor/pdfjs/cmaps/KSC-Johab-H.bcmap +0 -0
  238. package/native-host/src/vendor/pdfjs/cmaps/KSC-Johab-V.bcmap +0 -0
  239. package/native-host/src/vendor/pdfjs/cmaps/KSC-V.bcmap +0 -0
  240. package/native-host/src/vendor/pdfjs/cmaps/KSCms-UHC-H.bcmap +0 -0
  241. package/native-host/src/vendor/pdfjs/cmaps/KSCms-UHC-HW-H.bcmap +0 -0
  242. package/native-host/src/vendor/pdfjs/cmaps/KSCms-UHC-HW-V.bcmap +0 -0
  243. package/native-host/src/vendor/pdfjs/cmaps/KSCms-UHC-V.bcmap +0 -0
  244. package/native-host/src/vendor/pdfjs/cmaps/KSCpc-EUC-H.bcmap +0 -0
  245. package/native-host/src/vendor/pdfjs/cmaps/KSCpc-EUC-V.bcmap +0 -0
  246. package/native-host/src/vendor/pdfjs/cmaps/Katakana.bcmap +0 -0
  247. package/native-host/src/vendor/pdfjs/cmaps/LICENSE +36 -0
  248. package/native-host/src/vendor/pdfjs/cmaps/NWP-H.bcmap +0 -0
  249. package/native-host/src/vendor/pdfjs/cmaps/NWP-V.bcmap +0 -0
  250. package/native-host/src/vendor/pdfjs/cmaps/RKSJ-H.bcmap +0 -0
  251. package/native-host/src/vendor/pdfjs/cmaps/RKSJ-V.bcmap +0 -0
  252. package/native-host/src/vendor/pdfjs/cmaps/Roman.bcmap +0 -0
  253. package/native-host/src/vendor/pdfjs/cmaps/UniCNS-UCS2-H.bcmap +0 -0
  254. package/native-host/src/vendor/pdfjs/cmaps/UniCNS-UCS2-V.bcmap +0 -0
  255. package/native-host/src/vendor/pdfjs/cmaps/UniCNS-UTF16-H.bcmap +0 -0
  256. package/native-host/src/vendor/pdfjs/cmaps/UniCNS-UTF16-V.bcmap +0 -0
  257. package/native-host/src/vendor/pdfjs/cmaps/UniCNS-UTF32-H.bcmap +0 -0
  258. package/native-host/src/vendor/pdfjs/cmaps/UniCNS-UTF32-V.bcmap +0 -0
  259. package/native-host/src/vendor/pdfjs/cmaps/UniCNS-UTF8-H.bcmap +0 -0
  260. package/native-host/src/vendor/pdfjs/cmaps/UniCNS-UTF8-V.bcmap +0 -0
  261. package/native-host/src/vendor/pdfjs/cmaps/UniGB-UCS2-H.bcmap +0 -0
  262. package/native-host/src/vendor/pdfjs/cmaps/UniGB-UCS2-V.bcmap +0 -0
  263. package/native-host/src/vendor/pdfjs/cmaps/UniGB-UTF16-H.bcmap +0 -0
  264. package/native-host/src/vendor/pdfjs/cmaps/UniGB-UTF16-V.bcmap +0 -0
  265. package/native-host/src/vendor/pdfjs/cmaps/UniGB-UTF32-H.bcmap +0 -0
  266. package/native-host/src/vendor/pdfjs/cmaps/UniGB-UTF32-V.bcmap +0 -0
  267. package/native-host/src/vendor/pdfjs/cmaps/UniGB-UTF8-H.bcmap +0 -0
  268. package/native-host/src/vendor/pdfjs/cmaps/UniGB-UTF8-V.bcmap +0 -0
  269. package/native-host/src/vendor/pdfjs/cmaps/UniJIS-UCS2-H.bcmap +0 -0
  270. package/native-host/src/vendor/pdfjs/cmaps/UniJIS-UCS2-HW-H.bcmap +0 -0
  271. package/native-host/src/vendor/pdfjs/cmaps/UniJIS-UCS2-HW-V.bcmap +0 -0
  272. package/native-host/src/vendor/pdfjs/cmaps/UniJIS-UCS2-V.bcmap +0 -0
  273. package/native-host/src/vendor/pdfjs/cmaps/UniJIS-UTF16-H.bcmap +0 -0
  274. package/native-host/src/vendor/pdfjs/cmaps/UniJIS-UTF16-V.bcmap +0 -0
  275. package/native-host/src/vendor/pdfjs/cmaps/UniJIS-UTF32-H.bcmap +0 -0
  276. package/native-host/src/vendor/pdfjs/cmaps/UniJIS-UTF32-V.bcmap +0 -0
  277. package/native-host/src/vendor/pdfjs/cmaps/UniJIS-UTF8-H.bcmap +0 -0
  278. package/native-host/src/vendor/pdfjs/cmaps/UniJIS-UTF8-V.bcmap +0 -0
  279. package/native-host/src/vendor/pdfjs/cmaps/UniJIS2004-UTF16-H.bcmap +0 -0
  280. package/native-host/src/vendor/pdfjs/cmaps/UniJIS2004-UTF16-V.bcmap +0 -0
  281. package/native-host/src/vendor/pdfjs/cmaps/UniJIS2004-UTF32-H.bcmap +0 -0
  282. package/native-host/src/vendor/pdfjs/cmaps/UniJIS2004-UTF32-V.bcmap +0 -0
  283. package/native-host/src/vendor/pdfjs/cmaps/UniJIS2004-UTF8-H.bcmap +0 -0
  284. package/native-host/src/vendor/pdfjs/cmaps/UniJIS2004-UTF8-V.bcmap +0 -0
  285. package/native-host/src/vendor/pdfjs/cmaps/UniJISPro-UCS2-HW-V.bcmap +0 -0
  286. package/native-host/src/vendor/pdfjs/cmaps/UniJISPro-UCS2-V.bcmap +0 -0
  287. package/native-host/src/vendor/pdfjs/cmaps/UniJISPro-UTF8-V.bcmap +0 -0
  288. package/native-host/src/vendor/pdfjs/cmaps/UniJISX0213-UTF32-H.bcmap +0 -0
  289. package/native-host/src/vendor/pdfjs/cmaps/UniJISX0213-UTF32-V.bcmap +0 -0
  290. package/native-host/src/vendor/pdfjs/cmaps/UniJISX02132004-UTF32-H.bcmap +0 -0
  291. package/native-host/src/vendor/pdfjs/cmaps/UniJISX02132004-UTF32-V.bcmap +0 -0
  292. package/native-host/src/vendor/pdfjs/cmaps/UniKS-UCS2-H.bcmap +0 -0
  293. package/native-host/src/vendor/pdfjs/cmaps/UniKS-UCS2-V.bcmap +0 -0
  294. package/native-host/src/vendor/pdfjs/cmaps/UniKS-UTF16-H.bcmap +0 -0
  295. package/native-host/src/vendor/pdfjs/cmaps/UniKS-UTF16-V.bcmap +0 -0
  296. package/native-host/src/vendor/pdfjs/cmaps/UniKS-UTF32-H.bcmap +0 -0
  297. package/native-host/src/vendor/pdfjs/cmaps/UniKS-UTF32-V.bcmap +0 -0
  298. package/native-host/src/vendor/pdfjs/cmaps/UniKS-UTF8-H.bcmap +0 -0
  299. package/native-host/src/vendor/pdfjs/cmaps/UniKS-UTF8-V.bcmap +0 -0
  300. package/native-host/src/vendor/pdfjs/cmaps/V.bcmap +0 -0
  301. package/native-host/src/vendor/pdfjs/cmaps/WP-Symbol.bcmap +0 -0
  302. package/native-host/src/vendor/pdfjs/pdf.mjs +26740 -0
  303. package/native-host/src/vendor/pdfjs/pdf.worker.mjs +62201 -0
  304. package/native-host/src/vendor/pdfjs/standard_fonts/FoxitDingbats.pfb +0 -0
  305. package/native-host/src/vendor/pdfjs/standard_fonts/FoxitFixed.pfb +0 -0
  306. package/native-host/src/vendor/pdfjs/standard_fonts/FoxitFixedBold.pfb +0 -0
  307. package/native-host/src/vendor/pdfjs/standard_fonts/FoxitFixedBoldItalic.pfb +0 -0
  308. package/native-host/src/vendor/pdfjs/standard_fonts/FoxitFixedItalic.pfb +0 -0
  309. package/native-host/src/vendor/pdfjs/standard_fonts/FoxitSerif.pfb +0 -0
  310. package/native-host/src/vendor/pdfjs/standard_fonts/FoxitSerifBold.pfb +0 -0
  311. package/native-host/src/vendor/pdfjs/standard_fonts/FoxitSerifBoldItalic.pfb +0 -0
  312. package/native-host/src/vendor/pdfjs/standard_fonts/FoxitSerifItalic.pfb +0 -0
  313. package/native-host/src/vendor/pdfjs/standard_fonts/FoxitSymbol.pfb +0 -0
  314. package/native-host/src/vendor/pdfjs/standard_fonts/LICENSE_FOXIT +27 -0
  315. package/native-host/src/vendor/pdfjs/standard_fonts/LICENSE_LIBERATION +102 -0
  316. package/native-host/src/vendor/pdfjs/standard_fonts/LiberationSans-Bold.ttf +0 -0
  317. package/native-host/src/vendor/pdfjs/standard_fonts/LiberationSans-BoldItalic.ttf +0 -0
  318. package/native-host/src/vendor/pdfjs/standard_fonts/LiberationSans-Italic.ttf +0 -0
  319. package/native-host/src/vendor/pdfjs/standard_fonts/LiberationSans-Regular.ttf +0 -0
  320. package/native-host/src/writingStyleEvidence.js +102 -0
  321. package/native-host/src/writingStylePdfWorker.js +35 -0
  322. package/native-host/src/writingStyleProfile.js +165 -0
  323. package/native-host/src/writingStyleRuntime.js +447 -0
  324. package/package.json +1 -1
@@ -63,6 +63,8 @@
63
63
  let writebackSettlement;
64
64
  let injectedWritebackSettlement;
65
65
  let assetTransferBroker;
66
+ let stageWritebackRecovery;
67
+ let settleWritebackRecovery;
66
68
 
67
69
  function buildSettlement(input = {}) {
68
70
  return writebackSettlement?.settle instanceof Function
@@ -99,6 +101,8 @@
99
101
  }
100
102
 
101
103
  async function applySyncChangesToOverleaf(syncChanges = [], project = {}, options = {}) {
104
+ const activeRun = getCurrentRunView?.();
105
+ const saveTarget = { runProjectId: activeRun?.runProjectId || '', recordId: activeRun?.recordId || '', sessionId: activeRun?.sessionId || '' };
102
106
  const runMode = options.mode || getState().mode;
103
107
  const runRequireReviewing = typeof options.requireReviewing === 'boolean'
104
108
  ? options.requireReviewing
@@ -106,6 +110,20 @@
106
110
  const assistantMessage = cleanFinalAnswer(options.assistantMessage || getAssistantAnswerForCurrentRun());
107
111
  const unsupportedChanges = Array.isArray(options.unsupportedChanges) ? options.unsupportedChanges : [];
108
112
  appendUnsupportedLocalChanges(unsupportedChanges);
113
+ const withheldOnly = unsupportedChanges.filter(change => ['subagent_unfinished_output', 'subagent_unauthorized_edit'].includes(change.reason));
114
+ if (runMode !== 'ask' && !syncChanges.length && withheldOnly.length) {
115
+ const skipped = withheldOnly.map(change => ({ operation: { type: 'create', path: change.path }, result: {
116
+ ok: false, code: change.reason, changedDocument: false,
117
+ reason: writebackController.formatUnsupportedLocalChangeReason(change, getLocale())
118
+ } }));
119
+ const applied = { ok: false, applied: [], skipped };
120
+ appendCompletionReport({ conclusion: assistantMessage || tx('Some generated files still need review.', '部分生成文件仍需核对。'),
121
+ status: 'failed', operations: [], applyResults: [applied], mode: runMode,
122
+ nextStep: tx('The main agent must review and adopt the withheld files before syncing them.', '主代理需核对并接管未同步文件后再写回。') });
123
+ return { summaryLine: tx('Generated files are awaiting review.', '生成文件待核对。'), hasSkippedOperations: true,
124
+ applied, settlement: buildSettlement({ operations: [], applyResult: applied }),
125
+ audit: buildAuditSummaryFromApply({ operations: [], applyResults: [applied], resultStatus: 'completed_with_skips' }) };
126
+ }
109
127
  // Guard on the immutable submitted mode, not the mutable panel state.
110
128
  if (options.mode === 'ask' && ((syncChanges || []).length || unsupportedChanges.length)) {
111
129
  appendRunEvent({
@@ -312,6 +330,13 @@
312
330
  })
313
331
  };
314
332
  }
333
+ const writebackActivityId = 'overleaf-writeback:' + Date.now().toString(36);
334
+ appendRunEvent({
335
+ title: tx('Syncing approved changes to Overleaf.', '正在将已批准的改动同步到 Overleaf。'),
336
+ status: 'running',
337
+ activity: { v: 1, kind: 'sync', id: writebackActivityId, state: 'running', paths: operations.map(operation => operation.path).filter(Boolean) }
338
+ });
339
+ await stageWritebackRecovery?.(operations, saveTarget, runRequireReviewing);
315
340
  const applied = operations.length
316
341
  ? mergeApplyResultSkipped(await assetTransferBroker.applyOperations({
317
342
  operations,
@@ -321,10 +346,19 @@
321
346
  // Welcome-panel + write-guard:
322
347
  // immutable per-run project id, checked by the page-side guard
323
348
  // against `_ide.project._id` before any mutation.
324
- runProjectId: getCurrentRunView()?.runProjectId || ''
349
+ runProjectId: getCurrentRunView()?.runProjectId || '',
350
+ retryCreates: options.retryCreates === true
325
351
  }), additionalSkippedEntries)
326
352
  : mergeApplyResultSkipped({ ok: true, applied: [], skipped: [] }, additionalSkippedEntries);
327
353
  const hasConfirmedApplyResult = hasApplyResultEntries(applied);
354
+ for (const change of unsupportedChanges.filter(item => ['subagent_unfinished_output', 'subagent_unauthorized_edit'].includes(item.reason))) {
355
+ const reason = writebackController.formatUnsupportedLocalChangeReason(change, getLocale());
356
+ applied.skipped.push({ operation: { type: 'create', path: change.path }, result: { ok: false,
357
+ code: change.reason, reason, changedDocument: false, failure: { code: change.reason,
358
+ stage: 'preflight', severity: 'blocked', retryable: false, terminalState: 'blocked', changedDocument: false,
359
+ userMessage: reason, nextAction: 'The main agent must review the withheld file before syncing it.' } } });
360
+ applied.ok = false;
361
+ }
328
362
  // Record the apply result + undo checkpoint IMMEDIATELY, before any
329
363
  // cancellable verify/mirror awaits below. A user-cancel during the
330
364
  // post-write save-verify or mirror refresh throws codex_cancelled; if undo
@@ -342,36 +376,37 @@
342
376
  renderReadOnlyDiffReview(getAppliedSyncChanges(syncChanges, applied));
343
377
  }
344
378
  const appliedPaths = getAppliedOperationPaths(applied);
379
+ appendRunEvent({
380
+ title: tx('Overleaf writeback returned its result.', 'Overleaf 写回已返回结果。'),
381
+ status: !hasConfirmedApplyResult || skippedEntries.length ? 'warning' : 'completed',
382
+ activity: { v: 1, kind: 'sync', id: writebackActivityId,
383
+ state: !hasConfirmedApplyResult || skippedEntries.length ? 'warning' : 'completed',
384
+ paths: operations.map(operation => operation.path).filter(Boolean),
385
+ written: appliedPaths.length, skipped: skippedEntries.length }
386
+ });
345
387
  // Only probe save-state + refresh the mirror when real writes landed. A
346
388
  // zero-write run (every operation skipped) has nothing to save-verify, so
347
389
  // skip the ~5s probe and its misleading "could not verify saved" warning
348
390
  // (v1.6.2).
349
- const saveVerification = appliedPaths.length
350
- ? await verifyPostWriteSaveState()
351
- : {
352
- ok: false,
353
- state: 'not_checked',
354
- reason: 'No applied writeback operations were returned.'
355
- };
391
+ const confirmation = appliedPaths.length
392
+ ? await verifyPostWriteSaveState(applied, project, saveTarget)
393
+ : { verification: { ok: false, state: 'not_checked', reason: 'No applied writeback operations were returned.' } };
394
+ const saveVerification = confirmation.verification;
395
+ await settleWritebackRecovery?.(applied, project, saveVerification, saveTarget);
356
396
  if (appliedPaths.length) {
357
- appendPostWriteSaveVerificationWarning(saveVerification);
397
+ appendPostWriteSaveVerificationWarning(saveVerification, saveTarget);
398
+ appendRunEvent({ kind: 'technical', title: 'Post-write save confirmation', status: 'info', detail: saveVerification });
358
399
  }
359
400
  // v1.7.5: the mirror refresh (zip snapshot + mirror.sync, often the
360
401
  // slowest post-write step) no longer blocks the completion report. The
361
402
  // pending promise is exposed so undoRun and the next runTask barrier on
362
403
  // it — a mirror.sync landing AFTER an undo would otherwise push the
363
404
  // pre-undo snapshot as the local baseline.
364
- const mirrorSettlementTarget = getCurrentRunView?.();
365
- pendingMirrorRefresh = refreshProjectMirrorAfterWriteback(project, applied, saveVerification)
366
- .catch(error => {
367
- appendRunEvent({
368
- title: tx(
369
- `Overleaf was written, but the background workspace refresh failed: ${error.message}. The next run will reread the project.`,
370
- `Overleaf 已写入,但后台刷新本地 workspace 失败:${error.message}。下一轮会重新读取项目。`
371
- ),
372
- status: 'failed'
373
- });
374
- return 'failed';
405
+ const mirrorSettlementTarget = saveTarget;
406
+ pendingMirrorRefresh = refreshProjectMirrorAfterWriteback(project, applied, saveVerification, { target: saveTarget, snapshot: confirmation.snapshot })
407
+ .catch(async error => {
408
+ appendRunRecordEvent(saveTarget.recordId, { kind: 'technical', title: 'Mirror refresh requires a fresh read', status: 'info', detail: { reason: error.message } });
409
+ return invalidateWritebackMirror(saveTarget);
375
410
  })
376
411
  .then(state => {
377
412
  if (typeof onMirrorRefreshSettled !== 'function') return;
@@ -388,7 +423,8 @@
388
423
  const compileSummary = appliedPaths.length
389
424
  ? await autoRecompileAfterWriteback(appliedPaths, saveVerification, {
390
425
  autoRecompile: options.autoRecompile,
391
- mode: runMode
426
+ mode: runMode,
427
+ runProjectId: saveTarget.runProjectId
392
428
  }).catch(error => {
393
429
  appendRunEvent({
394
430
  title: tx(`Post-write compile failed: ${error.message}`, `写后编译出错:${error.message}`),
@@ -435,6 +471,7 @@
435
471
  compileErrors: compileSummary?.status === 'failed' && Array.isArray(compileSummary.errors)
436
472
  ? compileSummary.errors
437
473
  : undefined,
474
+ saveVerification,
438
475
  // Promote the primary per-operation skip failure to the run level when
439
476
  // the writeback failed outright: target-file and write-stage codes only
440
477
  // ever exist inside applied.skipped[], and without this promotion the
@@ -475,57 +512,60 @@
475
512
  };
476
513
  }
477
514
 
478
- async function verifyPostWriteSaveState() {
479
- try {
480
- const result = await callPageBridge('waitForSaveState', {
481
- deadlineMs: 5000,
482
- requirePositiveSignal: true
483
- });
484
- if (result?.state === 'verified_saved') {
485
- return {
486
- ...result,
487
- ok: true,
488
- state: 'verified_saved'
489
- };
490
- }
491
- if (result?.ok === true && !result?.state) {
492
- return {
493
- ...result,
494
- ok: false,
495
- state: 'verified_quiet'
496
- };
497
- }
498
- if (result?.state === 'unknown_timeout' || result?.state === 'unavailable') {
499
- return {
500
- ...result,
501
- ok: false
502
- };
503
- }
504
- return {
505
- ...result,
506
- ok: false,
507
- state: 'unknown_timeout'
508
- };
509
- } catch (error) {
510
- return {
511
- ok: false,
512
- state: 'unavailable',
513
- reason: error.message
514
- };
515
- }
515
+ async function verifyPostWriteSaveState(applied, project, target = {}) {
516
+ return writebackController.confirmPostWriteSave({
517
+ applied, project, runProjectId: target.runProjectId,
518
+ assertCurrent() {
519
+ if (!target.runProjectId || getCurrentProjectId() !== target.runProjectId) {
520
+ throw Object.assign(new Error('The Overleaf project changed during save confirmation.'), { code: 'aborted_project_changed', changedDocument: true });
521
+ }
522
+ if (target.recordId && getCurrentRunView()?.recordId !== target.recordId) {
523
+ throw Object.assign(new Error('The run stopped during save confirmation.'), { code: 'codex_cancelled', changedDocument: true });
524
+ }
525
+ },
526
+ readSaveState: params => callPageBridge('waitForSaveState', { ...params, runProjectId: target.runProjectId }),
527
+ readSnapshot: params => callPageBridge('getProjectSnapshot', { ...params, runProjectId: target.runProjectId })
528
+ });
516
529
  }
517
530
 
518
- function appendPostWriteSaveVerificationWarning(saveVerification = {}) {
519
- if (saveVerification?.state === 'verified_saved') {
520
- return;
531
+ function appendPostWriteSaveVerificationWarning(saveVerification = {}, target = {}) {
532
+ if (saveVerification.state === 'verified_saved') return;
533
+ // Missing confirmation is represented once in the report, with a check action.
534
+ if (saveVerification.signal !== 'offline') return;
535
+ const title = saveVerification.signal === 'offline'
536
+ ? tx('Overleaf is offline. Keep this page open and reconnect so the changes can be saved.',
537
+ 'Overleaf 当前离线。请保持页面开启,恢复连接后等待改动保存。')
538
+ : tx('Saving these changes is not yet confirmed. Keep this page open and check Overleaf’s save and connection status.',
539
+ '尚未确认本次改动已保存。请保持页面开启,检查 Overleaf 的保存和连接状态。');
540
+ if (target.recordId) appendRunRecordEvent(target.recordId, { title, status: 'warning' });
541
+ else appendRunEvent({ title, status: 'warning' });
542
+ }
543
+
544
+ async function invalidateWritebackMirror(target = {}) {
545
+ let invalidated = false;
546
+ try {
547
+ if (target.runProjectId) {
548
+ const response = await sendBackgroundNative({ method: 'mirror.invalidate', params: { projectId: target.runProjectId } });
549
+ invalidated = response?.ok === true && response.result?.invalidated === true;
550
+ }
551
+ } catch (_error) { /* An unavailable host cannot acknowledge invalidation. */ }
552
+ let pageInvalidated = getCurrentProjectId() !== target.runProjectId;
553
+ if (!pageInvalidated) {
554
+ resetContextProject();
555
+ try {
556
+ const response = await callPageBridge('invalidateProjectSnapshot', { invalidateFileList: true, runProjectId: target.runProjectId });
557
+ pageInvalidated = response?.ok === true;
558
+ } catch (_error) { /* Leave the failure visible if both caches cannot be fenced. */ }
521
559
  }
522
- appendRunEvent({
523
- title: tx(
524
- 'Files were written or attempted in Overleaf, but Codex could not verify that Overleaf saved them. Local mirror refresh was skipped.',
525
- '文件已写入或尝试写入 Overleaf,但 Codex 未能确认 Overleaf 已保存;已跳过本地 mirror 刷新。'
526
- ),
560
+ if (invalidated && pageInvalidated) return 'not-attempted';
561
+ const event = {
562
+ title: tx('The local project cache could not be reset. Check the local connection before starting another task.',
563
+ '本地项目缓存未能重置。请检查本地连接后再开始下一轮任务。'),
527
564
  status: 'warning'
528
- });
565
+ };
566
+ if (target.recordId) appendRunRecordEvent(target.recordId, event);
567
+ else appendRunEvent(event);
568
+ return 'failed';
529
569
  }
530
570
 
531
571
  // v1.8.0: text-only writebacks confirm the mirror in place. The written
@@ -537,7 +577,7 @@
537
577
  // method — falls back to the full zip resync below.
538
578
  const MIRROR_CONFIRMABLE_OPERATION_TYPES = new Set(['edit']);
539
579
 
540
- async function tryConfirmMirrorWriteback(applied) {
580
+ async function tryConfirmMirrorWriteback(applied, runProjectId) {
541
581
  const entries = Array.isArray(applied?.applied) ? applied.applied : [];
542
582
  if (!entries.length) {
543
583
  return false;
@@ -554,7 +594,7 @@
554
594
  const response = await sendBackgroundNative({
555
595
  method: 'mirror.confirmWriteback',
556
596
  params: {
557
- projectId: getCurrentProjectId(),
597
+ projectId: runProjectId,
558
598
  paths: Array.from(new Set(paths))
559
599
  }
560
600
  });
@@ -564,15 +604,16 @@
564
604
  }
565
605
  }
566
606
 
567
- async function refreshProjectMirrorAfterWriteback(project = {}, applied = {}, saveVerification = {}) {
607
+ async function refreshProjectMirrorAfterWriteback(project = {}, applied = {}, saveVerification = {}, confirmation = {}) {
608
+ const target = confirmation.target || {};
568
609
  if (saveVerification?.state !== 'verified_saved') {
569
- return 'not-attempted';
610
+ return invalidateWritebackMirror(target);
570
611
  }
571
612
  if (!Array.isArray(applied?.applied) || !applied.applied.length) {
572
613
  return 'not-attempted';
573
614
  }
574
615
 
575
- if (await tryConfirmMirrorWriteback(applied)) {
616
+ if (!confirmation.snapshot && await tryConfirmMirrorWriteback(applied, target.runProjectId)) {
576
617
  appendRunEvent({
577
618
  title: tx(
578
619
  'Local Codex workspace confirmed in place (no project re-download needed). The next run starts from the latest content.',
@@ -588,10 +629,13 @@
588
629
  status: 'running'
589
630
  });
590
631
 
591
- await callPageBridge('invalidateProjectSnapshot', {
632
+ if (!target.runProjectId || getCurrentProjectId() !== target.runProjectId) return invalidateWritebackMirror(target);
633
+ if (!confirmation.snapshot) await callPageBridge('invalidateProjectSnapshot', {
634
+ runProjectId: target.runProjectId,
592
635
  invalidateFileList: true
593
636
  });
594
- const freshProject = sanitizeRunProjectSnapshot(await callPageBridge('getProjectSnapshot', {
637
+ const freshProject = confirmation.snapshot || sanitizeRunProjectSnapshot(await callPageBridge('getProjectSnapshot', {
638
+ runProjectId: target.runProjectId,
595
639
  force: true,
596
640
  maxAgeMs: 0,
597
641
  preferLightweight: true,
@@ -603,23 +647,18 @@
603
647
  zipTimeoutMs: RUN_SNAPSHOT_ZIP_TIMEOUT_MS,
604
648
  focusFiles: getAppliedOperationPaths(applied)
605
649
  }));
606
- if (!freshProject?.files?.length || freshProject?.capabilities?.fullProjectSnapshot === false) {
607
- appendRunEvent({
608
- title: tx(
609
- 'Overleaf was written, but the full project was not read. The local Codex workspace baseline was not refreshed; the next run will reread it.',
610
- 'Overleaf 已写入,但没有读到完整项目;暂不刷新本地 Codex workspace baseline,下一轮会重新读取。'
611
- ),
612
- status: 'failed'
613
- });
614
- return 'failed';
650
+ if (getCurrentProjectId() !== target.runProjectId || freshProject?.id !== target.runProjectId
651
+ || !freshProject?.files?.length || freshProject?.capabilities?.fullProjectSnapshot === false
652
+ || freshProject?.capabilities?.skipped?.length) {
653
+ return invalidateWritebackMirror(target);
615
654
  }
616
655
 
617
- const syncedProject = mergeVerifiedAppliedFiles(freshProject, project, applied);
656
+ const syncedProject = confirmation.snapshot || mergeVerifiedAppliedFiles(freshProject, project, applied);
618
657
  resetContextProject();
619
658
  const response = await sendBackgroundNative({
620
659
  method: 'mirror.sync',
621
660
  params: {
622
- projectId: getCurrentProjectId(),
661
+ projectId: target.runProjectId,
623
662
  project: syncedProject
624
663
  }
625
664
  });
@@ -631,15 +670,7 @@
631
670
  return 'complete';
632
671
  }
633
672
 
634
- const message = response?.error?.message || tx('native host did not respond', 'native host 没有响应');
635
- appendRunEvent({
636
- title: tx(
637
- `Overleaf was written, but refreshing the local workspace failed: ${message}`,
638
- `Overleaf 已写入,但刷新本地 workspace 失败:${message}`
639
- ),
640
- status: 'failed'
641
- });
642
- return 'failed';
673
+ return invalidateWritebackMirror(target);
643
674
  }
644
675
 
645
676
  function mergeVerifiedAppliedFiles(freshProject = {}, originalProject = {}, applied = {}) {
@@ -660,6 +691,8 @@
660
691
  return writebackController.formatUnsupportedLocalChangeSummary(changes, getLocale());
661
692
  }
662
693
 
694
+ const serverProvenSave = verification => ['overleaf-zip', 'server-receipts'].includes(verification?.source);
695
+
663
696
  async function autoRecompileAfterWriteback(writtenPaths = [], saveVerification = {}, options = {}) {
664
697
  if (options.autoRecompile === false
665
698
  || (options.autoRecompile === undefined && getState().autoRecompile === false)) return null;
@@ -671,7 +704,10 @@
671
704
  const hasCompilableFile = writtenPaths.some(filePath => CompileAdapter.isCompilableFile(filePath));
672
705
  if (!hasCompilableFile) return null;
673
706
 
707
+ const compileActivityId = 'overleaf-compile:' + Date.now().toString(36);
708
+ const activity = (state, output = '') => ({ v: 1, kind: 'compile', id: compileActivityId, state, target: 'Overleaf', output });
674
709
  appendRunEvent({
710
+ activity: activity('running'),
675
711
  title: saveVerification?.state !== 'verified_saved'
676
712
  ? tx(
677
713
  'Post-write compile: Overleaf save was not verified, but Auto Compile is on. Triggering Overleaf Recompile and letting Overleaf wait for the latest save.',
@@ -687,9 +723,10 @@
687
723
  try {
688
724
  const result = await callPageBridge('triggerCompile', {
689
725
  preferUiClick: true,
690
- waitForSaveMs: 5000,
691
- requireVerifiedSave: saveVerification?.state === 'verified_saved',
692
- runProjectId: getCurrentRunView()?.runProjectId || getCurrentProjectId()
726
+ // Server-side proof (ZIP or save receipts) already settles the save; don't also demand the UI indicator.
727
+ waitForSaveMs: serverProvenSave(saveVerification) ? 0 : 5000,
728
+ requireVerifiedSave: saveVerification?.state === 'verified_saved' && !serverProvenSave(saveVerification),
729
+ runProjectId: options.runProjectId || getCurrentRunView()?.runProjectId || getCurrentProjectId()
693
730
  });
694
731
  if (result?.ok) {
695
732
  let logResult = null;
@@ -698,64 +735,34 @@
698
735
  triggerIfStale: false,
699
736
  maxAgeMs: 30000,
700
737
  waitForSaveMs: 0,
701
- runProjectId: getCurrentRunView()?.runProjectId || getCurrentProjectId()
738
+ runProjectId: options.runProjectId || getCurrentRunView()?.runProjectId || getCurrentProjectId()
702
739
  });
703
740
  } catch (_error) {
704
741
  logResult = null;
705
742
  }
706
743
  const compile = result.compile;
707
744
  if (compile?.status === 'success') {
708
- appendRunEvent({ title: tx('Compile succeeded.', '编译成功。'), status: 'completed' });
745
+ appendRunEvent({ title: tx('Compile succeeded.', '编译成功。'), status: 'completed',
746
+ activity: activity('completed', [...(logResult?.errors || []), ...(logResult?.warnings || [])].slice(0, 5).map(CompileAdapter.formatCompileDiagnosticForSummary).join('\n')) });
709
747
  } else if (compile?.status === 'triggered') {
710
- appendRunEvent({ title: tx('Overleaf compile was triggered. The page will continue showing progress.', '已触发 Overleaf 编译;页面会继续显示编译进度。'), status: 'completed' });
748
+ appendRunEvent({ title: tx('Overleaf compile was triggered. The page will continue showing progress.', '已触发 Overleaf 编译;页面会继续显示编译进度。'), status: 'completed', activity: activity('triggered') });
711
749
  } else {
712
- appendRunEvent({ title: tx(`Compile finished with status: ${compile?.status || 'unknown'}`, `编译完成,状态:${compile?.status || '未知'}`), status: 'completed' });
750
+ appendRunEvent({ title: tx(`Compile finished with status: ${compile?.status || 'unknown'}`, `编译完成,状态:${compile?.status || '未知'}`), status: 'completed', activity: activity(compile?.status === 'failed' ? 'failed' : 'unknown') });
713
751
  }
714
752
  return buildPostWriteCompileSummary({ result, logResult });
715
753
  } else {
716
754
  const reason = result?.reason || tx('unknown reason', '未知原因');
717
- appendRunEvent({ title: tx(`Post-write compile did not succeed: ${reason}`, `写后编译未成功:${reason}`), status: 'failed' });
755
+ appendRunEvent({ title: tx(`Post-write compile did not succeed: ${reason}`, `写后编译未成功:${reason}`), status: 'failed', activity: activity('failed', reason) });
718
756
  return buildPostWriteCompileSummary({ result });
719
757
  }
720
758
  } catch (error) {
721
- appendRunEvent({ title: tx(`Post-write compile failed: ${error.message}`, `写后编译出错:${error.message}`), status: 'failed' });
759
+ appendRunEvent({ title: tx(`Post-write compile failed: ${error.message}`, `写后编译出错:${error.message}`), status: 'failed', activity: activity('failed', error.message) });
722
760
  return buildPostWriteCompileSummary({ error });
723
761
  }
724
762
  }
725
763
 
726
- function buildPostWriteCompileSummary({ result = null, logResult = null, error = null } = {}) {
727
- const logAvailable = logResult?.ok === true;
728
- const errors = logAvailable && Array.isArray(logResult.errors)
729
- ? logResult.errors.slice(0, 5).map(formatCompileDiagnosticForSummary)
730
- : [];
731
- const warnings = logAvailable && Array.isArray(logResult.warnings)
732
- ? logResult.warnings.slice(0, 5).map(formatCompileDiagnosticForSummary)
733
- : [];
734
- if (error) {
735
- return {
736
- status: 'failed',
737
- reason: error?.message || 'Post-write compile failed.',
738
- errors,
739
- warnings,
740
- logAvailable
741
- };
742
- }
743
- if (!result?.ok) {
744
- return {
745
- status: 'failed',
746
- reason: result?.reason || 'Post-write compile did not succeed.',
747
- errors,
748
- warnings,
749
- logAvailable
750
- };
751
- }
752
- return {
753
- status: result.compile?.status || 'triggered',
754
- reason: result.reason || '',
755
- errors,
756
- warnings,
757
- logAvailable
758
- };
764
+ function buildPostWriteCompileSummary(input = {}) {
765
+ return compileAdapter.buildPostWriteCompileSummary(input);
759
766
  }
760
767
 
761
768
  // First structured per-operation failure among the skipped writeback
@@ -813,10 +820,6 @@
813
820
  return [conclusion, '', summary].filter(Boolean).join('\n');
814
821
  }
815
822
 
816
- function formatCompileDiagnosticForSummary(value) {
817
- const text = String(value || '').replace(/\s+/g, ' ').trim();
818
- return text.length > 180 ? `${text.slice(0, 179)}...` : text;
819
- }
820
823
 
821
824
  async function resolveCompileLogContext() {
822
825
  try {
@@ -891,6 +894,8 @@
891
894
  getCurrentRunView,
892
895
  } = deps);
893
896
  assetTransferBroker = deps.assetTransferBroker;
897
+ stageWritebackRecovery = deps.stageWritebackRecovery;
898
+ settleWritebackRecovery = deps.settleWritebackRecovery;
894
899
  onMirrorRefreshSettled = deps.onMirrorRefreshSettled;
895
900
  writebackSettlement = deps.writebackSettlement;
896
901
  compileAdapter = deps.compileAdapter;