codex-overleaf-link 2.4.1 → 2.5.1
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.
- package/README.md +275 -305
- package/README.zh-CN.md +290 -320
- package/extension/bootstrap/background.js +99 -19
- package/extension/bootstrap/manifest.template.json +9 -4
- package/extension/bootstrap/popup.html +11 -16
- package/extension/bootstrap/popupFallback.js +55 -0
- package/extension/bootstrap/update.js +25 -2
- package/extension/bootstrap/updateStatus.js +1 -0
- package/extension/runtime-manifest.json +3 -1
- package/extension/src/background.js +234 -56
- package/extension/src/backgroundBootstrapMigration.js +181 -0
- package/extension/src/backgroundSharedSessions.js +440 -0
- package/extension/src/backgroundUpdateCoordinator.js +541 -381
- package/extension/src/backgroundUpdateSafety.js +173 -0
- package/extension/src/content/activeTurnControl.js +16 -2
- package/extension/src/content/applyResultFormatters.js +46 -73
- package/extension/src/content/assetTransferBroker.js +244 -12
- package/extension/src/content/changeHistoryView.js +175 -0
- package/extension/src/content/composerAttachments.js +117 -67
- package/extension/src/content/composerPanel.js +41 -8
- package/extension/src/content/contentRuntime.js +1084 -1099
- package/extension/src/content/diagnosticsController.js +122 -97
- package/extension/src/content/diagnosticsExport.js +236 -0
- package/extension/src/content/diagnosticsPanel.js +78 -19
- package/extension/src/content/diffReviewPanel.js +8 -5
- package/extension/src/content/directoryCleanupRecovery.js +54 -0
- package/extension/src/content/generated/content.bundle.js +14680 -3606
- package/extension/src/content/generated/content.bundle.meta.json +30 -3
- package/extension/src/content/globalPreferencesController.js +1 -1
- package/extension/src/content/legacyGlobalRegistry.js +25 -1
- package/extension/src/content/localSkillsPanel.js +141 -16
- package/extension/src/content/markdownDomRenderer.js +9 -4
- package/extension/src/content/markdownText.js +5 -6
- package/extension/src/content/modelPicker.js +8 -5
- package/extension/src/content/nativeCompatibilityController.js +45 -20
- package/extension/src/content/otWarmMirror.js +4 -5
- package/extension/src/content/otWarmMirrorController.js +17 -20
- package/extension/src/content/pageBridgeClient.js +33 -5
- package/extension/src/content/panelMaintenance.js +87 -132
- package/extension/src/content/panelRenderer.js +10 -0
- package/extension/src/content/pendingInputView.js +109 -76
- package/extension/src/content/projectProviderSelection.js +13 -4
- package/extension/src/content/projectSessionCleanup.js +109 -62
- package/extension/src/content/projectSettingsCoordinator.js +39 -2
- package/extension/src/content/providerSettingsCoordinator.js +63 -14
- package/extension/src/content/providerSettingsDialog.js +724 -113
- package/extension/src/content/recentProjects.js +21 -6
- package/extension/src/content/runActivitySummary.js +665 -0
- package/extension/src/content/runCompletionMeta.js +344 -0
- package/extension/src/content/runController.js +40 -15
- package/extension/src/content/runFailureNotice.js +34 -12
- package/extension/src/content/runGuidanceController.js +76 -30
- package/extension/src/content/runGuidanceView.js +59 -10
- package/extension/src/content/runPresence.js +306 -0
- package/extension/src/content/runQueueScheduler.js +150 -43
- package/extension/src/content/runRecoveryActions.js +146 -0
- package/extension/src/content/runResultActions.js +11 -8
- package/extension/src/content/runReviewController.js +574 -0
- package/extension/src/content/runScrollLayout.js +21 -2
- package/extension/src/content/runTimelineView.js +315 -290
- package/extension/src/content/scopedPersistencePanelState.js +51 -6
- package/extension/src/content/selectionContextView.js +300 -0
- package/extension/src/content/sensitivePreflight.js +140 -0
- package/extension/src/content/sessionForkController.js +80 -17
- package/extension/src/content/sessionManager.js +1 -1
- package/extension/src/content/sessionPersistence.js +6 -1
- package/extension/src/content/settingsPanel.js +84 -55
- package/extension/src/content/settingsWorkbench.js +379 -0
- package/extension/src/content/sharedSessionViewSync.js +109 -0
- package/extension/src/content/subagentActivityView.js +195 -0
- package/extension/src/content/trackedChangeCaptureController.js +7 -3
- package/extension/src/content/updateIdle.js +4 -1
- package/extension/src/content/updateNotice.js +179 -56
- package/extension/src/content/updateSafetyReceiver.js +58 -0
- package/extension/src/content/writebackController.js +308 -2
- package/extension/src/content/writebackOrchestrator.js +213 -199
- package/extension/src/content/writebackPlan.js +231 -0
- package/extension/src/content/writebackRecovery.js +122 -0
- package/extension/src/content/writingStyleSettings.js +600 -0
- package/extension/src/content/writtenChangesView.js +152 -0
- package/extension/src/page/binaryAssetUploader.js +223 -23
- package/extension/src/page/fileMover.js +256 -0
- package/extension/src/page/overleafProjectSnapshot.js +1 -0
- package/extension/src/page/ownedDirectoryCleanup.js +94 -0
- package/extension/src/page/referenceProjects.js +149 -0
- package/extension/src/page/reviewContext.js +113 -0
- package/extension/src/page/saveState.js +20 -6
- package/extension/src/page/snapshotRouter.js +124 -48
- package/extension/src/page/textCoordinates.js +102 -0
- package/extension/src/page/textFileCreator.js +442 -71
- package/extension/src/page/trackedChangeCapture.js +53 -57
- package/extension/src/page/trackedChangeOwnership.js +216 -0
- package/extension/src/page/trackedChangeReplay.js +184 -0
- package/extension/src/page/trackedChangesLifecycle.js +343 -339
- package/extension/src/page/treeOperations.js +33 -12
- package/extension/src/page/updateSafetyProbe.js +41 -0
- package/extension/src/page/writebackReceiptJournal.js +114 -0
- package/extension/src/page/writebackRouter.js +242 -201
- package/extension/src/pageBridge.js +73 -102
- package/extension/src/popup.js +261 -65
- package/extension/src/shared/agentTranscript.js +41 -4
- package/extension/src/shared/auditRecords.js +73 -0
- package/extension/src/shared/changeHistoryModel.js +94 -0
- package/extension/src/shared/compatibility.js +22 -6
- package/extension/src/shared/compileAdapter.js +101 -37
- package/extension/src/shared/composerAttachmentDraft.js +151 -0
- package/extension/src/shared/directoryCleanupProof.js +43 -0
- package/extension/src/shared/failureReasons.js +329 -3
- package/extension/src/shared/globalPreferences.js +31 -14
- package/extension/src/shared/governanceRules.js +4 -37
- package/extension/src/shared/i18n.js +389 -25
- package/extension/src/shared/managedUpdateProjection.js +8 -5
- package/extension/src/shared/nativeRequestIdentity.js +1 -0
- package/extension/src/shared/pageRpcContract.js +9 -2
- package/extension/src/shared/projectFiles.js +21 -44
- package/extension/src/shared/providerProfiles.js +114 -3
- package/extension/src/shared/runActivityModel.js +361 -0
- package/extension/src/shared/runExecutionSnapshot.js +8 -2
- package/extension/src/shared/runExecutionSnapshotCodec.js +16 -4
- package/extension/src/shared/runInputQueue.js +48 -5
- package/extension/src/shared/scopedPersistenceBrowserAdapter.js +6 -3
- package/extension/src/shared/selectionContext.js +37 -0
- package/extension/src/shared/sessionState.js +166 -30
- package/extension/src/shared/settlementFacts.js +10 -2
- package/extension/src/shared/sharedSessionBridge.js +311 -0
- package/extension/src/shared/sharedSessionTransfer.js +140 -0
- package/extension/src/shared/staleGuard.js +118 -13
- package/extension/src/shared/storageDb.js +77 -78
- package/extension/src/shared/storageMigration.js +74 -111
- package/extension/src/shared/storageRunActions.js +211 -22
- package/extension/src/shared/storageValuePruning.js +40 -0
- package/extension/src/shared/subagentActivityModel.js +174 -0
- package/extension/src/shared/undoOperations.js +216 -6
- package/extension/src/shared/updateConsent.js +42 -11
- package/extension/src/shared/updateRuntimeIdentity.js +1 -1
- package/extension/src/shared/writebackIntent.js +78 -0
- package/extension/src/shared/writebackOperationEvidence.js +4 -15
- package/extension/src/shared/writebackSettlement.js +67 -48
- package/extension/src/shared/writingStyle.js +33 -0
- package/extension/styles/panel.css +1987 -385
- package/extension/styles/popup.css +110 -0
- package/native-host/src/anthropicBridgeRequest.js +6 -3
- package/native-host/src/anthropicBridgeResponse.js +6 -2
- package/native-host/src/anthropicMessagesBridge.js +24 -16
- package/native-host/src/bootstrapMigration.js +296 -0
- package/native-host/src/bootstrapMigrationContract.js +101 -0
- package/native-host/src/bootstrapUpdate.js +233 -0
- package/native-host/src/bootstrapUpdateWatchdog.js +44 -0
- package/native-host/src/chatBridgeResponse.js +10 -0
- package/native-host/src/chatCompletionsBridge.js +21 -15
- package/native-host/src/codexConfigPaths.js +106 -0
- package/native-host/src/codexHome.js +66 -73
- package/native-host/src/codexHomeScope.js +124 -0
- package/native-host/src/codexInheritedAuth.js +90 -0
- package/native-host/src/codexLocalSkills.js +301 -0
- package/native-host/src/codexModelRecovery.js +107 -0
- package/native-host/src/codexPromptAssembly.js +33 -12
- package/native-host/src/codexProviderLaunch.js +3 -3
- package/native-host/src/codexProviderTest.js +24 -26
- package/native-host/src/codexRuntimeIdentity.js +1 -0
- package/native-host/src/codexSessionRunner.js +211 -318
- package/native-host/src/codexSessionTiming.js +21 -8
- package/native-host/src/codexSkillIsolation.js +170 -0
- package/native-host/src/codexThreadFork.js +19 -3
- package/native-host/src/index.js +19 -7
- package/native-host/src/managedInstall.js +115 -39
- package/native-host/src/managedInstallRecovery.js +140 -0
- package/native-host/src/managedRuntimeEvidence.js +57 -0
- package/native-host/src/mirrorWorkspace.js +92 -22
- package/native-host/src/nativeDoctor.js +15 -0
- package/native-host/src/nativeEnvironment.js +70 -0
- package/native-host/src/nativeHelperLifecycle.js +21 -0
- package/native-host/src/nativeHostRegistration.js +33 -0
- package/native-host/src/nativeQuotas.js +15 -8
- package/native-host/src/nativeRunLifecycle.js +71 -0
- package/native-host/src/overleafWorkspaceRules.js +16 -0
- package/native-host/src/processStopBarrier.js +115 -0
- package/native-host/src/projectPathPlatform.js +30 -0
- package/native-host/src/providerHttp.js +80 -0
- package/native-host/src/providerModelCatalog.js +4 -3
- package/native-host/src/providerProfile.js +17 -3
- package/native-host/src/providerReasoning.js +10 -11
- package/native-host/src/providerRuntime.js +1 -0
- package/native-host/src/providerStore.js +76 -14
- package/native-host/src/releaseTransport.js +14 -5
- package/native-host/src/responsesPassthroughBridge.js +266 -52
- package/native-host/src/runtimeInstaller.js +21 -1
- package/native-host/src/selectionScope.js +86 -0
- package/native-host/src/skills/parallel-subagents/SKILL.md +31 -3
- package/native-host/src/skills/writing-style-builder/SKILL.md +146 -0
- package/native-host/src/subagentAdmission.js +26 -0
- package/native-host/src/subagentBroker.js +176 -159
- package/native-host/src/subagentTelemetry.js +325 -0
- package/native-host/src/subagentWorkspace.js +103 -0
- package/native-host/src/subagentWorkspacePath.js +34 -0
- package/native-host/src/taskRunnerRuntime.js +130 -57
- package/native-host/src/tomlStatements.js +140 -0
- package/native-host/src/turnAttachments.js +113 -0
- package/native-host/src/updateManager.js +406 -38
- package/native-host/src/updateNetworkControl.js +75 -0
- package/native-host/src/updateTrust.js +21 -2
- package/native-host/src/vendor/pdfjs/LICENSE +177 -0
- package/native-host/src/vendor/pdfjs/SOURCE.txt +3 -0
- package/native-host/src/vendor/pdfjs/cmaps/78-EUC-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/78-EUC-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/78-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/78-RKSJ-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/78-RKSJ-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/78-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/78ms-RKSJ-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/78ms-RKSJ-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/83pv-RKSJ-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/90ms-RKSJ-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/90ms-RKSJ-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/90msp-RKSJ-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/90msp-RKSJ-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/90pv-RKSJ-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/90pv-RKSJ-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/Add-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/Add-RKSJ-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/Add-RKSJ-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/Add-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/Adobe-CNS1-0.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/Adobe-CNS1-1.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/Adobe-CNS1-2.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/Adobe-CNS1-3.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/Adobe-CNS1-4.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/Adobe-CNS1-5.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/Adobe-CNS1-6.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/Adobe-CNS1-UCS2.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/Adobe-GB1-0.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/Adobe-GB1-1.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/Adobe-GB1-2.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/Adobe-GB1-3.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/Adobe-GB1-4.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/Adobe-GB1-5.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/Adobe-GB1-UCS2.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/Adobe-Japan1-0.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/Adobe-Japan1-1.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/Adobe-Japan1-2.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/Adobe-Japan1-3.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/Adobe-Japan1-4.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/Adobe-Japan1-5.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/Adobe-Japan1-6.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/Adobe-Japan1-UCS2.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/Adobe-Korea1-0.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/Adobe-Korea1-1.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/Adobe-Korea1-2.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/Adobe-Korea1-UCS2.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/B5-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/B5-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/B5pc-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/B5pc-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/CNS-EUC-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/CNS-EUC-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/CNS1-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/CNS1-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/CNS2-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/CNS2-V.bcmap +3 -0
- package/native-host/src/vendor/pdfjs/cmaps/ETHK-B5-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/ETHK-B5-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/ETen-B5-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/ETen-B5-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/ETenms-B5-H.bcmap +3 -0
- package/native-host/src/vendor/pdfjs/cmaps/ETenms-B5-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/EUC-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/EUC-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/Ext-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/Ext-RKSJ-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/Ext-RKSJ-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/Ext-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/GB-EUC-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/GB-EUC-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/GB-H.bcmap +4 -0
- package/native-host/src/vendor/pdfjs/cmaps/GB-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/GBK-EUC-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/GBK-EUC-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/GBK2K-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/GBK2K-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/GBKp-EUC-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/GBKp-EUC-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/GBT-EUC-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/GBT-EUC-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/GBT-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/GBT-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/GBTpc-EUC-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/GBTpc-EUC-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/GBpc-EUC-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/GBpc-EUC-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/HKdla-B5-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/HKdla-B5-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/HKdlb-B5-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/HKdlb-B5-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/HKgccs-B5-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/HKgccs-B5-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/HKm314-B5-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/HKm314-B5-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/HKm471-B5-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/HKm471-B5-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/HKscs-B5-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/HKscs-B5-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/Hankaku.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/Hiragana.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/KSC-EUC-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/KSC-EUC-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/KSC-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/KSC-Johab-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/KSC-Johab-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/KSC-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/KSCms-UHC-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/KSCms-UHC-HW-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/KSCms-UHC-HW-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/KSCms-UHC-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/KSCpc-EUC-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/KSCpc-EUC-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/Katakana.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/LICENSE +36 -0
- package/native-host/src/vendor/pdfjs/cmaps/NWP-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/NWP-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/RKSJ-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/RKSJ-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/Roman.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/UniCNS-UCS2-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/UniCNS-UCS2-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/UniCNS-UTF16-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/UniCNS-UTF16-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/UniCNS-UTF32-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/UniCNS-UTF32-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/UniCNS-UTF8-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/UniCNS-UTF8-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/UniGB-UCS2-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/UniGB-UCS2-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/UniGB-UTF16-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/UniGB-UTF16-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/UniGB-UTF32-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/UniGB-UTF32-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/UniGB-UTF8-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/UniGB-UTF8-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/UniJIS-UCS2-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/UniJIS-UCS2-HW-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/UniJIS-UCS2-HW-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/UniJIS-UCS2-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/UniJIS-UTF16-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/UniJIS-UTF16-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/UniJIS-UTF32-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/UniJIS-UTF32-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/UniJIS-UTF8-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/UniJIS-UTF8-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/UniJIS2004-UTF16-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/UniJIS2004-UTF16-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/UniJIS2004-UTF32-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/UniJIS2004-UTF32-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/UniJIS2004-UTF8-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/UniJIS2004-UTF8-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/UniJISPro-UCS2-HW-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/UniJISPro-UCS2-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/UniJISPro-UTF8-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/UniJISX0213-UTF32-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/UniJISX0213-UTF32-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/UniJISX02132004-UTF32-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/UniJISX02132004-UTF32-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/UniKS-UCS2-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/UniKS-UCS2-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/UniKS-UTF16-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/UniKS-UTF16-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/UniKS-UTF32-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/UniKS-UTF32-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/UniKS-UTF8-H.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/UniKS-UTF8-V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/V.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/cmaps/WP-Symbol.bcmap +0 -0
- package/native-host/src/vendor/pdfjs/pdf.mjs +26740 -0
- package/native-host/src/vendor/pdfjs/pdf.worker.mjs +62201 -0
- package/native-host/src/vendor/pdfjs/standard_fonts/FoxitDingbats.pfb +0 -0
- package/native-host/src/vendor/pdfjs/standard_fonts/FoxitFixed.pfb +0 -0
- package/native-host/src/vendor/pdfjs/standard_fonts/FoxitFixedBold.pfb +0 -0
- package/native-host/src/vendor/pdfjs/standard_fonts/FoxitFixedBoldItalic.pfb +0 -0
- package/native-host/src/vendor/pdfjs/standard_fonts/FoxitFixedItalic.pfb +0 -0
- package/native-host/src/vendor/pdfjs/standard_fonts/FoxitSerif.pfb +0 -0
- package/native-host/src/vendor/pdfjs/standard_fonts/FoxitSerifBold.pfb +0 -0
- package/native-host/src/vendor/pdfjs/standard_fonts/FoxitSerifBoldItalic.pfb +0 -0
- package/native-host/src/vendor/pdfjs/standard_fonts/FoxitSerifItalic.pfb +0 -0
- package/native-host/src/vendor/pdfjs/standard_fonts/FoxitSymbol.pfb +0 -0
- package/native-host/src/vendor/pdfjs/standard_fonts/LICENSE_FOXIT +27 -0
- package/native-host/src/vendor/pdfjs/standard_fonts/LICENSE_LIBERATION +102 -0
- package/native-host/src/vendor/pdfjs/standard_fonts/LiberationSans-Bold.ttf +0 -0
- package/native-host/src/vendor/pdfjs/standard_fonts/LiberationSans-BoldItalic.ttf +0 -0
- package/native-host/src/vendor/pdfjs/standard_fonts/LiberationSans-Italic.ttf +0 -0
- package/native-host/src/vendor/pdfjs/standard_fonts/LiberationSans-Regular.ttf +0 -0
- package/native-host/src/writingStyleEvidence.js +102 -0
- package/native-host/src/writingStylePdfWorker.js +35 -0
- package/native-host/src/writingStyleProfile.js +165 -0
- package/native-host/src/writingStyleRuntime.js +475 -0
- package/native-host/src/writingStyleStore.js +73 -0
- package/package.json +1 -1
- package/scripts/install-managed.mjs +1 -0
|
@@ -171,6 +171,25 @@
|
|
|
171
171
|
|
|
172
172
|
function createCoordinator(options = {}) {
|
|
173
173
|
let view = null;
|
|
174
|
+
const guidanceAttempts = new Map();
|
|
175
|
+
const guidanceKey = (sessionId, itemId) => JSON.stringify([sessionId, itemId]);
|
|
176
|
+
const matchesGuidanceItem = (item, identity) => item?.id === identity.itemId
|
|
177
|
+
&& item.createdAt === identity.itemCreatedAt && item.text === identity.text
|
|
178
|
+
&& item.clientUserMessageId === identity.clientUserMessageId;
|
|
179
|
+
const matchesGuidanceScope = expected => {
|
|
180
|
+
const scope = options.getGuideScope?.();
|
|
181
|
+
return !expected || ['projectId', 'accountScopeId', 'generation'].every(key => scope?.[key] === expected[key]);
|
|
182
|
+
};
|
|
183
|
+
const guideErrorKeys = {
|
|
184
|
+
codex_turn_not_ready: 'queuedInputGuideNotReady',
|
|
185
|
+
codex_turn_mismatch: 'queuedInputGuideTurnChanged',
|
|
186
|
+
codex_steer_empty: 'queuedInputGuideEmpty',
|
|
187
|
+
codex_steer_too_large: 'queuedInputGuideTooLarge'
|
|
188
|
+
};
|
|
189
|
+
function formatGuideError(error) {
|
|
190
|
+
const key = guideErrorKeys[error?.code];
|
|
191
|
+
return (key && options.tr?.(key)) || error?.message || options.tr?.('queuedInputGuideFailed');
|
|
192
|
+
}
|
|
174
193
|
const scheduler = create({
|
|
175
194
|
getQueue: sessionId => options.getSession?.(sessionId)?.pendingInputs || [],
|
|
176
195
|
setQueue: (sessionId, pendingInputs) => options.setQueue?.(sessionId, pendingInputs),
|
|
@@ -226,62 +245,143 @@
|
|
|
226
245
|
const item = (session?.pendingInputs || []).find(entry => entry.id === itemId);
|
|
227
246
|
const run = options.getCurrentRun?.();
|
|
228
247
|
const binding = run?.activeTurn;
|
|
229
|
-
|
|
248
|
+
const initialScope = options.getGuideScope?.();
|
|
249
|
+
const guideScope = initialScope ? { ...initialScope } : null;
|
|
250
|
+
if (!session || !item || item.status !== 'queued' || !run || run.sessionId !== session.id || !binding?.threadId || !binding?.turnId) {
|
|
230
251
|
options.toast?.(options.tr?.('queuedInputGuideUnavailable'), 'warning');
|
|
231
252
|
return;
|
|
232
253
|
}
|
|
254
|
+
const identity = { requestId: run.nativeRequestId, threadId: binding.threadId, turnId: binding.turnId,
|
|
255
|
+
projectKey: run.runProjectId, recordId: run.recordId, sessionId: session.id, sessionCreatedAt: session.createdAt,
|
|
256
|
+
itemId, itemCreatedAt: item.createdAt, text: item.text, clientUserMessageId: item.clientUserMessageId };
|
|
257
|
+
const attemptKey = guidanceKey(identity.sessionId, itemId);
|
|
258
|
+
const attempt = { identity, scope: guideScope, previewToken: null };
|
|
259
|
+
const sameScope = () => matchesGuidanceScope(guideScope);
|
|
260
|
+
const ownedSession = () => {
|
|
261
|
+
const latest = options.getSession?.(identity.sessionId);
|
|
262
|
+
return sameScope() && latest?.createdAt === identity.sessionCreatedAt ? latest : null;
|
|
263
|
+
};
|
|
264
|
+
const ownedItemSession = (allowPaused = false) => {
|
|
265
|
+
const latest = ownedSession();
|
|
266
|
+
const current = latest?.pendingInputs?.find(entry => entry.id === itemId);
|
|
267
|
+
return guidanceAttempts.get(attemptKey) === attempt
|
|
268
|
+
&& (current?.status === 'steering' || (allowPaused && current?.status === 'paused'))
|
|
269
|
+
&& matchesGuidanceItem(current, identity) ? latest : null;
|
|
270
|
+
};
|
|
271
|
+
function clearPreview() {
|
|
272
|
+
const token = attempt.previewToken;
|
|
273
|
+
attempt.previewToken = null;
|
|
274
|
+
if (token) options.clearGuidancePreview?.(token);
|
|
275
|
+
}
|
|
276
|
+
const assertCurrent = () => {
|
|
277
|
+
const currentRun = options.getCurrentRun?.();
|
|
278
|
+
if (options.isGuideCancelled?.() || currentRun !== run || options.getActiveSession?.()?.id !== identity.sessionId
|
|
279
|
+
|| currentRun?.nativeRequestId !== identity.requestId
|
|
280
|
+
|| currentRun?.recordId !== identity.recordId || currentRun?.runProjectId !== identity.projectKey
|
|
281
|
+
|| currentRun?.activeTurn?.threadId !== identity.threadId || currentRun?.activeTurn?.turnId !== identity.turnId
|
|
282
|
+
|| !ownedItemSession()) {
|
|
283
|
+
throw Object.assign(new Error(options.tr?.('queuedInputGuideUnavailable') || 'Guidance is no longer available for this turn.'), { code: 'codex_turn_mismatch' });
|
|
284
|
+
}
|
|
285
|
+
};
|
|
286
|
+
async function restoreUnsent(error) {
|
|
287
|
+
// No steer was dispatched. Restore only this attempt's still-owned item;
|
|
288
|
+
// a concurrent removal, replacement or scope switch must stay untouched.
|
|
289
|
+
clearPreview();
|
|
290
|
+
const latest = ownedItemSession();
|
|
291
|
+
if (latest) {
|
|
292
|
+
options.setQueue?.(identity.sessionId, Queue.returnToQueue(latest.pendingInputs, itemId));
|
|
293
|
+
render();
|
|
294
|
+
try {
|
|
295
|
+
await options.save?.({ queueMutation: { type: 'transition', sessionId: identity.sessionId, itemId } });
|
|
296
|
+
} catch (recoveryError) {
|
|
297
|
+
if (error && typeof error === 'object') error.persistenceRecoveryError = recoveryError?.message || String(recoveryError);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
233
301
|
options.setQueue?.(session.id, Queue.markSteering(session.pendingInputs, itemId));
|
|
234
|
-
|
|
235
|
-
await options.save?.({
|
|
236
|
-
queueMutation: { type: 'transition', sessionId: session.id, itemId }
|
|
237
|
-
});
|
|
302
|
+
guidanceAttempts.set(attemptKey, attempt);
|
|
238
303
|
try {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
304
|
+
try {
|
|
305
|
+
attempt.previewToken = options.previewGuidance?.(identity.text, {
|
|
306
|
+
guidanceId: itemId, sessionId: identity.sessionId, recordId: identity.recordId,
|
|
307
|
+
sessionCreatedAt: identity.sessionCreatedAt
|
|
308
|
+
});
|
|
309
|
+
render();
|
|
310
|
+
const preflight = await options.preflightGuide?.({ task: identity.text, assertCurrent });
|
|
311
|
+
assertCurrent();
|
|
312
|
+
if (preflight?.blocked) throw Object.assign(new Error('Guidance was blocked before dispatch.'), { guidanceBlocked: true });
|
|
313
|
+
await options.save?.({
|
|
314
|
+
queueMutation: { type: 'transition', sessionId: identity.sessionId, itemId }
|
|
315
|
+
});
|
|
316
|
+
assertCurrent();
|
|
317
|
+
} catch (error) {
|
|
318
|
+
await restoreUnsent(error);
|
|
319
|
+
if (error?.guidanceBlocked) return { ok: false, blocked: true };
|
|
320
|
+
throw error;
|
|
321
|
+
}
|
|
322
|
+
let response;
|
|
323
|
+
try {
|
|
324
|
+
response = await options.sendSteer?.({
|
|
325
|
+
requestId: identity.requestId,
|
|
326
|
+
projectKey: identity.projectKey,
|
|
327
|
+
threadId: identity.threadId,
|
|
328
|
+
expectedTurnId: identity.turnId,
|
|
329
|
+
clientUserMessageId: identity.clientUserMessageId,
|
|
330
|
+
input: [{ type: 'text', text: identity.text }]
|
|
331
|
+
}, { assertCurrent });
|
|
332
|
+
} catch (error) {
|
|
333
|
+
if (error?.requestDispatched === false) { await restoreUnsent(error); throw error; }
|
|
334
|
+
clearPreview();
|
|
335
|
+
const latest = ownedItemSession(true);
|
|
336
|
+
if (latest) {
|
|
337
|
+
const paused = latest.pendingInputs.map(entry => entry.id === itemId
|
|
338
|
+
? { ...entry, status: 'paused', pauseReason: 'steer_delivery_unknown' }
|
|
339
|
+
: entry);
|
|
340
|
+
options.setQueue?.(identity.sessionId, Queue.normalizeQueue(paused));
|
|
341
|
+
}
|
|
342
|
+
options.toast?.(formatGuideError(error), 'warning');
|
|
343
|
+
render();
|
|
344
|
+
if (latest) await options.save?.({
|
|
345
|
+
queueMutation: { type: 'transition', sessionId: identity.sessionId, itemId }
|
|
346
|
+
});
|
|
347
|
+
return;
|
|
348
|
+
}
|
|
349
|
+
// Cancellation can pause the owned row while a dispatched steer is
|
|
350
|
+
// awaiting acknowledgement. A confirmed receipt also consumes that
|
|
351
|
+
// paused copy, so Resume cannot send an already accepted input again.
|
|
352
|
+
const latest = ownedItemSession(Boolean(response?.ok));
|
|
353
|
+
if (latest) options.setQueue?.(
|
|
354
|
+
identity.sessionId,
|
|
355
|
+
response?.ok ? Queue.remove(latest.pendingInputs, itemId)
|
|
356
|
+
: Queue.returnToQueue(latest.pendingInputs, itemId, response?.error?.code || 'steer_failed')
|
|
253
357
|
);
|
|
254
358
|
if (response?.ok) {
|
|
255
|
-
if (typeof options.appendGuidance === 'function') {
|
|
256
|
-
options.appendGuidance(
|
|
257
|
-
guidanceId:
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
status: 'completed'
|
|
359
|
+
if (ownedSession() && typeof options.appendGuidance === 'function') {
|
|
360
|
+
options.appendGuidance(identity.text, {
|
|
361
|
+
guidanceId: itemId, sessionId: identity.sessionId, recordId: identity.recordId,
|
|
362
|
+
sessionCreatedAt: identity.sessionCreatedAt, status: 'completed',
|
|
363
|
+
timestamp: attempt.previewToken?.event?.timestamp
|
|
261
364
|
});
|
|
262
|
-
} else {
|
|
365
|
+
} else if (ownedSession() && options.getCurrentRun?.() === run) {
|
|
263
366
|
options.appendEvent?.(options.tr?.('queuedInputGuided'), 'completed');
|
|
264
367
|
}
|
|
265
368
|
} else {
|
|
266
|
-
options.toast?.(response?.error
|
|
369
|
+
options.toast?.(formatGuideError(response?.error), 'warning');
|
|
267
370
|
}
|
|
371
|
+
clearPreview();
|
|
268
372
|
render();
|
|
269
|
-
|
|
373
|
+
// A Native acknowledgement is final delivery evidence. A later local
|
|
374
|
+
// save failure must not turn it into an unknown delivery or resend it.
|
|
375
|
+
if (latest) await options.save?.({
|
|
270
376
|
queueMutation: response?.ok
|
|
271
|
-
? { type: 'remove', sessionId:
|
|
272
|
-
: { type: 'transition', sessionId:
|
|
377
|
+
? { type: 'remove', sessionId: identity.sessionId, itemId }
|
|
378
|
+
: { type: 'transition', sessionId: identity.sessionId, itemId }
|
|
273
379
|
});
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
: entry);
|
|
279
|
-
options.setQueue?.(session.id, Queue.normalizeQueue(paused));
|
|
280
|
-
options.toast?.(error?.message || options.tr?.('queuedInputGuideFailed'), 'warning');
|
|
380
|
+
else if (response?.ok && ownedSession()) await options.save?.();
|
|
381
|
+
} finally {
|
|
382
|
+
clearPreview();
|
|
383
|
+
if (guidanceAttempts.get(attemptKey) === attempt) guidanceAttempts.delete(attemptKey);
|
|
281
384
|
render();
|
|
282
|
-
await options.save?.({
|
|
283
|
-
queueMutation: { type: 'transition', sessionId: session.id, itemId }
|
|
284
|
-
});
|
|
285
385
|
}
|
|
286
386
|
}
|
|
287
387
|
|
|
@@ -320,9 +420,10 @@
|
|
|
320
420
|
view = options.createView?.({
|
|
321
421
|
container,
|
|
322
422
|
tr: options.tr,
|
|
323
|
-
onGuide: itemId => guide(itemId).catch(error => options.toast?.(error
|
|
423
|
+
onGuide: itemId => guide(itemId).catch(error => options.toast?.(formatGuideError(error), 'warning')),
|
|
324
424
|
onRemove: remove,
|
|
325
|
-
onResume: resume
|
|
425
|
+
onResume: resume,
|
|
426
|
+
onToast: message => options.toast?.(message, 'warning')
|
|
326
427
|
});
|
|
327
428
|
if (view) {
|
|
328
429
|
view.container = container;
|
|
@@ -330,7 +431,13 @@
|
|
|
330
431
|
}
|
|
331
432
|
const session = options.getActiveSession?.();
|
|
332
433
|
const run = options.getCurrentRun?.();
|
|
333
|
-
|
|
434
|
+
const visibleQueue = (session?.pendingInputs || []).filter(item => {
|
|
435
|
+
const attempt = guidanceAttempts.get(guidanceKey(session.id, item.id));
|
|
436
|
+
return !attempt?.previewToken || !['steering', 'paused'].includes(item.status)
|
|
437
|
+
|| !matchesGuidanceScope(attempt.scope)
|
|
438
|
+
|| session.createdAt !== attempt.identity.sessionCreatedAt || !matchesGuidanceItem(item, attempt.identity);
|
|
439
|
+
});
|
|
440
|
+
view?.render?.(visibleQueue, {
|
|
334
441
|
running: Boolean(run),
|
|
335
442
|
canGuide: Boolean(run?.activeTurn?.turnId)
|
|
336
443
|
});
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
(function (root, factory) {
|
|
2
|
+
if (typeof module === 'object' && module.exports) module.exports = factory();
|
|
3
|
+
else root.CodexOverleafModuleRegistry.define('RunRecoveryActions', [], factory);
|
|
4
|
+
})(typeof window !== 'undefined' ? window : globalThis, function () {
|
|
5
|
+
'use strict';
|
|
6
|
+
|
|
7
|
+
function formatForceCancelOutcome(response, tx) {
|
|
8
|
+
if (response?.ok !== true) return tx('Release failed — refresh the tab, then try again.', '释放失败,请刷新页面后重试。');
|
|
9
|
+
const result = response.result || response;
|
|
10
|
+
if (result.lockReleased === true) return tx('Force-released — you can retry the run.', '已释放,可以重试本轮任务。');
|
|
11
|
+
if (result.cancelled === true) return tx('Cancellation requested. Wait for the task to stop before retrying.', '已请求取消,请等待任务停止后再重试。');
|
|
12
|
+
if (result.cancelled === false) return tx('No active task matched the release request.', '没有发现与释放请求匹配的活动任务。');
|
|
13
|
+
if (result.sent === true) return tx('Cancellation request sent; release is not yet confirmed.', '取消请求已发送,释放状态尚未确认。');
|
|
14
|
+
return tx('Release is not yet confirmed. Check the current task before retrying.', '释放状态尚未确认,请检查当前任务后再重试。');
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function create(deps = {}) {
|
|
18
|
+
const { tx, failureNotice, refillComposerForRetry, openProjectFileForFailure, showNativeSetupGuidance,
|
|
19
|
+
openStorageSettings, forceCancelStuckTaskForCurrentProject } = deps;
|
|
20
|
+
const document = deps.document || globalThis.document;
|
|
21
|
+
const window = deps.window || globalThis.window;
|
|
22
|
+
|
|
23
|
+
const RETRYABLE_FAILURE_CODES = new Set([
|
|
24
|
+
'native_request_failed', 'codex_timeout', 'codex_no_usable_result',
|
|
25
|
+
'codex_output_limit', 'stale_source_changed', 'patch_anchor_not_found',
|
|
26
|
+
'target_editor_not_ready', 'write_timeout', 'partial_write_needs_review',
|
|
27
|
+
'write_operation_failed'
|
|
28
|
+
]);
|
|
29
|
+
const NATIVE_SETUP_FAILURE_CODES = new Set([
|
|
30
|
+
'native_bridge_unavailable', 'native_protocol_incompatible'
|
|
31
|
+
]);
|
|
32
|
+
const OPEN_FILE_FAILURE_CODES = new Set([
|
|
33
|
+
'target_file_not_active', 'target_file_open_failed', 'target_file_not_found'
|
|
34
|
+
]);
|
|
35
|
+
const STORAGE_FAILURE_CODES = new Set([
|
|
36
|
+
'storage_quota_exceeded', 'run_state_persist_failed'
|
|
37
|
+
]);
|
|
38
|
+
// A missing `codex` binary is fixed in the terminal, not the panel — the
|
|
39
|
+
// action opens the README troubleshooting section (PATH / login checks).
|
|
40
|
+
const CODEX_INSTALL_FAILURE_CODES = new Set(['codex_not_found']);
|
|
41
|
+
const CODEX_CLI_TROUBLESHOOTING_URL = 'https://github.com/Ghqqqq/codex-overleaf-link#faq-and-troubleshooting';
|
|
42
|
+
|
|
43
|
+
function buildRecoveryButton(failureCode, label, title) {
|
|
44
|
+
const button = document.createElement('button');
|
|
45
|
+
button.type = 'button';
|
|
46
|
+
button.className = 'run-final-answer__recovery-action';
|
|
47
|
+
button.dataset.recoveryFor = failureCode;
|
|
48
|
+
button.textContent = label;
|
|
49
|
+
if (title) {
|
|
50
|
+
button.title = title;
|
|
51
|
+
}
|
|
52
|
+
return button;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function appendEditAndResend(report, run, actionKey) {
|
|
56
|
+
const retry = buildRecoveryButton(actionKey,
|
|
57
|
+
tx('Edit & resend', '编辑后重发'),
|
|
58
|
+
tx('Put this run\u2019s task back into the composer so you can adjust and resend it.', '把本轮任务填回输入框,修改后可直接重发。'));
|
|
59
|
+
retry.addEventListener('click', clickEvent => {
|
|
60
|
+
clickEvent.stopPropagation();
|
|
61
|
+
refillComposerForRetry(run || null);
|
|
62
|
+
});
|
|
63
|
+
report.append(retry);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function appendRecoveryActionForFailure(report, event, run) {
|
|
67
|
+
const recovery = failureNotice?.prepareRecovery(report, { openFile: openProjectFileForFailure });
|
|
68
|
+
const failure = recovery?.failure || event?.failure;
|
|
69
|
+
const failureCode = failure?.code || '';
|
|
70
|
+
if (recovery?.handled) return;
|
|
71
|
+
report = recovery?.target || report;
|
|
72
|
+
if (RETRYABLE_FAILURE_CODES.has(failureCode) && typeof refillComposerForRetry === 'function') {
|
|
73
|
+
appendEditAndResend(report, run, failureCode);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
if (NATIVE_SETUP_FAILURE_CODES.has(failureCode) && typeof showNativeSetupGuidance === 'function') {
|
|
77
|
+
const fix = buildRecoveryButton(failureCode,
|
|
78
|
+
tx('Fix the native host', '修复 native host'),
|
|
79
|
+
tx('Opens the install/update guidance with the copyable command.', '打开安装/更新指引(含可复制命令)。'));
|
|
80
|
+
fix.addEventListener('click', clickEvent => {
|
|
81
|
+
clickEvent.stopPropagation();
|
|
82
|
+
showNativeSetupGuidance();
|
|
83
|
+
});
|
|
84
|
+
report.append(fix);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
if (OPEN_FILE_FAILURE_CODES.has(failureCode) && failure?.file && typeof openProjectFileForFailure === 'function') {
|
|
88
|
+
const open = buildRecoveryButton(failureCode,
|
|
89
|
+
tx(`Open ${failure.file} in Overleaf`, `在 Overleaf 打开 ${failure.file}`), '');
|
|
90
|
+
open.addEventListener('click', clickEvent => {
|
|
91
|
+
clickEvent.stopPropagation();
|
|
92
|
+
openProjectFileForFailure(failure.file);
|
|
93
|
+
});
|
|
94
|
+
report.append(open);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
if (STORAGE_FAILURE_CODES.has(failureCode) && typeof openStorageSettings === 'function') {
|
|
98
|
+
const clean = buildRecoveryButton(failureCode,
|
|
99
|
+
tx('Open history & storage cleanup', '打开历史与存储清理'), '');
|
|
100
|
+
clean.addEventListener('click', clickEvent => {
|
|
101
|
+
clickEvent.stopPropagation();
|
|
102
|
+
openStorageSettings();
|
|
103
|
+
});
|
|
104
|
+
report.append(clean);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
if (CODEX_INSTALL_FAILURE_CODES.has(failureCode)) {
|
|
108
|
+
const guide = buildRecoveryButton(failureCode,
|
|
109
|
+
tx('Codex CLI troubleshooting guide', '查看 Codex CLI 排查指引'),
|
|
110
|
+
tx('Opens the README section on fixing a missing `codex` command (PATH / login).', '打开 README 中「找不到 codex 命令」的排查说明(PATH/登录)。'));
|
|
111
|
+
guide.addEventListener('click', clickEvent => {
|
|
112
|
+
clickEvent.stopPropagation();
|
|
113
|
+
window.open(CODEX_CLI_TROUBLESHOOTING_URL, '_blank', 'noopener');
|
|
114
|
+
});
|
|
115
|
+
report.append(guide);
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
if (failureCode !== 'codex_project_locked') return;
|
|
119
|
+
const button = document.createElement('button');
|
|
120
|
+
button.type = 'button';
|
|
121
|
+
button.className = 'run-final-answer__recovery-action';
|
|
122
|
+
button.dataset.recoveryFor = failureCode;
|
|
123
|
+
button.textContent = tx('Force-release the stuck task', '强制释放卡住的任务');
|
|
124
|
+
button.title = tx(
|
|
125
|
+
'Requests cancellation for this project. A sent request does not confirm that the task has stopped. Use this when refreshing the tab did not free the project.',
|
|
126
|
+
'请求取消当前项目的任务;请求已发送不代表任务已经停止。刷新页面仍未解除占用时使用。'
|
|
127
|
+
);
|
|
128
|
+
button.addEventListener('click', event => {
|
|
129
|
+
event.stopPropagation();
|
|
130
|
+
button.disabled = true;
|
|
131
|
+
button.textContent = tx('Releasing…', '正在释放…');
|
|
132
|
+
forceCancelStuckTaskForCurrentProject().then(result => {
|
|
133
|
+
button.textContent = formatForceCancelOutcome(result, tx);
|
|
134
|
+
button.disabled = result?.ok === true;
|
|
135
|
+
}).catch(() => {
|
|
136
|
+
button.disabled = false;
|
|
137
|
+
button.textContent = tx('Release failed — refresh the tab, then try again.', '释放失败,请刷新页面后重试。');
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
report.append(button);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
return { buildRecoveryButton, appendRecoveryActionForFailure };
|
|
144
|
+
}
|
|
145
|
+
return { create, formatForceCancelOutcome };
|
|
146
|
+
});
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
(function
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
})(typeof window !== 'undefined' ? window : globalThis, function runResultActionsFactory() {
|
|
1
|
+
(function (root, factory) {
|
|
2
|
+
if (typeof module === 'object' && module.exports) module.exports = factory(require('./runCompletionMeta'));
|
|
3
|
+
else root.CodexOverleafModuleRegistry.define('RunResultActions', ['RunCompletionMeta'], factory);
|
|
4
|
+
})(typeof window !== 'undefined' ? window : globalThis, function (RunCompletionMeta) {
|
|
6
5
|
'use strict';
|
|
7
6
|
|
|
7
|
+
const { splitFlatCompletionReport, projectCompletionBody, projectCompletionMeta, summarizeCompletionMeta } = RunCompletionMeta;
|
|
8
|
+
|
|
9
|
+
|
|
8
10
|
function create(deps = {}) {
|
|
9
11
|
const {
|
|
10
12
|
tr,
|
|
@@ -107,17 +109,18 @@
|
|
|
107
109
|
if (!copied) throw new Error('clipboard_copy_failed');
|
|
108
110
|
}
|
|
109
111
|
|
|
110
|
-
return Object.freeze({ configureResultActions, projectUndoAvailability });
|
|
112
|
+
return Object.freeze({ configureResultActions, projectUndoAvailability, splitFlatCompletionReport, projectCompletionBody, projectCompletionMeta, summarizeCompletionMeta });
|
|
111
113
|
}
|
|
112
114
|
|
|
115
|
+
|
|
113
116
|
function projectUndoAvailability(run, projectRunSettlement) {
|
|
114
117
|
const payload = run.recoveryPayload && typeof run.recoveryPayload === 'object'
|
|
115
118
|
? run.recoveryPayload : run;
|
|
116
119
|
if (!Array.isArray(payload.appliedOperations)) return projectRunSettlement(run);
|
|
117
|
-
// Forward
|
|
120
|
+
// Forward creation/asset writes alone do not provide a rollback. Filter them only for
|
|
118
121
|
// display; preserve the canonical settlement and every real recovery field.
|
|
119
122
|
const appliedOperations = payload.appliedOperations.filter(operation =>
|
|
120
|
-
operation?.type !== 'binary-create' && operation?.type !== 'overwrite-binary');
|
|
123
|
+
operation?.type !== 'create' && operation?.type !== 'binary-create' && operation?.type !== 'overwrite-binary');
|
|
121
124
|
if (appliedOperations.length === payload.appliedOperations.length) return projectRunSettlement(run);
|
|
122
125
|
return projectRunSettlement({
|
|
123
126
|
...run,
|