@shepai/cli 1.102.0 → 1.103.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 (206) hide show
  1. package/README.md +5 -4
  2. package/dist/packages/core/src/application/ports/output/services/git-pr-service.interface.d.ts +2 -1
  3. package/dist/packages/core/src/application/ports/output/services/git-pr-service.interface.d.ts.map +1 -1
  4. package/dist/packages/core/src/infrastructure/services/agents/feature-agent/nodes/merge/ci-watch-fix-loop.js +1 -1
  5. package/dist/packages/core/src/infrastructure/services/git/git-pr.service.d.ts +1 -1
  6. package/dist/packages/core/src/infrastructure/services/git/git-pr.service.d.ts.map +1 -1
  7. package/dist/packages/core/src/infrastructure/services/git/git-pr.service.js +2 -2
  8. package/dist/src/presentation/web/app/actions/check-agent-auth.d.ts +19 -0
  9. package/dist/src/presentation/web/app/actions/check-agent-auth.d.ts.map +1 -0
  10. package/dist/src/presentation/web/app/actions/check-agent-auth.js +178 -0
  11. package/dist/src/presentation/web/components/common/feature-node/feature-node.js +1 -1
  12. package/dist/src/presentation/web/components/features/control-center/control-center-empty-state.d.ts +1 -1
  13. package/dist/src/presentation/web/components/features/control-center/control-center-empty-state.d.ts.map +1 -1
  14. package/dist/src/presentation/web/components/features/control-center/control-center-empty-state.js +46 -8
  15. package/dist/src/presentation/web/components/features/control-center/control-center-inner.d.ts.map +1 -1
  16. package/dist/src/presentation/web/components/features/control-center/control-center-inner.js +28 -5
  17. package/dist/src/presentation/web/components/features/control-center/use-control-center-state.d.ts.map +1 -1
  18. package/dist/src/presentation/web/components/features/control-center/use-control-center-state.js +0 -2
  19. package/dist/src/presentation/web/components/features/control-center/welcome-agent-setup.d.ts.map +1 -1
  20. package/dist/src/presentation/web/components/features/control-center/welcome-agent-setup.js +26 -148
  21. package/dist/src/presentation/web/components/features/features-canvas/features-canvas.d.ts.map +1 -1
  22. package/dist/src/presentation/web/components/features/features-canvas/features-canvas.js +29 -8
  23. package/dist/src/presentation/web/components/ui/dialog.d.ts.map +1 -1
  24. package/dist/src/presentation/web/components/ui/dialog.js +2 -2
  25. package/dist/src/presentation/web/hooks/use-graph-state.d.ts.map +1 -1
  26. package/dist/src/presentation/web/hooks/use-graph-state.js +26 -6
  27. package/dist/tsconfig.build.tsbuildinfo +1 -1
  28. package/package.json +2 -2
  29. package/web/.next/BUILD_ID +1 -1
  30. package/web/.next/build-manifest.json +2 -2
  31. package/web/.next/fallback-build-manifest.json +2 -2
  32. package/web/.next/prerender-manifest.json +3 -3
  33. package/web/.next/required-server-files.js +2 -2
  34. package/web/.next/required-server-files.json +2 -2
  35. package/web/.next/server/app/(dashboard)/@drawer/create/page/server-reference-manifest.json +48 -48
  36. package/web/.next/server/app/(dashboard)/@drawer/create/page.js +1 -1
  37. package/web/.next/server/app/(dashboard)/@drawer/create/page.js.nft.json +1 -1
  38. package/web/.next/server/app/(dashboard)/@drawer/create/page_client-reference-manifest.js +1 -1
  39. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page/server-reference-manifest.json +58 -58
  40. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page.js +1 -1
  41. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page.js.nft.json +1 -1
  42. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
  43. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page/server-reference-manifest.json +58 -58
  44. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page.js +1 -1
  45. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page.js.nft.json +1 -1
  46. package/web/.next/server/app/(dashboard)/@drawer/feature/[featureId]/page_client-reference-manifest.js +1 -1
  47. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page/server-reference-manifest.json +44 -44
  48. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page.js +1 -1
  49. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page.js.nft.json +1 -1
  50. package/web/.next/server/app/(dashboard)/@drawer/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
  51. package/web/.next/server/app/(dashboard)/create/page/server-reference-manifest.json +48 -48
  52. package/web/.next/server/app/(dashboard)/create/page.js +1 -1
  53. package/web/.next/server/app/(dashboard)/create/page.js.nft.json +1 -1
  54. package/web/.next/server/app/(dashboard)/create/page_client-reference-manifest.js +1 -1
  55. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page/server-reference-manifest.json +58 -58
  56. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page.js +1 -1
  57. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page.js.nft.json +1 -1
  58. package/web/.next/server/app/(dashboard)/feature/[featureId]/[tab]/page_client-reference-manifest.js +1 -1
  59. package/web/.next/server/app/(dashboard)/feature/[featureId]/page/server-reference-manifest.json +58 -58
  60. package/web/.next/server/app/(dashboard)/feature/[featureId]/page.js +1 -1
  61. package/web/.next/server/app/(dashboard)/feature/[featureId]/page.js.nft.json +1 -1
  62. package/web/.next/server/app/(dashboard)/feature/[featureId]/page_client-reference-manifest.js +1 -1
  63. package/web/.next/server/app/(dashboard)/page/server-reference-manifest.json +44 -44
  64. package/web/.next/server/app/(dashboard)/page.js +1 -1
  65. package/web/.next/server/app/(dashboard)/page.js.nft.json +1 -1
  66. package/web/.next/server/app/(dashboard)/page_client-reference-manifest.js +1 -1
  67. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page/server-reference-manifest.json +44 -44
  68. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page.js +1 -1
  69. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page.js.nft.json +1 -1
  70. package/web/.next/server/app/(dashboard)/repository/[repositoryId]/page_client-reference-manifest.js +1 -1
  71. package/web/.next/server/app/_global-error.html +2 -2
  72. package/web/.next/server/app/_global-error.rsc +1 -1
  73. package/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  74. package/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  75. package/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  76. package/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  77. package/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  78. package/web/.next/server/app/_not-found/page/server-reference-manifest.json +1 -1
  79. package/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  80. package/web/.next/server/app/api/attachments/preview/route.js.nft.json +1 -1
  81. package/web/.next/server/app/api/evidence/route.js.nft.json +1 -1
  82. package/web/.next/server/app/settings/page/server-reference-manifest.json +5 -5
  83. package/web/.next/server/app/settings/page.js.nft.json +1 -1
  84. package/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  85. package/web/.next/server/app/skills/page/server-reference-manifest.json +6 -6
  86. package/web/.next/server/app/skills/page.js.nft.json +1 -1
  87. package/web/.next/server/app/skills/page_client-reference-manifest.js +1 -1
  88. package/web/.next/server/app/tools/page/server-reference-manifest.json +6 -6
  89. package/web/.next/server/app/tools/page.js.nft.json +1 -1
  90. package/web/.next/server/app/tools/page_client-reference-manifest.js +1 -1
  91. package/web/.next/server/app/version/page/server-reference-manifest.json +1 -1
  92. package/web/.next/server/app/version/page_client-reference-manifest.js +1 -1
  93. package/web/.next/server/chunks/[root-of-the-server]__f47bb8a5._.js +1 -1
  94. package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_create-drawer-client_tsx_5e26fc0a._.js +1 -1
  95. package/web/.next/server/chunks/ssr/744ca_web_components_common_control-center-drawer_create-drawer-client_tsx_5e26fc0a._.js.map +1 -1
  96. package/web/.next/server/chunks/ssr/7f428_lucide-react_dist_esm_icons_d0119342._.js +3 -0
  97. package/web/.next/server/chunks/ssr/7f428_lucide-react_dist_esm_icons_d0119342._.js.map +1 -0
  98. package/web/.next/server/chunks/ssr/7f428_lucide-react_dist_esm_icons_rocket_1575cd4d.js +3 -0
  99. package/web/.next/server/chunks/ssr/7f428_lucide-react_dist_esm_icons_rocket_1575cd4d.js.map +1 -0
  100. package/web/.next/server/chunks/ssr/8ba4b_server_app_(dashboard)_@drawer_repository_[repositoryId]_page_actions_0a7546ed.js +3 -0
  101. package/web/.next/server/chunks/ssr/8ba4b_server_app_(dashboard)_@drawer_repository_[repositoryId]_page_actions_0a7546ed.js.map +1 -0
  102. package/web/.next/server/chunks/ssr/8ba4b_server_app_(dashboard)_repository_[repositoryId]_page_actions_978cbb4c.js +3 -0
  103. package/web/.next/server/chunks/ssr/8ba4b_server_app_(dashboard)_repository_[repositoryId]_page_actions_978cbb4c.js.map +1 -0
  104. package/web/.next/server/chunks/ssr/[root-of-the-server]__11033878._.js +1 -1
  105. package/web/.next/server/chunks/ssr/[root-of-the-server]__11033878._.js.map +1 -1
  106. package/web/.next/server/chunks/ssr/[root-of-the-server]__24dd0927._.js +2 -2
  107. package/web/.next/server/chunks/ssr/[root-of-the-server]__24dd0927._.js.map +1 -1
  108. package/web/.next/server/chunks/ssr/[root-of-the-server]__357d99f9._.js +1 -1
  109. package/web/.next/server/chunks/ssr/{[root-of-the-server]__ec9a1550._.js → [root-of-the-server]__51fc98b0._.js} +2 -2
  110. package/web/.next/server/chunks/ssr/{[root-of-the-server]__0b6bb4ae._.js.map → [root-of-the-server]__51fc98b0._.js.map} +1 -1
  111. package/web/.next/server/chunks/ssr/{[root-of-the-server]__f8932d55._.js → [root-of-the-server]__57f37786._.js} +2 -2
  112. package/web/.next/server/chunks/ssr/{[root-of-the-server]__ec9a1550._.js.map → [root-of-the-server]__57f37786._.js.map} +1 -1
  113. package/web/.next/server/chunks/ssr/[root-of-the-server]__5d87af2e._.js +1 -1
  114. package/web/.next/server/chunks/ssr/{[root-of-the-server]__0b6bb4ae._.js → [root-of-the-server]__708dcad1._.js} +2 -2
  115. package/web/.next/server/chunks/ssr/{[root-of-the-server]__f8932d55._.js.map → [root-of-the-server]__708dcad1._.js.map} +1 -1
  116. package/web/.next/server/chunks/ssr/[root-of-the-server]__845a9d2a._.js +1 -1
  117. package/web/.next/server/chunks/ssr/[root-of-the-server]__845a9d2a._.js.map +1 -1
  118. package/web/.next/server/chunks/ssr/[root-of-the-server]__89e8a5cc._.js +2 -2
  119. package/web/.next/server/chunks/ssr/{[root-of-the-server]__6a82177d._.js → [root-of-the-server]__8e002910._.js} +2 -2
  120. package/web/.next/server/chunks/ssr/{[root-of-the-server]__6a82177d._.js.map → [root-of-the-server]__8e002910._.js.map} +1 -1
  121. package/web/.next/server/chunks/ssr/[root-of-the-server]__aad040c0._.js +2 -2
  122. package/web/.next/server/chunks/ssr/[root-of-the-server]__aad040c0._.js.map +1 -1
  123. package/web/.next/server/chunks/ssr/[root-of-the-server]__d91fdd51._.js +3 -0
  124. package/web/.next/server/chunks/ssr/[root-of-the-server]__d91fdd51._.js.map +1 -0
  125. package/web/.next/server/chunks/ssr/[root-of-the-server]__fdc75809._.js +1 -1
  126. package/web/.next/server/chunks/ssr/[root-of-the-server]__fdc75809._.js.map +1 -1
  127. package/web/.next/server/chunks/ssr/_135edb9c._.js +1 -1
  128. package/web/.next/server/chunks/ssr/_135edb9c._.js.map +1 -1
  129. package/web/.next/server/chunks/ssr/_273d4632._.js +3 -0
  130. package/web/.next/server/chunks/ssr/_273d4632._.js.map +1 -0
  131. package/web/.next/server/chunks/ssr/{_d2a282c5._.js → _43bc1b22._.js} +2 -2
  132. package/web/.next/server/chunks/ssr/{_d2a282c5._.js.map → _43bc1b22._.js.map} +1 -1
  133. package/web/.next/server/chunks/ssr/_6225647a._.js +3 -0
  134. package/web/.next/server/chunks/ssr/_6225647a._.js.map +1 -0
  135. package/web/.next/server/chunks/ssr/{_9d0908a8._.js → _798dcca3._.js} +2 -2
  136. package/web/.next/server/chunks/ssr/{_9d0908a8._.js.map → _798dcca3._.js.map} +1 -1
  137. package/web/.next/server/chunks/ssr/_8dacd1e7._.js +1 -1
  138. package/web/.next/server/chunks/ssr/_8dacd1e7._.js.map +1 -1
  139. package/web/.next/server/chunks/ssr/_cc77a143._.js +1 -1
  140. package/web/.next/server/chunks/ssr/_cc77a143._.js.map +1 -1
  141. package/web/.next/server/chunks/ssr/_f5316e67._.js +3 -0
  142. package/web/.next/server/chunks/ssr/_f5316e67._.js.map +1 -0
  143. package/web/.next/server/chunks/ssr/b1a17_presentation_web_components_features_settings_settings-page-client_tsx_6ed9d5f8._.js +1 -1
  144. package/web/.next/server/chunks/ssr/b1a17_presentation_web_components_features_settings_settings-page-client_tsx_6ed9d5f8._.js.map +1 -1
  145. package/web/.next/server/chunks/ssr/{src_presentation_web_3c53a23d._.js → src_presentation_web_7275ce5d._.js} +3 -3
  146. package/web/.next/server/chunks/ssr/{src_presentation_web_3c53a23d._.js.map → src_presentation_web_7275ce5d._.js.map} +1 -1
  147. package/web/.next/server/chunks/ssr/{src_presentation_web_ec8c7a4f._.js → src_presentation_web_758dfa10._.js} +3 -3
  148. package/web/.next/server/chunks/ssr/{src_presentation_web_ec8c7a4f._.js.map → src_presentation_web_758dfa10._.js.map} +1 -1
  149. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_(dashboard)_page_actions_84803221.js +3 -0
  150. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_(dashboard)_page_actions_84803221.js.map +1 -0
  151. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_skills_page_actions_1fa8042e.js +1 -1
  152. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_skills_page_actions_1fa8042e.js.map +1 -1
  153. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_tools_page_actions_24684200.js +1 -1
  154. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_tools_page_actions_24684200.js.map +1 -1
  155. package/web/.next/server/chunks/ssr/src_presentation_web_components_bf50c527._.js +1 -1
  156. package/web/.next/server/chunks/ssr/src_presentation_web_components_bf50c527._.js.map +1 -1
  157. package/web/.next/server/chunks/ssr/src_presentation_web_components_de814675._.js +1 -1
  158. package/web/.next/server/chunks/ssr/src_presentation_web_components_de814675._.js.map +1 -1
  159. package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_7ac3562e._.js +1 -1
  160. package/web/.next/server/chunks/ssr/src_presentation_web_components_features_control-center_7ac3562e._.js.map +1 -1
  161. package/web/.next/server/chunks/ssr/src_presentation_web_components_features_tools_tools-page-client_tsx_3d0aa70c._.js +1 -1
  162. package/web/.next/server/chunks/ssr/src_presentation_web_components_features_tools_tools-page-client_tsx_3d0aa70c._.js.map +1 -1
  163. package/web/.next/server/pages/500.html +2 -2
  164. package/web/.next/server/server-reference-manifest.js +1 -1
  165. package/web/.next/server/server-reference-manifest.json +273 -273
  166. package/web/.next/static/chunks/07b853e29af1e5f2.js +1 -0
  167. package/web/.next/static/chunks/12f2e950ef2c1a25.js +1 -0
  168. package/web/.next/static/chunks/{d3c337aa9acbfd96.js → 27b176706ec35488.js} +2 -2
  169. package/web/.next/static/chunks/28aa6c032562c065.js +1 -0
  170. package/web/.next/static/chunks/3a806cf059241bc9.js +1 -0
  171. package/web/.next/static/chunks/3ff4c5790bf84403.js +1 -0
  172. package/web/.next/static/chunks/{d994924b9107401b.js → 5981cd90d8cbdad7.js} +1 -1
  173. package/web/.next/static/chunks/790f576eb41aedc6.js +1 -0
  174. package/web/.next/static/chunks/{0ecdad7af8d93397.js → 87ce4933c46c0c18.js} +1 -1
  175. package/web/.next/static/chunks/{bfee4f72255f4654.js → 8f9956f5871a8cdb.js} +2 -2
  176. package/web/.next/static/chunks/93058c22968e2fef.css +1 -0
  177. package/web/.next/static/chunks/a39402a05bf12912.js +1 -0
  178. package/web/.next/static/chunks/f37993a7b6f87fcb.js +1 -0
  179. package/web/.next/server/chunks/ssr/7f428_lucide-react_dist_esm_icons_6ba7eb21._.js +0 -3
  180. package/web/.next/server/chunks/ssr/7f428_lucide-react_dist_esm_icons_6ba7eb21._.js.map +0 -1
  181. package/web/.next/server/chunks/ssr/8ba4b_server_app_(dashboard)_@drawer_repository_[repositoryId]_page_actions_c757eb00.js +0 -3
  182. package/web/.next/server/chunks/ssr/8ba4b_server_app_(dashboard)_@drawer_repository_[repositoryId]_page_actions_c757eb00.js.map +0 -1
  183. package/web/.next/server/chunks/ssr/8ba4b_server_app_(dashboard)_repository_[repositoryId]_page_actions_7eb49631.js +0 -3
  184. package/web/.next/server/chunks/ssr/8ba4b_server_app_(dashboard)_repository_[repositoryId]_page_actions_7eb49631.js.map +0 -1
  185. package/web/.next/server/chunks/ssr/[root-of-the-server]__7b49fcb3._.js +0 -3
  186. package/web/.next/server/chunks/ssr/[root-of-the-server]__7b49fcb3._.js.map +0 -1
  187. package/web/.next/server/chunks/ssr/_60e203af._.js +0 -3
  188. package/web/.next/server/chunks/ssr/_60e203af._.js.map +0 -1
  189. package/web/.next/server/chunks/ssr/_6a83bd29._.js +0 -3
  190. package/web/.next/server/chunks/ssr/_6a83bd29._.js.map +0 -1
  191. package/web/.next/server/chunks/ssr/_7d954884._.js +0 -3
  192. package/web/.next/server/chunks/ssr/_7d954884._.js.map +0 -1
  193. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_(dashboard)_page_actions_befd865a.js +0 -3
  194. package/web/.next/server/chunks/ssr/src_presentation_web__next-internal_server_app_(dashboard)_page_actions_befd865a.js.map +0 -1
  195. package/web/.next/static/chunks/0a370e5d6fd1bb24.js +0 -1
  196. package/web/.next/static/chunks/2d3dc372f05429dd.css +0 -1
  197. package/web/.next/static/chunks/3092c9611e2dc032.js +0 -1
  198. package/web/.next/static/chunks/30dc64780817371a.js +0 -1
  199. package/web/.next/static/chunks/ac12b8d2bd59675e.js +0 -1
  200. package/web/.next/static/chunks/b272ac93b52dceeb.js +0 -1
  201. package/web/.next/static/chunks/d61cbdfc00003e44.js +0 -1
  202. package/web/.next/static/chunks/e248c85913405af4.js +0 -1
  203. package/web/.next/static/chunks/e24a024affc634d9.js +0 -1
  204. /package/web/.next/static/{_-n7Ii9h0sTnlzE_aFMQI → YTwpzFRHYkkE5cDxaRlDQ}/_buildManifest.js +0 -0
  205. /package/web/.next/static/{_-n7Ii9h0sTnlzE_aFMQI → YTwpzFRHYkkE5cDxaRlDQ}/_clientMiddlewareManifest.json +0 -0
  206. /package/web/.next/static/{_-n7Ii9h0sTnlzE_aFMQI → YTwpzFRHYkkE5cDxaRlDQ}/_ssgManifest.js +0 -0
@@ -1,15 +1,13 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { useState, useEffect, useCallback, useRef } from 'react';
4
- import { Check, ChevronRight, ChevronLeft, Download, Loader2, CheckCircle2, Circle, AlertCircle, Bot, Terminal, ExternalLink, } from 'lucide-react';
4
+ import { ChevronRight, ChevronLeft, Loader2, Bot } from 'lucide-react';
5
5
  import { getAllAgentModels } from '../../../app/actions/get-all-agent-models.js';
6
- import { checkAgentTool } from '../../../app/actions/check-agent-tool.js';
7
6
  import { updateAgentAndModel } from '../../../app/actions/update-agent-and-model.js';
8
7
  import { getAgentTypeIcon } from '../../common/feature-node/agent-type-icons.js';
9
8
  import { getModelMeta } from '../../../lib/model-metadata.js';
10
- import { useToolInstallStream } from '../../../hooks/use-tool-install-stream.js';
11
9
  import { cn } from '../../../lib/utils.js';
12
- const STEPS = ['select-agent', 'select-model', 'check-tool', 'authenticate'];
10
+ const STEPS = ['select-agent', 'select-model'];
13
11
  /** Fixed width for the wizard content area to prevent layout jumps */
14
12
  const WIZARD_WIDTH = 'w-72';
15
13
  export function WelcomeAgentSetup({ onComplete, className }) {
@@ -17,9 +15,6 @@ export function WelcomeAgentSetup({ onComplete, className }) {
17
15
  const [loading, setLoading] = useState(true);
18
16
  const [step, setStep] = useState('select-agent');
19
17
  const [selectedAgent, setSelectedAgent] = useState(null);
20
- const [selectedModel, setSelectedModel] = useState(null);
21
- const [toolStatus, setToolStatus] = useState(null);
22
- const [checkingTool, setCheckingTool] = useState(false);
23
18
  const [saving, setSaving] = useState(false);
24
19
  const [transitioning, setTransitioning] = useState(false);
25
20
  const [visible, setVisible] = useState(true);
@@ -39,7 +34,6 @@ export function WelcomeAgentSetup({ onComplete, className }) {
39
34
  timeoutRef.current = setTimeout(() => {
40
35
  setup?.();
41
36
  setStep(nextStep);
42
- // Small delay to let React render the new content before fading in
43
37
  requestAnimationFrame(() => {
44
38
  setVisible(true);
45
39
  setTransitioning(false);
@@ -52,6 +46,17 @@ export function WelcomeAgentSetup({ onComplete, className }) {
52
46
  clearTimeout(timeoutRef.current);
53
47
  };
54
48
  }, []);
49
+ /** Save agent+model selection and complete the wizard */
50
+ const saveAndComplete = useCallback(async (agentType, model) => {
51
+ setSaving(true);
52
+ try {
53
+ await updateAgentAndModel(agentType, model);
54
+ onComplete();
55
+ }
56
+ finally {
57
+ setSaving(false);
58
+ }
59
+ }, [onComplete]);
55
60
  const handleAgentSelect = useCallback((agentType) => {
56
61
  const group = groups.find((g) => g.agentType === agentType);
57
62
  if (group && group.models.length > 0) {
@@ -60,81 +65,22 @@ export function WelcomeAgentSetup({ onComplete, className }) {
60
65
  });
61
66
  }
62
67
  else {
63
- transitionTo('check-tool', () => {
64
- setSelectedAgent(agentType);
65
- setSelectedModel('');
66
- });
68
+ // No models — save immediately
69
+ saveAndComplete(agentType, null);
67
70
  }
68
- }, [groups, transitionTo]);
71
+ }, [groups, transitionTo, saveAndComplete]);
69
72
  const handleModelSelect = useCallback((model) => {
70
- transitionTo('check-tool', () => {
71
- setSelectedModel(model);
72
- });
73
- }, [transitionTo]);
74
- const handleProceedToAuth = useCallback(() => {
75
- transitionTo('authenticate');
76
- }, [transitionTo]);
73
+ if (!selectedAgent)
74
+ return;
75
+ saveAndComplete(selectedAgent, model);
76
+ }, [selectedAgent, saveAndComplete]);
77
77
  const handleBack = useCallback(() => {
78
78
  if (step === 'select-model') {
79
79
  transitionTo('select-agent', () => {
80
80
  setSelectedAgent(null);
81
81
  });
82
82
  }
83
- else if (step === 'check-tool') {
84
- if (activeGroup && activeGroup.models.length > 0) {
85
- transitionTo('select-model', () => {
86
- setSelectedModel(null);
87
- });
88
- }
89
- else {
90
- transitionTo('select-agent', () => {
91
- setSelectedAgent(null);
92
- });
93
- }
94
- }
95
- else if (step === 'authenticate') {
96
- // If tool needed install, go back to check-tool; otherwise skip to model/agent
97
- if (toolStatus && !toolStatus.installed && toolStatus.toolId) {
98
- transitionTo('check-tool');
99
- }
100
- else if (activeGroup && activeGroup.models.length > 0) {
101
- transitionTo('select-model', () => {
102
- setSelectedModel(null);
103
- });
104
- }
105
- else {
106
- transitionTo('select-agent', () => {
107
- setSelectedAgent(null);
108
- });
109
- }
110
- }
111
- }, [step, activeGroup, toolStatus, transitionTo]);
112
- useEffect(() => {
113
- if (step !== 'check-tool' || !selectedAgent)
114
- return;
115
- setCheckingTool(true);
116
- checkAgentTool(selectedAgent)
117
- .then((status) => {
118
- setToolStatus(status);
119
- // Auto-skip to authenticate when tool is already available or not required
120
- if (status.installed || !status.toolId) {
121
- transitionTo('authenticate');
122
- }
123
- })
124
- .finally(() => setCheckingTool(false));
125
- }, [step, selectedAgent, transitionTo]);
126
- const handleConfirm = useCallback(async () => {
127
- if (!selectedAgent)
128
- return;
129
- setSaving(true);
130
- try {
131
- await updateAgentAndModel(selectedAgent, selectedModel ?? null);
132
- onComplete();
133
- }
134
- finally {
135
- setSaving(false);
136
- }
137
- }, [selectedAgent, selectedModel, onComplete]);
83
+ }, [step, transitionTo]);
138
84
  if (loading) {
139
85
  return (_jsxs("div", { "data-testid": "welcome-agent-setup", className: cn('flex flex-col items-center justify-center gap-3', className), children: [_jsx(Loader2, { className: "text-muted-foreground h-4 w-4 animate-spin" }), _jsx("p", { className: "text-muted-foreground text-xs", children: "Loading agents\u2026" })] }));
140
86
  }
@@ -144,79 +90,11 @@ export function WelcomeAgentSetup({ onComplete, className }) {
144
90
  const AgentIcon = getAgentTypeIcon(activeGroup.agentType);
145
91
  return (_jsxs(_Fragment, { children: [_jsx(AgentIcon, { className: "h-3.5 w-3.5" }), _jsxs("span", { className: "text-[10px] font-semibold tracking-widest uppercase", children: [activeGroup.label, " \u2014 Pick a model"] })] }));
146
92
  })()
147
- : null, step === 'check-tool' && (_jsxs(_Fragment, { children: [_jsx(Bot, { className: "h-3.5 w-3.5" }), _jsx("span", { className: "text-[10px] font-semibold tracking-widest uppercase", children: "Verifying setup" })] })), step === 'authenticate' && activeGroup
148
- ? (() => {
149
- const AgentIcon = getAgentTypeIcon(activeGroup.agentType);
150
- return (_jsxs(_Fragment, { children: [_jsx(AgentIcon, { className: "h-3.5 w-3.5" }), _jsx("span", { className: "text-[10px] font-semibold tracking-widest uppercase", children: "Authenticate" })] }));
151
- })()
152
- : null] }) }), _jsx("div", { className: "flex w-32 items-center gap-1", children: STEPS.map((s, i) => (_jsx("div", { className: cn('h-0.5 flex-1 rounded-full transition-colors duration-300', i <= stepIndex ? 'bg-foreground/60' : 'bg-muted') }, s))) }), _jsxs("div", { className: cn('flex w-full flex-col items-center transition-opacity duration-150', visible && !transitioning ? 'opacity-100' : 'opacity-0'), children: [step === 'select-agent' && (_jsx("div", { "data-testid": "agent-list", className: "flex w-full flex-col gap-1.5", children: groups.map((group) => {
93
+ : null] }) }), _jsx("div", { className: "flex w-full items-center gap-1", children: STEPS.map((s, i) => (_jsx("div", { className: cn('h-0.5 flex-1 rounded-full transition-colors duration-300', i <= stepIndex ? 'bg-foreground/60' : 'bg-muted') }, s))) }), _jsxs("div", { className: cn('flex w-full flex-col items-center transition-opacity duration-150', visible && !transitioning ? 'opacity-100' : 'opacity-0'), children: [step === 'select-agent' && (_jsx("div", { "data-testid": "agent-list", className: "flex w-full flex-col gap-1.5", children: groups.map((group) => {
153
94
  const GroupIcon = getAgentTypeIcon(group.agentType);
154
- return (_jsxs("button", { type: "button", "data-testid": `agent-option-${group.agentType}`, className: "border-border hover:border-foreground/40 flex w-full cursor-pointer items-center gap-2.5 rounded-md border border-dashed px-4 py-2.5 transition-colors", onClick: () => handleAgentSelect(group.agentType), children: [_jsx(GroupIcon, { className: "text-muted-foreground h-4 w-4 shrink-0" }), _jsx("span", { className: "flex-1 text-left text-xs font-medium", children: group.label }), _jsx(ChevronRight, { className: "text-muted-foreground h-3 w-3" })] }, group.agentType));
155
- }) })), step === 'select-model' && activeGroup ? (_jsxs("div", { "data-testid": "model-list", className: "flex w-full flex-col gap-1.5", children: [_jsxs("button", { type: "button", className: "text-muted-foreground hover:text-foreground mb-0.5 flex cursor-pointer items-center gap-1 self-start text-[10px] font-medium transition-colors", onClick: handleBack, children: [_jsx(ChevronLeft, { className: "h-3 w-3" }), "Back"] }), _jsx("div", { className: "flex max-h-48 w-full flex-col gap-1.5 overflow-y-auto", children: activeGroup.models.map((m) => {
95
+ return (_jsxs("button", { type: "button", disabled: saving, "data-testid": `agent-option-${group.agentType}`, className: "border-border hover:border-foreground/40 flex w-full cursor-pointer items-center gap-2.5 rounded-md border border-dashed px-4 py-2.5 transition-colors disabled:opacity-50", onClick: () => handleAgentSelect(group.agentType), children: [_jsx(GroupIcon, { className: "text-muted-foreground h-4 w-4 shrink-0" }), _jsx("span", { className: "flex-1 text-left text-xs font-medium", children: group.label }), _jsx(ChevronRight, { className: "text-muted-foreground h-3 w-3" })] }, group.agentType));
96
+ }) })), step === 'select-model' && activeGroup ? (_jsxs("div", { "data-testid": "model-list", className: "flex w-full flex-col gap-1.5", children: [_jsxs("button", { type: "button", disabled: saving, className: "text-muted-foreground hover:text-foreground mb-0.5 flex cursor-pointer items-center gap-1 self-start text-[10px] font-medium transition-colors", onClick: handleBack, children: [_jsx(ChevronLeft, { className: "h-3 w-3" }), "Back"] }), _jsx("div", { className: "flex max-h-48 w-full flex-col gap-1.5 overflow-y-auto", children: activeGroup.models.map((m) => {
156
97
  const meta = getModelMeta(m.id);
157
- return (_jsxs("button", { type: "button", "data-testid": `model-option-${m.id}`, className: "border-border hover:border-foreground/40 flex w-full cursor-pointer items-center gap-2.5 rounded-md border border-dashed px-4 py-2.5 text-left transition-colors", onClick: () => handleModelSelect(m.id), children: [_jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [_jsx("span", { className: "text-xs font-medium", children: meta.displayName || m.displayName }), _jsx("span", { className: "text-muted-foreground text-[10px] leading-tight", children: meta.description || m.description })] }), _jsx(ChevronRight, { className: "text-muted-foreground h-3 w-3 shrink-0" })] }, m.id));
158
- }) })] })) : null, step === 'check-tool' && (_jsx(ToolCheckStep, { toolStatus: toolStatus, checking: checkingTool, saving: false, onConfirm: handleProceedToAuth, onBack: handleBack, onToolInstalled: () => {
159
- if (selectedAgent) {
160
- setCheckingTool(true);
161
- checkAgentTool(selectedAgent)
162
- .then(setToolStatus)
163
- .finally(() => setCheckingTool(false));
164
- }
165
- } })), step === 'authenticate' && toolStatus ? (_jsx(AuthenticateStep, { toolStatus: toolStatus, agentLabel: activeGroup?.label ?? selectedAgent ?? 'Agent', saving: saving, onConfirm: handleConfirm, onBack: handleBack })) : null] })] }));
166
- }
167
- /** Sub-component for the tool verification step */
168
- function ToolCheckStep({ toolStatus, checking, saving, onConfirm, onBack, onToolInstalled, }) {
169
- if (checking || !toolStatus) {
170
- return (_jsxs("div", { className: "flex flex-col items-center gap-2 py-4", children: [_jsx(Loader2, { className: "text-muted-foreground h-4 w-4 animate-spin" }), _jsx("p", { className: "text-muted-foreground text-[10px]", children: "Checking tool availability\u2026" })] }));
171
- }
172
- // Agent doesn't require a tool (e.g., dev/demo)
173
- if (!toolStatus.toolId) {
174
- return (_jsxs("div", { className: "flex w-full flex-col items-center gap-3", children: [_jsxs("div", { className: "text-muted-foreground flex items-center gap-1.5", children: [_jsx(CheckCircle2, { className: "h-3.5 w-3.5" }), _jsx("span", { className: "text-xs", children: "No additional tools required" })] }), _jsx(ConfirmRow, { saving: saving, onConfirm: onConfirm, onBack: onBack })] }));
175
- }
176
- if (toolStatus.installed) {
177
- return (_jsxs("div", { className: "flex w-full flex-col items-center gap-3", children: [_jsxs("div", { className: "text-muted-foreground flex items-center gap-1.5", children: [_jsx(CheckCircle2, { className: "h-3.5 w-3.5" }), _jsxs("span", { className: "text-xs", children: [toolStatus.tool?.name ?? toolStatus.toolId, " is installed"] })] }), _jsx(ConfirmRow, { saving: saving, onConfirm: onConfirm, onBack: onBack })] }));
178
- }
179
- return (_jsx(ToolInstallInline, { toolStatus: toolStatus, saving: saving, onConfirm: onConfirm, onBack: onBack, onInstalled: onToolInstalled }));
180
- }
181
- /** Shared back + continue row */
182
- function ConfirmRow({ saving, onConfirm, onBack, label = 'Continue', }) {
183
- return (_jsxs("div", { className: "flex items-center gap-3", children: [_jsxs("button", { type: "button", className: "text-muted-foreground hover:text-foreground cursor-pointer text-[10px] transition-colors", onClick: onBack, children: [_jsx(ChevronLeft, { className: "mr-0.5 inline h-3 w-3" }), "Back"] }), _jsxs("button", { type: "button", "data-testid": "agent-setup-confirm", disabled: saving, className: "border-border hover:border-foreground/40 flex cursor-pointer items-center gap-1.5 rounded-md border border-dashed px-4 py-2 text-xs font-medium transition-colors disabled:opacity-50", onClick: onConfirm, children: [saving ? _jsx(Loader2, { className: "h-3 w-3 animate-spin" }) : _jsx(Check, { className: "h-3 w-3" }), label] })] }));
184
- }
185
- /** Authenticate step — optional agent launch for auth */
186
- function AuthenticateStep({ toolStatus, agentLabel, saving, onConfirm, onBack, }) {
187
- const [launching, setLaunching] = useState(false);
188
- const [launched, setLaunched] = useState(false);
189
- const handleLaunch = useCallback(async () => {
190
- if (!toolStatus.toolId)
191
- return;
192
- setLaunching(true);
193
- try {
194
- const res = await fetch(`/api/tools/${toolStatus.toolId}/launch`, { method: 'POST' });
195
- if (res.ok)
196
- setLaunched(true);
197
- }
198
- finally {
199
- setLaunching(false);
200
- }
201
- }, [toolStatus.toolId]);
202
- // No tool = no auth needed, skip straight to confirm
203
- if (!toolStatus.toolId) {
204
- return (_jsxs("div", { className: "flex w-full flex-col items-center gap-3", children: [_jsx("p", { className: "text-muted-foreground text-[10px]", children: "No authentication required" }), _jsx(ConfirmRow, { saving: saving, onConfirm: onConfirm, onBack: onBack, label: "Done" })] }));
205
- }
206
- return (_jsxs("div", { className: "flex w-full flex-col items-center gap-3", children: [_jsxs("p", { className: "text-muted-foreground text-center text-[10px] leading-relaxed", children: ["Open ", agentLabel, " in a terminal to sign in.", _jsx("br", {}), "Follow the prompts, then come back here."] }), _jsxs("button", { type: "button", "data-testid": "agent-setup-launch", disabled: launching, onClick: handleLaunch, className: "border-border hover:border-foreground/40 flex w-full cursor-pointer items-center gap-2.5 rounded-md border border-dashed px-4 py-2.5 transition-colors disabled:opacity-50", children: [launching ? (_jsx(Loader2, { className: "text-muted-foreground h-4 w-4 animate-spin" })) : (_jsx(Terminal, { className: "text-muted-foreground h-4 w-4" })), _jsx("span", { className: "flex-1 text-left text-xs font-medium", children: launched ? 'Open again' : `Open ${agentLabel}` }), _jsx(ExternalLink, { className: "text-muted-foreground h-3 w-3" })] }), launched ? (_jsx("p", { className: "text-muted-foreground text-[10px]", children: "Terminal opened \u2014 complete sign-in there" })) : null, toolStatus.binaryName ? (_jsxs("div", { className: "flex w-full flex-col gap-1", children: [_jsx("p", { className: "text-muted-foreground text-[10px]", children: "Or run manually in any terminal:" }), _jsxs("div", { className: "w-full rounded-md bg-zinc-900 px-3 py-1.5 font-mono text-[11px] text-zinc-300", children: [_jsx("span", { className: "text-zinc-500 select-none", children: "$ " }), toolStatus.binaryName] })] })) : null, _jsxs("div", { className: "flex items-center gap-3", children: [_jsxs("button", { type: "button", className: "text-muted-foreground hover:text-foreground cursor-pointer text-[10px] transition-colors", onClick: onBack, children: [_jsx(ChevronLeft, { className: "mr-0.5 inline h-3 w-3" }), "Back"] }), _jsxs("button", { type: "button", "data-testid": "agent-setup-confirm", disabled: saving, className: "border-border hover:border-foreground/40 flex cursor-pointer items-center gap-1.5 rounded-md border border-dashed px-4 py-2 text-xs font-medium transition-colors disabled:opacity-50", onClick: onConfirm, children: [saving ? _jsx(Loader2, { className: "h-3 w-3 animate-spin" }) : _jsx(Check, { className: "h-3 w-3" }), launched ? 'Done' : 'Skip'] })] })] }));
207
- }
208
- /** Inline tool installer for the welcome wizard */
209
- function ToolInstallInline({ toolStatus, saving, onConfirm, onBack, onInstalled, }) {
210
- const toolId = toolStatus.toolId ?? '';
211
- const { logs, status, startInstall } = useToolInstallStream(toolId);
212
- const isInstallDone = status === 'done';
213
- const isInstallError = status === 'error';
214
- useEffect(() => {
215
- if (isInstallDone) {
216
- onInstalled();
217
- }
218
- }, [isInstallDone, onInstalled]);
219
- return (_jsxs("div", { className: "flex w-full flex-col items-center gap-3", children: [_jsxs("div", { className: "flex items-center gap-1.5", children: [isInstallDone ? (_jsx(CheckCircle2, { className: "text-muted-foreground h-3.5 w-3.5" })) : isInstallError ? (_jsx(AlertCircle, { className: "text-destructive h-3.5 w-3.5" })) : (_jsx(Circle, { className: "text-muted-foreground h-3.5 w-3.5" })), _jsxs("span", { className: "text-xs", children: [toolStatus.tool?.name ?? toolId, ' ', isInstallDone ? 'installed' : isInstallError ? 'install failed' : 'is not installed'] })] }), toolStatus.tool?.installCommand && status === 'idle' ? (_jsxs("div", { className: "w-full rounded-md bg-zinc-900 px-3 py-2 font-mono text-[11px] text-zinc-300", children: [_jsx("span", { className: "text-zinc-500 select-none", children: "$ " }), toolStatus.tool.installCommand] })) : null, (status === 'streaming' || isInstallDone || isInstallError) && logs.length > 0 ? (_jsxs("div", { className: "max-h-28 w-full overflow-auto rounded-md bg-zinc-900 px-3 py-2 font-mono text-[10px] leading-relaxed text-zinc-400", children: [logs.map((line, idx) => (
220
- // eslint-disable-next-line react/no-array-index-key -- logs are append-only, never reorder
221
- _jsx("div", { className: "break-all whitespace-pre-wrap", children: line }, idx))), isInstallDone ? (_jsx("div", { className: "text-muted-foreground mt-1", children: "Installation complete" })) : null, isInstallError ? (_jsx("div", { className: "text-destructive mt-1", children: "Installation failed \u2014 try manually" })) : null] })) : null, _jsxs("div", { className: "flex items-center gap-3", children: [_jsxs("button", { type: "button", className: "text-muted-foreground hover:text-foreground cursor-pointer text-[10px] transition-colors", onClick: onBack, children: [_jsx(ChevronLeft, { className: "mr-0.5 inline h-3 w-3" }), "Back"] }), !isInstallDone && toolStatus.tool?.autoInstall ? (_jsxs("button", { type: "button", "data-testid": "agent-setup-install", disabled: status === 'streaming', className: "border-border hover:border-foreground/40 flex cursor-pointer items-center gap-1.5 rounded-md border border-dashed px-4 py-2 text-xs font-medium transition-colors disabled:opacity-50", onClick: startInstall, children: [status === 'streaming' ? (_jsx(Loader2, { className: "h-3 w-3 animate-spin" })) : (_jsx(Download, { className: "h-3 w-3" })), status === 'streaming' ? 'Installing…' : 'Install'] })) : null, isInstallDone ? (_jsxs("button", { type: "button", "data-testid": "agent-setup-confirm", disabled: saving, className: "border-border hover:border-foreground/40 flex cursor-pointer items-center gap-1.5 rounded-md border border-dashed px-4 py-2 text-xs font-medium transition-colors disabled:opacity-50", onClick: onConfirm, children: [saving ? _jsx(Loader2, { className: "h-3 w-3 animate-spin" }) : _jsx(Check, { className: "h-3 w-3" }), "Continue"] })) : null] })] }));
98
+ return (_jsxs("button", { type: "button", disabled: saving, "data-testid": `model-option-${m.id}`, className: "border-border hover:border-foreground/40 flex w-full cursor-pointer items-center gap-2.5 rounded-md border border-dashed px-4 py-2.5 text-left transition-colors disabled:opacity-50", onClick: () => handleModelSelect(m.id), children: [_jsxs("div", { className: "flex min-w-0 flex-1 flex-col gap-0.5", children: [_jsx("span", { className: "text-xs font-medium", children: meta.displayName || m.displayName }), _jsx("span", { className: "text-muted-foreground text-[10px] leading-tight", children: meta.description || m.description })] }), _jsx(ChevronRight, { className: "text-muted-foreground h-3 w-3 shrink-0" })] }, m.id));
99
+ }) })] })) : null] })] }));
222
100
  }
@@ -1 +1 @@
1
- {"version":3,"file":"features-canvas.d.ts","sourceRoot":"","sources":["../../../../../../../src/presentation/web/components/features/features-canvas/features-canvas.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAKvF,OAAO,KAAK,EAAE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W,EACX,WAAW,EACX,YAAY,EACZ,SAAS,EACT,eAAe,EACf,OAAO,EACP,UAAU,GACX,EAAE,mBAAmB,2CA2HrB"}
@@ -1,8 +1,9 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useCallback, useMemo } from 'react';
4
- import { ReactFlow, Background, Controls, ControlButton, useReactFlow } from '@xyflow/react';
3
+ import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
4
+ import { ReactFlow, Background, BackgroundVariant, Controls, ControlButton, useReactFlow, } from '@xyflow/react';
5
5
  import { Plus, RotateCcw } from 'lucide-react';
6
+ import { cn } from '../../../lib/utils.js';
6
7
  import { Button } from '../../ui/button.js';
7
8
  import { EmptyState } from '../../common/empty-state/index.js';
8
9
  import { FeatureNode } from '../../common/feature-node/index.js';
@@ -33,11 +34,31 @@ export function FeaturesCanvas({ nodes, edges, selectedFeatureId, defaultViewpor
33
34
  node.data.featureId === selectedFeatureId
34
35
  ? { ...node, selected: true }
35
36
  : node), [nodes, selectedFeatureId]);
36
- if (nodes.length === 0) {
37
- if (emptyState) {
38
- return (_jsx("div", { "data-testid": "features-canvas-empty", className: "h-full w-full", children: emptyState }));
37
+ const isEmpty = nodes.length === 0;
38
+ // Track empty→populated transition for exit animation.
39
+ // When isEmpty flips from true to false, keep the overlay mounted
40
+ // and fade it out before removing it from the DOM.
41
+ const [showOverlay, setShowOverlay] = useState(isEmpty);
42
+ const [overlayExiting, setOverlayExiting] = useState(false);
43
+ const prevEmptyRef = useRef(isEmpty);
44
+ useEffect(() => {
45
+ if (prevEmptyRef.current && !isEmpty) {
46
+ // Was empty, now populated — start exit animation
47
+ setOverlayExiting(true);
48
+ const timer = setTimeout(() => {
49
+ setShowOverlay(false);
50
+ setOverlayExiting(false);
51
+ }, 300);
52
+ prevEmptyRef.current = isEmpty;
53
+ return () => clearTimeout(timer);
39
54
  }
40
- return (_jsx("div", { "data-testid": "features-canvas-empty", children: _jsx(EmptyState, { title: "No features yet", description: "Get started by creating your first feature.", action: _jsxs(Button, { onClick: onAddFeature, children: [_jsx(Plus, { className: "mr-2 h-4 w-4" }), "New Feature"] }) }) }));
41
- }
42
- return (_jsx("div", { "data-testid": "features-canvas", "data-no-drawer-close": true, className: "pointer-events-auto h-full w-full", children: _jsxs(ReactFlow, { nodes: enrichedNodes, edges: edges, nodeTypes: nodeTypes, edgeTypes: edgeTypes, onConnect: onConnect, onNodesChange: onNodesChange, onNodeClick: onNodeClick, onPaneClick: onPaneClick, onMoveStart: onCanvasDrag, onMoveEnd: onMoveEnd, defaultViewport: defaultViewport ?? FALLBACK_VIEWPORT, nodesDraggable: false, nodesConnectable: false, elementsSelectable: false, proOptions: { hideAttribution: true }, children: [_jsx(Background, {}), _jsx(Controls, { showInteractive: false, children: onResetViewport ? _jsx(ResetButton, { onResetViewport: onResetViewport }) : null }), toolbar] }) }));
55
+ if (!prevEmptyRef.current && isEmpty) {
56
+ // Was populated, now empty — show overlay immediately
57
+ setShowOverlay(true);
58
+ }
59
+ prevEmptyRef.current = isEmpty;
60
+ }, [isEmpty]);
61
+ const fallbackEmptyState = isEmpty && !emptyState ? (_jsx(EmptyState, { title: "No features yet", description: "Get started by creating your first feature.", action: _jsxs(Button, { onClick: onAddFeature, children: [_jsx(Plus, { className: "mr-2 h-4 w-4" }), "New Feature"] }) })) : null;
62
+ const overlayContent = emptyState ?? fallbackEmptyState;
63
+ return (_jsxs("div", { "data-testid": isEmpty ? 'features-canvas-empty' : 'features-canvas', "data-no-drawer-close": true, className: "dark:bg-background pointer-events-auto relative h-full w-full bg-[#f6f7f8]", children: [_jsxs(ReactFlow, { nodes: enrichedNodes, edges: edges, nodeTypes: nodeTypes, edgeTypes: edgeTypes, onConnect: onConnect, onNodesChange: onNodesChange, onNodeClick: onNodeClick, onPaneClick: onPaneClick, onMoveStart: onCanvasDrag, onMoveEnd: onMoveEnd, defaultViewport: defaultViewport ?? FALLBACK_VIEWPORT, nodesDraggable: false, nodesConnectable: false, elementsSelectable: false, proOptions: { hideAttribution: true }, children: [_jsx(Background, { variant: BackgroundVariant.Dots, gap: 24, size: 1, color: "#b8bcc4", className: "dark:[&_circle]:!fill-white/[0.1]" }), !isEmpty && (_jsx(Controls, { showInteractive: false, children: onResetViewport ? _jsx(ResetButton, { onResetViewport: onResetViewport }) : null })), toolbar] }), showOverlay && overlayContent ? (_jsx("div", { className: cn('pointer-events-none absolute inset-0 z-10 flex items-center justify-center transition-opacity duration-300', overlayExiting ? 'opacity-0' : 'animate-in fade-in opacity-100 duration-200'), children: _jsx("div", { className: "pointer-events-auto", children: overlayContent }) })) : null] }));
43
64
  }
@@ -1 +1 @@
1
- {"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/web/components/ui/dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,UAAU,CAAC;AAKrD,QAAA,MAAM,MAAM,uCAAuB,CAAC;AAEpC,QAAA,MAAM,aAAa,8GAA0B,CAAC;AAE9C,QAAA,MAAM,YAAY,6CAAyB,CAAC;AAE5C,QAAA,MAAM,WAAW,4GAAwB,CAAC;AAE1C,QAAA,MAAM,aAAa,8JAejB,CAAC;AAGH,QAAA,MAAM,aAAa,8JAqBjB,CAAC;AAGH,QAAA,MAAM,YAAY;8BAA6B,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;;CAElF,CAAC;AAGF,QAAA,MAAM,YAAY;8BAA6B,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;;CAKlF,CAAC;AAGF,QAAA,MAAM,WAAW,oKASf,CAAC;AAGH,QAAA,MAAM,iBAAiB,8KASrB,CAAC;AAGH,OAAO,EACL,MAAM,EACN,YAAY,EACZ,aAAa,EACb,aAAa,EACb,WAAW,EACX,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,iBAAiB,GAClB,CAAC"}
1
+ {"version":3,"file":"dialog.d.ts","sourceRoot":"","sources":["../../../../../../src/presentation/web/components/ui/dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,IAAI,eAAe,EAAE,MAAM,UAAU,CAAC;AAKrD,QAAA,MAAM,MAAM,uCAAuB,CAAC;AAEpC,QAAA,MAAM,aAAa,8GAA0B,CAAC;AAE9C,QAAA,MAAM,YAAY,6CAAyB,CAAC;AAE5C,QAAA,MAAM,WAAW,4GAAwB,CAAC;AAE1C,QAAA,MAAM,aAAa,8JAkBjB,CAAC;AAGH,QAAA,MAAM,aAAa,8JAqBjB,CAAC;AAGH,QAAA,MAAM,YAAY;8BAA6B,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;;CAElF,CAAC;AAGF,QAAA,MAAM,YAAY;8BAA6B,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;;CAKlF,CAAC;AAGF,QAAA,MAAM,WAAW,oKASf,CAAC;AAGH,QAAA,MAAM,iBAAiB,8KASrB,CAAC;AAGH,OAAO,EACL,MAAM,EACN,YAAY,EACZ,aAAa,EACb,aAAa,EACb,WAAW,EACX,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,iBAAiB,GAClB,CAAC"}
@@ -8,14 +8,14 @@ const Dialog = DialogPrimitive.Root;
8
8
  const DialogTrigger = DialogPrimitive.Trigger;
9
9
  const DialogPortal = DialogPrimitive.Portal;
10
10
  const DialogClose = DialogPrimitive.Close;
11
- const DialogOverlay = React.forwardRef(({ className, onClick, ...props }, ref) => (_jsx(DialogPrimitive.Overlay, { ref: ref, className: cn('fixed inset-0 z-50 bg-black/80', className), onClick: (e) => {
11
+ const DialogOverlay = React.forwardRef(({ className, onClick, ...props }, ref) => (_jsx(DialogPrimitive.Overlay, { ref: ref, className: cn('data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 fixed inset-0 z-50 bg-black/80 duration-150', className), onClick: (e) => {
12
12
  // Prevent overlay clicks from propagating to document-level handlers
13
13
  // (e.g. BaseDrawer outside-click) — only the dialog should dismiss.
14
14
  e.stopPropagation();
15
15
  onClick?.(e);
16
16
  }, ...props })));
17
17
  DialogOverlay.displayName = DialogPrimitive.Overlay.displayName;
18
- const DialogContent = React.forwardRef(({ className, children, ...props }, ref) => (_jsxs(DialogPortal, { children: [_jsx(DialogOverlay, {}), _jsxs(DialogPrimitive.Content, { ref: ref, className: cn('bg-background fixed top-[50%] left-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border p-6 shadow-lg sm:rounded-lg', className), ...props, children: [children, _jsxs(DialogPrimitive.Close, { className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 cursor-pointer rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-none disabled:pointer-events-none", children: [_jsx(X, { className: "h-4 w-4" }), _jsx("span", { className: "sr-only", children: "Close" })] })] })] })));
18
+ const DialogContent = React.forwardRef(({ className, children, ...props }, ref) => (_jsxs(DialogPortal, { children: [_jsx(DialogOverlay, {}), _jsxs(DialogPrimitive.Content, { ref: ref, className: cn('bg-background data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border p-6 shadow-lg duration-150 sm:rounded-lg', className), ...props, children: [children, _jsxs(DialogPrimitive.Close, { className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 cursor-pointer rounded-sm opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-none disabled:pointer-events-none", children: [_jsx(X, { className: "h-4 w-4" }), _jsx("span", { className: "sr-only", children: "Close" })] })] })] })));
19
19
  DialogContent.displayName = DialogPrimitive.Content.displayName;
20
20
  const DialogHeader = ({ className, ...props }) => (_jsx("div", { className: cn('flex flex-col space-y-1.5 text-center sm:text-left', className), ...props }));
21
21
  DialogHeader.displayName = 'DialogHeader';
@@ -1 +1 @@
1
- {"version":3,"file":"use-graph-state.d.ts","sourceRoot":"","sources":["../../../../../src/presentation/web/hooks/use-graph-state.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAY,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAEL,KAAK,YAAY,EAEjB,KAAK,cAAc,EACpB,MAAM,oBAAoB,CAAC;AAG5B,YAAY,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,MAAM,WAAW,mBAAmB;IAClC,mDAAmD;IACnD,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,mDAAmD;IACnD,KAAK,EAAE,IAAI,EAAE,CAAC;IACd;;;OAGG;IACH,SAAS,EAAE,CAAC,QAAQ,EAAE,cAAc,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,IAAI,CAAC;IAClE,uEAAuE;IACvE,aAAa,EAAE,CAAC,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAC5E,kEAAkE;IAClE,iBAAiB,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,YAAY,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1F,yDAAyD;IACzD,oBAAoB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/C,sDAAsD;IACtD,aAAa,EAAE,CAAC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K,IAAI,CAAC;IACtF,gEAAgE;IAChE,wBAAwB,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IACxE,yDAAyD;IACzD,iBAAiB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,kBAAkB,GAAG,SAAS,CAAC;IACtE,+EAA+E;IAC/E,cAAc,EAAE,MAAM,MAAM,CAAC;IAC7B,6EAA6E;IAC7E,YAAY,EAAE,CAAC,SAAS,EAAE,cAAc,KAAK,IAAI,CAAC;CACnD;AAuCD,KAAK,kBAAkB,GAAG,OAAO,CAC/B,IAAI,CAAC,eAAe,EAAE,OAAO,GAAG,WAAW,GAAG,MAAM,GAAG,aAAa,CAAC,CACtE,CAAC;AAWF,wBAAgB,aAAa,CAC3B,YAAY,EAAE,cAAc,EAAE,EAC9B,YAAY,EAAE,IAAI,EAAE,GACnB,mBAAmB,CAkXrB"}
@@ -45,6 +45,12 @@ export function useGraphState(initialNodes, initialEdges) {
45
45
  // Buffer for SSE updates that arrive before their feature is in featureMap.
46
46
  // When reconcile adds new features, buffered updates are applied automatically.
47
47
  const pendingUpdatesRef = useRef(new Map());
48
+ // Protect recently-added/replaced repos from stale-poll reconcile.
49
+ // After addRepository or replaceRepository, the repo ID is marked as protected.
50
+ // Once reconcile sees the repo in server data, the protection is cleared.
51
+ // This prevents a stale poll (that fetched data before the server action completed)
52
+ // from wiping a repo that the client has already added.
53
+ const protectedRepoIdsRef = useRef(new Set());
48
54
  // Track 'deleting' features that the server no longer returns.
49
55
  // Retained for one extra reconcile cycle so the user sees the deleting state
50
56
  // before the node disappears from the canvas.
@@ -189,18 +195,28 @@ export function useGraphState(initialNodes, initialEdges) {
189
195
  }
190
196
  return changed ? next : currentPendingMap;
191
197
  });
192
- // Merge repoMap: preserve optimistic (temp) repos that the server doesn't
193
- // know about yet. Temp repos use IDs like "repo-temp-*". Without this,
194
- // a polling reconcile that fires before the server action returns would
195
- // wipe the optimistic entry, causing the repo to disappear and reappear.
198
+ // Merge repoMap: preserve optimistic (temp) repos AND recently-added/replaced
199
+ // repos that the server doesn't know about yet. Without this, a polling
200
+ // reconcile that fires before the server action returns (or uses stale data
201
+ // from an in-flight fetch) would wipe the repo, causing a canvas→empty flicker.
196
202
  setRepoMap((currentRepoMap) => {
197
203
  // Start with everything the server returned
198
204
  const merged = new Map(newRepoMap);
199
205
  // Build a set of repositoryPaths present in server data for dedup
200
206
  const serverPaths = new Set([...newRepoMap.values()].map((e) => e.data.repositoryPath));
201
- // Keep optimistic entries whose path isn't in server data yet
202
207
  for (const [id, entry] of currentRepoMap) {
203
- if (id.startsWith('repo-temp-') && !serverPaths.has(entry.data.repositoryPath)) {
208
+ if (merged.has(id)) {
209
+ // Server confirmed this repo — no longer needs protection
210
+ protectedRepoIdsRef.current.delete(id);
211
+ continue;
212
+ }
213
+ if (serverPaths.has(entry.data.repositoryPath)) {
214
+ // Server has a repo with same path — clear protection
215
+ protectedRepoIdsRef.current.delete(id);
216
+ continue;
217
+ }
218
+ // Keep temp repos or protected (recently added/replaced) repos
219
+ if (id.startsWith('repo-temp-') || protectedRepoIdsRef.current.has(id)) {
204
220
  merged.set(id, entry);
205
221
  }
206
222
  }
@@ -271,6 +287,7 @@ export function useGraphState(initialNodes, initialEdges) {
271
287
  });
272
288
  }, []);
273
289
  const addRepository = useCallback((nodeId, data) => {
290
+ protectedRepoIdsRef.current.add(nodeId);
274
291
  setRepoMap((prev) => {
275
292
  const next = new Map(prev);
276
293
  next.set(nodeId, { nodeId, data });
@@ -278,6 +295,7 @@ export function useGraphState(initialNodes, initialEdges) {
278
295
  });
279
296
  }, []);
280
297
  const removeRepository = useCallback((nodeId) => {
298
+ protectedRepoIdsRef.current.delete(nodeId);
281
299
  setRepoMap((prev) => {
282
300
  if (!prev.has(nodeId))
283
301
  return prev;
@@ -287,6 +305,8 @@ export function useGraphState(initialNodes, initialEdges) {
287
305
  });
288
306
  }, []);
289
307
  const replaceRepository = useCallback((tempId, realId, data) => {
308
+ protectedRepoIdsRef.current.delete(tempId);
309
+ protectedRepoIdsRef.current.add(realId);
290
310
  setRepoMap((prev) => {
291
311
  if (!prev.has(tempId))
292
312
  return prev;