@vybestack/llxprt-code-core 0.11.0 → 0.12.0-nightly.260910.2aac6841e
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/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/prompt-config/defaults/default-prompts.json +3 -3
- package/dist/src/config/agentClientLifecycle.d.ts +4 -3
- package/dist/src/config/agentClientLifecycle.js +27 -14
- package/dist/src/config/agentClientLifecycle.js.map +1 -1
- package/dist/src/config/config.d.ts +2 -5
- package/dist/src/config/config.js +10 -23
- package/dist/src/config/config.js.map +1 -1
- package/dist/src/config/configBase.d.ts +5 -1
- package/dist/src/config/configBase.js +27 -6
- package/dist/src/config/configBase.js.map +1 -1
- package/dist/src/config/configBaseCore.d.ts +26 -8
- package/dist/src/config/configBaseCore.js +30 -26
- package/dist/src/config/configBaseCore.js.map +1 -1
- package/dist/src/config/configMcpRuntime.d.ts +16 -0
- package/dist/src/config/configMcpRuntime.js +31 -0
- package/dist/src/config/configMcpRuntime.js.map +1 -0
- package/dist/src/config/configMediaDefaults.d.ts +10 -0
- package/dist/src/config/configMediaDefaults.js +17 -0
- package/dist/src/config/configMediaDefaults.js.map +1 -0
- package/dist/src/config/configTestHarness.d.ts +4 -0
- package/dist/src/config/configTypes.d.ts +4 -54
- package/dist/src/config/configTypes.js +6 -82
- package/dist/src/config/configTypes.js.map +1 -1
- package/dist/src/config/index.d.ts +1 -2
- package/dist/src/config/index.js +1 -2
- package/dist/src/config/index.js.map +1 -1
- package/dist/src/config/models.d.ts +0 -4
- package/dist/src/config/models.js +0 -4
- package/dist/src/config/models.js.map +1 -1
- package/dist/src/config/toolRegistryFactory.d.ts +2 -2
- package/dist/src/core/clientContract.d.ts +4 -6
- package/dist/src/core/compression/transcriptPathNotice.d.ts +22 -0
- package/dist/src/core/compression/transcriptPathNotice.js +29 -0
- package/dist/src/core/compression/transcriptPathNotice.js.map +1 -0
- package/dist/src/core/contentGenerator.d.ts +2 -5
- package/dist/src/core/contentGenerator.js +10 -24
- package/dist/src/core/contentGenerator.js.map +1 -1
- package/dist/src/core/logger.d.ts +66 -0
- package/dist/src/core/logger.js +345 -30
- package/dist/src/core/logger.js.map +1 -1
- package/dist/src/core/prompts.d.ts +0 -1
- package/dist/src/core/prompts.js +5 -79
- package/dist/src/core/prompts.js.map +1 -1
- package/dist/src/core/turn.d.ts +3 -3
- package/dist/src/hooks/hookTranslator.js +5 -4
- package/dist/src/hooks/hookTranslator.js.map +1 -1
- package/dist/src/index.d.ts +8 -6
- package/dist/src/index.js +8 -6
- package/dist/src/index.js.map +1 -1
- package/dist/src/llm-types/index.d.ts +1 -1
- package/dist/src/llm-types/modelEnvelope.d.ts +2 -1
- package/dist/src/llm-types/modelEnvelope.js +17 -1
- package/dist/src/llm-types/modelEnvelope.js.map +1 -1
- package/dist/src/models/schema.d.ts +40 -40
- package/dist/src/policy/policies/read-only.toml +0 -5
- package/dist/src/prompt-config/TemplateEngine.js +0 -3
- package/dist/src/prompt-config/TemplateEngine.js.map +1 -1
- package/dist/src/prompt-config/defaults/providers/gemini/core.md +0 -2
- package/dist/src/prompt-config/defaults/providers/gemini/models/gemini-2.5-flash/core.md +0 -2
- package/dist/src/prompt-config/defaults/providers/gemini/models/gemini-2.5-flash/gemini-2-5-flash/core.md +0 -2
- package/dist/src/prompt-config/prompt-loader.d.ts +1 -1
- package/dist/src/prompt-config/prompt-loader.js +4 -4
- package/dist/src/prompt-config/prompt-loader.js.map +1 -1
- package/dist/src/prompt-config/types.d.ts +0 -1
- package/dist/src/recording/CheckpointService.d.ts +4 -0
- package/dist/src/recording/CheckpointService.js +67 -46
- package/dist/src/recording/CheckpointService.js.map +1 -1
- package/dist/src/recording/HistoryMutationService.d.ts +1 -1
- package/dist/src/recording/HistoryMutationService.js +27 -4
- package/dist/src/recording/HistoryMutationService.js.map +1 -1
- package/dist/src/recording/RecordingIntegration.d.ts +36 -2
- package/dist/src/recording/RecordingIntegration.js +224 -7
- package/dist/src/recording/RecordingIntegration.js.map +1 -1
- package/dist/src/recording/ReplayEngine.d.ts +8 -10
- package/dist/src/recording/ReplayEngine.js +161 -95
- package/dist/src/recording/ReplayEngine.js.map +1 -1
- package/dist/src/recording/SessionDiscovery.d.ts +4 -2
- package/dist/src/recording/SessionDiscovery.js +13 -5
- package/dist/src/recording/SessionDiscovery.js.map +1 -1
- package/dist/src/recording/SessionRecordingService.d.ts +23 -3
- package/dist/src/recording/SessionRecordingService.js +209 -51
- package/dist/src/recording/SessionRecordingService.js.map +1 -1
- package/dist/src/recording/SessionTransitionService.d.ts +7 -0
- package/dist/src/recording/SessionTransitionService.js +66 -13
- package/dist/src/recording/SessionTransitionService.js.map +1 -1
- package/dist/src/recording/index.d.ts +1 -0
- package/dist/src/recording/index.js +1 -0
- package/dist/src/recording/index.js.map +1 -1
- package/dist/src/recording/janitor/cleanupTypes.d.ts +3 -0
- package/dist/src/recording/janitor/cleanupTypes.js.map +1 -1
- package/dist/src/recording/janitor/mediaReclamation.d.ts +23 -0
- package/dist/src/recording/janitor/mediaReclamation.js +195 -0
- package/dist/src/recording/janitor/mediaReclamation.js.map +1 -0
- package/dist/src/recording/janitor/sessionJanitor.js +47 -1
- package/dist/src/recording/janitor/sessionJanitor.js.map +1 -1
- package/dist/src/recording/janitor/sessionScanner.d.ts +12 -9
- package/dist/src/recording/janitor/sessionScanner.js +248 -193
- package/dist/src/recording/janitor/sessionScanner.js.map +1 -1
- package/dist/src/recording/replay-test-helpers.d.ts +10 -1
- package/dist/src/recording/replay-test-helpers.js +24 -2
- package/dist/src/recording/replay-test-helpers.js.map +1 -1
- package/dist/src/recording/replayCheckpointMetadata.d.ts +28 -0
- package/dist/src/recording/replayCheckpointMetadata.js +96 -0
- package/dist/src/recording/replayCheckpointMetadata.js.map +1 -0
- package/dist/src/recording/replayErrorFormatting.d.ts +6 -0
- package/dist/src/recording/replayErrorFormatting.js +38 -0
- package/dist/src/recording/replayErrorFormatting.js.map +1 -0
- package/dist/src/recording/resumeSession.d.ts +3 -0
- package/dist/src/recording/resumeSession.js +7 -1
- package/dist/src/recording/resumeSession.js.map +1 -1
- package/dist/src/recording/semanticMediaPurgeReplayValidation.d.ts +14 -0
- package/dist/src/recording/semanticMediaPurgeReplayValidation.js +24 -0
- package/dist/src/recording/semanticMediaPurgeReplayValidation.js.map +1 -0
- package/dist/src/recording/session-media-package-blobs.d.ts +8 -0
- package/dist/src/recording/session-media-package-blobs.js +72 -0
- package/dist/src/recording/session-media-package-blobs.js.map +1 -0
- package/dist/src/recording/session-media-package-import.d.ts +26 -0
- package/dist/src/recording/session-media-package-import.js +124 -0
- package/dist/src/recording/session-media-package-import.js.map +1 -0
- package/dist/src/recording/session-media-package-state.d.ts +19 -0
- package/dist/src/recording/session-media-package-state.js +56 -0
- package/dist/src/recording/session-media-package-state.js.map +1 -0
- package/dist/src/recording/session-media-package-validation.d.ts +59 -0
- package/dist/src/recording/session-media-package-validation.js +286 -0
- package/dist/src/recording/session-media-package-validation.js.map +1 -0
- package/dist/src/recording/session-media-package-writer.d.ts +18 -0
- package/dist/src/recording/session-media-package-writer.js +70 -0
- package/dist/src/recording/session-media-package-writer.js.map +1 -0
- package/dist/src/recording/session-media-package.d.ts +27 -0
- package/dist/src/recording/session-media-package.js +366 -0
- package/dist/src/recording/session-media-package.js.map +1 -0
- package/dist/src/recording/types.d.ts +34 -2
- package/dist/src/recording/types.js.map +1 -1
- package/dist/src/runtime/AgentRuntimeContext.d.ts +22 -5
- package/dist/src/runtime/AgentRuntimeLoader.d.ts +6 -0
- package/dist/src/runtime/AgentRuntimeLoader.js +25 -6
- package/dist/src/runtime/AgentRuntimeLoader.js.map +1 -1
- package/dist/src/runtime/contracts/PromptEstimation.d.ts +1 -0
- package/dist/src/runtime/contracts/PromptEstimation.js.map +1 -1
- package/dist/src/runtime/contracts/RuntimeProvider.d.ts +3 -2
- package/dist/src/runtime/contracts/RuntimeProviderManager.d.ts +0 -2
- package/dist/src/runtime/createAgentRuntimeContext.js +28 -1
- package/dist/src/runtime/createAgentRuntimeContext.js.map +1 -1
- package/dist/src/runtime/providerRuntimeContext.d.ts +12 -0
- package/dist/src/runtime/providerRuntimeContext.js +3 -0
- package/dist/src/runtime/providerRuntimeContext.js.map +1 -1
- package/dist/src/runtime/runtimeAdapters.js +2 -2
- package/dist/src/runtime/runtimeAdapters.js.map +1 -1
- package/dist/src/services/history/ContentConverters.d.ts +11 -7
- package/dist/src/services/history/ContentConverters.js +11 -7
- package/dist/src/services/history/ContentConverters.js.map +1 -1
- package/dist/src/services/history/HistoryService.d.ts +18 -180
- package/dist/src/services/history/HistoryService.js +53 -523
- package/dist/src/services/history/HistoryService.js.map +1 -1
- package/dist/src/services/history/HistoryServiceCore.d.ts +278 -0
- package/dist/src/services/history/HistoryServiceCore.js +727 -0
- package/dist/src/services/history/HistoryServiceCore.js.map +1 -0
- package/dist/src/services/history/IContent.d.ts +118 -16
- package/dist/src/services/history/IContent.js +284 -4
- package/dist/src/services/history/IContent.js.map +1 -1
- package/dist/src/services/history/contentSize.js +22 -2
- package/dist/src/services/history/contentSize.js.map +1 -1
- package/dist/src/services/history/historyChronology.d.ts +7 -0
- package/dist/src/services/history/historyChronology.js +35 -3
- package/dist/src/services/history/historyChronology.js.map +1 -1
- package/dist/src/services/history/historyCloneUtils.d.ts +5 -4
- package/dist/src/services/history/historyCloneUtils.js +23 -16
- package/dist/src/services/history/historyCloneUtils.js.map +1 -1
- package/dist/src/services/history/historyCompressionQueue.d.ts +33 -0
- package/dist/src/services/history/historyCompressionQueue.js +81 -0
- package/dist/src/services/history/historyCompressionQueue.js.map +1 -0
- package/dist/src/services/history/historyEventTypes.d.ts +3 -0
- package/dist/src/services/history/historyMutationFailure.d.ts +15 -0
- package/dist/src/services/history/historyMutationFailure.js +22 -0
- package/dist/src/services/history/historyMutationFailure.js.map +1 -1
- package/dist/src/services/history/historyProviderPipeline.d.ts +1 -1
- package/dist/src/services/history/historyProviderPipeline.js +15 -5
- package/dist/src/services/history/historyProviderPipeline.js.map +1 -1
- package/dist/src/services/history/historyTokenEstimation.js +10 -6
- package/dist/src/services/history/historyTokenEstimation.js.map +1 -1
- package/dist/src/services/history/historyToolNormalization.d.ts +2 -0
- package/dist/src/services/history/historyToolNormalization.js +26 -9
- package/dist/src/services/history/historyToolNormalization.js.map +1 -1
- package/dist/src/services/history/provider-file-binding.d.ts +11 -0
- package/dist/src/services/history/provider-file-binding.js +70 -0
- package/dist/src/services/history/provider-file-binding.js.map +1 -0
- package/dist/src/services/history/semantic-media-purge.d.ts +66 -0
- package/dist/src/services/history/semantic-media-purge.js +404 -0
- package/dist/src/services/history/semantic-media-purge.js.map +1 -0
- package/dist/src/storage/SessionPersistenceService.d.ts +53 -2
- package/dist/src/storage/SessionPersistenceService.js +435 -23
- package/dist/src/storage/SessionPersistenceService.js.map +1 -1
- package/dist/src/storage/history-media-ownership.d.ts +38 -0
- package/dist/src/storage/history-media-ownership.js +136 -0
- package/dist/src/storage/history-media-ownership.js.map +1 -0
- package/dist/src/storage/local-media-store-child.d.ts +6 -0
- package/dist/src/storage/local-media-store-child.js +140 -0
- package/dist/src/storage/local-media-store-child.js.map +1 -0
- package/dist/src/storage/local-media-store-files.d.ts +44 -0
- package/dist/src/storage/local-media-store-files.js +460 -0
- package/dist/src/storage/local-media-store-files.js.map +1 -0
- package/dist/src/storage/local-media-store-lock-recovery.d.ts +15 -0
- package/dist/src/storage/local-media-store-lock-recovery.js +112 -0
- package/dist/src/storage/local-media-store-lock-recovery.js.map +1 -0
- package/dist/src/storage/local-media-store-persistence.d.ts +48 -0
- package/dist/src/storage/local-media-store-persistence.js +443 -0
- package/dist/src/storage/local-media-store-persistence.js.map +1 -0
- package/dist/src/storage/local-media-store-quota.d.ts +6 -0
- package/dist/src/storage/local-media-store-quota.js +66 -0
- package/dist/src/storage/local-media-store-quota.js.map +1 -0
- package/dist/src/storage/local-media-store-reservations.d.ts +55 -0
- package/dist/src/storage/local-media-store-reservations.js +377 -0
- package/dist/src/storage/local-media-store-reservations.js.map +1 -0
- package/dist/src/storage/local-media-store-types.d.ts +110 -0
- package/dist/src/storage/local-media-store-types.js +35 -0
- package/dist/src/storage/local-media-store-types.js.map +1 -0
- package/dist/src/storage/local-media-store-validation.d.ts +34 -0
- package/dist/src/storage/local-media-store-validation.js +449 -0
- package/dist/src/storage/local-media-store-validation.js.map +1 -0
- package/dist/src/storage/local-media-store.d.ts +47 -0
- package/dist/src/storage/local-media-store.js +353 -0
- package/dist/src/storage/local-media-store.js.map +1 -0
- package/dist/src/storage/media-admission-service.d.ts +49 -0
- package/dist/src/storage/media-admission-service.js +333 -0
- package/dist/src/storage/media-admission-service.js.map +1 -0
- package/dist/src/storage/media-lifecycle-metrics.d.ts +75 -0
- package/dist/src/storage/media-lifecycle-metrics.js +105 -0
- package/dist/src/storage/media-lifecycle-metrics.js.map +1 -0
- package/dist/src/storage/media-reference-lifecycle.d.ts +16 -0
- package/dist/src/storage/media-reference-lifecycle.js +84 -0
- package/dist/src/storage/media-reference-lifecycle.js.map +1 -0
- package/dist/src/storage/request-media-resolver.d.ts +67 -0
- package/dist/src/storage/request-media-resolver.js +325 -0
- package/dist/src/storage/request-media-resolver.js.map +1 -0
- package/dist/src/storage/session-media-service-factories.d.ts +19 -0
- package/dist/src/storage/session-media-service-factories.js +34 -0
- package/dist/src/storage/session-media-service-factories.js.map +1 -0
- package/dist/src/storage/session-persistence-helpers.d.ts +10 -0
- package/dist/src/storage/session-persistence-helpers.js +46 -0
- package/dist/src/storage/session-persistence-helpers.js.map +1 -0
- package/dist/src/test-utils/config.d.ts +2 -0
- package/dist/src/test-utils/config.js +5 -5
- package/dist/src/test-utils/config.js.map +1 -1
- package/dist/src/test-utils/runtime.d.ts +2 -0
- package/dist/src/test-utils/runtime.js +1 -2
- package/dist/src/test-utils/runtime.js.map +1 -1
- package/dist/src/tools-adapters/CoreShellToolHostAdapter.js +1 -9
- package/dist/src/tools-adapters/CoreShellToolHostAdapter.js.map +1 -1
- package/dist/src/tools-adapters/CoreSkillServiceAdapter.d.ts +0 -2
- package/dist/src/tools-adapters/CoreSkillServiceAdapter.js +0 -17
- package/dist/src/tools-adapters/CoreSkillServiceAdapter.js.map +1 -1
- package/dist/src/tools-adapters/CoreToolHostAdapter.d.ts +0 -21
- package/dist/src/tools-adapters/CoreToolHostAdapter.js +0 -8
- package/dist/src/tools-adapters/CoreToolHostAdapter.js.map +1 -1
- package/dist/src/utils/environmentContext.d.ts +8 -9
- package/dist/src/utils/environmentContext.js +11 -22
- package/dist/src/utils/environmentContext.js.map +1 -1
- package/dist/src/utils/errorParsing.d.ts +1 -2
- package/dist/src/utils/errorParsing.js +22 -41
- package/dist/src/utils/errorParsing.js.map +1 -1
- package/dist/src/utils/generateContentResponseUtilities.js +12 -0
- package/dist/src/utils/generateContentResponseUtilities.js.map +1 -1
- package/dist/src/utils/summarizer.d.ts +1 -2
- package/dist/src/utils/summarizer.js +6 -5
- package/dist/src/utils/summarizer.js.map +1 -1
- package/dist/src/utils/tool-utils.js +7 -1
- package/dist/src/utils/tool-utils.js.map +1 -1
- package/index.ts +0 -4
- package/package.json +38 -30
- package/src/config/agentClientLifecycle.ts +53 -22
- package/src/config/config.ts +11 -26
- package/src/config/configBase.ts +46 -7
- package/src/config/configBaseCore.ts +38 -36
- package/src/config/configMcpRuntime.ts +46 -0
- package/src/config/configMediaDefaults.ts +19 -0
- package/src/config/configTypes.ts +13 -53
- package/src/config/index.ts +1 -4
- package/src/config/models.ts +0 -6
- package/src/config/toolRegistryFactory.ts +2 -2
- package/src/core/clientContract.ts +4 -6
- package/src/core/compression/transcriptPathNotice.ts +31 -0
- package/src/core/contentGenerator.ts +15 -39
- package/src/core/logger.ts +370 -39
- package/src/core/prompts.ts +4 -114
- package/src/core/turn.ts +3 -3
- package/src/hooks/hookTranslator.ts +6 -4
- package/src/index.ts +7 -7
- package/src/llm-types/index.ts +5 -0
- package/src/llm-types/modelEnvelope.ts +26 -2
- package/src/policy/policies/read-only.toml +0 -5
- package/src/prompt-config/TemplateEngine.ts +0 -3
- package/src/prompt-config/defaults/providers/gemini/core.md +0 -2
- package/src/prompt-config/defaults/providers/gemini/models/gemini-2.5-flash/core.md +0 -2
- package/src/prompt-config/defaults/providers/gemini/models/gemini-2.5-flash/gemini-2-5-flash/core.md +0 -2
- package/src/prompt-config/prompt-loader.ts +7 -8
- package/src/prompt-config/types.ts +0 -1
- package/src/recording/CheckpointService.ts +110 -45
- package/src/recording/HistoryMutationService.ts +28 -3
- package/src/recording/RecordingIntegration.ts +258 -11
- package/src/recording/ReplayEngine.ts +220 -110
- package/src/recording/SessionDiscovery.ts +30 -4
- package/src/recording/SessionRecordingService.ts +253 -55
- package/src/recording/SessionTransitionService.ts +75 -12
- package/src/recording/index.ts +7 -0
- package/src/recording/janitor/cleanupTypes.ts +4 -0
- package/src/recording/janitor/mediaReclamation.ts +295 -0
- package/src/recording/janitor/sessionJanitor.ts +54 -1
- package/src/recording/janitor/sessionScanner.ts +319 -227
- package/src/recording/replay-test-helpers.ts +33 -2
- package/src/recording/replayCheckpointMetadata.ts +115 -0
- package/src/recording/replayErrorFormatting.ts +43 -0
- package/src/recording/resumeSession.ts +10 -0
- package/src/recording/semanticMediaPurgeReplayValidation.ts +35 -0
- package/src/recording/session-media-package-blobs.ts +116 -0
- package/src/recording/session-media-package-import.ts +189 -0
- package/src/recording/session-media-package-state.ts +120 -0
- package/src/recording/session-media-package-validation.ts +400 -0
- package/src/recording/session-media-package-writer.ts +117 -0
- package/src/recording/session-media-package.ts +692 -0
- package/src/recording/types.ts +37 -2
- package/src/runtime/AgentRuntimeContext.ts +28 -5
- package/src/runtime/AgentRuntimeLoader.ts +32 -7
- package/src/runtime/contracts/PromptEstimation.ts +1 -0
- package/src/runtime/contracts/RuntimeProvider.ts +3 -8
- package/src/runtime/contracts/RuntimeProviderManager.ts +0 -2
- package/src/runtime/createAgentRuntimeContext.ts +43 -1
- package/src/runtime/providerRuntimeContext.ts +22 -0
- package/src/runtime/runtimeAdapters.ts +2 -2
- package/src/services/history/ContentConverters.ts +11 -7
- package/src/services/history/HistoryService.ts +71 -696
- package/src/services/history/HistoryServiceCore.ts +1055 -0
- package/src/services/history/IContent.ts +460 -20
- package/src/services/history/contentSize.ts +22 -2
- package/src/services/history/historyChronology.ts +53 -3
- package/src/services/history/historyCloneUtils.ts +26 -22
- package/src/services/history/historyCompressionQueue.ts +102 -0
- package/src/services/history/historyEventTypes.ts +9 -0
- package/src/services/history/historyMutationFailure.ts +33 -0
- package/src/services/history/historyProviderPipeline.ts +19 -5
- package/src/services/history/historyTokenEstimation.ts +9 -5
- package/src/services/history/historyToolNormalization.ts +43 -11
- package/src/services/history/provider-file-binding.ts +115 -0
- package/src/services/history/semantic-media-purge.ts +593 -0
- package/src/storage/SessionPersistenceService.ts +667 -30
- package/src/storage/history-media-ownership.ts +185 -0
- package/src/storage/local-media-store-child.ts +163 -0
- package/src/storage/local-media-store-files.ts +643 -0
- package/src/storage/local-media-store-lock-recovery.ts +159 -0
- package/src/storage/local-media-store-persistence.ts +737 -0
- package/src/storage/local-media-store-quota.ts +111 -0
- package/src/storage/local-media-store-reservations.ts +485 -0
- package/src/storage/local-media-store-types.ts +161 -0
- package/src/storage/local-media-store-validation.ts +643 -0
- package/src/storage/local-media-store.ts +696 -0
- package/src/storage/media-admission-service.ts +512 -0
- package/src/storage/media-lifecycle-metrics.ts +228 -0
- package/src/storage/media-reference-lifecycle.ts +164 -0
- package/src/storage/request-media-resolver.ts +491 -0
- package/src/storage/session-media-service-factories.ts +48 -0
- package/src/storage/session-persistence-helpers.ts +85 -0
- package/src/test-utils/config.ts +7 -5
- package/src/test-utils/runtime.ts +3 -2
- package/src/tools-adapters/CoreShellToolHostAdapter.ts +1 -11
- package/src/tools-adapters/CoreSkillServiceAdapter.ts +0 -23
- package/src/tools-adapters/CoreToolHostAdapter.ts +0 -36
- package/src/utils/environmentContext.ts +11 -30
- package/src/utils/errorParsing.ts +19 -69
- package/src/utils/generateContentResponseUtilities.ts +28 -1
- package/src/utils/summarizer.ts +8 -10
- package/src/utils/tool-utils.ts +7 -1
- package/dist/src/code_assist/codeAssist.d.ts +0 -19
- package/dist/src/code_assist/codeAssist.js +0 -41
- package/dist/src/code_assist/codeAssist.js.map +0 -1
- package/dist/src/code_assist/contentGeneratorAdapters.d.ts +0 -49
- package/dist/src/code_assist/contentGeneratorAdapters.js +0 -197
- package/dist/src/code_assist/contentGeneratorAdapters.js.map +0 -1
- package/dist/src/code_assist/converter.d.ts +0 -74
- package/dist/src/code_assist/converter.js +0 -158
- package/dist/src/code_assist/converter.js.map +0 -1
- package/dist/src/code_assist/googleGenAIWrapper.d.ts +0 -27
- package/dist/src/code_assist/googleGenAIWrapper.js +0 -46
- package/dist/src/code_assist/googleGenAIWrapper.js.map +0 -1
- package/dist/src/code_assist/oauth-credential-storage.d.ts +0 -30
- package/dist/src/code_assist/oauth-credential-storage.js +0 -135
- package/dist/src/code_assist/oauth-credential-storage.js.map +0 -1
- package/dist/src/code_assist/server.d.ts +0 -44
- package/dist/src/code_assist/server.js +0 -154
- package/dist/src/code_assist/server.js.map +0 -1
- package/dist/src/code_assist/setup.d.ts +0 -20
- package/dist/src/code_assist/setup.js +0 -126
- package/dist/src/code_assist/setup.js.map +0 -1
- package/dist/src/code_assist/types.d.ts +0 -161
- package/dist/src/code_assist/types.js +0 -46
- package/dist/src/code_assist/types.js.map +0 -1
- package/dist/src/utils/getFolderStructure.d.ts +0 -31
- package/dist/src/utils/getFolderStructure.js +0 -240
- package/dist/src/utils/getFolderStructure.js.map +0 -1
- package/dist/src/utils/installationManager.d.ts +0 -16
- package/dist/src/utils/installationManager.js +0 -51
- package/dist/src/utils/installationManager.js.map +0 -1
- package/dist/src/utils/llm-edit-fixer.d.ts +0 -25
- package/dist/src/utils/llm-edit-fixer.js +0 -120
- package/dist/src/utils/llm-edit-fixer.js.map +0 -1
- package/src/code_assist/codeAssist.ts +0 -59
- package/src/code_assist/contentGeneratorAdapters.ts +0 -275
- package/src/code_assist/converter.ts +0 -288
- package/src/code_assist/googleGenAIWrapper.ts +0 -90
- package/src/code_assist/oauth-credential-storage.ts +0 -171
- package/src/code_assist/server.ts +0 -263
- package/src/code_assist/setup.ts +0 -189
- package/src/code_assist/types.ts +0 -201
- package/src/utils/getFolderStructure.ts +0 -382
- package/src/utils/installationManager.ts +0 -59
- package/src/utils/llm-edit-fixer.ts +0 -157
|
@@ -5,9 +5,11 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { z } from 'zod';
|
|
8
|
-
import { DEFAULT_GEMINI_FLASH_MODEL } from '../config/models.js';
|
|
9
8
|
import { getResponseText } from '../utils/partUtils.js';
|
|
10
9
|
|
|
10
|
+
// Interim literal; hook-v2 (subissue B of #2614) deletes this fallback with the versioned wire.
|
|
11
|
+
const HOOK_FALLBACK_MODEL = 'gemini-2.5-flash';
|
|
12
|
+
|
|
11
13
|
/**
|
|
12
14
|
* Structural shapes matching the portions of the @google/genai SDK types used
|
|
13
15
|
* by the hook translator's internal plumbing. Defined locally so core does
|
|
@@ -335,8 +337,8 @@ export class HookTranslatorGenAIv1 extends HookTranslator {
|
|
|
335
337
|
return {
|
|
336
338
|
model:
|
|
337
339
|
sdkRequest.model === ''
|
|
338
|
-
?
|
|
339
|
-
: (sdkRequest.model ??
|
|
340
|
+
? HOOK_FALLBACK_MODEL
|
|
341
|
+
: (sdkRequest.model ?? HOOK_FALLBACK_MODEL),
|
|
340
342
|
messages,
|
|
341
343
|
config: {
|
|
342
344
|
temperature: config?.temperature,
|
|
@@ -420,7 +422,7 @@ export class HookTranslatorGenAIv1 extends HookTranslator {
|
|
|
420
422
|
typeof hookRequest.model === 'string' ? hookRequest.model : undefined;
|
|
421
423
|
const result: HookGenerateContentParameters = {
|
|
422
424
|
...baseRequest,
|
|
423
|
-
model: hookModel ?? baseRequest?.model ??
|
|
425
|
+
model: hookModel ?? baseRequest?.model ?? HOOK_FALLBACK_MODEL,
|
|
424
426
|
contents,
|
|
425
427
|
};
|
|
426
428
|
|
package/src/index.ts
CHANGED
|
@@ -110,10 +110,7 @@ export {
|
|
|
110
110
|
hasInteractiveSubagentScheduler,
|
|
111
111
|
} from './core/subagentTypes.js';
|
|
112
112
|
export { buildContinuationDirective } from './core/compression/continuationDirective.js';
|
|
113
|
-
|
|
114
|
-
export * from './code_assist/codeAssist.js';
|
|
115
|
-
export * from './code_assist/server.js';
|
|
116
|
-
export * from './code_assist/types.js';
|
|
113
|
+
export { buildTranscriptPathNotice } from './core/compression/transcriptPathNotice.js';
|
|
117
114
|
|
|
118
115
|
// Export utilities
|
|
119
116
|
export * from './utils/paths.js';
|
|
@@ -125,7 +122,6 @@ export * from './utils/checkpointUtils.js';
|
|
|
125
122
|
export * from './utils/output-format.js';
|
|
126
123
|
export * from './utils/exitCodes.js';
|
|
127
124
|
export * from './utils/refusalNotice.js';
|
|
128
|
-
export * from './utils/getFolderStructure.js';
|
|
129
125
|
export * from './utils/memoryDiscovery.js';
|
|
130
126
|
export * from './utils/gitIgnoreParser.js';
|
|
131
127
|
export * from './utils/gitUtils.js';
|
|
@@ -169,7 +165,6 @@ export {
|
|
|
169
165
|
export * from './utils/browser-profile-discovery.js';
|
|
170
166
|
export * from './utils/errorParsing.js';
|
|
171
167
|
export * from './utils/ignorePatterns.js';
|
|
172
|
-
export { INITIAL_HISTORY_LENGTH } from './utils/environmentContext.js';
|
|
173
168
|
export * from './utils/partUtils.js';
|
|
174
169
|
export * from './utils/ide-trust.js';
|
|
175
170
|
export * from './utils/thoughtUtils.js';
|
|
@@ -251,6 +246,11 @@ export {
|
|
|
251
246
|
getProviderKeyStorage,
|
|
252
247
|
resetProviderKeyStorage,
|
|
253
248
|
} from './storage/provider-key-storage.js';
|
|
249
|
+
export * from './storage/local-media-store.js';
|
|
250
|
+
export * from './storage/SessionPersistenceService.js';
|
|
251
|
+
export * from './storage/media-admission-service.js';
|
|
252
|
+
export * from './storage/request-media-resolver.js';
|
|
253
|
+
export * from './storage/media-lifecycle-metrics.js';
|
|
254
254
|
|
|
255
255
|
// Export services
|
|
256
256
|
export * from './services/fileDiscoveryService.js';
|
|
@@ -505,7 +505,6 @@ export {
|
|
|
505
505
|
MCPOAuthProvider,
|
|
506
506
|
MCPOAuthTokenStorage,
|
|
507
507
|
BaseTokenStore,
|
|
508
|
-
FileTokenStore,
|
|
509
508
|
OAuthUtils,
|
|
510
509
|
getMcpServerOAuthStatus,
|
|
511
510
|
} from '@vybestack/llxprt-code-mcp';
|
|
@@ -528,6 +527,7 @@ export * from './telemetry/uiTelemetry.js';
|
|
|
528
527
|
export { sessionId } from './utils/session.js';
|
|
529
528
|
// Export content interfaces
|
|
530
529
|
export * from './services/history/IContent.js';
|
|
530
|
+
export * from './services/history/semantic-media-purge.js';
|
|
531
531
|
export { ContentConverters } from './services/history/ContentConverters.js';
|
|
532
532
|
// Chronology trace shape (#1721) is part of the public surface so consumers
|
|
533
533
|
// (e.g. the CLI /dumpcontext command) can type the trace without deep-importing.
|
package/src/llm-types/index.ts
CHANGED
|
@@ -65,6 +65,11 @@ export type {
|
|
|
65
65
|
ToolCallBlock,
|
|
66
66
|
ToolResponseBlock,
|
|
67
67
|
MediaBlock,
|
|
68
|
+
InlineMediaBlock,
|
|
69
|
+
MediaReferenceBlock,
|
|
70
|
+
MediaDimensions,
|
|
71
|
+
MediaSemanticMetadata,
|
|
72
|
+
MediaSemanticMetadataValue,
|
|
68
73
|
ThinkingBlock,
|
|
69
74
|
CodeBlock,
|
|
70
75
|
} from '../services/history/IContent.js';
|
|
@@ -22,7 +22,11 @@
|
|
|
22
22
|
* @pseudocode lines 10-52
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
import type {
|
|
25
|
+
import type {
|
|
26
|
+
IContent,
|
|
27
|
+
SemanticMediaPurgeCacheWriteEvidence,
|
|
28
|
+
UsageStats,
|
|
29
|
+
} from '../services/history/IContent.js';
|
|
26
30
|
import type { ToolCallRequest } from './toolCall.js';
|
|
27
31
|
import type { CanonicalFinishReason } from './finishReasons.js';
|
|
28
32
|
import {
|
|
@@ -60,6 +64,7 @@ export interface ModelOutput {
|
|
|
60
64
|
responseId?: string;
|
|
61
65
|
hookRestrictions?: HookRestrictions;
|
|
62
66
|
providerMetadata?: Record<string, unknown>;
|
|
67
|
+
semanticMediaPurgeCacheWriteEvidence?: SemanticMediaPurgeCacheWriteEvidence;
|
|
63
68
|
/**
|
|
64
69
|
* Neutral automatic-function-calling history — a sequence of IContent
|
|
65
70
|
* turns produced by automatic tool invocation during a single generation.
|
|
@@ -160,6 +165,14 @@ export function accumulateModelStreamChunk(
|
|
|
160
165
|
};
|
|
161
166
|
}
|
|
162
167
|
|
|
168
|
+
const semanticMediaPurgeCacheWriteEvidence =
|
|
169
|
+
chunk.semanticMediaPurgeCacheWriteEvidence ??
|
|
170
|
+
acc.semanticMediaPurgeCacheWriteEvidence;
|
|
171
|
+
if (semanticMediaPurgeCacheWriteEvidence !== undefined) {
|
|
172
|
+
result.semanticMediaPurgeCacheWriteEvidence =
|
|
173
|
+
semanticMediaPurgeCacheWriteEvidence;
|
|
174
|
+
}
|
|
175
|
+
|
|
163
176
|
// afcHistory: last-write-wins (chunk overrides acc when present). Carried
|
|
164
177
|
// as neutral IContent[] (REQ-001.4).
|
|
165
178
|
const afcHistory = chunk.afcHistory ?? acc.afcHistory;
|
|
@@ -233,7 +246,7 @@ export function toModelStreamChunk(icontent: IContent): ModelStreamChunk {
|
|
|
233
246
|
// content.metadata.providerMetadata so it never leaks to agents. This is
|
|
234
247
|
// done immutably — the original icontent is never mutated.
|
|
235
248
|
const providerMeta = meta?.providerMetadata;
|
|
236
|
-
|
|
249
|
+
let content: IContent =
|
|
237
250
|
providerMeta !== undefined &&
|
|
238
251
|
'automaticFunctionCallingHistory' in providerMeta
|
|
239
252
|
? {
|
|
@@ -246,8 +259,19 @@ export function toModelStreamChunk(icontent: IContent): ModelStreamChunk {
|
|
|
246
259
|
},
|
|
247
260
|
}
|
|
248
261
|
: icontent;
|
|
262
|
+
const semanticMediaPurgeCacheWriteEvidence =
|
|
263
|
+
meta?.semanticMediaPurgeCacheWriteEvidence;
|
|
264
|
+
if (semanticMediaPurgeCacheWriteEvidence !== undefined) {
|
|
265
|
+
const metadata = { ...content.metadata };
|
|
266
|
+
delete metadata.semanticMediaPurgeCacheWriteEvidence;
|
|
267
|
+
content = { ...content, metadata };
|
|
268
|
+
}
|
|
249
269
|
|
|
250
270
|
const result: ModelStreamChunk = { content };
|
|
271
|
+
if (semanticMediaPurgeCacheWriteEvidence !== undefined) {
|
|
272
|
+
result.semanticMediaPurgeCacheWriteEvidence =
|
|
273
|
+
semanticMediaPurgeCacheWriteEvidence;
|
|
274
|
+
}
|
|
251
275
|
|
|
252
276
|
const raw = meta?.stopReason ?? meta?.finishReason;
|
|
253
277
|
if (raw !== undefined) {
|
|
@@ -227,9 +227,6 @@ export class TemplateEngine {
|
|
|
227
227
|
if (env.workingDirectory) {
|
|
228
228
|
variables['WORKING_DIRECTORY'] = env.workingDirectory;
|
|
229
229
|
}
|
|
230
|
-
if (env.folderStructure) {
|
|
231
|
-
variables['FOLDER_STRUCTURE'] = env.folderStructure;
|
|
232
|
-
}
|
|
233
230
|
|
|
234
231
|
if (env.sandboxType) {
|
|
235
232
|
variables['SANDBOX_TYPE'] = env.sandboxType;
|
|
@@ -12,8 +12,6 @@ You are LLxprt Code running on {{PLATFORM}} with {{MODEL}} via {{PROVIDER}}.
|
|
|
12
12
|
- Sandbox type: {{SANDBOX_TYPE}}
|
|
13
13
|
- IDE companion available: {{HAS_IDE}}
|
|
14
14
|
|
|
15
|
-
{{FOLDER_STRUCTURE}}
|
|
16
|
-
|
|
17
15
|
You are {{INTERACTION_MODE_LABEL}} CLI agent specializing in software engineering tasks. Your primary goal is to help users safely and efficiently, adhering strictly to the following instructions and utilizing your available tools.
|
|
18
16
|
|
|
19
17
|
# Core Mandates
|
|
@@ -12,8 +12,6 @@ You are LLxprt Code running on {{PLATFORM}} with {{MODEL}} via {{PROVIDER}}.
|
|
|
12
12
|
- Sandbox type: {{SANDBOX_TYPE}}
|
|
13
13
|
- IDE companion available: {{HAS_IDE}}
|
|
14
14
|
|
|
15
|
-
{{FOLDER_STRUCTURE}}
|
|
16
|
-
|
|
17
15
|
You are {{INTERACTION_MODE_LABEL}} CLI agent specializing in software engineering tasks. Your primary goal is to help users safely and efficiently, adhering strictly to the following instructions and utilizing your available tools.
|
|
18
16
|
|
|
19
17
|
# Core Mandates
|
package/src/prompt-config/defaults/providers/gemini/models/gemini-2.5-flash/gemini-2-5-flash/core.md
CHANGED
|
@@ -12,8 +12,6 @@ You are LLxprt Code running on {{PLATFORM}} with {{MODEL}} via {{PROVIDER}}.
|
|
|
12
12
|
- Sandbox type: {{SANDBOX_TYPE}}
|
|
13
13
|
- IDE companion available: {{HAS_IDE}}
|
|
14
14
|
|
|
15
|
-
{{FOLDER_STRUCTURE}}
|
|
16
|
-
|
|
17
15
|
You are an interactive CLI agent specializing in software engineering tasks. Your primary goal is to help users safely and efficiently, adhering strictly to the following instructions and utilizing your available tools.
|
|
18
16
|
|
|
19
17
|
# Core Mandates
|
|
@@ -294,17 +294,16 @@ export class PromptLoader {
|
|
|
294
294
|
* Load multiple files and return a map of path to content
|
|
295
295
|
*/
|
|
296
296
|
async loadAllFiles(
|
|
297
|
-
baseDir: string,
|
|
298
|
-
fileList: string[],
|
|
297
|
+
baseDir: string | null | undefined,
|
|
298
|
+
fileList: string[] | null | undefined,
|
|
299
299
|
shouldCompress: boolean,
|
|
300
300
|
): Promise<Map<string, string>> {
|
|
301
301
|
// Step 1: Validate inputs
|
|
302
|
-
if (
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
) {
|
|
302
|
+
if (baseDir === null || baseDir === undefined || baseDir === '') {
|
|
303
|
+
return new Map();
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
if (fileList === null || fileList === undefined || fileList.length === 0) {
|
|
308
307
|
return new Map();
|
|
309
308
|
}
|
|
310
309
|
|
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
type LockHandle,
|
|
25
25
|
} from './SessionLockManager.js';
|
|
26
26
|
import { type SessionRecordingService } from './SessionRecordingService.js';
|
|
27
|
+
import type { LocalMediaStore } from '../storage/local-media-store.js';
|
|
27
28
|
import {
|
|
28
29
|
type CheckpointMetadataView,
|
|
29
30
|
type ContinueTarget,
|
|
@@ -47,6 +48,15 @@ type NamedOperation =
|
|
|
47
48
|
|
|
48
49
|
type NamedOperationAction<T> = (name: string) => Promise<T>;
|
|
49
50
|
|
|
51
|
+
interface ClosedCheckpointRename {
|
|
52
|
+
readonly filePath: string;
|
|
53
|
+
readonly projectHash: string;
|
|
54
|
+
readonly chatsDir: string;
|
|
55
|
+
readonly checkpointId: string;
|
|
56
|
+
readonly name: string;
|
|
57
|
+
readonly sessionIds: readonly string[];
|
|
58
|
+
}
|
|
59
|
+
|
|
50
60
|
type FileSnapshot = {
|
|
51
61
|
readonly filePath: string;
|
|
52
62
|
readonly content: Buffer;
|
|
@@ -126,8 +136,9 @@ async function appendEvent(
|
|
|
126
136
|
projectHash: string,
|
|
127
137
|
type: SessionRecordLine['type'],
|
|
128
138
|
payload: unknown,
|
|
139
|
+
mediaStore: LocalMediaStore | undefined,
|
|
129
140
|
): Promise<void> {
|
|
130
|
-
const replay = await replaySession(filePath, projectHash);
|
|
141
|
+
const replay = await replaySession(filePath, projectHash, { mediaStore });
|
|
131
142
|
if (!replay.ok) throw new Error(replay.error);
|
|
132
143
|
if (replay.sequenceCorrupt) {
|
|
133
144
|
throw new Error('Cannot append metadata to a sequence-corrupt recording');
|
|
@@ -143,12 +154,18 @@ async function appendEvent(
|
|
|
143
154
|
}
|
|
144
155
|
|
|
145
156
|
export class CheckpointService {
|
|
157
|
+
constructor(private readonly mediaStore?: LocalMediaStore) {}
|
|
158
|
+
|
|
146
159
|
async listCheckpoints(
|
|
147
160
|
filePath: string,
|
|
148
161
|
projectHash: string,
|
|
149
162
|
): Promise<readonly CheckpointMetadataView[]> {
|
|
150
|
-
const result = await replaySession(filePath, projectHash
|
|
151
|
-
|
|
163
|
+
const result = await replaySession(filePath, projectHash, {
|
|
164
|
+
mediaStore: this.mediaStore,
|
|
165
|
+
});
|
|
166
|
+
if (!result.ok) {
|
|
167
|
+
throw new Error(`Cannot list checkpoints: ${result.error}`);
|
|
168
|
+
}
|
|
152
169
|
return (result.checkpoints ?? []).filter(
|
|
153
170
|
(checkpoint) => !checkpoint.deleted,
|
|
154
171
|
);
|
|
@@ -158,7 +175,9 @@ export class CheckpointService {
|
|
|
158
175
|
filePath: string,
|
|
159
176
|
projectHash: string,
|
|
160
177
|
): Promise<readonly CheckpointMetadataView[]> {
|
|
161
|
-
const result = await replaySession(filePath, projectHash
|
|
178
|
+
const result = await replaySession(filePath, projectHash, {
|
|
179
|
+
mediaStore: this.mediaStore,
|
|
180
|
+
});
|
|
162
181
|
if (!result.ok) {
|
|
163
182
|
throw new Error(`Cannot verify checkpoint blockers: ${result.error}`);
|
|
164
183
|
}
|
|
@@ -233,14 +252,75 @@ export class CheckpointService {
|
|
|
233
252
|
const lock = await this.acquireLock(chatsDir, sourceSessionId);
|
|
234
253
|
try {
|
|
235
254
|
await this.requireLiveCheckpoint(filePath, projectHash, checkpointId);
|
|
236
|
-
await appendEvent(
|
|
237
|
-
|
|
238
|
-
|
|
255
|
+
await appendEvent(
|
|
256
|
+
filePath,
|
|
257
|
+
projectHash,
|
|
258
|
+
'checkpoint_deleted',
|
|
259
|
+
{ checkpointId },
|
|
260
|
+
this.mediaStore,
|
|
261
|
+
);
|
|
239
262
|
} finally {
|
|
240
263
|
await lock.release().catch(() => undefined);
|
|
241
264
|
}
|
|
242
265
|
}
|
|
243
266
|
|
|
267
|
+
private async renameCheckpointUnderSessionLocks(
|
|
268
|
+
input: ClosedCheckpointRename,
|
|
269
|
+
): Promise<void> {
|
|
270
|
+
const operation: NamedOperation = {
|
|
271
|
+
kind: 'rename',
|
|
272
|
+
checkpointId: input.checkpointId,
|
|
273
|
+
name: input.name,
|
|
274
|
+
};
|
|
275
|
+
const locks = await this.acquireSessionLocks(
|
|
276
|
+
input.chatsDir,
|
|
277
|
+
input.sessionIds,
|
|
278
|
+
);
|
|
279
|
+
try {
|
|
280
|
+
const refreshedCollisions = (
|
|
281
|
+
await SessionDiscovery.listContinueTargets(
|
|
282
|
+
input.chatsDir,
|
|
283
|
+
input.projectHash,
|
|
284
|
+
this.mediaStore,
|
|
285
|
+
)
|
|
286
|
+
).filter(
|
|
287
|
+
(target) =>
|
|
288
|
+
targetName(target) === input.name &&
|
|
289
|
+
!isSameReference(target, operation),
|
|
290
|
+
);
|
|
291
|
+
const lockedIds = new Set(input.sessionIds);
|
|
292
|
+
if (
|
|
293
|
+
refreshedCollisions.some(
|
|
294
|
+
(target) => !lockedIds.has(targetSessionId(target)),
|
|
295
|
+
)
|
|
296
|
+
) {
|
|
297
|
+
throw new Error(`Name '${input.name}' changed while acquiring locks`);
|
|
298
|
+
}
|
|
299
|
+
await this.requireLiveCheckpoint(
|
|
300
|
+
input.filePath,
|
|
301
|
+
input.projectHash,
|
|
302
|
+
input.checkpointId,
|
|
303
|
+
);
|
|
304
|
+
const snapshots = await captureFiles(refreshedCollisions);
|
|
305
|
+
await runWithFileRollback(snapshots, async () => {
|
|
306
|
+
for (const collision of refreshedCollisions) {
|
|
307
|
+
await this.tombstoneClosedCollision(collision, input.projectHash);
|
|
308
|
+
}
|
|
309
|
+
await appendEvent(
|
|
310
|
+
input.filePath,
|
|
311
|
+
input.projectHash,
|
|
312
|
+
'checkpoint_renamed',
|
|
313
|
+
{ checkpointId: input.checkpointId, name: input.name },
|
|
314
|
+
this.mediaStore,
|
|
315
|
+
);
|
|
316
|
+
});
|
|
317
|
+
} finally {
|
|
318
|
+
for (const lock of [...locks].reverse()) {
|
|
319
|
+
await lock.release().catch(() => undefined);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
|
|
244
324
|
async renameCheckpointClosed(
|
|
245
325
|
filePath: string,
|
|
246
326
|
projectHash: string,
|
|
@@ -259,6 +339,7 @@ export class CheckpointService {
|
|
|
259
339
|
const targets = await SessionDiscovery.listContinueTargets(
|
|
260
340
|
chatsDir,
|
|
261
341
|
projectHash,
|
|
342
|
+
this.mediaStore,
|
|
262
343
|
);
|
|
263
344
|
const reservedIdentity = targets.find((target) =>
|
|
264
345
|
target.kind === 'session'
|
|
@@ -283,39 +364,14 @@ export class CheckpointService {
|
|
|
283
364
|
const sessionIds = [
|
|
284
365
|
...new Set([sourceSessionId, ...collisions.map(targetSessionId)]),
|
|
285
366
|
].sort((left, right) => left.localeCompare(right));
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
);
|
|
295
|
-
const lockedIds = new Set(sessionIds);
|
|
296
|
-
if (
|
|
297
|
-
refreshedCollisions.some(
|
|
298
|
-
(target) => !lockedIds.has(targetSessionId(target)),
|
|
299
|
-
)
|
|
300
|
-
) {
|
|
301
|
-
throw new Error(`Name '${trimmed}' changed while acquiring locks`);
|
|
302
|
-
}
|
|
303
|
-
await this.requireLiveCheckpoint(filePath, projectHash, checkpointId);
|
|
304
|
-
const snapshots = await captureFiles(refreshedCollisions);
|
|
305
|
-
await runWithFileRollback(snapshots, async () => {
|
|
306
|
-
for (const collision of refreshedCollisions) {
|
|
307
|
-
await this.tombstoneClosedCollision(collision, projectHash);
|
|
308
|
-
}
|
|
309
|
-
await appendEvent(filePath, projectHash, 'checkpoint_renamed', {
|
|
310
|
-
checkpointId,
|
|
311
|
-
name: trimmed,
|
|
312
|
-
});
|
|
313
|
-
});
|
|
314
|
-
} finally {
|
|
315
|
-
for (const lock of [...locks].reverse()) {
|
|
316
|
-
await lock.release().catch(() => undefined);
|
|
317
|
-
}
|
|
318
|
-
}
|
|
367
|
+
await this.renameCheckpointUnderSessionLocks({
|
|
368
|
+
filePath,
|
|
369
|
+
projectHash,
|
|
370
|
+
chatsDir,
|
|
371
|
+
checkpointId,
|
|
372
|
+
name: trimmed,
|
|
373
|
+
sessionIds,
|
|
374
|
+
});
|
|
319
375
|
} finally {
|
|
320
376
|
await namespaceLock.release().catch(() => undefined);
|
|
321
377
|
}
|
|
@@ -337,6 +393,7 @@ export class CheckpointService {
|
|
|
337
393
|
const targets = await SessionDiscovery.listContinueTargets(
|
|
338
394
|
chatsDir,
|
|
339
395
|
projectHash,
|
|
396
|
+
this.mediaStore,
|
|
340
397
|
);
|
|
341
398
|
const collision = targets.find(
|
|
342
399
|
(target) =>
|
|
@@ -350,7 +407,9 @@ export class CheckpointService {
|
|
|
350
407
|
}
|
|
351
408
|
const lock = await this.acquireLock(chatsDir, sourceSessionId);
|
|
352
409
|
try {
|
|
353
|
-
const replay = await replaySession(filePath, projectHash
|
|
410
|
+
const replay = await replaySession(filePath, projectHash, {
|
|
411
|
+
mediaStore: this.mediaStore,
|
|
412
|
+
});
|
|
354
413
|
if (!replay.ok) throw new Error(replay.error);
|
|
355
414
|
if (replay.sequenceCorrupt) {
|
|
356
415
|
throw new Error(
|
|
@@ -399,6 +458,7 @@ export class CheckpointService {
|
|
|
399
458
|
const targets = await SessionDiscovery.listContinueTargets(
|
|
400
459
|
chatsDir,
|
|
401
460
|
projectHash,
|
|
461
|
+
this.mediaStore,
|
|
402
462
|
);
|
|
403
463
|
const reservedIdentity = targets.find((target) =>
|
|
404
464
|
target.kind === 'session'
|
|
@@ -479,6 +539,7 @@ export class CheckpointService {
|
|
|
479
539
|
projectHash,
|
|
480
540
|
'checkpoint_deleted',
|
|
481
541
|
{ checkpointId: collision.checkpointId },
|
|
542
|
+
this.mediaStore,
|
|
482
543
|
);
|
|
483
544
|
return;
|
|
484
545
|
}
|
|
@@ -486,9 +547,8 @@ export class CheckpointService {
|
|
|
486
547
|
collision.session.filePath,
|
|
487
548
|
projectHash,
|
|
488
549
|
'session_named',
|
|
489
|
-
{
|
|
490
|
-
|
|
491
|
-
},
|
|
550
|
+
{ name: null },
|
|
551
|
+
this.mediaStore,
|
|
492
552
|
);
|
|
493
553
|
}
|
|
494
554
|
|
|
@@ -525,6 +585,7 @@ export class CheckpointService {
|
|
|
525
585
|
const refreshed = await SessionDiscovery.listContinueTargets(
|
|
526
586
|
chatsDir,
|
|
527
587
|
projectHash,
|
|
588
|
+
this.mediaStore,
|
|
528
589
|
);
|
|
529
590
|
const collisions = refreshed.filter(
|
|
530
591
|
(target) =>
|
|
@@ -561,6 +622,7 @@ export class CheckpointService {
|
|
|
561
622
|
projectHash,
|
|
562
623
|
'checkpoint_deleted',
|
|
563
624
|
{ checkpointId: collision.checkpointId },
|
|
625
|
+
this.mediaStore,
|
|
564
626
|
);
|
|
565
627
|
return;
|
|
566
628
|
}
|
|
@@ -581,6 +643,7 @@ export class CheckpointService {
|
|
|
581
643
|
projectHash,
|
|
582
644
|
'session_named',
|
|
583
645
|
{ name: null },
|
|
646
|
+
this.mediaStore,
|
|
584
647
|
);
|
|
585
648
|
}
|
|
586
649
|
|
|
@@ -615,7 +678,9 @@ export class CheckpointService {
|
|
|
615
678
|
projectHash: string,
|
|
616
679
|
checkpointId: string,
|
|
617
680
|
): Promise<CheckpointMetadataView> {
|
|
618
|
-
const result = await replaySession(filePath, projectHash
|
|
681
|
+
const result = await replaySession(filePath, projectHash, {
|
|
682
|
+
mediaStore: this.mediaStore,
|
|
683
|
+
});
|
|
619
684
|
if (!result.ok) throw new Error(result.error);
|
|
620
685
|
const checkpoint = result.checkpoints?.find(
|
|
621
686
|
(candidate) => candidate.checkpointId === checkpointId,
|
|
@@ -109,6 +109,27 @@ function computeRestoreCut(
|
|
|
109
109
|
};
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
+
/**
|
|
113
|
+
* Resolve the chronology identity of the cut point so replay can reproduce the
|
|
114
|
+
* cut without depending on live and journalled history having the same length.
|
|
115
|
+
*
|
|
116
|
+
* The cut point is the first removed item. The journal is append-only, so an
|
|
117
|
+
* item present in live history when the cut was computed is also present in the
|
|
118
|
+
* replayed history and can be found there by its marker.
|
|
119
|
+
*
|
|
120
|
+
* Returns `undefined` when the item carries no usable marker, in which case the
|
|
121
|
+
* rewind is recorded as a bare count exactly as it always has been.
|
|
122
|
+
*
|
|
123
|
+
* @issue #2934
|
|
124
|
+
*/
|
|
125
|
+
function resolveCutSeq(cutItem: IContent | undefined): number | undefined {
|
|
126
|
+
const seq = cutItem?.metadata?.chronology?.seq;
|
|
127
|
+
if (typeof seq !== 'number' || !Number.isSafeInteger(seq) || seq < 0) {
|
|
128
|
+
return undefined;
|
|
129
|
+
}
|
|
130
|
+
return seq;
|
|
131
|
+
}
|
|
132
|
+
|
|
112
133
|
/**
|
|
113
134
|
* Service for durable history mutations that persist rewind semantics.
|
|
114
135
|
*/
|
|
@@ -122,9 +143,12 @@ export class HistoryMutationService {
|
|
|
122
143
|
async clear(
|
|
123
144
|
history: readonly IContent[],
|
|
124
145
|
recording: SessionRecordingService,
|
|
146
|
+
beforeCommit?: (remainingHistory: readonly IContent[]) => Promise<void>,
|
|
125
147
|
): Promise<HistoryMutationResult | HistoryMutationError> {
|
|
126
148
|
const { cutIndex, removed } = computeClearCut(history);
|
|
127
|
-
|
|
149
|
+
const remaining = history.slice(0, cutIndex);
|
|
150
|
+
await beforeCommit?.(remaining);
|
|
151
|
+
return this.applyMutation(remaining, removed, recording);
|
|
128
152
|
}
|
|
129
153
|
|
|
130
154
|
/**
|
|
@@ -170,8 +194,9 @@ export class HistoryMutationService {
|
|
|
170
194
|
return { ok: false, error: 'Recording is not active' };
|
|
171
195
|
}
|
|
172
196
|
|
|
173
|
-
// 2. Durably append the rewind event
|
|
174
|
-
|
|
197
|
+
// 2. Durably append the rewind event, identifying the cut point by
|
|
198
|
+
// chronology so replay does not depend on offsets (#2934).
|
|
199
|
+
recording.recordRewind(removed.length, resolveCutSeq(removed[0]));
|
|
175
200
|
|
|
176
201
|
// 3. Flush the rewind.
|
|
177
202
|
await recording.flush();
|