@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
package/src/code_assist/types.ts
DELETED
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2025 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
export interface ClientMetadata {
|
|
8
|
-
ideType?: ClientMetadataIdeType;
|
|
9
|
-
ideVersion?: string;
|
|
10
|
-
pluginVersion?: string;
|
|
11
|
-
platform?: ClientMetadataPlatform;
|
|
12
|
-
updateChannel?: string;
|
|
13
|
-
duetProject?: string;
|
|
14
|
-
pluginType?: ClientMetadataPluginType;
|
|
15
|
-
ideName?: string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export type ClientMetadataIdeType =
|
|
19
|
-
| 'IDE_UNSPECIFIED'
|
|
20
|
-
| 'VSCODE'
|
|
21
|
-
| 'INTELLIJ'
|
|
22
|
-
| 'VSCODE_CLOUD_WORKSTATION'
|
|
23
|
-
| 'INTELLIJ_CLOUD_WORKSTATION'
|
|
24
|
-
| 'CLOUD_SHELL';
|
|
25
|
-
export type ClientMetadataPlatform =
|
|
26
|
-
| 'PLATFORM_UNSPECIFIED'
|
|
27
|
-
| 'DARWIN_AMD64'
|
|
28
|
-
| 'DARWIN_ARM64'
|
|
29
|
-
| 'LINUX_AMD64'
|
|
30
|
-
| 'LINUX_ARM64'
|
|
31
|
-
| 'WINDOWS_AMD64';
|
|
32
|
-
export type ClientMetadataPluginType =
|
|
33
|
-
| 'PLUGIN_UNSPECIFIED'
|
|
34
|
-
| 'CLOUD_CODE'
|
|
35
|
-
| 'GEMINI'
|
|
36
|
-
| 'AIPLUGIN_INTELLIJ'
|
|
37
|
-
| 'AIPLUGIN_STUDIO';
|
|
38
|
-
|
|
39
|
-
export interface LoadCodeAssistRequest {
|
|
40
|
-
cloudaicompanionProject?: string;
|
|
41
|
-
metadata: ClientMetadata;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Represents LoadCodeAssistResponse proto json field
|
|
46
|
-
* http://google3/google/internal/cloud/code/v1internal/cloudcode.proto;l=224
|
|
47
|
-
*/
|
|
48
|
-
export interface LoadCodeAssistResponse {
|
|
49
|
-
currentTier?: GeminiUserTier | null;
|
|
50
|
-
allowedTiers?: GeminiUserTier[] | null;
|
|
51
|
-
ineligibleTiers?: IneligibleTier[] | null;
|
|
52
|
-
cloudaicompanionProject?: string | null;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* GeminiUserTier reflects the structure received from the CodeAssist when calling LoadCodeAssist.
|
|
57
|
-
*/
|
|
58
|
-
export interface GeminiUserTier {
|
|
59
|
-
id: UserTierId;
|
|
60
|
-
name: string;
|
|
61
|
-
description: string;
|
|
62
|
-
// This value is used to declare whether a given tier requires the user to configure the project setting on the IDE settings or not.
|
|
63
|
-
userDefinedCloudaicompanionProject?: boolean | null;
|
|
64
|
-
isDefault?: boolean;
|
|
65
|
-
privacyNotice?: PrivacyNotice;
|
|
66
|
-
hasAcceptedTos?: boolean;
|
|
67
|
-
hasOnboardedPreviously?: boolean;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
/**
|
|
71
|
-
* Includes information specifying the reasons for a user's ineligibility for a specific tier.
|
|
72
|
-
* @param reasonCode mnemonic code representing the reason for in-eligibility.
|
|
73
|
-
* @param reasonMessage message to display to the user.
|
|
74
|
-
* @param tierId id of the tier.
|
|
75
|
-
* @param tierName name of the tier.
|
|
76
|
-
*/
|
|
77
|
-
export interface IneligibleTier {
|
|
78
|
-
reasonCode: IneligibleTierReasonCode;
|
|
79
|
-
reasonMessage: string;
|
|
80
|
-
tierId: UserTierId;
|
|
81
|
-
tierName: string;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* List of predefined reason codes when a tier is blocked from a specific tier.
|
|
86
|
-
* https://source.corp.google.com/piper///depot/google3/google/internal/cloud/code/v1internal/cloudcode.proto;l=378
|
|
87
|
-
*/
|
|
88
|
-
export enum IneligibleTierReasonCode {
|
|
89
|
-
// go/keep-sorted start
|
|
90
|
-
DASHER_USER = 'DASHER_USER',
|
|
91
|
-
INELIGIBLE_ACCOUNT = 'INELIGIBLE_ACCOUNT',
|
|
92
|
-
NON_USER_ACCOUNT = 'NON_USER_ACCOUNT',
|
|
93
|
-
RESTRICTED_AGE = 'RESTRICTED_AGE',
|
|
94
|
-
RESTRICTED_NETWORK = 'RESTRICTED_NETWORK',
|
|
95
|
-
UNKNOWN = 'UNKNOWN',
|
|
96
|
-
UNKNOWN_LOCATION = 'UNKNOWN_LOCATION',
|
|
97
|
-
UNSUPPORTED_LOCATION = 'UNSUPPORTED_LOCATION',
|
|
98
|
-
// go/keep-sorted end
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* UserTierId represents IDs returned from the Cloud Code Private API representing a user's tier
|
|
102
|
-
*
|
|
103
|
-
* //depot/google3/cloud/developer_experience/cloudcode/pa/service/usertier.go;l=16
|
|
104
|
-
*/
|
|
105
|
-
export enum UserTierId {
|
|
106
|
-
FREE = 'free-tier',
|
|
107
|
-
LEGACY = 'legacy-tier',
|
|
108
|
-
STANDARD = 'standard-tier',
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* PrivacyNotice reflects the structure received from the CodeAssist in regards to a tier
|
|
113
|
-
* privacy notice.
|
|
114
|
-
*/
|
|
115
|
-
export interface PrivacyNotice {
|
|
116
|
-
showNotice: boolean;
|
|
117
|
-
noticeText?: string;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Proto signature of OnboardUserRequest as payload to OnboardUser call
|
|
122
|
-
*/
|
|
123
|
-
export interface OnboardUserRequest {
|
|
124
|
-
tierId: string | undefined;
|
|
125
|
-
cloudaicompanionProject: string | undefined;
|
|
126
|
-
metadata: ClientMetadata | undefined;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Represents LongRunningOperation proto
|
|
131
|
-
* http://google3/google/longrunning/operations.proto;rcl=698857719;l=107
|
|
132
|
-
*/
|
|
133
|
-
export interface LongRunningOperationResponse {
|
|
134
|
-
name: string;
|
|
135
|
-
done?: boolean;
|
|
136
|
-
response?: OnboardUserResponse;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Represents OnboardUserResponse proto
|
|
141
|
-
* http://google3/google/internal/cloud/code/v1internal/cloudcode.proto;l=215
|
|
142
|
-
*/
|
|
143
|
-
export interface OnboardUserResponse {
|
|
144
|
-
// tslint:disable-next-line:enforce-name-casing This is the name of the field in the proto.
|
|
145
|
-
cloudaicompanionProject?: {
|
|
146
|
-
id: string;
|
|
147
|
-
name: string;
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* Status code of user license status
|
|
153
|
-
* it does not strictly correspond to the proto
|
|
154
|
-
* Error value is an additional value assigned to error responses from OnboardUser
|
|
155
|
-
*/
|
|
156
|
-
export enum OnboardUserStatusCode {
|
|
157
|
-
Default = 'DEFAULT',
|
|
158
|
-
Notice = 'NOTICE',
|
|
159
|
-
Warning = 'WARNING',
|
|
160
|
-
Error = 'ERROR',
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* Status of user onboarded to gemini
|
|
165
|
-
*/
|
|
166
|
-
export interface OnboardUserStatus {
|
|
167
|
-
statusCode: OnboardUserStatusCode;
|
|
168
|
-
displayMessage: string;
|
|
169
|
-
helpLink: HelpLinkUrl | undefined;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
export interface HelpLinkUrl {
|
|
173
|
-
description: string;
|
|
174
|
-
url: string;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
export interface SetCodeAssistGlobalUserSettingRequest {
|
|
178
|
-
cloudaicompanionProject?: string;
|
|
179
|
-
freeTierDataCollectionOptin: boolean;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
export interface CodeAssistGlobalUserSettingResponse {
|
|
183
|
-
cloudaicompanionProject?: string;
|
|
184
|
-
freeTierDataCollectionOptin: boolean;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
export interface BucketInfo {
|
|
188
|
-
remainingAmount?: string;
|
|
189
|
-
remainingFraction?: number;
|
|
190
|
-
resetTime?: string;
|
|
191
|
-
tokenType?: string;
|
|
192
|
-
modelId?: string;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
export interface RetrieveUserQuotaRequest {
|
|
196
|
-
project: string;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
export interface RetrieveUserQuotaResponse {
|
|
200
|
-
buckets?: BucketInfo[];
|
|
201
|
-
}
|
|
@@ -1,382 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2025 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import * as fs from 'fs/promises';
|
|
8
|
-
import type { Dirent } from 'fs';
|
|
9
|
-
import * as path from 'path';
|
|
10
|
-
import { getErrorMessage, isNodeError } from './errors.js';
|
|
11
|
-
import type { FileDiscoveryService } from '../services/fileDiscoveryService.js';
|
|
12
|
-
import type { FileFilteringOptions } from '../config/constants.js';
|
|
13
|
-
import { DEFAULT_FILE_FILTERING_OPTIONS } from '../config/constants.js';
|
|
14
|
-
import { debugLogger } from './debugLogger.js';
|
|
15
|
-
|
|
16
|
-
const MAX_ITEMS = 200;
|
|
17
|
-
const TRUNCATION_INDICATOR = '...';
|
|
18
|
-
|
|
19
|
-
function getChildIndent(isLastChildOfParent: boolean): string {
|
|
20
|
-
return isLastChildOfParent ? ' ' : '│ ';
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const DEFAULT_IGNORED_FOLDERS = new Set([
|
|
24
|
-
'node_modules',
|
|
25
|
-
'.git',
|
|
26
|
-
'dist',
|
|
27
|
-
'__pycache__',
|
|
28
|
-
]);
|
|
29
|
-
|
|
30
|
-
// --- Interfaces ---
|
|
31
|
-
|
|
32
|
-
/** Options for customizing folder structure retrieval. */
|
|
33
|
-
interface FolderStructureOptions {
|
|
34
|
-
/** Maximum number of files and folders combined to display. Defaults to 200. */
|
|
35
|
-
maxItems?: number;
|
|
36
|
-
/** Set of folder names to ignore completely. Case-sensitive. */
|
|
37
|
-
ignoredFolders?: Set<string>;
|
|
38
|
-
/** Optional regex to filter included files by name. */
|
|
39
|
-
fileIncludePattern?: RegExp;
|
|
40
|
-
/** For filtering files. */
|
|
41
|
-
fileService?: FileDiscoveryService;
|
|
42
|
-
/** File filtering ignore options. */
|
|
43
|
-
fileFilteringOptions?: FileFilteringOptions;
|
|
44
|
-
}
|
|
45
|
-
// Define a type for the merged options where fileIncludePattern remains optional
|
|
46
|
-
type MergedFolderStructureOptions = Required<
|
|
47
|
-
Omit<FolderStructureOptions, 'fileIncludePattern' | 'fileService'>
|
|
48
|
-
> & {
|
|
49
|
-
fileIncludePattern?: RegExp;
|
|
50
|
-
fileService?: FileDiscoveryService;
|
|
51
|
-
fileFilteringOptions?: FileFilteringOptions;
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
/** Represents the full, unfiltered information about a folder and its contents. */
|
|
55
|
-
interface FullFolderInfo {
|
|
56
|
-
name: string;
|
|
57
|
-
path: string;
|
|
58
|
-
files: string[];
|
|
59
|
-
subFolders: FullFolderInfo[];
|
|
60
|
-
totalChildren: number; // Number of files and subfolders included from this folder during BFS scan
|
|
61
|
-
totalFiles: number; // Number of files included from this folder during BFS scan
|
|
62
|
-
isIgnored?: boolean; // Flag to easily identify ignored folders later
|
|
63
|
-
hasMoreFiles?: boolean; // Indicates if files were truncated for this specific folder
|
|
64
|
-
hasMoreSubfolders?: boolean; // Indicates if subfolders were truncated for this specific folder
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// --- Interfaces ---
|
|
68
|
-
|
|
69
|
-
// --- Helper Functions ---
|
|
70
|
-
|
|
71
|
-
function shouldIgnorePath(
|
|
72
|
-
filePath: string,
|
|
73
|
-
fileService: FileDiscoveryService | undefined,
|
|
74
|
-
fileFilteringOptions: FileFilteringOptions,
|
|
75
|
-
): boolean {
|
|
76
|
-
if (!fileService) return false;
|
|
77
|
-
// Delegate to the unified decision path so that .llxprtignore negations
|
|
78
|
-
// can un-ignore gitignored files when both flags are true.
|
|
79
|
-
return fileService.shouldIgnoreFile(filePath, fileFilteringOptions);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
async function readDirectoryEntries(
|
|
83
|
-
currentPath: string,
|
|
84
|
-
rootPath: string,
|
|
85
|
-
): Promise<Dirent[] | null> {
|
|
86
|
-
try {
|
|
87
|
-
const rawEntries = await fs.readdir(currentPath, { withFileTypes: true });
|
|
88
|
-
return rawEntries.sort((a, b) => a.name.localeCompare(b.name));
|
|
89
|
-
} catch (error: unknown) {
|
|
90
|
-
if (
|
|
91
|
-
isNodeError(error) &&
|
|
92
|
-
(error.code === 'EACCES' || error.code === 'ENOENT')
|
|
93
|
-
) {
|
|
94
|
-
debugLogger.warn(
|
|
95
|
-
`Warning: Could not read directory ${currentPath}: ${error.message}`,
|
|
96
|
-
);
|
|
97
|
-
if (currentPath === rootPath && error.code === 'ENOENT') {
|
|
98
|
-
return null;
|
|
99
|
-
}
|
|
100
|
-
return [];
|
|
101
|
-
}
|
|
102
|
-
throw error;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
function collectFilesFromEntries(
|
|
107
|
-
entries: Dirent[],
|
|
108
|
-
currentPath: string,
|
|
109
|
-
folderInfo: FullFolderInfo,
|
|
110
|
-
options: MergedFolderStructureOptions,
|
|
111
|
-
itemCount: { count: number },
|
|
112
|
-
): string[] {
|
|
113
|
-
const filesInCurrentDir: string[] = [];
|
|
114
|
-
const fileEntries = entries.filter((e) => e.isFile());
|
|
115
|
-
for (const entry of fileEntries) {
|
|
116
|
-
if (itemCount.count >= options.maxItems) {
|
|
117
|
-
folderInfo.hasMoreFiles = true;
|
|
118
|
-
break;
|
|
119
|
-
}
|
|
120
|
-
const fileName = entry.name;
|
|
121
|
-
const filePath = path.join(currentPath, fileName);
|
|
122
|
-
if (
|
|
123
|
-
!shouldIgnorePath(
|
|
124
|
-
filePath,
|
|
125
|
-
options.fileService,
|
|
126
|
-
options.fileFilteringOptions,
|
|
127
|
-
) &&
|
|
128
|
-
(!options.fileIncludePattern || options.fileIncludePattern.test(fileName))
|
|
129
|
-
) {
|
|
130
|
-
filesInCurrentDir.push(fileName);
|
|
131
|
-
itemCount.count++;
|
|
132
|
-
folderInfo.totalFiles++;
|
|
133
|
-
folderInfo.totalChildren++;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
return filesInCurrentDir;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
function collectSubFoldersFromEntries(
|
|
140
|
-
entries: Dirent[],
|
|
141
|
-
currentPath: string,
|
|
142
|
-
folderInfo: FullFolderInfo,
|
|
143
|
-
options: MergedFolderStructureOptions,
|
|
144
|
-
itemCount: { count: number },
|
|
145
|
-
queue: Array<{ folderInfo: FullFolderInfo; currentPath: string }>,
|
|
146
|
-
): FullFolderInfo[] {
|
|
147
|
-
const subFoldersInCurrentDir: FullFolderInfo[] = [];
|
|
148
|
-
const dirEntries = entries.filter((e) => e.isDirectory());
|
|
149
|
-
for (const entry of dirEntries) {
|
|
150
|
-
if (itemCount.count >= options.maxItems) {
|
|
151
|
-
folderInfo.hasMoreSubfolders = true;
|
|
152
|
-
break;
|
|
153
|
-
}
|
|
154
|
-
const subFolderName = entry.name;
|
|
155
|
-
const subFolderPath = path.join(currentPath, subFolderName);
|
|
156
|
-
|
|
157
|
-
const isIgnored = shouldIgnorePath(
|
|
158
|
-
subFolderPath,
|
|
159
|
-
options.fileService,
|
|
160
|
-
options.fileFilteringOptions,
|
|
161
|
-
);
|
|
162
|
-
if (options.ignoredFolders.has(subFolderName) || isIgnored) {
|
|
163
|
-
subFoldersInCurrentDir.push({
|
|
164
|
-
name: subFolderName,
|
|
165
|
-
path: subFolderPath,
|
|
166
|
-
files: [],
|
|
167
|
-
subFolders: [],
|
|
168
|
-
totalChildren: 0,
|
|
169
|
-
totalFiles: 0,
|
|
170
|
-
isIgnored: true,
|
|
171
|
-
});
|
|
172
|
-
itemCount.count++;
|
|
173
|
-
folderInfo.totalChildren++;
|
|
174
|
-
} else {
|
|
175
|
-
const subFolderNode: FullFolderInfo = {
|
|
176
|
-
name: subFolderName,
|
|
177
|
-
path: subFolderPath,
|
|
178
|
-
files: [],
|
|
179
|
-
subFolders: [],
|
|
180
|
-
totalChildren: 0,
|
|
181
|
-
totalFiles: 0,
|
|
182
|
-
};
|
|
183
|
-
subFoldersInCurrentDir.push(subFolderNode);
|
|
184
|
-
itemCount.count++;
|
|
185
|
-
folderInfo.totalChildren++;
|
|
186
|
-
queue.push({ folderInfo: subFolderNode, currentPath: subFolderPath });
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
return subFoldersInCurrentDir;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
async function readFullStructure(
|
|
193
|
-
rootPath: string,
|
|
194
|
-
options: MergedFolderStructureOptions,
|
|
195
|
-
): Promise<FullFolderInfo | null> {
|
|
196
|
-
const rootNode: FullFolderInfo = {
|
|
197
|
-
name: path.basename(rootPath),
|
|
198
|
-
path: rootPath,
|
|
199
|
-
files: [],
|
|
200
|
-
subFolders: [],
|
|
201
|
-
totalChildren: 0,
|
|
202
|
-
totalFiles: 0,
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
const queue: Array<{ folderInfo: FullFolderInfo; currentPath: string }> = [
|
|
206
|
-
{ folderInfo: rootNode, currentPath: rootPath },
|
|
207
|
-
];
|
|
208
|
-
const itemCount = { count: 0 };
|
|
209
|
-
const processedPaths = new Set<string>();
|
|
210
|
-
|
|
211
|
-
while (queue.length > 0) {
|
|
212
|
-
const { folderInfo, currentPath } = queue.shift()!;
|
|
213
|
-
|
|
214
|
-
if (processedPaths.has(currentPath)) {
|
|
215
|
-
continue;
|
|
216
|
-
}
|
|
217
|
-
processedPaths.add(currentPath);
|
|
218
|
-
|
|
219
|
-
if (itemCount.count < options.maxItems) {
|
|
220
|
-
const entries = await readDirectoryEntries(currentPath, rootPath);
|
|
221
|
-
if (entries === null) return null;
|
|
222
|
-
|
|
223
|
-
folderInfo.files = collectFilesFromEntries(
|
|
224
|
-
entries,
|
|
225
|
-
currentPath,
|
|
226
|
-
folderInfo,
|
|
227
|
-
options,
|
|
228
|
-
itemCount,
|
|
229
|
-
);
|
|
230
|
-
folderInfo.subFolders = collectSubFoldersFromEntries(
|
|
231
|
-
entries,
|
|
232
|
-
currentPath,
|
|
233
|
-
folderInfo,
|
|
234
|
-
options,
|
|
235
|
-
itemCount,
|
|
236
|
-
queue,
|
|
237
|
-
);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
return rootNode;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
/**
|
|
245
|
-
* Reads the directory structure using BFS, respecting maxItems.
|
|
246
|
-
* @param node The current node in the reduced structure.
|
|
247
|
-
* @param indent The current indentation string.
|
|
248
|
-
* @param isLast Sibling indicator.
|
|
249
|
-
* @param builder Array to build the string lines.
|
|
250
|
-
*/
|
|
251
|
-
function formatStructure(
|
|
252
|
-
node: FullFolderInfo,
|
|
253
|
-
currentIndent: string,
|
|
254
|
-
isLastChildOfParent: boolean,
|
|
255
|
-
isProcessingRootNode: boolean,
|
|
256
|
-
builder: string[],
|
|
257
|
-
): void {
|
|
258
|
-
const connector = isLastChildOfParent ? '└───' : '├───';
|
|
259
|
-
|
|
260
|
-
// The root node of the structure (the one passed initially to getFolderStructure)
|
|
261
|
-
// is not printed with a connector line itself, only its name as a header.
|
|
262
|
-
// Its children are printed relative to that conceptual root.
|
|
263
|
-
// Ignored root nodes ARE printed with a connector.
|
|
264
|
-
if (!isProcessingRootNode || node.isIgnored === true) {
|
|
265
|
-
builder.push(
|
|
266
|
-
`${currentIndent}${connector}${node.name}${path.sep}${node.isIgnored === true ? TRUNCATION_INDICATOR : ''}`,
|
|
267
|
-
);
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
// Determine the indent for the children of *this* node.
|
|
271
|
-
// If *this* node was the root of the whole structure, its children start with no indent before their connectors.
|
|
272
|
-
// Otherwise, children's indent extends from the current node's indent.
|
|
273
|
-
const indentForChildren = isProcessingRootNode
|
|
274
|
-
? ''
|
|
275
|
-
: currentIndent + getChildIndent(isLastChildOfParent);
|
|
276
|
-
|
|
277
|
-
// Render files of the current node
|
|
278
|
-
const fileCount = node.files.length;
|
|
279
|
-
for (let i = 0; i < fileCount; i++) {
|
|
280
|
-
const isLastFileAmongSiblings =
|
|
281
|
-
i === fileCount - 1 &&
|
|
282
|
-
node.subFolders.length === 0 &&
|
|
283
|
-
node.hasMoreSubfolders !== true;
|
|
284
|
-
const fileConnector = isLastFileAmongSiblings ? '└───' : '├───';
|
|
285
|
-
builder.push(`${indentForChildren}${fileConnector}${node.files[i]}`);
|
|
286
|
-
}
|
|
287
|
-
if (node.hasMoreFiles === true) {
|
|
288
|
-
const isLastIndicatorAmongSiblings =
|
|
289
|
-
node.subFolders.length === 0 && node.hasMoreSubfolders !== true;
|
|
290
|
-
const fileConnector = isLastIndicatorAmongSiblings ? '└───' : '├───';
|
|
291
|
-
builder.push(`${indentForChildren}${fileConnector}${TRUNCATION_INDICATOR}`);
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
// Render subfolders of the current node
|
|
295
|
-
const subFolderCount = node.subFolders.length;
|
|
296
|
-
for (let i = 0; i < subFolderCount; i++) {
|
|
297
|
-
const isLastSubfolderAmongSiblings =
|
|
298
|
-
i === subFolderCount - 1 && node.hasMoreSubfolders !== true;
|
|
299
|
-
// Children are never the root node being processed initially.
|
|
300
|
-
formatStructure(
|
|
301
|
-
node.subFolders[i],
|
|
302
|
-
indentForChildren,
|
|
303
|
-
isLastSubfolderAmongSiblings,
|
|
304
|
-
false,
|
|
305
|
-
builder,
|
|
306
|
-
);
|
|
307
|
-
}
|
|
308
|
-
if (node.hasMoreSubfolders === true) {
|
|
309
|
-
builder.push(`${indentForChildren}└───${TRUNCATION_INDICATOR}`);
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
// --- Main Exported Function ---
|
|
314
|
-
|
|
315
|
-
/**
|
|
316
|
-
* Generates a string representation of a directory's structure,
|
|
317
|
-
* limiting the number of items displayed. Ignored folders are shown
|
|
318
|
-
* followed by '...' instead of their contents.
|
|
319
|
-
*
|
|
320
|
-
* @param directory The absolute or relative path to the directory.
|
|
321
|
-
* @param options Optional configuration settings.
|
|
322
|
-
* @returns A promise resolving to the formatted folder structure string.
|
|
323
|
-
*/
|
|
324
|
-
export async function getFolderStructure(
|
|
325
|
-
directory: string,
|
|
326
|
-
options?: FolderStructureOptions,
|
|
327
|
-
): Promise<string> {
|
|
328
|
-
const resolvedPath = path.resolve(directory);
|
|
329
|
-
const mergedOptions: MergedFolderStructureOptions = {
|
|
330
|
-
maxItems: options?.maxItems ?? MAX_ITEMS,
|
|
331
|
-
ignoredFolders: options?.ignoredFolders ?? DEFAULT_IGNORED_FOLDERS,
|
|
332
|
-
fileIncludePattern: options?.fileIncludePattern,
|
|
333
|
-
fileService: options?.fileService,
|
|
334
|
-
fileFilteringOptions:
|
|
335
|
-
options?.fileFilteringOptions ?? DEFAULT_FILE_FILTERING_OPTIONS,
|
|
336
|
-
};
|
|
337
|
-
|
|
338
|
-
try {
|
|
339
|
-
// 1. Read the structure using BFS, respecting maxItems
|
|
340
|
-
const structureRoot = await readFullStructure(resolvedPath, mergedOptions);
|
|
341
|
-
|
|
342
|
-
if (!structureRoot) {
|
|
343
|
-
return `Error: Could not read directory "${resolvedPath}". Check path and permissions.`;
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
// 2. Format the structure into a string
|
|
347
|
-
const structureLines: string[] = [];
|
|
348
|
-
// Pass true for isRoot for the initial call
|
|
349
|
-
formatStructure(structureRoot, '', true, true, structureLines);
|
|
350
|
-
|
|
351
|
-
// 3. Build the final output string
|
|
352
|
-
function isTruncated(node: FullFolderInfo): boolean {
|
|
353
|
-
if (
|
|
354
|
-
node.hasMoreFiles === true ||
|
|
355
|
-
node.hasMoreSubfolders === true ||
|
|
356
|
-
node.isIgnored === true
|
|
357
|
-
) {
|
|
358
|
-
return true;
|
|
359
|
-
}
|
|
360
|
-
for (const sub of node.subFolders) {
|
|
361
|
-
if (isTruncated(sub)) {
|
|
362
|
-
return true;
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
return false;
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
let summary = `Showing up to ${mergedOptions.maxItems} items (files + folders).`;
|
|
369
|
-
|
|
370
|
-
if (isTruncated(structureRoot)) {
|
|
371
|
-
summary += ` Folders or files indicated with ${TRUNCATION_INDICATOR} contain more items not shown, were ignored, or the display limit (${mergedOptions.maxItems} items) was reached.`;
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
return `${summary}\n\n${resolvedPath}${path.sep}\n${structureLines.join('\n')}`;
|
|
375
|
-
} catch (error: unknown) {
|
|
376
|
-
debugLogger.error(
|
|
377
|
-
`Error getting folder structure for ${resolvedPath}:`,
|
|
378
|
-
error,
|
|
379
|
-
);
|
|
380
|
-
return `Error processing directory "${resolvedPath}": ${getErrorMessage(error)}`;
|
|
381
|
-
}
|
|
382
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2025 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import * as fs from 'fs';
|
|
8
|
-
import { randomUUID } from 'crypto';
|
|
9
|
-
import * as path from 'node:path';
|
|
10
|
-
import { Storage } from '@vybestack/llxprt-code-settings';
|
|
11
|
-
import { debugLogger } from './debugLogger.js';
|
|
12
|
-
|
|
13
|
-
export class InstallationManager {
|
|
14
|
-
private getInstallationIdPath(): string {
|
|
15
|
-
return Storage.getInstallationIdPath();
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
private readInstallationIdFromFile(): string | null {
|
|
19
|
-
const installationIdFile = this.getInstallationIdPath();
|
|
20
|
-
if (fs.existsSync(installationIdFile)) {
|
|
21
|
-
const installationid = fs
|
|
22
|
-
.readFileSync(installationIdFile, 'utf-8')
|
|
23
|
-
.trim();
|
|
24
|
-
return installationid || null;
|
|
25
|
-
}
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
private writeInstallationIdToFile(installationId: string) {
|
|
30
|
-
const installationIdFile = this.getInstallationIdPath();
|
|
31
|
-
const dir = path.dirname(installationIdFile);
|
|
32
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
33
|
-
fs.writeFileSync(installationIdFile, installationId, 'utf-8');
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Retrieves the installation ID from a file, creating it if it doesn't exist.
|
|
38
|
-
* This ID is used for unique user installation tracking.
|
|
39
|
-
* @returns A UUID string for the user.
|
|
40
|
-
*/
|
|
41
|
-
getInstallationId(): string {
|
|
42
|
-
try {
|
|
43
|
-
let installationId = this.readInstallationIdFromFile();
|
|
44
|
-
|
|
45
|
-
if (!installationId) {
|
|
46
|
-
installationId = randomUUID();
|
|
47
|
-
this.writeInstallationIdToFile(installationId);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return installationId;
|
|
51
|
-
} catch (error) {
|
|
52
|
-
debugLogger.error(
|
|
53
|
-
'Error accessing installation ID file, generating ephemeral ID:',
|
|
54
|
-
error,
|
|
55
|
-
);
|
|
56
|
-
return '123456789';
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|