@jlongo78/agent-spaces 0.9.7 → 0.9.9

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 (643) hide show
  1. package/.next/standalone/.claude/settings.local.json +17 -4
  2. package/.next/standalone/.next/BUILD_ID +1 -1
  3. package/.next/standalone/.next/app-path-routes-manifest.json +4 -0
  4. package/.next/standalone/.next/build-manifest.json +2 -2
  5. package/.next/standalone/.next/prerender-manifest.json +3 -3
  6. package/.next/standalone/.next/routes-manifest.json +29 -0
  7. package/.next/standalone/.next/server/app/(desktop)/admin/analytics/page.js.nft.json +1 -1
  8. package/.next/standalone/.next/server/app/(desktop)/admin/analytics/page_client-reference-manifest.js +1 -1
  9. package/.next/standalone/.next/server/app/(desktop)/admin/users/page_client-reference-manifest.js +1 -1
  10. package/.next/standalone/.next/server/app/(desktop)/analytics/page_client-reference-manifest.js +1 -1
  11. package/.next/standalone/.next/server/app/(desktop)/cortex/page_client-reference-manifest.js +1 -1
  12. package/.next/standalone/.next/server/app/(desktop)/network/page_client-reference-manifest.js +1 -1
  13. package/.next/standalone/.next/server/app/(desktop)/page_client-reference-manifest.js +1 -1
  14. package/.next/standalone/.next/server/app/(desktop)/projects/page_client-reference-manifest.js +1 -1
  15. package/.next/standalone/.next/server/app/(desktop)/sessions/[id]/page.js.nft.json +1 -1
  16. package/.next/standalone/.next/server/app/(desktop)/sessions/[id]/page_client-reference-manifest.js +1 -1
  17. package/.next/standalone/.next/server/app/(desktop)/sessions/page_client-reference-manifest.js +1 -1
  18. package/.next/standalone/.next/server/app/(desktop)/settings/page_client-reference-manifest.js +1 -1
  19. package/.next/standalone/.next/server/app/(desktop)/terminal/page.js.nft.json +1 -1
  20. package/.next/standalone/.next/server/app/(desktop)/terminal/page_client-reference-manifest.js +1 -1
  21. package/.next/standalone/.next/server/app/(desktop)/terminal/pane/[id]/page_client-reference-manifest.js +1 -1
  22. package/.next/standalone/.next/server/app/(desktop)/terminal/remote/[nodeId]/[workspaceId]/page_client-reference-manifest.js +1 -1
  23. package/.next/standalone/.next/server/app/(desktop)/workspaces/page_client-reference-manifest.js +1 -1
  24. package/.next/standalone/.next/server/app/_global-error.html +2 -2
  25. package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
  26. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  27. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  28. package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  29. package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  30. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  31. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  32. package/.next/standalone/.next/server/app/_not-found.html +1 -1
  33. package/.next/standalone/.next/server/app/_not-found.rsc +2 -2
  34. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  35. package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  36. package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  37. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  38. package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  39. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  40. package/.next/standalone/.next/server/app/admin/analytics.html +1 -1
  41. package/.next/standalone/.next/server/app/admin/analytics.rsc +3 -3
  42. package/.next/standalone/.next/server/app/admin/analytics.segments/!KGRlc2t0b3Ap/admin/analytics/__PAGE__.segment.rsc +2 -2
  43. package/.next/standalone/.next/server/app/admin/analytics.segments/!KGRlc2t0b3Ap/admin/analytics.segment.rsc +1 -1
  44. package/.next/standalone/.next/server/app/admin/analytics.segments/!KGRlc2t0b3Ap/admin.segment.rsc +1 -1
  45. package/.next/standalone/.next/server/app/admin/analytics.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
  46. package/.next/standalone/.next/server/app/admin/analytics.segments/_full.segment.rsc +3 -3
  47. package/.next/standalone/.next/server/app/admin/analytics.segments/_head.segment.rsc +1 -1
  48. package/.next/standalone/.next/server/app/admin/analytics.segments/_index.segment.rsc +2 -2
  49. package/.next/standalone/.next/server/app/admin/analytics.segments/_tree.segment.rsc +2 -2
  50. package/.next/standalone/.next/server/app/admin/users.html +1 -1
  51. package/.next/standalone/.next/server/app/admin/users.rsc +2 -2
  52. package/.next/standalone/.next/server/app/admin/users.segments/!KGRlc2t0b3Ap/admin/users/__PAGE__.segment.rsc +1 -1
  53. package/.next/standalone/.next/server/app/admin/users.segments/!KGRlc2t0b3Ap/admin/users.segment.rsc +1 -1
  54. package/.next/standalone/.next/server/app/admin/users.segments/!KGRlc2t0b3Ap/admin.segment.rsc +1 -1
  55. package/.next/standalone/.next/server/app/admin/users.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
  56. package/.next/standalone/.next/server/app/admin/users.segments/_full.segment.rsc +2 -2
  57. package/.next/standalone/.next/server/app/admin/users.segments/_head.segment.rsc +1 -1
  58. package/.next/standalone/.next/server/app/admin/users.segments/_index.segment.rsc +2 -2
  59. package/.next/standalone/.next/server/app/admin/users.segments/_tree.segment.rsc +2 -2
  60. package/.next/standalone/.next/server/app/analytics.html +1 -1
  61. package/.next/standalone/.next/server/app/analytics.rsc +2 -2
  62. package/.next/standalone/.next/server/app/analytics.segments/!KGRlc2t0b3Ap/analytics/__PAGE__.segment.rsc +1 -1
  63. package/.next/standalone/.next/server/app/analytics.segments/!KGRlc2t0b3Ap/analytics.segment.rsc +1 -1
  64. package/.next/standalone/.next/server/app/analytics.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
  65. package/.next/standalone/.next/server/app/analytics.segments/_full.segment.rsc +2 -2
  66. package/.next/standalone/.next/server/app/analytics.segments/_head.segment.rsc +1 -1
  67. package/.next/standalone/.next/server/app/analytics.segments/_index.segment.rsc +2 -2
  68. package/.next/standalone/.next/server/app/analytics.segments/_tree.segment.rsc +2 -2
  69. package/.next/standalone/.next/server/app/api/analytics/overview/route.js +1 -1
  70. package/.next/standalone/.next/server/app/api/analytics/overview/route.js.nft.json +1 -1
  71. package/.next/standalone/.next/server/app/api/benchmark/lobes/route.js +1 -1
  72. package/.next/standalone/.next/server/app/api/benchmark/lobes/route.js.nft.json +1 -1
  73. package/.next/standalone/.next/server/app/api/benchmark/run/route.js +1 -1
  74. package/.next/standalone/.next/server/app/api/benchmark/run/route.js.nft.json +1 -1
  75. package/.next/standalone/.next/server/app/api/benchmark/runs/[id]/route.js +1 -1
  76. package/.next/standalone/.next/server/app/api/benchmark/runs/[id]/route.js.nft.json +1 -1
  77. package/.next/standalone/.next/server/app/api/benchmark/runs/route.js +1 -1
  78. package/.next/standalone/.next/server/app/api/benchmark/runs/route.js.nft.json +1 -1
  79. package/.next/standalone/.next/server/app/api/benchmark/status/route.js +1 -1
  80. package/.next/standalone/.next/server/app/api/benchmark/status/route.js.nft.json +1 -1
  81. package/.next/standalone/.next/server/app/api/bulk/route.js +1 -1
  82. package/.next/standalone/.next/server/app/api/bulk/route.js.nft.json +1 -1
  83. package/.next/standalone/.next/server/app/api/claude/usage/route/app-paths-manifest.json +3 -0
  84. package/.next/standalone/.next/server/app/api/claude/usage/route/build-manifest.json +11 -0
  85. package/.next/standalone/.next/server/app/api/claude/usage/route/server-reference-manifest.json +4 -0
  86. package/.next/standalone/.next/server/app/api/claude/usage/route.js +8 -0
  87. package/.next/standalone/.next/server/app/api/claude/usage/route.js.map +5 -0
  88. package/.next/standalone/.next/server/app/api/claude/usage/route.js.nft.json +1 -0
  89. package/.next/standalone/.next/server/app/api/claude/usage/route_client-reference-manifest.js +2 -0
  90. package/.next/standalone/.next/server/app/api/config/route.js +1 -1
  91. package/.next/standalone/.next/server/app/api/config/route.js.nft.json +1 -1
  92. package/.next/standalone/.next/server/app/api/cortex/context/route.js +1 -1
  93. package/.next/standalone/.next/server/app/api/cortex/context/route.js.nft.json +1 -1
  94. package/.next/standalone/.next/server/app/api/cortex/curation/assess/route.js +1 -1
  95. package/.next/standalone/.next/server/app/api/cortex/curation/assess/route.js.nft.json +1 -1
  96. package/.next/standalone/.next/server/app/api/cortex/curation/publish/route.js +1 -1
  97. package/.next/standalone/.next/server/app/api/cortex/curation/publish/route.js.nft.json +1 -1
  98. package/.next/standalone/.next/server/app/api/cortex/curation/refine/route.js +1 -1
  99. package/.next/standalone/.next/server/app/api/cortex/curation/refine/route.js.nft.json +1 -1
  100. package/.next/standalone/.next/server/app/api/cortex/curation/review/route.js +1 -1
  101. package/.next/standalone/.next/server/app/api/cortex/curation/review/route.js.nft.json +1 -1
  102. package/.next/standalone/.next/server/app/api/cortex/curation/seed/route.js +1 -1
  103. package/.next/standalone/.next/server/app/api/cortex/curation/seed/route.js.nft.json +1 -1
  104. package/.next/standalone/.next/server/app/api/cortex/export/route.js +1 -1
  105. package/.next/standalone/.next/server/app/api/cortex/export/route.js.nft.json +1 -1
  106. package/.next/standalone/.next/server/app/api/cortex/federation/pending/route.js +1 -1
  107. package/.next/standalone/.next/server/app/api/cortex/federation/pending/route.js.nft.json +1 -1
  108. package/.next/standalone/.next/server/app/api/cortex/federation/resolve/route.js +1 -1
  109. package/.next/standalone/.next/server/app/api/cortex/federation/resolve/route.js.nft.json +1 -1
  110. package/.next/standalone/.next/server/app/api/cortex/federation/search/route.js +1 -1
  111. package/.next/standalone/.next/server/app/api/cortex/federation/search/route.js.nft.json +1 -1
  112. package/.next/standalone/.next/server/app/api/cortex/federation/teach/route.js +1 -1
  113. package/.next/standalone/.next/server/app/api/cortex/federation/teach/route.js.nft.json +1 -1
  114. package/.next/standalone/.next/server/app/api/cortex/graph/edges/route.js +1 -1
  115. package/.next/standalone/.next/server/app/api/cortex/graph/edges/route.js.nft.json +1 -1
  116. package/.next/standalone/.next/server/app/api/cortex/graph/entities/[id]/route.js +1 -1
  117. package/.next/standalone/.next/server/app/api/cortex/graph/entities/[id]/route.js.nft.json +1 -1
  118. package/.next/standalone/.next/server/app/api/cortex/graph/entities/route.js +1 -1
  119. package/.next/standalone/.next/server/app/api/cortex/graph/entities/route.js.nft.json +1 -1
  120. package/.next/standalone/.next/server/app/api/cortex/graph/populate/route.js +1 -1
  121. package/.next/standalone/.next/server/app/api/cortex/graph/populate/route.js.nft.json +1 -1
  122. package/.next/standalone/.next/server/app/api/cortex/import/route.js +1 -1
  123. package/.next/standalone/.next/server/app/api/cortex/import/route.js.nft.json +1 -1
  124. package/.next/standalone/.next/server/app/api/cortex/import/status/route.js +1 -1
  125. package/.next/standalone/.next/server/app/api/cortex/import/status/route.js.nft.json +1 -1
  126. package/.next/standalone/.next/server/app/api/cortex/ingest/bootstrap/route.js +1 -1
  127. package/.next/standalone/.next/server/app/api/cortex/ingest/bootstrap/route.js.nft.json +1 -1
  128. package/.next/standalone/.next/server/app/api/cortex/ingest/status/route.js +1 -1
  129. package/.next/standalone/.next/server/app/api/cortex/ingest/status/route.js.nft.json +1 -1
  130. package/.next/standalone/.next/server/app/api/cortex/knowledge/[id]/route.js +1 -1
  131. package/.next/standalone/.next/server/app/api/cortex/knowledge/[id]/route.js.nft.json +1 -1
  132. package/.next/standalone/.next/server/app/api/cortex/knowledge/route.js +1 -1
  133. package/.next/standalone/.next/server/app/api/cortex/knowledge/route.js.nft.json +1 -1
  134. package/.next/standalone/.next/server/app/api/cortex/lobes/[id]/route.js +1 -1
  135. package/.next/standalone/.next/server/app/api/cortex/lobes/[id]/route.js.nft.json +1 -1
  136. package/.next/standalone/.next/server/app/api/cortex/lobes/route.js +1 -1
  137. package/.next/standalone/.next/server/app/api/cortex/lobes/route.js.nft.json +1 -1
  138. package/.next/standalone/.next/server/app/api/cortex/lobes/share/route.js +1 -1
  139. package/.next/standalone/.next/server/app/api/cortex/lobes/share/route.js.nft.json +1 -1
  140. package/.next/standalone/.next/server/app/api/cortex/marketplace/browse/route.js +1 -1
  141. package/.next/standalone/.next/server/app/api/cortex/marketplace/browse/route.js.nft.json +1 -1
  142. package/.next/standalone/.next/server/app/api/cortex/marketplace/preview/route.js +1 -1
  143. package/.next/standalone/.next/server/app/api/cortex/marketplace/preview/route.js.nft.json +1 -1
  144. package/.next/standalone/.next/server/app/api/cortex/mcp/call/route.js +1 -1
  145. package/.next/standalone/.next/server/app/api/cortex/mcp/call/route.js.nft.json +1 -1
  146. package/.next/standalone/.next/server/app/api/cortex/mcp/tools/route.js +1 -1
  147. package/.next/standalone/.next/server/app/api/cortex/mcp/tools/route.js.nft.json +1 -1
  148. package/.next/standalone/.next/server/app/api/cortex/search/route.js +1 -1
  149. package/.next/standalone/.next/server/app/api/cortex/search/route.js.nft.json +1 -1
  150. package/.next/standalone/.next/server/app/api/cortex/settings/route.js +1 -1
  151. package/.next/standalone/.next/server/app/api/cortex/settings/route.js.nft.json +1 -1
  152. package/.next/standalone/.next/server/app/api/cortex/status/route.js +1 -1
  153. package/.next/standalone/.next/server/app/api/cortex/status/route.js.nft.json +1 -1
  154. package/.next/standalone/.next/server/app/api/cortex/timeline/route.js +1 -1
  155. package/.next/standalone/.next/server/app/api/cortex/timeline/route.js.nft.json +1 -1
  156. package/.next/standalone/.next/server/app/api/cortex/usage/route.js +1 -1
  157. package/.next/standalone/.next/server/app/api/cortex/usage/route.js.nft.json +1 -1
  158. package/.next/standalone/.next/server/app/api/cortex/workspace/[id]/context/route.js +1 -1
  159. package/.next/standalone/.next/server/app/api/cortex/workspace/[id]/context/route.js.nft.json +1 -1
  160. package/.next/standalone/.next/server/app/api/events/route.js +1 -1
  161. package/.next/standalone/.next/server/app/api/events/route.js.nft.json +1 -1
  162. package/.next/standalone/.next/server/app/api/files/route.js +1 -1
  163. package/.next/standalone/.next/server/app/api/files/route.js.nft.json +1 -1
  164. package/.next/standalone/.next/server/app/api/folders/route.js +1 -1
  165. package/.next/standalone/.next/server/app/api/folders/route.js.nft.json +1 -1
  166. package/.next/standalone/.next/server/app/api/network/handshake/route.js +1 -1
  167. package/.next/standalone/.next/server/app/api/network/handshake/route.js.nft.json +1 -1
  168. package/.next/standalone/.next/server/app/api/network/panes/[id]/route.js +1 -1
  169. package/.next/standalone/.next/server/app/api/network/panes/[id]/route.js.nft.json +1 -1
  170. package/.next/standalone/.next/server/app/api/network/panes/route.js +1 -1
  171. package/.next/standalone/.next/server/app/api/network/panes/route.js.nft.json +1 -1
  172. package/.next/standalone/.next/server/app/api/network/projects/route.js +1 -1
  173. package/.next/standalone/.next/server/app/api/network/projects/route.js.nft.json +1 -1
  174. package/.next/standalone/.next/server/app/api/network/search/route.js +1 -1
  175. package/.next/standalone/.next/server/app/api/network/search/route.js.nft.json +1 -1
  176. package/.next/standalone/.next/server/app/api/network/sessions/[id]/messages/route.js +1 -1
  177. package/.next/standalone/.next/server/app/api/network/sessions/[id]/messages/route.js.nft.json +1 -1
  178. package/.next/standalone/.next/server/app/api/network/sessions/[id]/route.js +1 -1
  179. package/.next/standalone/.next/server/app/api/network/sessions/[id]/route.js.nft.json +1 -1
  180. package/.next/standalone/.next/server/app/api/network/sessions/route.js +1 -1
  181. package/.next/standalone/.next/server/app/api/network/sessions/route.js.nft.json +1 -1
  182. package/.next/standalone/.next/server/app/api/network/workspaces/[id]/route.js +1 -1
  183. package/.next/standalone/.next/server/app/api/network/workspaces/[id]/route.js.nft.json +1 -1
  184. package/.next/standalone/.next/server/app/api/network/workspaces/route.js +1 -1
  185. package/.next/standalone/.next/server/app/api/network/workspaces/route.js.nft.json +1 -1
  186. package/.next/standalone/.next/server/app/api/panes/[id]/diff/route.js +1 -1
  187. package/.next/standalone/.next/server/app/api/panes/[id]/diff/route.js.nft.json +1 -1
  188. package/.next/standalone/.next/server/app/api/panes/[id]/route.js +1 -1
  189. package/.next/standalone/.next/server/app/api/panes/[id]/route.js.nft.json +1 -1
  190. package/.next/standalone/.next/server/app/api/panes/route.js +1 -1
  191. package/.next/standalone/.next/server/app/api/panes/route.js.nft.json +1 -1
  192. package/.next/standalone/.next/server/app/api/projects/route.js +1 -1
  193. package/.next/standalone/.next/server/app/api/projects/route.js.nft.json +1 -1
  194. package/.next/standalone/.next/server/app/api/proxy/models/[modelId]/[...path]/route.js +1 -1
  195. package/.next/standalone/.next/server/app/api/proxy/models/[modelId]/[...path]/route.js.nft.json +1 -1
  196. package/.next/standalone/.next/server/app/api/proxy/models/[modelId]/status/route.js +1 -1
  197. package/.next/standalone/.next/server/app/api/proxy/models/[modelId]/status/route.js.nft.json +1 -1
  198. package/.next/standalone/.next/server/app/api/search/route.js +2 -2
  199. package/.next/standalone/.next/server/app/api/search/route.js.nft.json +1 -1
  200. package/.next/standalone/.next/server/app/api/sessions/[id]/chat/route.js +1 -1
  201. package/.next/standalone/.next/server/app/api/sessions/[id]/chat/route.js.nft.json +1 -1
  202. package/.next/standalone/.next/server/app/api/sessions/[id]/messages/route.js +1 -1
  203. package/.next/standalone/.next/server/app/api/sessions/[id]/messages/route.js.nft.json +1 -1
  204. package/.next/standalone/.next/server/app/api/sessions/[id]/route.js +1 -1
  205. package/.next/standalone/.next/server/app/api/sessions/[id]/route.js.nft.json +1 -1
  206. package/.next/standalone/.next/server/app/api/sessions/route.js +2 -2
  207. package/.next/standalone/.next/server/app/api/sessions/route.js.nft.json +1 -1
  208. package/.next/standalone/.next/server/app/api/sync/route.js +1 -1
  209. package/.next/standalone/.next/server/app/api/sync/route.js.nft.json +1 -1
  210. package/.next/standalone/.next/server/app/api/tags/route.js +1 -1
  211. package/.next/standalone/.next/server/app/api/tags/route.js.nft.json +1 -1
  212. package/.next/standalone/.next/server/app/api/tier/route.js +1 -1
  213. package/.next/standalone/.next/server/app/api/tier/route.js.nft.json +1 -1
  214. package/.next/standalone/.next/server/app/api/whisper/config/route.js +1 -1
  215. package/.next/standalone/.next/server/app/api/whisper/config/route.js.nft.json +1 -1
  216. package/.next/standalone/.next/server/app/api/whisper/route.js.nft.json +1 -1
  217. package/.next/standalone/.next/server/app/api/wizard/chart/route/app-paths-manifest.json +3 -0
  218. package/.next/standalone/.next/server/app/api/wizard/chart/route/build-manifest.json +11 -0
  219. package/.next/standalone/.next/server/app/api/wizard/chart/route/server-reference-manifest.json +4 -0
  220. package/.next/standalone/.next/server/app/api/wizard/chart/route.js +7 -0
  221. package/.next/standalone/.next/server/app/api/wizard/chart/route.js.map +5 -0
  222. package/.next/standalone/.next/server/app/api/wizard/chart/route.js.nft.json +1 -0
  223. package/.next/standalone/.next/server/app/api/wizard/chart/route_client-reference-manifest.js +2 -0
  224. package/.next/standalone/.next/server/app/api/wizard/chat/route.js +1 -1
  225. package/.next/standalone/.next/server/app/api/wizard/chat/route.js.nft.json +1 -1
  226. package/.next/standalone/.next/server/app/api/workspaces/[id]/context/[key]/route.js +1 -1
  227. package/.next/standalone/.next/server/app/api/workspaces/[id]/context/[key]/route.js.nft.json +1 -1
  228. package/.next/standalone/.next/server/app/api/workspaces/[id]/context/route.js +1 -1
  229. package/.next/standalone/.next/server/app/api/workspaces/[id]/context/route.js.nft.json +1 -1
  230. package/.next/standalone/.next/server/app/api/workspaces/[id]/messages/[msgId]/route.js +1 -1
  231. package/.next/standalone/.next/server/app/api/workspaces/[id]/messages/[msgId]/route.js.nft.json +1 -1
  232. package/.next/standalone/.next/server/app/api/workspaces/[id]/messages/route.js +1 -1
  233. package/.next/standalone/.next/server/app/api/workspaces/[id]/messages/route.js.nft.json +1 -1
  234. package/.next/standalone/.next/server/app/api/workspaces/[id]/route.js +1 -1
  235. package/.next/standalone/.next/server/app/api/workspaces/[id]/route.js.nft.json +1 -1
  236. package/.next/standalone/.next/server/app/api/workspaces/[id]/sessions/route.js +1 -1
  237. package/.next/standalone/.next/server/app/api/workspaces/[id]/sessions/route.js.nft.json +1 -1
  238. package/.next/standalone/.next/server/app/api/workspaces/[id]/todos/[todoId]/route/app-paths-manifest.json +3 -0
  239. package/.next/standalone/.next/server/app/api/workspaces/[id]/todos/[todoId]/route/build-manifest.json +11 -0
  240. package/.next/standalone/.next/server/app/api/workspaces/[id]/todos/[todoId]/route/server-reference-manifest.json +4 -0
  241. package/.next/standalone/.next/server/app/api/workspaces/[id]/todos/[todoId]/route.js +8 -0
  242. package/.next/standalone/.next/server/app/api/workspaces/[id]/todos/[todoId]/route.js.map +5 -0
  243. package/.next/standalone/.next/server/app/api/workspaces/[id]/todos/[todoId]/route.js.nft.json +1 -0
  244. package/.next/standalone/.next/server/app/api/workspaces/[id]/todos/[todoId]/route_client-reference-manifest.js +2 -0
  245. package/.next/standalone/.next/server/app/api/workspaces/[id]/todos/route/app-paths-manifest.json +3 -0
  246. package/.next/standalone/.next/server/app/api/workspaces/[id]/todos/route/build-manifest.json +11 -0
  247. package/.next/standalone/.next/server/app/api/workspaces/[id]/todos/route/server-reference-manifest.json +4 -0
  248. package/.next/standalone/.next/server/app/api/workspaces/[id]/todos/route.js +8 -0
  249. package/.next/standalone/.next/server/app/api/workspaces/[id]/todos/route.js.map +5 -0
  250. package/.next/standalone/.next/server/app/api/workspaces/[id]/todos/route.js.nft.json +1 -0
  251. package/.next/standalone/.next/server/app/api/workspaces/[id]/todos/route_client-reference-manifest.js +2 -0
  252. package/.next/standalone/.next/server/app/api/workspaces/route.js +2 -2
  253. package/.next/standalone/.next/server/app/api/workspaces/route.js.nft.json +1 -1
  254. package/.next/standalone/.next/server/app/cortex.html +1 -1
  255. package/.next/standalone/.next/server/app/cortex.rsc +3 -3
  256. package/.next/standalone/.next/server/app/cortex.segments/!KGRlc2t0b3Ap/cortex/__PAGE__.segment.rsc +2 -2
  257. package/.next/standalone/.next/server/app/cortex.segments/!KGRlc2t0b3Ap/cortex.segment.rsc +1 -1
  258. package/.next/standalone/.next/server/app/cortex.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
  259. package/.next/standalone/.next/server/app/cortex.segments/_full.segment.rsc +3 -3
  260. package/.next/standalone/.next/server/app/cortex.segments/_head.segment.rsc +1 -1
  261. package/.next/standalone/.next/server/app/cortex.segments/_index.segment.rsc +2 -2
  262. package/.next/standalone/.next/server/app/cortex.segments/_tree.segment.rsc +2 -2
  263. package/.next/standalone/.next/server/app/login/page_client-reference-manifest.js +1 -1
  264. package/.next/standalone/.next/server/app/login.html +1 -1
  265. package/.next/standalone/.next/server/app/login.rsc +2 -2
  266. package/.next/standalone/.next/server/app/login.segments/_full.segment.rsc +2 -2
  267. package/.next/standalone/.next/server/app/login.segments/_head.segment.rsc +1 -1
  268. package/.next/standalone/.next/server/app/login.segments/_index.segment.rsc +2 -2
  269. package/.next/standalone/.next/server/app/login.segments/_tree.segment.rsc +2 -2
  270. package/.next/standalone/.next/server/app/login.segments/login/__PAGE__.segment.rsc +1 -1
  271. package/.next/standalone/.next/server/app/login.segments/login.segment.rsc +1 -1
  272. package/.next/standalone/.next/server/app/m/page_client-reference-manifest.js +1 -1
  273. package/.next/standalone/.next/server/app/m/projects/page_client-reference-manifest.js +1 -1
  274. package/.next/standalone/.next/server/app/m/projects.html +1 -1
  275. package/.next/standalone/.next/server/app/m/projects.rsc +2 -2
  276. package/.next/standalone/.next/server/app/m/projects.segments/_full.segment.rsc +2 -2
  277. package/.next/standalone/.next/server/app/m/projects.segments/_head.segment.rsc +1 -1
  278. package/.next/standalone/.next/server/app/m/projects.segments/_index.segment.rsc +2 -2
  279. package/.next/standalone/.next/server/app/m/projects.segments/_tree.segment.rsc +2 -2
  280. package/.next/standalone/.next/server/app/m/projects.segments/m/projects/__PAGE__.segment.rsc +1 -1
  281. package/.next/standalone/.next/server/app/m/projects.segments/m/projects.segment.rsc +1 -1
  282. package/.next/standalone/.next/server/app/m/projects.segments/m.segment.rsc +1 -1
  283. package/.next/standalone/.next/server/app/m/sessions/[id]/page.js.nft.json +1 -1
  284. package/.next/standalone/.next/server/app/m/sessions/[id]/page_client-reference-manifest.js +1 -1
  285. package/.next/standalone/.next/server/app/m/sessions/page_client-reference-manifest.js +1 -1
  286. package/.next/standalone/.next/server/app/m/sessions.html +1 -1
  287. package/.next/standalone/.next/server/app/m/sessions.rsc +2 -2
  288. package/.next/standalone/.next/server/app/m/sessions.segments/_full.segment.rsc +2 -2
  289. package/.next/standalone/.next/server/app/m/sessions.segments/_head.segment.rsc +1 -1
  290. package/.next/standalone/.next/server/app/m/sessions.segments/_index.segment.rsc +2 -2
  291. package/.next/standalone/.next/server/app/m/sessions.segments/_tree.segment.rsc +2 -2
  292. package/.next/standalone/.next/server/app/m/sessions.segments/m/sessions/__PAGE__.segment.rsc +1 -1
  293. package/.next/standalone/.next/server/app/m/sessions.segments/m/sessions.segment.rsc +1 -1
  294. package/.next/standalone/.next/server/app/m/sessions.segments/m.segment.rsc +1 -1
  295. package/.next/standalone/.next/server/app/m/settings/page_client-reference-manifest.js +1 -1
  296. package/.next/standalone/.next/server/app/m/settings.html +1 -1
  297. package/.next/standalone/.next/server/app/m/settings.rsc +2 -2
  298. package/.next/standalone/.next/server/app/m/settings.segments/_full.segment.rsc +2 -2
  299. package/.next/standalone/.next/server/app/m/settings.segments/_head.segment.rsc +1 -1
  300. package/.next/standalone/.next/server/app/m/settings.segments/_index.segment.rsc +2 -2
  301. package/.next/standalone/.next/server/app/m/settings.segments/_tree.segment.rsc +2 -2
  302. package/.next/standalone/.next/server/app/m/settings.segments/m/settings/__PAGE__.segment.rsc +1 -1
  303. package/.next/standalone/.next/server/app/m/settings.segments/m/settings.segment.rsc +1 -1
  304. package/.next/standalone/.next/server/app/m/settings.segments/m.segment.rsc +1 -1
  305. package/.next/standalone/.next/server/app/m/terminal/page_client-reference-manifest.js +1 -1
  306. package/.next/standalone/.next/server/app/m/terminal.html +1 -1
  307. package/.next/standalone/.next/server/app/m/terminal.rsc +3 -3
  308. package/.next/standalone/.next/server/app/m/terminal.segments/_full.segment.rsc +3 -3
  309. package/.next/standalone/.next/server/app/m/terminal.segments/_head.segment.rsc +1 -1
  310. package/.next/standalone/.next/server/app/m/terminal.segments/_index.segment.rsc +2 -2
  311. package/.next/standalone/.next/server/app/m/terminal.segments/_tree.segment.rsc +2 -2
  312. package/.next/standalone/.next/server/app/m/terminal.segments/m/terminal/__PAGE__.segment.rsc +2 -2
  313. package/.next/standalone/.next/server/app/m/terminal.segments/m/terminal.segment.rsc +1 -1
  314. package/.next/standalone/.next/server/app/m/terminal.segments/m.segment.rsc +1 -1
  315. package/.next/standalone/.next/server/app/m.html +1 -1
  316. package/.next/standalone/.next/server/app/m.rsc +2 -2
  317. package/.next/standalone/.next/server/app/m.segments/_full.segment.rsc +2 -2
  318. package/.next/standalone/.next/server/app/m.segments/_head.segment.rsc +1 -1
  319. package/.next/standalone/.next/server/app/m.segments/_index.segment.rsc +2 -2
  320. package/.next/standalone/.next/server/app/m.segments/_tree.segment.rsc +2 -2
  321. package/.next/standalone/.next/server/app/m.segments/m/__PAGE__.segment.rsc +1 -1
  322. package/.next/standalone/.next/server/app/m.segments/m.segment.rsc +1 -1
  323. package/.next/standalone/.next/server/app/network.html +1 -1
  324. package/.next/standalone/.next/server/app/network.rsc +2 -2
  325. package/.next/standalone/.next/server/app/network.segments/!KGRlc2t0b3Ap/network/__PAGE__.segment.rsc +1 -1
  326. package/.next/standalone/.next/server/app/network.segments/!KGRlc2t0b3Ap/network.segment.rsc +1 -1
  327. package/.next/standalone/.next/server/app/network.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
  328. package/.next/standalone/.next/server/app/network.segments/_full.segment.rsc +2 -2
  329. package/.next/standalone/.next/server/app/network.segments/_head.segment.rsc +1 -1
  330. package/.next/standalone/.next/server/app/network.segments/_index.segment.rsc +2 -2
  331. package/.next/standalone/.next/server/app/network.segments/_tree.segment.rsc +2 -2
  332. package/.next/standalone/.next/server/app/projects.html +1 -1
  333. package/.next/standalone/.next/server/app/projects.rsc +2 -2
  334. package/.next/standalone/.next/server/app/projects.segments/!KGRlc2t0b3Ap/projects/__PAGE__.segment.rsc +1 -1
  335. package/.next/standalone/.next/server/app/projects.segments/!KGRlc2t0b3Ap/projects.segment.rsc +1 -1
  336. package/.next/standalone/.next/server/app/projects.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
  337. package/.next/standalone/.next/server/app/projects.segments/_full.segment.rsc +2 -2
  338. package/.next/standalone/.next/server/app/projects.segments/_head.segment.rsc +1 -1
  339. package/.next/standalone/.next/server/app/projects.segments/_index.segment.rsc +2 -2
  340. package/.next/standalone/.next/server/app/projects.segments/_tree.segment.rsc +2 -2
  341. package/.next/standalone/.next/server/app/sessions.html +1 -1
  342. package/.next/standalone/.next/server/app/sessions.rsc +2 -2
  343. package/.next/standalone/.next/server/app/sessions.segments/!KGRlc2t0b3Ap/sessions/__PAGE__.segment.rsc +1 -1
  344. package/.next/standalone/.next/server/app/sessions.segments/!KGRlc2t0b3Ap/sessions.segment.rsc +1 -1
  345. package/.next/standalone/.next/server/app/sessions.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
  346. package/.next/standalone/.next/server/app/sessions.segments/_full.segment.rsc +2 -2
  347. package/.next/standalone/.next/server/app/sessions.segments/_head.segment.rsc +1 -1
  348. package/.next/standalone/.next/server/app/sessions.segments/_index.segment.rsc +2 -2
  349. package/.next/standalone/.next/server/app/sessions.segments/_tree.segment.rsc +2 -2
  350. package/.next/standalone/.next/server/app/settings.html +1 -1
  351. package/.next/standalone/.next/server/app/settings.rsc +3 -3
  352. package/.next/standalone/.next/server/app/settings.segments/!KGRlc2t0b3Ap/settings/__PAGE__.segment.rsc +2 -2
  353. package/.next/standalone/.next/server/app/settings.segments/!KGRlc2t0b3Ap/settings.segment.rsc +1 -1
  354. package/.next/standalone/.next/server/app/settings.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
  355. package/.next/standalone/.next/server/app/settings.segments/_full.segment.rsc +3 -3
  356. package/.next/standalone/.next/server/app/settings.segments/_head.segment.rsc +1 -1
  357. package/.next/standalone/.next/server/app/settings.segments/_index.segment.rsc +2 -2
  358. package/.next/standalone/.next/server/app/settings.segments/_tree.segment.rsc +2 -2
  359. package/.next/standalone/.next/server/app/terminal.html +1 -1
  360. package/.next/standalone/.next/server/app/terminal.rsc +3 -3
  361. package/.next/standalone/.next/server/app/terminal.segments/!KGRlc2t0b3Ap/terminal/__PAGE__.segment.rsc +2 -2
  362. package/.next/standalone/.next/server/app/terminal.segments/!KGRlc2t0b3Ap/terminal.segment.rsc +1 -1
  363. package/.next/standalone/.next/server/app/terminal.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
  364. package/.next/standalone/.next/server/app/terminal.segments/_full.segment.rsc +3 -3
  365. package/.next/standalone/.next/server/app/terminal.segments/_head.segment.rsc +1 -1
  366. package/.next/standalone/.next/server/app/terminal.segments/_index.segment.rsc +2 -2
  367. package/.next/standalone/.next/server/app/terminal.segments/_tree.segment.rsc +2 -2
  368. package/.next/standalone/.next/server/app/vr/page/react-loadable-manifest.json +1 -1
  369. package/.next/standalone/.next/server/app/vr/page_client-reference-manifest.js +1 -1
  370. package/.next/standalone/.next/server/app/vr.html +1 -1
  371. package/.next/standalone/.next/server/app/vr.rsc +3 -3
  372. package/.next/standalone/.next/server/app/vr.segments/_full.segment.rsc +3 -3
  373. package/.next/standalone/.next/server/app/vr.segments/_head.segment.rsc +1 -1
  374. package/.next/standalone/.next/server/app/vr.segments/_index.segment.rsc +2 -2
  375. package/.next/standalone/.next/server/app/vr.segments/_tree.segment.rsc +2 -2
  376. package/.next/standalone/.next/server/app/vr.segments/vr/__PAGE__.segment.rsc +2 -2
  377. package/.next/standalone/.next/server/app/vr.segments/vr.segment.rsc +1 -1
  378. package/.next/standalone/.next/server/app/workspaces.html +1 -1
  379. package/.next/standalone/.next/server/app/workspaces.rsc +2 -2
  380. package/.next/standalone/.next/server/app/workspaces.segments/!KGRlc2t0b3Ap/workspaces/__PAGE__.segment.rsc +1 -1
  381. package/.next/standalone/.next/server/app/workspaces.segments/!KGRlc2t0b3Ap/workspaces.segment.rsc +1 -1
  382. package/.next/standalone/.next/server/app/workspaces.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
  383. package/.next/standalone/.next/server/app/workspaces.segments/_full.segment.rsc +2 -2
  384. package/.next/standalone/.next/server/app/workspaces.segments/_head.segment.rsc +1 -1
  385. package/.next/standalone/.next/server/app/workspaces.segments/_index.segment.rsc +2 -2
  386. package/.next/standalone/.next/server/app/workspaces.segments/_tree.segment.rsc +2 -2
  387. package/.next/standalone/.next/server/app-paths-manifest.json +4 -0
  388. package/.next/standalone/.next/server/chunks/[root-of-the-server]__00e90fc6._.js +111 -0
  389. package/.next/standalone/.next/server/chunks/[root-of-the-server]__01ab8675._.js +111 -0
  390. package/.next/standalone/.next/server/chunks/[root-of-the-server]__03974f05._.js +111 -0
  391. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__bb331da9._.js → [root-of-the-server]__046c9b91._.js} +16 -3
  392. package/.next/standalone/.next/server/chunks/[root-of-the-server]__04ae6bf0._.js +111 -0
  393. package/.next/standalone/.next/server/chunks/[root-of-the-server]__056fa416._.js +1 -1
  394. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0ac4ea3f._.js +3 -0
  395. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0b8e64cb._.js +111 -0
  396. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0facd39e._.js +111 -0
  397. package/.next/standalone/.next/server/chunks/[root-of-the-server]__10bc76a3._.js +3 -0
  398. package/.next/standalone/.next/server/chunks/[root-of-the-server]__115f3934._.js +111 -0
  399. package/.next/standalone/.next/server/chunks/[root-of-the-server]__11f155f1._.js +3 -0
  400. package/.next/standalone/.next/server/chunks/[root-of-the-server]__160e7c73._.js +50 -33
  401. package/.next/standalone/.next/server/chunks/[root-of-the-server]__17a3b966._.js +111 -0
  402. package/.next/standalone/.next/server/chunks/[root-of-the-server]__17d3a2b2._.js +111 -0
  403. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1a86c055._.js +111 -0
  404. package/.next/standalone/.next/server/chunks/[root-of-the-server]__20b5e9c4._.js +3 -0
  405. package/.next/standalone/.next/server/chunks/[root-of-the-server]__28d6fbd8._.js +111 -0
  406. package/.next/standalone/.next/server/chunks/[root-of-the-server]__2a3f866b._.js +119 -0
  407. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__a95bb38b._.js → [root-of-the-server]__316617e7._.js} +3 -3
  408. package/.next/standalone/.next/server/chunks/[root-of-the-server]__32ad8f71._.js +111 -0
  409. package/.next/standalone/.next/server/chunks/[root-of-the-server]__35457394._.js +111 -0
  410. package/.next/standalone/.next/server/chunks/[root-of-the-server]__35de78e6._.js +111 -0
  411. package/.next/standalone/.next/server/chunks/[root-of-the-server]__3685ffcb._.js +111 -0
  412. package/.next/standalone/.next/server/chunks/[root-of-the-server]__38954988._.js +111 -0
  413. package/.next/standalone/.next/server/chunks/[root-of-the-server]__3a32b624._.js +111 -0
  414. package/.next/standalone/.next/server/chunks/[root-of-the-server]__426ad936._.js +119 -0
  415. package/.next/standalone/.next/server/chunks/[root-of-the-server]__4985c034._.js +111 -0
  416. package/.next/standalone/.next/server/chunks/[root-of-the-server]__5c6ce9ed._.js +111 -0
  417. package/.next/standalone/.next/server/chunks/[root-of-the-server]__5cebe58a._.js +111 -0
  418. package/.next/standalone/.next/server/chunks/[root-of-the-server]__5d5e4789._.js +111 -0
  419. package/.next/standalone/.next/server/chunks/[root-of-the-server]__65676930._.js +3 -0
  420. package/.next/standalone/.next/server/chunks/[root-of-the-server]__67cab326._.js +58 -0
  421. package/.next/standalone/.next/server/chunks/[root-of-the-server]__698c6f01._.js +111 -0
  422. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__7ebc4280._.js → [root-of-the-server]__6c64af29._.js} +22 -9
  423. package/.next/standalone/.next/server/chunks/[root-of-the-server]__73aed9f5._.js +111 -0
  424. package/.next/standalone/.next/server/chunks/[root-of-the-server]__79b6a9bb._.js +111 -0
  425. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__e56abacf._.js → [root-of-the-server]__7db704c6._.js} +18 -5
  426. package/.next/standalone/.next/server/chunks/[root-of-the-server]__812ca02b._.js +111 -0
  427. package/.next/standalone/.next/server/chunks/[root-of-the-server]__821f50fa._.js +111 -0
  428. package/.next/standalone/.next/server/chunks/[root-of-the-server]__8716b86e._.js +111 -0
  429. package/.next/standalone/.next/server/chunks/[root-of-the-server]__884ef754._.js +111 -0
  430. package/.next/standalone/.next/server/chunks/[root-of-the-server]__88cdbd68._.js +111 -0
  431. package/.next/standalone/.next/server/chunks/[root-of-the-server]__89d9aba9._.js +111 -0
  432. package/.next/standalone/.next/server/chunks/[root-of-the-server]__8c2e1260._.js +111 -0
  433. package/.next/standalone/.next/server/chunks/[root-of-the-server]__8d536cb5._.js +111 -0
  434. package/.next/standalone/.next/server/chunks/[root-of-the-server]__8df8c5d1._.js +111 -0
  435. package/.next/standalone/.next/server/chunks/[root-of-the-server]__8f2ccc41._.js +111 -0
  436. package/.next/standalone/.next/server/chunks/[root-of-the-server]__95c9d682._.js +111 -0
  437. package/.next/standalone/.next/server/chunks/[root-of-the-server]__9e5d7774._.js +111 -0
  438. package/.next/standalone/.next/server/chunks/[root-of-the-server]__9edcff87._.js +111 -0
  439. package/.next/standalone/.next/server/chunks/[root-of-the-server]__a049dfc2._.js +111 -0
  440. package/.next/standalone/.next/server/chunks/[root-of-the-server]__a5b4bb9a._.js +111 -0
  441. package/.next/standalone/.next/server/chunks/[root-of-the-server]__a83262a1._.js +111 -0
  442. package/.next/standalone/.next/server/chunks/[root-of-the-server]__a9cd1240._.js +111 -0
  443. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__efb8251e._.js → [root-of-the-server]__a9d7f822._.js} +16 -3
  444. package/.next/standalone/.next/server/chunks/[root-of-the-server]__ad08c221._.js +111 -0
  445. package/.next/standalone/.next/server/chunks/[root-of-the-server]__ad585f2f._.js +111 -0
  446. package/.next/standalone/.next/server/chunks/[root-of-the-server]__afcb8f7d._.js +111 -0
  447. package/.next/standalone/.next/server/chunks/[root-of-the-server]__bc250d43._.js +111 -0
  448. package/.next/standalone/.next/server/chunks/[root-of-the-server]__bce2a6e7._.js +111 -0
  449. package/.next/standalone/.next/server/chunks/[root-of-the-server]__c011bf91._.js +111 -0
  450. package/.next/standalone/.next/server/chunks/[root-of-the-server]__c0ac2895._.js +3 -0
  451. package/.next/standalone/.next/server/chunks/[root-of-the-server]__c37d6380._.js +3 -0
  452. package/.next/standalone/.next/server/chunks/[root-of-the-server]__cae392eb._.js +111 -0
  453. package/.next/standalone/.next/server/chunks/[root-of-the-server]__cc2616bb._.js +16 -3
  454. package/.next/standalone/.next/server/chunks/[root-of-the-server]__d501fa9b._.js +111 -0
  455. package/.next/standalone/.next/server/chunks/[root-of-the-server]__d59c6c15._.js +111 -0
  456. package/.next/standalone/.next/server/chunks/[root-of-the-server]__d5c1db32._.js +111 -0
  457. package/.next/standalone/.next/server/chunks/[root-of-the-server]__dba60c86._.js +111 -0
  458. package/.next/standalone/.next/server/chunks/[root-of-the-server]__de14b9ae._.js +111 -0
  459. package/.next/standalone/.next/server/chunks/[root-of-the-server]__e10643d1._.js +111 -0
  460. package/.next/standalone/.next/server/chunks/[root-of-the-server]__e2a996e5._.js +127 -0
  461. package/.next/standalone/.next/server/chunks/[root-of-the-server]__e3477417._.js +111 -0
  462. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__32dc5513._.js → [root-of-the-server]__e4db362e._.js} +2 -2
  463. package/.next/standalone/.next/server/chunks/[root-of-the-server]__e4e70b86._.js +111 -0
  464. package/.next/standalone/.next/server/chunks/[root-of-the-server]__e54925af._.js +111 -0
  465. package/.next/standalone/.next/server/chunks/[root-of-the-server]__e8cbeaca._.js +111 -0
  466. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__cabaac2b._.js → [root-of-the-server]__e8edc5b0._.js} +16 -3
  467. package/.next/standalone/.next/server/chunks/[root-of-the-server]__eab4d83b._.js +111 -0
  468. package/.next/standalone/.next/server/chunks/[root-of-the-server]__ead29015._.js +1 -1
  469. package/.next/standalone/.next/server/chunks/[root-of-the-server]__f056fd83._.js +111 -0
  470. package/.next/standalone/.next/server/chunks/[root-of-the-server]__f0e99572._.js +111 -0
  471. package/.next/standalone/.next/server/chunks/[root-of-the-server]__fe1e16d0._.js +111 -0
  472. package/.next/standalone/.next/server/chunks/[root-of-the-server]__ff9cd277._.js +111 -0
  473. package/.next/standalone/.next/server/chunks/[root-of-the-server]__ffaea2ce._.js +111 -0
  474. package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_claude_usage_route_actions_fe002ec1.js +3 -0
  475. package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_wizard_chart_route_actions_888e2ec1.js +3 -0
  476. package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_workspaces_[id]_todos_route_actions_0d4ffac5.js +3 -0
  477. package/.next/standalone/.next/server/chunks/ce889_server_app_api_workspaces_[id]_todos_[todoId]_route_actions_754fe6b9.js +3 -0
  478. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__2cffc362._.js +3 -0
  479. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__f1050870._.js → [root-of-the-server]__47c97637._.js} +2 -2
  480. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__66aca5d4._.js +1 -1
  481. package/.next/standalone/.next/server/chunks/ssr/_20c2cf3a._.js +3 -0
  482. package/.next/standalone/.next/server/chunks/ssr/_2a1d79e7._.js +1 -1
  483. package/.next/standalone/.next/server/chunks/ssr/_5c3c4cfa._.js +7 -5
  484. package/.next/standalone/.next/server/chunks/ssr/_5f55bf8f._.js +3 -0
  485. package/.next/standalone/.next/server/chunks/ssr/_ba432382._.js +7 -5
  486. package/.next/standalone/.next/server/chunks/ssr/src_app_(desktop)_cortex_page_tsx_0f33d8b3._.js +1 -1
  487. package/.next/standalone/.next/server/chunks/ssr/src_app_(desktop)_settings_page_tsx_f74824b3._.js +1 -1
  488. package/.next/standalone/.next/server/chunks/ssr/src_app_(desktop)_terminal_page_tsx_de5e8d85._.js +4 -4
  489. package/.next/standalone/.next/server/edge/chunks/[root-of-the-server]__90eeddae._.js +1 -1
  490. package/.next/standalone/.next/server/middleware-manifest.json +5 -5
  491. package/.next/standalone/.next/server/pages/404.html +1 -1
  492. package/.next/standalone/.next/server/pages/500.html +2 -2
  493. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  494. package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
  495. package/.next/standalone/.next/static/chunks/{74d0ac0b1d0a1b79.js → 10b00b4f66102dcf.js} +1 -1
  496. package/.next/standalone/.next/static/chunks/14216197f9dcbe5b.css +3 -0
  497. package/.next/standalone/.next/static/chunks/{16eb77953dee9ea3.js → 19c71a8376c23c58.js} +1 -1
  498. package/.next/standalone/.next/static/chunks/{3e91fc608659c524.js → 350271fe79509caf.js} +1 -1
  499. package/.next/standalone/.next/static/chunks/4c9fb0a38f041a3d.js +85 -0
  500. package/.next/standalone/.next/static/chunks/{70423c7afd8abf5f.js → 597847c22200c212.js} +1 -1
  501. package/.next/standalone/.next/static/chunks/8f6f93ab45a5ff5b.js +1 -0
  502. package/.next/standalone/.next/static/chunks/{7ecd9bbb0ce4d68a.js → b7c8fe9b7275a84f.js} +1 -1
  503. package/.next/standalone/.next/static/chunks/{6245135a7afb8c7b.js → c9b10fc55516d142.js} +8 -6
  504. package/.next/standalone/.next/static/chunks/d0065f48eab94944.js +1 -0
  505. package/.next/standalone/.next/static/chunks/{e62bb488d02db247.js → d2566c2dcf53fef3.js} +1 -1
  506. package/.next/standalone/.next/static/chunks/{180c1b9ff31b979f.js → f7b34c807badf95d.js} +8 -6
  507. package/.next/standalone/.next/static/chunks/{fb0abd1933b2b2e1.js → ff7d85dade44d1f3.js} +1 -1
  508. package/.next/standalone/.spaces/cortex-context.md +35 -129
  509. package/.next/standalone/bin/spaces.js +7 -4
  510. package/.next/standalone/bin/terminal-server.js +48 -10
  511. package/.next/standalone/cortex-hook-debug.log +118 -23
  512. package/.next/standalone/docs/features/claude-usage.md +105 -0
  513. package/.next/standalone/docs/features/workspace-todos.md +127 -0
  514. package/.next/standalone/docs/superpowers/plans/2026-04-21-workspace-todos.md +1097 -0
  515. package/.next/standalone/docs/superpowers/plans/2026-04-22-claude-usage-display.md +749 -0
  516. package/.next/standalone/docs/superpowers/specs/2026-04-21-workspace-todos-design.md +180 -0
  517. package/.next/standalone/docs/superpowers/specs/2026-04-22-claude-usage-display-design.md +183 -0
  518. package/.next/standalone/package-lock.json +2 -2
  519. package/.next/standalone/package.json +1 -1
  520. package/.next/standalone/src/app/(desktop)/settings/page.tsx +40 -1
  521. package/.next/standalone/src/app/(desktop)/terminal/page.tsx +98 -7
  522. package/.next/standalone/src/app/api/benchmark/run/route.ts +24 -3
  523. package/.next/standalone/src/app/api/claude/usage/route.ts +33 -0
  524. package/.next/standalone/src/app/api/config/route.ts +3 -0
  525. package/.next/standalone/src/app/api/cortex/context/route.ts +1 -1
  526. package/.next/standalone/src/app/api/cortex/knowledge/route.ts +1 -1
  527. package/.next/standalone/src/app/api/cortex/search/route.ts +14 -2
  528. package/.next/standalone/src/app/api/folders/route.ts +16 -6
  529. package/.next/standalone/src/app/api/network/panes/[id]/route.ts +27 -11
  530. package/.next/standalone/src/app/api/network/panes/route.ts +25 -14
  531. package/.next/standalone/src/app/api/network/projects/route.ts +11 -4
  532. package/.next/standalone/src/app/api/network/search/route.ts +21 -14
  533. package/.next/standalone/src/app/api/network/sessions/[id]/messages/route.ts +18 -11
  534. package/.next/standalone/src/app/api/network/sessions/[id]/route.ts +16 -9
  535. package/.next/standalone/src/app/api/network/sessions/route.ts +25 -18
  536. package/.next/standalone/src/app/api/network/workspaces/[id]/route.ts +21 -12
  537. package/.next/standalone/src/app/api/network/workspaces/route.ts +16 -14
  538. package/.next/standalone/src/app/api/whisper/config/route.ts +16 -8
  539. package/.next/standalone/src/app/api/wizard/chart/route.ts +129 -0
  540. package/.next/standalone/src/app/api/workspaces/[id]/todos/[todoId]/route.ts +55 -0
  541. package/.next/standalone/src/app/api/workspaces/[id]/todos/route.ts +43 -0
  542. package/.next/standalone/src/components/claude/claude-usage-strip.tsx +175 -0
  543. package/.next/standalone/src/components/cortex/benchmark-tab.tsx +14 -0
  544. package/.next/standalone/src/components/terminal/terminal-pane.tsx +78 -12
  545. package/.next/standalone/src/components/wizard/chart-wizard.tsx +405 -0
  546. package/.next/standalone/src/components/workspace/workspace-todos.tsx +265 -0
  547. package/.next/standalone/src/hooks/use-benchmark.ts +1 -0
  548. package/.next/standalone/src/hooks/use-claude-usage.ts +66 -0
  549. package/.next/standalone/src/hooks/use-speech-recognition.ts +2 -1
  550. package/.next/standalone/src/lib/claude/credentials.ts +36 -0
  551. package/.next/standalone/src/lib/claude/usage.ts +69 -0
  552. package/.next/standalone/src/lib/config.ts +3 -0
  553. package/.next/standalone/src/lib/cortex/benchmark.ts +17 -1
  554. package/.next/standalone/src/lib/cortex/index.ts +54 -1
  555. package/.next/standalone/src/lib/db/queries.ts +105 -90
  556. package/.next/standalone/src/lib/db/schema.ts +18 -0
  557. package/.next/standalone/src/lib/shell-user.ts +101 -0
  558. package/.next/standalone/src/types/claude.ts +39 -0
  559. package/.next/standalone/tests/db/workspace-todos.test.ts +156 -0
  560. package/bin/spaces.js +7 -4
  561. package/bin/terminal-server.js +48 -10
  562. package/package.json +1 -1
  563. package/.next/standalone/.next/server/chunks/[root-of-the-server]__00fdfbda._.js +0 -114
  564. package/.next/standalone/.next/server/chunks/[root-of-the-server]__04f04898._.js +0 -106
  565. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0903a426._.js +0 -98
  566. package/.next/standalone/.next/server/chunks/[root-of-the-server]__09e8ccc9._.js +0 -98
  567. package/.next/standalone/.next/server/chunks/[root-of-the-server]__11c684b1._.js +0 -98
  568. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1572d4ef._.js +0 -98
  569. package/.next/standalone/.next/server/chunks/[root-of-the-server]__186cd0bb._.js +0 -3
  570. package/.next/standalone/.next/server/chunks/[root-of-the-server]__194955d4._.js +0 -98
  571. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1f054c65._.js +0 -98
  572. package/.next/standalone/.next/server/chunks/[root-of-the-server]__212760e6._.js +0 -98
  573. package/.next/standalone/.next/server/chunks/[root-of-the-server]__228595ec._.js +0 -98
  574. package/.next/standalone/.next/server/chunks/[root-of-the-server]__2384f98e._.js +0 -98
  575. package/.next/standalone/.next/server/chunks/[root-of-the-server]__277d9445._.js +0 -98
  576. package/.next/standalone/.next/server/chunks/[root-of-the-server]__283c890f._.js +0 -3
  577. package/.next/standalone/.next/server/chunks/[root-of-the-server]__2a2c5fc5._.js +0 -98
  578. package/.next/standalone/.next/server/chunks/[root-of-the-server]__2d7a454e._.js +0 -98
  579. package/.next/standalone/.next/server/chunks/[root-of-the-server]__2f300a68._.js +0 -98
  580. package/.next/standalone/.next/server/chunks/[root-of-the-server]__2f452778._.js +0 -98
  581. package/.next/standalone/.next/server/chunks/[root-of-the-server]__35f8e77e._.js +0 -98
  582. package/.next/standalone/.next/server/chunks/[root-of-the-server]__379fc2e9._.js +0 -98
  583. package/.next/standalone/.next/server/chunks/[root-of-the-server]__3b40d79f._.js +0 -98
  584. package/.next/standalone/.next/server/chunks/[root-of-the-server]__3d3dca2b._.js +0 -98
  585. package/.next/standalone/.next/server/chunks/[root-of-the-server]__49e42a3a._.js +0 -98
  586. package/.next/standalone/.next/server/chunks/[root-of-the-server]__4d5b78d2._.js +0 -98
  587. package/.next/standalone/.next/server/chunks/[root-of-the-server]__4d903941._.js +0 -98
  588. package/.next/standalone/.next/server/chunks/[root-of-the-server]__54163e52._.js +0 -98
  589. package/.next/standalone/.next/server/chunks/[root-of-the-server]__563c0817._.js +0 -3
  590. package/.next/standalone/.next/server/chunks/[root-of-the-server]__5812f90a._.js +0 -98
  591. package/.next/standalone/.next/server/chunks/[root-of-the-server]__5c5e87f5._.js +0 -98
  592. package/.next/standalone/.next/server/chunks/[root-of-the-server]__60d15b16._.js +0 -98
  593. package/.next/standalone/.next/server/chunks/[root-of-the-server]__614458b7._.js +0 -98
  594. package/.next/standalone/.next/server/chunks/[root-of-the-server]__69d315e5._.js +0 -3
  595. package/.next/standalone/.next/server/chunks/[root-of-the-server]__6fe5e6c8._.js +0 -98
  596. package/.next/standalone/.next/server/chunks/[root-of-the-server]__71f29038._.js +0 -98
  597. package/.next/standalone/.next/server/chunks/[root-of-the-server]__74084e07._.js +0 -3
  598. package/.next/standalone/.next/server/chunks/[root-of-the-server]__7921aa80._.js +0 -98
  599. package/.next/standalone/.next/server/chunks/[root-of-the-server]__7e077dd8._.js +0 -98
  600. package/.next/standalone/.next/server/chunks/[root-of-the-server]__857c60bb._.js +0 -98
  601. package/.next/standalone/.next/server/chunks/[root-of-the-server]__874fe565._.js +0 -98
  602. package/.next/standalone/.next/server/chunks/[root-of-the-server]__8e2171f7._.js +0 -98
  603. package/.next/standalone/.next/server/chunks/[root-of-the-server]__91e23c96._.js +0 -98
  604. package/.next/standalone/.next/server/chunks/[root-of-the-server]__929ea03a._.js +0 -98
  605. package/.next/standalone/.next/server/chunks/[root-of-the-server]__95659b2d._.js +0 -98
  606. package/.next/standalone/.next/server/chunks/[root-of-the-server]__9679b91e._.js +0 -98
  607. package/.next/standalone/.next/server/chunks/[root-of-the-server]__9d68157b._.js +0 -98
  608. package/.next/standalone/.next/server/chunks/[root-of-the-server]__a90729a1._.js +0 -98
  609. package/.next/standalone/.next/server/chunks/[root-of-the-server]__ac39ecc7._.js +0 -98
  610. package/.next/standalone/.next/server/chunks/[root-of-the-server]__ac84b704._.js +0 -98
  611. package/.next/standalone/.next/server/chunks/[root-of-the-server]__ad4346fa._.js +0 -98
  612. package/.next/standalone/.next/server/chunks/[root-of-the-server]__b0862d69._.js +0 -98
  613. package/.next/standalone/.next/server/chunks/[root-of-the-server]__b43306ee._.js +0 -98
  614. package/.next/standalone/.next/server/chunks/[root-of-the-server]__b689ff5e._.js +0 -106
  615. package/.next/standalone/.next/server/chunks/[root-of-the-server]__ba87daaa._.js +0 -98
  616. package/.next/standalone/.next/server/chunks/[root-of-the-server]__c0461005._.js +0 -98
  617. package/.next/standalone/.next/server/chunks/[root-of-the-server]__c1deb5f3._.js +0 -98
  618. package/.next/standalone/.next/server/chunks/[root-of-the-server]__c8a62f42._.js +0 -98
  619. package/.next/standalone/.next/server/chunks/[root-of-the-server]__cb027619._.js +0 -98
  620. package/.next/standalone/.next/server/chunks/[root-of-the-server]__cc6e2885._.js +0 -98
  621. package/.next/standalone/.next/server/chunks/[root-of-the-server]__cf608218._.js +0 -98
  622. package/.next/standalone/.next/server/chunks/[root-of-the-server]__cfc1290d._.js +0 -98
  623. package/.next/standalone/.next/server/chunks/[root-of-the-server]__d0109b9b._.js +0 -98
  624. package/.next/standalone/.next/server/chunks/[root-of-the-server]__d0125483._.js +0 -3
  625. package/.next/standalone/.next/server/chunks/[root-of-the-server]__d048ee6b._.js +0 -98
  626. package/.next/standalone/.next/server/chunks/[root-of-the-server]__d12644e7._.js +0 -98
  627. package/.next/standalone/.next/server/chunks/[root-of-the-server]__d95165f0._.js +0 -98
  628. package/.next/standalone/.next/server/chunks/[root-of-the-server]__e3cc946c._.js +0 -98
  629. package/.next/standalone/.next/server/chunks/[root-of-the-server]__e6fd27f8._.js +0 -98
  630. package/.next/standalone/.next/server/chunks/[root-of-the-server]__eafd040b._.js +0 -98
  631. package/.next/standalone/.next/server/chunks/[root-of-the-server]__f44c6882._.js +0 -98
  632. package/.next/standalone/.next/server/chunks/[root-of-the-server]__f85283de._.js +0 -98
  633. package/.next/standalone/.next/server/chunks/[root-of-the-server]__feceb3e4._.js +0 -98
  634. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__843070a6._.js +0 -3
  635. package/.next/standalone/.next/server/chunks/ssr/_3ba93bdd._.js +0 -3
  636. package/.next/standalone/.next/server/chunks/ssr/_e84a0c06._.js +0 -3
  637. package/.next/standalone/.next/static/chunks/074df89a63b6a854.js +0 -1
  638. package/.next/standalone/.next/static/chunks/9d4164833c2c1fd6.js +0 -85
  639. package/.next/standalone/.next/static/chunks/bffaf378f7745d59.css +0 -3
  640. package/.next/standalone/.next/static/chunks/f091f4bf8d80fd07.js +0 -1
  641. /package/.next/standalone/.next/static/{0KefPNmR9NsrZHWWt9Xr7 → bAQs2gDlFrq3e8w9ni9tr}/_buildManifest.js +0 -0
  642. /package/.next/standalone/.next/static/{0KefPNmR9NsrZHWWt9Xr7 → bAQs2gDlFrq3e8w9ni9tr}/_clientMiddlewareManifest.json +0 -0
  643. /package/.next/standalone/.next/static/{0KefPNmR9NsrZHWWt9Xr7 → bAQs2gDlFrq3e8w9ni9tr}/_ssgManifest.js +0 -0
@@ -1,3 +1,3 @@
1
- module.exports=[417835,a=>{"use strict";var b=a.i(187924),c=a.i(572131),d=a.i(819721),e=a.i(119032),f=a.i(587532),g=a.i(405784),h=a.i(767552),i=a.i(781560),j=a.i(73570);let k={decision:"bg-blue-500/20 text-blue-400",preference:"bg-pink-500/20 text-pink-400",pattern:"bg-green-500/20 text-green-400",error_fix:"bg-amber-500/20 text-amber-400",context:"bg-gray-500/20 text-gray-400",code_pattern:"bg-cyan-500/20 text-cyan-400",command:"bg-orange-500/20 text-orange-400",conversation:"bg-slate-500/20 text-slate-400",summary:"bg-violet-500/20 text-violet-400"},l={public:"bg-green-500/20 text-green-400",internal:"bg-indigo-500/20 text-indigo-400",restricted:"bg-amber-500/20 text-amber-400",confidential:"bg-red-500/20 text-red-400"},m={debugging:"text-red-400",architecture:"text-blue-400",onboarding:"text-green-400",policy:"text-purple-400","how-to":"text-amber-400",review:"text-pink-400",security:"text-red-500",general:"text-gray-400"};function n({unit:a,onDelete:c,compact:d}){var f;let g,h=k[a.type]||k.context,m=(f=a.created,0===(g=Math.floor((Date.now()-new Date(f).getTime())/864e5))?"today":1===g?"1d ago":g<30?`${g}d ago`:g<365?`${Math.floor(g/30)}mo ago`:`${Math.floor(g/365)}y ago`),n=(a.contradiction_refs?.length??0)>0,o=a.evidence_score??a.confidence,p=null!=a.evidence_score?`${o.toFixed(2)} evidence`:`${Math.round(100*o)}%`,q=async()=>{await fetch((0,e.api)(`/api/cortex/knowledge/${a.id}`),{method:"DELETE"}),c?.(a.id)};return(0,b.jsxs)("div",{className:"group border border-white/5 rounded-lg p-3 hover:border-white/10 transition-colors",children:[(0,b.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,b.jsxs)("div",{className:"flex items-center gap-1 flex-wrap",children:[(0,b.jsx)("span",{className:`text-[10px] px-1.5 py-0.5 rounded font-medium ${h}`,children:a.type.replace("_"," ")}),a.sensitivity&&(0,b.jsx)("span",{className:`text-[10px] px-1.5 py-0.5 rounded font-medium ${l[a.sensitivity]||l.internal}`,children:a.sensitivity}),a.scope&&(0,b.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded font-medium bg-purple-500/10 text-purple-400",children:a.scope.level}),(a.stale_score??0)>.3&&(0,b.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded font-medium bg-amber-500/20 text-amber-400",children:"stale"}),n&&(0,b.jsxs)("span",{className:"text-[10px] px-1.5 py-0.5 rounded font-medium bg-amber-500/20 text-amber-400 flex items-center gap-0.5",children:[(0,b.jsx)(j.AlertTriangle,{className:"w-2.5 h-2.5"})," contested"]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2 text-[10px] text-gray-500 shrink-0",children:[(0,b.jsx)("span",{children:m}),c&&(0,b.jsx)("button",{onClick:q,className:"opacity-0 group-hover:opacity-100 transition-opacity text-red-400 hover:text-red-300",children:(0,b.jsx)(i.Trash2,{className:"w-3 h-3"})})]})]}),(0,b.jsx)("p",{className:"text-xs text-gray-300 mt-1.5 leading-relaxed line-clamp-3",children:a.text}),!d&&a.origin&&(0,b.jsxs)("div",{className:"flex items-center gap-1.5 mt-1.5 text-[10px] text-gray-500 flex-wrap",children:[(0,b.jsxs)("span",{children:["by ",a.origin.creator_entity_id.replace("person-","")]}),(0,b.jsx)("span",{children:"·"}),(0,b.jsxs)("span",{children:["via ",a.origin.source_type.replace("_"," ")]}),(a.corroborations??0)>0&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("span",{children:"·"}),(0,b.jsxs)("span",{className:"text-green-400",children:[a.corroborations," corr."]})]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2 mt-2",children:[(0,b.jsx)("div",{className:"flex-1 h-1 bg-white/5 rounded-full overflow-hidden",children:(0,b.jsx)("div",{className:"h-full bg-purple-500/50 rounded-full",style:{width:`${Math.round(100*o)}%`}})}),(0,b.jsx)("span",{className:"text-[10px] text-gray-500 tabular-nums",children:p})]})]})}function o(){let[a,d]=(0,c.useState)(""),[i,j]=(0,c.useState)([]),[l,o]=(0,c.useState)(!1),[p,q]=(0,c.useState)(!1),[r,s]=(0,c.useState)(""),[t,u]=(0,c.useState)(null),[v,w]=(0,c.useState)(!1),x=async()=>{if(r.trim()){w(!0);try{let a=await fetch((0,e.api)(`/api/cortex/context?q=${encodeURIComponent(r)}&limit=5`));a.ok&&u(await a.json())}catch{}w(!1)}},y=(0,c.useCallback)(async a=>{o(!0);try{let b=new URLSearchParams({limit:"30"});a&&b.set("q",a);let c=await fetch((0,e.api)(`/api/cortex/search?${b}`));c.ok&&j((await c.json()).results||[])}catch{}o(!1)},[]);(0,c.useEffect)(()=>{y()},[y]);let z=a=>j(b=>b.filter(b=>b.id!==a));return(0,b.jsxs)("div",{className:"flex flex-col h-full",children:[(0,b.jsx)("div",{className:"p-4 border-b border-white/5",children:(0,b.jsxs)("div",{className:"relative max-w-md",children:[(0,b.jsx)(f.Search,{className:"absolute left-3 top-2.5 w-4 h-4 text-gray-500"}),(0,b.jsx)("input",{value:a,onChange:a=>d(a.target.value),onKeyDown:b=>"Enter"===b.key&&y(a.trim()||void 0),placeholder:"Search knowledge...",className:"w-full pl-9 pr-4 py-2 text-sm bg-white/5 border border-white/10 rounded-lg text-gray-300 placeholder-gray-600 focus:outline-none focus:border-purple-500/50"})]})}),(0,b.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:(0,b.jsxs)("div",{className:"max-w-2xl space-y-2",children:[l&&(0,b.jsx)("p",{className:"text-sm text-gray-500 text-center py-8",children:"Loading..."}),!l&&0===i.length&&(0,b.jsx)("p",{className:"text-sm text-gray-500 text-center py-8",children:"No knowledge found"}),i.map(a=>(0,b.jsx)(n,{unit:a,onDelete:z},a.id)),(0,b.jsxs)("div",{className:"border-t border-white/5 mt-4 pt-4",children:[(0,b.jsxs)("button",{onClick:()=>q(!p),className:"flex items-center gap-2 text-xs text-gray-500 hover:text-gray-300 mb-3",children:[p?(0,b.jsx)(h.ChevronUp,{className:"w-3 h-3"}):(0,b.jsx)(g.ChevronDown,{className:"w-3 h-3"}),"Query Analyzer"]}),p&&(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"flex gap-3 mb-4",children:[(0,b.jsxs)("div",{className:"flex-1 relative",children:[(0,b.jsx)(f.Search,{className:"absolute left-3 top-2.5 w-4 h-4 text-gray-500"}),(0,b.jsx)("input",{value:r,onChange:a=>s(a.target.value),onKeyDown:a=>"Enter"===a.key&&x(),placeholder:"Enter a query to analyze...",className:"w-full pl-9 pr-4 py-2 text-sm bg-white/5 border border-white/10 rounded-lg text-gray-300 placeholder-gray-600 focus:outline-none focus:border-purple-500/50"})]}),(0,b.jsx)("button",{onClick:x,disabled:v,className:"px-5 py-2 text-sm bg-purple-600 hover:bg-purple-500 text-white rounded-lg disabled:opacity-50",children:v?"Analyzing...":"Analyze"})]}),!t&&!v&&(0,b.jsx)("p",{className:"text-sm text-gray-600 text-center py-8",children:"Enter a query to see how the Context Engine processes it"}),t&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("div",{className:"grid grid-cols-3 gap-3 mb-4",children:[(0,b.jsxs)("div",{className:"bg-white/[0.02] border border-white/5 rounded-lg p-3",children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-600 uppercase mb-1",children:"Intent"}),(0,b.jsx)("div",{className:`text-lg font-semibold ${m[t.intent?.intent]||"text-gray-400"}`,children:t.intent?.intent||"?"}),(0,b.jsxs)("div",{className:"text-[10px] text-gray-600",children:["confidence: ",(t.intent?.confidence??0).toFixed(2)]})]}),(0,b.jsxs)("div",{className:"bg-white/[0.02] border border-white/5 rounded-lg p-3",children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-600 uppercase mb-1",children:"Entities"}),(0,b.jsxs)("div",{className:"flex flex-wrap gap-1 mt-1",children:[(t.entities||[]).map((a,c)=>(0,b.jsxs)("span",{className:"text-[10px] px-1.5 py-0.5 bg-white/5 border border-white/10 rounded text-gray-300",children:[a.entity?.type,":",a.entity?.name]},c)),(!t.entities||0===t.entities.length)&&(0,b.jsx)("span",{className:"text-[10px] text-gray-600",children:"none detected"})]})]}),(0,b.jsxs)("div",{className:"bg-white/[0.02] border border-white/5 rounded-lg p-3",children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-600 uppercase mb-1",children:"Timing"}),(0,b.jsxs)("div",{className:"text-lg font-semibold text-green-400",children:[t.timing?.totalMs??"?","ms"]}),(0,b.jsxs)("div",{className:"text-[10px] text-gray-600",children:["intent ",t.timing?.intentMs,"ms · search ",t.timing?.searchMs,"ms"]})]})]}),(0,b.jsxs)("div",{className:"mb-4",children:[(0,b.jsxs)("div",{className:"text-[10px] text-gray-600 uppercase mb-2",children:["Results (",(t.results||[]).length,")"]}),(0,b.jsx)("div",{className:"space-y-1",children:(t.results||[]).map((a,c)=>(0,b.jsxs)("div",{className:"flex items-center gap-2 bg-white/[0.02] border border-white/5 rounded-lg px-3 py-2",children:[(0,b.jsx)("span",{className:`text-[10px] px-1.5 py-0.5 rounded font-medium ${k[a.type]||k.context}`,children:a.type?.replace("_"," ")}),(0,b.jsx)("span",{className:"text-xs text-gray-300 truncate flex-1",children:a.text}),(0,b.jsx)("span",{className:"text-[10px] text-gray-600 tabular-nums shrink-0",children:(a.relevance_score??0).toFixed(3)})]},c))})]})]})]})]})]})})]})}var p=a.i(565870);function q(a){return a<1024?`${a} B`:a<1048576?`${(a/1024).toFixed(1)} KB`:a<0x40000000?`${(a/1048576).toFixed(1)} MB`:`${(a/0x40000000).toFixed(2)} GB`}function r({items:a,maxValue:c}){return(0,b.jsx)("div",{className:"space-y-1.5",children:a.map(a=>(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:"text-[10px] text-gray-500 w-24 text-right truncate",title:a.label,children:a.label}),(0,b.jsx)("div",{className:"flex-1 h-3 bg-white/[0.03] rounded-full overflow-hidden",children:(0,b.jsx)("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${Math.max(2,a.value/Math.max(c,1)*100)}%`,backgroundColor:a.color}})}),(0,b.jsx)("span",{className:"text-[10px] text-gray-400 w-14 text-right tabular-nums",children:a.value.toLocaleString()})]},a.label))})}function s({label:a,value:c,sub:d,color:e}){return(0,b.jsxs)("div",{className:"bg-white/[0.02] border border-white/[0.06] rounded-lg p-3",children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-500 uppercase tracking-wider mb-1",children:a}),(0,b.jsx)("div",{className:`text-lg font-semibold tabular-nums ${e||"text-white"}`,children:c}),d&&(0,b.jsx)("div",{className:"text-[10px] text-gray-600 mt-0.5",children:d})]})}let t=["#7c3aed","#06b6d4","#10b981","#f59e0b","#ef4444","#8b5cf6","#14b8a6","#22c55e","#eab308","#f97316"],u={decision:"#3b82f6",pattern:"#22c55e",preference:"#ec4899",error_fix:"#f59e0b",context:"#6b7280",code_pattern:"#06b6d4",command:"#f97316",conversation:"#64748b",summary:"#8b5cf6"};function v(){let[a,d]=(0,c.useState)(null),[f,g]=(0,c.useState)(!0);if((0,c.useEffect)(()=>{fetch((0,e.api)("/api/cortex/status")).then(a=>a.json()).then(a=>{a.enabled&&d(a)}).catch(()=>{}).finally(()=>g(!1))},[]),f)return(0,b.jsx)("div",{className:"p-6 text-sm text-gray-500",children:"Loading dashboard..."});if(!a)return(0,b.jsx)("div",{className:"p-6 text-sm text-gray-500",children:"Cortex is not active."});let h=Object.entries(a.lobes).sort((a,b)=>b[1].count-a[1].count),i=Math.max(...h.map(([,a])=>a.count),1),j=Math.max(...h.map(([,a])=>a.sizeBytes),1),k=a.usage,m=k?.distillation;return(0,b.jsxs)("div",{className:"p-6 max-w-4xl space-y-6",children:[(0,b.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[(0,b.jsx)(s,{label:"Knowledge Units",value:a.totalCount.toLocaleString(),sub:`across ${h.length} lobes`,color:"text-purple-400"}),(0,b.jsx)(s,{label:"Storage",value:q(a.totalSizeBytes),sub:`${a.embedding_provider} (${a.embedding_dimensions}d)`}),(0,b.jsx)(s,{label:"Coverage",value:a.quality?a.quality.coverage_score.toFixed(2):"—",sub:a.quality?`${Math.round(100*a.quality.coverage_score)}% distilled`:"no data",color:a.quality?a.quality.coverage_score>.7?"text-green-400":a.quality.coverage_score>.3?"text-amber-400":"text-red-400":"text-gray-500"}),(0,b.jsx)(s,{label:"Distillation",value:m?`$${m.estimated_cost_usd.toFixed(2)}`:"Off",sub:m?`${m.calls.toLocaleString()} calls`:a.distillation?"No API key":"Disabled",color:m?"text-amber-400":"text-gray-500"})]}),(0,b.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[(0,b.jsxs)("div",{className:"bg-white/[0.02] border border-white/[0.06] rounded-lg p-4",children:[(0,b.jsx)("h3",{className:"text-xs font-medium text-gray-400 mb-3",children:"Knowledge by Lobe"}),(0,b.jsx)(r,{items:h.map(([a,b],c)=>({label:b.label||a,value:b.count,color:t[c%t.length]})),maxValue:i})]}),(0,b.jsxs)("div",{className:"bg-white/[0.02] border border-white/[0.06] rounded-lg p-4",children:[(0,b.jsx)("h3",{className:"text-xs font-medium text-gray-400 mb-3",children:"Storage by Lobe"}),(0,b.jsx)(r,{items:h.map(([a,b],c)=>({label:b.label||a,value:b.sizeBytes,color:t[c%t.length]})),maxValue:j}),(0,b.jsxs)("div",{className:"mt-2 flex justify-between text-[10px] text-gray-600",children:[(0,b.jsxs)("span",{children:["Smallest: ",q(Math.min(...h.map(([,a])=>a.sizeBytes)))]}),(0,b.jsxs)("span",{children:["Total: ",q(a.totalSizeBytes)]})]})]})]}),a.quality&&(0,b.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[(0,b.jsxs)("div",{className:"bg-white/[0.02] border border-white/[0.06] rounded-lg p-4",children:[(0,b.jsx)("h3",{className:"text-xs font-medium text-gray-400 mb-3",children:"Type Distribution"}),(0,b.jsx)(r,{items:Object.entries(a.quality.type_distribution).sort((a,b)=>b[1]-a[1]).map(([a,b])=>({label:a.replace("_"," "),value:b,color:u[a]||"#7c3aed"})),maxValue:Math.max(...Object.values(a.quality.type_distribution),1)})]}),(0,b.jsxs)("div",{className:"bg-white/[0.02] border border-white/[0.06] rounded-lg p-4",children:[(0,b.jsx)("h3",{className:"text-xs font-medium text-gray-400 mb-3",children:"Lobe Health"}),(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsxs)("div",{className:"flex justify-between text-[11px]",children:[(0,b.jsx)("span",{className:"text-gray-500",children:"Stale units"}),(0,b.jsx)("span",{className:a.quality.stale_count>10?"text-amber-400":"text-gray-300",children:a.quality.stale_count})]}),(0,b.jsxs)("div",{className:"flex justify-between text-[11px]",children:[(0,b.jsx)("span",{className:"text-gray-500",children:"Avg confidence"}),(0,b.jsx)("span",{className:"text-gray-300",children:a.quality.avg_confidence.toFixed(2)})]}),a.quality.top_accessed.length>0&&(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-500 mb-1",children:"Top accessed"}),(0,b.jsxs)("div",{className:"text-[11px] text-gray-400 truncate",children:["“",a.quality.top_accessed[0].text,"”"]})]}),a.quality.sensitivity_counts&&(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-500 mb-1",children:"Sensitivity"}),(0,b.jsx)("div",{className:"flex flex-wrap gap-1",children:Object.entries(a.quality.sensitivity_counts).map(([a,c])=>(0,b.jsxs)("span",{className:`text-[9px] px-1.5 py-0.5 rounded ${l[a]||l.internal}`,children:[c," ",a]},a))})]})]})]})]}),m&&(0,b.jsxs)("div",{className:"bg-white/[0.02] border border-white/[0.06] rounded-lg p-4",children:[(0,b.jsx)("h3",{className:"text-xs font-medium text-gray-400 mb-3",children:"Distillation Activity"}),(0,b.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-500",children:"API Calls"}),(0,b.jsx)("div",{className:"text-sm font-medium text-white tabular-nums",children:m.calls.toLocaleString()})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-500",children:"Input Tokens"}),(0,b.jsxs)("div",{className:"text-sm font-medium text-white tabular-nums",children:[(m.input_tokens/1e3).toFixed(1),"K"]})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-500",children:"Output Tokens"}),(0,b.jsxs)("div",{className:"text-sm font-medium text-white tabular-nums",children:[(m.output_tokens/1e3).toFixed(1),"K"]})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-500",children:"Estimated Cost"}),(0,b.jsxs)("div",{className:"text-sm font-medium text-amber-400 tabular-nums",children:["$",m.estimated_cost_usd.toFixed(4)]})]})]}),m.last_updated&&(0,b.jsxs)("div",{className:"mt-2 text-[10px] text-gray-600",children:["Last distillation: ",new Date(m.last_updated).toLocaleString()]}),k.by_model&&Object.keys(k.by_model).length>0&&(0,b.jsxs)("div",{className:"mt-3 border-t border-white/[0.04] pt-3",children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-500 mb-2",children:"By Model"}),Object.entries(k.by_model).map(([a,c])=>(0,b.jsxs)("div",{className:"flex items-center justify-between text-[10px]",children:[(0,b.jsx)("span",{className:"text-gray-400 font-mono",children:a}),(0,b.jsxs)("span",{className:"text-gray-500",children:[c.calls," calls · $",c.estimated_cost_usd.toFixed(4)]})]},a))]})]}),(0,b.jsxs)("div",{className:"bg-white/[0.02] border border-white/[0.06] rounded-lg p-4",children:[(0,b.jsx)("h3",{className:"text-xs font-medium text-gray-400 mb-3",children:"System"}),(0,b.jsxs)("div",{className:"grid grid-cols-2 gap-x-8 gap-y-1.5 text-[11px]",children:[(0,b.jsxs)("div",{className:"flex justify-between",children:[(0,b.jsx)("span",{className:"text-gray-500",children:"Status"}),(0,b.jsx)("span",{className:"text-green-400",children:a.status})]}),(0,b.jsxs)("div",{className:"flex justify-between",children:[(0,b.jsx)("span",{className:"text-gray-500",children:"Embedding"}),(0,b.jsxs)("span",{className:"text-gray-300",children:[a.embedding_provider," (",a.embedding_dimensions,"d)"]})]}),(0,b.jsxs)("div",{className:"flex justify-between",children:[(0,b.jsx)("span",{className:"text-gray-500",children:"Distillation"}),(0,b.jsx)("span",{className:a.distillation?"text-green-400":"text-gray-600",children:a.distillation?"Enabled":"Disabled"})]}),(0,b.jsxs)("div",{className:"flex justify-between",children:[(0,b.jsx)("span",{className:"text-gray-500",children:"Lobes"}),(0,b.jsxs)("span",{className:"text-gray-300",children:[h.length," active"]})]})]})]})]})}var w=a.i(773320),x=a.i(839761),y=a.i(669520),z=a.i(883706);let A=(0,z.default)("package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);var B=a.i(596221);let C=[{id:"seed",label:"Seed",icon:(0,b.jsx)(w.Upload,{className:"w-3.5 h-3.5"})},{id:"assess",label:"Assess",icon:(0,b.jsx)(x.BarChart3,{className:"w-3.5 h-3.5"})},{id:"review",label:"Review",icon:(0,b.jsx)(f.Search,{className:"w-3.5 h-3.5"})},{id:"refine",label:"Refine",icon:(0,b.jsx)(y.RefreshCw,{className:"w-3.5 h-3.5"})},{id:"publish",label:"Publish",icon:(0,b.jsx)(A,{className:"w-3.5 h-3.5"})}],D={decision:"#3b82f6",pattern:"#22c55e",preference:"#ec4899",error_fix:"#f59e0b",context:"#6b7280",code_pattern:"#06b6d4",command:"#f97316",conversation:"#64748b",summary:"#8b5cf6"};function E(){let a,[d,g]=(0,c.useState)([]),[h,i]=(0,c.useState)(""),[j,l]=(0,c.useState)("seed"),[m,n]=(0,c.useState)(""),[o,p]=(0,c.useState)(""),[q,r]=(0,c.useState)("auto"),[s,t]=(0,c.useState)(""),[u,v]=(0,c.useState)(!0),[z,E]=(0,c.useState)(!1),[F,G]=(0,c.useState)(null),[H,I]=(0,c.useState)(!1),[J,K]=(0,c.useState)(null),[L,M]=(0,c.useState)(""),[N,O]=(0,c.useState)("25"),[P,Q]=(0,c.useState)(!1),[R,S]=(0,c.useState)(null),[T,U]=(0,c.useState)(""),[V,W]=(0,c.useState)({decisions:!0,patterns:!0,preferences:!0,error_fixes:!0}),[X,Y]=(0,c.useState)(!1),[Z,$]=(0,c.useState)(null),[_,aa]=(0,c.useState)(""),[ab,ac]=(0,c.useState)(""),[ad,ae]=(0,c.useState)(""),[af,ag]=(0,c.useState)(""),[ah,ai]=(0,c.useState)("1.0.0"),[aj,ak]=(0,c.useState)("MIT"),[al,am]=(0,c.useState)(!1),[an,ao]=(0,c.useState)(null),ap=(0,c.useCallback)(()=>{G(null),K(null),S(null),$(null),ao(null),n("")},[]);(0,c.useEffect)(()=>{fetch((0,e.api)("/api/workspaces")).then(a=>a.json()).then(a=>{g(a),a.length>0&&i(a[0].id)}).catch(()=>{})},[]);let aq=async()=>{if(o.trim()&&h){E(!0),n(""),G(null);try{let a=await fetch((0,e.api)("/api/cortex/curation/seed"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:o,format:q,source_ref:s||void 0,workspace_id:h,distill:u})}),b=await a.json();if(!a.ok)throw Error(b.error||b.message||"Seed failed");G(b)}catch(a){n(a instanceof Error?a.message:"Seed failed")}finally{E(!1)}}},ar=async()=>{if(h){I(!0),n(""),K(null);try{let a=await fetch((0,e.api)(`/api/cortex/curation/assess?workspace_id=${encodeURIComponent(h)}`)),b=await a.json();if(!a.ok)throw Error(b.error||b.message||"Assessment failed");K(b)}catch(a){n(a instanceof Error?a.message:"Assessment failed")}finally{I(!1)}}},as=async()=>{if(h&&L.trim()){Q(!0),n(""),S(null);try{let a=new URLSearchParams({workspace_id:h,topic:L.trim(),limit:N}),b=await fetch((0,e.api)(`/api/cortex/curation/review?${a}`)),c=await b.json();if(!b.ok)throw Error(c.error||c.message||"Review failed");S(c)}catch(a){n(a instanceof Error?a.message:"Review failed")}finally{Q(!1)}}},at=async()=>{if(h){Y(!0),n(""),$(null);try{let a=Object.keys(V).filter(a=>V[a]),b=await fetch((0,e.api)("/api/cortex/curation/refine"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace_id:h,domain_context:T||void 0,types:a})}),c=await b.json();if(!b.ok)throw Error(c.error||c.message||"Refine failed");$(c)}catch(a){n(a instanceof Error?a.message:"Refine failed")}finally{Y(!1)}}},au=async()=>{if(h&&_.trim()){am(!0),n(""),ao(null);try{let a=await fetch((0,e.api)("/api/cortex/curation/publish"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace_id:h,name:_,author:ab||void 0,description:ad||void 0,tags:af?af.split(",").map(a=>a.trim()).filter(Boolean):[],version:ah,license:aj})}),b=await a.json();if(!a.ok)throw Error(b.error||b.message||"Publish failed");ao(b)}catch(a){n(a instanceof Error?a.message:"Publish failed")}finally{am(!1)}}},av="w-full px-3 py-2 text-sm bg-white/5 border border-white/10 rounded-lg text-gray-300 placeholder-gray-600 focus:outline-none focus:border-purple-500/50",aw="text-[11px] text-gray-500 mb-1 block",ax="bg-white/[0.02] border border-white/[0.06] rounded-lg p-4";return(0,b.jsxs)("div",{className:"flex flex-col h-full",children:[(0,b.jsxs)("div",{className:"px-4 pt-4 pb-3 border-b border-white/5",children:[(0,b.jsx)("label",{className:aw,children:"Workspace"}),(0,b.jsxs)("select",{value:h,onChange:a=>{i(a.target.value),ap()},className:`${av} max-w-xs`,children:[0===d.length&&(0,b.jsx)("option",{value:"",disabled:!0,children:"No workspaces found"}),d.map(a=>(0,b.jsx)("option",{value:a.id,children:a.name},a.id))]})]}),(0,b.jsx)("div",{className:"px-4 py-3 border-b border-white/5",children:(0,b.jsx)("div",{className:"flex items-center",children:C.map((a,c)=>(0,b.jsxs)("div",{className:"flex items-center",children:[(0,b.jsxs)("button",{onClick:()=>{l(a.id),ap()},className:`flex items-center gap-1.5 px-3 py-1.5 rounded-full text-xs font-medium border transition-colors ${j===a.id?"bg-purple-500/20 border-purple-500/30 text-purple-400":"bg-white/[0.03] border-white/[0.06] text-gray-500 hover:text-gray-300 hover:bg-white/[0.06]"}`,children:[a.icon,a.label]}),c<C.length-1&&(0,b.jsx)("div",{className:"w-8 h-px bg-white/[0.06]"})]},a.id))})}),(0,b.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:(0,b.jsxs)("div",{className:"max-w-2xl space-y-4",children:[m&&(0,b.jsx)("div",{className:"bg-red-500/10 border border-red-500/20 text-red-400 rounded-lg px-4 py-2.5 text-sm",children:m}),"seed"===j&&(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:aw,children:"Document content"}),(0,b.jsx)("textarea",{value:o,onChange:a=>p(a.target.value),placeholder:"Paste document content here...",rows:8,className:av})]}),(0,b.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:aw,children:"Format"}),(0,b.jsxs)("select",{value:q,onChange:a=>r(a.target.value),className:av,children:[(0,b.jsx)("option",{value:"auto",children:"Auto-detect"}),(0,b.jsx)("option",{value:"markdown",children:"Markdown"}),(0,b.jsx)("option",{value:"plaintext",children:"Plain text"}),(0,b.jsx)("option",{value:"csv",children:"CSV"})]})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:aw,children:"Source reference"}),(0,b.jsx)("input",{value:s,onChange:a=>t(a.target.value),placeholder:"e.g. docs/guide.md",className:av})]})]}),(0,b.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[(0,b.jsx)("input",{type:"checkbox",checked:u,onChange:a=>v(a.target.checked),className:"rounded border-white/20 bg-white/5 accent-purple-500"}),(0,b.jsx)("span",{className:"text-xs text-gray-400",children:"Distill after seeding"})]}),(0,b.jsxs)("button",{onClick:aq,disabled:z||!o.trim()||!h,className:"flex items-center gap-2 px-4 py-2 text-sm bg-purple-600 hover:bg-purple-500 text-white rounded-lg disabled:opacity-50 transition-colors",children:[z?(0,b.jsx)(B.Loader2,{className:"w-4 h-4 animate-spin"}):(0,b.jsx)(w.Upload,{className:"w-4 h-4"}),"Seed Documents"]}),F&&(0,b.jsxs)("div",{className:ax,children:[(0,b.jsx)("div",{className:"text-xs font-medium text-gray-400 mb-3",children:"Seed Results"}),(0,b.jsxs)("div",{className:"grid grid-cols-3 gap-3",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-500 uppercase mb-0.5",children:"Chunks Created"}),(0,b.jsx)("div",{className:"text-lg font-semibold text-green-400 tabular-nums",children:F.chunksCreated})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-500 uppercase mb-0.5",children:"Chunks Skipped"}),(0,b.jsx)("div",{className:"text-lg font-semibold text-amber-400 tabular-nums",children:F.chunksSkipped})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-500 uppercase mb-0.5",children:"Errors"}),(0,b.jsx)("div",{className:`text-lg font-semibold tabular-nums ${F.errors.length>0?"text-red-400":"text-gray-500"}`,children:F.errors.length})]})]}),F.errors.length>0&&(0,b.jsx)("div",{className:"mt-3 space-y-1",children:F.errors.map((a,c)=>(0,b.jsx)("div",{className:"text-xs text-red-400/80",children:a},c))})]})]}),"assess"===j&&(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsxs)("button",{onClick:ar,disabled:H||!h,className:"flex items-center gap-2 px-4 py-2 text-sm bg-purple-600 hover:bg-purple-500 text-white rounded-lg disabled:opacity-50 transition-colors",children:[H?(0,b.jsx)(B.Loader2,{className:"w-4 h-4 animate-spin"}):(0,b.jsx)(x.BarChart3,{className:"w-4 h-4"}),"Run Assessment"]}),J&&(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsxs)("div",{className:"grid grid-cols-3 gap-3",children:[(0,b.jsxs)("div",{className:ax,children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-500 uppercase mb-1",children:"Coverage Score"}),(0,b.jsx)("div",{className:`text-2xl font-semibold tabular-nums ${(a=J.coverage_score)>.7?"text-green-400":a>.3?"text-amber-400":"text-red-400"}`,children:J.coverage_score.toFixed(2)}),(0,b.jsxs)("div",{className:"text-[10px] text-gray-600 mt-0.5",children:[Math.round(100*J.coverage_score),"% covered"]})]}),(0,b.jsxs)("div",{className:ax,children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-500 uppercase mb-1",children:"Total Units"}),(0,b.jsx)("div",{className:"text-2xl font-semibold text-white tabular-nums",children:J.total_units.toLocaleString()})]}),(0,b.jsxs)("div",{className:ax,children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-500 uppercase mb-1",children:"Stale Count"}),(0,b.jsx)("div",{className:`text-2xl font-semibold tabular-nums ${J.stale_count>10?"text-amber-400":"text-gray-300"}`,children:J.stale_count})]})]}),J.type_distribution&&Object.keys(J.type_distribution).length>0&&(0,b.jsxs)("div",{className:ax,children:[(0,b.jsx)("div",{className:"text-xs font-medium text-gray-400 mb-3",children:"Type Distribution"}),(0,b.jsx)("div",{className:"space-y-1.5",children:Object.entries(J.type_distribution).sort((a,b)=>b[1]-a[1]).map(([a,c])=>{let d=Math.max(...Object.values(J.type_distribution),1);return(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:"text-[10px] text-gray-500 w-24 text-right truncate",children:a.replace("_"," ")}),(0,b.jsx)("div",{className:"flex-1 h-3 bg-white/[0.03] rounded-full overflow-hidden",children:(0,b.jsx)("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${Math.max(2,c/d*100)}%`,backgroundColor:D[a]||"#7c3aed"}})}),(0,b.jsx)("span",{className:"text-[10px] text-gray-400 w-10 text-right tabular-nums",children:c})]},a)})})]})]})]}),"review"===j&&(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsxs)("div",{className:"flex gap-3",children:[(0,b.jsxs)("div",{className:"flex-1",children:[(0,b.jsx)("label",{className:aw,children:"Topic filter"}),(0,b.jsx)("input",{value:L,onChange:a=>M(a.target.value),onKeyDown:a=>"Enter"===a.key&&as(),placeholder:"Filter by topic (optional)",className:av})]}),(0,b.jsxs)("div",{className:"w-28",children:[(0,b.jsx)("label",{className:aw,children:"Limit"}),(0,b.jsxs)("select",{value:N,onChange:a=>O(a.target.value),className:av,children:[(0,b.jsx)("option",{value:"10",children:"10"}),(0,b.jsx)("option",{value:"25",children:"25"}),(0,b.jsx)("option",{value:"50",children:"50"})]})]})]}),(0,b.jsxs)("button",{onClick:as,disabled:P||!h||!L.trim(),className:"flex items-center gap-2 px-4 py-2 text-sm bg-purple-600 hover:bg-purple-500 text-white rounded-lg disabled:opacity-50 transition-colors",children:[P?(0,b.jsx)(B.Loader2,{className:"w-4 h-4 animate-spin"}):(0,b.jsx)(f.Search,{className:"w-4 h-4"}),"Review"]}),R&&(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsxs)("div",{className:"text-[11px] text-gray-500",children:[R.total_matches," match",1!==R.total_matches?"es":""," for “",R.topic,"”"]}),Object.entries(R.by_type).map(([a,c])=>(0,b.jsxs)("details",{open:!0,className:ax,children:[(0,b.jsxs)("summary",{className:"flex items-center gap-2 cursor-pointer list-none",children:[(0,b.jsx)("span",{className:`text-[10px] px-1.5 py-0.5 rounded font-medium ${k[a]||k.context}`,children:a.replace("_"," ")}),(0,b.jsxs)("span",{className:"text-xs text-gray-500",children:[c.length," unit",1!==c.length?"s":""]})]}),(0,b.jsx)("div",{className:"mt-3 space-y-2",children:c.map((a,c)=>(0,b.jsxs)("div",{className:"bg-white/[0.02] border border-white/[0.04] rounded px-3 py-2",children:[(0,b.jsx)("div",{className:"text-xs text-gray-300 leading-relaxed",children:a.text}),(0,b.jsxs)("div",{className:"mt-1 text-[10px] text-gray-600",children:["confidence: ",a.confidence?.toFixed(2)," · similarity: ",a.similarity?.toFixed(3)]})]},c))})]},a))]})]}),"refine"===j&&(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsx)("div",{className:"bg-amber-500/10 border border-amber-500/20 text-amber-400 rounded-lg px-4 py-2.5 text-xs leading-relaxed",children:"Refine uses LLM distillation and requires an API key configured in Cortex settings. Without a key, refinement will run in passthrough mode."}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:aw,children:"Domain context"}),(0,b.jsx)("textarea",{value:T,onChange:a=>U(a.target.value),placeholder:"Describe the domain or project context to guide distillation...",rows:4,className:av})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:aw,children:"Distillation passes"}),(0,b.jsx)("div",{className:"grid grid-cols-2 gap-2",children:Object.keys(V).map(a=>(0,b.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[(0,b.jsx)("input",{type:"checkbox",checked:V[a],onChange:b=>W(c=>({...c,[a]:b.target.checked})),className:"rounded border-white/20 bg-white/5 accent-purple-500"}),(0,b.jsx)("span",{className:"text-xs text-gray-400 capitalize",children:a.replace("_"," ")})]},a))})]}),(0,b.jsxs)("button",{onClick:at,disabled:X||!h,className:"flex items-center gap-2 px-4 py-2 text-sm bg-purple-600 hover:bg-purple-500 text-white rounded-lg disabled:opacity-50 transition-colors",children:[X?(0,b.jsx)(B.Loader2,{className:"w-4 h-4 animate-spin"}):(0,b.jsx)(y.RefreshCw,{className:"w-4 h-4"}),"Refine Lobe"]}),Z&&(0,b.jsxs)("div",{className:ax,children:[(0,b.jsx)("div",{className:"text-xs font-medium text-gray-400 mb-3",children:"Refine Results"}),(0,b.jsxs)("div",{className:"grid grid-cols-3 gap-3",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-500 uppercase mb-0.5",children:"Source Units"}),(0,b.jsx)("div",{className:"text-lg font-semibold text-white tabular-nums",children:Z.source_units_found})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-500 uppercase mb-0.5",children:"Purged"}),(0,b.jsx)("div",{className:"text-lg font-semibold text-amber-400 tabular-nums",children:Z.distilled_purged})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-500 uppercase mb-0.5",children:"New Units"}),(0,b.jsx)("div",{className:"text-lg font-semibold text-green-400 tabular-nums",children:Z.new_units_created})]})]})]})]}),"publish"===j&&(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:aw,children:"Package name *"}),(0,b.jsx)("input",{value:_,onChange:a=>aa(a.target.value),placeholder:"my-knowledge-pack",className:av})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:aw,children:"Author"}),(0,b.jsx)("input",{value:ab,onChange:a=>ac(a.target.value),placeholder:"Your name or org",className:av})]})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:aw,children:"Description"}),(0,b.jsx)("textarea",{value:ad,onChange:a=>ae(a.target.value),placeholder:"Describe the knowledge pack...",rows:3,className:av})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:aw,children:"Tags (comma-separated)"}),(0,b.jsx)("input",{value:af,onChange:a=>ag(a.target.value),placeholder:"e.g. typescript, react, patterns",className:av})]}),(0,b.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:aw,children:"Version"}),(0,b.jsx)("input",{value:ah,onChange:a=>ai(a.target.value),placeholder:"1.0.0",className:av})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:aw,children:"License"}),(0,b.jsxs)("select",{value:aj,onChange:a=>ak(a.target.value),className:av,children:[(0,b.jsx)("option",{value:"MIT",children:"MIT"}),(0,b.jsx)("option",{value:"Apache-2.0",children:"Apache 2.0"}),(0,b.jsx)("option",{value:"GPL-3.0",children:"GPL 3.0"}),(0,b.jsx)("option",{value:"BSD-3-Clause",children:"BSD 3-Clause"}),(0,b.jsx)("option",{value:"CC-BY-4.0",children:"CC BY 4.0"}),(0,b.jsx)("option",{value:"Proprietary",children:"Proprietary"})]})]})]}),(0,b.jsxs)("button",{onClick:au,disabled:al||!_.trim()||!h,className:"flex items-center gap-2 px-4 py-2 text-sm bg-purple-600 hover:bg-purple-500 text-white rounded-lg disabled:opacity-50 transition-colors",children:[al?(0,b.jsx)(B.Loader2,{className:"w-4 h-4 animate-spin"}):(0,b.jsx)(A,{className:"w-4 h-4"}),"Publish to Marketplace"]}),an&&(0,b.jsxs)("div",{className:ax,children:[an.quality_warning&&(0,b.jsx)("div",{className:"mb-3 bg-amber-500/10 border border-amber-500/20 text-amber-400 rounded px-3 py-2 text-xs",children:an.quality_warning}),(0,b.jsx)("div",{className:"text-xs font-medium text-gray-400 mb-3",children:"Published"}),an.output_path&&(0,b.jsxs)("div",{className:"mb-2",children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-500 uppercase mb-0.5",children:"Output Path"}),(0,b.jsx)("div",{className:"text-xs text-gray-300 font-mono break-all",children:an.output_path})]}),an.pii_scrub&&(0,b.jsxs)("div",{className:"mt-2 pt-2 border-t border-white/[0.06]",children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-500 uppercase mb-1",children:"PII Scrub"}),(0,b.jsxs)("div",{className:"flex gap-4 text-[11px] text-gray-400",children:[(0,b.jsxs)("span",{children:[an.pii_scrub.records_checked.toLocaleString()," records checked"]}),(0,b.jsxs)("span",{children:[an.pii_scrub.fields_scrubbed.toLocaleString()," fields scrubbed"]})]})]})]})]})]})})]})}var F=a.i(296101);function G({filename:a,manifest:d,onImport:e}){let[f,i]=(0,c.useState)(!1),j=d.marketplace??{},k=j.name||a,l=d.version||j.version||"0.0.0",m=j.author||d.author||"Unknown",n=j.description||d.description||"",o=j.tags||d.tags||[],p=j.license||d.license||"",q="number"==typeof j.coverage_score?j.coverage_score:-1,r="number"==typeof d.unit_count?d.unit_count:Array.isArray(d.units)?d.units.length:0,s=j.preview||d.preview||"",t=q<0?"N/A":`${Math.round(100*q)}%`;return(0,b.jsxs)("div",{className:"border border-white/10 rounded-xl p-4 bg-white/[0.02] flex flex-col gap-3 hover:border-white/20 transition-colors",children:[(0,b.jsxs)("div",{className:"flex items-start gap-3",children:[(0,b.jsx)("div",{className:"shrink-0 w-9 h-9 rounded-lg bg-purple-500/10 flex items-center justify-center",children:(0,b.jsx)(A,{className:"w-4 h-4 text-purple-400"})}),(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,b.jsx)("span",{className:"text-sm font-semibold text-gray-100 truncate",children:k}),(0,b.jsxs)("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-white/5 text-gray-400 font-mono shrink-0",children:["v",l]})]}),(0,b.jsx)("p",{className:"text-[11px] text-gray-500 mt-0.5",children:m})]})]}),n&&(0,b.jsx)("p",{className:"text-xs text-gray-400 leading-relaxed line-clamp-2",children:n}),(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[o.map(a=>(0,b.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-white/5 text-gray-400 border border-white/5",children:a},a)),p&&(0,b.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-purple-500/10 text-purple-400 border border-purple-500/20 font-medium",children:p})]}),(0,b.jsxs)("div",{className:"flex items-center gap-4 text-[11px]",children:[(0,b.jsxs)("div",{className:"flex items-center gap-1",children:[(0,b.jsx)("span",{className:"text-gray-600",children:"Coverage:"}),(0,b.jsx)("span",{className:`font-semibold tabular-nums ${q<0?"text-gray-500":q>.7?"text-green-400":q>.3?"text-amber-400":"text-red-400"}`,children:t})]}),(0,b.jsxs)("div",{className:"flex items-center gap-1",children:[(0,b.jsx)("span",{className:"text-gray-600",children:"Units:"}),(0,b.jsx)("span",{className:"text-gray-300 font-semibold tabular-nums",children:r})]})]}),s&&(0,b.jsxs)("div",{children:[(0,b.jsxs)("button",{onClick:()=>i(a=>!a),className:"flex items-center gap-1 text-[11px] text-gray-500 hover:text-gray-300 transition-colors",children:[f?(0,b.jsx)(h.ChevronUp,{className:"w-3 h-3"}):(0,b.jsx)(g.ChevronDown,{className:"w-3 h-3"}),f?"Hide preview":"Show preview"]}),f&&(0,b.jsx)("pre",{className:"mt-2 text-[10px] text-gray-400 bg-white/[0.03] border border-white/5 rounded-lg p-3 overflow-x-auto whitespace-pre-wrap break-all",children:s})]}),(0,b.jsx)("button",{onClick:()=>e(a,d),className:"w-full py-2 text-sm font-medium bg-purple-600 hover:bg-purple-500 text-white rounded-lg transition-colors",children:"Import"})]})}var H=a.i(633508);function I({filename:a,hasDomainContext:d,onClose:f,onComplete:g}){let[h,i]=(0,c.useState)("personal"),[j,k]=(0,c.useState)(""),[l,m]=(0,c.useState)([]),[n,o]=(0,c.useState)("append"),[p,q]=(0,c.useState)(!1),[r,s]=(0,c.useState)(!1),[t,u]=(0,c.useState)(!1),[v,w]=(0,c.useState)(null);(0,c.useEffect)(()=>{"workspace"===h&&fetch((0,e.api)("/api/workspaces")).then(a=>a.ok?a.json():null).then(a=>{let b=a?.workspaces??a??[];m(b),b.length>0&&!j&&k(b[0].id)}).catch(()=>{})},[h]);let x=async()=>{u(!0),w(null);try{let b={marketplace_file:a,target_layer:h,merge_strategy:n,re_embed:p};"workspace"===h&&j&&(b.workspace_id=j),d&&(b.apply_domain_context=r);let c=await fetch((0,e.api)("/api/cortex/import"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)});if(!c.ok){let a=await c.json().catch(()=>({}));throw Error(a?.error||`Request failed (${c.status})`)}g()}catch(a){w(a?.message||"Import failed")}finally{u(!1)}};return(0,b.jsx)("div",{className:"fixed inset-0 z-50 bg-black/60 flex items-center justify-center p-4",children:(0,b.jsxs)("div",{className:"bg-gray-900 border border-white/10 rounded-xl p-6 max-w-md w-full flex flex-col gap-5",children:[(0,b.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h2",{className:"text-sm font-semibold text-gray-100",children:"Import Pack"}),(0,b.jsx)("p",{className:"text-[11px] text-gray-500 mt-0.5 font-mono break-all",children:a})]}),(0,b.jsx)("button",{onClick:f,className:"shrink-0 text-gray-500 hover:text-gray-300 transition-colors","aria-label":"Close",children:(0,b.jsx)(H.X,{className:"w-4 h-4"})})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-[11px] text-gray-500 uppercase tracking-wide mb-2",children:"Target layer"}),(0,b.jsx)("div",{className:"flex gap-2",children:[{value:"personal",label:"Personal"},{value:"workspace",label:"Workspace"},{value:"team",label:"Team"}].map(a=>(0,b.jsx)("button",{onClick:()=>i(a.value),className:`flex-1 py-1.5 text-xs font-medium rounded-lg border transition-colors ${h===a.value?"bg-purple-600 border-purple-500 text-white":"bg-white/5 border-white/10 text-gray-400 hover:border-white/20 hover:text-gray-200"}`,children:a.label},a.value))})]}),"workspace"===h&&(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-[11px] text-gray-500 uppercase tracking-wide mb-2",children:"Workspace"}),0===l.length?(0,b.jsx)("p",{className:"text-xs text-gray-600",children:"No workspaces found"}):(0,b.jsx)("select",{value:j,onChange:a=>k(a.target.value),className:"w-full py-2 px-3 text-sm bg-white/5 border border-white/10 rounded-lg text-gray-300 focus:outline-none focus:border-purple-500/50",children:l.map(a=>(0,b.jsx)("option",{value:a.id,children:a.name},a.id))})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-[11px] text-gray-500 uppercase tracking-wide mb-2",children:"Merge strategy"}),(0,b.jsx)("div",{className:"flex gap-2",children:[{value:"append",label:"Append"},{value:"merge",label:"Merge"},{value:"replace",label:"Replace"}].map(a=>(0,b.jsx)("button",{onClick:()=>o(a.value),className:`flex-1 py-1.5 text-xs font-medium rounded-lg border transition-colors ${n===a.value?"bg-purple-600 border-purple-500 text-white":"bg-white/5 border-white/10 text-gray-400 hover:border-white/20 hover:text-gray-200"}`,children:a.label},a.value))})]}),(0,b.jsxs)("div",{className:"flex flex-col gap-2.5",children:[(0,b.jsxs)("label",{className:"flex items-center gap-2.5 cursor-pointer select-none group",children:[(0,b.jsx)("input",{type:"checkbox",checked:p,onChange:a=>q(a.target.checked),className:"w-3.5 h-3.5 accent-purple-500"}),(0,b.jsx)("span",{className:"text-xs text-gray-400 group-hover:text-gray-200 transition-colors",children:"Re-embed on import"})]}),d&&(0,b.jsxs)("label",{className:"flex items-center gap-2.5 cursor-pointer select-none group",children:[(0,b.jsx)("input",{type:"checkbox",checked:r,onChange:a=>s(a.target.checked),className:"w-3.5 h-3.5 accent-purple-500"}),(0,b.jsx)("span",{className:"text-xs text-gray-400 group-hover:text-gray-200 transition-colors",children:"Apply domain context"})]})]}),v&&(0,b.jsx)("p",{className:"text-xs text-red-400 bg-red-500/10 border border-red-500/20 rounded-lg px-3 py-2",children:v}),(0,b.jsxs)("button",{onClick:x,disabled:t,className:"w-full py-2 text-sm font-medium bg-purple-600 hover:bg-purple-500 text-white rounded-lg transition-colors disabled:opacity-50 flex items-center justify-center gap-2",children:[t&&(0,b.jsx)(B.Loader2,{className:"w-3.5 h-3.5 animate-spin"}),t?"Importing...":"Import"]})]})})}function J(){let[a,d]=(0,c.useState)([]),[f,g]=(0,c.useState)(""),[h,i]=(0,c.useState)(!1),[j,k]=(0,c.useState)(null),l=(0,c.useCallback)(async()=>{i(!0);try{let a=await fetch((0,e.api)("/api/cortex/marketplace/browse"));if(a.ok){let b=await a.json();d(b.packs??[]),b.directory&&g(b.directory)}}catch{}i(!1)},[]);(0,c.useEffect)(()=>{l()},[l]);let m=(a,b)=>{k({filename:a,manifest:b})},n=j?.manifest?.marketplace?.domain_context!=null||j?.manifest?.domain_context!=null;return(0,b.jsxs)("div",{className:"flex flex-col h-full",children:[(0,b.jsxs)("div",{className:"p-4 border-b border-white/5 flex items-center justify-between gap-3",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h2",{className:"text-sm font-semibold text-gray-100",children:"Marketplace"}),f&&(0,b.jsx)("p",{className:"text-[11px] text-gray-600 font-mono mt-0.5 truncate",children:f})]}),(0,b.jsxs)("button",{onClick:l,disabled:h,className:"flex items-center gap-1.5 text-xs text-gray-400 hover:text-gray-200 transition-colors disabled:opacity-50",children:[(0,b.jsx)(y.RefreshCw,{className:`w-3.5 h-3.5 ${h?"animate-spin":""}`}),"Refresh"]})]}),(0,b.jsxs)("div",{className:"flex-1 overflow-y-auto p-4",children:[h&&0===a.length&&(0,b.jsx)("p",{className:"text-sm text-gray-500 text-center py-12",children:"Loading..."}),!h&&0===a.length&&(0,b.jsxs)("div",{className:"flex flex-col items-center justify-center gap-3 py-16 text-gray-600",children:[(0,b.jsx)(F.FolderOpen,{className:"w-8 h-8"}),(0,b.jsx)("p",{className:"text-sm",children:"No .cortexpack files found"})]}),a.length>0&&(0,b.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:a.map(a=>(0,b.jsx)(G,{filename:a.filename,manifest:a.manifest,onImport:m},a.filename))})]}),j&&(0,b.jsx)(I,{filename:j.filename,hasDomainContext:n,onClose:()=>k(null),onComplete:()=>{k(null),l()}})]})}var K=a.i(618155),L=a.i(923665),M=a.i(758042),N=a.i(994222),O=a.i(659854),P=a.i(48662),Q=a.i(467149);let R=(0,z.default)("flask-conical",[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]]);var S=a.i(50522);let T=(0,z.default)("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]);var U=a.i(433217),V=a.i(370025),W=a.i(937927);function X({label:a,value:c,sub:d,color:e}){return(0,b.jsxs)("div",{className:"bg-white/[0.02] border border-white/[0.06] rounded-lg p-3",children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-500 uppercase tracking-wider mb-1",children:a}),(0,b.jsx)("div",{className:`text-lg font-semibold tabular-nums ${e||"text-white"}`,children:c}),d&&(0,b.jsx)("div",{className:"text-[10px] text-gray-600 mt-0.5",children:d})]})}let Y={background:"#0f0f11",border:"1px solid rgba(255,255,255,0.08)",borderRadius:"0.5rem",fontSize:"11px",color:"#d1d5db"};function Z(a){return a<-10?"#22c55e":a<0?"#86efac":a<5?"#f59e0b":"#ef4444"}function $({result:a}){let[d,e]=(0,c.useState)(!1);return(0,b.jsxs)("div",{className:"border border-white/[0.05] rounded-lg overflow-hidden",children:[(0,b.jsxs)("button",{onClick:()=>e(a=>!a),className:"w-full flex items-center gap-3 px-3 py-2 text-left hover:bg-white/[0.02] transition-colors",children:[(0,b.jsx)("span",{className:"text-gray-500",children:d?(0,b.jsx)(g.ChevronDown,{className:"w-3.5 h-3.5"}):(0,b.jsx)(S.ChevronRight,{className:"w-3.5 h-3.5"})}),(0,b.jsx)("span",{className:"text-xs text-gray-300 font-mono flex-1 truncate",title:a.task_id,children:a.task_id}),(0,b.jsx)("span",{className:"text-[10px] text-gray-600 w-20",children:a.category}),(0,b.jsx)("span",{className:"text-[10px] text-gray-600 w-12",children:a.difficulty}),(0,b.jsx)("span",{className:"text-[10px] tabular-nums w-16 text-right",style:{color:Z(a.tokens_delta_percent??0)},children:null!=a.tokens_delta_percent?`${a.tokens_delta_percent>0?"+":""}${a.tokens_delta_percent.toFixed(1)}%`:"—"}),(0,b.jsxs)("span",{className:"text-[10px] text-gray-400 tabular-nums w-20 text-right",children:[null!=a.quality_with?a.quality_with.toFixed(2):"—"," / ",null!=a.quality_without?a.quality_without.toFixed(2):"—"]})]}),d&&(0,b.jsxs)("div",{className:"px-8 pb-3 pt-1 grid grid-cols-2 md:grid-cols-4 gap-3 bg-white/[0.01] border-t border-white/[0.05]",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-[9px] text-gray-600 uppercase mb-0.5",children:"Tokens without"}),(0,b.jsxs)("div",{className:"text-xs text-gray-300 tabular-nums",children:[a.tokens_without_input??"—"," in / ",a.tokens_without_output??"—"," out"]})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-[9px] text-gray-600 uppercase mb-0.5",children:"Tokens with"}),(0,b.jsxs)("div",{className:"text-xs text-gray-300 tabular-nums",children:[a.tokens_with_input??"—"," in / ",a.tokens_with_output??"—"," out"]})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-[9px] text-gray-600 uppercase mb-0.5",children:"Injection"}),(0,b.jsxs)("div",{className:"text-xs text-gray-300 tabular-nums",children:[a.injection_tokens??"—"," tokens"]})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-[9px] text-gray-600 uppercase mb-0.5",children:"Retrieval"}),(0,b.jsxs)("div",{className:"text-xs text-gray-300 tabular-nums",children:[a.retrieval_count??0," hits",null!=a.retrieval_avg_relevance?` \xb7 ${a.retrieval_avg_relevance.toFixed(3)} rel`:"",null!=a.retrieval_latency_ms?` \xb7 ${a.retrieval_latency_ms.toFixed(0)}ms`:""]})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-[9px] text-gray-600 uppercase mb-0.5",children:"Quality improvement"}),(0,b.jsx)("div",{className:"text-xs tabular-nums",style:{color:(a.quality_improvement??0)>0?"#22c55e":(a.quality_improvement??0)<0?"#ef4444":"#6b7280"},children:null!=a.quality_improvement?`${a.quality_improvement>0?"+":""}${a.quality_improvement.toFixed(3)}`:"—"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-[9px] text-gray-600 uppercase mb-0.5",children:"Judge confidence"}),(0,b.jsx)("div",{className:"text-xs text-gray-300 tabular-nums",children:null!=a.judge_confidence?a.judge_confidence.toFixed(2):"—"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-[9px] text-gray-600 uppercase mb-0.5",children:"Duration without"}),(0,b.jsx)("div",{className:"text-xs text-gray-300 tabular-nums",children:null!=a.duration_without_ms?`${a.duration_without_ms.toFixed(0)}ms`:"—"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-[9px] text-gray-600 uppercase mb-0.5",children:"Duration with"}),(0,b.jsx)("div",{className:"text-xs text-gray-300 tabular-nums",children:null!=a.duration_with_ms?`${a.duration_with_ms.toFixed(0)}ms`:"—"})]})]})]})}function _({tier:a}){if(!a)return null;let c={gold:"bg-yellow-500/20 text-yellow-300 border-yellow-500/30",silver:"bg-gray-400/20 text-gray-300 border-gray-400/30",bronze:"bg-orange-500/20 text-orange-300 border-orange-500/30"}[a.toLowerCase()]||"bg-purple-500/20 text-purple-300 border-purple-500/30";return(0,b.jsx)("span",{className:`text-[9px] px-1.5 py-0.5 rounded border font-medium uppercase ${c}`,children:a})}let aa=["codebase-qa","bug-fixing","code-generation","refactoring","style-convention","decision-recall","cross-session","error-recovery","domain-knowledge","multi-layer","performance-optimization","api-integration","security-access","meta-self","lobe-specific"],ab={quick:{label:"Quick Test",desc:"Single task per category",tasks:"~15 tasks",time:"~3 min"},standard:{label:"Standard",desc:"5 tasks per category",tasks:"~75 tasks",time:"~20 min"},full:{label:"Comprehensive",desc:"All tasks",tasks:"~156 tasks",time:"~1 hour"}};function ac({current:a,total:c}){let d=c>0?Math.round(a/c*100):0;return(0,b.jsxs)("div",{className:"w-full",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,b.jsxs)("span",{className:"text-[10px] text-gray-500 tabular-nums",children:[a," / ",c>0?c:"?"," tasks"]}),(0,b.jsxs)("span",{className:"text-[10px] text-gray-500 tabular-nums",children:[d,"%"]})]}),(0,b.jsx)("div",{className:"h-1.5 bg-white/[0.06] rounded-full overflow-hidden",children:(0,b.jsx)("div",{className:"h-full bg-purple-500 rounded-full transition-all duration-500",style:{width:`${d}%`}})})]})}function ad({onRunComplete:a}){let d,{data:f}=(0,U.useQuery)({queryKey:["benchmark","status"],queryFn:async()=>{let a=await fetch((0,e.api)("/api/benchmark/status"));return a.ok?a.json():null},refetchInterval:3e3}),h=(d=(0,W.useQueryClient)(),(0,V.useMutation)({mutationFn:async a=>(await fetch((0,e.api)("/api/benchmark/run"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})).json(),onSuccess:()=>{d.invalidateQueries({queryKey:["benchmark"]})}})),[i,j]=(0,c.useState)([]),[k,l]=(0,c.useState)("claude-haiku-4-5"),[m,n]=(0,c.useState)(!1),[o,p]=(0,c.useState)(!1),q=f?.running===!0,r=(0,c.useRef)(void 0);(0,c.useEffect)(()=>{!0!==r.current||q||f?.exitCode==null||a(),r.current=q},[q,f?.exitCode,a]);let s=f?.output?f.output.split("\n").filter(a=>a.trim().length>0).slice(-6):[];if(q)return(0,b.jsxs)("div",{className:"bg-white/[0.02] border border-white/[0.06] rounded-lg p-4 space-y-3",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(B.Loader2,{className:"w-3.5 h-3.5 text-purple-400 animate-spin"}),(0,b.jsxs)("span",{className:"text-xs font-medium text-gray-300",children:["Benchmark running — ",f?.preset,f?.categories&&"all"!==f.categories?` (${f.categories})`:""]})]}),(0,b.jsx)("span",{className:"text-[10px] text-gray-600 font-mono",children:f?.model})]}),(0,b.jsx)(ac,{current:f?.progress?.current??0,total:f?.progress?.total??0}),s.length>0&&(0,b.jsx)("div",{className:"bg-black/30 rounded-md p-3 font-mono text-[10px] text-gray-500 space-y-0.5 max-h-28 overflow-y-auto",children:s.map((a,c)=>(0,b.jsx)("div",{className:"leading-relaxed",children:a},c))})]});let t=h.data?.error;return(0,b.jsxs)("div",{className:"bg-white/[0.02] border border-white/[0.06] rounded-lg overflow-hidden",children:[(0,b.jsx)("div",{className:"px-4 py-3 border-b border-white/[0.05]",children:(0,b.jsx)("h3",{className:"text-xs font-medium text-gray-400",children:"Run Benchmark"})}),(0,b.jsxs)("div",{className:"p-4 space-y-2",children:[Object.entries(ab).map(([a,c])=>(0,b.jsxs)("div",{className:"flex items-center justify-between px-3 py-2.5 rounded-lg border border-white/[0.05] hover:border-white/[0.10] hover:bg-white/[0.02] transition-colors",children:[(0,b.jsxs)("div",{className:"min-w-0",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:"text-xs font-medium text-gray-300",children:c.label}),(0,b.jsx)("span",{className:"text-[10px] text-gray-600",children:c.desc})]}),(0,b.jsxs)("div",{className:"text-[10px] text-gray-600 mt-0.5 tabular-nums",children:[c.tasks," · ",c.time]})]}),(0,b.jsxs)("button",{onClick:()=>{h.mutate({preset:a})},disabled:h.isPending,className:"ml-4 flex items-center gap-1.5 px-3 py-1 text-[11px] font-medium rounded-md bg-purple-600/20 text-purple-300 border border-purple-500/20 hover:bg-purple-600/30 hover:border-purple-500/40 disabled:opacity-50 disabled:cursor-not-allowed transition-colors shrink-0",children:[(0,b.jsx)(T,{className:"w-2.5 h-2.5"}),"Run"]})]},a)),(0,b.jsxs)("div",{className:"pt-1",children:[(0,b.jsxs)("button",{onClick:()=>p(a=>!a),className:"flex items-center gap-1.5 text-[11px] text-gray-500 hover:text-gray-400 transition-colors",children:[o?(0,b.jsx)(g.ChevronDown,{className:"w-3 h-3"}):(0,b.jsx)(S.ChevronRight,{className:"w-3 h-3"}),"Custom"]}),o&&(0,b.jsxs)("div",{className:"mt-3 space-y-3 pl-1",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-600 uppercase tracking-wider mb-2",children:"Categories"}),(0,b.jsx)("div",{className:"flex flex-wrap gap-1.5",children:aa.map(a=>{let c=i.includes(a);return(0,b.jsx)("button",{onClick:()=>{j(b=>b.includes(a)?b.filter(b=>b!==a):[...b,a])},className:`px-2 py-0.5 text-[10px] rounded border transition-colors ${c?"bg-purple-500/20 text-purple-300 border-purple-500/30":"bg-white/[0.03] text-gray-500 border-white/[0.06] hover:text-gray-400 hover:border-white/[0.10]"}`,children:a},a)})}),0===i.length&&(0,b.jsx)("div",{className:"text-[10px] text-gray-600 mt-1",children:"None selected = all categories"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-600 uppercase tracking-wider mb-1",children:"Model"}),(0,b.jsxs)("select",{value:k,onChange:a=>l(a.target.value),className:"px-2.5 py-1 text-xs bg-white/5 border border-white/10 rounded-md text-gray-300 focus:outline-none focus:border-purple-500/50",children:[(0,b.jsx)("option",{value:"claude-haiku-4-5",children:"claude-haiku-4-5"}),(0,b.jsx)("option",{value:"claude-sonnet-4-5",children:"claude-sonnet-4-5"}),(0,b.jsx)("option",{value:"claude-opus-4-5",children:"claude-opus-4-5"})]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2 mt-4",children:[(0,b.jsx)("input",{id:"no-judge",type:"checkbox",checked:m,onChange:a=>n(a.target.checked),className:"w-3.5 h-3.5 rounded accent-purple-500"}),(0,b.jsx)("label",{htmlFor:"no-judge",className:"text-[11px] text-gray-400 cursor-pointer",children:"Skip judge"})]})]}),(0,b.jsxs)("button",{onClick:function(){h.mutate({preset:"custom",categories:i.length>0?i.join(","):void 0,noJudge:m,model:k})},disabled:h.isPending,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md bg-purple-600/20 text-purple-300 border border-purple-500/20 hover:bg-purple-600/30 hover:border-purple-500/40 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[(0,b.jsx)(T,{className:"w-3 h-3"}),"Run Custom"]})]})]}),t&&(0,b.jsx)("div",{className:"text-[11px] text-red-400 bg-red-500/10 border border-red-500/20 rounded-md px-3 py-2",children:t}),f&&!q&&null!=f.exitCode&&(0,b.jsxs)("div",{className:"text-[11px] text-gray-500 bg-white/[0.02] border border-white/[0.05] rounded-md px-3 py-2",children:["Last run finished — exit code ",f.exitCode,0===f.exitCode?" (success)":" (error)"]})]})]})}function ae(){let{data:a,isLoading:d,refetch:f}=(0,U.useQuery)({queryKey:["benchmark","runs"],queryFn:async()=>{let a=await fetch((0,e.api)("/api/benchmark/runs"));return a.ok?a.json():null}}),g=a?.runs??[],[h,i]=(0,c.useState)(null),j=h??g[0]?.id??null,{data:k,isLoading:l}=(0,U.useQuery)({queryKey:["benchmark","run",j],queryFn:async()=>{if(!j)return null;let a=await fetch((0,e.api)(`/api/benchmark/runs/${j}`));return a.ok?a.json():null},enabled:!!j}),{data:m}=(0,U.useQuery)({queryKey:["benchmark","lobes"],queryFn:async()=>{let a=await fetch((0,e.api)("/api/benchmark/lobes"));return a.ok?a.json():null}}),n=k?.summary??null,o=k?.categories??[],p=k?.results??[],q=m?.lobes??[],r=!d&&0===g.length;if(d)return(0,b.jsxs)("div",{className:"p-6 max-w-5xl space-y-6",children:[(0,b.jsx)(ad,{onRunComplete:()=>f()}),(0,b.jsx)("div",{className:"text-sm text-gray-500",children:"Loading benchmark data..."})]});if(r)return(0,b.jsxs)("div",{className:"p-6 max-w-5xl space-y-6",children:[(0,b.jsx)(ad,{onRunComplete:()=>f()}),(0,b.jsxs)("div",{className:"flex flex-col items-center justify-center gap-4 py-16 text-gray-600",children:[(0,b.jsx)(R,{className:"w-10 h-10"}),(0,b.jsxs)("p",{className:"text-sm text-center max-w-xs",children:["No benchmark data yet. Use the launcher above or run"," ",(0,b.jsx)("span",{className:"text-gray-500 font-mono text-xs",children:"npm run benchmark"})," ","to generate results."]})]})]});let s=o.map(a=>({name:a.category,delta:parseFloat(a.avgTokenDeltaPercent.toFixed(1))})),t=o.map(a=>({name:a.category,without:parseFloat(a.avgQualityWithout.toFixed(3)),with:parseFloat(a.avgQualityWith.toFixed(3))})),u=[...o].sort((a,b)=>b.hitRate-a.hitRate).map(a=>({name:a.category,hitRate:parseFloat((100*a.hitRate).toFixed(1))}));return(0,b.jsxs)("div",{className:"p-6 max-w-5xl space-y-6",children:[(0,b.jsx)(ad,{onRunComplete:()=>f()}),(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)("label",{className:"text-[11px] text-gray-500 shrink-0",children:"Run"}),(0,b.jsx)("select",{value:j??"",onChange:a=>i(a.target.value||null),className:"px-3 py-1.5 text-xs bg-white/5 border border-white/10 rounded-lg text-gray-300 focus:outline-none focus:border-purple-500/50",children:g.map(a=>(0,b.jsxs)("option",{value:a.id,children:[new Date(a.timestamp).toLocaleString()," — ",a.model," (",a.preset,", ",a.task_count," tasks)"]},a.id))})]}),n&&(0,b.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-3",children:[(0,b.jsx)(X,{label:"Avg Token Delta",value:null!=n.avgTokenDeltaPercent?`${n.avgTokenDeltaPercent>0?"+":""}${n.avgTokenDeltaPercent.toFixed(1)}%`:"—",sub:"vs baseline",color:n.avgTokenDeltaPercent<0?"text-green-400":n.avgTokenDeltaPercent<5?"text-amber-400":"text-red-400"}),(0,b.jsx)(X,{label:"Quality (with)",value:n.avgQualityWith.toFixed(2),sub:"avg LLM judge score",color:"text-purple-400"}),(0,b.jsx)(X,{label:"Quality (without)",value:n.avgQualityWithout.toFixed(2),sub:"baseline"}),(0,b.jsx)(X,{label:"Tasks",value:n.taskCount.toString(),sub:`${o.length} categories`}),(0,b.jsx)(X,{label:"Avg Retrieval",value:n.avgRetrievalLatencyMs?`${n.avgRetrievalLatencyMs.toFixed(0)}ms`:"—",sub:n.avgRetrievalRelevance?`${n.avgRetrievalRelevance.toFixed(3)} relevance`:"relevance"})]}),l&&(0,b.jsx)("div",{className:"text-sm text-gray-500",children:"Loading run details..."}),o.length>0&&(0,b.jsxs)("div",{className:"bg-white/[0.02] border border-white/[0.06] rounded-lg overflow-hidden",children:[(0,b.jsx)("div",{className:"px-4 py-3 border-b border-white/[0.05]",children:(0,b.jsx)("h3",{className:"text-xs font-medium text-gray-400",children:"Category Breakdown"})}),(0,b.jsx)("div",{className:"overflow-x-auto",children:(0,b.jsxs)("table",{className:"w-full text-xs",children:[(0,b.jsx)("thead",{children:(0,b.jsxs)("tr",{className:"border-b border-white/[0.05]",children:[(0,b.jsx)("th",{className:"px-4 py-2 text-left text-[10px] text-gray-500 uppercase tracking-wider",children:"Category"}),(0,b.jsx)("th",{className:"px-4 py-2 text-right text-[10px] text-gray-500 uppercase tracking-wider",children:"Tasks"}),(0,b.jsx)("th",{className:"px-4 py-2 text-right text-[10px] text-gray-500 uppercase tracking-wider",children:"Token Delta"}),(0,b.jsx)("th",{className:"px-4 py-2 text-right text-[10px] text-gray-500 uppercase tracking-wider",children:"Quality w/o"}),(0,b.jsx)("th",{className:"px-4 py-2 text-right text-[10px] text-gray-500 uppercase tracking-wider",children:"Quality with"}),(0,b.jsx)("th",{className:"px-4 py-2 text-right text-[10px] text-gray-500 uppercase tracking-wider",children:"Hit Rate"}),(0,b.jsx)("th",{className:"px-4 py-2 text-right text-[10px] text-gray-500 uppercase tracking-wider",children:"Relevance"})]})}),(0,b.jsx)("tbody",{children:o.map((a,c)=>(0,b.jsxs)("tr",{className:`border-b border-white/[0.03] ${c%2==0?"":"bg-white/[0.01]"}`,children:[(0,b.jsx)("td",{className:"px-4 py-2 text-gray-300",children:a.category}),(0,b.jsx)("td",{className:"px-4 py-2 text-right text-gray-400 tabular-nums",children:a.taskCount}),(0,b.jsxs)("td",{className:"px-4 py-2 text-right tabular-nums font-medium",style:{color:Z(a.avgTokenDeltaPercent)},children:[a.avgTokenDeltaPercent>0?"+":"",a.avgTokenDeltaPercent.toFixed(1),"%"]}),(0,b.jsx)("td",{className:"px-4 py-2 text-right text-gray-400 tabular-nums",children:a.avgQualityWithout.toFixed(2)}),(0,b.jsx)("td",{className:"px-4 py-2 text-right text-gray-300 tabular-nums font-medium",children:a.avgQualityWith.toFixed(2)}),(0,b.jsxs)("td",{className:"px-4 py-2 text-right text-gray-400 tabular-nums",children:[(100*a.hitRate).toFixed(0),"%"]}),(0,b.jsx)("td",{className:"px-4 py-2 text-right text-gray-400 tabular-nums",children:a.avgRetrievalRelevance.toFixed(3)})]},a.category))})]})})]}),o.length>0&&(0,b.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[(0,b.jsxs)("div",{className:"bg-white/[0.02] border border-white/[0.06] rounded-lg p-4",children:[(0,b.jsx)("h3",{className:"text-xs font-medium text-gray-400 mb-3",children:"Token Delta % by Category"}),(0,b.jsx)(P.ResponsiveContainer,{width:"100%",height:160,children:(0,b.jsxs)(K.BarChart,{data:s,margin:{top:4,right:4,bottom:4,left:0},children:[(0,b.jsx)(M.XAxis,{dataKey:"name",tick:{fontSize:10,fill:"#6b7280"}}),(0,b.jsx)(N.YAxis,{tick:{fontSize:10,fill:"#6b7280"}}),(0,b.jsx)(O.Tooltip,{contentStyle:Y,formatter:a=>[`${a>0?"+":""}${a}%`,"Token delta"]}),(0,b.jsx)(L.Bar,{dataKey:"delta",radius:[2,2,0,0],children:s.map((a,c)=>(0,b.jsx)(Q.Cell,{fill:Z(a.delta)},c))})]})})]}),(0,b.jsxs)("div",{className:"bg-white/[0.02] border border-white/[0.06] rounded-lg p-4",children:[(0,b.jsx)("h3",{className:"text-xs font-medium text-gray-400 mb-3",children:"Quality Score by Category"}),(0,b.jsxs)("div",{className:"flex items-center gap-4 mb-2",children:[(0,b.jsxs)("span",{className:"flex items-center gap-1 text-[10px] text-gray-500",children:[(0,b.jsx)("span",{className:"w-2 h-2 rounded-sm inline-block",style:{background:"#6b7280"}}),"Without"]}),(0,b.jsxs)("span",{className:"flex items-center gap-1 text-[10px] text-gray-500",children:[(0,b.jsx)("span",{className:"w-2 h-2 rounded-sm inline-block",style:{background:"#7c3aed"}}),"With Cortex"]})]}),(0,b.jsx)(P.ResponsiveContainer,{width:"100%",height:160,children:(0,b.jsxs)(K.BarChart,{data:t,margin:{top:4,right:4,bottom:4,left:0},children:[(0,b.jsx)(M.XAxis,{dataKey:"name",tick:{fontSize:10,fill:"#6b7280"}}),(0,b.jsx)(N.YAxis,{domain:[0,1],tick:{fontSize:10,fill:"#6b7280"}}),(0,b.jsx)(O.Tooltip,{contentStyle:Y}),(0,b.jsx)(L.Bar,{dataKey:"without",fill:"#4b5563",radius:[2,2,0,0]}),(0,b.jsx)(L.Bar,{dataKey:"with",fill:"#7c3aed",radius:[2,2,0,0]})]})})]}),(0,b.jsxs)("div",{className:"bg-white/[0.02] border border-white/[0.06] rounded-lg p-4 md:col-span-2",children:[(0,b.jsx)("h3",{className:"text-xs font-medium text-gray-400 mb-3",children:"Knowledge Retrieval Hit Rate %"}),(0,b.jsx)(P.ResponsiveContainer,{width:"100%",height:120,children:(0,b.jsxs)(K.BarChart,{data:u,layout:"vertical",margin:{top:4,right:4,bottom:4,left:60},children:[(0,b.jsx)(M.XAxis,{type:"number",domain:[0,100],tick:{fontSize:10,fill:"#6b7280"}}),(0,b.jsx)(N.YAxis,{type:"category",dataKey:"name",tick:{fontSize:10,fill:"#6b7280"},width:56}),(0,b.jsx)(O.Tooltip,{contentStyle:Y,formatter:a=>[`${a}%`,"Hit rate"]}),(0,b.jsx)(L.Bar,{dataKey:"hitRate",fill:"#06b6d4",radius:[0,2,2,0]})]})})]})]}),q.length>0&&(0,b.jsxs)("div",{className:"bg-white/[0.02] border border-white/[0.06] rounded-lg overflow-hidden",children:[(0,b.jsx)("div",{className:"px-4 py-3 border-b border-white/[0.05]",children:(0,b.jsx)("h3",{className:"text-xs font-medium text-gray-400",children:"Lobe Scores"})}),(0,b.jsx)("div",{className:"overflow-x-auto",children:(0,b.jsxs)("table",{className:"w-full text-xs",children:[(0,b.jsx)("thead",{children:(0,b.jsxs)("tr",{className:"border-b border-white/[0.05]",children:[(0,b.jsx)("th",{className:"px-4 py-2 text-left text-[10px] text-gray-500 uppercase tracking-wider",children:"Lobe"}),(0,b.jsx)("th",{className:"px-4 py-2 text-right text-[10px] text-gray-500 uppercase tracking-wider",children:"Overall"}),(0,b.jsx)("th",{className:"px-4 py-2 text-right text-[10px] text-gray-500 uppercase tracking-wider",children:"Token Savings"}),(0,b.jsx)("th",{className:"px-4 py-2 text-right text-[10px] text-gray-500 uppercase tracking-wider",children:"Quality +"}),(0,b.jsx)("th",{className:"px-4 py-2 text-right text-[10px] text-gray-500 uppercase tracking-wider",children:"Coverage"}),(0,b.jsx)("th",{className:"px-4 py-2 text-right text-[10px] text-gray-500 uppercase tracking-wider",children:"Badge"}),(0,b.jsx)("th",{className:"px-4 py-2 text-right text-[10px] text-gray-500 uppercase tracking-wider",children:"Marketplace"})]})}),(0,b.jsx)("tbody",{children:q.map((a,c)=>(0,b.jsxs)("tr",{className:`border-b border-white/[0.03] ${c%2==0?"":"bg-white/[0.01]"}`,children:[(0,b.jsxs)("td",{className:"px-4 py-2",children:[(0,b.jsx)("div",{className:"text-gray-300",children:a.lobe_name}),(0,b.jsx)("div",{className:"text-[9px] text-gray-600 font-mono",children:a.lobe_id})]}),(0,b.jsx)("td",{className:"px-4 py-2 text-right text-purple-400 tabular-nums font-medium",children:null!=a.overall_score?a.overall_score.toFixed(2):"—"}),(0,b.jsx)("td",{className:"px-4 py-2 text-right tabular-nums",style:{color:(a.token_savings??0)>0?"#22c55e":"#6b7280"},children:null!=a.token_savings?`${a.token_savings>0?"+":""}${a.token_savings.toFixed(1)}%`:"—"}),(0,b.jsx)("td",{className:"px-4 py-2 text-right tabular-nums",style:{color:(a.quality_improvement??0)>0?"#22c55e":"#6b7280"},children:null!=a.quality_improvement?`${a.quality_improvement>0?"+":""}${a.quality_improvement.toFixed(3)}`:"—"}),(0,b.jsx)("td",{className:"px-4 py-2 text-right text-gray-400 tabular-nums",children:null!=a.coverage_score?a.coverage_score.toFixed(2):"—"}),(0,b.jsx)("td",{className:"px-4 py-2 text-right",children:(0,b.jsx)(_,{tier:a.badge_tier})}),(0,b.jsx)("td",{className:"px-4 py-2 text-right",children:a.marketplace_ready?(0,b.jsx)("span",{className:"text-[9px] px-1.5 py-0.5 rounded border bg-green-500/10 text-green-400 border-green-500/20",children:"Ready"}):(0,b.jsx)("span",{className:"text-[9px] text-gray-600",children:"—"})})]},a.id))})]})})]}),p.length>0&&(0,b.jsxs)("div",{className:"bg-white/[0.02] border border-white/[0.06] rounded-lg overflow-hidden",children:[(0,b.jsxs)("div",{className:"px-4 py-3 border-b border-white/[0.05] flex items-center justify-between",children:[(0,b.jsx)("h3",{className:"text-xs font-medium text-gray-400",children:"Task Results"}),(0,b.jsxs)("span",{className:"text-[10px] text-gray-600",children:[p.length," tasks"]})]}),(0,b.jsxs)("div",{className:"px-4 py-2",children:[(0,b.jsxs)("div",{className:"flex items-center gap-3 px-3 py-1 mb-1",children:[(0,b.jsx)("span",{className:"w-3.5"}),(0,b.jsx)("span",{className:"text-[9px] text-gray-600 uppercase tracking-wider flex-1",children:"Task ID"}),(0,b.jsx)("span",{className:"text-[9px] text-gray-600 uppercase tracking-wider w-20",children:"Category"}),(0,b.jsx)("span",{className:"text-[9px] text-gray-600 uppercase tracking-wider w-12",children:"Diff"}),(0,b.jsx)("span",{className:"text-[9px] text-gray-600 uppercase tracking-wider w-16 text-right",children:"Token %"}),(0,b.jsx)("span",{className:"text-[9px] text-gray-600 uppercase tracking-wider w-20 text-right",children:"Quality w/w"})]}),(0,b.jsx)("div",{className:"space-y-1",children:p.map(a=>(0,b.jsx)($,{result:a},a.id))})]})]})]})}let af=(0,d.default)(async()=>{},{loadableGenerated:{modules:[756409]},ssr:!1,loading:()=>(0,b.jsx)("div",{className:"flex-1 flex items-center justify-center text-gray-500 text-sm",children:"Loading graph..."})});function ag(){let[a,d]=(0,c.useState)("dashboard"),[f,g]=(0,c.useState)(null);(0,c.useEffect)(()=>{fetch((0,e.api)("/api/cortex/status")).then(a=>a.json()).then(g).catch(()=>{})},[]);let h=f?Object.values(f.layers||{}).reduce((a,b)=>a+(b.count||0),0):0;return(0,b.jsxs)("div",{className:"flex flex-col h-screen bg-gray-950",children:[(0,b.jsxs)("div",{className:"flex items-center border-b border-white/5 px-4 shrink-0",children:[(0,b.jsx)("div",{className:"flex",children:[{key:"dashboard",label:"Dashboard"},{key:"graph",label:"Graph"},{key:"knowledge",label:"Knowledge"},{key:"curation",label:"Curation"},{key:"marketplace",label:"Marketplace"},{key:"benchmark",label:"Benchmark"},{key:"settings",label:"Settings"}].map(c=>(0,b.jsx)("button",{onClick:()=>d(c.key),className:`px-5 py-3 text-sm font-medium transition-colors border-b-2 ${a===c.key?"text-purple-400 border-purple-400":"text-gray-500 border-transparent hover:text-gray-300"}`,children:c.label},c.key))}),(0,b.jsxs)("div",{className:"ml-auto text-xs text-gray-600",children:[h," knowledge units"]})]}),(0,b.jsxs)("div",{className:"flex-1 overflow-y-auto",children:["dashboard"===a&&(0,b.jsx)(v,{}),"graph"===a&&(0,b.jsx)(af,{}),"knowledge"===a&&(0,b.jsx)(o,{}),"curation"===a&&(0,b.jsx)(E,{}),"marketplace"===a&&(0,b.jsx)(J,{}),"benchmark"===a&&(0,b.jsx)(ae,{}),"settings"===a&&(0,b.jsx)("div",{className:"p-6 max-w-2xl space-y-8",children:(0,b.jsx)(p.CortexSettings,{})})]})]})}a.s(["default",()=>ag],417835)}];
1
+ module.exports=[417835,a=>{"use strict";var b=a.i(187924),c=a.i(572131),d=a.i(819721),e=a.i(119032),f=a.i(587532),g=a.i(405784),h=a.i(767552),i=a.i(781560),j=a.i(73570);let k={decision:"bg-blue-500/20 text-blue-400",preference:"bg-pink-500/20 text-pink-400",pattern:"bg-green-500/20 text-green-400",error_fix:"bg-amber-500/20 text-amber-400",context:"bg-gray-500/20 text-gray-400",code_pattern:"bg-cyan-500/20 text-cyan-400",command:"bg-orange-500/20 text-orange-400",conversation:"bg-slate-500/20 text-slate-400",summary:"bg-violet-500/20 text-violet-400"},l={public:"bg-green-500/20 text-green-400",internal:"bg-indigo-500/20 text-indigo-400",restricted:"bg-amber-500/20 text-amber-400",confidential:"bg-red-500/20 text-red-400"},m={debugging:"text-red-400",architecture:"text-blue-400",onboarding:"text-green-400",policy:"text-purple-400","how-to":"text-amber-400",review:"text-pink-400",security:"text-red-500",general:"text-gray-400"};function n({unit:a,onDelete:c,compact:d}){var f;let g,h=k[a.type]||k.context,m=(f=a.created,0===(g=Math.floor((Date.now()-new Date(f).getTime())/864e5))?"today":1===g?"1d ago":g<30?`${g}d ago`:g<365?`${Math.floor(g/30)}mo ago`:`${Math.floor(g/365)}y ago`),n=(a.contradiction_refs?.length??0)>0,o=a.evidence_score??a.confidence,p=null!=a.evidence_score?`${o.toFixed(2)} evidence`:`${Math.round(100*o)}%`,q=async()=>{await fetch((0,e.api)(`/api/cortex/knowledge/${a.id}`),{method:"DELETE"}),c?.(a.id)};return(0,b.jsxs)("div",{className:"group border border-white/5 rounded-lg p-3 hover:border-white/10 transition-colors",children:[(0,b.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,b.jsxs)("div",{className:"flex items-center gap-1 flex-wrap",children:[(0,b.jsx)("span",{className:`text-[10px] px-1.5 py-0.5 rounded font-medium ${h}`,children:a.type.replace("_"," ")}),a.sensitivity&&(0,b.jsx)("span",{className:`text-[10px] px-1.5 py-0.5 rounded font-medium ${l[a.sensitivity]||l.internal}`,children:a.sensitivity}),a.scope&&(0,b.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded font-medium bg-purple-500/10 text-purple-400",children:a.scope.level}),(a.stale_score??0)>.3&&(0,b.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded font-medium bg-amber-500/20 text-amber-400",children:"stale"}),n&&(0,b.jsxs)("span",{className:"text-[10px] px-1.5 py-0.5 rounded font-medium bg-amber-500/20 text-amber-400 flex items-center gap-0.5",children:[(0,b.jsx)(j.AlertTriangle,{className:"w-2.5 h-2.5"})," contested"]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2 text-[10px] text-gray-500 shrink-0",children:[(0,b.jsx)("span",{children:m}),c&&(0,b.jsx)("button",{onClick:q,className:"opacity-0 group-hover:opacity-100 transition-opacity text-red-400 hover:text-red-300",children:(0,b.jsx)(i.Trash2,{className:"w-3 h-3"})})]})]}),(0,b.jsx)("p",{className:"text-xs text-gray-300 mt-1.5 leading-relaxed line-clamp-3",children:a.text}),!d&&a.origin&&(0,b.jsxs)("div",{className:"flex items-center gap-1.5 mt-1.5 text-[10px] text-gray-500 flex-wrap",children:[(0,b.jsxs)("span",{children:["by ",a.origin.creator_entity_id.replace("person-","")]}),(0,b.jsx)("span",{children:"·"}),(0,b.jsxs)("span",{children:["via ",a.origin.source_type.replace("_"," ")]}),(a.corroborations??0)>0&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("span",{children:"·"}),(0,b.jsxs)("span",{className:"text-green-400",children:[a.corroborations," corr."]})]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2 mt-2",children:[(0,b.jsx)("div",{className:"flex-1 h-1 bg-white/5 rounded-full overflow-hidden",children:(0,b.jsx)("div",{className:"h-full bg-purple-500/50 rounded-full",style:{width:`${Math.round(100*o)}%`}})}),(0,b.jsx)("span",{className:"text-[10px] text-gray-500 tabular-nums",children:p})]})]})}function o(){let[a,d]=(0,c.useState)(""),[i,j]=(0,c.useState)([]),[l,o]=(0,c.useState)(!1),[p,q]=(0,c.useState)(!1),[r,s]=(0,c.useState)(""),[t,u]=(0,c.useState)(null),[v,w]=(0,c.useState)(!1),x=async()=>{if(r.trim()){w(!0);try{let a=await fetch((0,e.api)(`/api/cortex/context?q=${encodeURIComponent(r)}&limit=5`));a.ok&&u(await a.json())}catch{}w(!1)}},y=(0,c.useCallback)(async a=>{o(!0);try{let b=new URLSearchParams({limit:"30"});a&&b.set("q",a);let c=await fetch((0,e.api)(`/api/cortex/search?${b}`));c.ok&&j((await c.json()).results||[])}catch{}o(!1)},[]);(0,c.useEffect)(()=>{y()},[y]);let z=a=>j(b=>b.filter(b=>b.id!==a));return(0,b.jsxs)("div",{className:"flex flex-col h-full",children:[(0,b.jsx)("div",{className:"p-4 border-b border-white/5",children:(0,b.jsxs)("div",{className:"relative max-w-md",children:[(0,b.jsx)(f.Search,{className:"absolute left-3 top-2.5 w-4 h-4 text-gray-500"}),(0,b.jsx)("input",{value:a,onChange:a=>d(a.target.value),onKeyDown:b=>"Enter"===b.key&&y(a.trim()||void 0),placeholder:"Search knowledge...",className:"w-full pl-9 pr-4 py-2 text-sm bg-white/5 border border-white/10 rounded-lg text-gray-300 placeholder-gray-600 focus:outline-none focus:border-purple-500/50"})]})}),(0,b.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:(0,b.jsxs)("div",{className:"max-w-2xl space-y-2",children:[l&&(0,b.jsx)("p",{className:"text-sm text-gray-500 text-center py-8",children:"Loading..."}),!l&&0===i.length&&(0,b.jsx)("p",{className:"text-sm text-gray-500 text-center py-8",children:"No knowledge found"}),i.map(a=>(0,b.jsx)(n,{unit:a,onDelete:z},a.id)),(0,b.jsxs)("div",{className:"border-t border-white/5 mt-4 pt-4",children:[(0,b.jsxs)("button",{onClick:()=>q(!p),className:"flex items-center gap-2 text-xs text-gray-500 hover:text-gray-300 mb-3",children:[p?(0,b.jsx)(h.ChevronUp,{className:"w-3 h-3"}):(0,b.jsx)(g.ChevronDown,{className:"w-3 h-3"}),"Query Analyzer"]}),p&&(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"flex gap-3 mb-4",children:[(0,b.jsxs)("div",{className:"flex-1 relative",children:[(0,b.jsx)(f.Search,{className:"absolute left-3 top-2.5 w-4 h-4 text-gray-500"}),(0,b.jsx)("input",{value:r,onChange:a=>s(a.target.value),onKeyDown:a=>"Enter"===a.key&&x(),placeholder:"Enter a query to analyze...",className:"w-full pl-9 pr-4 py-2 text-sm bg-white/5 border border-white/10 rounded-lg text-gray-300 placeholder-gray-600 focus:outline-none focus:border-purple-500/50"})]}),(0,b.jsx)("button",{onClick:x,disabled:v,className:"px-5 py-2 text-sm bg-purple-600 hover:bg-purple-500 text-white rounded-lg disabled:opacity-50",children:v?"Analyzing...":"Analyze"})]}),!t&&!v&&(0,b.jsx)("p",{className:"text-sm text-gray-600 text-center py-8",children:"Enter a query to see how the Context Engine processes it"}),t&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("div",{className:"grid grid-cols-3 gap-3 mb-4",children:[(0,b.jsxs)("div",{className:"bg-white/[0.02] border border-white/5 rounded-lg p-3",children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-600 uppercase mb-1",children:"Intent"}),(0,b.jsx)("div",{className:`text-lg font-semibold ${m[t.intent?.intent]||"text-gray-400"}`,children:t.intent?.intent||"?"}),(0,b.jsxs)("div",{className:"text-[10px] text-gray-600",children:["confidence: ",(t.intent?.confidence??0).toFixed(2)]})]}),(0,b.jsxs)("div",{className:"bg-white/[0.02] border border-white/5 rounded-lg p-3",children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-600 uppercase mb-1",children:"Entities"}),(0,b.jsxs)("div",{className:"flex flex-wrap gap-1 mt-1",children:[(t.entities||[]).map((a,c)=>(0,b.jsxs)("span",{className:"text-[10px] px-1.5 py-0.5 bg-white/5 border border-white/10 rounded text-gray-300",children:[a.entity?.type,":",a.entity?.name]},c)),(!t.entities||0===t.entities.length)&&(0,b.jsx)("span",{className:"text-[10px] text-gray-600",children:"none detected"})]})]}),(0,b.jsxs)("div",{className:"bg-white/[0.02] border border-white/5 rounded-lg p-3",children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-600 uppercase mb-1",children:"Timing"}),(0,b.jsxs)("div",{className:"text-lg font-semibold text-green-400",children:[t.timing?.totalMs??"?","ms"]}),(0,b.jsxs)("div",{className:"text-[10px] text-gray-600",children:["intent ",t.timing?.intentMs,"ms · search ",t.timing?.searchMs,"ms"]})]})]}),(0,b.jsxs)("div",{className:"mb-4",children:[(0,b.jsxs)("div",{className:"text-[10px] text-gray-600 uppercase mb-2",children:["Results (",(t.results||[]).length,")"]}),(0,b.jsx)("div",{className:"space-y-1",children:(t.results||[]).map((a,c)=>(0,b.jsxs)("div",{className:"flex items-center gap-2 bg-white/[0.02] border border-white/5 rounded-lg px-3 py-2",children:[(0,b.jsx)("span",{className:`text-[10px] px-1.5 py-0.5 rounded font-medium ${k[a.type]||k.context}`,children:a.type?.replace("_"," ")}),(0,b.jsx)("span",{className:"text-xs text-gray-300 truncate flex-1",children:a.text}),(0,b.jsx)("span",{className:"text-[10px] text-gray-600 tabular-nums shrink-0",children:(a.relevance_score??0).toFixed(3)})]},c))})]})]})]})]})]})})]})}var p=a.i(565870);function q(a){return a<1024?`${a} B`:a<1048576?`${(a/1024).toFixed(1)} KB`:a<0x40000000?`${(a/1048576).toFixed(1)} MB`:`${(a/0x40000000).toFixed(2)} GB`}function r({items:a,maxValue:c}){return(0,b.jsx)("div",{className:"space-y-1.5",children:a.map(a=>(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:"text-[10px] text-gray-500 w-24 text-right truncate",title:a.label,children:a.label}),(0,b.jsx)("div",{className:"flex-1 h-3 bg-white/[0.03] rounded-full overflow-hidden",children:(0,b.jsx)("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${Math.max(2,a.value/Math.max(c,1)*100)}%`,backgroundColor:a.color}})}),(0,b.jsx)("span",{className:"text-[10px] text-gray-400 w-14 text-right tabular-nums",children:a.value.toLocaleString()})]},a.label))})}function s({label:a,value:c,sub:d,color:e}){return(0,b.jsxs)("div",{className:"bg-white/[0.02] border border-white/[0.06] rounded-lg p-3",children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-500 uppercase tracking-wider mb-1",children:a}),(0,b.jsx)("div",{className:`text-lg font-semibold tabular-nums ${e||"text-white"}`,children:c}),d&&(0,b.jsx)("div",{className:"text-[10px] text-gray-600 mt-0.5",children:d})]})}let t=["#7c3aed","#06b6d4","#10b981","#f59e0b","#ef4444","#8b5cf6","#14b8a6","#22c55e","#eab308","#f97316"],u={decision:"#3b82f6",pattern:"#22c55e",preference:"#ec4899",error_fix:"#f59e0b",context:"#6b7280",code_pattern:"#06b6d4",command:"#f97316",conversation:"#64748b",summary:"#8b5cf6"};function v(){let[a,d]=(0,c.useState)(null),[f,g]=(0,c.useState)(!0);if((0,c.useEffect)(()=>{fetch((0,e.api)("/api/cortex/status")).then(a=>a.json()).then(a=>{a.enabled&&d(a)}).catch(()=>{}).finally(()=>g(!1))},[]),f)return(0,b.jsx)("div",{className:"p-6 text-sm text-gray-500",children:"Loading dashboard..."});if(!a)return(0,b.jsx)("div",{className:"p-6 text-sm text-gray-500",children:"Cortex is not active."});let h=Object.entries(a.lobes).sort((a,b)=>b[1].count-a[1].count),i=Math.max(...h.map(([,a])=>a.count),1),j=Math.max(...h.map(([,a])=>a.sizeBytes),1),k=a.usage,m=k?.distillation;return(0,b.jsxs)("div",{className:"p-6 max-w-4xl space-y-6",children:[(0,b.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[(0,b.jsx)(s,{label:"Knowledge Units",value:a.totalCount.toLocaleString(),sub:`across ${h.length} lobes`,color:"text-purple-400"}),(0,b.jsx)(s,{label:"Storage",value:q(a.totalSizeBytes),sub:`${a.embedding_provider} (${a.embedding_dimensions}d)`}),(0,b.jsx)(s,{label:"Coverage",value:a.quality?a.quality.coverage_score.toFixed(2):"—",sub:a.quality?`${Math.round(100*a.quality.coverage_score)}% distilled`:"no data",color:a.quality?a.quality.coverage_score>.7?"text-green-400":a.quality.coverage_score>.3?"text-amber-400":"text-red-400":"text-gray-500"}),(0,b.jsx)(s,{label:"Distillation",value:m?`$${m.estimated_cost_usd.toFixed(2)}`:"Off",sub:m?`${m.calls.toLocaleString()} calls`:a.distillation?"No API key":"Disabled",color:m?"text-amber-400":"text-gray-500"})]}),(0,b.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[(0,b.jsxs)("div",{className:"bg-white/[0.02] border border-white/[0.06] rounded-lg p-4",children:[(0,b.jsx)("h3",{className:"text-xs font-medium text-gray-400 mb-3",children:"Knowledge by Lobe"}),(0,b.jsx)(r,{items:h.map(([a,b],c)=>({label:b.label||a,value:b.count,color:t[c%t.length]})),maxValue:i})]}),(0,b.jsxs)("div",{className:"bg-white/[0.02] border border-white/[0.06] rounded-lg p-4",children:[(0,b.jsx)("h3",{className:"text-xs font-medium text-gray-400 mb-3",children:"Storage by Lobe"}),(0,b.jsx)(r,{items:h.map(([a,b],c)=>({label:b.label||a,value:b.sizeBytes,color:t[c%t.length]})),maxValue:j}),(0,b.jsxs)("div",{className:"mt-2 flex justify-between text-[10px] text-gray-600",children:[(0,b.jsxs)("span",{children:["Smallest: ",q(Math.min(...h.map(([,a])=>a.sizeBytes)))]}),(0,b.jsxs)("span",{children:["Total: ",q(a.totalSizeBytes)]})]})]})]}),a.quality&&(0,b.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[(0,b.jsxs)("div",{className:"bg-white/[0.02] border border-white/[0.06] rounded-lg p-4",children:[(0,b.jsx)("h3",{className:"text-xs font-medium text-gray-400 mb-3",children:"Type Distribution"}),(0,b.jsx)(r,{items:Object.entries(a.quality.type_distribution).sort((a,b)=>b[1]-a[1]).map(([a,b])=>({label:a.replace("_"," "),value:b,color:u[a]||"#7c3aed"})),maxValue:Math.max(...Object.values(a.quality.type_distribution),1)})]}),(0,b.jsxs)("div",{className:"bg-white/[0.02] border border-white/[0.06] rounded-lg p-4",children:[(0,b.jsx)("h3",{className:"text-xs font-medium text-gray-400 mb-3",children:"Lobe Health"}),(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsxs)("div",{className:"flex justify-between text-[11px]",children:[(0,b.jsx)("span",{className:"text-gray-500",children:"Stale units"}),(0,b.jsx)("span",{className:a.quality.stale_count>10?"text-amber-400":"text-gray-300",children:a.quality.stale_count})]}),(0,b.jsxs)("div",{className:"flex justify-between text-[11px]",children:[(0,b.jsx)("span",{className:"text-gray-500",children:"Avg confidence"}),(0,b.jsx)("span",{className:"text-gray-300",children:a.quality.avg_confidence.toFixed(2)})]}),a.quality.top_accessed.length>0&&(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-500 mb-1",children:"Top accessed"}),(0,b.jsxs)("div",{className:"text-[11px] text-gray-400 truncate",children:["“",a.quality.top_accessed[0].text,"”"]})]}),a.quality.sensitivity_counts&&(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-500 mb-1",children:"Sensitivity"}),(0,b.jsx)("div",{className:"flex flex-wrap gap-1",children:Object.entries(a.quality.sensitivity_counts).map(([a,c])=>(0,b.jsxs)("span",{className:`text-[9px] px-1.5 py-0.5 rounded ${l[a]||l.internal}`,children:[c," ",a]},a))})]})]})]})]}),m&&(0,b.jsxs)("div",{className:"bg-white/[0.02] border border-white/[0.06] rounded-lg p-4",children:[(0,b.jsx)("h3",{className:"text-xs font-medium text-gray-400 mb-3",children:"Distillation Activity"}),(0,b.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-500",children:"API Calls"}),(0,b.jsx)("div",{className:"text-sm font-medium text-white tabular-nums",children:m.calls.toLocaleString()})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-500",children:"Input Tokens"}),(0,b.jsxs)("div",{className:"text-sm font-medium text-white tabular-nums",children:[(m.input_tokens/1e3).toFixed(1),"K"]})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-500",children:"Output Tokens"}),(0,b.jsxs)("div",{className:"text-sm font-medium text-white tabular-nums",children:[(m.output_tokens/1e3).toFixed(1),"K"]})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-500",children:"Estimated Cost"}),(0,b.jsxs)("div",{className:"text-sm font-medium text-amber-400 tabular-nums",children:["$",m.estimated_cost_usd.toFixed(4)]})]})]}),m.last_updated&&(0,b.jsxs)("div",{className:"mt-2 text-[10px] text-gray-600",children:["Last distillation: ",new Date(m.last_updated).toLocaleString()]}),k.by_model&&Object.keys(k.by_model).length>0&&(0,b.jsxs)("div",{className:"mt-3 border-t border-white/[0.04] pt-3",children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-500 mb-2",children:"By Model"}),Object.entries(k.by_model).map(([a,c])=>(0,b.jsxs)("div",{className:"flex items-center justify-between text-[10px]",children:[(0,b.jsx)("span",{className:"text-gray-400 font-mono",children:a}),(0,b.jsxs)("span",{className:"text-gray-500",children:[c.calls," calls · $",c.estimated_cost_usd.toFixed(4)]})]},a))]})]}),(0,b.jsxs)("div",{className:"bg-white/[0.02] border border-white/[0.06] rounded-lg p-4",children:[(0,b.jsx)("h3",{className:"text-xs font-medium text-gray-400 mb-3",children:"System"}),(0,b.jsxs)("div",{className:"grid grid-cols-2 gap-x-8 gap-y-1.5 text-[11px]",children:[(0,b.jsxs)("div",{className:"flex justify-between",children:[(0,b.jsx)("span",{className:"text-gray-500",children:"Status"}),(0,b.jsx)("span",{className:"text-green-400",children:a.status})]}),(0,b.jsxs)("div",{className:"flex justify-between",children:[(0,b.jsx)("span",{className:"text-gray-500",children:"Embedding"}),(0,b.jsxs)("span",{className:"text-gray-300",children:[a.embedding_provider," (",a.embedding_dimensions,"d)"]})]}),(0,b.jsxs)("div",{className:"flex justify-between",children:[(0,b.jsx)("span",{className:"text-gray-500",children:"Distillation"}),(0,b.jsx)("span",{className:a.distillation?"text-green-400":"text-gray-600",children:a.distillation?"Enabled":"Disabled"})]}),(0,b.jsxs)("div",{className:"flex justify-between",children:[(0,b.jsx)("span",{className:"text-gray-500",children:"Lobes"}),(0,b.jsxs)("span",{className:"text-gray-300",children:[h.length," active"]})]})]})]})]})}var w=a.i(773320),x=a.i(839761),y=a.i(669520),z=a.i(883706);let A=(0,z.default)("package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);var B=a.i(596221);let C=[{id:"seed",label:"Seed",icon:(0,b.jsx)(w.Upload,{className:"w-3.5 h-3.5"})},{id:"assess",label:"Assess",icon:(0,b.jsx)(x.BarChart3,{className:"w-3.5 h-3.5"})},{id:"review",label:"Review",icon:(0,b.jsx)(f.Search,{className:"w-3.5 h-3.5"})},{id:"refine",label:"Refine",icon:(0,b.jsx)(y.RefreshCw,{className:"w-3.5 h-3.5"})},{id:"publish",label:"Publish",icon:(0,b.jsx)(A,{className:"w-3.5 h-3.5"})}],D={decision:"#3b82f6",pattern:"#22c55e",preference:"#ec4899",error_fix:"#f59e0b",context:"#6b7280",code_pattern:"#06b6d4",command:"#f97316",conversation:"#64748b",summary:"#8b5cf6"};function E(){let a,[d,g]=(0,c.useState)([]),[h,i]=(0,c.useState)(""),[j,l]=(0,c.useState)("seed"),[m,n]=(0,c.useState)(""),[o,p]=(0,c.useState)(""),[q,r]=(0,c.useState)("auto"),[s,t]=(0,c.useState)(""),[u,v]=(0,c.useState)(!0),[z,E]=(0,c.useState)(!1),[F,G]=(0,c.useState)(null),[H,I]=(0,c.useState)(!1),[J,K]=(0,c.useState)(null),[L,M]=(0,c.useState)(""),[N,O]=(0,c.useState)("25"),[P,Q]=(0,c.useState)(!1),[R,S]=(0,c.useState)(null),[T,U]=(0,c.useState)(""),[V,W]=(0,c.useState)({decisions:!0,patterns:!0,preferences:!0,error_fixes:!0}),[X,Y]=(0,c.useState)(!1),[Z,$]=(0,c.useState)(null),[_,aa]=(0,c.useState)(""),[ab,ac]=(0,c.useState)(""),[ad,ae]=(0,c.useState)(""),[af,ag]=(0,c.useState)(""),[ah,ai]=(0,c.useState)("1.0.0"),[aj,ak]=(0,c.useState)("MIT"),[al,am]=(0,c.useState)(!1),[an,ao]=(0,c.useState)(null),ap=(0,c.useCallback)(()=>{G(null),K(null),S(null),$(null),ao(null),n("")},[]);(0,c.useEffect)(()=>{fetch((0,e.api)("/api/workspaces")).then(a=>a.json()).then(a=>{g(a),a.length>0&&i(a[0].id)}).catch(()=>{})},[]);let aq=async()=>{if(o.trim()&&h){E(!0),n(""),G(null);try{let a=await fetch((0,e.api)("/api/cortex/curation/seed"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:o,format:q,source_ref:s||void 0,workspace_id:h,distill:u})}),b=await a.json();if(!a.ok)throw Error(b.error||b.message||"Seed failed");G(b)}catch(a){n(a instanceof Error?a.message:"Seed failed")}finally{E(!1)}}},ar=async()=>{if(h){I(!0),n(""),K(null);try{let a=await fetch((0,e.api)(`/api/cortex/curation/assess?workspace_id=${encodeURIComponent(h)}`)),b=await a.json();if(!a.ok)throw Error(b.error||b.message||"Assessment failed");K(b)}catch(a){n(a instanceof Error?a.message:"Assessment failed")}finally{I(!1)}}},as=async()=>{if(h&&L.trim()){Q(!0),n(""),S(null);try{let a=new URLSearchParams({workspace_id:h,topic:L.trim(),limit:N}),b=await fetch((0,e.api)(`/api/cortex/curation/review?${a}`)),c=await b.json();if(!b.ok)throw Error(c.error||c.message||"Review failed");S(c)}catch(a){n(a instanceof Error?a.message:"Review failed")}finally{Q(!1)}}},at=async()=>{if(h){Y(!0),n(""),$(null);try{let a=Object.keys(V).filter(a=>V[a]),b=await fetch((0,e.api)("/api/cortex/curation/refine"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace_id:h,domain_context:T||void 0,types:a})}),c=await b.json();if(!b.ok)throw Error(c.error||c.message||"Refine failed");$(c)}catch(a){n(a instanceof Error?a.message:"Refine failed")}finally{Y(!1)}}},au=async()=>{if(h&&_.trim()){am(!0),n(""),ao(null);try{let a=await fetch((0,e.api)("/api/cortex/curation/publish"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace_id:h,name:_,author:ab||void 0,description:ad||void 0,tags:af?af.split(",").map(a=>a.trim()).filter(Boolean):[],version:ah,license:aj})}),b=await a.json();if(!a.ok)throw Error(b.error||b.message||"Publish failed");ao(b)}catch(a){n(a instanceof Error?a.message:"Publish failed")}finally{am(!1)}}},av="w-full px-3 py-2 text-sm bg-white/5 border border-white/10 rounded-lg text-gray-300 placeholder-gray-600 focus:outline-none focus:border-purple-500/50",aw="text-[11px] text-gray-500 mb-1 block",ax="bg-white/[0.02] border border-white/[0.06] rounded-lg p-4";return(0,b.jsxs)("div",{className:"flex flex-col h-full",children:[(0,b.jsxs)("div",{className:"px-4 pt-4 pb-3 border-b border-white/5",children:[(0,b.jsx)("label",{className:aw,children:"Workspace"}),(0,b.jsxs)("select",{value:h,onChange:a=>{i(a.target.value),ap()},className:`${av} max-w-xs`,children:[0===d.length&&(0,b.jsx)("option",{value:"",disabled:!0,children:"No workspaces found"}),d.map(a=>(0,b.jsx)("option",{value:a.id,children:a.name},a.id))]})]}),(0,b.jsx)("div",{className:"px-4 py-3 border-b border-white/5",children:(0,b.jsx)("div",{className:"flex items-center",children:C.map((a,c)=>(0,b.jsxs)("div",{className:"flex items-center",children:[(0,b.jsxs)("button",{onClick:()=>{l(a.id),ap()},className:`flex items-center gap-1.5 px-3 py-1.5 rounded-full text-xs font-medium border transition-colors ${j===a.id?"bg-purple-500/20 border-purple-500/30 text-purple-400":"bg-white/[0.03] border-white/[0.06] text-gray-500 hover:text-gray-300 hover:bg-white/[0.06]"}`,children:[a.icon,a.label]}),c<C.length-1&&(0,b.jsx)("div",{className:"w-8 h-px bg-white/[0.06]"})]},a.id))})}),(0,b.jsx)("div",{className:"flex-1 overflow-y-auto p-4",children:(0,b.jsxs)("div",{className:"max-w-2xl space-y-4",children:[m&&(0,b.jsx)("div",{className:"bg-red-500/10 border border-red-500/20 text-red-400 rounded-lg px-4 py-2.5 text-sm",children:m}),"seed"===j&&(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:aw,children:"Document content"}),(0,b.jsx)("textarea",{value:o,onChange:a=>p(a.target.value),placeholder:"Paste document content here...",rows:8,className:av})]}),(0,b.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:aw,children:"Format"}),(0,b.jsxs)("select",{value:q,onChange:a=>r(a.target.value),className:av,children:[(0,b.jsx)("option",{value:"auto",children:"Auto-detect"}),(0,b.jsx)("option",{value:"markdown",children:"Markdown"}),(0,b.jsx)("option",{value:"plaintext",children:"Plain text"}),(0,b.jsx)("option",{value:"csv",children:"CSV"})]})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:aw,children:"Source reference"}),(0,b.jsx)("input",{value:s,onChange:a=>t(a.target.value),placeholder:"e.g. docs/guide.md",className:av})]})]}),(0,b.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[(0,b.jsx)("input",{type:"checkbox",checked:u,onChange:a=>v(a.target.checked),className:"rounded border-white/20 bg-white/5 accent-purple-500"}),(0,b.jsx)("span",{className:"text-xs text-gray-400",children:"Distill after seeding"})]}),(0,b.jsxs)("button",{onClick:aq,disabled:z||!o.trim()||!h,className:"flex items-center gap-2 px-4 py-2 text-sm bg-purple-600 hover:bg-purple-500 text-white rounded-lg disabled:opacity-50 transition-colors",children:[z?(0,b.jsx)(B.Loader2,{className:"w-4 h-4 animate-spin"}):(0,b.jsx)(w.Upload,{className:"w-4 h-4"}),"Seed Documents"]}),F&&(0,b.jsxs)("div",{className:ax,children:[(0,b.jsx)("div",{className:"text-xs font-medium text-gray-400 mb-3",children:"Seed Results"}),(0,b.jsxs)("div",{className:"grid grid-cols-3 gap-3",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-500 uppercase mb-0.5",children:"Chunks Created"}),(0,b.jsx)("div",{className:"text-lg font-semibold text-green-400 tabular-nums",children:F.chunksCreated})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-500 uppercase mb-0.5",children:"Chunks Skipped"}),(0,b.jsx)("div",{className:"text-lg font-semibold text-amber-400 tabular-nums",children:F.chunksSkipped})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-500 uppercase mb-0.5",children:"Errors"}),(0,b.jsx)("div",{className:`text-lg font-semibold tabular-nums ${F.errors.length>0?"text-red-400":"text-gray-500"}`,children:F.errors.length})]})]}),F.errors.length>0&&(0,b.jsx)("div",{className:"mt-3 space-y-1",children:F.errors.map((a,c)=>(0,b.jsx)("div",{className:"text-xs text-red-400/80",children:a},c))})]})]}),"assess"===j&&(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsxs)("button",{onClick:ar,disabled:H||!h,className:"flex items-center gap-2 px-4 py-2 text-sm bg-purple-600 hover:bg-purple-500 text-white rounded-lg disabled:opacity-50 transition-colors",children:[H?(0,b.jsx)(B.Loader2,{className:"w-4 h-4 animate-spin"}):(0,b.jsx)(x.BarChart3,{className:"w-4 h-4"}),"Run Assessment"]}),J&&(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsxs)("div",{className:"grid grid-cols-3 gap-3",children:[(0,b.jsxs)("div",{className:ax,children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-500 uppercase mb-1",children:"Coverage Score"}),(0,b.jsx)("div",{className:`text-2xl font-semibold tabular-nums ${(a=J.coverage_score)>.7?"text-green-400":a>.3?"text-amber-400":"text-red-400"}`,children:J.coverage_score.toFixed(2)}),(0,b.jsxs)("div",{className:"text-[10px] text-gray-600 mt-0.5",children:[Math.round(100*J.coverage_score),"% covered"]})]}),(0,b.jsxs)("div",{className:ax,children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-500 uppercase mb-1",children:"Total Units"}),(0,b.jsx)("div",{className:"text-2xl font-semibold text-white tabular-nums",children:J.total_units.toLocaleString()})]}),(0,b.jsxs)("div",{className:ax,children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-500 uppercase mb-1",children:"Stale Count"}),(0,b.jsx)("div",{className:`text-2xl font-semibold tabular-nums ${J.stale_count>10?"text-amber-400":"text-gray-300"}`,children:J.stale_count})]})]}),J.type_distribution&&Object.keys(J.type_distribution).length>0&&(0,b.jsxs)("div",{className:ax,children:[(0,b.jsx)("div",{className:"text-xs font-medium text-gray-400 mb-3",children:"Type Distribution"}),(0,b.jsx)("div",{className:"space-y-1.5",children:Object.entries(J.type_distribution).sort((a,b)=>b[1]-a[1]).map(([a,c])=>{let d=Math.max(...Object.values(J.type_distribution),1);return(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:"text-[10px] text-gray-500 w-24 text-right truncate",children:a.replace("_"," ")}),(0,b.jsx)("div",{className:"flex-1 h-3 bg-white/[0.03] rounded-full overflow-hidden",children:(0,b.jsx)("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${Math.max(2,c/d*100)}%`,backgroundColor:D[a]||"#7c3aed"}})}),(0,b.jsx)("span",{className:"text-[10px] text-gray-400 w-10 text-right tabular-nums",children:c})]},a)})})]})]})]}),"review"===j&&(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsxs)("div",{className:"flex gap-3",children:[(0,b.jsxs)("div",{className:"flex-1",children:[(0,b.jsx)("label",{className:aw,children:"Topic filter"}),(0,b.jsx)("input",{value:L,onChange:a=>M(a.target.value),onKeyDown:a=>"Enter"===a.key&&as(),placeholder:"Filter by topic (optional)",className:av})]}),(0,b.jsxs)("div",{className:"w-28",children:[(0,b.jsx)("label",{className:aw,children:"Limit"}),(0,b.jsxs)("select",{value:N,onChange:a=>O(a.target.value),className:av,children:[(0,b.jsx)("option",{value:"10",children:"10"}),(0,b.jsx)("option",{value:"25",children:"25"}),(0,b.jsx)("option",{value:"50",children:"50"})]})]})]}),(0,b.jsxs)("button",{onClick:as,disabled:P||!h||!L.trim(),className:"flex items-center gap-2 px-4 py-2 text-sm bg-purple-600 hover:bg-purple-500 text-white rounded-lg disabled:opacity-50 transition-colors",children:[P?(0,b.jsx)(B.Loader2,{className:"w-4 h-4 animate-spin"}):(0,b.jsx)(f.Search,{className:"w-4 h-4"}),"Review"]}),R&&(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsxs)("div",{className:"text-[11px] text-gray-500",children:[R.total_matches," match",1!==R.total_matches?"es":""," for “",R.topic,"”"]}),Object.entries(R.by_type).map(([a,c])=>(0,b.jsxs)("details",{open:!0,className:ax,children:[(0,b.jsxs)("summary",{className:"flex items-center gap-2 cursor-pointer list-none",children:[(0,b.jsx)("span",{className:`text-[10px] px-1.5 py-0.5 rounded font-medium ${k[a]||k.context}`,children:a.replace("_"," ")}),(0,b.jsxs)("span",{className:"text-xs text-gray-500",children:[c.length," unit",1!==c.length?"s":""]})]}),(0,b.jsx)("div",{className:"mt-3 space-y-2",children:c.map((a,c)=>(0,b.jsxs)("div",{className:"bg-white/[0.02] border border-white/[0.04] rounded px-3 py-2",children:[(0,b.jsx)("div",{className:"text-xs text-gray-300 leading-relaxed",children:a.text}),(0,b.jsxs)("div",{className:"mt-1 text-[10px] text-gray-600",children:["confidence: ",a.confidence?.toFixed(2)," · similarity: ",a.similarity?.toFixed(3)]})]},c))})]},a))]})]}),"refine"===j&&(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsx)("div",{className:"bg-amber-500/10 border border-amber-500/20 text-amber-400 rounded-lg px-4 py-2.5 text-xs leading-relaxed",children:"Refine uses LLM distillation and requires an API key configured in Cortex settings. Without a key, refinement will run in passthrough mode."}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:aw,children:"Domain context"}),(0,b.jsx)("textarea",{value:T,onChange:a=>U(a.target.value),placeholder:"Describe the domain or project context to guide distillation...",rows:4,className:av})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:aw,children:"Distillation passes"}),(0,b.jsx)("div",{className:"grid grid-cols-2 gap-2",children:Object.keys(V).map(a=>(0,b.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer select-none",children:[(0,b.jsx)("input",{type:"checkbox",checked:V[a],onChange:b=>W(c=>({...c,[a]:b.target.checked})),className:"rounded border-white/20 bg-white/5 accent-purple-500"}),(0,b.jsx)("span",{className:"text-xs text-gray-400 capitalize",children:a.replace("_"," ")})]},a))})]}),(0,b.jsxs)("button",{onClick:at,disabled:X||!h,className:"flex items-center gap-2 px-4 py-2 text-sm bg-purple-600 hover:bg-purple-500 text-white rounded-lg disabled:opacity-50 transition-colors",children:[X?(0,b.jsx)(B.Loader2,{className:"w-4 h-4 animate-spin"}):(0,b.jsx)(y.RefreshCw,{className:"w-4 h-4"}),"Refine Lobe"]}),Z&&(0,b.jsxs)("div",{className:ax,children:[(0,b.jsx)("div",{className:"text-xs font-medium text-gray-400 mb-3",children:"Refine Results"}),(0,b.jsxs)("div",{className:"grid grid-cols-3 gap-3",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-500 uppercase mb-0.5",children:"Source Units"}),(0,b.jsx)("div",{className:"text-lg font-semibold text-white tabular-nums",children:Z.source_units_found})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-500 uppercase mb-0.5",children:"Purged"}),(0,b.jsx)("div",{className:"text-lg font-semibold text-amber-400 tabular-nums",children:Z.distilled_purged})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-500 uppercase mb-0.5",children:"New Units"}),(0,b.jsx)("div",{className:"text-lg font-semibold text-green-400 tabular-nums",children:Z.new_units_created})]})]})]})]}),"publish"===j&&(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:aw,children:"Package name *"}),(0,b.jsx)("input",{value:_,onChange:a=>aa(a.target.value),placeholder:"my-knowledge-pack",className:av})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:aw,children:"Author"}),(0,b.jsx)("input",{value:ab,onChange:a=>ac(a.target.value),placeholder:"Your name or org",className:av})]})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:aw,children:"Description"}),(0,b.jsx)("textarea",{value:ad,onChange:a=>ae(a.target.value),placeholder:"Describe the knowledge pack...",rows:3,className:av})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:aw,children:"Tags (comma-separated)"}),(0,b.jsx)("input",{value:af,onChange:a=>ag(a.target.value),placeholder:"e.g. typescript, react, patterns",className:av})]}),(0,b.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:aw,children:"Version"}),(0,b.jsx)("input",{value:ah,onChange:a=>ai(a.target.value),placeholder:"1.0.0",className:av})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:aw,children:"License"}),(0,b.jsxs)("select",{value:aj,onChange:a=>ak(a.target.value),className:av,children:[(0,b.jsx)("option",{value:"MIT",children:"MIT"}),(0,b.jsx)("option",{value:"Apache-2.0",children:"Apache 2.0"}),(0,b.jsx)("option",{value:"GPL-3.0",children:"GPL 3.0"}),(0,b.jsx)("option",{value:"BSD-3-Clause",children:"BSD 3-Clause"}),(0,b.jsx)("option",{value:"CC-BY-4.0",children:"CC BY 4.0"}),(0,b.jsx)("option",{value:"Proprietary",children:"Proprietary"})]})]})]}),(0,b.jsxs)("button",{onClick:au,disabled:al||!_.trim()||!h,className:"flex items-center gap-2 px-4 py-2 text-sm bg-purple-600 hover:bg-purple-500 text-white rounded-lg disabled:opacity-50 transition-colors",children:[al?(0,b.jsx)(B.Loader2,{className:"w-4 h-4 animate-spin"}):(0,b.jsx)(A,{className:"w-4 h-4"}),"Publish to Marketplace"]}),an&&(0,b.jsxs)("div",{className:ax,children:[an.quality_warning&&(0,b.jsx)("div",{className:"mb-3 bg-amber-500/10 border border-amber-500/20 text-amber-400 rounded px-3 py-2 text-xs",children:an.quality_warning}),(0,b.jsx)("div",{className:"text-xs font-medium text-gray-400 mb-3",children:"Published"}),an.output_path&&(0,b.jsxs)("div",{className:"mb-2",children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-500 uppercase mb-0.5",children:"Output Path"}),(0,b.jsx)("div",{className:"text-xs text-gray-300 font-mono break-all",children:an.output_path})]}),an.pii_scrub&&(0,b.jsxs)("div",{className:"mt-2 pt-2 border-t border-white/[0.06]",children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-500 uppercase mb-1",children:"PII Scrub"}),(0,b.jsxs)("div",{className:"flex gap-4 text-[11px] text-gray-400",children:[(0,b.jsxs)("span",{children:[an.pii_scrub.records_checked.toLocaleString()," records checked"]}),(0,b.jsxs)("span",{children:[an.pii_scrub.fields_scrubbed.toLocaleString()," fields scrubbed"]})]})]})]})]})]})})]})}var F=a.i(296101);function G({filename:a,manifest:d,onImport:e}){let[f,i]=(0,c.useState)(!1),j=d.marketplace??{},k=j.name||a,l=d.version||j.version||"0.0.0",m=j.author||d.author||"Unknown",n=j.description||d.description||"",o=j.tags||d.tags||[],p=j.license||d.license||"",q="number"==typeof j.coverage_score?j.coverage_score:-1,r="number"==typeof d.unit_count?d.unit_count:Array.isArray(d.units)?d.units.length:0,s=j.preview||d.preview||"",t=q<0?"N/A":`${Math.round(100*q)}%`;return(0,b.jsxs)("div",{className:"border border-white/10 rounded-xl p-4 bg-white/[0.02] flex flex-col gap-3 hover:border-white/20 transition-colors",children:[(0,b.jsxs)("div",{className:"flex items-start gap-3",children:[(0,b.jsx)("div",{className:"shrink-0 w-9 h-9 rounded-lg bg-purple-500/10 flex items-center justify-center",children:(0,b.jsx)(A,{className:"w-4 h-4 text-purple-400"})}),(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,b.jsx)("span",{className:"text-sm font-semibold text-gray-100 truncate",children:k}),(0,b.jsxs)("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-white/5 text-gray-400 font-mono shrink-0",children:["v",l]})]}),(0,b.jsx)("p",{className:"text-[11px] text-gray-500 mt-0.5",children:m})]})]}),n&&(0,b.jsx)("p",{className:"text-xs text-gray-400 leading-relaxed line-clamp-2",children:n}),(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[o.map(a=>(0,b.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-white/5 text-gray-400 border border-white/5",children:a},a)),p&&(0,b.jsx)("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-purple-500/10 text-purple-400 border border-purple-500/20 font-medium",children:p})]}),(0,b.jsxs)("div",{className:"flex items-center gap-4 text-[11px]",children:[(0,b.jsxs)("div",{className:"flex items-center gap-1",children:[(0,b.jsx)("span",{className:"text-gray-600",children:"Coverage:"}),(0,b.jsx)("span",{className:`font-semibold tabular-nums ${q<0?"text-gray-500":q>.7?"text-green-400":q>.3?"text-amber-400":"text-red-400"}`,children:t})]}),(0,b.jsxs)("div",{className:"flex items-center gap-1",children:[(0,b.jsx)("span",{className:"text-gray-600",children:"Units:"}),(0,b.jsx)("span",{className:"text-gray-300 font-semibold tabular-nums",children:r})]})]}),s&&(0,b.jsxs)("div",{children:[(0,b.jsxs)("button",{onClick:()=>i(a=>!a),className:"flex items-center gap-1 text-[11px] text-gray-500 hover:text-gray-300 transition-colors",children:[f?(0,b.jsx)(h.ChevronUp,{className:"w-3 h-3"}):(0,b.jsx)(g.ChevronDown,{className:"w-3 h-3"}),f?"Hide preview":"Show preview"]}),f&&(0,b.jsx)("pre",{className:"mt-2 text-[10px] text-gray-400 bg-white/[0.03] border border-white/5 rounded-lg p-3 overflow-x-auto whitespace-pre-wrap break-all",children:s})]}),(0,b.jsx)("button",{onClick:()=>e(a,d),className:"w-full py-2 text-sm font-medium bg-purple-600 hover:bg-purple-500 text-white rounded-lg transition-colors",children:"Import"})]})}var H=a.i(633508);function I({filename:a,hasDomainContext:d,onClose:f,onComplete:g}){let[h,i]=(0,c.useState)("personal"),[j,k]=(0,c.useState)(""),[l,m]=(0,c.useState)([]),[n,o]=(0,c.useState)("append"),[p,q]=(0,c.useState)(!1),[r,s]=(0,c.useState)(!1),[t,u]=(0,c.useState)(!1),[v,w]=(0,c.useState)(null);(0,c.useEffect)(()=>{"workspace"===h&&fetch((0,e.api)("/api/workspaces")).then(a=>a.ok?a.json():null).then(a=>{let b=a?.workspaces??a??[];m(b),b.length>0&&!j&&k(b[0].id)}).catch(()=>{})},[h]);let x=async()=>{u(!0),w(null);try{let b={marketplace_file:a,target_layer:h,merge_strategy:n,re_embed:p};"workspace"===h&&j&&(b.workspace_id=j),d&&(b.apply_domain_context=r);let c=await fetch((0,e.api)("/api/cortex/import"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)});if(!c.ok){let a=await c.json().catch(()=>({}));throw Error(a?.error||`Request failed (${c.status})`)}g()}catch(a){w(a?.message||"Import failed")}finally{u(!1)}};return(0,b.jsx)("div",{className:"fixed inset-0 z-50 bg-black/60 flex items-center justify-center p-4",children:(0,b.jsxs)("div",{className:"bg-gray-900 border border-white/10 rounded-xl p-6 max-w-md w-full flex flex-col gap-5",children:[(0,b.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h2",{className:"text-sm font-semibold text-gray-100",children:"Import Pack"}),(0,b.jsx)("p",{className:"text-[11px] text-gray-500 mt-0.5 font-mono break-all",children:a})]}),(0,b.jsx)("button",{onClick:f,className:"shrink-0 text-gray-500 hover:text-gray-300 transition-colors","aria-label":"Close",children:(0,b.jsx)(H.X,{className:"w-4 h-4"})})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-[11px] text-gray-500 uppercase tracking-wide mb-2",children:"Target layer"}),(0,b.jsx)("div",{className:"flex gap-2",children:[{value:"personal",label:"Personal"},{value:"workspace",label:"Workspace"},{value:"team",label:"Team"}].map(a=>(0,b.jsx)("button",{onClick:()=>i(a.value),className:`flex-1 py-1.5 text-xs font-medium rounded-lg border transition-colors ${h===a.value?"bg-purple-600 border-purple-500 text-white":"bg-white/5 border-white/10 text-gray-400 hover:border-white/20 hover:text-gray-200"}`,children:a.label},a.value))})]}),"workspace"===h&&(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-[11px] text-gray-500 uppercase tracking-wide mb-2",children:"Workspace"}),0===l.length?(0,b.jsx)("p",{className:"text-xs text-gray-600",children:"No workspaces found"}):(0,b.jsx)("select",{value:j,onChange:a=>k(a.target.value),className:"w-full py-2 px-3 text-sm bg-white/5 border border-white/10 rounded-lg text-gray-300 focus:outline-none focus:border-purple-500/50",children:l.map(a=>(0,b.jsx)("option",{value:a.id,children:a.name},a.id))})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"text-[11px] text-gray-500 uppercase tracking-wide mb-2",children:"Merge strategy"}),(0,b.jsx)("div",{className:"flex gap-2",children:[{value:"append",label:"Append"},{value:"merge",label:"Merge"},{value:"replace",label:"Replace"}].map(a=>(0,b.jsx)("button",{onClick:()=>o(a.value),className:`flex-1 py-1.5 text-xs font-medium rounded-lg border transition-colors ${n===a.value?"bg-purple-600 border-purple-500 text-white":"bg-white/5 border-white/10 text-gray-400 hover:border-white/20 hover:text-gray-200"}`,children:a.label},a.value))})]}),(0,b.jsxs)("div",{className:"flex flex-col gap-2.5",children:[(0,b.jsxs)("label",{className:"flex items-center gap-2.5 cursor-pointer select-none group",children:[(0,b.jsx)("input",{type:"checkbox",checked:p,onChange:a=>q(a.target.checked),className:"w-3.5 h-3.5 accent-purple-500"}),(0,b.jsx)("span",{className:"text-xs text-gray-400 group-hover:text-gray-200 transition-colors",children:"Re-embed on import"})]}),d&&(0,b.jsxs)("label",{className:"flex items-center gap-2.5 cursor-pointer select-none group",children:[(0,b.jsx)("input",{type:"checkbox",checked:r,onChange:a=>s(a.target.checked),className:"w-3.5 h-3.5 accent-purple-500"}),(0,b.jsx)("span",{className:"text-xs text-gray-400 group-hover:text-gray-200 transition-colors",children:"Apply domain context"})]})]}),v&&(0,b.jsx)("p",{className:"text-xs text-red-400 bg-red-500/10 border border-red-500/20 rounded-lg px-3 py-2",children:v}),(0,b.jsxs)("button",{onClick:x,disabled:t,className:"w-full py-2 text-sm font-medium bg-purple-600 hover:bg-purple-500 text-white rounded-lg transition-colors disabled:opacity-50 flex items-center justify-center gap-2",children:[t&&(0,b.jsx)(B.Loader2,{className:"w-3.5 h-3.5 animate-spin"}),t?"Importing...":"Import"]})]})})}function J(){let[a,d]=(0,c.useState)([]),[f,g]=(0,c.useState)(""),[h,i]=(0,c.useState)(!1),[j,k]=(0,c.useState)(null),l=(0,c.useCallback)(async()=>{i(!0);try{let a=await fetch((0,e.api)("/api/cortex/marketplace/browse"));if(a.ok){let b=await a.json();d(b.packs??[]),b.directory&&g(b.directory)}}catch{}i(!1)},[]);(0,c.useEffect)(()=>{l()},[l]);let m=(a,b)=>{k({filename:a,manifest:b})},n=j?.manifest?.marketplace?.domain_context!=null||j?.manifest?.domain_context!=null;return(0,b.jsxs)("div",{className:"flex flex-col h-full",children:[(0,b.jsxs)("div",{className:"p-4 border-b border-white/5 flex items-center justify-between gap-3",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h2",{className:"text-sm font-semibold text-gray-100",children:"Marketplace"}),f&&(0,b.jsx)("p",{className:"text-[11px] text-gray-600 font-mono mt-0.5 truncate",children:f})]}),(0,b.jsxs)("button",{onClick:l,disabled:h,className:"flex items-center gap-1.5 text-xs text-gray-400 hover:text-gray-200 transition-colors disabled:opacity-50",children:[(0,b.jsx)(y.RefreshCw,{className:`w-3.5 h-3.5 ${h?"animate-spin":""}`}),"Refresh"]})]}),(0,b.jsxs)("div",{className:"flex-1 overflow-y-auto p-4",children:[h&&0===a.length&&(0,b.jsx)("p",{className:"text-sm text-gray-500 text-center py-12",children:"Loading..."}),!h&&0===a.length&&(0,b.jsxs)("div",{className:"flex flex-col items-center justify-center gap-3 py-16 text-gray-600",children:[(0,b.jsx)(F.FolderOpen,{className:"w-8 h-8"}),(0,b.jsx)("p",{className:"text-sm",children:"No .cortexpack files found"})]}),a.length>0&&(0,b.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:a.map(a=>(0,b.jsx)(G,{filename:a.filename,manifest:a.manifest,onImport:m},a.filename))})]}),j&&(0,b.jsx)(I,{filename:j.filename,hasDomainContext:n,onClose:()=>k(null),onComplete:()=>{k(null),l()}})]})}var K=a.i(618155),L=a.i(923665),M=a.i(758042),N=a.i(994222),O=a.i(659854),P=a.i(48662),Q=a.i(467149);let R=(0,z.default)("flask-conical",[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]]);var S=a.i(50522);let T=(0,z.default)("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]);var U=a.i(433217),V=a.i(370025),W=a.i(937927);function X({label:a,value:c,sub:d,color:e}){return(0,b.jsxs)("div",{className:"bg-white/[0.02] border border-white/[0.06] rounded-lg p-3",children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-500 uppercase tracking-wider mb-1",children:a}),(0,b.jsx)("div",{className:`text-lg font-semibold tabular-nums ${e||"text-white"}`,children:c}),d&&(0,b.jsx)("div",{className:"text-[10px] text-gray-600 mt-0.5",children:d})]})}let Y={background:"#0f0f11",border:"1px solid rgba(255,255,255,0.08)",borderRadius:"0.5rem",fontSize:"11px",color:"#d1d5db"};function Z(a){return a<-10?"#22c55e":a<0?"#86efac":a<5?"#f59e0b":"#ef4444"}function $({result:a}){let[d,e]=(0,c.useState)(!1);return(0,b.jsxs)("div",{className:"border border-white/[0.05] rounded-lg overflow-hidden",children:[(0,b.jsxs)("button",{onClick:()=>e(a=>!a),className:"w-full flex items-center gap-3 px-3 py-2 text-left hover:bg-white/[0.02] transition-colors",children:[(0,b.jsx)("span",{className:"text-gray-500",children:d?(0,b.jsx)(g.ChevronDown,{className:"w-3.5 h-3.5"}):(0,b.jsx)(S.ChevronRight,{className:"w-3.5 h-3.5"})}),(0,b.jsx)("span",{className:"text-xs text-gray-300 font-mono flex-1 truncate",title:a.task_id,children:a.task_id}),(0,b.jsx)("span",{className:"text-[10px] text-gray-600 w-20",children:a.category}),(0,b.jsx)("span",{className:"text-[10px] text-gray-600 w-12",children:a.difficulty}),(0,b.jsx)("span",{className:"text-[10px] tabular-nums w-16 text-right",style:{color:Z(a.tokens_delta_percent??0)},children:null!=a.tokens_delta_percent?`${a.tokens_delta_percent>0?"+":""}${a.tokens_delta_percent.toFixed(1)}%`:"—"}),(0,b.jsxs)("span",{className:"text-[10px] text-gray-400 tabular-nums w-20 text-right",children:[null!=a.quality_with?a.quality_with.toFixed(2):"—"," / ",null!=a.quality_without?a.quality_without.toFixed(2):"—"]})]}),d&&(0,b.jsxs)("div",{className:"px-8 pb-3 pt-1 grid grid-cols-2 md:grid-cols-4 gap-3 bg-white/[0.01] border-t border-white/[0.05]",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-[9px] text-gray-600 uppercase mb-0.5",children:"Tokens without"}),(0,b.jsxs)("div",{className:"text-xs text-gray-300 tabular-nums",children:[a.tokens_without_input??"—"," in / ",a.tokens_without_output??"—"," out"]})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-[9px] text-gray-600 uppercase mb-0.5",children:"Tokens with"}),(0,b.jsxs)("div",{className:"text-xs text-gray-300 tabular-nums",children:[a.tokens_with_input??"—"," in / ",a.tokens_with_output??"—"," out"]})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-[9px] text-gray-600 uppercase mb-0.5",children:"Injection"}),(0,b.jsxs)("div",{className:"text-xs text-gray-300 tabular-nums",children:[a.injection_tokens??"—"," tokens"]})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-[9px] text-gray-600 uppercase mb-0.5",children:"Retrieval"}),(0,b.jsxs)("div",{className:"text-xs text-gray-300 tabular-nums",children:[a.retrieval_count??0," hits",null!=a.retrieval_avg_relevance?` \xb7 ${a.retrieval_avg_relevance.toFixed(3)} rel`:"",null!=a.retrieval_latency_ms?` \xb7 ${a.retrieval_latency_ms.toFixed(0)}ms`:""]})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-[9px] text-gray-600 uppercase mb-0.5",children:"Quality improvement"}),(0,b.jsx)("div",{className:"text-xs tabular-nums",style:{color:(a.quality_improvement??0)>0?"#22c55e":(a.quality_improvement??0)<0?"#ef4444":"#6b7280"},children:null!=a.quality_improvement?`${a.quality_improvement>0?"+":""}${a.quality_improvement.toFixed(3)}`:"—"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-[9px] text-gray-600 uppercase mb-0.5",children:"Judge confidence"}),(0,b.jsx)("div",{className:"text-xs text-gray-300 tabular-nums",children:null!=a.judge_confidence?a.judge_confidence.toFixed(2):"—"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-[9px] text-gray-600 uppercase mb-0.5",children:"Duration without"}),(0,b.jsx)("div",{className:"text-xs text-gray-300 tabular-nums",children:null!=a.duration_without_ms?`${a.duration_without_ms.toFixed(0)}ms`:"—"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-[9px] text-gray-600 uppercase mb-0.5",children:"Duration with"}),(0,b.jsx)("div",{className:"text-xs text-gray-300 tabular-nums",children:null!=a.duration_with_ms?`${a.duration_with_ms.toFixed(0)}ms`:"—"})]})]})]})}function _({tier:a}){if(!a)return null;let c={gold:"bg-yellow-500/20 text-yellow-300 border-yellow-500/30",silver:"bg-gray-400/20 text-gray-300 border-gray-400/30",bronze:"bg-orange-500/20 text-orange-300 border-orange-500/30"}[a.toLowerCase()]||"bg-purple-500/20 text-purple-300 border-purple-500/30";return(0,b.jsx)("span",{className:`text-[9px] px-1.5 py-0.5 rounded border font-medium uppercase ${c}`,children:a})}let aa=["codebase-qa","bug-fixing","code-generation","refactoring","style-convention","decision-recall","cross-session","error-recovery","domain-knowledge","multi-layer","performance-optimization","api-integration","security-access","meta-self","lobe-specific"],ab={quick:{label:"Quick Test",desc:"Single task per category",tasks:"~15 tasks",time:"~3 min"},standard:{label:"Standard",desc:"5 tasks per category",tasks:"~75 tasks",time:"~20 min"},full:{label:"Comprehensive",desc:"All tasks",tasks:"~156 tasks",time:"~1 hour"}};function ac({current:a,total:c}){let d=c>0?Math.round(a/c*100):0;return(0,b.jsxs)("div",{className:"w-full",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,b.jsxs)("span",{className:"text-[10px] text-gray-500 tabular-nums",children:[a," / ",c>0?c:"?"," tasks"]}),(0,b.jsxs)("span",{className:"text-[10px] text-gray-500 tabular-nums",children:[d,"%"]})]}),(0,b.jsx)("div",{className:"h-1.5 bg-white/[0.06] rounded-full overflow-hidden",children:(0,b.jsx)("div",{className:"h-full bg-purple-500 rounded-full transition-all duration-500",style:{width:`${d}%`}})})]})}function ad({onRunComplete:a}){let d,{data:f}=(0,U.useQuery)({queryKey:["benchmark","status"],queryFn:async()=>{let a=await fetch((0,e.api)("/api/benchmark/status"));return a.ok?a.json():null},refetchInterval:3e3}),h=(d=(0,W.useQueryClient)(),(0,V.useMutation)({mutationFn:async a=>(await fetch((0,e.api)("/api/benchmark/run"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)})).json(),onSuccess:()=>{d.invalidateQueries({queryKey:["benchmark"]})}})),[i,j]=(0,c.useState)([]),[k,l]=(0,c.useState)("claude-haiku-4-5"),[m,n]=(0,c.useState)(!1),[o,p]=(0,c.useState)(1),[q,r]=(0,c.useState)(!1),s=f?.running===!0,t=(0,c.useRef)(void 0);(0,c.useEffect)(()=>{!0!==t.current||s||f?.exitCode==null||a(),t.current=s},[s,f?.exitCode,a]);let u=f?.output?f.output.split("\n").filter(a=>a.trim().length>0).slice(-6):[];if(s)return(0,b.jsxs)("div",{className:"bg-white/[0.02] border border-white/[0.06] rounded-lg p-4 space-y-3",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(B.Loader2,{className:"w-3.5 h-3.5 text-purple-400 animate-spin"}),(0,b.jsxs)("span",{className:"text-xs font-medium text-gray-300",children:["Benchmark running — ",f?.preset,f?.categories&&"all"!==f.categories?` (${f.categories})`:""]})]}),(0,b.jsx)("span",{className:"text-[10px] text-gray-600 font-mono",children:f?.model})]}),(0,b.jsx)(ac,{current:f?.progress?.current??0,total:f?.progress?.total??0}),u.length>0&&(0,b.jsx)("div",{className:"bg-black/30 rounded-md p-3 font-mono text-[10px] text-gray-500 space-y-0.5 max-h-28 overflow-y-auto",children:u.map((a,c)=>(0,b.jsx)("div",{className:"leading-relaxed",children:a},c))})]});let v=h.data?.error;return(0,b.jsxs)("div",{className:"bg-white/[0.02] border border-white/[0.06] rounded-lg overflow-hidden",children:[(0,b.jsx)("div",{className:"px-4 py-3 border-b border-white/[0.05]",children:(0,b.jsx)("h3",{className:"text-xs font-medium text-gray-400",children:"Run Benchmark"})}),(0,b.jsxs)("div",{className:"p-4 space-y-2",children:[Object.entries(ab).map(([a,c])=>(0,b.jsxs)("div",{className:"flex items-center justify-between px-3 py-2.5 rounded-lg border border-white/[0.05] hover:border-white/[0.10] hover:bg-white/[0.02] transition-colors",children:[(0,b.jsxs)("div",{className:"min-w-0",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:"text-xs font-medium text-gray-300",children:c.label}),(0,b.jsx)("span",{className:"text-[10px] text-gray-600",children:c.desc})]}),(0,b.jsxs)("div",{className:"text-[10px] text-gray-600 mt-0.5 tabular-nums",children:[c.tasks," · ",c.time]})]}),(0,b.jsxs)("button",{onClick:()=>{h.mutate({preset:a})},disabled:h.isPending,className:"ml-4 flex items-center gap-1.5 px-3 py-1 text-[11px] font-medium rounded-md bg-purple-600/20 text-purple-300 border border-purple-500/20 hover:bg-purple-600/30 hover:border-purple-500/40 disabled:opacity-50 disabled:cursor-not-allowed transition-colors shrink-0",children:[(0,b.jsx)(T,{className:"w-2.5 h-2.5"}),"Run"]})]},a)),(0,b.jsxs)("div",{className:"pt-1",children:[(0,b.jsxs)("button",{onClick:()=>r(a=>!a),className:"flex items-center gap-1.5 text-[11px] text-gray-500 hover:text-gray-400 transition-colors",children:[q?(0,b.jsx)(g.ChevronDown,{className:"w-3 h-3"}):(0,b.jsx)(S.ChevronRight,{className:"w-3 h-3"}),"Custom"]}),q&&(0,b.jsxs)("div",{className:"mt-3 space-y-3 pl-1",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-600 uppercase tracking-wider mb-2",children:"Categories"}),(0,b.jsx)("div",{className:"flex flex-wrap gap-1.5",children:aa.map(a=>{let c=i.includes(a);return(0,b.jsx)("button",{onClick:()=>{j(b=>b.includes(a)?b.filter(b=>b!==a):[...b,a])},className:`px-2 py-0.5 text-[10px] rounded border transition-colors ${c?"bg-purple-500/20 text-purple-300 border-purple-500/30":"bg-white/[0.03] text-gray-500 border-white/[0.06] hover:text-gray-400 hover:border-white/[0.10]"}`,children:a},a)})}),0===i.length&&(0,b.jsx)("div",{className:"text-[10px] text-gray-600 mt-1",children:"None selected = all categories"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-600 uppercase tracking-wider mb-1",children:"Model"}),(0,b.jsxs)("select",{value:k,onChange:a=>l(a.target.value),className:"px-2.5 py-1 text-xs bg-white/5 border border-white/10 rounded-md text-gray-300 focus:outline-none focus:border-purple-500/50",children:[(0,b.jsx)("option",{value:"claude-haiku-4-5",children:"claude-haiku-4-5"}),(0,b.jsx)("option",{value:"claude-sonnet-4-5",children:"claude-sonnet-4-5"}),(0,b.jsx)("option",{value:"claude-opus-4-5",children:"claude-opus-4-5"})]})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-[10px] text-gray-600 uppercase tracking-wider mb-1",children:"Concurrency"}),(0,b.jsx)("input",{type:"number",min:1,max:5,value:o,onChange:a=>p(Math.min(5,Math.max(1,parseInt(a.target.value)||1))),className:"w-16 px-2.5 py-1 text-xs bg-white/5 border border-white/10 rounded-md text-gray-300 focus:outline-none focus:border-purple-500/50"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2 mt-4",children:[(0,b.jsx)("input",{id:"no-judge",type:"checkbox",checked:m,onChange:a=>n(a.target.checked),className:"w-3.5 h-3.5 rounded accent-purple-500"}),(0,b.jsx)("label",{htmlFor:"no-judge",className:"text-[11px] text-gray-400 cursor-pointer",children:"Skip judge"})]})]}),(0,b.jsxs)("button",{onClick:function(){h.mutate({preset:"custom",categories:i.length>0?i.join(","):void 0,noJudge:m,model:k,concurrency:o})},disabled:h.isPending,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-md bg-purple-600/20 text-purple-300 border border-purple-500/20 hover:bg-purple-600/30 hover:border-purple-500/40 disabled:opacity-50 disabled:cursor-not-allowed transition-colors",children:[(0,b.jsx)(T,{className:"w-3 h-3"}),"Run Custom"]})]})]}),v&&(0,b.jsx)("div",{className:"text-[11px] text-red-400 bg-red-500/10 border border-red-500/20 rounded-md px-3 py-2",children:v}),f&&!s&&null!=f.exitCode&&(0,b.jsxs)("div",{className:"text-[11px] text-gray-500 bg-white/[0.02] border border-white/[0.05] rounded-md px-3 py-2",children:["Last run finished — exit code ",f.exitCode,0===f.exitCode?" (success)":" (error)"]})]})]})}function ae(){let{data:a,isLoading:d,refetch:f}=(0,U.useQuery)({queryKey:["benchmark","runs"],queryFn:async()=>{let a=await fetch((0,e.api)("/api/benchmark/runs"));return a.ok?a.json():null}}),g=a?.runs??[],[h,i]=(0,c.useState)(null),j=h??g[0]?.id??null,{data:k,isLoading:l}=(0,U.useQuery)({queryKey:["benchmark","run",j],queryFn:async()=>{if(!j)return null;let a=await fetch((0,e.api)(`/api/benchmark/runs/${j}`));return a.ok?a.json():null},enabled:!!j}),{data:m}=(0,U.useQuery)({queryKey:["benchmark","lobes"],queryFn:async()=>{let a=await fetch((0,e.api)("/api/benchmark/lobes"));return a.ok?a.json():null}}),n=k?.summary??null,o=k?.categories??[],p=k?.results??[],q=m?.lobes??[],r=!d&&0===g.length;if(d)return(0,b.jsxs)("div",{className:"p-6 max-w-5xl space-y-6",children:[(0,b.jsx)(ad,{onRunComplete:()=>f()}),(0,b.jsx)("div",{className:"text-sm text-gray-500",children:"Loading benchmark data..."})]});if(r)return(0,b.jsxs)("div",{className:"p-6 max-w-5xl space-y-6",children:[(0,b.jsx)(ad,{onRunComplete:()=>f()}),(0,b.jsxs)("div",{className:"flex flex-col items-center justify-center gap-4 py-16 text-gray-600",children:[(0,b.jsx)(R,{className:"w-10 h-10"}),(0,b.jsxs)("p",{className:"text-sm text-center max-w-xs",children:["No benchmark data yet. Use the launcher above or run"," ",(0,b.jsx)("span",{className:"text-gray-500 font-mono text-xs",children:"npm run benchmark"})," ","to generate results."]})]})]});let s=o.map(a=>({name:a.category,delta:parseFloat(a.avgTokenDeltaPercent.toFixed(1))})),t=o.map(a=>({name:a.category,without:parseFloat(a.avgQualityWithout.toFixed(3)),with:parseFloat(a.avgQualityWith.toFixed(3))})),u=[...o].sort((a,b)=>b.hitRate-a.hitRate).map(a=>({name:a.category,hitRate:parseFloat((100*a.hitRate).toFixed(1))}));return(0,b.jsxs)("div",{className:"p-6 max-w-5xl space-y-6",children:[(0,b.jsx)(ad,{onRunComplete:()=>f()}),(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)("label",{className:"text-[11px] text-gray-500 shrink-0",children:"Run"}),(0,b.jsx)("select",{value:j??"",onChange:a=>i(a.target.value||null),className:"px-3 py-1.5 text-xs bg-white/5 border border-white/10 rounded-lg text-gray-300 focus:outline-none focus:border-purple-500/50",children:g.map(a=>(0,b.jsxs)("option",{value:a.id,children:[new Date(a.timestamp).toLocaleString()," — ",a.model," (",a.preset,", ",a.task_count," tasks)"]},a.id))})]}),n&&(0,b.jsxs)("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-3",children:[(0,b.jsx)(X,{label:"Avg Token Delta",value:null!=n.avgTokenDeltaPercent?`${n.avgTokenDeltaPercent>0?"+":""}${n.avgTokenDeltaPercent.toFixed(1)}%`:"—",sub:"vs baseline",color:n.avgTokenDeltaPercent<0?"text-green-400":n.avgTokenDeltaPercent<5?"text-amber-400":"text-red-400"}),(0,b.jsx)(X,{label:"Quality (with)",value:n.avgQualityWith.toFixed(2),sub:"avg LLM judge score",color:"text-purple-400"}),(0,b.jsx)(X,{label:"Quality (without)",value:n.avgQualityWithout.toFixed(2),sub:"baseline"}),(0,b.jsx)(X,{label:"Tasks",value:n.taskCount.toString(),sub:`${o.length} categories`}),(0,b.jsx)(X,{label:"Avg Retrieval",value:n.avgRetrievalLatencyMs?`${n.avgRetrievalLatencyMs.toFixed(0)}ms`:"—",sub:n.avgRetrievalRelevance?`${n.avgRetrievalRelevance.toFixed(3)} relevance`:"relevance"})]}),l&&(0,b.jsx)("div",{className:"text-sm text-gray-500",children:"Loading run details..."}),o.length>0&&(0,b.jsxs)("div",{className:"bg-white/[0.02] border border-white/[0.06] rounded-lg overflow-hidden",children:[(0,b.jsx)("div",{className:"px-4 py-3 border-b border-white/[0.05]",children:(0,b.jsx)("h3",{className:"text-xs font-medium text-gray-400",children:"Category Breakdown"})}),(0,b.jsx)("div",{className:"overflow-x-auto",children:(0,b.jsxs)("table",{className:"w-full text-xs",children:[(0,b.jsx)("thead",{children:(0,b.jsxs)("tr",{className:"border-b border-white/[0.05]",children:[(0,b.jsx)("th",{className:"px-4 py-2 text-left text-[10px] text-gray-500 uppercase tracking-wider",children:"Category"}),(0,b.jsx)("th",{className:"px-4 py-2 text-right text-[10px] text-gray-500 uppercase tracking-wider",children:"Tasks"}),(0,b.jsx)("th",{className:"px-4 py-2 text-right text-[10px] text-gray-500 uppercase tracking-wider",children:"Token Delta"}),(0,b.jsx)("th",{className:"px-4 py-2 text-right text-[10px] text-gray-500 uppercase tracking-wider",children:"Quality w/o"}),(0,b.jsx)("th",{className:"px-4 py-2 text-right text-[10px] text-gray-500 uppercase tracking-wider",children:"Quality with"}),(0,b.jsx)("th",{className:"px-4 py-2 text-right text-[10px] text-gray-500 uppercase tracking-wider",children:"Hit Rate"}),(0,b.jsx)("th",{className:"px-4 py-2 text-right text-[10px] text-gray-500 uppercase tracking-wider",children:"Relevance"})]})}),(0,b.jsx)("tbody",{children:o.map((a,c)=>(0,b.jsxs)("tr",{className:`border-b border-white/[0.03] ${c%2==0?"":"bg-white/[0.01]"}`,children:[(0,b.jsx)("td",{className:"px-4 py-2 text-gray-300",children:a.category}),(0,b.jsx)("td",{className:"px-4 py-2 text-right text-gray-400 tabular-nums",children:a.taskCount}),(0,b.jsxs)("td",{className:"px-4 py-2 text-right tabular-nums font-medium",style:{color:Z(a.avgTokenDeltaPercent)},children:[a.avgTokenDeltaPercent>0?"+":"",a.avgTokenDeltaPercent.toFixed(1),"%"]}),(0,b.jsx)("td",{className:"px-4 py-2 text-right text-gray-400 tabular-nums",children:a.avgQualityWithout.toFixed(2)}),(0,b.jsx)("td",{className:"px-4 py-2 text-right text-gray-300 tabular-nums font-medium",children:a.avgQualityWith.toFixed(2)}),(0,b.jsxs)("td",{className:"px-4 py-2 text-right text-gray-400 tabular-nums",children:[(100*a.hitRate).toFixed(0),"%"]}),(0,b.jsx)("td",{className:"px-4 py-2 text-right text-gray-400 tabular-nums",children:a.avgRetrievalRelevance.toFixed(3)})]},a.category))})]})})]}),o.length>0&&(0,b.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[(0,b.jsxs)("div",{className:"bg-white/[0.02] border border-white/[0.06] rounded-lg p-4",children:[(0,b.jsx)("h3",{className:"text-xs font-medium text-gray-400 mb-3",children:"Token Delta % by Category"}),(0,b.jsx)(P.ResponsiveContainer,{width:"100%",height:160,children:(0,b.jsxs)(K.BarChart,{data:s,margin:{top:4,right:4,bottom:4,left:0},children:[(0,b.jsx)(M.XAxis,{dataKey:"name",tick:{fontSize:10,fill:"#6b7280"}}),(0,b.jsx)(N.YAxis,{tick:{fontSize:10,fill:"#6b7280"}}),(0,b.jsx)(O.Tooltip,{contentStyle:Y,formatter:a=>[`${a>0?"+":""}${a}%`,"Token delta"]}),(0,b.jsx)(L.Bar,{dataKey:"delta",radius:[2,2,0,0],children:s.map((a,c)=>(0,b.jsx)(Q.Cell,{fill:Z(a.delta)},c))})]})})]}),(0,b.jsxs)("div",{className:"bg-white/[0.02] border border-white/[0.06] rounded-lg p-4",children:[(0,b.jsx)("h3",{className:"text-xs font-medium text-gray-400 mb-3",children:"Quality Score by Category"}),(0,b.jsxs)("div",{className:"flex items-center gap-4 mb-2",children:[(0,b.jsxs)("span",{className:"flex items-center gap-1 text-[10px] text-gray-500",children:[(0,b.jsx)("span",{className:"w-2 h-2 rounded-sm inline-block",style:{background:"#6b7280"}}),"Without"]}),(0,b.jsxs)("span",{className:"flex items-center gap-1 text-[10px] text-gray-500",children:[(0,b.jsx)("span",{className:"w-2 h-2 rounded-sm inline-block",style:{background:"#7c3aed"}}),"With Cortex"]})]}),(0,b.jsx)(P.ResponsiveContainer,{width:"100%",height:160,children:(0,b.jsxs)(K.BarChart,{data:t,margin:{top:4,right:4,bottom:4,left:0},children:[(0,b.jsx)(M.XAxis,{dataKey:"name",tick:{fontSize:10,fill:"#6b7280"}}),(0,b.jsx)(N.YAxis,{domain:[0,1],tick:{fontSize:10,fill:"#6b7280"}}),(0,b.jsx)(O.Tooltip,{contentStyle:Y}),(0,b.jsx)(L.Bar,{dataKey:"without",fill:"#4b5563",radius:[2,2,0,0]}),(0,b.jsx)(L.Bar,{dataKey:"with",fill:"#7c3aed",radius:[2,2,0,0]})]})})]}),(0,b.jsxs)("div",{className:"bg-white/[0.02] border border-white/[0.06] rounded-lg p-4 md:col-span-2",children:[(0,b.jsx)("h3",{className:"text-xs font-medium text-gray-400 mb-3",children:"Knowledge Retrieval Hit Rate %"}),(0,b.jsx)(P.ResponsiveContainer,{width:"100%",height:120,children:(0,b.jsxs)(K.BarChart,{data:u,layout:"vertical",margin:{top:4,right:4,bottom:4,left:60},children:[(0,b.jsx)(M.XAxis,{type:"number",domain:[0,100],tick:{fontSize:10,fill:"#6b7280"}}),(0,b.jsx)(N.YAxis,{type:"category",dataKey:"name",tick:{fontSize:10,fill:"#6b7280"},width:56}),(0,b.jsx)(O.Tooltip,{contentStyle:Y,formatter:a=>[`${a}%`,"Hit rate"]}),(0,b.jsx)(L.Bar,{dataKey:"hitRate",fill:"#06b6d4",radius:[0,2,2,0]})]})})]})]}),q.length>0&&(0,b.jsxs)("div",{className:"bg-white/[0.02] border border-white/[0.06] rounded-lg overflow-hidden",children:[(0,b.jsx)("div",{className:"px-4 py-3 border-b border-white/[0.05]",children:(0,b.jsx)("h3",{className:"text-xs font-medium text-gray-400",children:"Lobe Scores"})}),(0,b.jsx)("div",{className:"overflow-x-auto",children:(0,b.jsxs)("table",{className:"w-full text-xs",children:[(0,b.jsx)("thead",{children:(0,b.jsxs)("tr",{className:"border-b border-white/[0.05]",children:[(0,b.jsx)("th",{className:"px-4 py-2 text-left text-[10px] text-gray-500 uppercase tracking-wider",children:"Lobe"}),(0,b.jsx)("th",{className:"px-4 py-2 text-right text-[10px] text-gray-500 uppercase tracking-wider",children:"Overall"}),(0,b.jsx)("th",{className:"px-4 py-2 text-right text-[10px] text-gray-500 uppercase tracking-wider",children:"Token Savings"}),(0,b.jsx)("th",{className:"px-4 py-2 text-right text-[10px] text-gray-500 uppercase tracking-wider",children:"Quality +"}),(0,b.jsx)("th",{className:"px-4 py-2 text-right text-[10px] text-gray-500 uppercase tracking-wider",children:"Coverage"}),(0,b.jsx)("th",{className:"px-4 py-2 text-right text-[10px] text-gray-500 uppercase tracking-wider",children:"Badge"}),(0,b.jsx)("th",{className:"px-4 py-2 text-right text-[10px] text-gray-500 uppercase tracking-wider",children:"Marketplace"})]})}),(0,b.jsx)("tbody",{children:q.map((a,c)=>(0,b.jsxs)("tr",{className:`border-b border-white/[0.03] ${c%2==0?"":"bg-white/[0.01]"}`,children:[(0,b.jsxs)("td",{className:"px-4 py-2",children:[(0,b.jsx)("div",{className:"text-gray-300",children:a.lobe_name}),(0,b.jsx)("div",{className:"text-[9px] text-gray-600 font-mono",children:a.lobe_id})]}),(0,b.jsx)("td",{className:"px-4 py-2 text-right text-purple-400 tabular-nums font-medium",children:null!=a.overall_score?a.overall_score.toFixed(2):"—"}),(0,b.jsx)("td",{className:"px-4 py-2 text-right tabular-nums",style:{color:(a.token_savings??0)>0?"#22c55e":"#6b7280"},children:null!=a.token_savings?`${a.token_savings>0?"+":""}${a.token_savings.toFixed(1)}%`:"—"}),(0,b.jsx)("td",{className:"px-4 py-2 text-right tabular-nums",style:{color:(a.quality_improvement??0)>0?"#22c55e":"#6b7280"},children:null!=a.quality_improvement?`${a.quality_improvement>0?"+":""}${a.quality_improvement.toFixed(3)}`:"—"}),(0,b.jsx)("td",{className:"px-4 py-2 text-right text-gray-400 tabular-nums",children:null!=a.coverage_score?a.coverage_score.toFixed(2):"—"}),(0,b.jsx)("td",{className:"px-4 py-2 text-right",children:(0,b.jsx)(_,{tier:a.badge_tier})}),(0,b.jsx)("td",{className:"px-4 py-2 text-right",children:a.marketplace_ready?(0,b.jsx)("span",{className:"text-[9px] px-1.5 py-0.5 rounded border bg-green-500/10 text-green-400 border-green-500/20",children:"Ready"}):(0,b.jsx)("span",{className:"text-[9px] text-gray-600",children:"—"})})]},a.id))})]})})]}),p.length>0&&(0,b.jsxs)("div",{className:"bg-white/[0.02] border border-white/[0.06] rounded-lg overflow-hidden",children:[(0,b.jsxs)("div",{className:"px-4 py-3 border-b border-white/[0.05] flex items-center justify-between",children:[(0,b.jsx)("h3",{className:"text-xs font-medium text-gray-400",children:"Task Results"}),(0,b.jsxs)("span",{className:"text-[10px] text-gray-600",children:[p.length," tasks"]})]}),(0,b.jsxs)("div",{className:"px-4 py-2",children:[(0,b.jsxs)("div",{className:"flex items-center gap-3 px-3 py-1 mb-1",children:[(0,b.jsx)("span",{className:"w-3.5"}),(0,b.jsx)("span",{className:"text-[9px] text-gray-600 uppercase tracking-wider flex-1",children:"Task ID"}),(0,b.jsx)("span",{className:"text-[9px] text-gray-600 uppercase tracking-wider w-20",children:"Category"}),(0,b.jsx)("span",{className:"text-[9px] text-gray-600 uppercase tracking-wider w-12",children:"Diff"}),(0,b.jsx)("span",{className:"text-[9px] text-gray-600 uppercase tracking-wider w-16 text-right",children:"Token %"}),(0,b.jsx)("span",{className:"text-[9px] text-gray-600 uppercase tracking-wider w-20 text-right",children:"Quality w/w"})]}),(0,b.jsx)("div",{className:"space-y-1",children:p.map(a=>(0,b.jsx)($,{result:a},a.id))})]})]})]})}let af=(0,d.default)(async()=>{},{loadableGenerated:{modules:[756409]},ssr:!1,loading:()=>(0,b.jsx)("div",{className:"flex-1 flex items-center justify-center text-gray-500 text-sm",children:"Loading graph..."})});function ag(){let[a,d]=(0,c.useState)("dashboard"),[f,g]=(0,c.useState)(null);(0,c.useEffect)(()=>{fetch((0,e.api)("/api/cortex/status")).then(a=>a.json()).then(g).catch(()=>{})},[]);let h=f?Object.values(f.layers||{}).reduce((a,b)=>a+(b.count||0),0):0;return(0,b.jsxs)("div",{className:"flex flex-col h-screen bg-gray-950",children:[(0,b.jsxs)("div",{className:"flex items-center border-b border-white/5 px-4 shrink-0",children:[(0,b.jsx)("div",{className:"flex",children:[{key:"dashboard",label:"Dashboard"},{key:"graph",label:"Graph"},{key:"knowledge",label:"Knowledge"},{key:"curation",label:"Curation"},{key:"marketplace",label:"Marketplace"},{key:"benchmark",label:"Benchmark"},{key:"settings",label:"Settings"}].map(c=>(0,b.jsx)("button",{onClick:()=>d(c.key),className:`px-5 py-3 text-sm font-medium transition-colors border-b-2 ${a===c.key?"text-purple-400 border-purple-400":"text-gray-500 border-transparent hover:text-gray-300"}`,children:c.label},c.key))}),(0,b.jsxs)("div",{className:"ml-auto text-xs text-gray-600",children:[h," knowledge units"]})]}),(0,b.jsxs)("div",{className:"flex-1 overflow-y-auto",children:["dashboard"===a&&(0,b.jsx)(v,{}),"graph"===a&&(0,b.jsx)(af,{}),"knowledge"===a&&(0,b.jsx)(o,{}),"curation"===a&&(0,b.jsx)(E,{}),"marketplace"===a&&(0,b.jsx)(J,{}),"benchmark"===a&&(0,b.jsx)(ae,{}),"settings"===a&&(0,b.jsx)("div",{className:"p-6 max-w-2xl space-y-8",children:(0,b.jsx)(p.CortexSettings,{})})]})]})}a.s(["default",()=>ag],417835)}];
2
2
 
3
3
  //# sourceMappingURL=src_app_%28desktop%29_cortex_page_tsx_0f33d8b3._.js.map
@@ -1,3 +1,3 @@
1
- module.exports=[773663,a=>{"use strict";var b=a.i(187924),c=a.i(572131),d=a.i(859603),e=a.i(321161),f=a.i(669520),g=a.i(296101),h=a.i(596221),i=a.i(603314),j=a.i(167453),k=a.i(839761),l=a.i(915618),m=a.i(633508),n=a.i(663572),o=a.i(119032),p=a.i(58037),q=a.i(897498),r=a.i(565870);function s(){let{hasAuth:a,tier:s,version:t,hasCortex:u,cortexTierEnabled:v}=(0,q.useTier)(),w="u">typeof document&&document.cookie.includes("spaces-session="),x=(0,d.useSync)(),[y,z]=(0,c.useState)(""),[A,B]=(0,c.useState)(!1),[C,D]=(0,c.useState)(!0),[E,F]=(0,c.useState)(!1),[G,H]=(0,c.useState)(""),[I,J]=(0,c.useState)(""),[K,L]=(0,c.useState)(""),[M,N]=(0,c.useState)(""),[O,P]=(0,c.useState)(!1),Q=(0,c.useRef)(null),[R,S]=(0,c.useState)(null),[T,U]=(0,c.useState)([]),[V,W]=(0,c.useState)(""),[X,Y]=(0,c.useState)(!1),[Z,$]=(0,c.useState)(!0);(0,c.useEffect)(()=>{a?w?fetch((0,o.api)("/api/auth/me")).then(a=>a.json()).then(a=>{S(a),D(!1)}).catch(()=>D(!1)):fetch((0,o.api)("/api/auth/totp/status")).then(a=>a.json()).then(a=>{B(a.enabled),D(!1)}).catch(()=>D(!1)):D(!1)},[a,w]),(0,c.useEffect)(()=>{fetch((0,o.api)("/api/config")).then(a=>a.json()).then(a=>{Y(a.telemetryOptOut),U(a.devDirectories||[]),$(!1)}).catch(()=>$(!1))},[]);let _=async a=>{U(a),await fetch((0,o.api)("/api/config"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({devDirectories:a})})},aa=()=>{let a=V.trim();!a||T.includes(a)||(a.startsWith("/")||/^[A-Za-z]:[\\/]/.test(a))&&(_([...T,a]),W(""))},ab=async()=>{let a=await x.mutateAsync();z(`Synced ${a.projects} projects, ${a.sessions} sessions, enriched ${a.enriched}`),(0,p.track)("sync_completed",{projects:a.projects,sessions:a.sessions,enriched:a.enriched})},ac=async()=>{let a=!X;Y(a),(0,p.setOptOut)(a),(0,p.track)("telemetry_toggled",{enabled:!a}),await fetch((0,o.api)("/api/config"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({telemetryOptOut:a})})},ad=async()=>{F(!0),N(""),L("");let a=await fetch((0,o.api)("/api/auth/totp/setup"),{method:"POST"}),b=await a.json();H(b.qrDataUrl),J(b.secret),setTimeout(()=>Q.current?.focus(),100)},ae=async a=>{if(6!==a.length)return;P(!0),N("");let b=await fetch((0,o.api)("/api/auth/totp/verify"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:a,action:"enable"})}),c=await b.json();P(!1),c.success?(B(!0),F(!1),H(""),J(""),L("")):(N(c.error||"Invalid code"),L(""),Q.current?.focus())},af=async()=>{confirm("Disable 2FA? You will need to set it up again to use terminals.")&&(await fetch((0,o.api)("/api/auth/totp/setup"),{method:"POST"}),B(!1),F(!1))};return(0,b.jsxs)("div",{className:"p-6 max-w-3xl",children:[(0,b.jsxs)("div",{className:"mb-6",children:[(0,b.jsx)("h1",{className:"text-2xl font-bold",children:"Settings"}),(0,b.jsx)("p",{className:"text-muted-foreground text-sm mt-1",children:"Configure Spaces"})]}),(0,b.jsxs)("div",{className:"space-y-6",children:[a&&(0,b.jsxs)("div",{className:"bg-white dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-800 rounded-lg p-5",children:[(0,b.jsxs)("h3",{className:"font-semibold flex items-center gap-2 mb-3",children:[(0,b.jsx)(i.Shield,{className:"w-4 h-4"}),"Terminal Security"]}),C?(0,b.jsxs)("div",{className:"flex items-center gap-2 text-sm text-zinc-400",children:[(0,b.jsx)(h.Loader2,{className:"w-4 h-4 animate-spin"}),"Loading..."]}):w?(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(j.CheckCircle2,{className:"w-5 h-5 text-green-500"}),(0,b.jsx)("span",{className:"text-sm font-medium text-green-500",children:"2FA Enabled"})]}),(0,b.jsx)("p",{className:"text-xs text-zinc-500",children:"Two-factor authentication is required at login. TOTP is managed through the login flow. Contact an admin to reset your 2FA if needed."})]}):A&&!E?(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(j.CheckCircle2,{className:"w-5 h-5 text-green-500"}),(0,b.jsx)("span",{className:"text-sm font-medium text-green-500",children:"2FA Enabled"})]}),(0,b.jsx)("p",{className:"text-xs text-zinc-500",children:"Two-factor authentication is required each time you open a terminal session. Tokens are valid for 8 hours."}),(0,b.jsx)("button",{onClick:af,className:"text-xs text-zinc-500 hover:text-red-400 transition-colors",children:"Disable 2FA"})]}):E?(0,b.jsxs)("div",{className:"space-y-4",children:[(0,b.jsx)("p",{className:"text-sm text-zinc-400",children:"Scan this QR code with your authenticator app (Google Authenticator, Authy, etc.)"}),G?(0,b.jsxs)("div",{className:"flex flex-col items-center gap-4",children:[(0,b.jsx)("div",{className:"bg-white p-3 rounded-lg",children:(0,b.jsx)("img",{src:G,alt:"TOTP QR Code",width:200,height:200})}),(0,b.jsxs)("div",{className:"text-center",children:[(0,b.jsx)("p",{className:"text-[10px] text-zinc-600 mb-1",children:"Manual entry key:"}),(0,b.jsx)("code",{className:"text-xs bg-zinc-800 px-2 py-1 rounded font-mono select-all",children:I})]})]}):(0,b.jsx)("div",{className:"flex justify-center py-8",children:(0,b.jsx)(h.Loader2,{className:"w-6 h-6 animate-spin text-zinc-400"})}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs text-zinc-400 block mb-1.5",children:"Enter the 6-digit code from your authenticator"}),(0,b.jsx)("input",{ref:Q,type:"text",inputMode:"numeric",autoComplete:"one-time-code",placeholder:"000000",value:K,onChange:a=>{let b;L(b=a.target.value.replace(/\D/g,"").slice(0,6)),N(""),6===b.length&&ae(b)},disabled:O,className:"w-40 px-3 py-2 text-lg font-mono tracking-[0.3em] text-center bg-zinc-800 border border-zinc-700 rounded-md focus:outline-none focus:border-indigo-500 text-white disabled:opacity-50"}),O&&(0,b.jsxs)("div",{className:"flex items-center gap-2 mt-2 text-xs text-zinc-400",children:[(0,b.jsx)(h.Loader2,{className:"w-3 h-3 animate-spin"}),"Verifying..."]}),M&&(0,b.jsx)("p",{className:"text-xs text-red-400 mt-2",children:M})]}),(0,b.jsx)("button",{onClick:()=>{F(!1),H(""),J("")},className:"text-xs text-zinc-500 hover:text-white transition-colors",children:"Cancel"})]}):(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsx)("p",{className:"text-sm text-zinc-400",children:"Two-factor authentication adds an extra layer of security to terminal access. You'll need an authenticator app to generate codes."}),(0,b.jsxs)("button",{onClick:ad,className:"flex items-center gap-2 px-4 py-2 text-sm bg-indigo-500 text-white rounded-md hover:bg-indigo-600",children:[(0,b.jsx)(i.Shield,{className:"w-4 h-4"}),"Set up 2FA"]})]})]}),(0,b.jsxs)("div",{className:"bg-white dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-800 rounded-lg p-5",children:[(0,b.jsxs)("h3",{className:"font-semibold flex items-center gap-2 mb-3",children:[(0,b.jsx)(g.FolderOpen,{className:"w-4 h-4"}),"Data Source"]}),(0,b.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-muted-foreground text-xs",children:"Agent Data Directories"}),(0,b.jsxs)("div",{className:"font-mono text-xs mt-1 p-2 bg-zinc-50 dark:bg-zinc-800 rounded space-y-1",children:[(0,b.jsx)("p",{children:"~/.claude/"}),(0,b.jsx)("p",{children:"~/.codex/"}),(0,b.jsx)("p",{children:"~/.gemini/"})]})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-muted-foreground text-xs",children:"Spaces Database"}),(0,b.jsx)("p",{className:"font-mono text-xs mt-1 p-2 bg-zinc-50 dark:bg-zinc-800 rounded",children:"~/.spaces/spaces.db"})]})]})]}),(0,b.jsxs)("div",{className:"bg-white dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-800 rounded-lg p-5",children:[(0,b.jsxs)("h3",{className:"font-semibold flex items-center gap-2 mb-3",children:[(0,b.jsx)(n.FolderCode,{className:"w-4 h-4"}),"Development Directories"]}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground mb-3",children:"Restrict terminal pane creation to these project roots. Paths must be absolute."}),T.length>0&&(0,b.jsx)("div",{className:"space-y-1.5 mb-3",children:T.map(a=>(0,b.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-zinc-50 dark:bg-zinc-800 rounded-md group",children:[(0,b.jsx)(g.FolderOpen,{className:"w-3.5 h-3.5 text-amber-500/70 flex-shrink-0"}),(0,b.jsx)("span",{className:"font-mono text-xs flex-1 truncate",children:a}),(0,b.jsx)("button",{onClick:()=>{_(T.filter(b=>b!==a))},className:"text-zinc-400 hover:text-red-400 opacity-0 group-hover:opacity-100 transition-opacity",title:"Remove",children:(0,b.jsx)(m.X,{className:"w-3.5 h-3.5"})})]},a))}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("input",{type:"text",placeholder:"u">typeof navigator&&navigator.platform?.startsWith("Win")?"C:\\Users\\you\\projects":"/home/user/projects",value:V,onChange:a=>W(a.target.value),onKeyDown:a=>"Enter"===a.key&&aa(),className:"flex-1 px-3 py-1.5 text-sm bg-zinc-50 dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 rounded-md focus:outline-none focus:border-indigo-500 font-mono"}),(0,b.jsxs)("button",{onClick:aa,disabled:!V.trim()||!(V.trim().startsWith("/")||/^[A-Za-z]:[\\/]/.test(V.trim())),className:"flex items-center gap-1.5 px-3 py-1.5 text-sm bg-indigo-500 text-white rounded-md hover:bg-indigo-600 disabled:opacity-50",children:[(0,b.jsx)(l.Plus,{className:"w-3.5 h-3.5"}),"Add"]})]})]}),(0,b.jsxs)("div",{className:"bg-white dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-800 rounded-lg p-5",children:[(0,b.jsxs)("h3",{className:"font-semibold flex items-center gap-2 mb-3",children:[(0,b.jsx)(f.RefreshCw,{className:"w-4 h-4"}),"Data Sync"]}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground mb-3",children:"Force a full re-scan of all agent sessions. This rebuilds the index from scratch."}),(0,b.jsxs)("button",{onClick:ab,disabled:x.isPending,className:"flex items-center gap-2 px-4 py-2 text-sm bg-indigo-500 text-white rounded-md hover:bg-indigo-600 disabled:opacity-50",children:[x.isPending?(0,b.jsx)(h.Loader2,{className:"w-4 h-4 animate-spin"}):(0,b.jsx)(f.RefreshCw,{className:"w-4 h-4"}),"Re-sync Now"]}),y&&(0,b.jsx)("p",{className:"text-xs text-green-600 mt-2",children:y})]}),(0,b.jsxs)("div",{className:"bg-white dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-800 rounded-lg p-5",children:[(0,b.jsxs)("h3",{className:"font-semibold flex items-center gap-2 mb-3",children:[(0,b.jsx)(k.BarChart3,{className:"w-4 h-4"}),"Telemetry"]}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground mb-3",children:"Anonymous usage data helps us understand how Spaces is used and improve the product. No file paths, session content, or personal information is ever collected."}),Z?(0,b.jsxs)("div",{className:"flex items-center gap-2 text-sm text-zinc-400",children:[(0,b.jsx)(h.Loader2,{className:"w-4 h-4 animate-spin"}),"Loading..."]}):(0,b.jsxs)("label",{className:"flex items-center gap-3 cursor-pointer",children:[(0,b.jsx)("input",{type:"checkbox",checked:!X,onChange:ac,className:"w-4 h-4 rounded border-zinc-300 dark:border-zinc-700 text-indigo-500 focus:ring-indigo-500"}),(0,b.jsx)("span",{className:"text-sm",children:"Send anonymous usage data"})]})]}),v&&(0,b.jsx)("div",{className:"bg-white dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-800 rounded-lg p-5",children:(0,b.jsx)(r.CortexSettings,{})}),(0,b.jsxs)("div",{className:"bg-white dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-800 rounded-lg p-5",children:[(0,b.jsxs)("h3",{className:"font-semibold flex items-center gap-2 mb-3",children:[(0,b.jsx)(e.Settings,{className:"w-4 h-4"}),"About"]}),(0,b.jsxs)("div",{className:"text-sm space-y-1",children:[(0,b.jsxs)("p",{children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"Version:"})," ",t||"..."]}),(0,b.jsxs)("p",{children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"Tier:"})," ",(0,b.jsx)("span",{className:"capitalize",children:s})]}),(0,b.jsxs)("p",{children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"Data access:"})," Read-only (never modifies agent data directories)"]}),(0,b.jsx)("p",{className:"text-muted-foreground text-xs mt-2",children:"Spaces is an open-source agent workspace manager. All session data stays local on your machine."})]})]})]})]})}a.s(["default",()=>s])}];
1
+ module.exports=[773663,a=>{"use strict";var b=a.i(187924),c=a.i(572131),d=a.i(859603),e=a.i(321161),f=a.i(669520),g=a.i(296101),h=a.i(596221),i=a.i(603314),j=a.i(167453),k=a.i(839761),l=a.i(915618),m=a.i(633508),n=a.i(663572);let o=(0,a.i(883706).default)("list-todo",[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]]);var p=a.i(119032),q=a.i(58037),r=a.i(897498),s=a.i(565870);function t(){let{hasAuth:a,tier:t,version:u,hasCortex:v,cortexTierEnabled:w}=(0,r.useTier)(),x="u">typeof document&&document.cookie.includes("spaces-session="),y=(0,d.useSync)(),[z,A]=(0,c.useState)(""),[B,C]=(0,c.useState)(!1),[D,E]=(0,c.useState)(!0),[F,G]=(0,c.useState)(!1),[H,I]=(0,c.useState)(""),[J,K]=(0,c.useState)(""),[L,M]=(0,c.useState)(""),[N,O]=(0,c.useState)(""),[P,Q]=(0,c.useState)(!1),R=(0,c.useRef)(null),[S,T]=(0,c.useState)(null),[U,V]=(0,c.useState)([]),[W,X]=(0,c.useState)(""),[Y,Z]=(0,c.useState)(!1),[$,_]=(0,c.useState)(!0),[aa,ab]=(0,c.useState)(!1);(0,c.useEffect)(()=>{a?x?fetch((0,p.api)("/api/auth/me")).then(a=>a.json()).then(a=>{T(a),E(!1)}).catch(()=>E(!1)):fetch((0,p.api)("/api/auth/totp/status")).then(a=>a.json()).then(a=>{C(a.enabled),E(!1)}).catch(()=>E(!1)):E(!1)},[a,x]),(0,c.useEffect)(()=>{fetch((0,p.api)("/api/config")).then(a=>a.json()).then(a=>{Z(a.telemetryOptOut),V(a.devDirectories||[]),ab(!!a.todosEnabled),_(!1)}).catch(()=>_(!1))},[]);let ac=async()=>{let a=!aa;ab(a),await fetch((0,p.api)("/api/config"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({todosEnabled:a})})},ad=async a=>{V(a),await fetch((0,p.api)("/api/config"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({devDirectories:a})})},ae=()=>{let a=W.trim();!a||U.includes(a)||(a.startsWith("/")||/^[A-Za-z]:[\\/]/.test(a))&&(ad([...U,a]),X(""))},af=async()=>{let a=await y.mutateAsync();A(`Synced ${a.projects} projects, ${a.sessions} sessions, enriched ${a.enriched}`),(0,q.track)("sync_completed",{projects:a.projects,sessions:a.sessions,enriched:a.enriched})},ag=async()=>{let a=!Y;Z(a),(0,q.setOptOut)(a),(0,q.track)("telemetry_toggled",{enabled:!a}),await fetch((0,p.api)("/api/config"),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({telemetryOptOut:a})})},ah=async()=>{G(!0),O(""),M("");let a=await fetch((0,p.api)("/api/auth/totp/setup"),{method:"POST"}),b=await a.json();I(b.qrDataUrl),K(b.secret),setTimeout(()=>R.current?.focus(),100)},ai=async a=>{if(6!==a.length)return;Q(!0),O("");let b=await fetch((0,p.api)("/api/auth/totp/verify"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:a,action:"enable"})}),c=await b.json();Q(!1),c.success?(C(!0),G(!1),I(""),K(""),M("")):(O(c.error||"Invalid code"),M(""),R.current?.focus())},aj=async()=>{confirm("Disable 2FA? You will need to set it up again to use terminals.")&&(await fetch((0,p.api)("/api/auth/totp/setup"),{method:"POST"}),C(!1),G(!1))};return(0,b.jsxs)("div",{className:"p-6 max-w-3xl",children:[(0,b.jsxs)("div",{className:"mb-6",children:[(0,b.jsx)("h1",{className:"text-2xl font-bold",children:"Settings"}),(0,b.jsx)("p",{className:"text-muted-foreground text-sm mt-1",children:"Configure Spaces"})]}),(0,b.jsxs)("div",{className:"space-y-6",children:[a&&(0,b.jsxs)("div",{className:"bg-white dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-800 rounded-lg p-5",children:[(0,b.jsxs)("h3",{className:"font-semibold flex items-center gap-2 mb-3",children:[(0,b.jsx)(i.Shield,{className:"w-4 h-4"}),"Terminal Security"]}),D?(0,b.jsxs)("div",{className:"flex items-center gap-2 text-sm text-zinc-400",children:[(0,b.jsx)(h.Loader2,{className:"w-4 h-4 animate-spin"}),"Loading..."]}):x?(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(j.CheckCircle2,{className:"w-5 h-5 text-green-500"}),(0,b.jsx)("span",{className:"text-sm font-medium text-green-500",children:"2FA Enabled"})]}),(0,b.jsx)("p",{className:"text-xs text-zinc-500",children:"Two-factor authentication is required at login. TOTP is managed through the login flow. Contact an admin to reset your 2FA if needed."})]}):B&&!F?(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(j.CheckCircle2,{className:"w-5 h-5 text-green-500"}),(0,b.jsx)("span",{className:"text-sm font-medium text-green-500",children:"2FA Enabled"})]}),(0,b.jsx)("p",{className:"text-xs text-zinc-500",children:"Two-factor authentication is required each time you open a terminal session. Tokens are valid for 8 hours."}),(0,b.jsx)("button",{onClick:aj,className:"text-xs text-zinc-500 hover:text-red-400 transition-colors",children:"Disable 2FA"})]}):F?(0,b.jsxs)("div",{className:"space-y-4",children:[(0,b.jsx)("p",{className:"text-sm text-zinc-400",children:"Scan this QR code with your authenticator app (Google Authenticator, Authy, etc.)"}),H?(0,b.jsxs)("div",{className:"flex flex-col items-center gap-4",children:[(0,b.jsx)("div",{className:"bg-white p-3 rounded-lg",children:(0,b.jsx)("img",{src:H,alt:"TOTP QR Code",width:200,height:200})}),(0,b.jsxs)("div",{className:"text-center",children:[(0,b.jsx)("p",{className:"text-[10px] text-zinc-600 mb-1",children:"Manual entry key:"}),(0,b.jsx)("code",{className:"text-xs bg-zinc-800 px-2 py-1 rounded font-mono select-all",children:J})]})]}):(0,b.jsx)("div",{className:"flex justify-center py-8",children:(0,b.jsx)(h.Loader2,{className:"w-6 h-6 animate-spin text-zinc-400"})}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-xs text-zinc-400 block mb-1.5",children:"Enter the 6-digit code from your authenticator"}),(0,b.jsx)("input",{ref:R,type:"text",inputMode:"numeric",autoComplete:"one-time-code",placeholder:"000000",value:L,onChange:a=>{let b;M(b=a.target.value.replace(/\D/g,"").slice(0,6)),O(""),6===b.length&&ai(b)},disabled:P,className:"w-40 px-3 py-2 text-lg font-mono tracking-[0.3em] text-center bg-zinc-800 border border-zinc-700 rounded-md focus:outline-none focus:border-indigo-500 text-white disabled:opacity-50"}),P&&(0,b.jsxs)("div",{className:"flex items-center gap-2 mt-2 text-xs text-zinc-400",children:[(0,b.jsx)(h.Loader2,{className:"w-3 h-3 animate-spin"}),"Verifying..."]}),N&&(0,b.jsx)("p",{className:"text-xs text-red-400 mt-2",children:N})]}),(0,b.jsx)("button",{onClick:()=>{G(!1),I(""),K("")},className:"text-xs text-zinc-500 hover:text-white transition-colors",children:"Cancel"})]}):(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsx)("p",{className:"text-sm text-zinc-400",children:"Two-factor authentication adds an extra layer of security to terminal access. You'll need an authenticator app to generate codes."}),(0,b.jsxs)("button",{onClick:ah,className:"flex items-center gap-2 px-4 py-2 text-sm bg-indigo-500 text-white rounded-md hover:bg-indigo-600",children:[(0,b.jsx)(i.Shield,{className:"w-4 h-4"}),"Set up 2FA"]})]})]}),(0,b.jsxs)("div",{className:"bg-white dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-800 rounded-lg p-5",children:[(0,b.jsxs)("h3",{className:"font-semibold flex items-center gap-2 mb-3",children:[(0,b.jsx)(g.FolderOpen,{className:"w-4 h-4"}),"Data Source"]}),(0,b.jsxs)("div",{className:"space-y-3 text-sm",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-muted-foreground text-xs",children:"Agent Data Directories"}),(0,b.jsxs)("div",{className:"font-mono text-xs mt-1 p-2 bg-zinc-50 dark:bg-zinc-800 rounded space-y-1",children:[(0,b.jsx)("p",{children:"~/.claude/"}),(0,b.jsx)("p",{children:"~/.codex/"}),(0,b.jsx)("p",{children:"~/.gemini/"})]})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{className:"text-muted-foreground text-xs",children:"Spaces Database"}),(0,b.jsx)("p",{className:"font-mono text-xs mt-1 p-2 bg-zinc-50 dark:bg-zinc-800 rounded",children:"~/.spaces/spaces.db"})]})]})]}),(0,b.jsxs)("div",{className:"bg-white dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-800 rounded-lg p-5",children:[(0,b.jsxs)("h3",{className:"font-semibold flex items-center gap-2 mb-3",children:[(0,b.jsx)(n.FolderCode,{className:"w-4 h-4"}),"Development Directories"]}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground mb-3",children:"Restrict terminal pane creation to these project roots. Paths must be absolute."}),U.length>0&&(0,b.jsx)("div",{className:"space-y-1.5 mb-3",children:U.map(a=>(0,b.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5 bg-zinc-50 dark:bg-zinc-800 rounded-md group",children:[(0,b.jsx)(g.FolderOpen,{className:"w-3.5 h-3.5 text-amber-500/70 flex-shrink-0"}),(0,b.jsx)("span",{className:"font-mono text-xs flex-1 truncate",children:a}),(0,b.jsx)("button",{onClick:()=>{ad(U.filter(b=>b!==a))},className:"text-zinc-400 hover:text-red-400 opacity-0 group-hover:opacity-100 transition-opacity",title:"Remove",children:(0,b.jsx)(m.X,{className:"w-3.5 h-3.5"})})]},a))}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("input",{type:"text",placeholder:"u">typeof navigator&&navigator.platform?.startsWith("Win")?"C:\\Users\\you\\projects":"/home/user/projects",value:W,onChange:a=>X(a.target.value),onKeyDown:a=>"Enter"===a.key&&ae(),className:"flex-1 px-3 py-1.5 text-sm bg-zinc-50 dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 rounded-md focus:outline-none focus:border-indigo-500 font-mono"}),(0,b.jsxs)("button",{onClick:ae,disabled:!W.trim()||!(W.trim().startsWith("/")||/^[A-Za-z]:[\\/]/.test(W.trim())),className:"flex items-center gap-1.5 px-3 py-1.5 text-sm bg-indigo-500 text-white rounded-md hover:bg-indigo-600 disabled:opacity-50",children:[(0,b.jsx)(l.Plus,{className:"w-3.5 h-3.5"}),"Add"]})]})]}),(0,b.jsxs)("div",{className:"bg-white dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-800 rounded-lg p-5",children:[(0,b.jsxs)("h3",{className:"font-semibold flex items-center gap-2 mb-3",children:[(0,b.jsx)(f.RefreshCw,{className:"w-4 h-4"}),"Data Sync"]}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground mb-3",children:"Force a full re-scan of all agent sessions. This rebuilds the index from scratch."}),(0,b.jsxs)("button",{onClick:af,disabled:y.isPending,className:"flex items-center gap-2 px-4 py-2 text-sm bg-indigo-500 text-white rounded-md hover:bg-indigo-600 disabled:opacity-50",children:[y.isPending?(0,b.jsx)(h.Loader2,{className:"w-4 h-4 animate-spin"}):(0,b.jsx)(f.RefreshCw,{className:"w-4 h-4"}),"Re-sync Now"]}),z&&(0,b.jsx)("p",{className:"text-xs text-green-600 mt-2",children:z})]}),(0,b.jsxs)("div",{className:"bg-white dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-800 rounded-lg p-5",children:[(0,b.jsxs)("h3",{className:"font-semibold flex items-center gap-2 mb-3",children:[(0,b.jsx)(o,{className:"w-4 h-4"}),"Experimental"]}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground mb-3",children:"Opt-in to features that are still being shaped."}),(0,b.jsxs)("label",{className:"flex items-start gap-3 cursor-pointer",children:[(0,b.jsx)("input",{type:"checkbox",checked:aa,onChange:ac,className:"mt-0.5 w-4 h-4 rounded border-zinc-300 dark:border-zinc-700 text-indigo-500 focus:ring-indigo-500"}),(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-sm",children:"Workspace todos"}),(0,b.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5",children:"Show a horizontal row of todo chips above the pane grid in each workspace."})]})]})]}),(0,b.jsxs)("div",{className:"bg-white dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-800 rounded-lg p-5",children:[(0,b.jsxs)("h3",{className:"font-semibold flex items-center gap-2 mb-3",children:[(0,b.jsx)(k.BarChart3,{className:"w-4 h-4"}),"Telemetry"]}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground mb-3",children:"Anonymous usage data helps us understand how Spaces is used and improve the product. No file paths, session content, or personal information is ever collected."}),$?(0,b.jsxs)("div",{className:"flex items-center gap-2 text-sm text-zinc-400",children:[(0,b.jsx)(h.Loader2,{className:"w-4 h-4 animate-spin"}),"Loading..."]}):(0,b.jsxs)("label",{className:"flex items-center gap-3 cursor-pointer",children:[(0,b.jsx)("input",{type:"checkbox",checked:!Y,onChange:ag,className:"w-4 h-4 rounded border-zinc-300 dark:border-zinc-700 text-indigo-500 focus:ring-indigo-500"}),(0,b.jsx)("span",{className:"text-sm",children:"Send anonymous usage data"})]})]}),w&&(0,b.jsx)("div",{className:"bg-white dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-800 rounded-lg p-5",children:(0,b.jsx)(s.CortexSettings,{})}),(0,b.jsxs)("div",{className:"bg-white dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-800 rounded-lg p-5",children:[(0,b.jsxs)("h3",{className:"font-semibold flex items-center gap-2 mb-3",children:[(0,b.jsx)(e.Settings,{className:"w-4 h-4"}),"About"]}),(0,b.jsxs)("div",{className:"text-sm space-y-1",children:[(0,b.jsxs)("p",{children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"Version:"})," ",u||"..."]}),(0,b.jsxs)("p",{children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"Tier:"})," ",(0,b.jsx)("span",{className:"capitalize",children:t})]}),(0,b.jsxs)("p",{children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"Data access:"})," Read-only (never modifies agent data directories)"]}),(0,b.jsx)("p",{className:"text-muted-foreground text-xs mt-2",children:"Spaces is an open-source agent workspace manager. All session data stays local on your machine."})]})]})]})]})}a.s(["default",()=>t],773663)}];
2
2
 
3
3
  //# sourceMappingURL=src_app_%28desktop%29_settings_page_tsx_f74824b3._.js.map