@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.
Files changed (417) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/index.js +1 -1
  3. package/dist/index.js.map +1 -1
  4. package/dist/prompt-config/defaults/default-prompts.json +3 -3
  5. package/dist/src/config/agentClientLifecycle.d.ts +4 -3
  6. package/dist/src/config/agentClientLifecycle.js +27 -14
  7. package/dist/src/config/agentClientLifecycle.js.map +1 -1
  8. package/dist/src/config/config.d.ts +2 -5
  9. package/dist/src/config/config.js +10 -23
  10. package/dist/src/config/config.js.map +1 -1
  11. package/dist/src/config/configBase.d.ts +5 -1
  12. package/dist/src/config/configBase.js +27 -6
  13. package/dist/src/config/configBase.js.map +1 -1
  14. package/dist/src/config/configBaseCore.d.ts +26 -8
  15. package/dist/src/config/configBaseCore.js +30 -26
  16. package/dist/src/config/configBaseCore.js.map +1 -1
  17. package/dist/src/config/configMcpRuntime.d.ts +16 -0
  18. package/dist/src/config/configMcpRuntime.js +31 -0
  19. package/dist/src/config/configMcpRuntime.js.map +1 -0
  20. package/dist/src/config/configMediaDefaults.d.ts +10 -0
  21. package/dist/src/config/configMediaDefaults.js +17 -0
  22. package/dist/src/config/configMediaDefaults.js.map +1 -0
  23. package/dist/src/config/configTestHarness.d.ts +4 -0
  24. package/dist/src/config/configTypes.d.ts +4 -54
  25. package/dist/src/config/configTypes.js +6 -82
  26. package/dist/src/config/configTypes.js.map +1 -1
  27. package/dist/src/config/index.d.ts +1 -2
  28. package/dist/src/config/index.js +1 -2
  29. package/dist/src/config/index.js.map +1 -1
  30. package/dist/src/config/models.d.ts +0 -4
  31. package/dist/src/config/models.js +0 -4
  32. package/dist/src/config/models.js.map +1 -1
  33. package/dist/src/config/toolRegistryFactory.d.ts +2 -2
  34. package/dist/src/core/clientContract.d.ts +4 -6
  35. package/dist/src/core/compression/transcriptPathNotice.d.ts +22 -0
  36. package/dist/src/core/compression/transcriptPathNotice.js +29 -0
  37. package/dist/src/core/compression/transcriptPathNotice.js.map +1 -0
  38. package/dist/src/core/contentGenerator.d.ts +2 -5
  39. package/dist/src/core/contentGenerator.js +10 -24
  40. package/dist/src/core/contentGenerator.js.map +1 -1
  41. package/dist/src/core/logger.d.ts +66 -0
  42. package/dist/src/core/logger.js +345 -30
  43. package/dist/src/core/logger.js.map +1 -1
  44. package/dist/src/core/prompts.d.ts +0 -1
  45. package/dist/src/core/prompts.js +5 -79
  46. package/dist/src/core/prompts.js.map +1 -1
  47. package/dist/src/core/turn.d.ts +3 -3
  48. package/dist/src/hooks/hookTranslator.js +5 -4
  49. package/dist/src/hooks/hookTranslator.js.map +1 -1
  50. package/dist/src/index.d.ts +8 -6
  51. package/dist/src/index.js +8 -6
  52. package/dist/src/index.js.map +1 -1
  53. package/dist/src/llm-types/index.d.ts +1 -1
  54. package/dist/src/llm-types/modelEnvelope.d.ts +2 -1
  55. package/dist/src/llm-types/modelEnvelope.js +17 -1
  56. package/dist/src/llm-types/modelEnvelope.js.map +1 -1
  57. package/dist/src/models/schema.d.ts +40 -40
  58. package/dist/src/policy/policies/read-only.toml +0 -5
  59. package/dist/src/prompt-config/TemplateEngine.js +0 -3
  60. package/dist/src/prompt-config/TemplateEngine.js.map +1 -1
  61. package/dist/src/prompt-config/defaults/providers/gemini/core.md +0 -2
  62. package/dist/src/prompt-config/defaults/providers/gemini/models/gemini-2.5-flash/core.md +0 -2
  63. package/dist/src/prompt-config/defaults/providers/gemini/models/gemini-2.5-flash/gemini-2-5-flash/core.md +0 -2
  64. package/dist/src/prompt-config/prompt-loader.d.ts +1 -1
  65. package/dist/src/prompt-config/prompt-loader.js +4 -4
  66. package/dist/src/prompt-config/prompt-loader.js.map +1 -1
  67. package/dist/src/prompt-config/types.d.ts +0 -1
  68. package/dist/src/recording/CheckpointService.d.ts +4 -0
  69. package/dist/src/recording/CheckpointService.js +67 -46
  70. package/dist/src/recording/CheckpointService.js.map +1 -1
  71. package/dist/src/recording/HistoryMutationService.d.ts +1 -1
  72. package/dist/src/recording/HistoryMutationService.js +27 -4
  73. package/dist/src/recording/HistoryMutationService.js.map +1 -1
  74. package/dist/src/recording/RecordingIntegration.d.ts +36 -2
  75. package/dist/src/recording/RecordingIntegration.js +224 -7
  76. package/dist/src/recording/RecordingIntegration.js.map +1 -1
  77. package/dist/src/recording/ReplayEngine.d.ts +8 -10
  78. package/dist/src/recording/ReplayEngine.js +161 -95
  79. package/dist/src/recording/ReplayEngine.js.map +1 -1
  80. package/dist/src/recording/SessionDiscovery.d.ts +4 -2
  81. package/dist/src/recording/SessionDiscovery.js +13 -5
  82. package/dist/src/recording/SessionDiscovery.js.map +1 -1
  83. package/dist/src/recording/SessionRecordingService.d.ts +23 -3
  84. package/dist/src/recording/SessionRecordingService.js +209 -51
  85. package/dist/src/recording/SessionRecordingService.js.map +1 -1
  86. package/dist/src/recording/SessionTransitionService.d.ts +7 -0
  87. package/dist/src/recording/SessionTransitionService.js +66 -13
  88. package/dist/src/recording/SessionTransitionService.js.map +1 -1
  89. package/dist/src/recording/index.d.ts +1 -0
  90. package/dist/src/recording/index.js +1 -0
  91. package/dist/src/recording/index.js.map +1 -1
  92. package/dist/src/recording/janitor/cleanupTypes.d.ts +3 -0
  93. package/dist/src/recording/janitor/cleanupTypes.js.map +1 -1
  94. package/dist/src/recording/janitor/mediaReclamation.d.ts +23 -0
  95. package/dist/src/recording/janitor/mediaReclamation.js +195 -0
  96. package/dist/src/recording/janitor/mediaReclamation.js.map +1 -0
  97. package/dist/src/recording/janitor/sessionJanitor.js +47 -1
  98. package/dist/src/recording/janitor/sessionJanitor.js.map +1 -1
  99. package/dist/src/recording/janitor/sessionScanner.d.ts +12 -9
  100. package/dist/src/recording/janitor/sessionScanner.js +248 -193
  101. package/dist/src/recording/janitor/sessionScanner.js.map +1 -1
  102. package/dist/src/recording/replay-test-helpers.d.ts +10 -1
  103. package/dist/src/recording/replay-test-helpers.js +24 -2
  104. package/dist/src/recording/replay-test-helpers.js.map +1 -1
  105. package/dist/src/recording/replayCheckpointMetadata.d.ts +28 -0
  106. package/dist/src/recording/replayCheckpointMetadata.js +96 -0
  107. package/dist/src/recording/replayCheckpointMetadata.js.map +1 -0
  108. package/dist/src/recording/replayErrorFormatting.d.ts +6 -0
  109. package/dist/src/recording/replayErrorFormatting.js +38 -0
  110. package/dist/src/recording/replayErrorFormatting.js.map +1 -0
  111. package/dist/src/recording/resumeSession.d.ts +3 -0
  112. package/dist/src/recording/resumeSession.js +7 -1
  113. package/dist/src/recording/resumeSession.js.map +1 -1
  114. package/dist/src/recording/semanticMediaPurgeReplayValidation.d.ts +14 -0
  115. package/dist/src/recording/semanticMediaPurgeReplayValidation.js +24 -0
  116. package/dist/src/recording/semanticMediaPurgeReplayValidation.js.map +1 -0
  117. package/dist/src/recording/session-media-package-blobs.d.ts +8 -0
  118. package/dist/src/recording/session-media-package-blobs.js +72 -0
  119. package/dist/src/recording/session-media-package-blobs.js.map +1 -0
  120. package/dist/src/recording/session-media-package-import.d.ts +26 -0
  121. package/dist/src/recording/session-media-package-import.js +124 -0
  122. package/dist/src/recording/session-media-package-import.js.map +1 -0
  123. package/dist/src/recording/session-media-package-state.d.ts +19 -0
  124. package/dist/src/recording/session-media-package-state.js +56 -0
  125. package/dist/src/recording/session-media-package-state.js.map +1 -0
  126. package/dist/src/recording/session-media-package-validation.d.ts +59 -0
  127. package/dist/src/recording/session-media-package-validation.js +286 -0
  128. package/dist/src/recording/session-media-package-validation.js.map +1 -0
  129. package/dist/src/recording/session-media-package-writer.d.ts +18 -0
  130. package/dist/src/recording/session-media-package-writer.js +70 -0
  131. package/dist/src/recording/session-media-package-writer.js.map +1 -0
  132. package/dist/src/recording/session-media-package.d.ts +27 -0
  133. package/dist/src/recording/session-media-package.js +366 -0
  134. package/dist/src/recording/session-media-package.js.map +1 -0
  135. package/dist/src/recording/types.d.ts +34 -2
  136. package/dist/src/recording/types.js.map +1 -1
  137. package/dist/src/runtime/AgentRuntimeContext.d.ts +22 -5
  138. package/dist/src/runtime/AgentRuntimeLoader.d.ts +6 -0
  139. package/dist/src/runtime/AgentRuntimeLoader.js +25 -6
  140. package/dist/src/runtime/AgentRuntimeLoader.js.map +1 -1
  141. package/dist/src/runtime/contracts/PromptEstimation.d.ts +1 -0
  142. package/dist/src/runtime/contracts/PromptEstimation.js.map +1 -1
  143. package/dist/src/runtime/contracts/RuntimeProvider.d.ts +3 -2
  144. package/dist/src/runtime/contracts/RuntimeProviderManager.d.ts +0 -2
  145. package/dist/src/runtime/createAgentRuntimeContext.js +28 -1
  146. package/dist/src/runtime/createAgentRuntimeContext.js.map +1 -1
  147. package/dist/src/runtime/providerRuntimeContext.d.ts +12 -0
  148. package/dist/src/runtime/providerRuntimeContext.js +3 -0
  149. package/dist/src/runtime/providerRuntimeContext.js.map +1 -1
  150. package/dist/src/runtime/runtimeAdapters.js +2 -2
  151. package/dist/src/runtime/runtimeAdapters.js.map +1 -1
  152. package/dist/src/services/history/ContentConverters.d.ts +11 -7
  153. package/dist/src/services/history/ContentConverters.js +11 -7
  154. package/dist/src/services/history/ContentConverters.js.map +1 -1
  155. package/dist/src/services/history/HistoryService.d.ts +18 -180
  156. package/dist/src/services/history/HistoryService.js +53 -523
  157. package/dist/src/services/history/HistoryService.js.map +1 -1
  158. package/dist/src/services/history/HistoryServiceCore.d.ts +278 -0
  159. package/dist/src/services/history/HistoryServiceCore.js +727 -0
  160. package/dist/src/services/history/HistoryServiceCore.js.map +1 -0
  161. package/dist/src/services/history/IContent.d.ts +118 -16
  162. package/dist/src/services/history/IContent.js +284 -4
  163. package/dist/src/services/history/IContent.js.map +1 -1
  164. package/dist/src/services/history/contentSize.js +22 -2
  165. package/dist/src/services/history/contentSize.js.map +1 -1
  166. package/dist/src/services/history/historyChronology.d.ts +7 -0
  167. package/dist/src/services/history/historyChronology.js +35 -3
  168. package/dist/src/services/history/historyChronology.js.map +1 -1
  169. package/dist/src/services/history/historyCloneUtils.d.ts +5 -4
  170. package/dist/src/services/history/historyCloneUtils.js +23 -16
  171. package/dist/src/services/history/historyCloneUtils.js.map +1 -1
  172. package/dist/src/services/history/historyCompressionQueue.d.ts +33 -0
  173. package/dist/src/services/history/historyCompressionQueue.js +81 -0
  174. package/dist/src/services/history/historyCompressionQueue.js.map +1 -0
  175. package/dist/src/services/history/historyEventTypes.d.ts +3 -0
  176. package/dist/src/services/history/historyMutationFailure.d.ts +15 -0
  177. package/dist/src/services/history/historyMutationFailure.js +22 -0
  178. package/dist/src/services/history/historyMutationFailure.js.map +1 -1
  179. package/dist/src/services/history/historyProviderPipeline.d.ts +1 -1
  180. package/dist/src/services/history/historyProviderPipeline.js +15 -5
  181. package/dist/src/services/history/historyProviderPipeline.js.map +1 -1
  182. package/dist/src/services/history/historyTokenEstimation.js +10 -6
  183. package/dist/src/services/history/historyTokenEstimation.js.map +1 -1
  184. package/dist/src/services/history/historyToolNormalization.d.ts +2 -0
  185. package/dist/src/services/history/historyToolNormalization.js +26 -9
  186. package/dist/src/services/history/historyToolNormalization.js.map +1 -1
  187. package/dist/src/services/history/provider-file-binding.d.ts +11 -0
  188. package/dist/src/services/history/provider-file-binding.js +70 -0
  189. package/dist/src/services/history/provider-file-binding.js.map +1 -0
  190. package/dist/src/services/history/semantic-media-purge.d.ts +66 -0
  191. package/dist/src/services/history/semantic-media-purge.js +404 -0
  192. package/dist/src/services/history/semantic-media-purge.js.map +1 -0
  193. package/dist/src/storage/SessionPersistenceService.d.ts +53 -2
  194. package/dist/src/storage/SessionPersistenceService.js +435 -23
  195. package/dist/src/storage/SessionPersistenceService.js.map +1 -1
  196. package/dist/src/storage/history-media-ownership.d.ts +38 -0
  197. package/dist/src/storage/history-media-ownership.js +136 -0
  198. package/dist/src/storage/history-media-ownership.js.map +1 -0
  199. package/dist/src/storage/local-media-store-child.d.ts +6 -0
  200. package/dist/src/storage/local-media-store-child.js +140 -0
  201. package/dist/src/storage/local-media-store-child.js.map +1 -0
  202. package/dist/src/storage/local-media-store-files.d.ts +44 -0
  203. package/dist/src/storage/local-media-store-files.js +460 -0
  204. package/dist/src/storage/local-media-store-files.js.map +1 -0
  205. package/dist/src/storage/local-media-store-lock-recovery.d.ts +15 -0
  206. package/dist/src/storage/local-media-store-lock-recovery.js +112 -0
  207. package/dist/src/storage/local-media-store-lock-recovery.js.map +1 -0
  208. package/dist/src/storage/local-media-store-persistence.d.ts +48 -0
  209. package/dist/src/storage/local-media-store-persistence.js +443 -0
  210. package/dist/src/storage/local-media-store-persistence.js.map +1 -0
  211. package/dist/src/storage/local-media-store-quota.d.ts +6 -0
  212. package/dist/src/storage/local-media-store-quota.js +66 -0
  213. package/dist/src/storage/local-media-store-quota.js.map +1 -0
  214. package/dist/src/storage/local-media-store-reservations.d.ts +55 -0
  215. package/dist/src/storage/local-media-store-reservations.js +377 -0
  216. package/dist/src/storage/local-media-store-reservations.js.map +1 -0
  217. package/dist/src/storage/local-media-store-types.d.ts +110 -0
  218. package/dist/src/storage/local-media-store-types.js +35 -0
  219. package/dist/src/storage/local-media-store-types.js.map +1 -0
  220. package/dist/src/storage/local-media-store-validation.d.ts +34 -0
  221. package/dist/src/storage/local-media-store-validation.js +449 -0
  222. package/dist/src/storage/local-media-store-validation.js.map +1 -0
  223. package/dist/src/storage/local-media-store.d.ts +47 -0
  224. package/dist/src/storage/local-media-store.js +353 -0
  225. package/dist/src/storage/local-media-store.js.map +1 -0
  226. package/dist/src/storage/media-admission-service.d.ts +49 -0
  227. package/dist/src/storage/media-admission-service.js +333 -0
  228. package/dist/src/storage/media-admission-service.js.map +1 -0
  229. package/dist/src/storage/media-lifecycle-metrics.d.ts +75 -0
  230. package/dist/src/storage/media-lifecycle-metrics.js +105 -0
  231. package/dist/src/storage/media-lifecycle-metrics.js.map +1 -0
  232. package/dist/src/storage/media-reference-lifecycle.d.ts +16 -0
  233. package/dist/src/storage/media-reference-lifecycle.js +84 -0
  234. package/dist/src/storage/media-reference-lifecycle.js.map +1 -0
  235. package/dist/src/storage/request-media-resolver.d.ts +67 -0
  236. package/dist/src/storage/request-media-resolver.js +325 -0
  237. package/dist/src/storage/request-media-resolver.js.map +1 -0
  238. package/dist/src/storage/session-media-service-factories.d.ts +19 -0
  239. package/dist/src/storage/session-media-service-factories.js +34 -0
  240. package/dist/src/storage/session-media-service-factories.js.map +1 -0
  241. package/dist/src/storage/session-persistence-helpers.d.ts +10 -0
  242. package/dist/src/storage/session-persistence-helpers.js +46 -0
  243. package/dist/src/storage/session-persistence-helpers.js.map +1 -0
  244. package/dist/src/test-utils/config.d.ts +2 -0
  245. package/dist/src/test-utils/config.js +5 -5
  246. package/dist/src/test-utils/config.js.map +1 -1
  247. package/dist/src/test-utils/runtime.d.ts +2 -0
  248. package/dist/src/test-utils/runtime.js +1 -2
  249. package/dist/src/test-utils/runtime.js.map +1 -1
  250. package/dist/src/tools-adapters/CoreShellToolHostAdapter.js +1 -9
  251. package/dist/src/tools-adapters/CoreShellToolHostAdapter.js.map +1 -1
  252. package/dist/src/tools-adapters/CoreSkillServiceAdapter.d.ts +0 -2
  253. package/dist/src/tools-adapters/CoreSkillServiceAdapter.js +0 -17
  254. package/dist/src/tools-adapters/CoreSkillServiceAdapter.js.map +1 -1
  255. package/dist/src/tools-adapters/CoreToolHostAdapter.d.ts +0 -21
  256. package/dist/src/tools-adapters/CoreToolHostAdapter.js +0 -8
  257. package/dist/src/tools-adapters/CoreToolHostAdapter.js.map +1 -1
  258. package/dist/src/utils/environmentContext.d.ts +8 -9
  259. package/dist/src/utils/environmentContext.js +11 -22
  260. package/dist/src/utils/environmentContext.js.map +1 -1
  261. package/dist/src/utils/errorParsing.d.ts +1 -2
  262. package/dist/src/utils/errorParsing.js +22 -41
  263. package/dist/src/utils/errorParsing.js.map +1 -1
  264. package/dist/src/utils/generateContentResponseUtilities.js +12 -0
  265. package/dist/src/utils/generateContentResponseUtilities.js.map +1 -1
  266. package/dist/src/utils/summarizer.d.ts +1 -2
  267. package/dist/src/utils/summarizer.js +6 -5
  268. package/dist/src/utils/summarizer.js.map +1 -1
  269. package/dist/src/utils/tool-utils.js +7 -1
  270. package/dist/src/utils/tool-utils.js.map +1 -1
  271. package/index.ts +0 -4
  272. package/package.json +38 -30
  273. package/src/config/agentClientLifecycle.ts +53 -22
  274. package/src/config/config.ts +11 -26
  275. package/src/config/configBase.ts +46 -7
  276. package/src/config/configBaseCore.ts +38 -36
  277. package/src/config/configMcpRuntime.ts +46 -0
  278. package/src/config/configMediaDefaults.ts +19 -0
  279. package/src/config/configTypes.ts +13 -53
  280. package/src/config/index.ts +1 -4
  281. package/src/config/models.ts +0 -6
  282. package/src/config/toolRegistryFactory.ts +2 -2
  283. package/src/core/clientContract.ts +4 -6
  284. package/src/core/compression/transcriptPathNotice.ts +31 -0
  285. package/src/core/contentGenerator.ts +15 -39
  286. package/src/core/logger.ts +370 -39
  287. package/src/core/prompts.ts +4 -114
  288. package/src/core/turn.ts +3 -3
  289. package/src/hooks/hookTranslator.ts +6 -4
  290. package/src/index.ts +7 -7
  291. package/src/llm-types/index.ts +5 -0
  292. package/src/llm-types/modelEnvelope.ts +26 -2
  293. package/src/policy/policies/read-only.toml +0 -5
  294. package/src/prompt-config/TemplateEngine.ts +0 -3
  295. package/src/prompt-config/defaults/providers/gemini/core.md +0 -2
  296. package/src/prompt-config/defaults/providers/gemini/models/gemini-2.5-flash/core.md +0 -2
  297. package/src/prompt-config/defaults/providers/gemini/models/gemini-2.5-flash/gemini-2-5-flash/core.md +0 -2
  298. package/src/prompt-config/prompt-loader.ts +7 -8
  299. package/src/prompt-config/types.ts +0 -1
  300. package/src/recording/CheckpointService.ts +110 -45
  301. package/src/recording/HistoryMutationService.ts +28 -3
  302. package/src/recording/RecordingIntegration.ts +258 -11
  303. package/src/recording/ReplayEngine.ts +220 -110
  304. package/src/recording/SessionDiscovery.ts +30 -4
  305. package/src/recording/SessionRecordingService.ts +253 -55
  306. package/src/recording/SessionTransitionService.ts +75 -12
  307. package/src/recording/index.ts +7 -0
  308. package/src/recording/janitor/cleanupTypes.ts +4 -0
  309. package/src/recording/janitor/mediaReclamation.ts +295 -0
  310. package/src/recording/janitor/sessionJanitor.ts +54 -1
  311. package/src/recording/janitor/sessionScanner.ts +319 -227
  312. package/src/recording/replay-test-helpers.ts +33 -2
  313. package/src/recording/replayCheckpointMetadata.ts +115 -0
  314. package/src/recording/replayErrorFormatting.ts +43 -0
  315. package/src/recording/resumeSession.ts +10 -0
  316. package/src/recording/semanticMediaPurgeReplayValidation.ts +35 -0
  317. package/src/recording/session-media-package-blobs.ts +116 -0
  318. package/src/recording/session-media-package-import.ts +189 -0
  319. package/src/recording/session-media-package-state.ts +120 -0
  320. package/src/recording/session-media-package-validation.ts +400 -0
  321. package/src/recording/session-media-package-writer.ts +117 -0
  322. package/src/recording/session-media-package.ts +692 -0
  323. package/src/recording/types.ts +37 -2
  324. package/src/runtime/AgentRuntimeContext.ts +28 -5
  325. package/src/runtime/AgentRuntimeLoader.ts +32 -7
  326. package/src/runtime/contracts/PromptEstimation.ts +1 -0
  327. package/src/runtime/contracts/RuntimeProvider.ts +3 -8
  328. package/src/runtime/contracts/RuntimeProviderManager.ts +0 -2
  329. package/src/runtime/createAgentRuntimeContext.ts +43 -1
  330. package/src/runtime/providerRuntimeContext.ts +22 -0
  331. package/src/runtime/runtimeAdapters.ts +2 -2
  332. package/src/services/history/ContentConverters.ts +11 -7
  333. package/src/services/history/HistoryService.ts +71 -696
  334. package/src/services/history/HistoryServiceCore.ts +1055 -0
  335. package/src/services/history/IContent.ts +460 -20
  336. package/src/services/history/contentSize.ts +22 -2
  337. package/src/services/history/historyChronology.ts +53 -3
  338. package/src/services/history/historyCloneUtils.ts +26 -22
  339. package/src/services/history/historyCompressionQueue.ts +102 -0
  340. package/src/services/history/historyEventTypes.ts +9 -0
  341. package/src/services/history/historyMutationFailure.ts +33 -0
  342. package/src/services/history/historyProviderPipeline.ts +19 -5
  343. package/src/services/history/historyTokenEstimation.ts +9 -5
  344. package/src/services/history/historyToolNormalization.ts +43 -11
  345. package/src/services/history/provider-file-binding.ts +115 -0
  346. package/src/services/history/semantic-media-purge.ts +593 -0
  347. package/src/storage/SessionPersistenceService.ts +667 -30
  348. package/src/storage/history-media-ownership.ts +185 -0
  349. package/src/storage/local-media-store-child.ts +163 -0
  350. package/src/storage/local-media-store-files.ts +643 -0
  351. package/src/storage/local-media-store-lock-recovery.ts +159 -0
  352. package/src/storage/local-media-store-persistence.ts +737 -0
  353. package/src/storage/local-media-store-quota.ts +111 -0
  354. package/src/storage/local-media-store-reservations.ts +485 -0
  355. package/src/storage/local-media-store-types.ts +161 -0
  356. package/src/storage/local-media-store-validation.ts +643 -0
  357. package/src/storage/local-media-store.ts +696 -0
  358. package/src/storage/media-admission-service.ts +512 -0
  359. package/src/storage/media-lifecycle-metrics.ts +228 -0
  360. package/src/storage/media-reference-lifecycle.ts +164 -0
  361. package/src/storage/request-media-resolver.ts +491 -0
  362. package/src/storage/session-media-service-factories.ts +48 -0
  363. package/src/storage/session-persistence-helpers.ts +85 -0
  364. package/src/test-utils/config.ts +7 -5
  365. package/src/test-utils/runtime.ts +3 -2
  366. package/src/tools-adapters/CoreShellToolHostAdapter.ts +1 -11
  367. package/src/tools-adapters/CoreSkillServiceAdapter.ts +0 -23
  368. package/src/tools-adapters/CoreToolHostAdapter.ts +0 -36
  369. package/src/utils/environmentContext.ts +11 -30
  370. package/src/utils/errorParsing.ts +19 -69
  371. package/src/utils/generateContentResponseUtilities.ts +28 -1
  372. package/src/utils/summarizer.ts +8 -10
  373. package/src/utils/tool-utils.ts +7 -1
  374. package/dist/src/code_assist/codeAssist.d.ts +0 -19
  375. package/dist/src/code_assist/codeAssist.js +0 -41
  376. package/dist/src/code_assist/codeAssist.js.map +0 -1
  377. package/dist/src/code_assist/contentGeneratorAdapters.d.ts +0 -49
  378. package/dist/src/code_assist/contentGeneratorAdapters.js +0 -197
  379. package/dist/src/code_assist/contentGeneratorAdapters.js.map +0 -1
  380. package/dist/src/code_assist/converter.d.ts +0 -74
  381. package/dist/src/code_assist/converter.js +0 -158
  382. package/dist/src/code_assist/converter.js.map +0 -1
  383. package/dist/src/code_assist/googleGenAIWrapper.d.ts +0 -27
  384. package/dist/src/code_assist/googleGenAIWrapper.js +0 -46
  385. package/dist/src/code_assist/googleGenAIWrapper.js.map +0 -1
  386. package/dist/src/code_assist/oauth-credential-storage.d.ts +0 -30
  387. package/dist/src/code_assist/oauth-credential-storage.js +0 -135
  388. package/dist/src/code_assist/oauth-credential-storage.js.map +0 -1
  389. package/dist/src/code_assist/server.d.ts +0 -44
  390. package/dist/src/code_assist/server.js +0 -154
  391. package/dist/src/code_assist/server.js.map +0 -1
  392. package/dist/src/code_assist/setup.d.ts +0 -20
  393. package/dist/src/code_assist/setup.js +0 -126
  394. package/dist/src/code_assist/setup.js.map +0 -1
  395. package/dist/src/code_assist/types.d.ts +0 -161
  396. package/dist/src/code_assist/types.js +0 -46
  397. package/dist/src/code_assist/types.js.map +0 -1
  398. package/dist/src/utils/getFolderStructure.d.ts +0 -31
  399. package/dist/src/utils/getFolderStructure.js +0 -240
  400. package/dist/src/utils/getFolderStructure.js.map +0 -1
  401. package/dist/src/utils/installationManager.d.ts +0 -16
  402. package/dist/src/utils/installationManager.js +0 -51
  403. package/dist/src/utils/installationManager.js.map +0 -1
  404. package/dist/src/utils/llm-edit-fixer.d.ts +0 -25
  405. package/dist/src/utils/llm-edit-fixer.js +0 -120
  406. package/dist/src/utils/llm-edit-fixer.js.map +0 -1
  407. package/src/code_assist/codeAssist.ts +0 -59
  408. package/src/code_assist/contentGeneratorAdapters.ts +0 -275
  409. package/src/code_assist/converter.ts +0 -288
  410. package/src/code_assist/googleGenAIWrapper.ts +0 -90
  411. package/src/code_assist/oauth-credential-storage.ts +0 -171
  412. package/src/code_assist/server.ts +0 -263
  413. package/src/code_assist/setup.ts +0 -189
  414. package/src/code_assist/types.ts +0 -201
  415. package/src/utils/getFolderStructure.ts +0 -382
  416. package/src/utils/installationManager.ts +0 -59
  417. package/src/utils/llm-edit-fixer.ts +0 -157
@@ -1,46 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2025 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- /**
7
- * List of predefined reason codes when a tier is blocked from a specific tier.
8
- * https://source.corp.google.com/piper///depot/google3/google/internal/cloud/code/v1internal/cloudcode.proto;l=378
9
- */
10
- export var IneligibleTierReasonCode;
11
- (function (IneligibleTierReasonCode) {
12
- // go/keep-sorted start
13
- IneligibleTierReasonCode["DASHER_USER"] = "DASHER_USER";
14
- IneligibleTierReasonCode["INELIGIBLE_ACCOUNT"] = "INELIGIBLE_ACCOUNT";
15
- IneligibleTierReasonCode["NON_USER_ACCOUNT"] = "NON_USER_ACCOUNT";
16
- IneligibleTierReasonCode["RESTRICTED_AGE"] = "RESTRICTED_AGE";
17
- IneligibleTierReasonCode["RESTRICTED_NETWORK"] = "RESTRICTED_NETWORK";
18
- IneligibleTierReasonCode["UNKNOWN"] = "UNKNOWN";
19
- IneligibleTierReasonCode["UNKNOWN_LOCATION"] = "UNKNOWN_LOCATION";
20
- IneligibleTierReasonCode["UNSUPPORTED_LOCATION"] = "UNSUPPORTED_LOCATION";
21
- // go/keep-sorted end
22
- })(IneligibleTierReasonCode || (IneligibleTierReasonCode = {}));
23
- /**
24
- * UserTierId represents IDs returned from the Cloud Code Private API representing a user's tier
25
- *
26
- * //depot/google3/cloud/developer_experience/cloudcode/pa/service/usertier.go;l=16
27
- */
28
- export var UserTierId;
29
- (function (UserTierId) {
30
- UserTierId["FREE"] = "free-tier";
31
- UserTierId["LEGACY"] = "legacy-tier";
32
- UserTierId["STANDARD"] = "standard-tier";
33
- })(UserTierId || (UserTierId = {}));
34
- /**
35
- * Status code of user license status
36
- * it does not strictly correspond to the proto
37
- * Error value is an additional value assigned to error responses from OnboardUser
38
- */
39
- export var OnboardUserStatusCode;
40
- (function (OnboardUserStatusCode) {
41
- OnboardUserStatusCode["Default"] = "DEFAULT";
42
- OnboardUserStatusCode["Notice"] = "NOTICE";
43
- OnboardUserStatusCode["Warning"] = "WARNING";
44
- OnboardUserStatusCode["Error"] = "ERROR";
45
- })(OnboardUserStatusCode || (OnboardUserStatusCode = {}));
46
- //# sourceMappingURL=types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/code_assist/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA+EH;;;GAGG;AACH,MAAM,CAAN,IAAY,wBAWX;AAXD,WAAY,wBAAwB;IAClC,uBAAuB;IACvB,uDAA2B,CAAA;IAC3B,qEAAyC,CAAA;IACzC,iEAAqC,CAAA;IACrC,6DAAiC,CAAA;IACjC,qEAAyC,CAAA;IACzC,+CAAmB,CAAA;IACnB,iEAAqC,CAAA;IACrC,yEAA6C,CAAA;IAC7C,qBAAqB;AACvB,CAAC,EAXW,wBAAwB,KAAxB,wBAAwB,QAWnC;AACD;;;;GAIG;AACH,MAAM,CAAN,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,gCAAkB,CAAA;IAClB,oCAAsB,CAAA;IACtB,wCAA0B,CAAA;AAC5B,CAAC,EAJW,UAAU,KAAV,UAAU,QAIrB;AA0CD;;;;GAIG;AACH,MAAM,CAAN,IAAY,qBAKX;AALD,WAAY,qBAAqB;IAC/B,4CAAmB,CAAA;IACnB,0CAAiB,CAAA;IACjB,4CAAmB,CAAA;IACnB,wCAAe,CAAA;AACjB,CAAC,EALW,qBAAqB,KAArB,qBAAqB,QAKhC"}
@@ -1,31 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2025 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- import type { FileDiscoveryService } from '../services/fileDiscoveryService.js';
7
- import type { FileFilteringOptions } from '../config/constants.js';
8
- /** Options for customizing folder structure retrieval. */
9
- interface FolderStructureOptions {
10
- /** Maximum number of files and folders combined to display. Defaults to 200. */
11
- maxItems?: number;
12
- /** Set of folder names to ignore completely. Case-sensitive. */
13
- ignoredFolders?: Set<string>;
14
- /** Optional regex to filter included files by name. */
15
- fileIncludePattern?: RegExp;
16
- /** For filtering files. */
17
- fileService?: FileDiscoveryService;
18
- /** File filtering ignore options. */
19
- fileFilteringOptions?: FileFilteringOptions;
20
- }
21
- /**
22
- * Generates a string representation of a directory's structure,
23
- * limiting the number of items displayed. Ignored folders are shown
24
- * followed by '...' instead of their contents.
25
- *
26
- * @param directory The absolute or relative path to the directory.
27
- * @param options Optional configuration settings.
28
- * @returns A promise resolving to the formatted folder structure string.
29
- */
30
- export declare function getFolderStructure(directory: string, options?: FolderStructureOptions): Promise<string>;
31
- export {};
@@ -1,240 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2025 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- import * as fs from 'fs/promises';
7
- import * as path from 'path';
8
- import { getErrorMessage, isNodeError } from './errors.js';
9
- import { DEFAULT_FILE_FILTERING_OPTIONS } from '../config/constants.js';
10
- import { debugLogger } from './debugLogger.js';
11
- const MAX_ITEMS = 200;
12
- const TRUNCATION_INDICATOR = '...';
13
- function getChildIndent(isLastChildOfParent) {
14
- return isLastChildOfParent ? ' ' : '│ ';
15
- }
16
- const DEFAULT_IGNORED_FOLDERS = new Set([
17
- 'node_modules',
18
- '.git',
19
- 'dist',
20
- '__pycache__',
21
- ]);
22
- // --- Interfaces ---
23
- // --- Helper Functions ---
24
- function shouldIgnorePath(filePath, fileService, fileFilteringOptions) {
25
- if (!fileService)
26
- return false;
27
- // Delegate to the unified decision path so that .llxprtignore negations
28
- // can un-ignore gitignored files when both flags are true.
29
- return fileService.shouldIgnoreFile(filePath, fileFilteringOptions);
30
- }
31
- async function readDirectoryEntries(currentPath, rootPath) {
32
- try {
33
- const rawEntries = await fs.readdir(currentPath, { withFileTypes: true });
34
- return rawEntries.sort((a, b) => a.name.localeCompare(b.name));
35
- }
36
- catch (error) {
37
- if (isNodeError(error) &&
38
- (error.code === 'EACCES' || error.code === 'ENOENT')) {
39
- debugLogger.warn(`Warning: Could not read directory ${currentPath}: ${error.message}`);
40
- if (currentPath === rootPath && error.code === 'ENOENT') {
41
- return null;
42
- }
43
- return [];
44
- }
45
- throw error;
46
- }
47
- }
48
- function collectFilesFromEntries(entries, currentPath, folderInfo, options, itemCount) {
49
- const filesInCurrentDir = [];
50
- const fileEntries = entries.filter((e) => e.isFile());
51
- for (const entry of fileEntries) {
52
- if (itemCount.count >= options.maxItems) {
53
- folderInfo.hasMoreFiles = true;
54
- break;
55
- }
56
- const fileName = entry.name;
57
- const filePath = path.join(currentPath, fileName);
58
- if (!shouldIgnorePath(filePath, options.fileService, options.fileFilteringOptions) &&
59
- (!options.fileIncludePattern || options.fileIncludePattern.test(fileName))) {
60
- filesInCurrentDir.push(fileName);
61
- itemCount.count++;
62
- folderInfo.totalFiles++;
63
- folderInfo.totalChildren++;
64
- }
65
- }
66
- return filesInCurrentDir;
67
- }
68
- function collectSubFoldersFromEntries(entries, currentPath, folderInfo, options, itemCount, queue) {
69
- const subFoldersInCurrentDir = [];
70
- const dirEntries = entries.filter((e) => e.isDirectory());
71
- for (const entry of dirEntries) {
72
- if (itemCount.count >= options.maxItems) {
73
- folderInfo.hasMoreSubfolders = true;
74
- break;
75
- }
76
- const subFolderName = entry.name;
77
- const subFolderPath = path.join(currentPath, subFolderName);
78
- const isIgnored = shouldIgnorePath(subFolderPath, options.fileService, options.fileFilteringOptions);
79
- if (options.ignoredFolders.has(subFolderName) || isIgnored) {
80
- subFoldersInCurrentDir.push({
81
- name: subFolderName,
82
- path: subFolderPath,
83
- files: [],
84
- subFolders: [],
85
- totalChildren: 0,
86
- totalFiles: 0,
87
- isIgnored: true,
88
- });
89
- itemCount.count++;
90
- folderInfo.totalChildren++;
91
- }
92
- else {
93
- const subFolderNode = {
94
- name: subFolderName,
95
- path: subFolderPath,
96
- files: [],
97
- subFolders: [],
98
- totalChildren: 0,
99
- totalFiles: 0,
100
- };
101
- subFoldersInCurrentDir.push(subFolderNode);
102
- itemCount.count++;
103
- folderInfo.totalChildren++;
104
- queue.push({ folderInfo: subFolderNode, currentPath: subFolderPath });
105
- }
106
- }
107
- return subFoldersInCurrentDir;
108
- }
109
- async function readFullStructure(rootPath, options) {
110
- const rootNode = {
111
- name: path.basename(rootPath),
112
- path: rootPath,
113
- files: [],
114
- subFolders: [],
115
- totalChildren: 0,
116
- totalFiles: 0,
117
- };
118
- const queue = [
119
- { folderInfo: rootNode, currentPath: rootPath },
120
- ];
121
- const itemCount = { count: 0 };
122
- const processedPaths = new Set();
123
- while (queue.length > 0) {
124
- const { folderInfo, currentPath } = queue.shift();
125
- if (processedPaths.has(currentPath)) {
126
- continue;
127
- }
128
- processedPaths.add(currentPath);
129
- if (itemCount.count < options.maxItems) {
130
- const entries = await readDirectoryEntries(currentPath, rootPath);
131
- if (entries === null)
132
- return null;
133
- folderInfo.files = collectFilesFromEntries(entries, currentPath, folderInfo, options, itemCount);
134
- folderInfo.subFolders = collectSubFoldersFromEntries(entries, currentPath, folderInfo, options, itemCount, queue);
135
- }
136
- }
137
- return rootNode;
138
- }
139
- /**
140
- * Reads the directory structure using BFS, respecting maxItems.
141
- * @param node The current node in the reduced structure.
142
- * @param indent The current indentation string.
143
- * @param isLast Sibling indicator.
144
- * @param builder Array to build the string lines.
145
- */
146
- function formatStructure(node, currentIndent, isLastChildOfParent, isProcessingRootNode, builder) {
147
- const connector = isLastChildOfParent ? '└───' : '├───';
148
- // The root node of the structure (the one passed initially to getFolderStructure)
149
- // is not printed with a connector line itself, only its name as a header.
150
- // Its children are printed relative to that conceptual root.
151
- // Ignored root nodes ARE printed with a connector.
152
- if (!isProcessingRootNode || node.isIgnored === true) {
153
- builder.push(`${currentIndent}${connector}${node.name}${path.sep}${node.isIgnored === true ? TRUNCATION_INDICATOR : ''}`);
154
- }
155
- // Determine the indent for the children of *this* node.
156
- // If *this* node was the root of the whole structure, its children start with no indent before their connectors.
157
- // Otherwise, children's indent extends from the current node's indent.
158
- const indentForChildren = isProcessingRootNode
159
- ? ''
160
- : currentIndent + getChildIndent(isLastChildOfParent);
161
- // Render files of the current node
162
- const fileCount = node.files.length;
163
- for (let i = 0; i < fileCount; i++) {
164
- const isLastFileAmongSiblings = i === fileCount - 1 &&
165
- node.subFolders.length === 0 &&
166
- node.hasMoreSubfolders !== true;
167
- const fileConnector = isLastFileAmongSiblings ? '└───' : '├───';
168
- builder.push(`${indentForChildren}${fileConnector}${node.files[i]}`);
169
- }
170
- if (node.hasMoreFiles === true) {
171
- const isLastIndicatorAmongSiblings = node.subFolders.length === 0 && node.hasMoreSubfolders !== true;
172
- const fileConnector = isLastIndicatorAmongSiblings ? '└───' : '├───';
173
- builder.push(`${indentForChildren}${fileConnector}${TRUNCATION_INDICATOR}`);
174
- }
175
- // Render subfolders of the current node
176
- const subFolderCount = node.subFolders.length;
177
- for (let i = 0; i < subFolderCount; i++) {
178
- const isLastSubfolderAmongSiblings = i === subFolderCount - 1 && node.hasMoreSubfolders !== true;
179
- // Children are never the root node being processed initially.
180
- formatStructure(node.subFolders[i], indentForChildren, isLastSubfolderAmongSiblings, false, builder);
181
- }
182
- if (node.hasMoreSubfolders === true) {
183
- builder.push(`${indentForChildren}└───${TRUNCATION_INDICATOR}`);
184
- }
185
- }
186
- // --- Main Exported Function ---
187
- /**
188
- * Generates a string representation of a directory's structure,
189
- * limiting the number of items displayed. Ignored folders are shown
190
- * followed by '...' instead of their contents.
191
- *
192
- * @param directory The absolute or relative path to the directory.
193
- * @param options Optional configuration settings.
194
- * @returns A promise resolving to the formatted folder structure string.
195
- */
196
- export async function getFolderStructure(directory, options) {
197
- const resolvedPath = path.resolve(directory);
198
- const mergedOptions = {
199
- maxItems: options?.maxItems ?? MAX_ITEMS,
200
- ignoredFolders: options?.ignoredFolders ?? DEFAULT_IGNORED_FOLDERS,
201
- fileIncludePattern: options?.fileIncludePattern,
202
- fileService: options?.fileService,
203
- fileFilteringOptions: options?.fileFilteringOptions ?? DEFAULT_FILE_FILTERING_OPTIONS,
204
- };
205
- try {
206
- // 1. Read the structure using BFS, respecting maxItems
207
- const structureRoot = await readFullStructure(resolvedPath, mergedOptions);
208
- if (!structureRoot) {
209
- return `Error: Could not read directory "${resolvedPath}". Check path and permissions.`;
210
- }
211
- // 2. Format the structure into a string
212
- const structureLines = [];
213
- // Pass true for isRoot for the initial call
214
- formatStructure(structureRoot, '', true, true, structureLines);
215
- // 3. Build the final output string
216
- function isTruncated(node) {
217
- if (node.hasMoreFiles === true ||
218
- node.hasMoreSubfolders === true ||
219
- node.isIgnored === true) {
220
- return true;
221
- }
222
- for (const sub of node.subFolders) {
223
- if (isTruncated(sub)) {
224
- return true;
225
- }
226
- }
227
- return false;
228
- }
229
- let summary = `Showing up to ${mergedOptions.maxItems} items (files + folders).`;
230
- if (isTruncated(structureRoot)) {
231
- summary += ` Folders or files indicated with ${TRUNCATION_INDICATOR} contain more items not shown, were ignored, or the display limit (${mergedOptions.maxItems} items) was reached.`;
232
- }
233
- return `${summary}\n\n${resolvedPath}${path.sep}\n${structureLines.join('\n')}`;
234
- }
235
- catch (error) {
236
- debugLogger.error(`Error getting folder structure for ${resolvedPath}:`, error);
237
- return `Error processing directory "${resolvedPath}": ${getErrorMessage(error)}`;
238
- }
239
- }
240
- //# sourceMappingURL=getFolderStructure.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getFolderStructure.js","sourceRoot":"","sources":["../../../src/utils/getFolderStructure.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,aAAa,CAAC;AAElC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG3D,OAAO,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,MAAM,SAAS,GAAG,GAAG,CAAC;AACtB,MAAM,oBAAoB,GAAG,KAAK,CAAC;AAEnC,SAAS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AK,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;IAClF,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACxB,WAAW,CAAC,KAAK,CACf,sCAAsC,YAAY,GAAG,EACrD,KAAK,CACN,CAAC;QACF,OAAO,+BAA+B,YAAY,MAAM,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC;IACnF,CAAC;AACH,CAAC"}
@@ -1,16 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2025 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- export declare class InstallationManager {
7
- private getInstallationIdPath;
8
- private readInstallationIdFromFile;
9
- private writeInstallationIdToFile;
10
- /**
11
- * Retrieves the installation ID from a file, creating it if it doesn't exist.
12
- * This ID is used for unique user installation tracking.
13
- * @returns A UUID string for the user.
14
- */
15
- getInstallationId(): string;
16
- }
@@ -1,51 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2025 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- import * as fs from 'fs';
7
- import { randomUUID } from 'crypto';
8
- import * as path from 'node:path';
9
- import { Storage } from '@vybestack/llxprt-code-settings';
10
- import { debugLogger } from './debugLogger.js';
11
- export class InstallationManager {
12
- getInstallationIdPath() {
13
- return Storage.getInstallationIdPath();
14
- }
15
- readInstallationIdFromFile() {
16
- const installationIdFile = this.getInstallationIdPath();
17
- if (fs.existsSync(installationIdFile)) {
18
- const installationid = fs
19
- .readFileSync(installationIdFile, 'utf-8')
20
- .trim();
21
- return installationid || null;
22
- }
23
- return null;
24
- }
25
- writeInstallationIdToFile(installationId) {
26
- const installationIdFile = this.getInstallationIdPath();
27
- const dir = path.dirname(installationIdFile);
28
- fs.mkdirSync(dir, { recursive: true });
29
- fs.writeFileSync(installationIdFile, installationId, 'utf-8');
30
- }
31
- /**
32
- * Retrieves the installation ID from a file, creating it if it doesn't exist.
33
- * This ID is used for unique user installation tracking.
34
- * @returns A UUID string for the user.
35
- */
36
- getInstallationId() {
37
- try {
38
- let installationId = this.readInstallationIdFromFile();
39
- if (!installationId) {
40
- installationId = randomUUID();
41
- this.writeInstallationIdToFile(installationId);
42
- }
43
- return installationId;
44
- }
45
- catch (error) {
46
- debugLogger.error('Error accessing installation ID file, generating ephemeral ID:', error);
47
- return '123456789';
48
- }
49
- }
50
- }
51
- //# sourceMappingURL=installationManager.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"installationManager.js","sourceRoot":"","sources":["../../../src/utils/installationManager.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,MAAM,OAAO,mBAAmB;IACtB,qBAAqB;QAC3B,OAAO,OAAO,CAAC,qBAAqB,EAAE,CAAC;IACzC,CAAC;IAEO,0BAA0B;QAChC,MAAM,kBAAkB,GAAG,IAAI,CAAC,qBAAqB,EAAE,CAAC;QACxD,IAAI,EAAE,CAAC,UAAU,CAAC,kBAAkB,CAAC,EAAE,CAAC;YACtC,MAAM,cAAc,GAAG,EAAE;iBACtB,YAAY,CAAC,kBAAkB,EAAE,OAAO,CAAC;iBACzC,IAAI,EAAE,CAAC;YACV,OAAO,cAAc,IAAI,IAAI,CAAC;QAChC,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IAEO,yBAAyB,CAAC,cAAsB;QACtD,MAAM,kBAAkB,GAAG,IAAI,CAAC,qBAAqB,EAAE,CAAC;QACxD,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;QAC7C,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACvC,EAAE,CAAC,aAAa,CAAC,kBAAkB,EAAE,cAAc,EAAE,OAAO,CAAC,CAAC;IAChE,CAAC;IAED;;;;OAIG;IACH,iBAAiB;QACf,IAAI,CAAC;YACH,IAAI,cAAc,GAAG,IAAI,CAAC,0BAA0B,EAAE,CAAC;YAEvD,IAAI,CAAC,cAAc,EAAE,CAAC;gBACpB,cAAc,GAAG,UAAU,EAAE,CAAC;gBAC9B,IAAI,CAAC,yBAAyB,CAAC,cAAc,CAAC,CAAC;YACjD,CAAC;YAED,OAAO,cAAc,CAAC;QACxB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,WAAW,CAAC,KAAK,CACf,gEAAgE,EAChE,KAAK,CACN,CAAC;YACF,OAAO,WAAW,CAAC;QACrB,CAAC;IACH,CAAC;CACF"}
@@ -1,25 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2025 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- import type { AgentClientContract } from '../core/clientContract.js';
7
- export interface SearchReplaceEdit {
8
- search: string;
9
- replace: string;
10
- noChangesRequired: boolean;
11
- explanation: string;
12
- }
13
- /**
14
- * Attempts to fix a failed edit by using an LLM to generate a new search and replace pair.
15
- * @param instruction The instruction for what needs to be done.
16
- * @param old_string The original string to be replaced.
17
- * @param new_string The original replacement string.
18
- * @param error The error that occurred during the initial edit.
19
- * @param current_content The current content of the file.
20
- * @param agentClient The agent client to use for the LLM call.
21
- * @param abortSignal An abort signal to cancel the operation.
22
- * @returns A new search and replace pair.
23
- */
24
- export declare function FixLLMEditWithInstruction(instruction: string, old_string: string, new_string: string, error: string, current_content: string, agentClient: AgentClientContract, abortSignal: AbortSignal): Promise<SearchReplaceEdit>;
25
- export declare function resetLlmEditFixerCaches_TEST_ONLY(): void;
@@ -1,120 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2025 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
- import { createHash } from 'node:crypto';
7
- import { LruCache } from './LruCache.js';
8
- import { DEFAULT_GEMINI_FLASH_MODEL } from '../config/models.js';
9
- const MAX_CACHE_SIZE = 50;
10
- const EDIT_SYS_PROMPT = `
11
- You are an expert code-editing assistant specializing in debugging and correcting failed search-and-replace operations.
12
-
13
- # Primary Goal
14
- Your task is to analyze a failed edit attempt and provide a corrected \`search\` string that will match the text in the file precisely. The correction should be as minimal as possible, staying very close to the original, failed \`search\` string. Do NOT invent a completely new edit based on the instruction; your job is to fix the provided parameters.
15
-
16
- It is important that you do no try to figure out if the instruction is correct. DO NOT GIVE ADVICE. Your only goal here is to do your best to perform the search and replace task!
17
-
18
- # Input Context
19
- You will be given:
20
- 1. The high-level instruction for the original edit.
21
- 2. The exact \`search\` and \`replace\` strings that failed.
22
- 3. The error message that was produced.
23
- 4. The full content of the latest version of the source file.
24
-
25
- # Rules for Correction
26
- 1. **Minimal Correction:** Your new \`search\` string must be a close variation of the original. Focus on fixing issues like whitespace, indentation, line endings, or small contextual differences.
27
- 2. **Explain the Fix:** Your \`explanation\` MUST state exactly why the original \`search\` failed and how your new \`search\` string resolves that specific failure. (e.g., "The original search failed due to incorrect indentation; the new search corrects the indentation to match the source file.").
28
- 3. **Preserve the \`replace\` String:** Do NOT modify the \`replace\` string unless the instruction explicitly requires it and it was the source of the error. Do not escape any characters in \`replace\`. Your primary focus is fixing the \`search\` string.
29
- 4. **No Changes Case:** CRUCIAL: if the change is already present in the file, set \`noChangesRequired\` to True and explain why in the \`explanation\`. It is crucial that you only do this if the changes outline in \`replace\` are already in the file and suits the instruction.
30
- 5. **Exactness:** The final \`search\` field must be the EXACT literal text from the file. Do not escape characters.
31
- `;
32
- const EDIT_USER_PROMPT = `
33
- # Goal of the Original Edit
34
- <instruction>
35
- {instruction}
36
- </instruction>
37
-
38
- # Failed Attempt Details
39
- - **Original \`search\` parameter (failed):**
40
- <search>
41
- {old_string}
42
- </search>
43
- - **Original \`replace\` parameter:**
44
- <replace>
45
- {new_string}
46
- </replace>
47
- - **Error Encountered:**
48
- <error>
49
- {error}
50
- </error>
51
-
52
- # Full File Content
53
- <file_content>
54
- {current_content}
55
- </file_content>
56
-
57
- # Your Task
58
- Based on the error and the file content, provide a corrected \`search\` string that will succeed. Remember to keep your correction minimal and explain the precise reason for the failure in your \`explanation\`.
59
- `;
60
- const SearchReplaceEditSchema = {
61
- type: 'object',
62
- properties: {
63
- explanation: { type: 'string' },
64
- search: { type: 'string' },
65
- replace: { type: 'string' },
66
- noChangesRequired: { type: 'boolean' },
67
- },
68
- required: ['search', 'replace', 'explanation'],
69
- };
70
- const editCorrectionWithInstructionCache = new LruCache(MAX_CACHE_SIZE);
71
- /**
72
- * Attempts to fix a failed edit by using an LLM to generate a new search and replace pair.
73
- * @param instruction The instruction for what needs to be done.
74
- * @param old_string The original string to be replaced.
75
- * @param new_string The original replacement string.
76
- * @param error The error that occurred during the initial edit.
77
- * @param current_content The current content of the file.
78
- * @param agentClient The agent client to use for the LLM call.
79
- * @param abortSignal An abort signal to cancel the operation.
80
- * @returns A new search and replace pair.
81
- */
82
- export async function FixLLMEditWithInstruction(instruction, old_string, new_string, error, current_content, agentClient, abortSignal) {
83
- const cacheKey = createHash('sha256')
84
- .update(JSON.stringify([
85
- current_content,
86
- old_string,
87
- new_string,
88
- instruction,
89
- error,
90
- ]))
91
- .digest('hex');
92
- const cachedResult = editCorrectionWithInstructionCache.get(cacheKey);
93
- if (cachedResult) {
94
- return cachedResult;
95
- }
96
- const userPrompt = EDIT_USER_PROMPT.replace('{instruction}', instruction)
97
- .replace('{old_string}', old_string)
98
- .replace('{new_string}', new_string)
99
- .replace('{error}', error)
100
- .replace('{current_content}', current_content);
101
- const contents = [
102
- {
103
- speaker: 'human',
104
- blocks: [
105
- {
106
- type: 'text',
107
- text: `${EDIT_SYS_PROMPT}
108
- ${userPrompt}`,
109
- },
110
- ],
111
- },
112
- ];
113
- const result = (await agentClient.generateJson(contents, SearchReplaceEditSchema, abortSignal, DEFAULT_GEMINI_FLASH_MODEL));
114
- editCorrectionWithInstructionCache.set(cacheKey, result);
115
- return result;
116
- }
117
- export function resetLlmEditFixerCaches_TEST_ONLY() {
118
- editCorrectionWithInstructionCache.clear();
119
- }
120
- //# sourceMappingURL=llm-edit-fixer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"llm-edit-fixer.js","sourceRoot":"","sources":["../../../src/utils/llm-edit-fixer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AAEjE,MAAM,cAAc,GAAG,EAAE,CAAC;AAE1B,MAAM,eAAe,GAAG;;;;;;;;;;;;;;;;;;;;;CAqBvB,CAAC;AAEF,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BxB,CAAC;AASF,MAAM,uBAAuB,GAAG;IAC9B,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC/B,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC1B,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC3B,iBAAiB,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE;KACvC;IACD,QAAQ,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,aAAa,CAAC;CAC/C,CAAC;AAEF,MAAM,kCAAkC,GAAG,IAAI,QAAQ,CAGrD,cAAc,CAAC,CAAC;AAElB;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB,CAC7C,WAAmB,EACnB,UAAkB,EAClB,UAAkB,EAClB,KAAa,EACb,eAAuB,EACvB,WAAgC,EAChC,WAAwB;IAExB,MAAM,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC;SAClC,MAAM,CACL,IAAI,CAAC,SAAS,CAAC;QACb,eAAe;QACf,UAAU;QACV,UAAU;QACV,WAAW;QACX,KAAK;KACN,CAAC,CACH;SACA,MAAM,CAAC,KAAK,CAAC,CAAC;IACjB,MAAM,YAAY,GAAG,kCAAkC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACtE,IAAI,YAAY,EAAE,CAAC;QACjB,OAAO,YAAY,CAAC;IACtB,CAAC;IACD,MAAM,UAAU,GAAG,gBAAgB,CAAC,OAAO,CAAC,eAAe,EAAE,WAAW,CAAC;SACtE,OAAO,CAAC,cAAc,EAAE,UAAU,CAAC;SACnC,OAAO,CAAC,cAAc,EAAE,UAAU,CAAC;SACnC,OAAO,CAAC,SAAS,EAAE,KAAK,CAAC;SACzB,OAAO,CAAC,mBAAmB,EAAE,eAAe,CAAC,CAAC;IAEjD,MAAM,QAAQ,GAAe;QAC3B;YACE,OAAO,EAAE,OAAO;YAChB,MAAM,EAAE;gBACN;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,GAAG,eAAe;EAChC,UAAU,EAAE;iBACL;aACF;SACF;KACF,CAAC;IAEF,MAAM,MAAM,GAAG,CAAC,MAAM,WAAW,CAAC,YAAY,CAC5C,QAAQ,EACR,uBAAuB,EACvB,WAAW,EACX,0BAA0B,CAC3B,CAAiC,CAAC;IAEnC,kCAAkC,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACzD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,iCAAiC;IAC/C,kCAAkC,CAAC,KAAK,EAAE,CAAC;AAC7C,CAAC"}
@@ -1,59 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2025 Google LLC
4
- * SPDX-License-Identifier: Apache-2.0
5
- */
6
-
7
- import type { ContentGenerator } from '../core/contentGenerator.js';
8
- import { CodeAssistServer } from './server.js';
9
- import type { Config } from '../config/config.js';
10
- import { debugLogger } from '../utils/debugLogger.js';
11
-
12
- export interface CodeAssistServerSource {
13
- getAgentClient():
14
- | {
15
- getContentGenerator(): ContentGenerator;
16
- }
17
- | null
18
- | undefined;
19
- }
20
-
21
- export function getCodeAssistServer(
22
- config: CodeAssistServerSource,
23
- ): CodeAssistServer | undefined {
24
- const agentClient = config.getAgentClient();
25
- if (!agentClient) {
26
- return undefined;
27
- }
28
-
29
- const generator = agentClient.getContentGenerator();
30
-
31
- // Direct CodeAssistServer (e.g. in tests or legacy wiring)
32
- if (generator instanceof CodeAssistServer) {
33
- return generator;
34
- }
35
-
36
- // Structural fallback: some test mocks and legacy wiring produce plain
37
- // objects that carry projectId. Detect them structurally so the privacy
38
- // settings hook continues to work.
39
- if (typeof generator === 'object' && 'projectId' in generator) {
40
- return generator as unknown as CodeAssistServer;
41
- }
42
-
43
- return undefined;
44
- }
45
-
46
- /**
47
- * Emits a citation event if citation display is enabled for the current user.
48
- * This function integrates with llxprt's provider abstraction to work across all providers.
49
- */
50
- export function emitCitationEvent(config: Config, citationText: string): void {
51
- const providerManager = config.getProviderManager();
52
- if (providerManager) {
53
- try {
54
- debugLogger.debug('Citation event would be emitted:', citationText);
55
- } catch (error) {
56
- debugLogger.debug('Failed to emit citation event:', error);
57
- }
58
- }
59
- }