codex-overleaf-link 2.5.1 → 2.6.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 (93) hide show
  1. package/README.md +149 -398
  2. package/README.zh-CN.md +153 -404
  3. package/extension/bootstrap/manifest.template.json +1 -1
  4. package/extension/src/background.js +78 -3
  5. package/extension/src/backgroundSharedSessions.js +55 -2
  6. package/extension/src/backgroundUpdateCoordinator.js +128 -12
  7. package/extension/src/content/activeTurnControl.js +164 -7
  8. package/extension/src/content/composerAttachments.js +11 -2
  9. package/extension/src/content/composerPanel.js +92 -12
  10. package/extension/src/content/contentRuntime.js +920 -276
  11. package/extension/src/content/contextTray.js +8 -2
  12. package/extension/src/content/contextUsageView.js +267 -0
  13. package/extension/src/content/diagnosticsPanel.js +18 -0
  14. package/extension/src/content/generated/content.bundle.js +4496 -924
  15. package/extension/src/content/generated/content.bundle.meta.json +6 -3
  16. package/extension/src/content/legacyGlobalRegistry.js +4 -0
  17. package/extension/src/content/localSkillsPanel.js +2 -2
  18. package/extension/src/content/markdownDomRenderer.js +5 -3
  19. package/extension/src/content/markdownText.js +42 -5
  20. package/extension/src/content/modelPicker.js +1 -0
  21. package/extension/src/content/nativeCompatibilityController.js +29 -10
  22. package/extension/src/content/otWarmMirror.js +1 -1
  23. package/extension/src/content/pageBridgeClient.js +2 -2
  24. package/extension/src/content/panelMaintenance.js +6 -2
  25. package/extension/src/content/panelRenderer.js +51 -27
  26. package/extension/src/content/pendingInputView.js +1 -1
  27. package/extension/src/content/projectSettingsCoordinator.js +30 -6
  28. package/extension/src/content/providerSettingsDialog.js +2 -1
  29. package/extension/src/content/recentProjects.js +4 -3
  30. package/extension/src/content/runActivitySummary.js +122 -14
  31. package/extension/src/content/runCompletionMeta.js +194 -6
  32. package/extension/src/content/runController.js +2 -1
  33. package/extension/src/content/runFailureNotice.js +8 -1
  34. package/extension/src/content/runPresence.js +18 -8
  35. package/extension/src/content/runQueueScheduler.js +9 -5
  36. package/extension/src/content/runRecoveryActions.js +2 -1
  37. package/extension/src/content/runResultActions.js +22 -20
  38. package/extension/src/content/runReviewController.js +94 -35
  39. package/extension/src/content/runTimelineView.js +224 -25
  40. package/extension/src/content/scopedPersistencePanelState.js +92 -23
  41. package/extension/src/content/sensitivePreflight.js +14 -1
  42. package/extension/src/content/sessionManager.js +49 -3
  43. package/extension/src/content/sessionMenuView.js +54 -18
  44. package/extension/src/content/sessionPersistence.js +25 -5
  45. package/extension/src/content/settingsPanel.js +15 -2
  46. package/extension/src/content/settingsWorkbench.js +127 -89
  47. package/extension/src/content/sharedSessionViewSync.js +4 -3
  48. package/extension/src/content/subagentActivityView.js +23 -7
  49. package/extension/src/content/updateNotice.js +60 -6
  50. package/extension/src/content/writebackOrchestrator.js +35 -22
  51. package/extension/src/page/compileBridge.js +193 -180
  52. package/extension/src/page/overleafCapabilities.js +4 -1
  53. package/extension/src/page/textCoordinates.js +17 -1
  54. package/extension/src/page/textFileCreator.js +9 -1
  55. package/extension/src/page/writebackRouter.js +24 -77
  56. package/extension/src/pageBridge.js +107 -66
  57. package/extension/src/popup.js +1 -1
  58. package/extension/src/shared/agentTranscript.js +350 -17
  59. package/extension/src/shared/auditRecords.js +2 -0
  60. package/extension/src/shared/compatibility.js +1 -1
  61. package/extension/src/shared/compileAdapter.js +58 -17
  62. package/extension/src/shared/composerAttachmentDraft.js +6 -1
  63. package/extension/src/shared/contextUsage.js +125 -0
  64. package/extension/src/shared/failureReasons.js +42 -3
  65. package/extension/src/shared/i18n.js +299 -29
  66. package/extension/src/shared/lineReferences.js +38 -31
  67. package/extension/src/shared/pageRpcContract.js +1 -1
  68. package/extension/src/shared/panelIcons.js +39 -0
  69. package/extension/src/shared/reviewing.js +130 -1
  70. package/extension/src/shared/runActivityModel.js +70 -4
  71. package/extension/src/shared/runExecutionSnapshot.js +13 -0
  72. package/extension/src/shared/sessionState.js +63 -4
  73. package/extension/src/shared/sessionTitle.js +14 -1
  74. package/extension/src/shared/sharedSessionBridge.js +81 -13
  75. package/extension/src/shared/staleGuard.js +72 -63
  76. package/extension/src/shared/storageDb.js +35 -3
  77. package/extension/src/shared/storageMigration.js +7 -1
  78. package/extension/src/shared/storageRunActions.js +62 -8
  79. package/extension/src/shared/undoOperations.js +126 -28
  80. package/extension/src/shared/updateRuntimeIdentity.js +16 -2
  81. package/extension/src/shared/writebackSettlement.js +21 -3
  82. package/extension/styles/panel.css +1106 -490
  83. package/native-host/src/bootstrapUpdate.js +52 -16
  84. package/native-host/src/chatBridgeRequest.js +60 -6
  85. package/native-host/src/chatBridgeResponse.js +10 -1
  86. package/native-host/src/chatCompletionsBridge.js +29 -2
  87. package/native-host/src/codexPromptAssembly.js +86 -118
  88. package/native-host/src/codexSessionRunner.js +126 -17
  89. package/native-host/src/providerContextError.js +20 -0
  90. package/native-host/src/taskRunnerRuntime.js +18 -6
  91. package/native-host/src/textPatch.js +473 -377
  92. package/native-host/src/updateManager.js +120 -15
  93. package/package.json +5 -8
@@ -130,7 +130,7 @@
130
130
  const skipped = withheldOnly.map(buildWithheldEntry);
131
131
  const hasSelectionViolation = withheldOnly.some(change => change.reason === 'selection_scope_violation');
132
132
  const applied = { ok: false, applied: [], skipped };
133
- appendCompletionReport({ conclusion: assistantMessage || tx('Some generated changes were blocked.', '部分生成的改动已被阻止。'),
133
+ appendCompletionReport({ conclusionKey: options.assistantMessageKey || (!assistantMessage ? 'withheld_changes' : undefined), conclusion: assistantMessage || tx('Some generated changes were blocked.', '部分生成的改动已被阻止。'),
134
134
  status: 'failed', operations: [], applyResults: [applied], mode: runMode,
135
135
  nextStep: hasSelectionViolation
136
136
  ? selectionViolationNextStep()
@@ -151,7 +151,7 @@
151
151
  ),
152
152
  status: 'warning'
153
153
  });
154
- appendCompletionReport({
154
+ appendCompletionReport({ conclusionKey: options.assistantMessageKey || (!assistantMessage ? 'ask_ignored_changes' : undefined),
155
155
  conclusion: assistantMessage || tx(
156
156
  'Codex finished in Ask mode. Any local file changes were ignored and were not synced to Overleaf.',
157
157
  'Codex 已在 Ask 模式完成;本地文件改动已忽略,未同步到 Overleaf。'
@@ -228,8 +228,15 @@
228
228
  title: tx('Codex did not produce file changes that need to sync back to Overleaf.', 'Codex 没有产生需要同步回 Overleaf 的文件改动。'),
229
229
  status: 'completed'
230
230
  });
231
- appendCompletionReport({
232
- conclusion: assistantMessage || tx('Codex finished locally. There are no changes to sync back to Overleaf.', 'Codex 已完成本地处理,没有需要同步回 Overleaf 的改动。'),
231
+ const blockedConclusion = assistantMessage
232
+ ? `${assistantMessage}\n\n${tx('Sync note: no changes were written to Overleaf; every change was blocked before writing.', '同步提示:没有向 Overleaf 写入任何改动;所有改动都在写入前被拦下。')}`
233
+ : tx('No changes were written to Overleaf; every change was blocked before writing.', '没有向 Overleaf 写入任何改动;所有改动都在写入前被拦下。');
234
+ appendCompletionReport({ conclusionKey: additionalSkippedEntries.length ? undefined
235
+ : options.assistantMessageKey || (!assistantMessage ? 'no_sync_changes' : undefined),
236
+ conclusion: additionalSkippedEntries.length ? blockedConclusion
237
+ : assistantMessage || tx('Codex finished locally. There are no changes to sync back to Overleaf.', 'Codex 已完成本地处理,没有需要同步回 Overleaf 的改动。'),
238
+ conclusionSource: additionalSkippedEntries.length ? { origin: 'product', key: 'writeback',
239
+ outcome: 'blocked_sync', prefixLength: assistantMessage.length } : undefined,
233
240
  status: additionalSkippedEntries.length ? 'failed' : runMode === 'ask' ? tr('modeAsk') : 'completed',
234
241
  failure: blockedFailure,
235
242
  operations: [],
@@ -295,7 +302,7 @@
295
302
  title: tx('No approved file changes remain to sync back to Overleaf.', '没有剩余已确认的文件改动需要同步回 Overleaf。'),
296
303
  status: 'completed'
297
304
  });
298
- appendCompletionReport({
305
+ appendCompletionReport({ conclusionKey: options.assistantMessageKey || (!assistantMessage ? 'no_approved_changes' : undefined),
299
306
  conclusion: assistantMessage || tx('No approved changes were written back to Overleaf.', '没有已确认的改动写回 Overleaf。'),
300
307
  status: additionalSkippedEntries.length ? 'failed' : runMode === 'ask' ? tr('modeAsk') : 'completed',
301
308
  failure: approvalFailure,
@@ -326,8 +333,8 @@
326
333
  if (!reviewing.ok) {
327
334
  const blocked = buildReviewingBlockedApplyResult(operations, reviewing);
328
335
  appendApplyResult(blocked);
329
- appendCompletionReport({
330
- conclusion: tx(
336
+ appendCompletionReport({ conclusionKey: 'reviewing_unavailable',
337
+ conclusion: reviewing.code === 'reviewing_unavailable' ? tr('failureReason_reviewing_unavailable_user') : tx(
331
338
  'No files were written: Track is enabled, but Codex could not verify Overleaf Reviewing/Track Changes.',
332
339
  '这轮没有写入:已开启“留痕”要求,但 Codex 没能确认 Overleaf 正在用 Reviewing/Track Changes。'
333
340
  ),
@@ -335,7 +342,7 @@
335
342
  operations,
336
343
  applyResults: [blocked],
337
344
  mode: runMode,
338
- nextStep: tx(
345
+ nextStep: reviewing.code === 'reviewing_unavailable' ? tr('failureReason_reviewing_unavailable_next') : tx(
339
346
  'Switch Overleaf to Reviewing/Track Changes manually and rerun, or turn off Track before writing.',
340
347
  '请在 Overleaf 手动切到 Reviewing/Track Changes 后重新运行,或关闭“留痕”再写入。'
341
348
  )
@@ -415,7 +422,7 @@
415
422
  ? await verifyPostWriteSaveState(applied, project, saveTarget)
416
423
  : { verification: { ok: false, state: 'not_checked', reason: 'No applied writeback operations were returned.' } };
417
424
  const saveVerification = confirmation.verification;
418
- await settleWritebackRecovery?.(applied, project, saveVerification, saveTarget);
425
+ await settleWritebackRecovery?.(applied, project, saveVerification, saveTarget, runRequireReviewing);
419
426
  if (appliedPaths.length) {
420
427
  appendPostWriteSaveVerificationWarning(saveVerification, saveTarget);
421
428
  appendRunEvent({ kind: 'technical', title: 'Post-write save confirmation', status: 'info', detail: saveVerification });
@@ -453,7 +460,7 @@
453
460
  title: tx(`Post-write compile failed: ${error.message}`, `写后编译出错:${error.message}`),
454
461
  status: 'failed'
455
462
  });
456
- return buildPostWriteCompileSummary({ error });
463
+ return compileAdapter.buildPostWriteCompileSummary({ error });
457
464
  })
458
465
  : null;
459
466
  const hasSkippedApplyResult = skippedEntries.length > 0;
@@ -485,6 +492,10 @@
485
492
  : tx('Review the synced file in Overleaf.', '请在 Overleaf 中查看同步后的文件。');
486
493
  appendCompletionReport({
487
494
  conclusion: appendCompileSummaryToConclusion(writebackConclusion, compileSummary),
495
+ conclusionSource: { origin: 'product', key: 'writeback',
496
+ outcome: !hasConfirmedApplyResult ? 'unconfirmed_sync' : hasSkippedApplyResult ? 'partial_sync' : 'synced',
497
+ prefixLength: assistantMessage.length, prefixKey: options.assistantMessageKey, hasCompile: Boolean(compileSummary), compileStatus: compileSummary?.status || '',
498
+ compileReason: compileAdapter.localizeCompileReason(compileSummary?.reason || '', getLocale()), errors: compileSummary?.errors?.slice(0, 3) || [], errorCount: compileSummary?.errors?.length || 0, warningCount: compileSummary?.warnings?.length || 0 },
488
499
  status: writebackIncomplete ? 'failed' : 'completed',
489
500
  operations,
490
501
  applyResults: [applied],
@@ -747,40 +758,40 @@
747
758
  let logResult = null;
748
759
  try {
749
760
  logResult = await callPageBridge('getCompileLog', {
761
+ captureId: result.compile?.captureId,
750
762
  triggerIfStale: false,
751
763
  maxAgeMs: 30000,
752
764
  waitForSaveMs: 0,
753
765
  runProjectId: options.runProjectId || getCurrentRunView()?.runProjectId || getCurrentProjectId()
754
766
  });
755
- } catch (_error) {
756
- logResult = null;
767
+ } catch (error) {
768
+ logResult = { ok: false, reason: error.message || 'compile_log_fetch_failed' };
757
769
  }
758
- const compile = result.compile;
770
+ const compile = compileAdapter.buildPostWriteCompileSummary({ result, logResult });
771
+ compile.errors = compile.errors.map(value => CompileAdapter.localizeCompileReason(value, getLocale()));
759
772
  if (compile?.status === 'success') {
760
773
  appendRunEvent({ title: tx('Compile succeeded.', '编译成功。'), status: 'completed',
761
774
  activity: activity('completed', [...(logResult?.errors || []), ...(logResult?.warnings || [])].slice(0, 5).map(CompileAdapter.formatCompileDiagnosticForSummary).join('\n')) });
762
775
  } else if (compile?.status === 'triggered') {
763
- appendRunEvent({ title: tx('Overleaf compile was triggered. The page will continue showing progress.', '已触发 Overleaf 编译;页面会继续显示编译进度。'), status: 'completed', activity: activity('triggered') });
776
+ appendRunEvent({ title: tx('Overleaf compile was triggered. The page will continue showing progress.', '已触发 Overleaf 编译;页面会继续显示编译进度。'), status: 'completed', activity: activity('triggered', compile.reason) });
764
777
  } else {
765
- appendRunEvent({ title: tx(`Compile finished with status: ${compile?.status || 'unknown'}`, `编译完成,状态:${compile?.status || '未知'}`), status: 'completed', activity: activity(compile?.status === 'failed' ? 'failed' : 'unknown') });
778
+ appendRunEvent({ title: compile.status === 'unconfirmed' ? tr('runCompileUnconfirmed')
779
+ : tx(`Compile finished with status: ${compile.status}`, `编译完成,状态:${compile.status}`),
780
+ status: 'completed', activity: activity(compile.status === 'failed' ? 'failed' : 'unknown', compile.errors.join('\n') || compile.reason) });
766
781
  }
767
- return buildPostWriteCompileSummary({ result, logResult });
782
+ return compile;
768
783
  } else {
769
784
  const reason = CompileAdapter.localizeCompileReason(result?.reason, getLocale()) || tx('unknown reason', '未知原因');
770
785
  appendRunEvent({ title: tx(`Post-write compile did not succeed: ${reason}`, `写后编译未成功:${reason}`), status: 'failed', activity: activity('failed', reason) });
771
- return buildPostWriteCompileSummary({ result });
786
+ return compileAdapter.buildPostWriteCompileSummary({ result });
772
787
  }
773
788
  } catch (error) {
774
789
  const reason = CompileAdapter.localizeCompileReason(error.message, getLocale());
775
790
  appendRunEvent({ title: tx(`Post-write compile failed: ${reason}`, `写后编译出错:${reason}`), status: 'failed', activity: activity('failed', reason) });
776
- return buildPostWriteCompileSummary({ error });
791
+ return compileAdapter.buildPostWriteCompileSummary({ error });
777
792
  }
778
793
  }
779
794
 
780
- function buildPostWriteCompileSummary(input = {}) {
781
- return compileAdapter.buildPostWriteCompileSummary(input);
782
- }
783
-
784
795
  // Use the same normalized failure selection as settlement and its UI, while
785
796
  // preserving the selected producer's full evidence on the historical report.
786
797
  function promoteWritebackSkippedFailure(applied) {
@@ -814,6 +825,8 @@
814
825
  `已触发写后编译;最新日志显示 ${warnings.length} 个警告。`
815
826
  )
816
827
  : tx('Post-write compile was triggered; Overleaf may still be updating the result.', '已触发写后编译;Overleaf 可能仍在更新结果。');
828
+ } else if (compileSummary.status === 'unconfirmed') {
829
+ summary = tr('runCompileUnconfirmed');
817
830
  } else if (compileSummary.status === 'failed') {
818
831
  const reason = compileAdapter.localizeCompileReason(compileSummary.reason, getLocale());
819
832
  summary = tx(