repoburg 1.0.69 → 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/dist/packages/gemini-core/examples/simple.d.ts +1 -0
  3. package/backend/dist/packages/gemini-core/examples/simple.js +73 -0
  4. package/backend/dist/packages/gemini-core/examples/simple.js.map +1 -0
  5. package/backend/dist/packages/gemini-core/index.d.ts +3 -0
  6. package/backend/dist/packages/gemini-core/index.js +27 -0
  7. package/backend/dist/packages/gemini-core/index.js.map +1 -0
  8. package/backend/dist/packages/gemini-core/src/code_assist/codeAssist.d.ts +5 -0
  9. package/backend/dist/packages/gemini-core/src/code_assist/codeAssist.js +17 -0
  10. package/backend/dist/packages/gemini-core/src/code_assist/codeAssist.js.map +1 -0
  11. package/backend/dist/packages/gemini-core/src/code_assist/converter.d.ts +69 -0
  12. package/backend/dist/packages/gemini-core/src/code_assist/converter.js +129 -0
  13. package/backend/dist/packages/gemini-core/src/code_assist/converter.js.map +1 -0
  14. package/backend/dist/packages/gemini-core/src/code_assist/oauth-credential-storage.d.ts +8 -0
  15. package/backend/dist/packages/gemini-core/src/code_assist/oauth-credential-storage.js +84 -0
  16. package/backend/dist/packages/gemini-core/src/code_assist/oauth-credential-storage.js.map +1 -0
  17. package/backend/dist/packages/gemini-core/src/code_assist/oauth2.d.ts +12 -0
  18. package/backend/dist/packages/gemini-core/src/code_assist/oauth2.js +371 -0
  19. package/backend/dist/packages/gemini-core/src/code_assist/oauth2.js.map +1 -0
  20. package/backend/dist/packages/gemini-core/src/code_assist/server.d.ts +28 -0
  21. package/backend/dist/packages/gemini-core/src/code_assist/server.js +135 -0
  22. package/backend/dist/packages/gemini-core/src/code_assist/server.js.map +1 -0
  23. package/backend/dist/packages/gemini-core/src/code_assist/setup.d.ts +10 -0
  24. package/backend/dist/packages/gemini-core/src/code_assist/setup.js +94 -0
  25. package/backend/dist/packages/gemini-core/src/code_assist/setup.js.map +1 -0
  26. package/backend/dist/packages/gemini-core/src/code_assist/types.d.ts +106 -0
  27. package/backend/dist/packages/gemini-core/src/code_assist/types.js +28 -0
  28. package/backend/dist/packages/gemini-core/src/code_assist/types.js.map +1 -0
  29. package/backend/dist/packages/gemini-core/src/config/config.d.ts +22 -0
  30. package/backend/dist/packages/gemini-core/src/config/config.js +38 -0
  31. package/backend/dist/packages/gemini-core/src/config/config.js.map +1 -0
  32. package/backend/dist/packages/gemini-core/src/config/models.d.ts +6 -0
  33. package/backend/dist/packages/gemini-core/src/config/models.js +13 -0
  34. package/backend/dist/packages/gemini-core/src/config/models.js.map +1 -0
  35. package/backend/dist/packages/gemini-core/src/config/storage.d.ts +8 -0
  36. package/backend/dist/packages/gemini-core/src/config/storage.js +25 -0
  37. package/backend/dist/packages/gemini-core/src/config/storage.js.map +1 -0
  38. package/backend/dist/packages/gemini-core/src/core/contentGenerator.d.ts +23 -0
  39. package/backend/dist/packages/gemini-core/src/core/contentGenerator.js +63 -0
  40. package/backend/dist/packages/gemini-core/src/core/contentGenerator.js.map +1 -0
  41. package/backend/dist/packages/gemini-core/src/core/geminiChat.d.ts +34 -0
  42. package/backend/dist/packages/gemini-core/src/core/geminiChat.js +247 -0
  43. package/backend/dist/packages/gemini-core/src/core/geminiChat.js.map +1 -0
  44. package/backend/dist/packages/gemini-core/src/core/geminiRequest.d.ts +3 -0
  45. package/backend/dist/packages/gemini-core/src/core/geminiRequest.js +8 -0
  46. package/backend/dist/packages/gemini-core/src/core/geminiRequest.js.map +1 -0
  47. package/backend/dist/packages/gemini-core/src/core/prompts.d.ts +7 -0
  48. package/backend/dist/packages/gemini-core/src/core/prompts.js +69 -0
  49. package/backend/dist/packages/gemini-core/src/core/prompts.js.map +1 -0
  50. package/backend/dist/packages/gemini-core/src/core/tokenLimits.d.ts +5 -0
  51. package/backend/dist/packages/gemini-core/src/core/tokenLimits.js +25 -0
  52. package/backend/dist/packages/gemini-core/src/core/tokenLimits.js.map +1 -0
  53. package/backend/dist/packages/gemini-core/src/index.d.ts +18 -0
  54. package/backend/dist/packages/gemini-core/src/index.js +37 -0
  55. package/backend/dist/packages/gemini-core/src/index.js.map +1 -0
  56. package/backend/dist/packages/gemini-core/src/mcp/token-storage/base-token-storage.d.ts +14 -0
  57. package/backend/dist/packages/gemini-core/src/mcp/token-storage/base-token-storage.js +34 -0
  58. package/backend/dist/packages/gemini-core/src/mcp/token-storage/base-token-storage.js.map +1 -0
  59. package/backend/dist/packages/gemini-core/src/mcp/token-storage/file-token-storage.d.ts +19 -0
  60. package/backend/dist/packages/gemini-core/src/mcp/token-storage/file-token-storage.js +141 -0
  61. package/backend/dist/packages/gemini-core/src/mcp/token-storage/file-token-storage.js.map +1 -0
  62. package/backend/dist/packages/gemini-core/src/mcp/token-storage/hybrid-token-storage.d.ts +18 -0
  63. package/backend/dist/packages/gemini-core/src/mcp/token-storage/hybrid-token-storage.js +74 -0
  64. package/backend/dist/packages/gemini-core/src/mcp/token-storage/hybrid-token-storage.js.map +1 -0
  65. package/backend/dist/packages/gemini-core/src/mcp/token-storage/index.d.ts +6 -0
  66. package/backend/dist/packages/gemini-core/src/mcp/token-storage/index.js +24 -0
  67. package/backend/dist/packages/gemini-core/src/mcp/token-storage/index.js.map +1 -0
  68. package/backend/dist/packages/gemini-core/src/mcp/token-storage/keychain-token-storage.d.ts +26 -0
  69. package/backend/dist/packages/gemini-core/src/mcp/token-storage/keychain-token-storage.js +188 -0
  70. package/backend/dist/packages/gemini-core/src/mcp/token-storage/keychain-token-storage.js.map +1 -0
  71. package/backend/dist/packages/gemini-core/src/mcp/token-storage/types.d.ts +27 -0
  72. package/backend/dist/packages/gemini-core/src/mcp/token-storage/types.js +9 -0
  73. package/backend/dist/packages/gemini-core/src/mcp/token-storage/types.js.map +1 -0
  74. package/backend/dist/packages/gemini-core/src/utils/errors.d.ts +34 -0
  75. package/backend/dist/packages/gemini-core/src/utils/errors.js +103 -0
  76. package/backend/dist/packages/gemini-core/src/utils/errors.js.map +1 -0
  77. package/backend/dist/packages/gemini-core/src/utils/partUtils.d.ts +7 -0
  78. package/backend/dist/packages/gemini-core/src/utils/partUtils.js +108 -0
  79. package/backend/dist/packages/gemini-core/src/utils/partUtils.js.map +1 -0
  80. package/backend/dist/packages/gemini-core/src/utils/quotaErrorDetection.d.ts +16 -0
  81. package/backend/dist/packages/gemini-core/src/utils/quotaErrorDetection.js +60 -0
  82. package/backend/dist/packages/gemini-core/src/utils/quotaErrorDetection.js.map +1 -0
  83. package/backend/dist/packages/gemini-core/src/utils/retry.d.ts +14 -0
  84. package/backend/dist/packages/gemini-core/src/utils/retry.js +154 -0
  85. package/backend/dist/packages/gemini-core/src/utils/retry.js.map +1 -0
  86. package/backend/dist/packages/gemini-core/src/utils/session.d.ts +1 -0
  87. package/backend/dist/packages/gemini-core/src/utils/session.js +6 -0
  88. package/backend/dist/packages/gemini-core/src/utils/session.js.map +1 -0
  89. package/backend/dist/packages/gemini-core/src/utils/userAccountManager.d.ts +10 -0
  90. package/backend/dist/packages/gemini-core/src/utils/userAccountManager.js +106 -0
  91. package/backend/dist/packages/gemini-core/src/utils/userAccountManager.js.map +1 -0
  92. package/backend/dist/src/action-execution/action-execution.module.js.map +1 -0
  93. package/backend/dist/src/action-execution/action-execution.service.js.map +1 -0
  94. package/backend/dist/src/ai-actions/ai-action-batch.service.js.map +1 -0
  95. package/backend/dist/src/ai-actions/ai-action-creation.service.js.map +1 -0
  96. package/backend/dist/src/ai-actions/ai-actions.controller.js.map +1 -0
  97. package/backend/dist/src/ai-actions/ai-actions.module.js.map +1 -0
  98. package/backend/dist/src/ai-actions/ai-actions.service.js.map +1 -0
  99. package/backend/dist/src/app.controller.js.map +1 -0
  100. package/backend/dist/src/app.module.js.map +1 -0
  101. package/backend/dist/src/app.service.js.map +1 -0
  102. package/backend/dist/src/application-state/application-state.controller.js.map +1 -0
  103. package/backend/dist/src/application-state/application-state.module.js.map +1 -0
  104. package/backend/dist/src/application-state/application-state.service.js.map +1 -0
  105. package/backend/dist/src/application-state/dto/set-auto-context-fetch-enabled.dto.js.map +1 -0
  106. package/backend/dist/src/application-state/dto/set-auto-send-to-ai-studio-enabled.dto.js.map +1 -0
  107. package/backend/dist/src/application-state/dto/set-context-token-limit.dto.js.map +1 -0
  108. package/backend/dist/src/application-state/dto/set-orchestration-timeout.dto.js.map +1 -0
  109. package/backend/dist/src/application-state/dto/set-theme.dto.js.map +1 -0
  110. package/backend/dist/src/application-state/dto/set-websocket-enabled.dto.js.map +1 -0
  111. package/backend/dist/src/context-generation/context-generation.module.js.map +1 -0
  112. package/backend/dist/src/context-generation/context-generation.service.js.map +1 -0
  113. package/backend/dist/src/context-snippets/context-snippets.controller.js.map +1 -0
  114. package/backend/dist/src/context-snippets/context-snippets.module.js.map +1 -0
  115. package/backend/dist/src/context-snippets/context-snippets.service.js.map +1 -0
  116. package/backend/dist/src/context-snippets/dto/context-snippet.dto.js.map +1 -0
  117. package/backend/dist/src/context-templates/context-templates.controller.js.map +1 -0
  118. package/backend/dist/src/context-templates/context-templates.module.js.map +1 -0
  119. package/backend/dist/src/context-templates/context-templates.service.js.map +1 -0
  120. package/backend/dist/src/context-templates/dto/context-template.dto.js.map +1 -0
  121. package/backend/dist/src/core-entities/ai-action.entity.js.map +1 -0
  122. package/backend/dist/src/core-entities/application-state.entity.js.map +1 -0
  123. package/backend/dist/src/core-entities/base.entity.js.map +1 -0
  124. package/backend/dist/src/core-entities/context-snippet.entity.js.map +1 -0
  125. package/backend/dist/src/core-entities/context-template.entity.js.map +1 -0
  126. package/backend/dist/src/core-entities/custom-snippet.entity.js.map +1 -0
  127. package/backend/dist/src/core-entities/execution-log.entity.js.map +1 -0
  128. package/backend/dist/src/core-entities/index.js.map +1 -0
  129. package/backend/dist/src/core-entities/project.entity.js.map +1 -0
  130. package/backend/dist/src/core-entities/session-input.entity.js.map +1 -0
  131. package/backend/dist/src/core-entities/session.entity.js.map +1 -0
  132. package/backend/dist/src/core-entities/system-prompt.entity.js.map +1 -0
  133. package/backend/dist/src/custom-snippets/custom-snippets.controller.js.map +1 -0
  134. package/backend/dist/src/custom-snippets/custom-snippets.module.js.map +1 -0
  135. package/backend/dist/src/custom-snippets/custom-snippets.service.js.map +1 -0
  136. package/backend/dist/src/custom-snippets/dto/custom-snippet.dto.js.map +1 -0
  137. package/backend/dist/src/events/events.gateway.js.map +1 -0
  138. package/backend/dist/src/events/events.module.js.map +1 -0
  139. package/backend/dist/src/execution-logs/dto/execution-log.dto.js.map +1 -0
  140. package/backend/dist/src/execution-logs/execution-logs.controller.js.map +1 -0
  141. package/backend/dist/src/execution-logs/execution-logs.module.js.map +1 -0
  142. package/backend/dist/src/execution-logs/execution-logs.service.js.map +1 -0
  143. package/backend/dist/src/gemini/gemini-llm.provider.d.ts +10 -0
  144. package/backend/dist/src/gemini/gemini-llm.provider.js +103 -0
  145. package/backend/dist/src/gemini/gemini-llm.provider.js.map +1 -0
  146. package/backend/dist/src/gemini/gemini.module.d.ts +2 -0
  147. package/backend/dist/src/gemini/gemini.module.js +21 -0
  148. package/backend/dist/src/gemini/gemini.module.js.map +1 -0
  149. package/backend/dist/src/http-exception.filter.js.map +1 -0
  150. package/backend/dist/src/llm-provider/llm-provider.interface.d.ts +16 -0
  151. package/backend/dist/src/llm-provider/llm-provider.interface.js +5 -0
  152. package/backend/dist/src/llm-provider/llm-provider.interface.js.map +1 -0
  153. package/backend/dist/src/llm-provider/llm-provider.module.d.ts +2 -0
  154. package/backend/dist/src/llm-provider/llm-provider.module.js +29 -0
  155. package/backend/dist/src/llm-provider/llm-provider.module.js.map +1 -0
  156. package/backend/dist/src/llm-response-parser/dto/ai-action.dto.js.map +1 -0
  157. package/backend/dist/src/llm-response-parser/errors/parsing.error.js.map +1 -0
  158. package/backend/dist/src/llm-response-parser/llm-response-parser.module.js.map +1 -0
  159. package/backend/dist/src/llm-response-parser/llm-response-parser.service.js.map +1 -0
  160. package/backend/dist/src/llm-response-parser/parsing.constants.js.map +1 -0
  161. package/backend/dist/src/llm-responses/dto/submit-llm-response.dto.js.map +1 -0
  162. package/backend/dist/src/llm-responses/llm-responses.controller.js.map +1 -0
  163. package/backend/dist/src/llm-responses/llm-responses.module.js.map +1 -0
  164. package/backend/dist/src/llm-responses/llm-responses.service.js.map +1 -0
  165. package/backend/dist/src/main.js.map +1 -0
  166. package/backend/dist/src/orchestration/dto/orchestration.dto.js.map +1 -0
  167. package/backend/dist/src/orchestration/orchestration-fs.service.js.map +1 -0
  168. package/backend/dist/src/orchestration/orchestration-parser.service.js.map +1 -0
  169. package/backend/dist/src/orchestration/orchestration.controller.js.map +1 -0
  170. package/backend/dist/src/orchestration/orchestration.module.js.map +1 -0
  171. package/backend/dist/src/orchestration/orchestration.service.js.map +1 -0
  172. package/backend/dist/src/orchestration/orchestration.types.js.map +1 -0
  173. package/backend/dist/src/projects/dto/project.dto.js.map +1 -0
  174. package/backend/dist/src/projects/projects.controller.js.map +1 -0
  175. package/backend/dist/src/projects/projects.module.js.map +1 -0
  176. package/backend/dist/src/projects/projects.service.js.map +1 -0
  177. package/backend/dist/src/seeding/context-template-seeding.service.js.map +1 -0
  178. package/backend/dist/src/seeding/custom-snippet-seeding.service.js.map +1 -0
  179. package/backend/dist/src/seeding/data/context-templates/default-followup_ad-hoc-focused-context.js.map +1 -0
  180. package/backend/dist/src/seeding/data/context-templates/default-initial_condensed-project-context.js.map +1 -0
  181. package/backend/dist/src/seeding/data/context-templates/default-initial_full-project-context.js.map +1 -0
  182. package/backend/dist/src/seeding/data/context-templates/pm-context.js.map +1 -0
  183. package/backend/dist/src/seeding/data/context-templates/pr-description.js.map +1 -0
  184. package/backend/dist/src/seeding/data/context-templates/sample_focused-tree.d.ts +2 -0
  185. package/backend/dist/{seeding → src/seeding}/data/context-templates/sample_focused-tree.js +1 -3
  186. package/backend/dist/src/seeding/data/context-templates/sample_focused-tree.js.map +1 -0
  187. package/backend/dist/src/seeding/data/custom-snippets/default_rglob.js.map +1 -0
  188. package/backend/dist/src/seeding/data/custom-snippets/git-diff.js.map +1 -0
  189. package/backend/dist/src/seeding/data/custom-snippets/rg-exclude.js.map +1 -0
  190. package/backend/dist/src/seeding/data/custom-snippets/rg-search-glob.js.map +1 -0
  191. package/backend/dist/src/seeding/data/custom-snippets/rg-search.js.map +1 -0
  192. package/backend/dist/src/seeding/data/custom-snippets/run-command.js.map +1 -0
  193. package/backend/dist/src/seeding/data/custom-snippets/tree.js.map +1 -0
  194. package/backend/dist/src/seeding/data/custom-snippets/usr-adhoc-incl.js.map +1 -0
  195. package/backend/dist/src/seeding/data/custom-snippets/usr-cmd-output-incl.js.map +1 -0
  196. package/backend/dist/src/seeding/data/custom-snippets/usr-input-incl.js.map +1 -0
  197. package/backend/dist/src/seeding/data/system-prompts/codebase-explorer.js.map +1 -0
  198. package/backend/dist/src/seeding/data/system-prompts/default_multi-file-action-generator-with-requester.js.map +1 -0
  199. package/backend/dist/src/seeding/data/system-prompts/packup.js.map +1 -0
  200. package/backend/dist/src/seeding/data/system-prompts/refactor-split.js.map +1 -0
  201. package/backend/dist/src/seeding/seeding.module.js.map +1 -0
  202. package/backend/dist/src/seeding/seeding.service.js.map +1 -0
  203. package/backend/dist/src/seeding/system-prompt-seeding.service.js.map +1 -0
  204. package/backend/dist/src/session-followup/session-followup.module.js.map +1 -0
  205. package/backend/dist/src/session-followup/session-followup.service.js.map +1 -0
  206. package/backend/dist/src/session-inputs/dto/session-input.dto.js.map +1 -0
  207. package/backend/dist/{session-inputs → src/session-inputs}/session-input-context.service.d.ts +1 -1
  208. package/backend/dist/{session-inputs → src/session-inputs}/session-input-context.service.js +10 -11
  209. package/backend/dist/src/session-inputs/session-input-context.service.js.map +1 -0
  210. package/backend/dist/src/session-inputs/session-inputs.controller.js.map +1 -0
  211. package/backend/dist/{session-inputs → src/session-inputs}/session-inputs.module.js +2 -0
  212. package/backend/dist/src/session-inputs/session-inputs.module.js.map +1 -0
  213. package/backend/dist/{session-inputs → src/session-inputs}/session-inputs.service.d.ts +3 -1
  214. package/backend/dist/{session-inputs → src/session-inputs}/session-inputs.service.js +46 -15
  215. package/backend/dist/src/session-inputs/session-inputs.service.js.map +1 -0
  216. package/backend/dist/src/session-transfer/session-transfer.module.js.map +1 -0
  217. package/backend/dist/src/session-transfer/session-transfer.service.js.map +1 -0
  218. package/backend/dist/src/sessions/dto/session.dto.js.map +1 -0
  219. package/backend/dist/src/sessions/sessions.controller.js.map +1 -0
  220. package/backend/dist/src/sessions/sessions.module.js.map +1 -0
  221. package/backend/dist/src/sessions/sessions.service.js.map +1 -0
  222. package/backend/dist/src/system-prompts/dto/system-prompt.dto.js.map +1 -0
  223. package/backend/dist/src/system-prompts/system-prompts.controller.js.map +1 -0
  224. package/backend/dist/src/system-prompts/system-prompts.module.js.map +1 -0
  225. package/backend/dist/src/system-prompts/system-prompts.service.js.map +1 -0
  226. package/backend/dist/{timeout.interceptor.js → src/timeout.interceptor.js} +1 -1
  227. package/backend/dist/src/timeout.interceptor.js.map +1 -0
  228. package/backend/dist/src/tracing.js.map +1 -0
  229. package/backend/dist/src/utils/fuzzy-search.js.map +1 -0
  230. package/backend/dist/src/utils/index.js.map +1 -0
  231. package/backend/dist/src/utils/trace.decorator.js.map +1 -0
  232. package/backend/dist/src/workspace/dto/file-tree.dto.js.map +1 -0
  233. package/backend/dist/src/workspace/dto/search-workspace.dto.js.map +1 -0
  234. package/backend/dist/src/workspace/workspace.controller.js.map +1 -0
  235. package/backend/dist/src/workspace/workspace.module.js.map +1 -0
  236. package/backend/dist/src/workspace/workspace.service.js.map +1 -0
  237. package/backend/dist/tsconfig.build.tsbuildinfo +1 -1
  238. package/backend/packages/gemini-core/examples/simple.ts +120 -0
  239. package/backend/packages/gemini-core/index.ts +15 -0
  240. package/backend/packages/gemini-core/src/code_assist/codeAssist.ts +37 -0
  241. package/backend/packages/gemini-core/src/code_assist/converter.ts +250 -0
  242. package/backend/packages/gemini-core/src/code_assist/oauth-credential-storage.ts +129 -0
  243. package/backend/packages/gemini-core/src/code_assist/oauth2.ts +541 -0
  244. package/backend/packages/gemini-core/src/code_assist/server.ts +236 -0
  245. package/backend/packages/gemini-core/src/code_assist/setup.ts +124 -0
  246. package/backend/packages/gemini-core/src/code_assist/types.ts +201 -0
  247. package/backend/packages/gemini-core/src/config/config.ts +75 -0
  248. package/backend/packages/gemini-core/src/config/models.ts +23 -0
  249. package/backend/packages/gemini-core/src/config/storage.ts +30 -0
  250. package/backend/packages/gemini-core/src/core/contentGenerator.ts +136 -0
  251. package/backend/packages/gemini-core/src/core/geminiChat.ts +385 -0
  252. package/backend/packages/gemini-core/src/core/geminiRequest.ts +19 -0
  253. package/backend/packages/gemini-core/src/core/prompts.ts +109 -0
  254. package/backend/packages/gemini-core/src/core/tokenLimits.ts +32 -0
  255. package/backend/packages/gemini-core/src/index.ts +35 -0
  256. package/backend/packages/gemini-core/src/mcp/token-storage/base-token-storage.ts +49 -0
  257. package/backend/packages/gemini-core/src/mcp/token-storage/file-token-storage.ts +184 -0
  258. package/backend/packages/gemini-core/src/mcp/token-storage/hybrid-token-storage.ts +97 -0
  259. package/backend/packages/gemini-core/src/mcp/token-storage/index.ts +14 -0
  260. package/backend/packages/gemini-core/src/mcp/token-storage/keychain-token-storage.ts +251 -0
  261. package/backend/packages/gemini-core/src/mcp/token-storage/types.ts +42 -0
  262. package/backend/packages/gemini-core/src/utils/errors.ts +112 -0
  263. package/backend/packages/gemini-core/src/utils/partUtils.ts +169 -0
  264. package/backend/packages/gemini-core/src/utils/quotaErrorDetection.ts +102 -0
  265. package/backend/packages/gemini-core/src/utils/retry.ts +265 -0
  266. package/backend/packages/gemini-core/src/utils/session.ts +9 -0
  267. package/backend/packages/gemini-core/src/utils/userAccountManager.ts +140 -0
  268. package/package.json +5 -3
  269. package/backend/.repoburg/orchestrations/README.md +0 -41
  270. package/backend/dist/action-execution/action-execution.module.js.map +0 -1
  271. package/backend/dist/action-execution/action-execution.service.js.map +0 -1
  272. package/backend/dist/ai-actions/ai-action-batch.service.js.map +0 -1
  273. package/backend/dist/ai-actions/ai-action-creation.service.js.map +0 -1
  274. package/backend/dist/ai-actions/ai-actions.controller.js.map +0 -1
  275. package/backend/dist/ai-actions/ai-actions.module.js.map +0 -1
  276. package/backend/dist/ai-actions/ai-actions.service.js.map +0 -1
  277. package/backend/dist/app.controller.js.map +0 -1
  278. package/backend/dist/app.module.js.map +0 -1
  279. package/backend/dist/app.service.js.map +0 -1
  280. package/backend/dist/application-state/application-state.controller.js.map +0 -1
  281. package/backend/dist/application-state/application-state.module.js.map +0 -1
  282. package/backend/dist/application-state/application-state.service.js.map +0 -1
  283. package/backend/dist/application-state/dto/set-auto-context-fetch-enabled.dto.js.map +0 -1
  284. package/backend/dist/application-state/dto/set-auto-send-to-ai-studio-enabled.dto.js.map +0 -1
  285. package/backend/dist/application-state/dto/set-context-token-limit.dto.js.map +0 -1
  286. package/backend/dist/application-state/dto/set-orchestration-timeout.dto.js.map +0 -1
  287. package/backend/dist/application-state/dto/set-theme.dto.js.map +0 -1
  288. package/backend/dist/application-state/dto/set-websocket-enabled.dto.js.map +0 -1
  289. package/backend/dist/context-generation/context-generation.module.js.map +0 -1
  290. package/backend/dist/context-generation/context-generation.service.js.map +0 -1
  291. package/backend/dist/context-snippets/context-snippets.controller.js.map +0 -1
  292. package/backend/dist/context-snippets/context-snippets.module.js.map +0 -1
  293. package/backend/dist/context-snippets/context-snippets.service.js.map +0 -1
  294. package/backend/dist/context-snippets/dto/context-snippet.dto.js.map +0 -1
  295. package/backend/dist/context-templates/context-templates.controller.js.map +0 -1
  296. package/backend/dist/context-templates/context-templates.module.js.map +0 -1
  297. package/backend/dist/context-templates/context-templates.service.js.map +0 -1
  298. package/backend/dist/context-templates/dto/context-template.dto.js.map +0 -1
  299. package/backend/dist/core-entities/ai-action.entity.js.map +0 -1
  300. package/backend/dist/core-entities/application-state.entity.js.map +0 -1
  301. package/backend/dist/core-entities/base.entity.js.map +0 -1
  302. package/backend/dist/core-entities/context-snippet.entity.js.map +0 -1
  303. package/backend/dist/core-entities/context-template.entity.js.map +0 -1
  304. package/backend/dist/core-entities/custom-snippet.entity.js.map +0 -1
  305. package/backend/dist/core-entities/execution-log.entity.js.map +0 -1
  306. package/backend/dist/core-entities/index.js.map +0 -1
  307. package/backend/dist/core-entities/project.entity.js.map +0 -1
  308. package/backend/dist/core-entities/session-input.entity.js.map +0 -1
  309. package/backend/dist/core-entities/session.entity.js.map +0 -1
  310. package/backend/dist/core-entities/system-prompt.entity.js.map +0 -1
  311. package/backend/dist/custom-snippets/custom-snippets.controller.js.map +0 -1
  312. package/backend/dist/custom-snippets/custom-snippets.module.js.map +0 -1
  313. package/backend/dist/custom-snippets/custom-snippets.service.js.map +0 -1
  314. package/backend/dist/custom-snippets/dto/custom-snippet.dto.js.map +0 -1
  315. package/backend/dist/events/events.gateway.js.map +0 -1
  316. package/backend/dist/events/events.module.js.map +0 -1
  317. package/backend/dist/execution-logs/dto/execution-log.dto.js.map +0 -1
  318. package/backend/dist/execution-logs/execution-logs.controller.js.map +0 -1
  319. package/backend/dist/execution-logs/execution-logs.module.js.map +0 -1
  320. package/backend/dist/execution-logs/execution-logs.service.js.map +0 -1
  321. package/backend/dist/http-exception.filter.js.map +0 -1
  322. package/backend/dist/llm-response-parser/dto/ai-action.dto.js.map +0 -1
  323. package/backend/dist/llm-response-parser/errors/parsing.error.js.map +0 -1
  324. package/backend/dist/llm-response-parser/llm-response-parser.module.js.map +0 -1
  325. package/backend/dist/llm-response-parser/llm-response-parser.service.js.map +0 -1
  326. package/backend/dist/llm-response-parser/parsing.constants.js.map +0 -1
  327. package/backend/dist/llm-responses/dto/submit-llm-response.dto.js.map +0 -1
  328. package/backend/dist/llm-responses/llm-responses.controller.js.map +0 -1
  329. package/backend/dist/llm-responses/llm-responses.module.js.map +0 -1
  330. package/backend/dist/llm-responses/llm-responses.service.js.map +0 -1
  331. package/backend/dist/main.js.map +0 -1
  332. package/backend/dist/orchestration/dto/orchestration.dto.js.map +0 -1
  333. package/backend/dist/orchestration/orchestration-fs.service.js.map +0 -1
  334. package/backend/dist/orchestration/orchestration-parser.service.js.map +0 -1
  335. package/backend/dist/orchestration/orchestration.controller.js.map +0 -1
  336. package/backend/dist/orchestration/orchestration.module.js.map +0 -1
  337. package/backend/dist/orchestration/orchestration.service.js.map +0 -1
  338. package/backend/dist/orchestration/orchestration.types.js.map +0 -1
  339. package/backend/dist/projects/dto/project.dto.js.map +0 -1
  340. package/backend/dist/projects/projects.controller.js.map +0 -1
  341. package/backend/dist/projects/projects.module.js.map +0 -1
  342. package/backend/dist/projects/projects.service.js.map +0 -1
  343. package/backend/dist/seeding/context-template-seeding.service.js.map +0 -1
  344. package/backend/dist/seeding/custom-snippet-seeding.service.js.map +0 -1
  345. package/backend/dist/seeding/data/context-templates/default-followup_ad-hoc-focused-context.js.map +0 -1
  346. package/backend/dist/seeding/data/context-templates/default-initial_condensed-project-context.js.map +0 -1
  347. package/backend/dist/seeding/data/context-templates/default-initial_full-project-context.js.map +0 -1
  348. package/backend/dist/seeding/data/context-templates/pm-context.js.map +0 -1
  349. package/backend/dist/seeding/data/context-templates/pr-description.js.map +0 -1
  350. package/backend/dist/seeding/data/context-templates/sample_focused-tree.d.ts +0 -2
  351. package/backend/dist/seeding/data/context-templates/sample_focused-tree.js.map +0 -1
  352. package/backend/dist/seeding/data/custom-snippets/default_rglob.js.map +0 -1
  353. package/backend/dist/seeding/data/custom-snippets/git-diff.js.map +0 -1
  354. package/backend/dist/seeding/data/custom-snippets/rg-exclude.js.map +0 -1
  355. package/backend/dist/seeding/data/custom-snippets/rg-search-glob.js.map +0 -1
  356. package/backend/dist/seeding/data/custom-snippets/rg-search.js.map +0 -1
  357. package/backend/dist/seeding/data/custom-snippets/run-command.js.map +0 -1
  358. package/backend/dist/seeding/data/custom-snippets/tree.js.map +0 -1
  359. package/backend/dist/seeding/data/custom-snippets/usr-adhoc-incl.js.map +0 -1
  360. package/backend/dist/seeding/data/custom-snippets/usr-cmd-output-incl.js.map +0 -1
  361. package/backend/dist/seeding/data/custom-snippets/usr-input-incl.js.map +0 -1
  362. package/backend/dist/seeding/data/system-prompts/codebase-explorer.js.map +0 -1
  363. package/backend/dist/seeding/data/system-prompts/default_multi-file-action-generator-with-requester.js.map +0 -1
  364. package/backend/dist/seeding/data/system-prompts/packup.js.map +0 -1
  365. package/backend/dist/seeding/data/system-prompts/refactor-split.js.map +0 -1
  366. package/backend/dist/seeding/seeding.module.js.map +0 -1
  367. package/backend/dist/seeding/seeding.service.js.map +0 -1
  368. package/backend/dist/seeding/system-prompt-seeding.service.js.map +0 -1
  369. package/backend/dist/session-followup/session-followup.module.js.map +0 -1
  370. package/backend/dist/session-followup/session-followup.service.js.map +0 -1
  371. package/backend/dist/session-inputs/dto/session-input.dto.js.map +0 -1
  372. package/backend/dist/session-inputs/session-input-context.service.js.map +0 -1
  373. package/backend/dist/session-inputs/session-inputs.controller.js.map +0 -1
  374. package/backend/dist/session-inputs/session-inputs.module.js.map +0 -1
  375. package/backend/dist/session-inputs/session-inputs.service.js.map +0 -1
  376. package/backend/dist/session-transfer/session-transfer.module.js.map +0 -1
  377. package/backend/dist/session-transfer/session-transfer.service.js.map +0 -1
  378. package/backend/dist/sessions/dto/session.dto.js.map +0 -1
  379. package/backend/dist/sessions/sessions.controller.js.map +0 -1
  380. package/backend/dist/sessions/sessions.module.js.map +0 -1
  381. package/backend/dist/sessions/sessions.service.js.map +0 -1
  382. package/backend/dist/system-prompts/dto/system-prompt.dto.js.map +0 -1
  383. package/backend/dist/system-prompts/system-prompts.controller.js.map +0 -1
  384. package/backend/dist/system-prompts/system-prompts.module.js.map +0 -1
  385. package/backend/dist/system-prompts/system-prompts.service.js.map +0 -1
  386. package/backend/dist/timeout.interceptor.js.map +0 -1
  387. package/backend/dist/tracing.js.map +0 -1
  388. package/backend/dist/utils/fuzzy-search.js.map +0 -1
  389. package/backend/dist/utils/index.js.map +0 -1
  390. package/backend/dist/utils/trace.decorator.js.map +0 -1
  391. package/backend/dist/workspace/dto/file-tree.dto.js.map +0 -1
  392. package/backend/dist/workspace/dto/search-workspace.dto.js.map +0 -1
  393. package/backend/dist/workspace/workspace.controller.js.map +0 -1
  394. package/backend/dist/workspace/workspace.module.js.map +0 -1
  395. package/backend/dist/workspace/workspace.service.js.map +0 -1
  396. /package/backend/dist/{action-execution → src/action-execution}/action-execution.module.d.ts +0 -0
  397. /package/backend/dist/{action-execution → src/action-execution}/action-execution.module.js +0 -0
  398. /package/backend/dist/{action-execution → src/action-execution}/action-execution.service.d.ts +0 -0
  399. /package/backend/dist/{action-execution → src/action-execution}/action-execution.service.js +0 -0
  400. /package/backend/dist/{ai-actions → src/ai-actions}/ai-action-batch.service.d.ts +0 -0
  401. /package/backend/dist/{ai-actions → src/ai-actions}/ai-action-batch.service.js +0 -0
  402. /package/backend/dist/{ai-actions → src/ai-actions}/ai-action-creation.service.d.ts +0 -0
  403. /package/backend/dist/{ai-actions → src/ai-actions}/ai-action-creation.service.js +0 -0
  404. /package/backend/dist/{ai-actions → src/ai-actions}/ai-actions.controller.d.ts +0 -0
  405. /package/backend/dist/{ai-actions → src/ai-actions}/ai-actions.controller.js +0 -0
  406. /package/backend/dist/{ai-actions → src/ai-actions}/ai-actions.module.d.ts +0 -0
  407. /package/backend/dist/{ai-actions → src/ai-actions}/ai-actions.module.js +0 -0
  408. /package/backend/dist/{ai-actions → src/ai-actions}/ai-actions.service.d.ts +0 -0
  409. /package/backend/dist/{ai-actions → src/ai-actions}/ai-actions.service.js +0 -0
  410. /package/backend/dist/{app.controller.d.ts → src/app.controller.d.ts} +0 -0
  411. /package/backend/dist/{app.controller.js → src/app.controller.js} +0 -0
  412. /package/backend/dist/{app.module.d.ts → src/app.module.d.ts} +0 -0
  413. /package/backend/dist/{app.module.js → src/app.module.js} +0 -0
  414. /package/backend/dist/{app.service.d.ts → src/app.service.d.ts} +0 -0
  415. /package/backend/dist/{app.service.js → src/app.service.js} +0 -0
  416. /package/backend/dist/{application-state → src/application-state}/application-state.controller.d.ts +0 -0
  417. /package/backend/dist/{application-state → src/application-state}/application-state.controller.js +0 -0
  418. /package/backend/dist/{application-state → src/application-state}/application-state.module.d.ts +0 -0
  419. /package/backend/dist/{application-state → src/application-state}/application-state.module.js +0 -0
  420. /package/backend/dist/{application-state → src/application-state}/application-state.service.d.ts +0 -0
  421. /package/backend/dist/{application-state → src/application-state}/application-state.service.js +0 -0
  422. /package/backend/dist/{application-state → src/application-state}/dto/set-auto-context-fetch-enabled.dto.d.ts +0 -0
  423. /package/backend/dist/{application-state → src/application-state}/dto/set-auto-context-fetch-enabled.dto.js +0 -0
  424. /package/backend/dist/{application-state → src/application-state}/dto/set-auto-send-to-ai-studio-enabled.dto.d.ts +0 -0
  425. /package/backend/dist/{application-state → src/application-state}/dto/set-auto-send-to-ai-studio-enabled.dto.js +0 -0
  426. /package/backend/dist/{application-state → src/application-state}/dto/set-context-token-limit.dto.d.ts +0 -0
  427. /package/backend/dist/{application-state → src/application-state}/dto/set-context-token-limit.dto.js +0 -0
  428. /package/backend/dist/{application-state → src/application-state}/dto/set-orchestration-timeout.dto.d.ts +0 -0
  429. /package/backend/dist/{application-state → src/application-state}/dto/set-orchestration-timeout.dto.js +0 -0
  430. /package/backend/dist/{application-state → src/application-state}/dto/set-theme.dto.d.ts +0 -0
  431. /package/backend/dist/{application-state → src/application-state}/dto/set-theme.dto.js +0 -0
  432. /package/backend/dist/{application-state → src/application-state}/dto/set-websocket-enabled.dto.d.ts +0 -0
  433. /package/backend/dist/{application-state → src/application-state}/dto/set-websocket-enabled.dto.js +0 -0
  434. /package/backend/dist/{context-generation → src/context-generation}/context-generation.module.d.ts +0 -0
  435. /package/backend/dist/{context-generation → src/context-generation}/context-generation.module.js +0 -0
  436. /package/backend/dist/{context-generation → src/context-generation}/context-generation.service.d.ts +0 -0
  437. /package/backend/dist/{context-generation → src/context-generation}/context-generation.service.js +0 -0
  438. /package/backend/dist/{context-snippets → src/context-snippets}/context-snippets.controller.d.ts +0 -0
  439. /package/backend/dist/{context-snippets → src/context-snippets}/context-snippets.controller.js +0 -0
  440. /package/backend/dist/{context-snippets → src/context-snippets}/context-snippets.module.d.ts +0 -0
  441. /package/backend/dist/{context-snippets → src/context-snippets}/context-snippets.module.js +0 -0
  442. /package/backend/dist/{context-snippets → src/context-snippets}/context-snippets.service.d.ts +0 -0
  443. /package/backend/dist/{context-snippets → src/context-snippets}/context-snippets.service.js +0 -0
  444. /package/backend/dist/{context-snippets → src/context-snippets}/dto/context-snippet.dto.d.ts +0 -0
  445. /package/backend/dist/{context-snippets → src/context-snippets}/dto/context-snippet.dto.js +0 -0
  446. /package/backend/dist/{context-templates → src/context-templates}/context-templates.controller.d.ts +0 -0
  447. /package/backend/dist/{context-templates → src/context-templates}/context-templates.controller.js +0 -0
  448. /package/backend/dist/{context-templates → src/context-templates}/context-templates.module.d.ts +0 -0
  449. /package/backend/dist/{context-templates → src/context-templates}/context-templates.module.js +0 -0
  450. /package/backend/dist/{context-templates → src/context-templates}/context-templates.service.d.ts +0 -0
  451. /package/backend/dist/{context-templates → src/context-templates}/context-templates.service.js +0 -0
  452. /package/backend/dist/{context-templates → src/context-templates}/dto/context-template.dto.d.ts +0 -0
  453. /package/backend/dist/{context-templates → src/context-templates}/dto/context-template.dto.js +0 -0
  454. /package/backend/dist/{core-entities → src/core-entities}/ai-action.entity.d.ts +0 -0
  455. /package/backend/dist/{core-entities → src/core-entities}/ai-action.entity.js +0 -0
  456. /package/backend/dist/{core-entities → src/core-entities}/application-state.entity.d.ts +0 -0
  457. /package/backend/dist/{core-entities → src/core-entities}/application-state.entity.js +0 -0
  458. /package/backend/dist/{core-entities → src/core-entities}/base.entity.d.ts +0 -0
  459. /package/backend/dist/{core-entities → src/core-entities}/base.entity.js +0 -0
  460. /package/backend/dist/{core-entities → src/core-entities}/context-snippet.entity.d.ts +0 -0
  461. /package/backend/dist/{core-entities → src/core-entities}/context-snippet.entity.js +0 -0
  462. /package/backend/dist/{core-entities → src/core-entities}/context-template.entity.d.ts +0 -0
  463. /package/backend/dist/{core-entities → src/core-entities}/context-template.entity.js +0 -0
  464. /package/backend/dist/{core-entities → src/core-entities}/custom-snippet.entity.d.ts +0 -0
  465. /package/backend/dist/{core-entities → src/core-entities}/custom-snippet.entity.js +0 -0
  466. /package/backend/dist/{core-entities → src/core-entities}/execution-log.entity.d.ts +0 -0
  467. /package/backend/dist/{core-entities → src/core-entities}/execution-log.entity.js +0 -0
  468. /package/backend/dist/{core-entities → src/core-entities}/index.d.ts +0 -0
  469. /package/backend/dist/{core-entities → src/core-entities}/index.js +0 -0
  470. /package/backend/dist/{core-entities → src/core-entities}/project.entity.d.ts +0 -0
  471. /package/backend/dist/{core-entities → src/core-entities}/project.entity.js +0 -0
  472. /package/backend/dist/{core-entities → src/core-entities}/session-input.entity.d.ts +0 -0
  473. /package/backend/dist/{core-entities → src/core-entities}/session-input.entity.js +0 -0
  474. /package/backend/dist/{core-entities → src/core-entities}/session.entity.d.ts +0 -0
  475. /package/backend/dist/{core-entities → src/core-entities}/session.entity.js +0 -0
  476. /package/backend/dist/{core-entities → src/core-entities}/system-prompt.entity.d.ts +0 -0
  477. /package/backend/dist/{core-entities → src/core-entities}/system-prompt.entity.js +0 -0
  478. /package/backend/dist/{custom-snippets → src/custom-snippets}/custom-snippets.controller.d.ts +0 -0
  479. /package/backend/dist/{custom-snippets → src/custom-snippets}/custom-snippets.controller.js +0 -0
  480. /package/backend/dist/{custom-snippets → src/custom-snippets}/custom-snippets.module.d.ts +0 -0
  481. /package/backend/dist/{custom-snippets → src/custom-snippets}/custom-snippets.module.js +0 -0
  482. /package/backend/dist/{custom-snippets → src/custom-snippets}/custom-snippets.service.d.ts +0 -0
  483. /package/backend/dist/{custom-snippets → src/custom-snippets}/custom-snippets.service.js +0 -0
  484. /package/backend/dist/{custom-snippets → src/custom-snippets}/dto/custom-snippet.dto.d.ts +0 -0
  485. /package/backend/dist/{custom-snippets → src/custom-snippets}/dto/custom-snippet.dto.js +0 -0
  486. /package/backend/dist/{events → src/events}/events.gateway.d.ts +0 -0
  487. /package/backend/dist/{events → src/events}/events.gateway.js +0 -0
  488. /package/backend/dist/{events → src/events}/events.module.d.ts +0 -0
  489. /package/backend/dist/{events → src/events}/events.module.js +0 -0
  490. /package/backend/dist/{execution-logs → src/execution-logs}/dto/execution-log.dto.d.ts +0 -0
  491. /package/backend/dist/{execution-logs → src/execution-logs}/dto/execution-log.dto.js +0 -0
  492. /package/backend/dist/{execution-logs → src/execution-logs}/execution-logs.controller.d.ts +0 -0
  493. /package/backend/dist/{execution-logs → src/execution-logs}/execution-logs.controller.js +0 -0
  494. /package/backend/dist/{execution-logs → src/execution-logs}/execution-logs.module.d.ts +0 -0
  495. /package/backend/dist/{execution-logs → src/execution-logs}/execution-logs.module.js +0 -0
  496. /package/backend/dist/{execution-logs → src/execution-logs}/execution-logs.service.d.ts +0 -0
  497. /package/backend/dist/{execution-logs → src/execution-logs}/execution-logs.service.js +0 -0
  498. /package/backend/dist/{http-exception.filter.d.ts → src/http-exception.filter.d.ts} +0 -0
  499. /package/backend/dist/{http-exception.filter.js → src/http-exception.filter.js} +0 -0
  500. /package/backend/dist/{llm-response-parser → src/llm-response-parser}/dto/ai-action.dto.d.ts +0 -0
  501. /package/backend/dist/{llm-response-parser → src/llm-response-parser}/dto/ai-action.dto.js +0 -0
  502. /package/backend/dist/{llm-response-parser → src/llm-response-parser}/errors/parsing.error.d.ts +0 -0
  503. /package/backend/dist/{llm-response-parser → src/llm-response-parser}/errors/parsing.error.js +0 -0
  504. /package/backend/dist/{llm-response-parser → src/llm-response-parser}/llm-response-parser.module.d.ts +0 -0
  505. /package/backend/dist/{llm-response-parser → src/llm-response-parser}/llm-response-parser.module.js +0 -0
  506. /package/backend/dist/{llm-response-parser → src/llm-response-parser}/llm-response-parser.service.d.ts +0 -0
  507. /package/backend/dist/{llm-response-parser → src/llm-response-parser}/llm-response-parser.service.js +0 -0
  508. /package/backend/dist/{llm-response-parser → src/llm-response-parser}/parsing.constants.d.ts +0 -0
  509. /package/backend/dist/{llm-response-parser → src/llm-response-parser}/parsing.constants.js +0 -0
  510. /package/backend/dist/{llm-responses → src/llm-responses}/dto/submit-llm-response.dto.d.ts +0 -0
  511. /package/backend/dist/{llm-responses → src/llm-responses}/dto/submit-llm-response.dto.js +0 -0
  512. /package/backend/dist/{llm-responses → src/llm-responses}/llm-responses.controller.d.ts +0 -0
  513. /package/backend/dist/{llm-responses → src/llm-responses}/llm-responses.controller.js +0 -0
  514. /package/backend/dist/{llm-responses → src/llm-responses}/llm-responses.module.d.ts +0 -0
  515. /package/backend/dist/{llm-responses → src/llm-responses}/llm-responses.module.js +0 -0
  516. /package/backend/dist/{llm-responses → src/llm-responses}/llm-responses.service.d.ts +0 -0
  517. /package/backend/dist/{llm-responses → src/llm-responses}/llm-responses.service.js +0 -0
  518. /package/backend/dist/{main.d.ts → src/main.d.ts} +0 -0
  519. /package/backend/dist/{main.js → src/main.js} +0 -0
  520. /package/backend/dist/{orchestration → src/orchestration}/dto/orchestration.dto.d.ts +0 -0
  521. /package/backend/dist/{orchestration → src/orchestration}/dto/orchestration.dto.js +0 -0
  522. /package/backend/dist/{orchestration → src/orchestration}/orchestration-fs.service.d.ts +0 -0
  523. /package/backend/dist/{orchestration → src/orchestration}/orchestration-fs.service.js +0 -0
  524. /package/backend/dist/{orchestration → src/orchestration}/orchestration-parser.service.d.ts +0 -0
  525. /package/backend/dist/{orchestration → src/orchestration}/orchestration-parser.service.js +0 -0
  526. /package/backend/dist/{orchestration → src/orchestration}/orchestration.controller.d.ts +0 -0
  527. /package/backend/dist/{orchestration → src/orchestration}/orchestration.controller.js +0 -0
  528. /package/backend/dist/{orchestration → src/orchestration}/orchestration.module.d.ts +0 -0
  529. /package/backend/dist/{orchestration → src/orchestration}/orchestration.module.js +0 -0
  530. /package/backend/dist/{orchestration → src/orchestration}/orchestration.service.d.ts +0 -0
  531. /package/backend/dist/{orchestration → src/orchestration}/orchestration.service.js +0 -0
  532. /package/backend/dist/{orchestration → src/orchestration}/orchestration.types.d.ts +0 -0
  533. /package/backend/dist/{orchestration → src/orchestration}/orchestration.types.js +0 -0
  534. /package/backend/dist/{projects → src/projects}/dto/project.dto.d.ts +0 -0
  535. /package/backend/dist/{projects → src/projects}/dto/project.dto.js +0 -0
  536. /package/backend/dist/{projects → src/projects}/projects.controller.d.ts +0 -0
  537. /package/backend/dist/{projects → src/projects}/projects.controller.js +0 -0
  538. /package/backend/dist/{projects → src/projects}/projects.module.d.ts +0 -0
  539. /package/backend/dist/{projects → src/projects}/projects.module.js +0 -0
  540. /package/backend/dist/{projects → src/projects}/projects.service.d.ts +0 -0
  541. /package/backend/dist/{projects → src/projects}/projects.service.js +0 -0
  542. /package/backend/dist/{seeding → src/seeding}/context-template-seeding.service.d.ts +0 -0
  543. /package/backend/dist/{seeding → src/seeding}/context-template-seeding.service.js +0 -0
  544. /package/backend/dist/{seeding → src/seeding}/custom-snippet-seeding.service.d.ts +0 -0
  545. /package/backend/dist/{seeding → src/seeding}/custom-snippet-seeding.service.js +0 -0
  546. /package/backend/dist/{seeding → src/seeding}/data/context-templates/default-followup_ad-hoc-focused-context.d.ts +0 -0
  547. /package/backend/dist/{seeding → src/seeding}/data/context-templates/default-followup_ad-hoc-focused-context.js +0 -0
  548. /package/backend/dist/{seeding → src/seeding}/data/context-templates/default-initial_condensed-project-context.d.ts +0 -0
  549. /package/backend/dist/{seeding → src/seeding}/data/context-templates/default-initial_condensed-project-context.js +0 -0
  550. /package/backend/dist/{seeding → src/seeding}/data/context-templates/default-initial_full-project-context.d.ts +0 -0
  551. /package/backend/dist/{seeding → src/seeding}/data/context-templates/default-initial_full-project-context.js +0 -0
  552. /package/backend/dist/{seeding → src/seeding}/data/context-templates/pm-context.d.ts +0 -0
  553. /package/backend/dist/{seeding → src/seeding}/data/context-templates/pm-context.js +0 -0
  554. /package/backend/dist/{seeding → src/seeding}/data/context-templates/pr-description.d.ts +0 -0
  555. /package/backend/dist/{seeding → src/seeding}/data/context-templates/pr-description.js +0 -0
  556. /package/backend/dist/{seeding → src/seeding}/data/custom-snippets/default_rglob.d.ts +0 -0
  557. /package/backend/dist/{seeding → src/seeding}/data/custom-snippets/default_rglob.js +0 -0
  558. /package/backend/dist/{seeding → src/seeding}/data/custom-snippets/git-diff.d.ts +0 -0
  559. /package/backend/dist/{seeding → src/seeding}/data/custom-snippets/git-diff.js +0 -0
  560. /package/backend/dist/{seeding → src/seeding}/data/custom-snippets/rg-exclude.d.ts +0 -0
  561. /package/backend/dist/{seeding → src/seeding}/data/custom-snippets/rg-exclude.js +0 -0
  562. /package/backend/dist/{seeding → src/seeding}/data/custom-snippets/rg-search-glob.d.ts +0 -0
  563. /package/backend/dist/{seeding → src/seeding}/data/custom-snippets/rg-search-glob.js +0 -0
  564. /package/backend/dist/{seeding → src/seeding}/data/custom-snippets/rg-search.d.ts +0 -0
  565. /package/backend/dist/{seeding → src/seeding}/data/custom-snippets/rg-search.js +0 -0
  566. /package/backend/dist/{seeding → src/seeding}/data/custom-snippets/run-command.d.ts +0 -0
  567. /package/backend/dist/{seeding → src/seeding}/data/custom-snippets/run-command.js +0 -0
  568. /package/backend/dist/{seeding → src/seeding}/data/custom-snippets/tree.d.ts +0 -0
  569. /package/backend/dist/{seeding → src/seeding}/data/custom-snippets/tree.js +0 -0
  570. /package/backend/dist/{seeding → src/seeding}/data/custom-snippets/usr-adhoc-incl.d.ts +0 -0
  571. /package/backend/dist/{seeding → src/seeding}/data/custom-snippets/usr-adhoc-incl.js +0 -0
  572. /package/backend/dist/{seeding → src/seeding}/data/custom-snippets/usr-cmd-output-incl.d.ts +0 -0
  573. /package/backend/dist/{seeding → src/seeding}/data/custom-snippets/usr-cmd-output-incl.js +0 -0
  574. /package/backend/dist/{seeding → src/seeding}/data/custom-snippets/usr-input-incl.d.ts +0 -0
  575. /package/backend/dist/{seeding → src/seeding}/data/custom-snippets/usr-input-incl.js +0 -0
  576. /package/backend/dist/{seeding → src/seeding}/data/system-prompts/codebase-explorer.d.ts +0 -0
  577. /package/backend/dist/{seeding → src/seeding}/data/system-prompts/codebase-explorer.js +0 -0
  578. /package/backend/dist/{seeding → src/seeding}/data/system-prompts/default_multi-file-action-generator-with-requester.d.ts +0 -0
  579. /package/backend/dist/{seeding → src/seeding}/data/system-prompts/default_multi-file-action-generator-with-requester.js +0 -0
  580. /package/backend/dist/{seeding → src/seeding}/data/system-prompts/packup.d.ts +0 -0
  581. /package/backend/dist/{seeding → src/seeding}/data/system-prompts/packup.js +0 -0
  582. /package/backend/dist/{seeding → src/seeding}/data/system-prompts/refactor-split.d.ts +0 -0
  583. /package/backend/dist/{seeding → src/seeding}/data/system-prompts/refactor-split.js +0 -0
  584. /package/backend/dist/{seeding → src/seeding}/seeding.module.d.ts +0 -0
  585. /package/backend/dist/{seeding → src/seeding}/seeding.module.js +0 -0
  586. /package/backend/dist/{seeding → src/seeding}/seeding.service.d.ts +0 -0
  587. /package/backend/dist/{seeding → src/seeding}/seeding.service.js +0 -0
  588. /package/backend/dist/{seeding → src/seeding}/system-prompt-seeding.service.d.ts +0 -0
  589. /package/backend/dist/{seeding → src/seeding}/system-prompt-seeding.service.js +0 -0
  590. /package/backend/dist/{session-followup → src/session-followup}/session-followup.module.d.ts +0 -0
  591. /package/backend/dist/{session-followup → src/session-followup}/session-followup.module.js +0 -0
  592. /package/backend/dist/{session-followup → src/session-followup}/session-followup.service.d.ts +0 -0
  593. /package/backend/dist/{session-followup → src/session-followup}/session-followup.service.js +0 -0
  594. /package/backend/dist/{session-inputs → src/session-inputs}/dto/session-input.dto.d.ts +0 -0
  595. /package/backend/dist/{session-inputs → src/session-inputs}/dto/session-input.dto.js +0 -0
  596. /package/backend/dist/{session-inputs → src/session-inputs}/session-inputs.controller.d.ts +0 -0
  597. /package/backend/dist/{session-inputs → src/session-inputs}/session-inputs.controller.js +0 -0
  598. /package/backend/dist/{session-inputs → src/session-inputs}/session-inputs.module.d.ts +0 -0
  599. /package/backend/dist/{session-transfer → src/session-transfer}/session-transfer.module.d.ts +0 -0
  600. /package/backend/dist/{session-transfer → src/session-transfer}/session-transfer.module.js +0 -0
  601. /package/backend/dist/{session-transfer → src/session-transfer}/session-transfer.service.d.ts +0 -0
  602. /package/backend/dist/{session-transfer → src/session-transfer}/session-transfer.service.js +0 -0
  603. /package/backend/dist/{sessions → src/sessions}/dto/session.dto.d.ts +0 -0
  604. /package/backend/dist/{sessions → src/sessions}/dto/session.dto.js +0 -0
  605. /package/backend/dist/{sessions → src/sessions}/sessions.controller.d.ts +0 -0
  606. /package/backend/dist/{sessions → src/sessions}/sessions.controller.js +0 -0
  607. /package/backend/dist/{sessions → src/sessions}/sessions.module.d.ts +0 -0
  608. /package/backend/dist/{sessions → src/sessions}/sessions.module.js +0 -0
  609. /package/backend/dist/{sessions → src/sessions}/sessions.service.d.ts +0 -0
  610. /package/backend/dist/{sessions → src/sessions}/sessions.service.js +0 -0
  611. /package/backend/dist/{system-prompts → src/system-prompts}/dto/system-prompt.dto.d.ts +0 -0
  612. /package/backend/dist/{system-prompts → src/system-prompts}/dto/system-prompt.dto.js +0 -0
  613. /package/backend/dist/{system-prompts → src/system-prompts}/system-prompts.controller.d.ts +0 -0
  614. /package/backend/dist/{system-prompts → src/system-prompts}/system-prompts.controller.js +0 -0
  615. /package/backend/dist/{system-prompts → src/system-prompts}/system-prompts.module.d.ts +0 -0
  616. /package/backend/dist/{system-prompts → src/system-prompts}/system-prompts.module.js +0 -0
  617. /package/backend/dist/{system-prompts → src/system-prompts}/system-prompts.service.d.ts +0 -0
  618. /package/backend/dist/{system-prompts → src/system-prompts}/system-prompts.service.js +0 -0
  619. /package/backend/dist/{timeout.interceptor.d.ts → src/timeout.interceptor.d.ts} +0 -0
  620. /package/backend/dist/{tracing.d.ts → src/tracing.d.ts} +0 -0
  621. /package/backend/dist/{tracing.js → src/tracing.js} +0 -0
  622. /package/backend/dist/{utils → src/utils}/fuzzy-search.d.ts +0 -0
  623. /package/backend/dist/{utils → src/utils}/fuzzy-search.js +0 -0
  624. /package/backend/dist/{utils → src/utils}/index.d.ts +0 -0
  625. /package/backend/dist/{utils → src/utils}/index.js +0 -0
  626. /package/backend/dist/{utils → src/utils}/trace.decorator.d.ts +0 -0
  627. /package/backend/dist/{utils → src/utils}/trace.decorator.js +0 -0
  628. /package/backend/dist/{workspace → src/workspace}/dto/file-tree.dto.d.ts +0 -0
  629. /package/backend/dist/{workspace → src/workspace}/dto/file-tree.dto.js +0 -0
  630. /package/backend/dist/{workspace → src/workspace}/dto/search-workspace.dto.d.ts +0 -0
  631. /package/backend/dist/{workspace → src/workspace}/dto/search-workspace.dto.js +0 -0
  632. /package/backend/dist/{workspace → src/workspace}/workspace.controller.d.ts +0 -0
  633. /package/backend/dist/{workspace → src/workspace}/workspace.controller.js +0 -0
  634. /package/backend/dist/{workspace → src/workspace}/workspace.module.d.ts +0 -0
  635. /package/backend/dist/{workspace → src/workspace}/workspace.module.js +0 -0
  636. /package/backend/dist/{workspace → src/workspace}/workspace.service.d.ts +0 -0
  637. /package/backend/dist/{workspace → src/workspace}/workspace.service.js +0 -0
@@ -0,0 +1,541 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2025 Google LLC
4
+ * SPDX-License-Identifier: Apache-2.0
5
+ */
6
+
7
+ import type { Credentials } from 'google-auth-library';
8
+ import {
9
+ OAuth2Client,
10
+ Compute,
11
+ CodeChallengeMethod,
12
+ } from 'google-auth-library';
13
+ import * as http from 'node:http';
14
+ import url from 'node:url';
15
+ import * as crypto from 'node:crypto';
16
+ import * as net from 'node:net';
17
+ import * as path from 'node:path';
18
+ import { promises as fs } from 'node:fs';
19
+ import type { Config } from '../config/config';
20
+ import { getErrorMessage, FatalAuthenticationError } from '../utils/errors';
21
+ import { UserAccountManager } from '../utils/userAccountManager';
22
+ import { AuthType } from '../core/contentGenerator';
23
+ import readline from 'node:readline';
24
+ import { Storage } from '../config/storage';
25
+ import { OAuthCredentialStorage } from './oauth-credential-storage';
26
+ import { FORCE_ENCRYPTED_FILE_ENV_VAR } from '../mcp/token-storage/index';
27
+
28
+ const userAccountManager = new UserAccountManager();
29
+
30
+ // OAuth Client ID used to initiate OAuth2Client class.
31
+ const OAUTH_CLIENT_ID =
32
+ '681255809395-oo8ft2oprdrnp9e3aqf6av3hmdib135j.apps.googleusercontent.com';
33
+
34
+ // OAuth Secret value used to initiate OAuth2Client class.
35
+ // Note: It's ok to save this in git because this is an installed application
36
+ // as described here: https://developers.google.com/identity/protocols/oauth2#installed
37
+ // "The process results in a client ID and, in some cases, a client secret,
38
+ // which you embed in the source code of your application. (In this context,
39
+ // the client secret is obviously not treated as a secret.)"
40
+ const OAUTH_CLIENT_SECRET = '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';
41
+
42
+ // OAuth Scopes for Cloud Code authorization.
43
+ const OAUTH_SCOPE = [
44
+ 'https://www.googleapis.com/auth/cloud-platform',
45
+ 'https://www.googleapis.com/auth/userinfo.email',
46
+ 'https://www.googleapis.com/auth/userinfo.profile',
47
+ ];
48
+
49
+ const HTTP_REDIRECT = 301;
50
+ const SIGN_IN_SUCCESS_URL =
51
+ 'https://developers.google.com/gemini-code-assist/auth_success_gemini';
52
+ const SIGN_IN_FAILURE_URL =
53
+ 'https://developers.google.com/gemini-code-assist/auth_failure_gemini';
54
+
55
+ /**
56
+ * An Authentication URL for updating the credentials of a Oauth2Client
57
+ * as well as a promise that will resolve when the credentials have
58
+ * been refreshed (or which throws error when refreshing credentials failed).
59
+ */
60
+ export interface OauthWebLogin {
61
+ authUrl: string;
62
+ loginCompletePromise: Promise<void>;
63
+ }
64
+
65
+ const oauthClientPromises = new Map<AuthType, Promise<OAuth2Client>>();
66
+
67
+ function getUseEncryptedStorageFlag() {
68
+ return process.env[FORCE_ENCRYPTED_FILE_ENV_VAR] === 'true';
69
+ }
70
+
71
+ async function initOauthClient(
72
+ authType: AuthType,
73
+ config: Config,
74
+ ): Promise<OAuth2Client> {
75
+ const client = new OAuth2Client({
76
+ clientId: OAUTH_CLIENT_ID,
77
+ clientSecret: OAUTH_CLIENT_SECRET,
78
+ });
79
+ const useEncryptedStorage = getUseEncryptedStorageFlag();
80
+
81
+ if (
82
+ process.env['GOOGLE_GENAI_USE_GCA'] &&
83
+ process.env['GOOGLE_CLOUD_ACCESS_TOKEN']
84
+ ) {
85
+ client.setCredentials({
86
+ access_token: process.env['GOOGLE_CLOUD_ACCESS_TOKEN'],
87
+ });
88
+ await fetchAndCacheUserInfo(client);
89
+ return client;
90
+ }
91
+
92
+ client.on('tokens', async (tokens: Credentials) => {
93
+ if (useEncryptedStorage) {
94
+ await OAuthCredentialStorage.saveCredentials(tokens);
95
+ } else {
96
+ await cacheCredentials(tokens);
97
+ }
98
+ });
99
+
100
+ // If there are cached creds on disk, they always take precedence
101
+ if (await loadCachedCredentials(client)) {
102
+ // Found valid cached credentials.
103
+ // Check if we need to retrieve Google Account ID or Email
104
+ if (!userAccountManager.getCachedGoogleAccount()) {
105
+ try {
106
+ await fetchAndCacheUserInfo(client);
107
+ } catch (error) {
108
+ // Non-fatal, continue with existing auth.
109
+ console.warn('Failed to fetch user info:', getErrorMessage(error));
110
+ }
111
+ }
112
+ console.log('Loaded cached credentials.');
113
+ return client;
114
+ }
115
+
116
+ // In Google Cloud Shell, we can use Application Default Credentials (ADC)
117
+ // provided via its metadata server to authenticate non-interactively using
118
+ // the identity of the user logged into Cloud Shell.
119
+ if (authType === AuthType.CLOUD_SHELL) {
120
+ try {
121
+ console.log("Attempting to authenticate via Cloud Shell VM's ADC.");
122
+ const computeClient = new Compute({
123
+ // We can leave this empty, since the metadata server will provide
124
+ // the service account email.
125
+ });
126
+ await computeClient.getAccessToken();
127
+ console.log('Authentication successful.');
128
+
129
+ // Do not cache creds in this case; note that Compute client will handle its own refresh
130
+ return computeClient;
131
+ } catch (e) {
132
+ throw new Error(
133
+ `Could not authenticate using Cloud Shell credentials. Please select a different authentication method or ensure you are in a properly configured environment. Error: ${getErrorMessage(
134
+ e,
135
+ )}`,
136
+ );
137
+ }
138
+ }
139
+
140
+ if (config.isBrowserLaunchSuppressed()) {
141
+ let success = false;
142
+ const maxRetries = 2;
143
+ for (let i = 0; !success && i < maxRetries; i++) {
144
+ success = await authWithUserCode(client);
145
+ if (!success) {
146
+ console.error(
147
+ '\nFailed to authenticate with user code.',
148
+ i === maxRetries - 1 ? '' : 'Retrying...\n',
149
+ );
150
+ }
151
+ }
152
+ if (!success) {
153
+ throw new FatalAuthenticationError(
154
+ 'Failed to authenticate with user code.',
155
+ );
156
+ }
157
+ } else {
158
+ const webLogin = await authWithWeb(client);
159
+
160
+ console.log(
161
+ `\n\nCode Assist login required.\n` +
162
+ `Attempting to open authentication page in your browser.\n` +
163
+ `Otherwise navigate to:\n\n${webLogin.authUrl}\n\n`,
164
+ );
165
+ try {
166
+ const { default: open } = await import('open');
167
+ // Attempt to open the authentication URL in the default browser.
168
+ // We do not use the `wait` option here because the main script's execution
169
+ // is already paused by `loginCompletePromise`, which awaits the server callback.
170
+ const childProcess = await open(webLogin.authUrl);
171
+
172
+ // IMPORTANT: Attach an error handler to the returned child process.
173
+ // Without this, if `open` fails to spawn a process (e.g., `xdg-open` is not found
174
+ // in a minimal Docker container), it will emit an unhandled 'error' event,
175
+ // causing the entire Node.js process to crash.
176
+ childProcess.on('error', (error) => {
177
+ console.error(
178
+ 'Failed to open browser automatically. Please try running again with NO_BROWSER=true set.',
179
+ );
180
+ console.error('Browser error details:', getErrorMessage(error));
181
+ });
182
+ } catch (err) {
183
+ console.error(
184
+ 'An unexpected error occurred while trying to open the browser:',
185
+ getErrorMessage(err),
186
+ '\nThis might be due to browser compatibility issues or system configuration.',
187
+ '\nPlease try running again with NO_BROWSER=true set for manual authentication.',
188
+ );
189
+ throw new FatalAuthenticationError(
190
+ `Failed to open browser: ${getErrorMessage(err)}`,
191
+ );
192
+ }
193
+ console.log('Waiting for authentication...');
194
+
195
+ // Add timeout to prevent infinite waiting when browser tab gets stuck
196
+ const authTimeout = 5 * 60 * 1000; // 5 minutes timeout
197
+ const timeoutPromise = new Promise<never>((_, reject) => {
198
+ setTimeout(() => {
199
+ reject(
200
+ new FatalAuthenticationError(
201
+ 'Authentication timed out after 5 minutes. The browser tab may have gotten stuck in a loading state. ' +
202
+ 'Please try again or use NO_BROWSER=true for manual authentication.',
203
+ ),
204
+ );
205
+ }, authTimeout);
206
+ });
207
+
208
+ await Promise.race([webLogin.loginCompletePromise, timeoutPromise]);
209
+ }
210
+
211
+ return client;
212
+ }
213
+
214
+ export async function getOauthClient(
215
+ authType: AuthType,
216
+ config: Config,
217
+ ): Promise<OAuth2Client> {
218
+ if (!oauthClientPromises.has(authType)) {
219
+ oauthClientPromises.set(authType, initOauthClient(authType, config));
220
+ }
221
+ return oauthClientPromises.get(authType)!;
222
+ }
223
+
224
+ async function authWithUserCode(client: OAuth2Client): Promise<boolean> {
225
+ const redirectUri = 'https://codeassist.google.com/authcode';
226
+ const codeVerifier = await client.generateCodeVerifierAsync();
227
+ const state = crypto.randomBytes(32).toString('hex');
228
+ const authUrl: string = client.generateAuthUrl({
229
+ redirect_uri: redirectUri,
230
+ access_type: 'offline',
231
+ scope: OAUTH_SCOPE,
232
+ code_challenge_method: CodeChallengeMethod.S256,
233
+ code_challenge: codeVerifier.codeChallenge,
234
+ state,
235
+ });
236
+ console.log('Please visit the following URL to authorize the application:');
237
+ console.log('');
238
+ console.log(authUrl);
239
+ console.log('');
240
+
241
+ const code = await new Promise<string>((resolve) => {
242
+ const rl = readline.createInterface({
243
+ input: process.stdin,
244
+ output: process.stdout,
245
+ });
246
+ rl.question('Enter the authorization code: ', (code) => {
247
+ rl.close();
248
+ resolve(code.trim());
249
+ });
250
+ });
251
+
252
+ if (!code) {
253
+ console.error('Authorization code is required.');
254
+ return false;
255
+ }
256
+
257
+ try {
258
+ const { tokens } = await client.getToken({
259
+ code,
260
+ codeVerifier: codeVerifier.codeVerifier,
261
+ redirect_uri: redirectUri,
262
+ });
263
+ client.setCredentials(tokens);
264
+ } catch (error) {
265
+ console.error(
266
+ 'Failed to authenticate with authorization code:',
267
+ getErrorMessage(error),
268
+ );
269
+ return false;
270
+ }
271
+ return true;
272
+ }
273
+
274
+ async function authWithWeb(client: OAuth2Client): Promise<OauthWebLogin> {
275
+ const port = await getAvailablePort();
276
+ // The hostname used for the HTTP server binding (e.g., '0.0.0.0' in Docker).
277
+ const host = process.env['OAUTH_CALLBACK_HOST'] || 'localhost';
278
+ // The `redirectUri` sent to Google's authorization server MUST use a loopback IP literal
279
+ // (i.e., 'localhost' or '127.0.0.1'). This is a strict security policy for credentials of
280
+ // type 'Desktop app' or 'Web application' (when using loopback flow) to mitigate
281
+ // authorization code interception attacks.
282
+ const redirectUri = `http://localhost:${port}/oauth2callback`;
283
+ const state = crypto.randomBytes(32).toString('hex');
284
+ const authUrl = client.generateAuthUrl({
285
+ redirect_uri: redirectUri,
286
+ access_type: 'offline',
287
+ scope: OAUTH_SCOPE,
288
+ state,
289
+ });
290
+
291
+ const loginCompletePromise = new Promise<void>((resolve, reject) => {
292
+ const server = http.createServer(async (req, res) => {
293
+ try {
294
+ if (req.url!.indexOf('/oauth2callback') === -1) {
295
+ res.writeHead(HTTP_REDIRECT, { Location: SIGN_IN_FAILURE_URL });
296
+ res.end();
297
+ reject(
298
+ new FatalAuthenticationError(
299
+ 'OAuth callback not received. Unexpected request: ' + req.url,
300
+ ),
301
+ );
302
+ }
303
+ // acquire the code from the querystring, and close the web server.
304
+ const qs = new url.URL(req.url!, 'http://localhost:3000').searchParams;
305
+ if (qs.get('error')) {
306
+ res.writeHead(HTTP_REDIRECT, { Location: SIGN_IN_FAILURE_URL });
307
+ res.end();
308
+
309
+ const errorCode = qs.get('error');
310
+ const errorDescription =
311
+ qs.get('error_description') || 'No additional details provided';
312
+ reject(
313
+ new FatalAuthenticationError(
314
+ `Google OAuth error: ${errorCode}. ${errorDescription}`,
315
+ ),
316
+ );
317
+ } else if (qs.get('state') !== state) {
318
+ res.end('State mismatch. Possible CSRF attack');
319
+
320
+ reject(
321
+ new FatalAuthenticationError(
322
+ 'OAuth state mismatch. Possible CSRF attack or browser session issue.',
323
+ ),
324
+ );
325
+ } else if (qs.get('code')) {
326
+ try {
327
+ const { tokens } = await client.getToken({
328
+ code: qs.get('code')!,
329
+ redirect_uri: redirectUri,
330
+ });
331
+ client.setCredentials(tokens);
332
+
333
+ // Retrieve and cache Google Account ID during authentication
334
+ try {
335
+ await fetchAndCacheUserInfo(client);
336
+ } catch (error) {
337
+ console.warn(
338
+ 'Failed to retrieve Google Account ID during authentication:',
339
+ getErrorMessage(error),
340
+ );
341
+ // Don't fail the auth flow if Google Account ID retrieval fails
342
+ }
343
+
344
+ res.writeHead(HTTP_REDIRECT, { Location: SIGN_IN_SUCCESS_URL });
345
+ res.end();
346
+ resolve();
347
+ } catch (error) {
348
+ res.writeHead(HTTP_REDIRECT, { Location: SIGN_IN_FAILURE_URL });
349
+ res.end();
350
+ reject(
351
+ new FatalAuthenticationError(
352
+ `Failed to exchange authorization code for tokens: ${getErrorMessage(error)}`,
353
+ ),
354
+ );
355
+ }
356
+ } else {
357
+ reject(
358
+ new FatalAuthenticationError(
359
+ 'No authorization code received from Google OAuth. Please try authenticating again.',
360
+ ),
361
+ );
362
+ }
363
+ } catch (e) {
364
+ // Provide more specific error message for unexpected errors during OAuth flow
365
+ if (e instanceof FatalAuthenticationError) {
366
+ reject(e);
367
+ } else {
368
+ reject(
369
+ new FatalAuthenticationError(
370
+ `Unexpected error during OAuth authentication: ${getErrorMessage(e)}`,
371
+ ),
372
+ );
373
+ }
374
+ } finally {
375
+ server.close();
376
+ }
377
+ });
378
+
379
+ server.listen(port, host, () => {
380
+ // Server started successfully
381
+ });
382
+
383
+ server.on('error', (err) => {
384
+ reject(
385
+ new FatalAuthenticationError(
386
+ `OAuth callback server error: ${getErrorMessage(err)}`,
387
+ ),
388
+ );
389
+ });
390
+ });
391
+
392
+ return {
393
+ authUrl,
394
+ loginCompletePromise,
395
+ };
396
+ }
397
+
398
+ export function getAvailablePort(): Promise<number> {
399
+ return new Promise((resolve, reject) => {
400
+ let port = 0;
401
+ try {
402
+ const portStr = process.env['OAUTH_CALLBACK_PORT'];
403
+ if (portStr) {
404
+ port = parseInt(portStr, 10);
405
+ if (isNaN(port) || port <= 0 || port > 65535) {
406
+ return reject(
407
+ new Error(`Invalid value for OAUTH_CALLBACK_PORT: "${portStr}"`),
408
+ );
409
+ }
410
+ return resolve(port);
411
+ }
412
+ const server = net.createServer();
413
+ server.listen(0, () => {
414
+ const address = server.address()! as net.AddressInfo;
415
+ port = address.port;
416
+ });
417
+ server.on('listening', () => {
418
+ server.close();
419
+ server.unref();
420
+ });
421
+ server.on('error', (e) => reject(e));
422
+ server.on('close', () => resolve(port));
423
+ } catch (e) {
424
+ reject(e);
425
+ }
426
+ });
427
+ }
428
+
429
+ async function loadCachedCredentials(client: OAuth2Client): Promise<boolean> {
430
+ const useEncryptedStorage = getUseEncryptedStorageFlag();
431
+ if (useEncryptedStorage) {
432
+ const credentials = await OAuthCredentialStorage.loadCredentials();
433
+ if (credentials) {
434
+ client.setCredentials(credentials);
435
+ return true;
436
+ }
437
+ return false;
438
+ }
439
+
440
+ const pathsToTry = [
441
+ Storage.getOAuthCredsPath(),
442
+ process.env['GOOGLE_APPLICATION_CREDENTIALS'],
443
+ ].filter((p): p is string => !!p);
444
+
445
+ for (const keyFile of pathsToTry) {
446
+ try {
447
+ const creds = await fs.readFile(keyFile, 'utf-8');
448
+ client.setCredentials(JSON.parse(creds));
449
+
450
+ // This will verify locally that the credentials look good.
451
+ const { token } = await client.getAccessToken();
452
+ if (!token) {
453
+ continue;
454
+ }
455
+
456
+ // This will check with the server to see if it hasn't been revoked.
457
+ await client.getTokenInfo(token);
458
+
459
+ return true;
460
+ } catch (error) {
461
+ // Log specific error for debugging, but continue trying other paths
462
+ console.debug(
463
+ `Failed to load credentials from ${keyFile}:`,
464
+ getErrorMessage(error),
465
+ );
466
+ }
467
+ }
468
+
469
+ return false;
470
+ }
471
+
472
+ async function cacheCredentials(credentials: Credentials) {
473
+ const filePath = Storage.getOAuthCredsPath();
474
+ await fs.mkdir(path.dirname(filePath), { recursive: true });
475
+
476
+ const credString = JSON.stringify(credentials, null, 2);
477
+ await fs.writeFile(filePath, credString, { mode: 0o600 });
478
+ try {
479
+ await fs.chmod(filePath, 0o600);
480
+ } catch {
481
+ /* empty */
482
+ }
483
+ }
484
+
485
+ export function clearOauthClientCache() {
486
+ oauthClientPromises.clear();
487
+ }
488
+
489
+ export async function clearCachedCredentialFile() {
490
+ try {
491
+ const useEncryptedStorage = getUseEncryptedStorageFlag();
492
+ if (useEncryptedStorage) {
493
+ await OAuthCredentialStorage.clearCredentials();
494
+ } else {
495
+ await fs.rm(Storage.getOAuthCredsPath(), { force: true });
496
+ }
497
+ // Clear the Google Account ID cache when credentials are cleared
498
+ await userAccountManager.clearCachedGoogleAccount();
499
+ // Clear the in-memory OAuth client cache to force re-authentication
500
+ clearOauthClientCache();
501
+ } catch (e) {
502
+ console.error('Failed to clear cached credentials:', e);
503
+ }
504
+ }
505
+
506
+ async function fetchAndCacheUserInfo(client: OAuth2Client): Promise<void> {
507
+ try {
508
+ const { token } = await client.getAccessToken();
509
+ if (!token) {
510
+ return;
511
+ }
512
+
513
+ const response = await fetch(
514
+ 'https://www.googleapis.com/oauth2/v2/userinfo',
515
+ {
516
+ headers: {
517
+ Authorization: `Bearer ${token}`,
518
+ },
519
+ },
520
+ );
521
+
522
+ if (!response.ok) {
523
+ console.error(
524
+ 'Failed to fetch user info:',
525
+ response.status,
526
+ response.statusText,
527
+ );
528
+ return;
529
+ }
530
+
531
+ const userInfo = await response.json();
532
+ await userAccountManager.cacheGoogleAccount(userInfo.email);
533
+ } catch (error) {
534
+ console.error('Error retrieving user info:', error);
535
+ }
536
+ }
537
+
538
+ // Helper to ensure test isolation
539
+ export function resetOauthClientForTesting() {
540
+ oauthClientPromises.clear();
541
+ }