repoburg 1.0.68 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (637) hide show
  1. package/README.md +8 -1
  2. package/backend/.env +2 -2
  3. package/backend/dist/packages/gemini-core/examples/simple.d.ts +1 -0
  4. package/backend/dist/packages/gemini-core/examples/simple.js +73 -0
  5. package/backend/dist/packages/gemini-core/examples/simple.js.map +1 -0
  6. package/backend/dist/packages/gemini-core/index.d.ts +3 -0
  7. package/backend/dist/packages/gemini-core/index.js +27 -0
  8. package/backend/dist/packages/gemini-core/index.js.map +1 -0
  9. package/backend/dist/packages/gemini-core/src/code_assist/codeAssist.d.ts +5 -0
  10. package/backend/dist/packages/gemini-core/src/code_assist/codeAssist.js +17 -0
  11. package/backend/dist/packages/gemini-core/src/code_assist/codeAssist.js.map +1 -0
  12. package/backend/dist/packages/gemini-core/src/code_assist/converter.d.ts +69 -0
  13. package/backend/dist/packages/gemini-core/src/code_assist/converter.js +129 -0
  14. package/backend/dist/packages/gemini-core/src/code_assist/converter.js.map +1 -0
  15. package/backend/dist/packages/gemini-core/src/code_assist/oauth-credential-storage.d.ts +8 -0
  16. package/backend/dist/packages/gemini-core/src/code_assist/oauth-credential-storage.js +84 -0
  17. package/backend/dist/packages/gemini-core/src/code_assist/oauth-credential-storage.js.map +1 -0
  18. package/backend/dist/packages/gemini-core/src/code_assist/oauth2.d.ts +12 -0
  19. package/backend/dist/packages/gemini-core/src/code_assist/oauth2.js +371 -0
  20. package/backend/dist/packages/gemini-core/src/code_assist/oauth2.js.map +1 -0
  21. package/backend/dist/packages/gemini-core/src/code_assist/server.d.ts +28 -0
  22. package/backend/dist/packages/gemini-core/src/code_assist/server.js +135 -0
  23. package/backend/dist/packages/gemini-core/src/code_assist/server.js.map +1 -0
  24. package/backend/dist/packages/gemini-core/src/code_assist/setup.d.ts +10 -0
  25. package/backend/dist/packages/gemini-core/src/code_assist/setup.js +94 -0
  26. package/backend/dist/packages/gemini-core/src/code_assist/setup.js.map +1 -0
  27. package/backend/dist/packages/gemini-core/src/code_assist/types.d.ts +106 -0
  28. package/backend/dist/packages/gemini-core/src/code_assist/types.js +28 -0
  29. package/backend/dist/packages/gemini-core/src/code_assist/types.js.map +1 -0
  30. package/backend/dist/packages/gemini-core/src/config/config.d.ts +22 -0
  31. package/backend/dist/packages/gemini-core/src/config/config.js +38 -0
  32. package/backend/dist/packages/gemini-core/src/config/config.js.map +1 -0
  33. package/backend/dist/packages/gemini-core/src/config/models.d.ts +6 -0
  34. package/backend/dist/packages/gemini-core/src/config/models.js +13 -0
  35. package/backend/dist/packages/gemini-core/src/config/models.js.map +1 -0
  36. package/backend/dist/packages/gemini-core/src/config/storage.d.ts +8 -0
  37. package/backend/dist/packages/gemini-core/src/config/storage.js +25 -0
  38. package/backend/dist/packages/gemini-core/src/config/storage.js.map +1 -0
  39. package/backend/dist/packages/gemini-core/src/core/contentGenerator.d.ts +23 -0
  40. package/backend/dist/packages/gemini-core/src/core/contentGenerator.js +63 -0
  41. package/backend/dist/packages/gemini-core/src/core/contentGenerator.js.map +1 -0
  42. package/backend/dist/packages/gemini-core/src/core/geminiChat.d.ts +34 -0
  43. package/backend/dist/packages/gemini-core/src/core/geminiChat.js +247 -0
  44. package/backend/dist/packages/gemini-core/src/core/geminiChat.js.map +1 -0
  45. package/backend/dist/packages/gemini-core/src/core/geminiRequest.d.ts +3 -0
  46. package/backend/dist/packages/gemini-core/src/core/geminiRequest.js +8 -0
  47. package/backend/dist/packages/gemini-core/src/core/geminiRequest.js.map +1 -0
  48. package/backend/dist/packages/gemini-core/src/core/prompts.d.ts +7 -0
  49. package/backend/dist/packages/gemini-core/src/core/prompts.js +69 -0
  50. package/backend/dist/packages/gemini-core/src/core/prompts.js.map +1 -0
  51. package/backend/dist/packages/gemini-core/src/core/tokenLimits.d.ts +5 -0
  52. package/backend/dist/packages/gemini-core/src/core/tokenLimits.js +25 -0
  53. package/backend/dist/packages/gemini-core/src/core/tokenLimits.js.map +1 -0
  54. package/backend/dist/packages/gemini-core/src/index.d.ts +18 -0
  55. package/backend/dist/packages/gemini-core/src/index.js +37 -0
  56. package/backend/dist/packages/gemini-core/src/index.js.map +1 -0
  57. package/backend/dist/packages/gemini-core/src/mcp/token-storage/base-token-storage.d.ts +14 -0
  58. package/backend/dist/packages/gemini-core/src/mcp/token-storage/base-token-storage.js +34 -0
  59. package/backend/dist/packages/gemini-core/src/mcp/token-storage/base-token-storage.js.map +1 -0
  60. package/backend/dist/packages/gemini-core/src/mcp/token-storage/file-token-storage.d.ts +19 -0
  61. package/backend/dist/packages/gemini-core/src/mcp/token-storage/file-token-storage.js +141 -0
  62. package/backend/dist/packages/gemini-core/src/mcp/token-storage/file-token-storage.js.map +1 -0
  63. package/backend/dist/packages/gemini-core/src/mcp/token-storage/hybrid-token-storage.d.ts +18 -0
  64. package/backend/dist/packages/gemini-core/src/mcp/token-storage/hybrid-token-storage.js +74 -0
  65. package/backend/dist/packages/gemini-core/src/mcp/token-storage/hybrid-token-storage.js.map +1 -0
  66. package/backend/dist/packages/gemini-core/src/mcp/token-storage/index.d.ts +6 -0
  67. package/backend/dist/packages/gemini-core/src/mcp/token-storage/index.js +24 -0
  68. package/backend/dist/packages/gemini-core/src/mcp/token-storage/index.js.map +1 -0
  69. package/backend/dist/packages/gemini-core/src/mcp/token-storage/keychain-token-storage.d.ts +26 -0
  70. package/backend/dist/packages/gemini-core/src/mcp/token-storage/keychain-token-storage.js +188 -0
  71. package/backend/dist/packages/gemini-core/src/mcp/token-storage/keychain-token-storage.js.map +1 -0
  72. package/backend/dist/packages/gemini-core/src/mcp/token-storage/types.d.ts +27 -0
  73. package/backend/dist/packages/gemini-core/src/mcp/token-storage/types.js +9 -0
  74. package/backend/dist/packages/gemini-core/src/mcp/token-storage/types.js.map +1 -0
  75. package/backend/dist/packages/gemini-core/src/utils/errors.d.ts +34 -0
  76. package/backend/dist/packages/gemini-core/src/utils/errors.js +103 -0
  77. package/backend/dist/packages/gemini-core/src/utils/errors.js.map +1 -0
  78. package/backend/dist/packages/gemini-core/src/utils/partUtils.d.ts +7 -0
  79. package/backend/dist/packages/gemini-core/src/utils/partUtils.js +108 -0
  80. package/backend/dist/packages/gemini-core/src/utils/partUtils.js.map +1 -0
  81. package/backend/dist/packages/gemini-core/src/utils/quotaErrorDetection.d.ts +16 -0
  82. package/backend/dist/packages/gemini-core/src/utils/quotaErrorDetection.js +60 -0
  83. package/backend/dist/packages/gemini-core/src/utils/quotaErrorDetection.js.map +1 -0
  84. package/backend/dist/packages/gemini-core/src/utils/retry.d.ts +14 -0
  85. package/backend/dist/packages/gemini-core/src/utils/retry.js +154 -0
  86. package/backend/dist/packages/gemini-core/src/utils/retry.js.map +1 -0
  87. package/backend/dist/packages/gemini-core/src/utils/session.d.ts +1 -0
  88. package/backend/dist/packages/gemini-core/src/utils/session.js +6 -0
  89. package/backend/dist/packages/gemini-core/src/utils/session.js.map +1 -0
  90. package/backend/dist/packages/gemini-core/src/utils/userAccountManager.d.ts +10 -0
  91. package/backend/dist/packages/gemini-core/src/utils/userAccountManager.js +106 -0
  92. package/backend/dist/packages/gemini-core/src/utils/userAccountManager.js.map +1 -0
  93. package/backend/dist/src/action-execution/action-execution.module.js.map +1 -0
  94. package/backend/dist/src/action-execution/action-execution.service.js.map +1 -0
  95. package/backend/dist/src/ai-actions/ai-action-batch.service.js.map +1 -0
  96. package/backend/dist/src/ai-actions/ai-action-creation.service.js.map +1 -0
  97. package/backend/dist/src/ai-actions/ai-actions.controller.js.map +1 -0
  98. package/backend/dist/src/ai-actions/ai-actions.module.js.map +1 -0
  99. package/backend/dist/src/ai-actions/ai-actions.service.js.map +1 -0
  100. package/backend/dist/src/app.controller.js.map +1 -0
  101. package/backend/dist/src/app.module.js.map +1 -0
  102. package/backend/dist/src/app.service.js.map +1 -0
  103. package/backend/dist/src/application-state/application-state.controller.js.map +1 -0
  104. package/backend/dist/src/application-state/application-state.module.js.map +1 -0
  105. package/backend/dist/src/application-state/application-state.service.js.map +1 -0
  106. package/backend/dist/src/application-state/dto/set-auto-context-fetch-enabled.dto.js.map +1 -0
  107. package/backend/dist/src/application-state/dto/set-auto-send-to-ai-studio-enabled.dto.js.map +1 -0
  108. package/backend/dist/src/application-state/dto/set-context-token-limit.dto.js.map +1 -0
  109. package/backend/dist/src/application-state/dto/set-orchestration-timeout.dto.js.map +1 -0
  110. package/backend/dist/src/application-state/dto/set-theme.dto.js.map +1 -0
  111. package/backend/dist/src/application-state/dto/set-websocket-enabled.dto.js.map +1 -0
  112. package/backend/dist/src/context-generation/context-generation.module.js.map +1 -0
  113. package/backend/dist/src/context-generation/context-generation.service.js.map +1 -0
  114. package/backend/dist/src/context-snippets/context-snippets.controller.js.map +1 -0
  115. package/backend/dist/src/context-snippets/context-snippets.module.js.map +1 -0
  116. package/backend/dist/src/context-snippets/context-snippets.service.js.map +1 -0
  117. package/backend/dist/src/context-snippets/dto/context-snippet.dto.js.map +1 -0
  118. package/backend/dist/src/context-templates/context-templates.controller.js.map +1 -0
  119. package/backend/dist/src/context-templates/context-templates.module.js.map +1 -0
  120. package/backend/dist/src/context-templates/context-templates.service.js.map +1 -0
  121. package/backend/dist/src/context-templates/dto/context-template.dto.js.map +1 -0
  122. package/backend/dist/src/core-entities/ai-action.entity.js.map +1 -0
  123. package/backend/dist/src/core-entities/application-state.entity.js.map +1 -0
  124. package/backend/dist/src/core-entities/base.entity.js.map +1 -0
  125. package/backend/dist/src/core-entities/context-snippet.entity.js.map +1 -0
  126. package/backend/dist/src/core-entities/context-template.entity.js.map +1 -0
  127. package/backend/dist/src/core-entities/custom-snippet.entity.js.map +1 -0
  128. package/backend/dist/src/core-entities/execution-log.entity.js.map +1 -0
  129. package/backend/dist/src/core-entities/index.js.map +1 -0
  130. package/backend/dist/src/core-entities/project.entity.js.map +1 -0
  131. package/backend/dist/src/core-entities/session-input.entity.js.map +1 -0
  132. package/backend/dist/src/core-entities/session.entity.js.map +1 -0
  133. package/backend/dist/src/core-entities/system-prompt.entity.js.map +1 -0
  134. package/backend/dist/src/custom-snippets/custom-snippets.controller.js.map +1 -0
  135. package/backend/dist/src/custom-snippets/custom-snippets.module.js.map +1 -0
  136. package/backend/dist/src/custom-snippets/custom-snippets.service.js.map +1 -0
  137. package/backend/dist/src/custom-snippets/dto/custom-snippet.dto.js.map +1 -0
  138. package/backend/dist/src/events/events.gateway.js.map +1 -0
  139. package/backend/dist/src/events/events.module.js.map +1 -0
  140. package/backend/dist/src/execution-logs/dto/execution-log.dto.js.map +1 -0
  141. package/backend/dist/src/execution-logs/execution-logs.controller.js.map +1 -0
  142. package/backend/dist/src/execution-logs/execution-logs.module.js.map +1 -0
  143. package/backend/dist/src/execution-logs/execution-logs.service.js.map +1 -0
  144. package/backend/dist/src/gemini/gemini-llm.provider.d.ts +10 -0
  145. package/backend/dist/src/gemini/gemini-llm.provider.js +103 -0
  146. package/backend/dist/src/gemini/gemini-llm.provider.js.map +1 -0
  147. package/backend/dist/src/gemini/gemini.module.d.ts +2 -0
  148. package/backend/dist/src/gemini/gemini.module.js +21 -0
  149. package/backend/dist/src/gemini/gemini.module.js.map +1 -0
  150. package/backend/dist/src/http-exception.filter.js.map +1 -0
  151. package/backend/dist/src/llm-provider/llm-provider.interface.d.ts +16 -0
  152. package/backend/dist/src/llm-provider/llm-provider.interface.js +5 -0
  153. package/backend/dist/src/llm-provider/llm-provider.interface.js.map +1 -0
  154. package/backend/dist/src/llm-provider/llm-provider.module.d.ts +2 -0
  155. package/backend/dist/src/llm-provider/llm-provider.module.js +29 -0
  156. package/backend/dist/src/llm-provider/llm-provider.module.js.map +1 -0
  157. package/backend/dist/src/llm-response-parser/dto/ai-action.dto.js.map +1 -0
  158. package/backend/dist/src/llm-response-parser/errors/parsing.error.js.map +1 -0
  159. package/backend/dist/src/llm-response-parser/llm-response-parser.module.js.map +1 -0
  160. package/backend/dist/src/llm-response-parser/llm-response-parser.service.js.map +1 -0
  161. package/backend/dist/src/llm-response-parser/parsing.constants.js.map +1 -0
  162. package/backend/dist/src/llm-responses/dto/submit-llm-response.dto.js.map +1 -0
  163. package/backend/dist/src/llm-responses/llm-responses.controller.js.map +1 -0
  164. package/backend/dist/src/llm-responses/llm-responses.module.js.map +1 -0
  165. package/backend/dist/src/llm-responses/llm-responses.service.js.map +1 -0
  166. package/backend/dist/src/main.js.map +1 -0
  167. package/backend/dist/src/orchestration/dto/orchestration.dto.js.map +1 -0
  168. package/backend/dist/src/orchestration/orchestration-fs.service.js.map +1 -0
  169. package/backend/dist/src/orchestration/orchestration-parser.service.js.map +1 -0
  170. package/backend/dist/src/orchestration/orchestration.controller.js.map +1 -0
  171. package/backend/dist/src/orchestration/orchestration.module.js.map +1 -0
  172. package/backend/dist/src/orchestration/orchestration.service.js.map +1 -0
  173. package/backend/dist/src/orchestration/orchestration.types.js.map +1 -0
  174. package/backend/dist/src/projects/dto/project.dto.js.map +1 -0
  175. package/backend/dist/src/projects/projects.controller.js.map +1 -0
  176. package/backend/dist/src/projects/projects.module.js.map +1 -0
  177. package/backend/dist/src/projects/projects.service.js.map +1 -0
  178. package/backend/dist/src/seeding/context-template-seeding.service.js.map +1 -0
  179. package/backend/dist/src/seeding/custom-snippet-seeding.service.js.map +1 -0
  180. package/backend/dist/src/seeding/data/context-templates/default-followup_ad-hoc-focused-context.js.map +1 -0
  181. package/backend/dist/src/seeding/data/context-templates/default-initial_condensed-project-context.js.map +1 -0
  182. package/backend/dist/src/seeding/data/context-templates/default-initial_full-project-context.js.map +1 -0
  183. package/backend/dist/src/seeding/data/context-templates/pm-context.js.map +1 -0
  184. package/backend/dist/src/seeding/data/context-templates/pr-description.js.map +1 -0
  185. package/backend/dist/src/seeding/data/context-templates/sample_focused-tree.d.ts +2 -0
  186. package/backend/dist/{seeding → src/seeding}/data/context-templates/sample_focused-tree.js +1 -3
  187. package/backend/dist/src/seeding/data/context-templates/sample_focused-tree.js.map +1 -0
  188. package/backend/dist/src/seeding/data/custom-snippets/default_rglob.js.map +1 -0
  189. package/backend/dist/src/seeding/data/custom-snippets/git-diff.js.map +1 -0
  190. package/backend/dist/src/seeding/data/custom-snippets/rg-exclude.js.map +1 -0
  191. package/backend/dist/src/seeding/data/custom-snippets/rg-search-glob.js.map +1 -0
  192. package/backend/dist/src/seeding/data/custom-snippets/rg-search.js.map +1 -0
  193. package/backend/dist/src/seeding/data/custom-snippets/run-command.js.map +1 -0
  194. package/backend/dist/src/seeding/data/custom-snippets/tree.js.map +1 -0
  195. package/backend/dist/src/seeding/data/custom-snippets/usr-adhoc-incl.js.map +1 -0
  196. package/backend/dist/src/seeding/data/custom-snippets/usr-cmd-output-incl.js.map +1 -0
  197. package/backend/dist/src/seeding/data/custom-snippets/usr-input-incl.js.map +1 -0
  198. package/backend/dist/src/seeding/data/system-prompts/codebase-explorer.js.map +1 -0
  199. package/backend/dist/src/seeding/data/system-prompts/default_multi-file-action-generator-with-requester.js.map +1 -0
  200. package/backend/dist/src/seeding/data/system-prompts/packup.js.map +1 -0
  201. package/backend/dist/src/seeding/data/system-prompts/refactor-split.js.map +1 -0
  202. package/backend/dist/src/seeding/seeding.module.js.map +1 -0
  203. package/backend/dist/src/seeding/seeding.service.js.map +1 -0
  204. package/backend/dist/src/seeding/system-prompt-seeding.service.js.map +1 -0
  205. package/backend/dist/src/session-followup/session-followup.module.js.map +1 -0
  206. package/backend/dist/src/session-followup/session-followup.service.js.map +1 -0
  207. package/backend/dist/src/session-inputs/dto/session-input.dto.js.map +1 -0
  208. package/backend/dist/{session-inputs → src/session-inputs}/session-input-context.service.d.ts +1 -1
  209. package/backend/dist/{session-inputs → src/session-inputs}/session-input-context.service.js +10 -11
  210. package/backend/dist/src/session-inputs/session-input-context.service.js.map +1 -0
  211. package/backend/dist/src/session-inputs/session-inputs.controller.js.map +1 -0
  212. package/backend/dist/{session-inputs → src/session-inputs}/session-inputs.module.js +2 -0
  213. package/backend/dist/src/session-inputs/session-inputs.module.js.map +1 -0
  214. package/backend/dist/{session-inputs → src/session-inputs}/session-inputs.service.d.ts +3 -1
  215. package/backend/dist/{session-inputs → src/session-inputs}/session-inputs.service.js +46 -15
  216. package/backend/dist/src/session-inputs/session-inputs.service.js.map +1 -0
  217. package/backend/dist/src/session-transfer/session-transfer.module.js.map +1 -0
  218. package/backend/dist/src/session-transfer/session-transfer.service.js.map +1 -0
  219. package/backend/dist/src/sessions/dto/session.dto.js.map +1 -0
  220. package/backend/dist/src/sessions/sessions.controller.js.map +1 -0
  221. package/backend/dist/src/sessions/sessions.module.js.map +1 -0
  222. package/backend/dist/src/sessions/sessions.service.js.map +1 -0
  223. package/backend/dist/src/system-prompts/dto/system-prompt.dto.js.map +1 -0
  224. package/backend/dist/src/system-prompts/system-prompts.controller.js.map +1 -0
  225. package/backend/dist/src/system-prompts/system-prompts.module.js.map +1 -0
  226. package/backend/dist/src/system-prompts/system-prompts.service.js.map +1 -0
  227. package/backend/dist/{timeout.interceptor.js → src/timeout.interceptor.js} +1 -1
  228. package/backend/dist/src/timeout.interceptor.js.map +1 -0
  229. package/backend/dist/src/tracing.js.map +1 -0
  230. package/backend/dist/src/utils/fuzzy-search.js.map +1 -0
  231. package/backend/dist/src/utils/index.js.map +1 -0
  232. package/backend/dist/src/utils/trace.decorator.js.map +1 -0
  233. package/backend/dist/src/workspace/dto/file-tree.dto.d.ts +8 -0
  234. package/backend/dist/src/workspace/dto/file-tree.dto.js +10 -0
  235. package/backend/dist/src/workspace/dto/file-tree.dto.js.map +1 -0
  236. package/backend/dist/src/workspace/dto/search-workspace.dto.js.map +1 -0
  237. package/backend/dist/{workspace → src/workspace}/workspace.controller.d.ts +2 -5
  238. package/backend/dist/src/workspace/workspace.controller.js.map +1 -0
  239. package/backend/dist/src/workspace/workspace.module.js.map +1 -0
  240. package/backend/dist/{workspace → src/workspace}/workspace.service.d.ts +2 -6
  241. package/backend/dist/{workspace → src/workspace}/workspace.service.js +61 -12
  242. package/backend/dist/src/workspace/workspace.service.js.map +1 -0
  243. package/backend/dist/tsconfig.build.tsbuildinfo +1 -1
  244. package/backend/packages/gemini-core/examples/simple.ts +120 -0
  245. package/backend/packages/gemini-core/index.ts +15 -0
  246. package/backend/packages/gemini-core/src/code_assist/codeAssist.ts +37 -0
  247. package/backend/packages/gemini-core/src/code_assist/converter.ts +250 -0
  248. package/backend/packages/gemini-core/src/code_assist/oauth-credential-storage.ts +129 -0
  249. package/backend/packages/gemini-core/src/code_assist/oauth2.ts +541 -0
  250. package/backend/packages/gemini-core/src/code_assist/server.ts +236 -0
  251. package/backend/packages/gemini-core/src/code_assist/setup.ts +124 -0
  252. package/backend/packages/gemini-core/src/code_assist/types.ts +201 -0
  253. package/backend/packages/gemini-core/src/config/config.ts +75 -0
  254. package/backend/packages/gemini-core/src/config/models.ts +23 -0
  255. package/backend/packages/gemini-core/src/config/storage.ts +30 -0
  256. package/backend/packages/gemini-core/src/core/contentGenerator.ts +136 -0
  257. package/backend/packages/gemini-core/src/core/geminiChat.ts +385 -0
  258. package/backend/packages/gemini-core/src/core/geminiRequest.ts +19 -0
  259. package/backend/packages/gemini-core/src/core/prompts.ts +109 -0
  260. package/backend/packages/gemini-core/src/core/tokenLimits.ts +32 -0
  261. package/backend/packages/gemini-core/src/index.ts +35 -0
  262. package/backend/packages/gemini-core/src/mcp/token-storage/base-token-storage.ts +49 -0
  263. package/backend/packages/gemini-core/src/mcp/token-storage/file-token-storage.ts +184 -0
  264. package/backend/packages/gemini-core/src/mcp/token-storage/hybrid-token-storage.ts +97 -0
  265. package/backend/packages/gemini-core/src/mcp/token-storage/index.ts +14 -0
  266. package/backend/packages/gemini-core/src/mcp/token-storage/keychain-token-storage.ts +251 -0
  267. package/backend/packages/gemini-core/src/mcp/token-storage/types.ts +42 -0
  268. package/backend/packages/gemini-core/src/utils/errors.ts +112 -0
  269. package/backend/packages/gemini-core/src/utils/partUtils.ts +169 -0
  270. package/backend/packages/gemini-core/src/utils/quotaErrorDetection.ts +102 -0
  271. package/backend/packages/gemini-core/src/utils/retry.ts +265 -0
  272. package/backend/packages/gemini-core/src/utils/session.ts +9 -0
  273. package/backend/packages/gemini-core/src/utils/userAccountManager.ts +140 -0
  274. package/package.json +5 -3
  275. package/backend/.repoburg/orchestrations/README.md +0 -41
  276. package/backend/dist/action-execution/action-execution.module.js.map +0 -1
  277. package/backend/dist/action-execution/action-execution.service.js.map +0 -1
  278. package/backend/dist/ai-actions/ai-action-batch.service.js.map +0 -1
  279. package/backend/dist/ai-actions/ai-action-creation.service.js.map +0 -1
  280. package/backend/dist/ai-actions/ai-actions.controller.js.map +0 -1
  281. package/backend/dist/ai-actions/ai-actions.module.js.map +0 -1
  282. package/backend/dist/ai-actions/ai-actions.service.js.map +0 -1
  283. package/backend/dist/app.controller.js.map +0 -1
  284. package/backend/dist/app.module.js.map +0 -1
  285. package/backend/dist/app.service.js.map +0 -1
  286. package/backend/dist/application-state/application-state.controller.js.map +0 -1
  287. package/backend/dist/application-state/application-state.module.js.map +0 -1
  288. package/backend/dist/application-state/application-state.service.js.map +0 -1
  289. package/backend/dist/application-state/dto/set-auto-context-fetch-enabled.dto.js.map +0 -1
  290. package/backend/dist/application-state/dto/set-auto-send-to-ai-studio-enabled.dto.js.map +0 -1
  291. package/backend/dist/application-state/dto/set-context-token-limit.dto.js.map +0 -1
  292. package/backend/dist/application-state/dto/set-orchestration-timeout.dto.js.map +0 -1
  293. package/backend/dist/application-state/dto/set-theme.dto.js.map +0 -1
  294. package/backend/dist/application-state/dto/set-websocket-enabled.dto.js.map +0 -1
  295. package/backend/dist/context-generation/context-generation.module.js.map +0 -1
  296. package/backend/dist/context-generation/context-generation.service.js.map +0 -1
  297. package/backend/dist/context-snippets/context-snippets.controller.js.map +0 -1
  298. package/backend/dist/context-snippets/context-snippets.module.js.map +0 -1
  299. package/backend/dist/context-snippets/context-snippets.service.js.map +0 -1
  300. package/backend/dist/context-snippets/dto/context-snippet.dto.js.map +0 -1
  301. package/backend/dist/context-templates/context-templates.controller.js.map +0 -1
  302. package/backend/dist/context-templates/context-templates.module.js.map +0 -1
  303. package/backend/dist/context-templates/context-templates.service.js.map +0 -1
  304. package/backend/dist/context-templates/dto/context-template.dto.js.map +0 -1
  305. package/backend/dist/core-entities/ai-action.entity.js.map +0 -1
  306. package/backend/dist/core-entities/application-state.entity.js.map +0 -1
  307. package/backend/dist/core-entities/base.entity.js.map +0 -1
  308. package/backend/dist/core-entities/context-snippet.entity.js.map +0 -1
  309. package/backend/dist/core-entities/context-template.entity.js.map +0 -1
  310. package/backend/dist/core-entities/custom-snippet.entity.js.map +0 -1
  311. package/backend/dist/core-entities/execution-log.entity.js.map +0 -1
  312. package/backend/dist/core-entities/index.js.map +0 -1
  313. package/backend/dist/core-entities/project.entity.js.map +0 -1
  314. package/backend/dist/core-entities/session-input.entity.js.map +0 -1
  315. package/backend/dist/core-entities/session.entity.js.map +0 -1
  316. package/backend/dist/core-entities/system-prompt.entity.js.map +0 -1
  317. package/backend/dist/custom-snippets/custom-snippets.controller.js.map +0 -1
  318. package/backend/dist/custom-snippets/custom-snippets.module.js.map +0 -1
  319. package/backend/dist/custom-snippets/custom-snippets.service.js.map +0 -1
  320. package/backend/dist/custom-snippets/dto/custom-snippet.dto.js.map +0 -1
  321. package/backend/dist/events/events.gateway.js.map +0 -1
  322. package/backend/dist/events/events.module.js.map +0 -1
  323. package/backend/dist/execution-logs/dto/execution-log.dto.js.map +0 -1
  324. package/backend/dist/execution-logs/execution-logs.controller.js.map +0 -1
  325. package/backend/dist/execution-logs/execution-logs.module.js.map +0 -1
  326. package/backend/dist/execution-logs/execution-logs.service.js.map +0 -1
  327. package/backend/dist/http-exception.filter.js.map +0 -1
  328. package/backend/dist/llm-response-parser/dto/ai-action.dto.js.map +0 -1
  329. package/backend/dist/llm-response-parser/errors/parsing.error.js.map +0 -1
  330. package/backend/dist/llm-response-parser/llm-response-parser.module.js.map +0 -1
  331. package/backend/dist/llm-response-parser/llm-response-parser.service.js.map +0 -1
  332. package/backend/dist/llm-response-parser/parsing.constants.js.map +0 -1
  333. package/backend/dist/llm-responses/dto/submit-llm-response.dto.js.map +0 -1
  334. package/backend/dist/llm-responses/llm-responses.controller.js.map +0 -1
  335. package/backend/dist/llm-responses/llm-responses.module.js.map +0 -1
  336. package/backend/dist/llm-responses/llm-responses.service.js.map +0 -1
  337. package/backend/dist/main.js.map +0 -1
  338. package/backend/dist/orchestration/dto/orchestration.dto.js.map +0 -1
  339. package/backend/dist/orchestration/orchestration-fs.service.js.map +0 -1
  340. package/backend/dist/orchestration/orchestration-parser.service.js.map +0 -1
  341. package/backend/dist/orchestration/orchestration.controller.js.map +0 -1
  342. package/backend/dist/orchestration/orchestration.module.js.map +0 -1
  343. package/backend/dist/orchestration/orchestration.service.js.map +0 -1
  344. package/backend/dist/orchestration/orchestration.types.js.map +0 -1
  345. package/backend/dist/projects/dto/project.dto.js.map +0 -1
  346. package/backend/dist/projects/projects.controller.js.map +0 -1
  347. package/backend/dist/projects/projects.module.js.map +0 -1
  348. package/backend/dist/projects/projects.service.js.map +0 -1
  349. package/backend/dist/seeding/context-template-seeding.service.js.map +0 -1
  350. package/backend/dist/seeding/custom-snippet-seeding.service.js.map +0 -1
  351. package/backend/dist/seeding/data/context-templates/default-followup_ad-hoc-focused-context.js.map +0 -1
  352. package/backend/dist/seeding/data/context-templates/default-initial_condensed-project-context.js.map +0 -1
  353. package/backend/dist/seeding/data/context-templates/default-initial_full-project-context.js.map +0 -1
  354. package/backend/dist/seeding/data/context-templates/pm-context.js.map +0 -1
  355. package/backend/dist/seeding/data/context-templates/pr-description.js.map +0 -1
  356. package/backend/dist/seeding/data/context-templates/sample_focused-tree.d.ts +0 -2
  357. package/backend/dist/seeding/data/context-templates/sample_focused-tree.js.map +0 -1
  358. package/backend/dist/seeding/data/custom-snippets/default_rglob.js.map +0 -1
  359. package/backend/dist/seeding/data/custom-snippets/git-diff.js.map +0 -1
  360. package/backend/dist/seeding/data/custom-snippets/rg-exclude.js.map +0 -1
  361. package/backend/dist/seeding/data/custom-snippets/rg-search-glob.js.map +0 -1
  362. package/backend/dist/seeding/data/custom-snippets/rg-search.js.map +0 -1
  363. package/backend/dist/seeding/data/custom-snippets/run-command.js.map +0 -1
  364. package/backend/dist/seeding/data/custom-snippets/tree.js.map +0 -1
  365. package/backend/dist/seeding/data/custom-snippets/usr-adhoc-incl.js.map +0 -1
  366. package/backend/dist/seeding/data/custom-snippets/usr-cmd-output-incl.js.map +0 -1
  367. package/backend/dist/seeding/data/custom-snippets/usr-input-incl.js.map +0 -1
  368. package/backend/dist/seeding/data/system-prompts/codebase-explorer.js.map +0 -1
  369. package/backend/dist/seeding/data/system-prompts/default_multi-file-action-generator-with-requester.js.map +0 -1
  370. package/backend/dist/seeding/data/system-prompts/packup.js.map +0 -1
  371. package/backend/dist/seeding/data/system-prompts/refactor-split.js.map +0 -1
  372. package/backend/dist/seeding/seeding.module.js.map +0 -1
  373. package/backend/dist/seeding/seeding.service.js.map +0 -1
  374. package/backend/dist/seeding/system-prompt-seeding.service.js.map +0 -1
  375. package/backend/dist/session-followup/session-followup.module.js.map +0 -1
  376. package/backend/dist/session-followup/session-followup.service.js.map +0 -1
  377. package/backend/dist/session-inputs/dto/session-input.dto.js.map +0 -1
  378. package/backend/dist/session-inputs/session-input-context.service.js.map +0 -1
  379. package/backend/dist/session-inputs/session-inputs.controller.js.map +0 -1
  380. package/backend/dist/session-inputs/session-inputs.module.js.map +0 -1
  381. package/backend/dist/session-inputs/session-inputs.service.js.map +0 -1
  382. package/backend/dist/session-transfer/session-transfer.module.js.map +0 -1
  383. package/backend/dist/session-transfer/session-transfer.service.js.map +0 -1
  384. package/backend/dist/sessions/dto/session.dto.js.map +0 -1
  385. package/backend/dist/sessions/sessions.controller.js.map +0 -1
  386. package/backend/dist/sessions/sessions.module.js.map +0 -1
  387. package/backend/dist/sessions/sessions.service.js.map +0 -1
  388. package/backend/dist/system-prompts/dto/system-prompt.dto.js.map +0 -1
  389. package/backend/dist/system-prompts/system-prompts.controller.js.map +0 -1
  390. package/backend/dist/system-prompts/system-prompts.module.js.map +0 -1
  391. package/backend/dist/system-prompts/system-prompts.service.js.map +0 -1
  392. package/backend/dist/timeout.interceptor.js.map +0 -1
  393. package/backend/dist/tracing.js.map +0 -1
  394. package/backend/dist/utils/fuzzy-search.js.map +0 -1
  395. package/backend/dist/utils/index.js.map +0 -1
  396. package/backend/dist/utils/trace.decorator.js.map +0 -1
  397. package/backend/dist/workspace/dto/search-workspace.dto.js.map +0 -1
  398. package/backend/dist/workspace/workspace.controller.js.map +0 -1
  399. package/backend/dist/workspace/workspace.module.js.map +0 -1
  400. package/backend/dist/workspace/workspace.service.js.map +0 -1
  401. /package/backend/dist/{action-execution → src/action-execution}/action-execution.module.d.ts +0 -0
  402. /package/backend/dist/{action-execution → src/action-execution}/action-execution.module.js +0 -0
  403. /package/backend/dist/{action-execution → src/action-execution}/action-execution.service.d.ts +0 -0
  404. /package/backend/dist/{action-execution → src/action-execution}/action-execution.service.js +0 -0
  405. /package/backend/dist/{ai-actions → src/ai-actions}/ai-action-batch.service.d.ts +0 -0
  406. /package/backend/dist/{ai-actions → src/ai-actions}/ai-action-batch.service.js +0 -0
  407. /package/backend/dist/{ai-actions → src/ai-actions}/ai-action-creation.service.d.ts +0 -0
  408. /package/backend/dist/{ai-actions → src/ai-actions}/ai-action-creation.service.js +0 -0
  409. /package/backend/dist/{ai-actions → src/ai-actions}/ai-actions.controller.d.ts +0 -0
  410. /package/backend/dist/{ai-actions → src/ai-actions}/ai-actions.controller.js +0 -0
  411. /package/backend/dist/{ai-actions → src/ai-actions}/ai-actions.module.d.ts +0 -0
  412. /package/backend/dist/{ai-actions → src/ai-actions}/ai-actions.module.js +0 -0
  413. /package/backend/dist/{ai-actions → src/ai-actions}/ai-actions.service.d.ts +0 -0
  414. /package/backend/dist/{ai-actions → src/ai-actions}/ai-actions.service.js +0 -0
  415. /package/backend/dist/{app.controller.d.ts → src/app.controller.d.ts} +0 -0
  416. /package/backend/dist/{app.controller.js → src/app.controller.js} +0 -0
  417. /package/backend/dist/{app.module.d.ts → src/app.module.d.ts} +0 -0
  418. /package/backend/dist/{app.module.js → src/app.module.js} +0 -0
  419. /package/backend/dist/{app.service.d.ts → src/app.service.d.ts} +0 -0
  420. /package/backend/dist/{app.service.js → src/app.service.js} +0 -0
  421. /package/backend/dist/{application-state → src/application-state}/application-state.controller.d.ts +0 -0
  422. /package/backend/dist/{application-state → src/application-state}/application-state.controller.js +0 -0
  423. /package/backend/dist/{application-state → src/application-state}/application-state.module.d.ts +0 -0
  424. /package/backend/dist/{application-state → src/application-state}/application-state.module.js +0 -0
  425. /package/backend/dist/{application-state → src/application-state}/application-state.service.d.ts +0 -0
  426. /package/backend/dist/{application-state → src/application-state}/application-state.service.js +0 -0
  427. /package/backend/dist/{application-state → src/application-state}/dto/set-auto-context-fetch-enabled.dto.d.ts +0 -0
  428. /package/backend/dist/{application-state → src/application-state}/dto/set-auto-context-fetch-enabled.dto.js +0 -0
  429. /package/backend/dist/{application-state → src/application-state}/dto/set-auto-send-to-ai-studio-enabled.dto.d.ts +0 -0
  430. /package/backend/dist/{application-state → src/application-state}/dto/set-auto-send-to-ai-studio-enabled.dto.js +0 -0
  431. /package/backend/dist/{application-state → src/application-state}/dto/set-context-token-limit.dto.d.ts +0 -0
  432. /package/backend/dist/{application-state → src/application-state}/dto/set-context-token-limit.dto.js +0 -0
  433. /package/backend/dist/{application-state → src/application-state}/dto/set-orchestration-timeout.dto.d.ts +0 -0
  434. /package/backend/dist/{application-state → src/application-state}/dto/set-orchestration-timeout.dto.js +0 -0
  435. /package/backend/dist/{application-state → src/application-state}/dto/set-theme.dto.d.ts +0 -0
  436. /package/backend/dist/{application-state → src/application-state}/dto/set-theme.dto.js +0 -0
  437. /package/backend/dist/{application-state → src/application-state}/dto/set-websocket-enabled.dto.d.ts +0 -0
  438. /package/backend/dist/{application-state → src/application-state}/dto/set-websocket-enabled.dto.js +0 -0
  439. /package/backend/dist/{context-generation → src/context-generation}/context-generation.module.d.ts +0 -0
  440. /package/backend/dist/{context-generation → src/context-generation}/context-generation.module.js +0 -0
  441. /package/backend/dist/{context-generation → src/context-generation}/context-generation.service.d.ts +0 -0
  442. /package/backend/dist/{context-generation → src/context-generation}/context-generation.service.js +0 -0
  443. /package/backend/dist/{context-snippets → src/context-snippets}/context-snippets.controller.d.ts +0 -0
  444. /package/backend/dist/{context-snippets → src/context-snippets}/context-snippets.controller.js +0 -0
  445. /package/backend/dist/{context-snippets → src/context-snippets}/context-snippets.module.d.ts +0 -0
  446. /package/backend/dist/{context-snippets → src/context-snippets}/context-snippets.module.js +0 -0
  447. /package/backend/dist/{context-snippets → src/context-snippets}/context-snippets.service.d.ts +0 -0
  448. /package/backend/dist/{context-snippets → src/context-snippets}/context-snippets.service.js +0 -0
  449. /package/backend/dist/{context-snippets → src/context-snippets}/dto/context-snippet.dto.d.ts +0 -0
  450. /package/backend/dist/{context-snippets → src/context-snippets}/dto/context-snippet.dto.js +0 -0
  451. /package/backend/dist/{context-templates → src/context-templates}/context-templates.controller.d.ts +0 -0
  452. /package/backend/dist/{context-templates → src/context-templates}/context-templates.controller.js +0 -0
  453. /package/backend/dist/{context-templates → src/context-templates}/context-templates.module.d.ts +0 -0
  454. /package/backend/dist/{context-templates → src/context-templates}/context-templates.module.js +0 -0
  455. /package/backend/dist/{context-templates → src/context-templates}/context-templates.service.d.ts +0 -0
  456. /package/backend/dist/{context-templates → src/context-templates}/context-templates.service.js +0 -0
  457. /package/backend/dist/{context-templates → src/context-templates}/dto/context-template.dto.d.ts +0 -0
  458. /package/backend/dist/{context-templates → src/context-templates}/dto/context-template.dto.js +0 -0
  459. /package/backend/dist/{core-entities → src/core-entities}/ai-action.entity.d.ts +0 -0
  460. /package/backend/dist/{core-entities → src/core-entities}/ai-action.entity.js +0 -0
  461. /package/backend/dist/{core-entities → src/core-entities}/application-state.entity.d.ts +0 -0
  462. /package/backend/dist/{core-entities → src/core-entities}/application-state.entity.js +0 -0
  463. /package/backend/dist/{core-entities → src/core-entities}/base.entity.d.ts +0 -0
  464. /package/backend/dist/{core-entities → src/core-entities}/base.entity.js +0 -0
  465. /package/backend/dist/{core-entities → src/core-entities}/context-snippet.entity.d.ts +0 -0
  466. /package/backend/dist/{core-entities → src/core-entities}/context-snippet.entity.js +0 -0
  467. /package/backend/dist/{core-entities → src/core-entities}/context-template.entity.d.ts +0 -0
  468. /package/backend/dist/{core-entities → src/core-entities}/context-template.entity.js +0 -0
  469. /package/backend/dist/{core-entities → src/core-entities}/custom-snippet.entity.d.ts +0 -0
  470. /package/backend/dist/{core-entities → src/core-entities}/custom-snippet.entity.js +0 -0
  471. /package/backend/dist/{core-entities → src/core-entities}/execution-log.entity.d.ts +0 -0
  472. /package/backend/dist/{core-entities → src/core-entities}/execution-log.entity.js +0 -0
  473. /package/backend/dist/{core-entities → src/core-entities}/index.d.ts +0 -0
  474. /package/backend/dist/{core-entities → src/core-entities}/index.js +0 -0
  475. /package/backend/dist/{core-entities → src/core-entities}/project.entity.d.ts +0 -0
  476. /package/backend/dist/{core-entities → src/core-entities}/project.entity.js +0 -0
  477. /package/backend/dist/{core-entities → src/core-entities}/session-input.entity.d.ts +0 -0
  478. /package/backend/dist/{core-entities → src/core-entities}/session-input.entity.js +0 -0
  479. /package/backend/dist/{core-entities → src/core-entities}/session.entity.d.ts +0 -0
  480. /package/backend/dist/{core-entities → src/core-entities}/session.entity.js +0 -0
  481. /package/backend/dist/{core-entities → src/core-entities}/system-prompt.entity.d.ts +0 -0
  482. /package/backend/dist/{core-entities → src/core-entities}/system-prompt.entity.js +0 -0
  483. /package/backend/dist/{custom-snippets → src/custom-snippets}/custom-snippets.controller.d.ts +0 -0
  484. /package/backend/dist/{custom-snippets → src/custom-snippets}/custom-snippets.controller.js +0 -0
  485. /package/backend/dist/{custom-snippets → src/custom-snippets}/custom-snippets.module.d.ts +0 -0
  486. /package/backend/dist/{custom-snippets → src/custom-snippets}/custom-snippets.module.js +0 -0
  487. /package/backend/dist/{custom-snippets → src/custom-snippets}/custom-snippets.service.d.ts +0 -0
  488. /package/backend/dist/{custom-snippets → src/custom-snippets}/custom-snippets.service.js +0 -0
  489. /package/backend/dist/{custom-snippets → src/custom-snippets}/dto/custom-snippet.dto.d.ts +0 -0
  490. /package/backend/dist/{custom-snippets → src/custom-snippets}/dto/custom-snippet.dto.js +0 -0
  491. /package/backend/dist/{events → src/events}/events.gateway.d.ts +0 -0
  492. /package/backend/dist/{events → src/events}/events.gateway.js +0 -0
  493. /package/backend/dist/{events → src/events}/events.module.d.ts +0 -0
  494. /package/backend/dist/{events → src/events}/events.module.js +0 -0
  495. /package/backend/dist/{execution-logs → src/execution-logs}/dto/execution-log.dto.d.ts +0 -0
  496. /package/backend/dist/{execution-logs → src/execution-logs}/dto/execution-log.dto.js +0 -0
  497. /package/backend/dist/{execution-logs → src/execution-logs}/execution-logs.controller.d.ts +0 -0
  498. /package/backend/dist/{execution-logs → src/execution-logs}/execution-logs.controller.js +0 -0
  499. /package/backend/dist/{execution-logs → src/execution-logs}/execution-logs.module.d.ts +0 -0
  500. /package/backend/dist/{execution-logs → src/execution-logs}/execution-logs.module.js +0 -0
  501. /package/backend/dist/{execution-logs → src/execution-logs}/execution-logs.service.d.ts +0 -0
  502. /package/backend/dist/{execution-logs → src/execution-logs}/execution-logs.service.js +0 -0
  503. /package/backend/dist/{http-exception.filter.d.ts → src/http-exception.filter.d.ts} +0 -0
  504. /package/backend/dist/{http-exception.filter.js → src/http-exception.filter.js} +0 -0
  505. /package/backend/dist/{llm-response-parser → src/llm-response-parser}/dto/ai-action.dto.d.ts +0 -0
  506. /package/backend/dist/{llm-response-parser → src/llm-response-parser}/dto/ai-action.dto.js +0 -0
  507. /package/backend/dist/{llm-response-parser → src/llm-response-parser}/errors/parsing.error.d.ts +0 -0
  508. /package/backend/dist/{llm-response-parser → src/llm-response-parser}/errors/parsing.error.js +0 -0
  509. /package/backend/dist/{llm-response-parser → src/llm-response-parser}/llm-response-parser.module.d.ts +0 -0
  510. /package/backend/dist/{llm-response-parser → src/llm-response-parser}/llm-response-parser.module.js +0 -0
  511. /package/backend/dist/{llm-response-parser → src/llm-response-parser}/llm-response-parser.service.d.ts +0 -0
  512. /package/backend/dist/{llm-response-parser → src/llm-response-parser}/llm-response-parser.service.js +0 -0
  513. /package/backend/dist/{llm-response-parser → src/llm-response-parser}/parsing.constants.d.ts +0 -0
  514. /package/backend/dist/{llm-response-parser → src/llm-response-parser}/parsing.constants.js +0 -0
  515. /package/backend/dist/{llm-responses → src/llm-responses}/dto/submit-llm-response.dto.d.ts +0 -0
  516. /package/backend/dist/{llm-responses → src/llm-responses}/dto/submit-llm-response.dto.js +0 -0
  517. /package/backend/dist/{llm-responses → src/llm-responses}/llm-responses.controller.d.ts +0 -0
  518. /package/backend/dist/{llm-responses → src/llm-responses}/llm-responses.controller.js +0 -0
  519. /package/backend/dist/{llm-responses → src/llm-responses}/llm-responses.module.d.ts +0 -0
  520. /package/backend/dist/{llm-responses → src/llm-responses}/llm-responses.module.js +0 -0
  521. /package/backend/dist/{llm-responses → src/llm-responses}/llm-responses.service.d.ts +0 -0
  522. /package/backend/dist/{llm-responses → src/llm-responses}/llm-responses.service.js +0 -0
  523. /package/backend/dist/{main.d.ts → src/main.d.ts} +0 -0
  524. /package/backend/dist/{main.js → src/main.js} +0 -0
  525. /package/backend/dist/{orchestration → src/orchestration}/dto/orchestration.dto.d.ts +0 -0
  526. /package/backend/dist/{orchestration → src/orchestration}/dto/orchestration.dto.js +0 -0
  527. /package/backend/dist/{orchestration → src/orchestration}/orchestration-fs.service.d.ts +0 -0
  528. /package/backend/dist/{orchestration → src/orchestration}/orchestration-fs.service.js +0 -0
  529. /package/backend/dist/{orchestration → src/orchestration}/orchestration-parser.service.d.ts +0 -0
  530. /package/backend/dist/{orchestration → src/orchestration}/orchestration-parser.service.js +0 -0
  531. /package/backend/dist/{orchestration → src/orchestration}/orchestration.controller.d.ts +0 -0
  532. /package/backend/dist/{orchestration → src/orchestration}/orchestration.controller.js +0 -0
  533. /package/backend/dist/{orchestration → src/orchestration}/orchestration.module.d.ts +0 -0
  534. /package/backend/dist/{orchestration → src/orchestration}/orchestration.module.js +0 -0
  535. /package/backend/dist/{orchestration → src/orchestration}/orchestration.service.d.ts +0 -0
  536. /package/backend/dist/{orchestration → src/orchestration}/orchestration.service.js +0 -0
  537. /package/backend/dist/{orchestration → src/orchestration}/orchestration.types.d.ts +0 -0
  538. /package/backend/dist/{orchestration → src/orchestration}/orchestration.types.js +0 -0
  539. /package/backend/dist/{projects → src/projects}/dto/project.dto.d.ts +0 -0
  540. /package/backend/dist/{projects → src/projects}/dto/project.dto.js +0 -0
  541. /package/backend/dist/{projects → src/projects}/projects.controller.d.ts +0 -0
  542. /package/backend/dist/{projects → src/projects}/projects.controller.js +0 -0
  543. /package/backend/dist/{projects → src/projects}/projects.module.d.ts +0 -0
  544. /package/backend/dist/{projects → src/projects}/projects.module.js +0 -0
  545. /package/backend/dist/{projects → src/projects}/projects.service.d.ts +0 -0
  546. /package/backend/dist/{projects → src/projects}/projects.service.js +0 -0
  547. /package/backend/dist/{seeding → src/seeding}/context-template-seeding.service.d.ts +0 -0
  548. /package/backend/dist/{seeding → src/seeding}/context-template-seeding.service.js +0 -0
  549. /package/backend/dist/{seeding → src/seeding}/custom-snippet-seeding.service.d.ts +0 -0
  550. /package/backend/dist/{seeding → src/seeding}/custom-snippet-seeding.service.js +0 -0
  551. /package/backend/dist/{seeding → src/seeding}/data/context-templates/default-followup_ad-hoc-focused-context.d.ts +0 -0
  552. /package/backend/dist/{seeding → src/seeding}/data/context-templates/default-followup_ad-hoc-focused-context.js +0 -0
  553. /package/backend/dist/{seeding → src/seeding}/data/context-templates/default-initial_condensed-project-context.d.ts +0 -0
  554. /package/backend/dist/{seeding → src/seeding}/data/context-templates/default-initial_condensed-project-context.js +0 -0
  555. /package/backend/dist/{seeding → src/seeding}/data/context-templates/default-initial_full-project-context.d.ts +0 -0
  556. /package/backend/dist/{seeding → src/seeding}/data/context-templates/default-initial_full-project-context.js +0 -0
  557. /package/backend/dist/{seeding → src/seeding}/data/context-templates/pm-context.d.ts +0 -0
  558. /package/backend/dist/{seeding → src/seeding}/data/context-templates/pm-context.js +0 -0
  559. /package/backend/dist/{seeding → src/seeding}/data/context-templates/pr-description.d.ts +0 -0
  560. /package/backend/dist/{seeding → src/seeding}/data/context-templates/pr-description.js +0 -0
  561. /package/backend/dist/{seeding → src/seeding}/data/custom-snippets/default_rglob.d.ts +0 -0
  562. /package/backend/dist/{seeding → src/seeding}/data/custom-snippets/default_rglob.js +0 -0
  563. /package/backend/dist/{seeding → src/seeding}/data/custom-snippets/git-diff.d.ts +0 -0
  564. /package/backend/dist/{seeding → src/seeding}/data/custom-snippets/git-diff.js +0 -0
  565. /package/backend/dist/{seeding → src/seeding}/data/custom-snippets/rg-exclude.d.ts +0 -0
  566. /package/backend/dist/{seeding → src/seeding}/data/custom-snippets/rg-exclude.js +0 -0
  567. /package/backend/dist/{seeding → src/seeding}/data/custom-snippets/rg-search-glob.d.ts +0 -0
  568. /package/backend/dist/{seeding → src/seeding}/data/custom-snippets/rg-search-glob.js +0 -0
  569. /package/backend/dist/{seeding → src/seeding}/data/custom-snippets/rg-search.d.ts +0 -0
  570. /package/backend/dist/{seeding → src/seeding}/data/custom-snippets/rg-search.js +0 -0
  571. /package/backend/dist/{seeding → src/seeding}/data/custom-snippets/run-command.d.ts +0 -0
  572. /package/backend/dist/{seeding → src/seeding}/data/custom-snippets/run-command.js +0 -0
  573. /package/backend/dist/{seeding → src/seeding}/data/custom-snippets/tree.d.ts +0 -0
  574. /package/backend/dist/{seeding → src/seeding}/data/custom-snippets/tree.js +0 -0
  575. /package/backend/dist/{seeding → src/seeding}/data/custom-snippets/usr-adhoc-incl.d.ts +0 -0
  576. /package/backend/dist/{seeding → src/seeding}/data/custom-snippets/usr-adhoc-incl.js +0 -0
  577. /package/backend/dist/{seeding → src/seeding}/data/custom-snippets/usr-cmd-output-incl.d.ts +0 -0
  578. /package/backend/dist/{seeding → src/seeding}/data/custom-snippets/usr-cmd-output-incl.js +0 -0
  579. /package/backend/dist/{seeding → src/seeding}/data/custom-snippets/usr-input-incl.d.ts +0 -0
  580. /package/backend/dist/{seeding → src/seeding}/data/custom-snippets/usr-input-incl.js +0 -0
  581. /package/backend/dist/{seeding → src/seeding}/data/system-prompts/codebase-explorer.d.ts +0 -0
  582. /package/backend/dist/{seeding → src/seeding}/data/system-prompts/codebase-explorer.js +0 -0
  583. /package/backend/dist/{seeding → src/seeding}/data/system-prompts/default_multi-file-action-generator-with-requester.d.ts +0 -0
  584. /package/backend/dist/{seeding → src/seeding}/data/system-prompts/default_multi-file-action-generator-with-requester.js +0 -0
  585. /package/backend/dist/{seeding → src/seeding}/data/system-prompts/packup.d.ts +0 -0
  586. /package/backend/dist/{seeding → src/seeding}/data/system-prompts/packup.js +0 -0
  587. /package/backend/dist/{seeding → src/seeding}/data/system-prompts/refactor-split.d.ts +0 -0
  588. /package/backend/dist/{seeding → src/seeding}/data/system-prompts/refactor-split.js +0 -0
  589. /package/backend/dist/{seeding → src/seeding}/seeding.module.d.ts +0 -0
  590. /package/backend/dist/{seeding → src/seeding}/seeding.module.js +0 -0
  591. /package/backend/dist/{seeding → src/seeding}/seeding.service.d.ts +0 -0
  592. /package/backend/dist/{seeding → src/seeding}/seeding.service.js +0 -0
  593. /package/backend/dist/{seeding → src/seeding}/system-prompt-seeding.service.d.ts +0 -0
  594. /package/backend/dist/{seeding → src/seeding}/system-prompt-seeding.service.js +0 -0
  595. /package/backend/dist/{session-followup → src/session-followup}/session-followup.module.d.ts +0 -0
  596. /package/backend/dist/{session-followup → src/session-followup}/session-followup.module.js +0 -0
  597. /package/backend/dist/{session-followup → src/session-followup}/session-followup.service.d.ts +0 -0
  598. /package/backend/dist/{session-followup → src/session-followup}/session-followup.service.js +0 -0
  599. /package/backend/dist/{session-inputs → src/session-inputs}/dto/session-input.dto.d.ts +0 -0
  600. /package/backend/dist/{session-inputs → src/session-inputs}/dto/session-input.dto.js +0 -0
  601. /package/backend/dist/{session-inputs → src/session-inputs}/session-inputs.controller.d.ts +0 -0
  602. /package/backend/dist/{session-inputs → src/session-inputs}/session-inputs.controller.js +0 -0
  603. /package/backend/dist/{session-inputs → src/session-inputs}/session-inputs.module.d.ts +0 -0
  604. /package/backend/dist/{session-transfer → src/session-transfer}/session-transfer.module.d.ts +0 -0
  605. /package/backend/dist/{session-transfer → src/session-transfer}/session-transfer.module.js +0 -0
  606. /package/backend/dist/{session-transfer → src/session-transfer}/session-transfer.service.d.ts +0 -0
  607. /package/backend/dist/{session-transfer → src/session-transfer}/session-transfer.service.js +0 -0
  608. /package/backend/dist/{sessions → src/sessions}/dto/session.dto.d.ts +0 -0
  609. /package/backend/dist/{sessions → src/sessions}/dto/session.dto.js +0 -0
  610. /package/backend/dist/{sessions → src/sessions}/sessions.controller.d.ts +0 -0
  611. /package/backend/dist/{sessions → src/sessions}/sessions.controller.js +0 -0
  612. /package/backend/dist/{sessions → src/sessions}/sessions.module.d.ts +0 -0
  613. /package/backend/dist/{sessions → src/sessions}/sessions.module.js +0 -0
  614. /package/backend/dist/{sessions → src/sessions}/sessions.service.d.ts +0 -0
  615. /package/backend/dist/{sessions → src/sessions}/sessions.service.js +0 -0
  616. /package/backend/dist/{system-prompts → src/system-prompts}/dto/system-prompt.dto.d.ts +0 -0
  617. /package/backend/dist/{system-prompts → src/system-prompts}/dto/system-prompt.dto.js +0 -0
  618. /package/backend/dist/{system-prompts → src/system-prompts}/system-prompts.controller.d.ts +0 -0
  619. /package/backend/dist/{system-prompts → src/system-prompts}/system-prompts.controller.js +0 -0
  620. /package/backend/dist/{system-prompts → src/system-prompts}/system-prompts.module.d.ts +0 -0
  621. /package/backend/dist/{system-prompts → src/system-prompts}/system-prompts.module.js +0 -0
  622. /package/backend/dist/{system-prompts → src/system-prompts}/system-prompts.service.d.ts +0 -0
  623. /package/backend/dist/{system-prompts → src/system-prompts}/system-prompts.service.js +0 -0
  624. /package/backend/dist/{timeout.interceptor.d.ts → src/timeout.interceptor.d.ts} +0 -0
  625. /package/backend/dist/{tracing.d.ts → src/tracing.d.ts} +0 -0
  626. /package/backend/dist/{tracing.js → src/tracing.js} +0 -0
  627. /package/backend/dist/{utils → src/utils}/fuzzy-search.d.ts +0 -0
  628. /package/backend/dist/{utils → src/utils}/fuzzy-search.js +0 -0
  629. /package/backend/dist/{utils → src/utils}/index.d.ts +0 -0
  630. /package/backend/dist/{utils → src/utils}/index.js +0 -0
  631. /package/backend/dist/{utils → src/utils}/trace.decorator.d.ts +0 -0
  632. /package/backend/dist/{utils → src/utils}/trace.decorator.js +0 -0
  633. /package/backend/dist/{workspace → src/workspace}/dto/search-workspace.dto.d.ts +0 -0
  634. /package/backend/dist/{workspace → src/workspace}/dto/search-workspace.dto.js +0 -0
  635. /package/backend/dist/{workspace → src/workspace}/workspace.controller.js +0 -0
  636. /package/backend/dist/{workspace → src/workspace}/workspace.module.d.ts +0 -0
  637. /package/backend/dist/{workspace → src/workspace}/workspace.module.js +0 -0
@@ -0,0 +1,35 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ // Export config
8
+ export * from './config/config';
9
+
10
+ // Export Core Logic
11
+ export * from './core/contentGenerator';
12
+ export * from './core/geminiChat';
13
+ export * from './core/prompts';
14
+ export * from './core/tokenLimits';
15
+ export * from './core/geminiRequest';
16
+
17
+ export * from './code_assist/codeAssist';
18
+ export * from './code_assist/oauth2';
19
+ export * from './code_assist/server';
20
+ export * from './code_assist/types';
21
+
22
+ // Export utilities
23
+ export * from './utils/errors';
24
+ export * from './utils/quotaErrorDetection';
25
+ export * from './utils/retry';
26
+ export * from './utils/partUtils';
27
+ export { sessionId } from './utils/session';
28
+ export { Storage } from './config/storage';
29
+ export * from './utils/userAccountManager';
30
+
31
+ // MCP token storage for auth
32
+ export type {
33
+ OAuthToken,
34
+ OAuthCredentials,
35
+ } from './mcp/token-storage/types';
@@ -0,0 +1,49 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ import type { TokenStorage, OAuthCredentials } from './types';
8
+
9
+ export abstract class BaseTokenStorage implements TokenStorage {
10
+ protected readonly serviceName: string;
11
+
12
+ constructor(serviceName: string) {
13
+ this.serviceName = serviceName;
14
+ }
15
+
16
+ abstract getCredentials(serverName: string): Promise<OAuthCredentials | null>;
17
+ abstract setCredentials(credentials: OAuthCredentials): Promise<void>;
18
+ abstract deleteCredentials(serverName: string): Promise<void>;
19
+ abstract listServers(): Promise<string[]>;
20
+ abstract getAllCredentials(): Promise<Map<string, OAuthCredentials>>;
21
+ abstract clearAll(): Promise<void>;
22
+
23
+ protected validateCredentials(credentials: OAuthCredentials): void {
24
+ if (!credentials.serverName) {
25
+ throw new Error('Server name is required');
26
+ }
27
+ if (!credentials.token) {
28
+ throw new Error('Token is required');
29
+ }
30
+ if (!credentials.token.accessToken) {
31
+ throw new Error('Access token is required');
32
+ }
33
+ if (!credentials.token.tokenType) {
34
+ throw new Error('Token type is required');
35
+ }
36
+ }
37
+
38
+ protected isTokenExpired(credentials: OAuthCredentials): boolean {
39
+ if (!credentials.token.expiresAt) {
40
+ return false;
41
+ }
42
+ const bufferMs = 5 * 60 * 1000;
43
+ return Date.now() > credentials.token.expiresAt - bufferMs;
44
+ }
45
+
46
+ protected sanitizeServerName(serverName: string): string {
47
+ return serverName.replace(/[^a-zA-Z0-9-_.]/g, '_');
48
+ }
49
+ }
@@ -0,0 +1,184 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ import { promises as fs } from 'node:fs';
8
+ import * as path from 'node:path';
9
+ import * as os from 'node:os';
10
+ import * as crypto from 'node:crypto';
11
+ import { BaseTokenStorage } from './base-token-storage';
12
+ import type { OAuthCredentials } from './types';
13
+
14
+ export class FileTokenStorage extends BaseTokenStorage {
15
+ private readonly tokenFilePath: string;
16
+ private readonly encryptionKey: Buffer;
17
+
18
+ constructor(serviceName: string) {
19
+ super(serviceName);
20
+ const configDir = path.join(os.homedir(), '.gemini');
21
+ this.tokenFilePath = path.join(configDir, 'mcp-oauth-tokens-v2.json');
22
+ this.encryptionKey = this.deriveEncryptionKey();
23
+ }
24
+
25
+ private deriveEncryptionKey(): Buffer {
26
+ const salt = `${os.hostname()}-${os.userInfo().username}-gemini-cli`;
27
+ return crypto.scryptSync('gemini-cli-oauth', salt, 32);
28
+ }
29
+
30
+ private encrypt(text: string): string {
31
+ const iv = crypto.randomBytes(16);
32
+ const cipher = crypto.createCipheriv('aes-256-gcm', this.encryptionKey, iv);
33
+
34
+ let encrypted = cipher.update(text, 'utf8', 'hex');
35
+ encrypted += cipher.final('hex');
36
+
37
+ const authTag = cipher.getAuthTag();
38
+
39
+ return iv.toString('hex') + ':' + authTag.toString('hex') + ':' + encrypted;
40
+ }
41
+
42
+ private decrypt(encryptedData: string): string {
43
+ const parts = encryptedData.split(':');
44
+ if (parts.length !== 3) {
45
+ throw new Error('Invalid encrypted data format');
46
+ }
47
+
48
+ const iv = Buffer.from(parts[0], 'hex');
49
+ const authTag = Buffer.from(parts[1], 'hex');
50
+ const encrypted = parts[2];
51
+
52
+ const decipher = crypto.createDecipheriv(
53
+ 'aes-256-gcm',
54
+ this.encryptionKey,
55
+ iv,
56
+ );
57
+ decipher.setAuthTag(authTag);
58
+
59
+ let decrypted = decipher.update(encrypted, 'hex', 'utf8');
60
+ decrypted += decipher.final('utf8');
61
+
62
+ return decrypted;
63
+ }
64
+
65
+ private async ensureDirectoryExists(): Promise<void> {
66
+ const dir = path.dirname(this.tokenFilePath);
67
+ await fs.mkdir(dir, { recursive: true, mode: 0o700 });
68
+ }
69
+
70
+ private async loadTokens(): Promise<Map<string, OAuthCredentials>> {
71
+ try {
72
+ const data = await fs.readFile(this.tokenFilePath, 'utf-8');
73
+ const decrypted = this.decrypt(data);
74
+ const tokens = JSON.parse(decrypted) as Record<string, OAuthCredentials>;
75
+ return new Map(Object.entries(tokens));
76
+ } catch (error: unknown) {
77
+ const err = error as NodeJS.ErrnoException & { message?: string };
78
+ if (err.code === 'ENOENT') {
79
+ throw new Error('Token file does not exist');
80
+ }
81
+ if (
82
+ err.message?.includes('Invalid encrypted data format') ||
83
+ err.message?.includes(
84
+ 'Unsupported state or unable to authenticate data',
85
+ )
86
+ ) {
87
+ throw new Error('Token file corrupted');
88
+ }
89
+ throw error;
90
+ }
91
+ }
92
+
93
+ private async saveTokens(
94
+ tokens: Map<string, OAuthCredentials>,
95
+ ): Promise<void> {
96
+ await this.ensureDirectoryExists();
97
+
98
+ const data = Object.fromEntries(tokens);
99
+ const json = JSON.stringify(data, null, 2);
100
+ const encrypted = this.encrypt(json);
101
+
102
+ await fs.writeFile(this.tokenFilePath, encrypted, { mode: 0o600 });
103
+ }
104
+
105
+ async getCredentials(serverName: string): Promise<OAuthCredentials | null> {
106
+ const tokens = await this.loadTokens();
107
+ const credentials = tokens.get(serverName);
108
+
109
+ if (!credentials) {
110
+ return null;
111
+ }
112
+
113
+ if (this.isTokenExpired(credentials)) {
114
+ return null;
115
+ }
116
+
117
+ return credentials;
118
+ }
119
+
120
+ async setCredentials(credentials: OAuthCredentials): Promise<void> {
121
+ this.validateCredentials(credentials);
122
+
123
+ const tokens = await this.loadTokens();
124
+ const updatedCredentials: OAuthCredentials = {
125
+ ...credentials,
126
+ updatedAt: Date.now(),
127
+ };
128
+
129
+ tokens.set(credentials.serverName, updatedCredentials);
130
+ await this.saveTokens(tokens);
131
+ }
132
+
133
+ async deleteCredentials(serverName: string): Promise<void> {
134
+ const tokens = await this.loadTokens();
135
+
136
+ if (!tokens.has(serverName)) {
137
+ throw new Error(`No credentials found for ${serverName}`);
138
+ }
139
+
140
+ tokens.delete(serverName);
141
+
142
+ if (tokens.size === 0) {
143
+ try {
144
+ await fs.unlink(this.tokenFilePath);
145
+ } catch (error: unknown) {
146
+ const err = error as NodeJS.ErrnoException;
147
+ if (err.code !== 'ENOENT') {
148
+ throw error;
149
+ }
150
+ }
151
+ } else {
152
+ await this.saveTokens(tokens);
153
+ }
154
+ }
155
+
156
+ async listServers(): Promise<string[]> {
157
+ const tokens = await this.loadTokens();
158
+ return Array.from(tokens.keys());
159
+ }
160
+
161
+ async getAllCredentials(): Promise<Map<string, OAuthCredentials>> {
162
+ const tokens = await this.loadTokens();
163
+ const result = new Map<string, OAuthCredentials>();
164
+
165
+ for (const [serverName, credentials] of tokens) {
166
+ if (!this.isTokenExpired(credentials)) {
167
+ result.set(serverName, credentials);
168
+ }
169
+ }
170
+
171
+ return result;
172
+ }
173
+
174
+ async clearAll(): Promise<void> {
175
+ try {
176
+ await fs.unlink(this.tokenFilePath);
177
+ } catch (error: unknown) {
178
+ const err = error as NodeJS.ErrnoException;
179
+ if (err.code !== 'ENOENT') {
180
+ throw error;
181
+ }
182
+ }
183
+ }
184
+ }
@@ -0,0 +1,97 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ import { BaseTokenStorage } from './base-token-storage';
8
+ import { FileTokenStorage } from './file-token-storage';
9
+ import type { TokenStorage, OAuthCredentials } from './types';
10
+ import { TokenStorageType } from './types';
11
+
12
+ const FORCE_FILE_STORAGE_ENV_VAR = 'GEMINI_FORCE_FILE_STORAGE';
13
+
14
+ export class HybridTokenStorage extends BaseTokenStorage {
15
+ private storage: TokenStorage | null = null;
16
+ private storageType: TokenStorageType | null = null;
17
+ private storageInitPromise: Promise<TokenStorage> | null = null;
18
+
19
+ constructor(serviceName: string) {
20
+ super(serviceName);
21
+ }
22
+
23
+ private async initializeStorage(): Promise<TokenStorage> {
24
+ const forceFileStorage = process.env[FORCE_FILE_STORAGE_ENV_VAR] === 'true';
25
+
26
+ if (!forceFileStorage) {
27
+ try {
28
+ const { KeychainTokenStorage } = await import(
29
+ './keychain-token-storage'
30
+ );
31
+ const keychainStorage = new KeychainTokenStorage(this.serviceName);
32
+
33
+ const isAvailable = await keychainStorage.isAvailable();
34
+ if (isAvailable) {
35
+ this.storage = keychainStorage;
36
+ this.storageType = TokenStorageType.KEYCHAIN;
37
+ return this.storage;
38
+ }
39
+ } catch (_e) {
40
+ // Fallback to file storage if keychain fails to initialize
41
+ }
42
+ }
43
+
44
+ this.storage = new FileTokenStorage(this.serviceName);
45
+ this.storageType = TokenStorageType.ENCRYPTED_FILE;
46
+ return this.storage;
47
+ }
48
+
49
+ private async getStorage(): Promise<TokenStorage> {
50
+ if (this.storage !== null) {
51
+ return this.storage;
52
+ }
53
+
54
+ // Use a single initialization promise to avoid race conditions
55
+ if (!this.storageInitPromise) {
56
+ this.storageInitPromise = this.initializeStorage();
57
+ }
58
+
59
+ // Wait for initialization to complete
60
+ return await this.storageInitPromise;
61
+ }
62
+
63
+ async getCredentials(serverName: string): Promise<OAuthCredentials | null> {
64
+ const storage = await this.getStorage();
65
+ return storage.getCredentials(serverName);
66
+ }
67
+
68
+ async setCredentials(credentials: OAuthCredentials): Promise<void> {
69
+ const storage = await this.getStorage();
70
+ await storage.setCredentials(credentials);
71
+ }
72
+
73
+ async deleteCredentials(serverName: string): Promise<void> {
74
+ const storage = await this.getStorage();
75
+ await storage.deleteCredentials(serverName);
76
+ }
77
+
78
+ async listServers(): Promise<string[]> {
79
+ const storage = await this.getStorage();
80
+ return storage.listServers();
81
+ }
82
+
83
+ async getAllCredentials(): Promise<Map<string, OAuthCredentials>> {
84
+ const storage = await this.getStorage();
85
+ return storage.getAllCredentials();
86
+ }
87
+
88
+ async clearAll(): Promise<void> {
89
+ const storage = await this.getStorage();
90
+ await storage.clearAll();
91
+ }
92
+
93
+ async getStorageType(): Promise<TokenStorageType> {
94
+ await this.getStorage();
95
+ return this.storageType!;
96
+ }
97
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ export * from './types';
8
+ export * from './base-token-storage';
9
+ export * from './file-token-storage';
10
+ export * from './hybrid-token-storage';
11
+
12
+ export const DEFAULT_SERVICE_NAME = 'gemini-cli-oauth';
13
+ export const FORCE_ENCRYPTED_FILE_ENV_VAR =
14
+ 'GEMINI_FORCE_ENCRYPTED_FILE_STORAGE';
@@ -0,0 +1,251 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ import * as crypto from 'node:crypto';
8
+ import { BaseTokenStorage } from './base-token-storage';
9
+ import type { OAuthCredentials } from './types';
10
+
11
+ interface Keytar {
12
+ getPassword(service: string, account: string): Promise<string | null>;
13
+ setPassword(
14
+ service: string,
15
+ account: string,
16
+ password: string,
17
+ ): Promise<void>;
18
+ deletePassword(service: string, account: string): Promise<boolean>;
19
+ findCredentials(
20
+ service: string,
21
+ ): Promise<Array<{ account: string; password: string }>>;
22
+ }
23
+
24
+ const KEYCHAIN_TEST_PREFIX = '__keychain_test__';
25
+
26
+ export class KeychainTokenStorage extends BaseTokenStorage {
27
+ private keychainAvailable: boolean | null = null;
28
+ private keytarModule: Keytar | null = null;
29
+ private keytarLoadAttempted = false;
30
+
31
+ async getKeytar(): Promise<Keytar | null> {
32
+ // If we've already tried loading (successfully or not), return the result
33
+ if (this.keytarLoadAttempted) {
34
+ return this.keytarModule;
35
+ }
36
+
37
+ this.keytarLoadAttempted = true;
38
+
39
+ try {
40
+ // Try to import keytar without any timeout - let the OS handle it
41
+ const moduleName = 'keytar';
42
+ const module = await import(moduleName);
43
+ this.keytarModule = module.default || module;
44
+ } catch (error) {
45
+ console.error(error);
46
+ }
47
+ return this.keytarModule;
48
+ }
49
+
50
+ async getCredentials(serverName: string): Promise<OAuthCredentials | null> {
51
+ if (!(await this.checkKeychainAvailability())) {
52
+ throw new Error('Keychain is not available');
53
+ }
54
+
55
+ const keytar = await this.getKeytar();
56
+ if (!keytar) {
57
+ throw new Error('Keytar module not available');
58
+ }
59
+
60
+ try {
61
+ const sanitizedName = this.sanitizeServerName(serverName);
62
+ const data = await keytar.getPassword(this.serviceName, sanitizedName);
63
+
64
+ if (!data) {
65
+ return null;
66
+ }
67
+
68
+ const credentials = JSON.parse(data) as OAuthCredentials;
69
+
70
+ if (this.isTokenExpired(credentials)) {
71
+ return null;
72
+ }
73
+
74
+ return credentials;
75
+ } catch (error) {
76
+ if (error instanceof SyntaxError) {
77
+ throw new Error(`Failed to parse stored credentials for ${serverName}`);
78
+ }
79
+ throw error;
80
+ }
81
+ }
82
+
83
+ async setCredentials(credentials: OAuthCredentials): Promise<void> {
84
+ if (!(await this.checkKeychainAvailability())) {
85
+ throw new Error('Keychain is not available');
86
+ }
87
+
88
+ const keytar = await this.getKeytar();
89
+ if (!keytar) {
90
+ throw new Error('Keytar module not available');
91
+ }
92
+
93
+ this.validateCredentials(credentials);
94
+
95
+ const sanitizedName = this.sanitizeServerName(credentials.serverName);
96
+ const updatedCredentials: OAuthCredentials = {
97
+ ...credentials,
98
+ updatedAt: Date.now(),
99
+ };
100
+
101
+ const data = JSON.stringify(updatedCredentials);
102
+ await keytar.setPassword(this.serviceName, sanitizedName, data);
103
+ }
104
+
105
+ async deleteCredentials(serverName: string): Promise<void> {
106
+ if (!(await this.checkKeychainAvailability())) {
107
+ throw new Error('Keychain is not available');
108
+ }
109
+
110
+ const keytar = await this.getKeytar();
111
+ if (!keytar) {
112
+ throw new Error('Keytar module not available');
113
+ }
114
+
115
+ const sanitizedName = this.sanitizeServerName(serverName);
116
+ const deleted = await keytar.deletePassword(
117
+ this.serviceName,
118
+ sanitizedName,
119
+ );
120
+
121
+ if (!deleted) {
122
+ throw new Error(`No credentials found for ${serverName}`);
123
+ }
124
+ }
125
+
126
+ async listServers(): Promise<string[]> {
127
+ if (!(await this.checkKeychainAvailability())) {
128
+ throw new Error('Keychain is not available');
129
+ }
130
+
131
+ const keytar = await this.getKeytar();
132
+ if (!keytar) {
133
+ throw new Error('Keytar module not available');
134
+ }
135
+
136
+ try {
137
+ const credentials = await keytar.findCredentials(this.serviceName);
138
+ return credentials
139
+ .filter((cred) => !cred.account.startsWith(KEYCHAIN_TEST_PREFIX))
140
+ .map((cred: { account: string }) => cred.account);
141
+ } catch (error) {
142
+ console.error('Failed to list servers from keychain:', error);
143
+ return [];
144
+ }
145
+ }
146
+
147
+ async getAllCredentials(): Promise<Map<string, OAuthCredentials>> {
148
+ if (!(await this.checkKeychainAvailability())) {
149
+ throw new Error('Keychain is not available');
150
+ }
151
+
152
+ const keytar = await this.getKeytar();
153
+ if (!keytar) {
154
+ throw new Error('Keytar module not available');
155
+ }
156
+
157
+ const result = new Map<string, OAuthCredentials>();
158
+ try {
159
+ const credentials = (
160
+ await keytar.findCredentials(this.serviceName)
161
+ ).filter((c) => !c.account.startsWith(KEYCHAIN_TEST_PREFIX));
162
+
163
+ for (const cred of credentials) {
164
+ try {
165
+ const data = JSON.parse(cred.password) as OAuthCredentials;
166
+ if (!this.isTokenExpired(data)) {
167
+ result.set(cred.account, data);
168
+ }
169
+ } catch (error) {
170
+ console.error(
171
+ `Failed to parse credentials for ${cred.account}:`,
172
+ error,
173
+ );
174
+ }
175
+ }
176
+ } catch (error) {
177
+ console.error('Failed to get all credentials from keychain:', error);
178
+ }
179
+
180
+ return result;
181
+ }
182
+
183
+ async clearAll(): Promise<void> {
184
+ if (!(await this.checkKeychainAvailability())) {
185
+ throw new Error('Keychain is not available');
186
+ }
187
+
188
+ const servers = this.keytarModule
189
+ ? await this.keytarModule
190
+ .findCredentials(this.serviceName)
191
+ .then((creds) => creds.map((c) => c.account))
192
+ .catch((error: Error) => {
193
+ throw new Error(
194
+ `Failed to list servers for clearing: ${error.message}`,
195
+ );
196
+ })
197
+ : [];
198
+ const errors: Error[] = [];
199
+
200
+ for (const server of servers) {
201
+ try {
202
+ await this.deleteCredentials(server);
203
+ } catch (error) {
204
+ errors.push(error as Error);
205
+ }
206
+ }
207
+
208
+ if (errors.length > 0) {
209
+ throw new Error(
210
+ `Failed to clear some credentials: ${errors.map((e) => e.message).join(', ')}`,
211
+ );
212
+ }
213
+ }
214
+
215
+ // Checks whether or not a set-get-delete cycle with the keychain works.
216
+ // Returns false if any operation fails.
217
+ async checkKeychainAvailability(): Promise<boolean> {
218
+ if (this.keychainAvailable !== null) {
219
+ return this.keychainAvailable;
220
+ }
221
+
222
+ try {
223
+ const keytar = await this.getKeytar();
224
+ if (!keytar) {
225
+ this.keychainAvailable = false;
226
+ return false;
227
+ }
228
+
229
+ const testAccount = `${KEYCHAIN_TEST_PREFIX}${crypto.randomBytes(8).toString('hex')}`;
230
+ const testPassword = 'test';
231
+
232
+ await keytar.setPassword(this.serviceName, testAccount, testPassword);
233
+ const retrieved = await keytar.getPassword(this.serviceName, testAccount);
234
+ const deleted = await keytar.deletePassword(
235
+ this.serviceName,
236
+ testAccount,
237
+ );
238
+
239
+ const success = deleted && retrieved === testPassword;
240
+ this.keychainAvailable = success;
241
+ return success;
242
+ } catch (_error) {
243
+ this.keychainAvailable = false;
244
+ return false;
245
+ }
246
+ }
247
+
248
+ async isAvailable(): Promise<boolean> {
249
+ return this.checkKeychainAvailability();
250
+ }
251
+ }
@@ -0,0 +1,42 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ /**
8
+ * Interface for OAuth tokens.
9
+ */
10
+ export interface OAuthToken {
11
+ accessToken: string;
12
+ refreshToken?: string;
13
+ expiresAt?: number;
14
+ tokenType: string;
15
+ scope?: string;
16
+ }
17
+
18
+ /**
19
+ * Interface for stored OAuth credentials.
20
+ */
21
+ export interface OAuthCredentials {
22
+ serverName: string;
23
+ token: OAuthToken;
24
+ clientId?: string;
25
+ tokenUrl?: string;
26
+ mcpServerUrl?: string;
27
+ updatedAt: number;
28
+ }
29
+
30
+ export interface TokenStorage {
31
+ getCredentials(serverName: string): Promise<OAuthCredentials | null>;
32
+ setCredentials(credentials: OAuthCredentials): Promise<void>;
33
+ deleteCredentials(serverName: string): Promise<void>;
34
+ listServers(): Promise<string[]>;
35
+ getAllCredentials(): Promise<Map<string, OAuthCredentials>>;
36
+ clearAll(): Promise<void>;
37
+ }
38
+
39
+ export enum TokenStorageType {
40
+ KEYCHAIN = 'keychain',
41
+ ENCRYPTED_FILE = 'encrypted_file',
42
+ }