@jlongo78/agent-spaces 0.9.6 → 0.9.8

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 (917) hide show
  1. package/.next/standalone/.claude/settings.local.json +68 -0
  2. package/.next/standalone/.claude/spaces-env.json +1 -0
  3. package/.next/standalone/.next/BUILD_ID +1 -1
  4. package/.next/standalone/.next/app-path-routes-manifest.json +1 -0
  5. package/.next/standalone/.next/build-manifest.json +2 -2
  6. package/.next/standalone/.next/prerender-manifest.json +3 -3
  7. package/.next/standalone/.next/required-server-files.json +19 -19
  8. package/.next/standalone/.next/routes-manifest.json +6 -0
  9. package/.next/standalone/.next/server/app/(desktop)/admin/analytics/page_client-reference-manifest.js +1 -1
  10. package/.next/standalone/.next/server/app/(desktop)/admin/users/page_client-reference-manifest.js +1 -1
  11. package/.next/standalone/.next/server/app/(desktop)/analytics/page_client-reference-manifest.js +1 -1
  12. package/.next/standalone/.next/server/app/(desktop)/cortex/page_client-reference-manifest.js +1 -1
  13. package/.next/standalone/.next/server/app/(desktop)/network/page_client-reference-manifest.js +1 -1
  14. package/.next/standalone/.next/server/app/(desktop)/page_client-reference-manifest.js +1 -1
  15. package/.next/standalone/.next/server/app/(desktop)/projects/page_client-reference-manifest.js +1 -1
  16. package/.next/standalone/.next/server/app/(desktop)/sessions/[id]/page.js.nft.json +1 -1
  17. package/.next/standalone/.next/server/app/(desktop)/sessions/[id]/page_client-reference-manifest.js +1 -1
  18. package/.next/standalone/.next/server/app/(desktop)/sessions/page_client-reference-manifest.js +1 -1
  19. package/.next/standalone/.next/server/app/(desktop)/settings/page_client-reference-manifest.js +1 -1
  20. package/.next/standalone/.next/server/app/(desktop)/terminal/page.js.nft.json +1 -1
  21. package/.next/standalone/.next/server/app/(desktop)/terminal/page_client-reference-manifest.js +1 -1
  22. package/.next/standalone/.next/server/app/(desktop)/terminal/pane/[id]/page_client-reference-manifest.js +1 -1
  23. package/.next/standalone/.next/server/app/(desktop)/terminal/remote/[nodeId]/[workspaceId]/page_client-reference-manifest.js +1 -1
  24. package/.next/standalone/.next/server/app/(desktop)/workspaces/page_client-reference-manifest.js +1 -1
  25. package/.next/standalone/.next/server/app/_global-error.html +2 -2
  26. package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
  27. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  28. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  29. package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  30. package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  31. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  32. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  33. package/.next/standalone/.next/server/app/_not-found.html +1 -1
  34. package/.next/standalone/.next/server/app/_not-found.rsc +2 -2
  35. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  36. package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  37. package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  38. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  39. package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  40. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  41. package/.next/standalone/.next/server/app/admin/analytics.html +1 -1
  42. package/.next/standalone/.next/server/app/admin/analytics.rsc +2 -2
  43. package/.next/standalone/.next/server/app/admin/analytics.segments/!KGRlc2t0b3Ap/admin/analytics/__PAGE__.segment.rsc +1 -1
  44. package/.next/standalone/.next/server/app/admin/analytics.segments/!KGRlc2t0b3Ap/admin/analytics.segment.rsc +1 -1
  45. package/.next/standalone/.next/server/app/admin/analytics.segments/!KGRlc2t0b3Ap/admin.segment.rsc +1 -1
  46. package/.next/standalone/.next/server/app/admin/analytics.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
  47. package/.next/standalone/.next/server/app/admin/analytics.segments/_full.segment.rsc +2 -2
  48. package/.next/standalone/.next/server/app/admin/analytics.segments/_head.segment.rsc +1 -1
  49. package/.next/standalone/.next/server/app/admin/analytics.segments/_index.segment.rsc +2 -2
  50. package/.next/standalone/.next/server/app/admin/analytics.segments/_tree.segment.rsc +2 -2
  51. package/.next/standalone/.next/server/app/admin/users.html +1 -1
  52. package/.next/standalone/.next/server/app/admin/users.rsc +2 -2
  53. package/.next/standalone/.next/server/app/admin/users.segments/!KGRlc2t0b3Ap/admin/users/__PAGE__.segment.rsc +1 -1
  54. package/.next/standalone/.next/server/app/admin/users.segments/!KGRlc2t0b3Ap/admin/users.segment.rsc +1 -1
  55. package/.next/standalone/.next/server/app/admin/users.segments/!KGRlc2t0b3Ap/admin.segment.rsc +1 -1
  56. package/.next/standalone/.next/server/app/admin/users.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
  57. package/.next/standalone/.next/server/app/admin/users.segments/_full.segment.rsc +2 -2
  58. package/.next/standalone/.next/server/app/admin/users.segments/_head.segment.rsc +1 -1
  59. package/.next/standalone/.next/server/app/admin/users.segments/_index.segment.rsc +2 -2
  60. package/.next/standalone/.next/server/app/admin/users.segments/_tree.segment.rsc +2 -2
  61. package/.next/standalone/.next/server/app/analytics.html +1 -1
  62. package/.next/standalone/.next/server/app/analytics.rsc +2 -2
  63. package/.next/standalone/.next/server/app/analytics.segments/!KGRlc2t0b3Ap/analytics/__PAGE__.segment.rsc +1 -1
  64. package/.next/standalone/.next/server/app/analytics.segments/!KGRlc2t0b3Ap/analytics.segment.rsc +1 -1
  65. package/.next/standalone/.next/server/app/analytics.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
  66. package/.next/standalone/.next/server/app/analytics.segments/_full.segment.rsc +2 -2
  67. package/.next/standalone/.next/server/app/analytics.segments/_head.segment.rsc +1 -1
  68. package/.next/standalone/.next/server/app/analytics.segments/_index.segment.rsc +2 -2
  69. package/.next/standalone/.next/server/app/analytics.segments/_tree.segment.rsc +2 -2
  70. package/.next/standalone/.next/server/app/api/analytics/overview/route.js +1 -1
  71. package/.next/standalone/.next/server/app/api/analytics/overview/route.js.nft.json +1 -1
  72. package/.next/standalone/.next/server/app/api/benchmark/lobes/route.js +1 -1
  73. package/.next/standalone/.next/server/app/api/benchmark/lobes/route.js.nft.json +1 -1
  74. package/.next/standalone/.next/server/app/api/benchmark/run/route.js +1 -1
  75. package/.next/standalone/.next/server/app/api/benchmark/run/route.js.nft.json +1 -1
  76. package/.next/standalone/.next/server/app/api/benchmark/runs/[id]/route.js +1 -1
  77. package/.next/standalone/.next/server/app/api/benchmark/runs/[id]/route.js.nft.json +1 -1
  78. package/.next/standalone/.next/server/app/api/benchmark/runs/route.js +1 -1
  79. package/.next/standalone/.next/server/app/api/benchmark/runs/route.js.nft.json +1 -1
  80. package/.next/standalone/.next/server/app/api/benchmark/status/route.js +1 -1
  81. package/.next/standalone/.next/server/app/api/benchmark/status/route.js.nft.json +1 -1
  82. package/.next/standalone/.next/server/app/api/bulk/route.js +1 -1
  83. package/.next/standalone/.next/server/app/api/bulk/route.js.nft.json +1 -1
  84. package/.next/standalone/.next/server/app/api/config/route.js +1 -1
  85. package/.next/standalone/.next/server/app/api/config/route.js.nft.json +1 -1
  86. package/.next/standalone/.next/server/app/api/cortex/context/route.js +1 -1
  87. package/.next/standalone/.next/server/app/api/cortex/context/route.js.nft.json +1 -1
  88. package/.next/standalone/.next/server/app/api/cortex/curation/assess/route.js +1 -1
  89. package/.next/standalone/.next/server/app/api/cortex/curation/assess/route.js.nft.json +1 -1
  90. package/.next/standalone/.next/server/app/api/cortex/curation/publish/route.js +1 -1
  91. package/.next/standalone/.next/server/app/api/cortex/curation/publish/route.js.nft.json +1 -1
  92. package/.next/standalone/.next/server/app/api/cortex/curation/refine/route.js +1 -1
  93. package/.next/standalone/.next/server/app/api/cortex/curation/refine/route.js.nft.json +1 -1
  94. package/.next/standalone/.next/server/app/api/cortex/curation/review/route.js +1 -1
  95. package/.next/standalone/.next/server/app/api/cortex/curation/review/route.js.nft.json +1 -1
  96. package/.next/standalone/.next/server/app/api/cortex/curation/seed/route.js +1 -1
  97. package/.next/standalone/.next/server/app/api/cortex/curation/seed/route.js.nft.json +1 -1
  98. package/.next/standalone/.next/server/app/api/cortex/export/route.js +1 -1
  99. package/.next/standalone/.next/server/app/api/cortex/export/route.js.nft.json +1 -1
  100. package/.next/standalone/.next/server/app/api/cortex/federation/pending/route.js +1 -1
  101. package/.next/standalone/.next/server/app/api/cortex/federation/pending/route.js.nft.json +1 -1
  102. package/.next/standalone/.next/server/app/api/cortex/federation/resolve/route.js +1 -1
  103. package/.next/standalone/.next/server/app/api/cortex/federation/resolve/route.js.nft.json +1 -1
  104. package/.next/standalone/.next/server/app/api/cortex/federation/search/route.js +1 -1
  105. package/.next/standalone/.next/server/app/api/cortex/federation/search/route.js.nft.json +1 -1
  106. package/.next/standalone/.next/server/app/api/cortex/federation/teach/route.js +1 -1
  107. package/.next/standalone/.next/server/app/api/cortex/federation/teach/route.js.nft.json +1 -1
  108. package/.next/standalone/.next/server/app/api/cortex/graph/edges/route.js +1 -1
  109. package/.next/standalone/.next/server/app/api/cortex/graph/edges/route.js.nft.json +1 -1
  110. package/.next/standalone/.next/server/app/api/cortex/graph/entities/[id]/route.js +1 -1
  111. package/.next/standalone/.next/server/app/api/cortex/graph/entities/[id]/route.js.nft.json +1 -1
  112. package/.next/standalone/.next/server/app/api/cortex/graph/entities/route.js +1 -1
  113. package/.next/standalone/.next/server/app/api/cortex/graph/entities/route.js.nft.json +1 -1
  114. package/.next/standalone/.next/server/app/api/cortex/graph/populate/route.js +1 -1
  115. package/.next/standalone/.next/server/app/api/cortex/graph/populate/route.js.nft.json +1 -1
  116. package/.next/standalone/.next/server/app/api/cortex/import/route.js +1 -1
  117. package/.next/standalone/.next/server/app/api/cortex/import/route.js.nft.json +1 -1
  118. package/.next/standalone/.next/server/app/api/cortex/import/status/route.js +1 -1
  119. package/.next/standalone/.next/server/app/api/cortex/import/status/route.js.nft.json +1 -1
  120. package/.next/standalone/.next/server/app/api/cortex/ingest/bootstrap/route.js +1 -1
  121. package/.next/standalone/.next/server/app/api/cortex/ingest/bootstrap/route.js.nft.json +1 -1
  122. package/.next/standalone/.next/server/app/api/cortex/ingest/status/route.js +1 -1
  123. package/.next/standalone/.next/server/app/api/cortex/ingest/status/route.js.nft.json +1 -1
  124. package/.next/standalone/.next/server/app/api/cortex/knowledge/[id]/route.js +1 -1
  125. package/.next/standalone/.next/server/app/api/cortex/knowledge/[id]/route.js.nft.json +1 -1
  126. package/.next/standalone/.next/server/app/api/cortex/knowledge/route.js +1 -1
  127. package/.next/standalone/.next/server/app/api/cortex/knowledge/route.js.nft.json +1 -1
  128. package/.next/standalone/.next/server/app/api/cortex/lobes/[id]/route.js +1 -1
  129. package/.next/standalone/.next/server/app/api/cortex/lobes/[id]/route.js.nft.json +1 -1
  130. package/.next/standalone/.next/server/app/api/cortex/lobes/route.js +1 -1
  131. package/.next/standalone/.next/server/app/api/cortex/lobes/route.js.nft.json +1 -1
  132. package/.next/standalone/.next/server/app/api/cortex/lobes/share/route.js +1 -1
  133. package/.next/standalone/.next/server/app/api/cortex/lobes/share/route.js.nft.json +1 -1
  134. package/.next/standalone/.next/server/app/api/cortex/marketplace/browse/route.js +1 -1
  135. package/.next/standalone/.next/server/app/api/cortex/marketplace/browse/route.js.nft.json +1 -1
  136. package/.next/standalone/.next/server/app/api/cortex/marketplace/preview/route.js +1 -1
  137. package/.next/standalone/.next/server/app/api/cortex/marketplace/preview/route.js.nft.json +1 -1
  138. package/.next/standalone/.next/server/app/api/cortex/mcp/call/route.js +1 -1
  139. package/.next/standalone/.next/server/app/api/cortex/mcp/call/route.js.nft.json +1 -1
  140. package/.next/standalone/.next/server/app/api/cortex/mcp/tools/route.js +1 -1
  141. package/.next/standalone/.next/server/app/api/cortex/mcp/tools/route.js.nft.json +1 -1
  142. package/.next/standalone/.next/server/app/api/cortex/search/route.js +1 -1
  143. package/.next/standalone/.next/server/app/api/cortex/search/route.js.nft.json +1 -1
  144. package/.next/standalone/.next/server/app/api/cortex/settings/route.js +1 -1
  145. package/.next/standalone/.next/server/app/api/cortex/settings/route.js.nft.json +1 -1
  146. package/.next/standalone/.next/server/app/api/cortex/status/route.js +1 -1
  147. package/.next/standalone/.next/server/app/api/cortex/status/route.js.nft.json +1 -1
  148. package/.next/standalone/.next/server/app/api/cortex/timeline/route.js +1 -1
  149. package/.next/standalone/.next/server/app/api/cortex/timeline/route.js.nft.json +1 -1
  150. package/.next/standalone/.next/server/app/api/cortex/usage/route.js +1 -1
  151. package/.next/standalone/.next/server/app/api/cortex/usage/route.js.nft.json +1 -1
  152. package/.next/standalone/.next/server/app/api/cortex/workspace/[id]/context/route.js +1 -1
  153. package/.next/standalone/.next/server/app/api/cortex/workspace/[id]/context/route.js.nft.json +1 -1
  154. package/.next/standalone/.next/server/app/api/events/route.js +1 -1
  155. package/.next/standalone/.next/server/app/api/events/route.js.nft.json +1 -1
  156. package/.next/standalone/.next/server/app/api/files/route.js +1 -1
  157. package/.next/standalone/.next/server/app/api/files/route.js.nft.json +1 -1
  158. package/.next/standalone/.next/server/app/api/folders/route.js +1 -1
  159. package/.next/standalone/.next/server/app/api/folders/route.js.nft.json +1 -1
  160. package/.next/standalone/.next/server/app/api/network/handshake/route.js +1 -1
  161. package/.next/standalone/.next/server/app/api/network/handshake/route.js.nft.json +1 -1
  162. package/.next/standalone/.next/server/app/api/network/panes/[id]/route.js +1 -1
  163. package/.next/standalone/.next/server/app/api/network/panes/[id]/route.js.nft.json +1 -1
  164. package/.next/standalone/.next/server/app/api/network/panes/route.js +1 -1
  165. package/.next/standalone/.next/server/app/api/network/panes/route.js.nft.json +1 -1
  166. package/.next/standalone/.next/server/app/api/network/projects/route.js +1 -1
  167. package/.next/standalone/.next/server/app/api/network/projects/route.js.nft.json +1 -1
  168. package/.next/standalone/.next/server/app/api/network/search/route.js +1 -1
  169. package/.next/standalone/.next/server/app/api/network/search/route.js.nft.json +1 -1
  170. package/.next/standalone/.next/server/app/api/network/sessions/[id]/messages/route.js +1 -1
  171. package/.next/standalone/.next/server/app/api/network/sessions/[id]/messages/route.js.nft.json +1 -1
  172. package/.next/standalone/.next/server/app/api/network/sessions/[id]/route.js +1 -1
  173. package/.next/standalone/.next/server/app/api/network/sessions/[id]/route.js.nft.json +1 -1
  174. package/.next/standalone/.next/server/app/api/network/sessions/route.js +1 -1
  175. package/.next/standalone/.next/server/app/api/network/sessions/route.js.nft.json +1 -1
  176. package/.next/standalone/.next/server/app/api/network/workspaces/[id]/route.js +1 -1
  177. package/.next/standalone/.next/server/app/api/network/workspaces/[id]/route.js.nft.json +1 -1
  178. package/.next/standalone/.next/server/app/api/network/workspaces/route.js +1 -1
  179. package/.next/standalone/.next/server/app/api/network/workspaces/route.js.nft.json +1 -1
  180. package/.next/standalone/.next/server/app/api/panes/[id]/diff/route.js +1 -1
  181. package/.next/standalone/.next/server/app/api/panes/[id]/diff/route.js.nft.json +1 -1
  182. package/.next/standalone/.next/server/app/api/panes/[id]/route.js +1 -1
  183. package/.next/standalone/.next/server/app/api/panes/[id]/route.js.nft.json +1 -1
  184. package/.next/standalone/.next/server/app/api/panes/route.js +1 -1
  185. package/.next/standalone/.next/server/app/api/panes/route.js.nft.json +1 -1
  186. package/.next/standalone/.next/server/app/api/projects/route.js +1 -1
  187. package/.next/standalone/.next/server/app/api/projects/route.js.nft.json +1 -1
  188. package/.next/standalone/.next/server/app/api/proxy/models/[modelId]/[...path]/route.js +1 -1
  189. package/.next/standalone/.next/server/app/api/proxy/models/[modelId]/[...path]/route.js.nft.json +1 -1
  190. package/.next/standalone/.next/server/app/api/proxy/models/[modelId]/status/route.js +1 -1
  191. package/.next/standalone/.next/server/app/api/proxy/models/[modelId]/status/route.js.nft.json +1 -1
  192. package/.next/standalone/.next/server/app/api/search/route.js +2 -2
  193. package/.next/standalone/.next/server/app/api/search/route.js.nft.json +1 -1
  194. package/.next/standalone/.next/server/app/api/sessions/[id]/chat/route.js +1 -1
  195. package/.next/standalone/.next/server/app/api/sessions/[id]/chat/route.js.nft.json +1 -1
  196. package/.next/standalone/.next/server/app/api/sessions/[id]/messages/route.js +1 -1
  197. package/.next/standalone/.next/server/app/api/sessions/[id]/messages/route.js.nft.json +1 -1
  198. package/.next/standalone/.next/server/app/api/sessions/[id]/route.js +1 -1
  199. package/.next/standalone/.next/server/app/api/sessions/[id]/route.js.nft.json +1 -1
  200. package/.next/standalone/.next/server/app/api/sessions/route.js +2 -2
  201. package/.next/standalone/.next/server/app/api/sessions/route.js.nft.json +1 -1
  202. package/.next/standalone/.next/server/app/api/sync/route.js +1 -1
  203. package/.next/standalone/.next/server/app/api/sync/route.js.nft.json +1 -1
  204. package/.next/standalone/.next/server/app/api/tags/route.js +1 -1
  205. package/.next/standalone/.next/server/app/api/tags/route.js.nft.json +1 -1
  206. package/.next/standalone/.next/server/app/api/tier/route.js +1 -1
  207. package/.next/standalone/.next/server/app/api/tier/route.js.nft.json +1 -1
  208. package/.next/standalone/.next/server/app/api/whisper/config/route.js +1 -1
  209. package/.next/standalone/.next/server/app/api/whisper/config/route.js.nft.json +1 -1
  210. package/.next/standalone/.next/server/app/api/whisper/route.js.nft.json +1 -1
  211. package/.next/standalone/.next/server/app/api/wizard/chart/route/app-paths-manifest.json +3 -0
  212. package/.next/standalone/.next/server/app/api/wizard/chart/route/build-manifest.json +11 -0
  213. package/.next/standalone/.next/server/app/api/wizard/chart/route/server-reference-manifest.json +4 -0
  214. package/.next/standalone/.next/server/app/api/wizard/chart/route.js +7 -0
  215. package/.next/standalone/.next/server/app/api/wizard/chart/route.js.map +5 -0
  216. package/.next/standalone/.next/server/app/api/wizard/chart/route.js.nft.json +1 -0
  217. package/.next/standalone/.next/server/app/api/wizard/chart/route_client-reference-manifest.js +2 -0
  218. package/.next/standalone/.next/server/app/api/wizard/chat/route.js +1 -1
  219. package/.next/standalone/.next/server/app/api/wizard/chat/route.js.nft.json +1 -1
  220. package/.next/standalone/.next/server/app/api/workspaces/[id]/context/[key]/route.js +1 -1
  221. package/.next/standalone/.next/server/app/api/workspaces/[id]/context/[key]/route.js.nft.json +1 -1
  222. package/.next/standalone/.next/server/app/api/workspaces/[id]/context/route.js +1 -1
  223. package/.next/standalone/.next/server/app/api/workspaces/[id]/context/route.js.nft.json +1 -1
  224. package/.next/standalone/.next/server/app/api/workspaces/[id]/messages/[msgId]/route.js +1 -1
  225. package/.next/standalone/.next/server/app/api/workspaces/[id]/messages/[msgId]/route.js.nft.json +1 -1
  226. package/.next/standalone/.next/server/app/api/workspaces/[id]/messages/route.js +1 -1
  227. package/.next/standalone/.next/server/app/api/workspaces/[id]/messages/route.js.nft.json +1 -1
  228. package/.next/standalone/.next/server/app/api/workspaces/[id]/route.js +1 -1
  229. package/.next/standalone/.next/server/app/api/workspaces/[id]/route.js.nft.json +1 -1
  230. package/.next/standalone/.next/server/app/api/workspaces/[id]/sessions/route.js +1 -1
  231. package/.next/standalone/.next/server/app/api/workspaces/[id]/sessions/route.js.nft.json +1 -1
  232. package/.next/standalone/.next/server/app/api/workspaces/route.js +2 -2
  233. package/.next/standalone/.next/server/app/api/workspaces/route.js.nft.json +1 -1
  234. package/.next/standalone/.next/server/app/cortex.html +1 -1
  235. package/.next/standalone/.next/server/app/cortex.rsc +3 -3
  236. package/.next/standalone/.next/server/app/cortex.segments/!KGRlc2t0b3Ap/cortex/__PAGE__.segment.rsc +2 -2
  237. package/.next/standalone/.next/server/app/cortex.segments/!KGRlc2t0b3Ap/cortex.segment.rsc +1 -1
  238. package/.next/standalone/.next/server/app/cortex.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
  239. package/.next/standalone/.next/server/app/cortex.segments/_full.segment.rsc +3 -3
  240. package/.next/standalone/.next/server/app/cortex.segments/_head.segment.rsc +1 -1
  241. package/.next/standalone/.next/server/app/cortex.segments/_index.segment.rsc +2 -2
  242. package/.next/standalone/.next/server/app/cortex.segments/_tree.segment.rsc +2 -2
  243. package/.next/standalone/.next/server/app/login/page_client-reference-manifest.js +1 -1
  244. package/.next/standalone/.next/server/app/login.html +1 -1
  245. package/.next/standalone/.next/server/app/login.rsc +2 -2
  246. package/.next/standalone/.next/server/app/login.segments/_full.segment.rsc +2 -2
  247. package/.next/standalone/.next/server/app/login.segments/_head.segment.rsc +1 -1
  248. package/.next/standalone/.next/server/app/login.segments/_index.segment.rsc +2 -2
  249. package/.next/standalone/.next/server/app/login.segments/_tree.segment.rsc +2 -2
  250. package/.next/standalone/.next/server/app/login.segments/login/__PAGE__.segment.rsc +1 -1
  251. package/.next/standalone/.next/server/app/login.segments/login.segment.rsc +1 -1
  252. package/.next/standalone/.next/server/app/m/page_client-reference-manifest.js +1 -1
  253. package/.next/standalone/.next/server/app/m/projects/page_client-reference-manifest.js +1 -1
  254. package/.next/standalone/.next/server/app/m/projects.html +1 -1
  255. package/.next/standalone/.next/server/app/m/projects.rsc +2 -2
  256. package/.next/standalone/.next/server/app/m/projects.segments/_full.segment.rsc +2 -2
  257. package/.next/standalone/.next/server/app/m/projects.segments/_head.segment.rsc +1 -1
  258. package/.next/standalone/.next/server/app/m/projects.segments/_index.segment.rsc +2 -2
  259. package/.next/standalone/.next/server/app/m/projects.segments/_tree.segment.rsc +2 -2
  260. package/.next/standalone/.next/server/app/m/projects.segments/m/projects/__PAGE__.segment.rsc +1 -1
  261. package/.next/standalone/.next/server/app/m/projects.segments/m/projects.segment.rsc +1 -1
  262. package/.next/standalone/.next/server/app/m/projects.segments/m.segment.rsc +1 -1
  263. package/.next/standalone/.next/server/app/m/sessions/[id]/page.js.nft.json +1 -1
  264. package/.next/standalone/.next/server/app/m/sessions/[id]/page_client-reference-manifest.js +1 -1
  265. package/.next/standalone/.next/server/app/m/sessions/page_client-reference-manifest.js +1 -1
  266. package/.next/standalone/.next/server/app/m/sessions.html +1 -1
  267. package/.next/standalone/.next/server/app/m/sessions.rsc +2 -2
  268. package/.next/standalone/.next/server/app/m/sessions.segments/_full.segment.rsc +2 -2
  269. package/.next/standalone/.next/server/app/m/sessions.segments/_head.segment.rsc +1 -1
  270. package/.next/standalone/.next/server/app/m/sessions.segments/_index.segment.rsc +2 -2
  271. package/.next/standalone/.next/server/app/m/sessions.segments/_tree.segment.rsc +2 -2
  272. package/.next/standalone/.next/server/app/m/sessions.segments/m/sessions/__PAGE__.segment.rsc +1 -1
  273. package/.next/standalone/.next/server/app/m/sessions.segments/m/sessions.segment.rsc +1 -1
  274. package/.next/standalone/.next/server/app/m/sessions.segments/m.segment.rsc +1 -1
  275. package/.next/standalone/.next/server/app/m/settings/page_client-reference-manifest.js +1 -1
  276. package/.next/standalone/.next/server/app/m/settings.html +1 -1
  277. package/.next/standalone/.next/server/app/m/settings.rsc +2 -2
  278. package/.next/standalone/.next/server/app/m/settings.segments/_full.segment.rsc +2 -2
  279. package/.next/standalone/.next/server/app/m/settings.segments/_head.segment.rsc +1 -1
  280. package/.next/standalone/.next/server/app/m/settings.segments/_index.segment.rsc +2 -2
  281. package/.next/standalone/.next/server/app/m/settings.segments/_tree.segment.rsc +2 -2
  282. package/.next/standalone/.next/server/app/m/settings.segments/m/settings/__PAGE__.segment.rsc +1 -1
  283. package/.next/standalone/.next/server/app/m/settings.segments/m/settings.segment.rsc +1 -1
  284. package/.next/standalone/.next/server/app/m/settings.segments/m.segment.rsc +1 -1
  285. package/.next/standalone/.next/server/app/m/terminal/page_client-reference-manifest.js +1 -1
  286. package/.next/standalone/.next/server/app/m/terminal.html +1 -1
  287. package/.next/standalone/.next/server/app/m/terminal.rsc +3 -3
  288. package/.next/standalone/.next/server/app/m/terminal.segments/_full.segment.rsc +3 -3
  289. package/.next/standalone/.next/server/app/m/terminal.segments/_head.segment.rsc +1 -1
  290. package/.next/standalone/.next/server/app/m/terminal.segments/_index.segment.rsc +2 -2
  291. package/.next/standalone/.next/server/app/m/terminal.segments/_tree.segment.rsc +2 -2
  292. package/.next/standalone/.next/server/app/m/terminal.segments/m/terminal/__PAGE__.segment.rsc +2 -2
  293. package/.next/standalone/.next/server/app/m/terminal.segments/m/terminal.segment.rsc +1 -1
  294. package/.next/standalone/.next/server/app/m/terminal.segments/m.segment.rsc +1 -1
  295. package/.next/standalone/.next/server/app/m.html +1 -1
  296. package/.next/standalone/.next/server/app/m.rsc +2 -2
  297. package/.next/standalone/.next/server/app/m.segments/_full.segment.rsc +2 -2
  298. package/.next/standalone/.next/server/app/m.segments/_head.segment.rsc +1 -1
  299. package/.next/standalone/.next/server/app/m.segments/_index.segment.rsc +2 -2
  300. package/.next/standalone/.next/server/app/m.segments/_tree.segment.rsc +2 -2
  301. package/.next/standalone/.next/server/app/m.segments/m/__PAGE__.segment.rsc +1 -1
  302. package/.next/standalone/.next/server/app/m.segments/m.segment.rsc +1 -1
  303. package/.next/standalone/.next/server/app/network.html +1 -1
  304. package/.next/standalone/.next/server/app/network.rsc +2 -2
  305. package/.next/standalone/.next/server/app/network.segments/!KGRlc2t0b3Ap/network/__PAGE__.segment.rsc +1 -1
  306. package/.next/standalone/.next/server/app/network.segments/!KGRlc2t0b3Ap/network.segment.rsc +1 -1
  307. package/.next/standalone/.next/server/app/network.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
  308. package/.next/standalone/.next/server/app/network.segments/_full.segment.rsc +2 -2
  309. package/.next/standalone/.next/server/app/network.segments/_head.segment.rsc +1 -1
  310. package/.next/standalone/.next/server/app/network.segments/_index.segment.rsc +2 -2
  311. package/.next/standalone/.next/server/app/network.segments/_tree.segment.rsc +2 -2
  312. package/.next/standalone/.next/server/app/projects.html +1 -1
  313. package/.next/standalone/.next/server/app/projects.rsc +2 -2
  314. package/.next/standalone/.next/server/app/projects.segments/!KGRlc2t0b3Ap/projects/__PAGE__.segment.rsc +1 -1
  315. package/.next/standalone/.next/server/app/projects.segments/!KGRlc2t0b3Ap/projects.segment.rsc +1 -1
  316. package/.next/standalone/.next/server/app/projects.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
  317. package/.next/standalone/.next/server/app/projects.segments/_full.segment.rsc +2 -2
  318. package/.next/standalone/.next/server/app/projects.segments/_head.segment.rsc +1 -1
  319. package/.next/standalone/.next/server/app/projects.segments/_index.segment.rsc +2 -2
  320. package/.next/standalone/.next/server/app/projects.segments/_tree.segment.rsc +2 -2
  321. package/.next/standalone/.next/server/app/sessions.html +1 -1
  322. package/.next/standalone/.next/server/app/sessions.rsc +2 -2
  323. package/.next/standalone/.next/server/app/sessions.segments/!KGRlc2t0b3Ap/sessions/__PAGE__.segment.rsc +1 -1
  324. package/.next/standalone/.next/server/app/sessions.segments/!KGRlc2t0b3Ap/sessions.segment.rsc +1 -1
  325. package/.next/standalone/.next/server/app/sessions.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
  326. package/.next/standalone/.next/server/app/sessions.segments/_full.segment.rsc +2 -2
  327. package/.next/standalone/.next/server/app/sessions.segments/_head.segment.rsc +1 -1
  328. package/.next/standalone/.next/server/app/sessions.segments/_index.segment.rsc +2 -2
  329. package/.next/standalone/.next/server/app/sessions.segments/_tree.segment.rsc +2 -2
  330. package/.next/standalone/.next/server/app/settings.html +1 -1
  331. package/.next/standalone/.next/server/app/settings.rsc +2 -2
  332. package/.next/standalone/.next/server/app/settings.segments/!KGRlc2t0b3Ap/settings/__PAGE__.segment.rsc +1 -1
  333. package/.next/standalone/.next/server/app/settings.segments/!KGRlc2t0b3Ap/settings.segment.rsc +1 -1
  334. package/.next/standalone/.next/server/app/settings.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
  335. package/.next/standalone/.next/server/app/settings.segments/_full.segment.rsc +2 -2
  336. package/.next/standalone/.next/server/app/settings.segments/_head.segment.rsc +1 -1
  337. package/.next/standalone/.next/server/app/settings.segments/_index.segment.rsc +2 -2
  338. package/.next/standalone/.next/server/app/settings.segments/_tree.segment.rsc +2 -2
  339. package/.next/standalone/.next/server/app/terminal.html +1 -1
  340. package/.next/standalone/.next/server/app/terminal.rsc +3 -3
  341. package/.next/standalone/.next/server/app/terminal.segments/!KGRlc2t0b3Ap/terminal/__PAGE__.segment.rsc +2 -2
  342. package/.next/standalone/.next/server/app/terminal.segments/!KGRlc2t0b3Ap/terminal.segment.rsc +1 -1
  343. package/.next/standalone/.next/server/app/terminal.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
  344. package/.next/standalone/.next/server/app/terminal.segments/_full.segment.rsc +3 -3
  345. package/.next/standalone/.next/server/app/terminal.segments/_head.segment.rsc +1 -1
  346. package/.next/standalone/.next/server/app/terminal.segments/_index.segment.rsc +2 -2
  347. package/.next/standalone/.next/server/app/terminal.segments/_tree.segment.rsc +2 -2
  348. package/.next/standalone/.next/server/app/vr/page/react-loadable-manifest.json +1 -1
  349. package/.next/standalone/.next/server/app/vr/page_client-reference-manifest.js +1 -1
  350. package/.next/standalone/.next/server/app/vr.html +1 -1
  351. package/.next/standalone/.next/server/app/vr.rsc +3 -3
  352. package/.next/standalone/.next/server/app/vr.segments/_full.segment.rsc +3 -3
  353. package/.next/standalone/.next/server/app/vr.segments/_head.segment.rsc +1 -1
  354. package/.next/standalone/.next/server/app/vr.segments/_index.segment.rsc +2 -2
  355. package/.next/standalone/.next/server/app/vr.segments/_tree.segment.rsc +2 -2
  356. package/.next/standalone/.next/server/app/vr.segments/vr/__PAGE__.segment.rsc +2 -2
  357. package/.next/standalone/.next/server/app/vr.segments/vr.segment.rsc +1 -1
  358. package/.next/standalone/.next/server/app/workspaces.html +1 -1
  359. package/.next/standalone/.next/server/app/workspaces.rsc +2 -2
  360. package/.next/standalone/.next/server/app/workspaces.segments/!KGRlc2t0b3Ap/workspaces/__PAGE__.segment.rsc +1 -1
  361. package/.next/standalone/.next/server/app/workspaces.segments/!KGRlc2t0b3Ap/workspaces.segment.rsc +1 -1
  362. package/.next/standalone/.next/server/app/workspaces.segments/!KGRlc2t0b3Ap.segment.rsc +1 -1
  363. package/.next/standalone/.next/server/app/workspaces.segments/_full.segment.rsc +2 -2
  364. package/.next/standalone/.next/server/app/workspaces.segments/_head.segment.rsc +1 -1
  365. package/.next/standalone/.next/server/app/workspaces.segments/_index.segment.rsc +2 -2
  366. package/.next/standalone/.next/server/app/workspaces.segments/_tree.segment.rsc +2 -2
  367. package/.next/standalone/.next/server/app-paths-manifest.json +1 -0
  368. package/.next/standalone/.next/server/chunks/[root-of-the-server]__00e90fc6._.js +98 -0
  369. package/.next/standalone/.next/server/chunks/[root-of-the-server]__01ab8675._.js +98 -0
  370. package/.next/standalone/.next/server/chunks/[root-of-the-server]__03974f05._.js +98 -0
  371. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__bb331da9._.js → [root-of-the-server]__046c9b91._.js} +3 -3
  372. package/.next/standalone/.next/server/chunks/[root-of-the-server]__04ae6bf0._.js +98 -0
  373. package/.next/standalone/.next/server/chunks/[root-of-the-server]__056fa416._.js +1 -1
  374. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0ac4ea3f._.js +3 -0
  375. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0b8e64cb._.js +98 -0
  376. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__d95165f0._.js → [root-of-the-server]__0facd39e._.js} +3 -3
  377. package/.next/standalone/.next/server/chunks/[root-of-the-server]__10bc76a3._.js +3 -0
  378. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__9d68157b._.js → [root-of-the-server]__115f3934._.js} +3 -3
  379. package/.next/standalone/.next/server/chunks/[root-of-the-server]__11f155f1._.js +3 -0
  380. package/.next/standalone/.next/server/chunks/[root-of-the-server]__160e7c73._.js +22 -33
  381. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__91e23c96._.js → [root-of-the-server]__17a3b966._.js} +3 -3
  382. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__277d9445._.js → [root-of-the-server]__17d3a2b2._.js} +3 -3
  383. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1a86c055._.js +98 -0
  384. package/.next/standalone/.next/server/chunks/[root-of-the-server]__20b5e9c4._.js +3 -0
  385. package/.next/standalone/.next/server/chunks/[root-of-the-server]__28d6fbd8._.js +98 -0
  386. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__04f04898._.js → [root-of-the-server]__2a3f866b._.js} +2 -2
  387. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__a95bb38b._.js → [root-of-the-server]__316617e7._.js} +2 -2
  388. package/.next/standalone/.next/server/chunks/[root-of-the-server]__32ad8f71._.js +98 -0
  389. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__6fe5e6c8._.js → [root-of-the-server]__35457394._.js} +2 -2
  390. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__1f054c65._.js → [root-of-the-server]__35de78e6._.js} +3 -3
  391. package/.next/standalone/.next/server/chunks/[root-of-the-server]__3685ffcb._.js +98 -0
  392. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__614458b7._.js → [root-of-the-server]__38954988._.js} +3 -3
  393. package/.next/standalone/.next/server/chunks/[root-of-the-server]__426ad936._.js +106 -0
  394. package/.next/standalone/.next/server/chunks/[root-of-the-server]__4985c034._.js +98 -0
  395. package/.next/standalone/.next/server/chunks/[root-of-the-server]__5c6ce9ed._.js +98 -0
  396. package/.next/standalone/.next/server/chunks/[root-of-the-server]__5cebe58a._.js +98 -0
  397. package/.next/standalone/.next/server/chunks/[root-of-the-server]__5d5e4789._.js +98 -0
  398. package/.next/standalone/.next/server/chunks/[root-of-the-server]__65676930._.js +3 -0
  399. package/.next/standalone/.next/server/chunks/[root-of-the-server]__67cab326._.js +58 -0
  400. package/.next/standalone/.next/server/chunks/[root-of-the-server]__698c6f01._.js +98 -0
  401. package/.next/standalone/.next/server/chunks/[root-of-the-server]__6c64af29._.js +131 -0
  402. package/.next/standalone/.next/server/chunks/[root-of-the-server]__73aed9f5._.js +98 -0
  403. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__ac84b704._.js → [root-of-the-server]__79b6a9bb._.js} +3 -3
  404. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__e56abacf._.js → [root-of-the-server]__7db704c6._.js} +4 -4
  405. package/.next/standalone/.next/server/chunks/[root-of-the-server]__812ca02b._.js +98 -0
  406. package/.next/standalone/.next/server/chunks/[root-of-the-server]__821f50fa._.js +98 -0
  407. package/.next/standalone/.next/server/chunks/[root-of-the-server]__8716b86e._.js +98 -0
  408. package/.next/standalone/.next/server/chunks/[root-of-the-server]__884ef754._.js +98 -0
  409. package/.next/standalone/.next/server/chunks/[root-of-the-server]__88cdbd68._.js +98 -0
  410. package/.next/standalone/.next/server/chunks/[root-of-the-server]__89d9aba9._.js +98 -0
  411. package/.next/standalone/.next/server/chunks/[root-of-the-server]__8d536cb5._.js +98 -0
  412. package/.next/standalone/.next/server/chunks/[root-of-the-server]__8df8c5d1._.js +98 -0
  413. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__2d7a454e._.js → [root-of-the-server]__8f2ccc41._.js} +3 -3
  414. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__2a2c5fc5._.js → [root-of-the-server]__95c9d682._.js} +4 -4
  415. package/.next/standalone/.next/server/chunks/[root-of-the-server]__9e5d7774._.js +98 -0
  416. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__cc6e2885._.js → [root-of-the-server]__9edcff87._.js} +2 -2
  417. package/.next/standalone/.next/server/chunks/[root-of-the-server]__a049dfc2._.js +98 -0
  418. package/.next/standalone/.next/server/chunks/[root-of-the-server]__a5b4bb9a._.js +98 -0
  419. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__929ea03a._.js → [root-of-the-server]__a83262a1._.js} +2 -2
  420. package/.next/standalone/.next/server/chunks/[root-of-the-server]__a9cd1240._.js +98 -0
  421. package/.next/standalone/.next/server/chunks/[root-of-the-server]__a9d7f822._.js +98 -0
  422. package/.next/standalone/.next/server/chunks/[root-of-the-server]__ad08c221._.js +98 -0
  423. package/.next/standalone/.next/server/chunks/[root-of-the-server]__ad585f2f._.js +98 -0
  424. package/.next/standalone/.next/server/chunks/[root-of-the-server]__afcb8f7d._.js +98 -0
  425. package/.next/standalone/.next/server/chunks/[root-of-the-server]__bc250d43._.js +98 -0
  426. package/.next/standalone/.next/server/chunks/[root-of-the-server]__bce2a6e7._.js +98 -0
  427. package/.next/standalone/.next/server/chunks/[root-of-the-server]__c011bf91._.js +98 -0
  428. package/.next/standalone/.next/server/chunks/[root-of-the-server]__c0ac2895._.js +3 -0
  429. package/.next/standalone/.next/server/chunks/[root-of-the-server]__c130a00c._.js +1 -1
  430. package/.next/standalone/.next/server/chunks/[root-of-the-server]__c37d6380._.js +3 -0
  431. package/.next/standalone/.next/server/chunks/[root-of-the-server]__cae392eb._.js +98 -0
  432. package/.next/standalone/.next/server/chunks/[root-of-the-server]__cc2616bb._.js +3 -3
  433. package/.next/standalone/.next/server/chunks/[root-of-the-server]__d501fa9b._.js +98 -0
  434. package/.next/standalone/.next/server/chunks/[root-of-the-server]__d59c6c15._.js +98 -0
  435. package/.next/standalone/.next/server/chunks/[root-of-the-server]__d5c1db32._.js +98 -0
  436. package/.next/standalone/.next/server/chunks/[root-of-the-server]__d5d92527._.js +1 -1
  437. package/.next/standalone/.next/server/chunks/[root-of-the-server]__dba60c86._.js +98 -0
  438. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__2384f98e._.js → [root-of-the-server]__de14b9ae._.js} +3 -3
  439. package/.next/standalone/.next/server/chunks/[root-of-the-server]__e10643d1._.js +98 -0
  440. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__00fdfbda._.js → [root-of-the-server]__e2a996e5._.js} +2 -2
  441. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__4d903941._.js → [root-of-the-server]__e3477417._.js} +3 -3
  442. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__32dc5513._.js → [root-of-the-server]__e4db362e._.js} +2 -2
  443. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__49e42a3a._.js → [root-of-the-server]__e4e70b86._.js} +3 -3
  444. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__ac39ecc7._.js → [root-of-the-server]__e54925af._.js} +3 -3
  445. package/.next/standalone/.next/server/chunks/[root-of-the-server]__e8edc5b0._.js +98 -0
  446. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__eafd040b._.js → [root-of-the-server]__eab4d83b._.js} +2 -2
  447. package/.next/standalone/.next/server/chunks/[root-of-the-server]__ead29015._.js +1 -1
  448. package/.next/standalone/.next/server/chunks/{[root-of-the-server]__194955d4._.js → [root-of-the-server]__f056fd83._.js} +3 -3
  449. package/.next/standalone/.next/server/chunks/[root-of-the-server]__f0e99572._.js +98 -0
  450. package/.next/standalone/.next/server/chunks/[root-of-the-server]__fe1e16d0._.js +98 -0
  451. package/.next/standalone/.next/server/chunks/[root-of-the-server]__ff9cd277._.js +98 -0
  452. package/.next/standalone/.next/server/chunks/[root-of-the-server]__ffaea2ce._.js +98 -0
  453. package/.next/standalone/.next/server/chunks/_next-internal_server_app_api_wizard_chart_route_actions_888e2ec1.js +3 -0
  454. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__2cffc362._.js +3 -0
  455. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__f1050870._.js → [root-of-the-server]__47c97637._.js} +2 -2
  456. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__66aca5d4._.js +1 -1
  457. package/.next/standalone/.next/server/chunks/ssr/_17b946fd._.js +3 -0
  458. package/.next/standalone/.next/server/chunks/ssr/_2a1d79e7._.js +1 -1
  459. package/.next/standalone/.next/server/chunks/ssr/_5c3c4cfa._.js +7 -5
  460. package/.next/standalone/.next/server/chunks/ssr/_ba432382._.js +7 -5
  461. package/.next/standalone/.next/server/chunks/ssr/src_app_(desktop)_cortex_page_tsx_0f33d8b3._.js +1 -1
  462. package/.next/standalone/.next/server/chunks/ssr/src_app_(desktop)_terminal_page_tsx_de5e8d85._.js +4 -4
  463. package/.next/standalone/.next/server/edge/chunks/[root-of-the-server]__90eeddae._.js +1 -1
  464. package/.next/standalone/.next/server/middleware-manifest.json +5 -5
  465. package/.next/standalone/.next/server/pages/404.html +1 -1
  466. package/.next/standalone/.next/server/pages/500.html +2 -2
  467. package/.next/standalone/.next/server/server-reference-manifest.js +1 -1
  468. package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
  469. package/.next/standalone/.next/static/chunks/0852575eb90c1e8d.js +85 -0
  470. package/.next/standalone/.next/static/chunks/{74d0ac0b1d0a1b79.js → 10b00b4f66102dcf.js} +1 -1
  471. package/.next/standalone/.next/static/chunks/{16eb77953dee9ea3.js → 19c71a8376c23c58.js} +1 -1
  472. package/.next/standalone/.next/static/chunks/2b769d1597e4fc1c.css +3 -0
  473. package/.next/standalone/.next/static/chunks/{3e91fc608659c524.js → 350271fe79509caf.js} +1 -1
  474. package/.next/standalone/.next/static/chunks/{70423c7afd8abf5f.js → 597847c22200c212.js} +1 -1
  475. package/.next/standalone/.next/static/chunks/{fb0abd1933b2b2e1.js → 7f6a14f1849fa94d.js} +1 -1
  476. package/.next/standalone/.next/static/chunks/{7ecd9bbb0ce4d68a.js → b7c8fe9b7275a84f.js} +1 -1
  477. package/.next/standalone/.next/static/chunks/{6245135a7afb8c7b.js → c9b10fc55516d142.js} +8 -6
  478. package/.next/standalone/.next/static/chunks/d0065f48eab94944.js +1 -0
  479. package/.next/standalone/.next/static/chunks/{180c1b9ff31b979f.js → f7b34c807badf95d.js} +8 -6
  480. package/.next/standalone/.spaces/cortex-context.md +50 -144
  481. package/.next/standalone/LICENSE +661 -661
  482. package/.next/standalone/NOTICE +5 -5
  483. package/.next/standalone/README.md +131 -131
  484. package/.next/standalone/bin/cortex-hook.js +79 -79
  485. package/.next/standalone/bin/cortex-hook.sh +62 -62
  486. package/.next/standalone/bin/cortex-learn-hook.js +138 -138
  487. package/.next/standalone/bin/cortex-mcp.js +60 -60
  488. package/.next/standalone/bin/cortex-pi-extension.ts +170 -170
  489. package/.next/standalone/bin/fix-standalone-externals.js +79 -79
  490. package/.next/standalone/bin/lib/auto-setup.js +110 -110
  491. package/.next/standalone/bin/mdns-service.js +171 -171
  492. package/.next/standalone/bin/postinstall.js +35 -35
  493. package/.next/standalone/bin/setup-admin.js +195 -195
  494. package/.next/standalone/bin/spaces-dev.js +247 -247
  495. package/.next/standalone/bin/spaces-install.js +660 -660
  496. package/.next/standalone/bin/spaces-postinstall.js +50 -50
  497. package/.next/standalone/bin/spaces-reset-totp.js +50 -50
  498. package/.next/standalone/bin/spaces-service.js +1046 -1046
  499. package/.next/standalone/bin/spaces-setup.js +253 -253
  500. package/.next/standalone/bin/spaces.js +808 -805
  501. package/.next/standalone/bin/ssh-auth-keys.sh +68 -68
  502. package/.next/standalone/bin/terminal-server.js +2819 -2781
  503. package/.next/standalone/cortex-hook-debug.log +57 -23
  504. package/.next/standalone/docker-compose.yml +28 -28
  505. package/.next/standalone/docs/architecture.md +387 -387
  506. package/.next/standalone/docs/cortex-integration-reference.md +268 -268
  507. package/.next/standalone/docs/cortex.md +293 -293
  508. package/.next/standalone/docs/getting-started.md +96 -96
  509. package/.next/standalone/docs/plans/2026-02-24-multi-agent-sessions-design.md +133 -133
  510. package/.next/standalone/docs/plans/2026-02-24-multi-agent-sessions-plan.md +959 -959
  511. package/.next/standalone/docs/plans/2026-03-02-security-audit.md +229 -229
  512. package/.next/standalone/docs/plans/2026-03-07-service-command-design.md +146 -146
  513. package/.next/standalone/docs/plans/2026-03-07-service-command-plan.md +254 -254
  514. package/.next/standalone/docs/server-install.md +564 -564
  515. package/.next/standalone/docs/social-card.html +150 -150
  516. package/.next/standalone/docs/superpowers/plans/2026-03-12-spaces-cortex.md +5270 -5270
  517. package/.next/standalone/docs/superpowers/plans/2026-03-13-cortex-wiring.md +1387 -1387
  518. package/.next/standalone/docs/superpowers/plans/2026-03-14-cortex-v2-entity-graph.md +1923 -1923
  519. package/.next/standalone/docs/superpowers/plans/2026-03-14-cortex-v2-knowledge-evolution.md +1113 -1113
  520. package/.next/standalone/docs/superpowers/plans/2026-03-15-cortex-v2-boundary-engine.md +853 -853
  521. package/.next/standalone/docs/superpowers/plans/2026-03-15-cortex-v2-context-engine.md +1274 -1274
  522. package/.next/standalone/docs/superpowers/plans/2026-03-15-cortex-v2-signal-ingestion.md +933 -933
  523. package/.next/standalone/docs/superpowers/plans/2026-03-16-cortex-lobes.md +1080 -1080
  524. package/.next/standalone/docs/superpowers/plans/2026-03-16-cortex-v2-gravity-system.md +768 -768
  525. package/.next/standalone/docs/superpowers/plans/2026-03-16-cortex-v2-ui.md +1108 -1108
  526. package/.next/standalone/docs/superpowers/plans/2026-03-18-cortex-ui-integration.md +1846 -1846
  527. package/.next/standalone/docs/superpowers/plans/2026-03-19-vr-phase1-shell.md +1639 -1639
  528. package/.next/standalone/docs/superpowers/plans/2026-03-27-dockview-pane-layout.md +98 -98
  529. package/.next/standalone/docs/superpowers/specs/2026-03-11-universe-view-design.md +320 -320
  530. package/.next/standalone/docs/superpowers/specs/2026-03-12-spaces-brain-design.md +720 -720
  531. package/.next/standalone/docs/superpowers/specs/2026-03-13-cortex-wiring-design.md +268 -268
  532. package/.next/standalone/docs/superpowers/specs/2026-03-14-cortex-v2-design.md +623 -623
  533. package/.next/standalone/docs/superpowers/specs/2026-03-16-cortex-lobes-design.md +263 -263
  534. package/.next/standalone/docs/superpowers/specs/2026-03-16-cortex-v2-ui-design.md +240 -240
  535. package/.next/standalone/docs/superpowers/specs/2026-03-16-pane-ux-design.md +77 -77
  536. package/.next/standalone/docs/superpowers/specs/2026-03-18-cortex-ui-integration-design.md +341 -341
  537. package/.next/standalone/docs/superpowers/specs/2026-03-19-vr-phase1-shell-design.md +288 -288
  538. package/.next/standalone/docs/superpowers/specs/2026-03-27-pane-diff-review-and-project-wizard-design.md +322 -322
  539. package/.next/standalone/docs/tiers.md +104 -104
  540. package/.next/standalone/eslint.config.mjs +18 -18
  541. package/.next/standalone/next.config.ts +20 -20
  542. package/.next/standalone/nginx.conf +53 -53
  543. package/.next/standalone/node_modules/@img/sharp-win32-x64/lib/sharp-win32-x64.node +0 -0
  544. package/.next/standalone/node_modules/@img/{sharp-linux-x64 → sharp-win32-x64}/package.json +39 -46
  545. package/.next/standalone/package-lock.json +14985 -14986
  546. package/.next/standalone/package.json +111 -111
  547. package/.next/standalone/postcss.config.mjs +7 -7
  548. package/.next/standalone/scripts/rebuild.cmd +65 -65
  549. package/.next/standalone/scripts/rebuild.sh +59 -59
  550. package/.next/standalone/server.js +1 -1
  551. package/.next/standalone/src/app/(desktop)/admin/analytics/page.tsx +266 -266
  552. package/.next/standalone/src/app/(desktop)/admin/users/page.tsx +399 -399
  553. package/.next/standalone/src/app/(desktop)/analytics/page.tsx +166 -166
  554. package/.next/standalone/src/app/(desktop)/cortex/page.tsx +81 -81
  555. package/.next/standalone/src/app/(desktop)/dashboard-client.tsx +56 -56
  556. package/.next/standalone/src/app/(desktop)/layout.tsx +18 -18
  557. package/.next/standalone/src/app/(desktop)/network/page.tsx +137 -137
  558. package/.next/standalone/src/app/(desktop)/page.tsx +17 -17
  559. package/.next/standalone/src/app/(desktop)/projects/page.tsx +68 -68
  560. package/.next/standalone/src/app/(desktop)/sessions/[id]/page.tsx +519 -519
  561. package/.next/standalone/src/app/(desktop)/sessions/page.tsx +145 -145
  562. package/.next/standalone/src/app/(desktop)/settings/page.tsx +446 -446
  563. package/.next/standalone/src/app/(desktop)/terminal/layout.tsx +7 -7
  564. package/.next/standalone/src/app/(desktop)/terminal/page.tsx +1330 -1291
  565. package/.next/standalone/src/app/(desktop)/terminal/pane/[id]/page.tsx +211 -211
  566. package/.next/standalone/src/app/(desktop)/terminal/remote/[nodeId]/[workspaceId]/page.tsx +252 -252
  567. package/.next/standalone/src/app/(desktop)/workspaces/page.tsx +12 -12
  568. package/.next/standalone/src/app/api/admin/analytics/route.ts +10 -10
  569. package/.next/standalone/src/app/api/admin/users/[id]/route.ts +20 -20
  570. package/.next/standalone/src/app/api/admin/users/route.ts +15 -15
  571. package/.next/standalone/src/app/api/analytics/overview/route.ts +80 -80
  572. package/.next/standalone/src/app/api/auth/login/route.ts +10 -10
  573. package/.next/standalone/src/app/api/auth/logout/route.ts +9 -9
  574. package/.next/standalone/src/app/api/auth/me/route.ts +22 -22
  575. package/.next/standalone/src/app/api/auth/totp/setup/route.ts +10 -10
  576. package/.next/standalone/src/app/api/auth/totp/status/route.ts +10 -10
  577. package/.next/standalone/src/app/api/auth/totp/verify/route.ts +10 -10
  578. package/.next/standalone/src/app/api/benchmark/lobes/route.ts +16 -16
  579. package/.next/standalone/src/app/api/benchmark/run/route.ts +113 -92
  580. package/.next/standalone/src/app/api/benchmark/runs/[id]/route.ts +26 -26
  581. package/.next/standalone/src/app/api/benchmark/runs/route.ts +16 -16
  582. package/.next/standalone/src/app/api/benchmark/status/route.ts +35 -35
  583. package/.next/standalone/src/app/api/bulk/route.ts +34 -34
  584. package/.next/standalone/src/app/api/chat/route.ts +85 -85
  585. package/.next/standalone/src/app/api/config/route.ts +30 -30
  586. package/.next/standalone/src/app/api/cortex/context/route.ts +78 -78
  587. package/.next/standalone/src/app/api/cortex/curation/assess/route.ts +27 -27
  588. package/.next/standalone/src/app/api/cortex/curation/publish/route.ts +23 -23
  589. package/.next/standalone/src/app/api/cortex/curation/refine/route.ts +23 -23
  590. package/.next/standalone/src/app/api/cortex/curation/review/route.ts +29 -29
  591. package/.next/standalone/src/app/api/cortex/curation/seed/route.ts +23 -23
  592. package/.next/standalone/src/app/api/cortex/export/route.ts +40 -40
  593. package/.next/standalone/src/app/api/cortex/federation/pending/route.ts +20 -20
  594. package/.next/standalone/src/app/api/cortex/federation/resolve/route.ts +43 -43
  595. package/.next/standalone/src/app/api/cortex/federation/search/route.ts +35 -35
  596. package/.next/standalone/src/app/api/cortex/federation/teach/route.ts +76 -76
  597. package/.next/standalone/src/app/api/cortex/graph/edges/route.ts +112 -112
  598. package/.next/standalone/src/app/api/cortex/graph/entities/[id]/route.ts +73 -73
  599. package/.next/standalone/src/app/api/cortex/graph/entities/route.ts +75 -75
  600. package/.next/standalone/src/app/api/cortex/graph/populate/route.ts +203 -203
  601. package/.next/standalone/src/app/api/cortex/import/route.ts +75 -75
  602. package/.next/standalone/src/app/api/cortex/import/status/route.ts +15 -15
  603. package/.next/standalone/src/app/api/cortex/ingest/bootstrap/route.ts +39 -39
  604. package/.next/standalone/src/app/api/cortex/ingest/status/route.ts +15 -15
  605. package/.next/standalone/src/app/api/cortex/knowledge/[id]/route.ts +91 -91
  606. package/.next/standalone/src/app/api/cortex/knowledge/route.ts +97 -97
  607. package/.next/standalone/src/app/api/cortex/lobes/[id]/route.ts +67 -67
  608. package/.next/standalone/src/app/api/cortex/lobes/route.ts +22 -22
  609. package/.next/standalone/src/app/api/cortex/lobes/share/route.ts +80 -80
  610. package/.next/standalone/src/app/api/cortex/marketplace/browse/route.ts +43 -43
  611. package/.next/standalone/src/app/api/cortex/marketplace/preview/route.ts +46 -46
  612. package/.next/standalone/src/app/api/cortex/mcp/call/route.ts +11 -11
  613. package/.next/standalone/src/app/api/cortex/mcp/tools/route.ts +8 -8
  614. package/.next/standalone/src/app/api/cortex/search/route.ts +57 -45
  615. package/.next/standalone/src/app/api/cortex/settings/route.ts +35 -35
  616. package/.next/standalone/src/app/api/cortex/status/route.ts +169 -169
  617. package/.next/standalone/src/app/api/cortex/timeline/route.ts +42 -42
  618. package/.next/standalone/src/app/api/cortex/usage/route.ts +31 -31
  619. package/.next/standalone/src/app/api/cortex/workspace/[id]/context/route.ts +41 -41
  620. package/.next/standalone/src/app/api/events/route.ts +40 -40
  621. package/.next/standalone/src/app/api/files/route.ts +187 -187
  622. package/.next/standalone/src/app/api/folders/route.ts +107 -97
  623. package/.next/standalone/src/app/api/network/connect-callback/route.ts +11 -11
  624. package/.next/standalone/src/app/api/network/connect-request/[id]/route.ts +11 -11
  625. package/.next/standalone/src/app/api/network/connect-request/route.ts +17 -17
  626. package/.next/standalone/src/app/api/network/discovered/route.ts +9 -9
  627. package/.next/standalone/src/app/api/network/handshake/route.ts +25 -25
  628. package/.next/standalone/src/app/api/network/health/route.ts +10 -10
  629. package/.next/standalone/src/app/api/network/identity/route.ts +15 -15
  630. package/.next/standalone/src/app/api/network/keys/[id]/route.ts +10 -10
  631. package/.next/standalone/src/app/api/network/keys/route.ts +15 -15
  632. package/.next/standalone/src/app/api/network/nodes/[id]/route.ts +15 -15
  633. package/.next/standalone/src/app/api/network/nodes/check/route.ts +9 -9
  634. package/.next/standalone/src/app/api/network/nodes/route.ts +15 -15
  635. package/.next/standalone/src/app/api/network/panes/[id]/route.ts +78 -62
  636. package/.next/standalone/src/app/api/network/panes/route.ts +61 -50
  637. package/.next/standalone/src/app/api/network/projects/route.ts +32 -25
  638. package/.next/standalone/src/app/api/network/proxy/[nodeId]/[...path]/route.ts +25 -25
  639. package/.next/standalone/src/app/api/network/search/route.ts +45 -38
  640. package/.next/standalone/src/app/api/network/sessions/[id]/messages/route.ts +43 -36
  641. package/.next/standalone/src/app/api/network/sessions/[id]/route.ts +41 -34
  642. package/.next/standalone/src/app/api/network/sessions/route.ts +50 -43
  643. package/.next/standalone/src/app/api/network/terminal/token/route.ts +10 -10
  644. package/.next/standalone/src/app/api/network/workspaces/[id]/route.ts +80 -71
  645. package/.next/standalone/src/app/api/network/workspaces/route.ts +87 -85
  646. package/.next/standalone/src/app/api/panes/[id]/diff/route.ts +121 -121
  647. package/.next/standalone/src/app/api/panes/[id]/route.ts +60 -60
  648. package/.next/standalone/src/app/api/panes/route.ts +39 -39
  649. package/.next/standalone/src/app/api/projects/route.ts +13 -13
  650. package/.next/standalone/src/app/api/proxy/models/[modelId]/[...path]/route.ts +80 -80
  651. package/.next/standalone/src/app/api/proxy/models/[modelId]/status/route.ts +33 -33
  652. package/.next/standalone/src/app/api/search/route.ts +47 -47
  653. package/.next/standalone/src/app/api/sessions/[id]/chat/route.ts +120 -120
  654. package/.next/standalone/src/app/api/sessions/[id]/messages/route.ts +34 -34
  655. package/.next/standalone/src/app/api/sessions/[id]/route.ts +73 -73
  656. package/.next/standalone/src/app/api/sessions/route.ts +64 -64
  657. package/.next/standalone/src/app/api/sync/route.ts +24 -24
  658. package/.next/standalone/src/app/api/tags/route.ts +35 -35
  659. package/.next/standalone/src/app/api/tier/route.ts +16 -16
  660. package/.next/standalone/src/app/api/updates/route.ts +65 -65
  661. package/.next/standalone/src/app/api/whisper/config/route.ts +50 -42
  662. package/.next/standalone/src/app/api/whisper/route.ts +91 -91
  663. package/.next/standalone/src/app/api/wizard/chart/route.ts +129 -0
  664. package/.next/standalone/src/app/api/wizard/chat/route.ts +113 -113
  665. package/.next/standalone/src/app/api/workspaces/[id]/context/[key]/route.ts +39 -39
  666. package/.next/standalone/src/app/api/workspaces/[id]/context/route.ts +28 -28
  667. package/.next/standalone/src/app/api/workspaces/[id]/messages/[msgId]/route.ts +17 -17
  668. package/.next/standalone/src/app/api/workspaces/[id]/messages/route.ts +39 -39
  669. package/.next/standalone/src/app/api/workspaces/[id]/route.ts +47 -47
  670. package/.next/standalone/src/app/api/workspaces/[id]/sessions/route.ts +62 -62
  671. package/.next/standalone/src/app/api/workspaces/route.ts +79 -79
  672. package/.next/standalone/src/app/globals.css +88 -88
  673. package/.next/standalone/src/app/layout.tsx +33 -33
  674. package/.next/standalone/src/app/login/layout.tsx +7 -7
  675. package/.next/standalone/src/app/login/page.tsx +315 -315
  676. package/.next/standalone/src/app/m/layout.tsx +16 -16
  677. package/.next/standalone/src/app/m/page.tsx +118 -118
  678. package/.next/standalone/src/app/m/projects/page.tsx +64 -64
  679. package/.next/standalone/src/app/m/sessions/[id]/page.tsx +168 -168
  680. package/.next/standalone/src/app/m/sessions/page.tsx +177 -177
  681. package/.next/standalone/src/app/m/settings/page.tsx +230 -230
  682. package/.next/standalone/src/app/m/terminal/page.tsx +413 -413
  683. package/.next/standalone/src/app/vr/page.tsx +21 -21
  684. package/.next/standalone/src/app/vr/vr-app.tsx +163 -163
  685. package/.next/standalone/src/app/vr/vr-controls.tsx +139 -139
  686. package/.next/standalone/src/app/vr/vr-door.tsx +82 -82
  687. package/.next/standalone/src/app/vr/vr-environment.tsx +71 -71
  688. package/.next/standalone/src/app/vr/vr-gaze.tsx +89 -89
  689. package/.next/standalone/src/app/vr/vr-layout.ts +49 -49
  690. package/.next/standalone/src/app/vr/vr-lobby.tsx +97 -97
  691. package/.next/standalone/src/app/vr/vr-pane.tsx +195 -195
  692. package/.next/standalone/src/app/vr/vr-room.tsx +79 -79
  693. package/.next/standalone/src/app/vr/vr-terminal.tsx +303 -303
  694. package/.next/standalone/src/components/auth/totp-gate.tsx +183 -183
  695. package/.next/standalone/src/components/bus/activity-panel.tsx +261 -261
  696. package/.next/standalone/src/components/common/color-picker.tsx +35 -35
  697. package/.next/standalone/src/components/common/dev-directory-picker.tsx +339 -339
  698. package/.next/standalone/src/components/common/folder-picker.tsx +200 -200
  699. package/.next/standalone/src/components/common/tag-picker.tsx +190 -190
  700. package/.next/standalone/src/components/common/workspace-picker.tsx +113 -113
  701. package/.next/standalone/src/components/cortex/benchmark-tab.tsx +894 -880
  702. package/.next/standalone/src/components/cortex/constants.ts +29 -29
  703. package/.next/standalone/src/components/cortex/cortex-dashboard.tsx +304 -304
  704. package/.next/standalone/src/components/cortex/cortex-indicator.tsx +44 -44
  705. package/.next/standalone/src/components/cortex/cortex-panel.tsx +140 -140
  706. package/.next/standalone/src/components/cortex/cortex-settings.tsx +280 -280
  707. package/.next/standalone/src/components/cortex/curation-tab.tsx +810 -810
  708. package/.next/standalone/src/components/cortex/entity-detail.tsx +101 -101
  709. package/.next/standalone/src/components/cortex/entity-graph.tsx +382 -382
  710. package/.next/standalone/src/components/cortex/import-dialog.tsx +212 -212
  711. package/.next/standalone/src/components/cortex/injection-badge.tsx +72 -72
  712. package/.next/standalone/src/components/cortex/knowledge-card.tsx +109 -109
  713. package/.next/standalone/src/components/cortex/knowledge-tab.tsx +158 -158
  714. package/.next/standalone/src/components/cortex/lobe-settings.tsx +215 -215
  715. package/.next/standalone/src/components/cortex/marketplace-card.tsx +126 -126
  716. package/.next/standalone/src/components/cortex/marketplace-tab.tsx +113 -113
  717. package/.next/standalone/src/components/dashboard/activity-chart.tsx +41 -41
  718. package/.next/standalone/src/components/dashboard/model-usage-chart.tsx +61 -61
  719. package/.next/standalone/src/components/dashboard/recent-sessions.tsx +68 -68
  720. package/.next/standalone/src/components/dashboard/stats-cards.tsx +36 -36
  721. package/.next/standalone/src/components/files/file-explorer.tsx +703 -703
  722. package/.next/standalone/src/components/layout/providers.tsx +38 -38
  723. package/.next/standalone/src/components/layout/sidebar.tsx +170 -170
  724. package/.next/standalone/src/components/layout/tier-provider.tsx +53 -53
  725. package/.next/standalone/src/components/layout/update-banner.tsx +92 -92
  726. package/.next/standalone/src/components/mobile/bottom-nav.tsx +46 -46
  727. package/.next/standalone/src/components/mobile/immersive-voice-button.tsx +123 -123
  728. package/.next/standalone/src/components/mobile/mobile-chat-input.tsx +244 -244
  729. package/.next/standalone/src/components/mobile/mobile-header.tsx +44 -44
  730. package/.next/standalone/src/components/mobile/mobile-session-card.tsx +56 -56
  731. package/.next/standalone/src/components/mobile/mobile-terminal-input.tsx +74 -74
  732. package/.next/standalone/src/components/mobile/mobile-terminal-pane.tsx +302 -302
  733. package/.next/standalone/src/components/mobile/mobile-terminal-toolbar.tsx +76 -76
  734. package/.next/standalone/src/components/mobile/pull-to-refresh.tsx +82 -82
  735. package/.next/standalone/src/components/mobile/voice-input.tsx +53 -53
  736. package/.next/standalone/src/components/network/api-key-list.tsx +190 -190
  737. package/.next/standalone/src/components/network/connection-requests.tsx +94 -94
  738. package/.next/standalone/src/components/network/node-add-dialog.tsx +131 -131
  739. package/.next/standalone/src/components/network/node-badge.tsx +26 -26
  740. package/.next/standalone/src/components/network/node-list.tsx +207 -207
  741. package/.next/standalone/src/components/network/node-selector.tsx +49 -49
  742. package/.next/standalone/src/components/sessions/session-filters.tsx +116 -116
  743. package/.next/standalone/src/components/sessions/session-list.tsx +485 -485
  744. package/.next/standalone/src/components/terminal/pane-diff-panel.tsx +179 -179
  745. package/.next/standalone/src/components/terminal/terminal-pane.tsx +1530 -1464
  746. package/.next/standalone/src/components/viewer/chat-input.tsx +275 -275
  747. package/.next/standalone/src/components/viewer/message-renderer.tsx +551 -551
  748. package/.next/standalone/src/components/wizard/chart-wizard.tsx +405 -0
  749. package/.next/standalone/src/components/wizard/project-wizard.tsx +153 -153
  750. package/.next/standalone/src/components/wizard/wizard-chat.tsx +99 -99
  751. package/.next/standalone/src/components/wizard/wizard-plan-summary.tsx +103 -103
  752. package/.next/standalone/src/components/wizard/wizard-review.tsx +225 -225
  753. package/.next/standalone/src/components/workspace/universe-cluster.tsx +131 -131
  754. package/.next/standalone/src/components/workspace/universe-orb.tsx +128 -128
  755. package/.next/standalone/src/components/workspace/universe-types.ts +22 -22
  756. package/.next/standalone/src/components/workspace/universe-utils.ts +11 -11
  757. package/.next/standalone/src/components/workspace/universe-view.tsx +397 -397
  758. package/.next/standalone/src/components/workspace/workspace-chooser.tsx +634 -634
  759. package/.next/standalone/src/hooks/use-benchmark.ts +72 -71
  760. package/.next/standalone/src/hooks/use-bus.ts +147 -147
  761. package/.next/standalone/src/hooks/use-idle-detection.ts +79 -79
  762. package/.next/standalone/src/hooks/use-network.ts +229 -229
  763. package/.next/standalone/src/hooks/use-sessions.ts +437 -437
  764. package/.next/standalone/src/hooks/use-speech-recognition.ts +114 -113
  765. package/.next/standalone/src/hooks/use-sse.ts +35 -35
  766. package/.next/standalone/src/hooks/use-tier.ts +39 -39
  767. package/.next/standalone/src/lib/agents.ts +97 -97
  768. package/.next/standalone/src/lib/aider/parser.ts +111 -111
  769. package/.next/standalone/src/lib/api.ts +19 -19
  770. package/.next/standalone/src/lib/auth.ts +47 -47
  771. package/.next/standalone/src/lib/claude/parser.ts +212 -212
  772. package/.next/standalone/src/lib/claude/stats.ts +204 -204
  773. package/.next/standalone/src/lib/codex/parser.test.ts +111 -111
  774. package/.next/standalone/src/lib/codex/parser.ts +287 -287
  775. package/.next/standalone/src/lib/config.ts +132 -132
  776. package/.next/standalone/src/lib/cortex/benchmark.ts +83 -67
  777. package/.next/standalone/src/lib/cortex/config.ts +42 -42
  778. package/.next/standalone/src/lib/cortex/debug.ts +10 -10
  779. package/.next/standalone/src/lib/cortex/distillation/usage-store.ts +18 -18
  780. package/.next/standalone/src/lib/cortex/graph/resolver.ts +10 -10
  781. package/.next/standalone/src/lib/cortex/graph/types.ts +22 -22
  782. package/.next/standalone/src/lib/cortex/index.ts +109 -56
  783. package/.next/standalone/src/lib/cortex/ingestion/bootstrap.ts +14 -14
  784. package/.next/standalone/src/lib/cortex/knowledge/compat.ts +14 -14
  785. package/.next/standalone/src/lib/cortex/knowledge/contradiction.ts +10 -10
  786. package/.next/standalone/src/lib/cortex/knowledge/types.ts +67 -67
  787. package/.next/standalone/src/lib/cortex/lobes/config.ts +16 -16
  788. package/.next/standalone/src/lib/cortex/lobes/resolver.ts +8 -8
  789. package/.next/standalone/src/lib/cortex/lobes/shares.ts +14 -14
  790. package/.next/standalone/src/lib/cortex/mcp/server.ts +12 -12
  791. package/.next/standalone/src/lib/cortex/portability/exporter.ts +6 -6
  792. package/.next/standalone/src/lib/cortex/portability/importer.ts +10 -10
  793. package/.next/standalone/src/lib/cortex/retrieval/context-engine.ts +10 -10
  794. package/.next/standalone/src/lib/cortex/types.ts +39 -39
  795. package/.next/standalone/src/lib/cost-calculator.ts +48 -48
  796. package/.next/standalone/src/lib/db/init.ts +71 -71
  797. package/.next/standalone/src/lib/db/queries.ts +740 -827
  798. package/.next/standalone/src/lib/db/schema.ts +206 -206
  799. package/.next/standalone/src/lib/events/sse.ts +36 -36
  800. package/.next/standalone/src/lib/forge/parser.ts +52 -52
  801. package/.next/standalone/src/lib/gemini/parser.ts +258 -258
  802. package/.next/standalone/src/lib/license.ts +56 -56
  803. package/.next/standalone/src/lib/pro.ts +31 -31
  804. package/.next/standalone/src/lib/shell-user.ts +101 -0
  805. package/.next/standalone/src/lib/sync/indexer.ts +504 -504
  806. package/.next/standalone/src/lib/sync/watcher.ts +64 -64
  807. package/.next/standalone/src/lib/teams.ts +31 -31
  808. package/.next/standalone/src/lib/telemetry.ts +75 -75
  809. package/.next/standalone/src/lib/terminal/server.ts +188 -188
  810. package/.next/standalone/src/lib/tier.ts +38 -38
  811. package/.next/standalone/src/lib/utils.ts +72 -72
  812. package/.next/standalone/src/lib/vms/manager.ts +121 -121
  813. package/.next/standalone/src/middleware.ts +133 -133
  814. package/.next/standalone/src/types/claude.ts +208 -208
  815. package/.next/standalone/src/types/network.ts +61 -61
  816. package/.next/standalone/tests/setup.ts +8 -8
  817. package/.next/standalone/tsconfig.json +34 -34
  818. package/.next/standalone/vitest.config.ts +24 -24
  819. package/LICENSE +661 -661
  820. package/README.md +131 -131
  821. package/bin/cortex-hook.js +79 -79
  822. package/bin/cortex-hook.sh +62 -62
  823. package/bin/cortex-learn-hook.js +138 -138
  824. package/bin/cortex-mcp.js +60 -60
  825. package/bin/cortex-pi-extension.ts +170 -170
  826. package/bin/fix-standalone-externals.js +79 -79
  827. package/bin/lib/auto-setup.js +110 -110
  828. package/bin/mdns-service.js +171 -171
  829. package/bin/postinstall.js +35 -35
  830. package/bin/setup-admin.js +195 -195
  831. package/bin/spaces-dev.js +247 -247
  832. package/bin/spaces-install.js +660 -660
  833. package/bin/spaces-postinstall.js +50 -50
  834. package/bin/spaces-reset-totp.js +50 -50
  835. package/bin/spaces-service.js +1046 -1046
  836. package/bin/spaces-setup.js +253 -253
  837. package/bin/spaces.js +808 -805
  838. package/bin/ssh-auth-keys.sh +68 -68
  839. package/bin/terminal-server.js +2819 -2781
  840. package/package.json +111 -111
  841. package/.next/standalone/.next/server/chunks/[root-of-the-server]__0903a426._.js +0 -98
  842. package/.next/standalone/.next/server/chunks/[root-of-the-server]__09e8ccc9._.js +0 -98
  843. package/.next/standalone/.next/server/chunks/[root-of-the-server]__11c684b1._.js +0 -98
  844. package/.next/standalone/.next/server/chunks/[root-of-the-server]__1572d4ef._.js +0 -98
  845. package/.next/standalone/.next/server/chunks/[root-of-the-server]__186cd0bb._.js +0 -3
  846. package/.next/standalone/.next/server/chunks/[root-of-the-server]__212760e6._.js +0 -98
  847. package/.next/standalone/.next/server/chunks/[root-of-the-server]__228595ec._.js +0 -98
  848. package/.next/standalone/.next/server/chunks/[root-of-the-server]__283c890f._.js +0 -3
  849. package/.next/standalone/.next/server/chunks/[root-of-the-server]__2f300a68._.js +0 -98
  850. package/.next/standalone/.next/server/chunks/[root-of-the-server]__2f452778._.js +0 -98
  851. package/.next/standalone/.next/server/chunks/[root-of-the-server]__35f8e77e._.js +0 -98
  852. package/.next/standalone/.next/server/chunks/[root-of-the-server]__379fc2e9._.js +0 -98
  853. package/.next/standalone/.next/server/chunks/[root-of-the-server]__3b40d79f._.js +0 -98
  854. package/.next/standalone/.next/server/chunks/[root-of-the-server]__3d3dca2b._.js +0 -98
  855. package/.next/standalone/.next/server/chunks/[root-of-the-server]__4d5b78d2._.js +0 -98
  856. package/.next/standalone/.next/server/chunks/[root-of-the-server]__54163e52._.js +0 -98
  857. package/.next/standalone/.next/server/chunks/[root-of-the-server]__563c0817._.js +0 -3
  858. package/.next/standalone/.next/server/chunks/[root-of-the-server]__5812f90a._.js +0 -98
  859. package/.next/standalone/.next/server/chunks/[root-of-the-server]__5c5e87f5._.js +0 -98
  860. package/.next/standalone/.next/server/chunks/[root-of-the-server]__60d15b16._.js +0 -98
  861. package/.next/standalone/.next/server/chunks/[root-of-the-server]__69d315e5._.js +0 -3
  862. package/.next/standalone/.next/server/chunks/[root-of-the-server]__71f29038._.js +0 -98
  863. package/.next/standalone/.next/server/chunks/[root-of-the-server]__74084e07._.js +0 -3
  864. package/.next/standalone/.next/server/chunks/[root-of-the-server]__7921aa80._.js +0 -98
  865. package/.next/standalone/.next/server/chunks/[root-of-the-server]__7e077dd8._.js +0 -98
  866. package/.next/standalone/.next/server/chunks/[root-of-the-server]__7ebc4280._.js +0 -131
  867. package/.next/standalone/.next/server/chunks/[root-of-the-server]__857c60bb._.js +0 -98
  868. package/.next/standalone/.next/server/chunks/[root-of-the-server]__874fe565._.js +0 -98
  869. package/.next/standalone/.next/server/chunks/[root-of-the-server]__8e2171f7._.js +0 -98
  870. package/.next/standalone/.next/server/chunks/[root-of-the-server]__95659b2d._.js +0 -98
  871. package/.next/standalone/.next/server/chunks/[root-of-the-server]__9679b91e._.js +0 -98
  872. package/.next/standalone/.next/server/chunks/[root-of-the-server]__a90729a1._.js +0 -98
  873. package/.next/standalone/.next/server/chunks/[root-of-the-server]__ad4346fa._.js +0 -98
  874. package/.next/standalone/.next/server/chunks/[root-of-the-server]__b0862d69._.js +0 -98
  875. package/.next/standalone/.next/server/chunks/[root-of-the-server]__b43306ee._.js +0 -98
  876. package/.next/standalone/.next/server/chunks/[root-of-the-server]__b689ff5e._.js +0 -106
  877. package/.next/standalone/.next/server/chunks/[root-of-the-server]__ba87daaa._.js +0 -98
  878. package/.next/standalone/.next/server/chunks/[root-of-the-server]__c0461005._.js +0 -98
  879. package/.next/standalone/.next/server/chunks/[root-of-the-server]__c1deb5f3._.js +0 -98
  880. package/.next/standalone/.next/server/chunks/[root-of-the-server]__c8a62f42._.js +0 -98
  881. package/.next/standalone/.next/server/chunks/[root-of-the-server]__cabaac2b._.js +0 -98
  882. package/.next/standalone/.next/server/chunks/[root-of-the-server]__cb027619._.js +0 -98
  883. package/.next/standalone/.next/server/chunks/[root-of-the-server]__cf608218._.js +0 -98
  884. package/.next/standalone/.next/server/chunks/[root-of-the-server]__cfc1290d._.js +0 -98
  885. package/.next/standalone/.next/server/chunks/[root-of-the-server]__d0109b9b._.js +0 -98
  886. package/.next/standalone/.next/server/chunks/[root-of-the-server]__d0125483._.js +0 -3
  887. package/.next/standalone/.next/server/chunks/[root-of-the-server]__d048ee6b._.js +0 -98
  888. package/.next/standalone/.next/server/chunks/[root-of-the-server]__d12644e7._.js +0 -98
  889. package/.next/standalone/.next/server/chunks/[root-of-the-server]__e3cc946c._.js +0 -98
  890. package/.next/standalone/.next/server/chunks/[root-of-the-server]__e6fd27f8._.js +0 -98
  891. package/.next/standalone/.next/server/chunks/[root-of-the-server]__efb8251e._.js +0 -98
  892. package/.next/standalone/.next/server/chunks/[root-of-the-server]__f44c6882._.js +0 -98
  893. package/.next/standalone/.next/server/chunks/[root-of-the-server]__f85283de._.js +0 -98
  894. package/.next/standalone/.next/server/chunks/[root-of-the-server]__feceb3e4._.js +0 -98
  895. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__843070a6._.js +0 -3
  896. package/.next/standalone/.next/server/chunks/ssr/_e84a0c06._.js +0 -3
  897. package/.next/standalone/.next/static/chunks/470cade58d4eceeb.css +0 -3
  898. package/.next/standalone/.next/static/chunks/9d4164833c2c1fd6.js +0 -85
  899. package/.next/standalone/.next/static/chunks/f091f4bf8d80fd07.js +0 -1
  900. package/.next/standalone/node_modules/@img/sharp-libvips-linux-x64/README.md +0 -46
  901. package/.next/standalone/node_modules/@img/sharp-libvips-linux-x64/lib/glib-2.0/include/glibconfig.h +0 -221
  902. package/.next/standalone/node_modules/@img/sharp-libvips-linux-x64/lib/index.js +0 -1
  903. package/.next/standalone/node_modules/@img/sharp-libvips-linux-x64/lib/libvips-cpp.so.8.17.3 +0 -0
  904. package/.next/standalone/node_modules/@img/sharp-libvips-linux-x64/package.json +0 -42
  905. package/.next/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/README.md +0 -46
  906. package/.next/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/lib/glib-2.0/include/glibconfig.h +0 -221
  907. package/.next/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/lib/index.js +0 -1
  908. package/.next/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/lib/libvips-cpp.so.8.17.3 +0 -0
  909. package/.next/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/package.json +0 -42
  910. package/.next/standalone/node_modules/@img/sharp-libvips-linuxmusl-x64/versions.json +0 -30
  911. package/.next/standalone/node_modules/@img/sharp-linux-x64/lib/sharp-linux-x64.node +0 -0
  912. package/.next/standalone/node_modules/@img/sharp-linuxmusl-x64/lib/sharp-linuxmusl-x64.node +0 -0
  913. package/.next/standalone/node_modules/@img/sharp-linuxmusl-x64/package.json +0 -46
  914. /package/.next/standalone/.next/static/{5S4TviTCiNiTjf6KjXjBo → u1pHON3drz1mBi7owkbBP}/_buildManifest.js +0 -0
  915. /package/.next/standalone/.next/static/{5S4TviTCiNiTjf6KjXjBo → u1pHON3drz1mBi7owkbBP}/_clientMiddlewareManifest.json +0 -0
  916. /package/.next/standalone/.next/static/{5S4TviTCiNiTjf6KjXjBo → u1pHON3drz1mBi7owkbBP}/_ssgManifest.js +0 -0
  917. /package/.next/standalone/node_modules/@img/{sharp-libvips-linux-x64 → sharp-win32-x64}/versions.json +0 -0
@@ -1,827 +1,740 @@
1
- import path from 'path';
2
- import crypto from 'crypto';
3
- import { getDb } from './schema';
4
- import { getUserPaths } from '../config';
5
- import { getCurrentUser } from '../auth';
6
- import { scanCodexSessions } from '../codex/parser';
7
- import type { SessionWithMeta, Project, Workspace, Tag, SearchResult } from '@/types/claude';
8
-
9
- // ─── Projects ───────────────────────────────────────────────
10
-
11
- export function upsertProject(project: { id: string; name: string; path: string; claudePath: string; agentType?: string }) {
12
- const db = getDb();
13
- db.prepare(`
14
- INSERT INTO projects (id, name, path, claude_path, agent_path, agent_type)
15
- VALUES (?, ?, ?, ?, ?, ?)
16
- ON CONFLICT(id) DO UPDATE SET name=excluded.name, path=excluded.path, claude_path=excluded.claude_path, agent_path=excluded.agent_path, agent_type=excluded.agent_type
17
- `).run(project.id, project.name, project.path, project.claudePath, project.claudePath, project.agentType || 'claude');
18
- }
19
-
20
- export function getAllProjects(): Project[] {
21
- const db = getDb();
22
- return db.prepare(`
23
- SELECT p.id, p.name, p.path, p.claude_path as claudePath,
24
- p.agent_type as agentType,
25
- COUNT(s.id) as sessionCount,
26
- MAX(s.modified) as lastActivity
27
- FROM projects p
28
- LEFT JOIN sessions s ON s.project_id = p.id
29
- GROUP BY p.id
30
- ORDER BY lastActivity DESC
31
- `).all() as Project[];
32
- }
33
-
34
- // ─── Sessions ───────────────────────────────────────────────
35
-
36
- export function upsertSession(session: {
37
- id: string;
38
- sessionId: string;
39
- projectId: string;
40
- firstPrompt: string;
41
- summary: string;
42
- messageCount: number;
43
- created: string;
44
- modified: string;
45
- gitBranch: string;
46
- projectPath: string;
47
- fullPath: string;
48
- agentType?: string;
49
- }) {
50
- const db = getDb();
51
- db.prepare(`
52
- INSERT INTO sessions (id, session_id, project_id, first_prompt, summary, message_count, created, modified, git_branch, project_path, full_path, agent_type)
53
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
54
- ON CONFLICT(id) DO UPDATE SET
55
- first_prompt = CASE WHEN excluded.first_prompt != '' THEN excluded.first_prompt ELSE sessions.first_prompt END,
56
- summary = CASE WHEN excluded.summary != '' THEN excluded.summary ELSE sessions.summary END,
57
- message_count = CASE WHEN excluded.message_count > sessions.message_count THEN excluded.message_count ELSE sessions.message_count END,
58
- modified = CASE WHEN excluded.modified != '' THEN excluded.modified ELSE sessions.modified END,
59
- git_branch = CASE WHEN excluded.git_branch != '' THEN excluded.git_branch ELSE sessions.git_branch END,
60
- full_path = CASE WHEN excluded.full_path != '' THEN excluded.full_path ELSE sessions.full_path END,
61
- agent_type=excluded.agent_type
62
- `).run(
63
- session.id, session.sessionId, session.projectId,
64
- session.firstPrompt, session.summary, session.messageCount,
65
- session.created, session.modified, session.gitBranch,
66
- session.projectPath, session.fullPath, session.agentType || 'claude'
67
- );
68
- }
69
-
70
- interface SessionQueryParams {
71
- projectId?: string;
72
- projectPath?: string;
73
- starred?: boolean;
74
- tagId?: number;
75
- search?: string;
76
- agentType?: string;
77
- sortBy?: string;
78
- sortDir?: string;
79
- offset?: number;
80
- limit?: number;
81
- }
82
-
83
- export function getSessions(params: SessionQueryParams = {}): { sessions: SessionWithMeta[]; total: number } {
84
- const db = getDb();
85
- const {
86
- projectId,
87
- projectPath,
88
- starred,
89
- tagId,
90
- search,
91
- sortBy = 'modified',
92
- sortDir = 'DESC',
93
- offset = 0,
94
- limit = 50,
95
- } = params;
96
-
97
- const where: string[] = [];
98
- const queryParams: (string | number)[] = [];
99
-
100
- if (projectId) {
101
- where.push('s.project_id = ?');
102
- queryParams.push(projectId);
103
- }
104
- if (projectPath) {
105
- where.push('s.project_path = ?');
106
- queryParams.push(projectPath);
107
- }
108
- if (starred !== undefined) {
109
- where.push('s.starred = ?');
110
- queryParams.push(starred ? 1 : 0);
111
- }
112
- if (tagId) {
113
- where.push('EXISTS (SELECT 1 FROM session_tags st WHERE st.session_id = s.id AND st.tag_id = ?)');
114
- queryParams.push(tagId);
115
- }
116
- if (search) {
117
- where.push('(s.first_prompt LIKE ? OR s.summary LIKE ? OR s.custom_name LIKE ?)');
118
- const pattern = `%${search}%`;
119
- queryParams.push(pattern, pattern, pattern);
120
- }
121
- if (params.agentType) {
122
- where.push('s.agent_type = ?');
123
- queryParams.push(params.agentType);
124
- }
125
-
126
- const whereClause = where.length > 0 ? `WHERE ${where.join(' AND ')}` : '';
127
-
128
- const allowedSorts: Record<string, string> = {
129
- created: 's.created',
130
- modified: 's.modified',
131
- messages: 's.message_count',
132
- name: "COALESCE(s.custom_name, s.summary, s.first_prompt)",
133
- };
134
- const sortColumn = allowedSorts[sortBy] || 's.modified';
135
- const direction = sortDir === 'ASC' ? 'ASC' : 'DESC';
136
-
137
- const countRow = db.prepare(`SELECT COUNT(*) as total FROM sessions s ${whereClause}`).get(...queryParams) as { total: number };
138
-
139
- const rows = db.prepare(`
140
- SELECT s.id, s.session_id as sessionId, s.project_id as projectId,
141
- p.name as projectName, s.first_prompt as firstPrompt,
142
- s.summary, s.message_count as messageCount,
143
- s.created, s.modified, s.git_branch as gitBranch,
144
- s.project_path as projectPath, s.full_path as fullPath,
145
- s.starred, s.custom_name as customName, s.notes,
146
- s.agent_type as agentType
147
- FROM sessions s
148
- LEFT JOIN projects p ON p.id = s.project_id
149
- ${whereClause}
150
- ORDER BY ${sortColumn} ${direction}
151
- LIMIT ? OFFSET ?
152
- `).all(...queryParams, limit, offset) as SessionWithMeta[];
153
-
154
- // Fetch tags and workspaces for each session
155
- const tagStmt = db.prepare(`
156
- SELECT t.name FROM tags t
157
- JOIN session_tags st ON st.tag_id = t.id
158
- WHERE st.session_id = ?
159
- `);
160
- const wsStmt = db.prepare(`
161
- SELECT w.id, w.name, w.color FROM workspaces w
162
- JOIN workspace_sessions ws ON ws.workspace_id = w.id
163
- WHERE ws.session_id = ?
164
- `);
165
-
166
- for (const row of rows) {
167
- const tags = tagStmt.all(row.id) as { name: string }[];
168
- row.tags = tags.map(t => t.name);
169
- row.workspaces = wsStmt.all(row.id) as { id: number; name: string; color: string }[];
170
- row.starred = !!row.starred;
171
- }
172
-
173
- return { sessions: rows, total: countRow.total };
174
- }
175
-
176
- export function getSessionById(id: string): SessionWithMeta | null {
177
- const db = getDb();
178
- const row = db.prepare(`
179
- SELECT s.id, s.session_id as sessionId, s.project_id as projectId,
180
- p.name as projectName, s.first_prompt as firstPrompt,
181
- s.summary, s.message_count as messageCount,
182
- s.created, s.modified, s.git_branch as gitBranch,
183
- s.project_path as projectPath, s.full_path as fullPath,
184
- s.starred, s.custom_name as customName, s.notes,
185
- s.agent_type as agentType
186
- FROM sessions s
187
- LEFT JOIN projects p ON p.id = s.project_id
188
- WHERE s.id = ? OR s.session_id = ?
189
- `).get(id, id) as SessionWithMeta | undefined;
190
-
191
- if (!row) return null;
192
-
193
- const tags = db.prepare(`
194
- SELECT t.name FROM tags t
195
- JOIN session_tags st ON st.tag_id = t.id
196
- WHERE st.session_id = ?
197
- `).all(row.id) as { name: string }[];
198
-
199
- row.tags = tags.map(t => t.name);
200
- row.starred = !!row.starred;
201
-
202
- return row;
203
- }
204
-
205
- export function toggleStar(sessionId: string): boolean {
206
- const db = getDb();
207
- const current = db.prepare('SELECT starred FROM sessions WHERE id = ? OR session_id = ?').get(sessionId, sessionId) as { starred: number } | undefined;
208
- if (!current) return false;
209
- const newValue = current.starred ? 0 : 1;
210
- db.prepare('UPDATE sessions SET starred = ? WHERE id = ? OR session_id = ?').run(newValue, sessionId, sessionId);
211
- return !!newValue;
212
- }
213
-
214
- export function updateSessionNotes(sessionId: string, notes: string) {
215
- const db = getDb();
216
- db.prepare('UPDATE sessions SET notes = ? WHERE id = ? OR session_id = ?').run(notes, sessionId, sessionId);
217
- }
218
-
219
- // ─── Workspaces ─────────────────────────────────────────────
220
-
221
- export function createWorkspace(name: string, description?: string, color?: string): Workspace {
222
- const db = getDb();
223
- const result = db.prepare('INSERT INTO workspaces (name, description, color) VALUES (?, ?, ?)').run(
224
- name, description || '', color || '#6366f1'
225
- );
226
- return { id: Number(result.lastInsertRowid), name, description: description || '', color: color || '#6366f1', created: new Date().toISOString() };
227
- }
228
-
229
- export function getAllWorkspaces(): Workspace[] {
230
- const db = getDb();
231
- return db.prepare(`
232
- SELECT w.*, COUNT(ws.session_id) as sessionCount
233
- FROM workspaces w
234
- LEFT JOIN workspace_sessions ws ON ws.workspace_id = w.id
235
- GROUP BY w.id
236
- ORDER BY w.created DESC
237
- `).all() as Workspace[];
238
- }
239
-
240
- export function addSessionToWorkspace(workspaceId: number, sessionId: string) {
241
- const db = getDb();
242
- db.prepare('INSERT OR IGNORE INTO workspace_sessions (workspace_id, session_id) VALUES (?, ?)').run(workspaceId, sessionId);
243
- }
244
-
245
- export function removeSessionFromWorkspace(workspaceId: number, sessionId: string) {
246
- const db = getDb();
247
- db.prepare('DELETE FROM workspace_sessions WHERE workspace_id = ? AND session_id = ?').run(workspaceId, sessionId);
248
- }
249
-
250
- // ─── Tags ───────────────────────────────────────────────────
251
-
252
- export function createTag(name: string, color?: string): Tag {
253
- const db = getDb();
254
- const result = db.prepare('INSERT OR IGNORE INTO tags (name, color) VALUES (?, ?)').run(name, color || '#8b5cf6');
255
- return { id: Number(result.lastInsertRowid), name, color: color || '#8b5cf6' };
256
- }
257
-
258
- export function getAllTags(): Tag[] {
259
- const db = getDb();
260
- return db.prepare('SELECT * FROM tags ORDER BY name').all() as Tag[];
261
- }
262
-
263
- export function addTagToSession(sessionId: string, tagName: string) {
264
- const db = getDb();
265
- let tag = db.prepare('SELECT id FROM tags WHERE name = ?').get(tagName) as { id: number } | undefined;
266
- if (!tag) {
267
- const result = db.prepare('INSERT INTO tags (name) VALUES (?)').run(tagName);
268
- tag = { id: Number(result.lastInsertRowid) };
269
- }
270
- db.prepare('INSERT OR IGNORE INTO session_tags (session_id, tag_id) VALUES (?, ?)').run(sessionId, tag.id);
271
- }
272
-
273
- export function removeTagFromSession(sessionId: string, tagId: number) {
274
- const db = getDb();
275
- db.prepare('DELETE FROM session_tags WHERE session_id = ? AND tag_id = ?').run(sessionId, tagId);
276
- }
277
-
278
- export function removeTagFromSessionByName(sessionId: string, tagName: string) {
279
- const db = getDb();
280
- const tag = db.prepare('SELECT id FROM tags WHERE name = ?').get(tagName) as { id: number } | undefined;
281
- if (tag) {
282
- db.prepare('DELETE FROM session_tags WHERE session_id = ? AND tag_id = ?').run(sessionId, tag.id);
283
- }
284
- }
285
-
286
- export function deleteTag(tagId: number) {
287
- const db = getDb();
288
- db.prepare('DELETE FROM session_tags WHERE tag_id = ?').run(tagId);
289
- db.prepare('DELETE FROM tags WHERE id = ?').run(tagId);
290
- }
291
-
292
- export function updateTagColor(tagId: number, color: string) {
293
- const db = getDb();
294
- db.prepare('UPDATE tags SET color = ? WHERE id = ?').run(color, tagId);
295
- }
296
-
297
- export function getSessionTags(sessionId: string): Tag[] {
298
- const db = getDb();
299
- return db.prepare(`
300
- SELECT t.id, t.name, t.color FROM tags t
301
- JOIN session_tags st ON st.tag_id = t.id
302
- WHERE st.session_id = ?
303
- ORDER BY t.name
304
- `).all(sessionId) as Tag[];
305
- }
306
-
307
- export function renameSession(sessionId: string, customName: string) {
308
- const db = getDb();
309
- db.prepare('UPDATE sessions SET custom_name = ? WHERE id = ? OR session_id = ?').run(customName || null, sessionId, sessionId);
310
- }
311
-
312
- // ─── Workspace Extras ───────────────────────────────────────
313
-
314
- export function deleteWorkspace(workspaceId: number) {
315
- const db = getDb();
316
- db.prepare('DELETE FROM workspace_sessions WHERE workspace_id = ?').run(workspaceId);
317
- db.prepare('DELETE FROM workspaces WHERE id = ?').run(workspaceId);
318
- }
319
-
320
- export function updateWorkspace(workspaceId: number, data: { name?: string; description?: string; color?: string; collaboration?: boolean }) {
321
- const db = getDb();
322
- if (data.name !== undefined) db.prepare('UPDATE workspaces SET name = ? WHERE id = ?').run(data.name, workspaceId);
323
- if (data.description !== undefined) db.prepare('UPDATE workspaces SET description = ? WHERE id = ?').run(data.description, workspaceId);
324
- if (data.color !== undefined) db.prepare('UPDATE workspaces SET color = ? WHERE id = ?').run(data.color, workspaceId);
325
- if (data.collaboration !== undefined) db.prepare('UPDATE workspaces SET collaboration = ? WHERE id = ?').run(data.collaboration ? 1 : 0, workspaceId);
326
- }
327
-
328
- export function getWorkspacesForSession(sessionId: string): { id: number; name: string; color: string }[] {
329
- const db = getDb();
330
- // Check workspace_sessions first (local sessions)
331
- const fromWs = db.prepare(`
332
- SELECT w.id, w.name, w.color FROM workspaces w
333
- JOIN workspace_sessions ws ON ws.workspace_id = w.id
334
- WHERE ws.session_id = ?
335
- `).all(sessionId) as { id: number; name: string; color: string }[];
336
- if (fromWs.length > 0) return fromWs;
337
- // Fallback: check panes table (remote sessions stored via pane only)
338
- return db.prepare(`
339
- SELECT DISTINCT w.id, w.name, w.color FROM workspaces w
340
- JOIN panes p ON p.workspace_id = w.id
341
- WHERE p.claude_session_id = ?
342
- `).all(sessionId) as { id: number; name: string; color: string }[];
343
- }
344
-
345
- export function getWorkspaceSessions(workspaceId: number): SessionWithMeta[] {
346
- const db = getDb();
347
- const rows = db.prepare(`
348
- SELECT s.id, s.session_id as sessionId, s.project_id as projectId,
349
- p.name as projectName, s.first_prompt as firstPrompt,
350
- s.summary, s.message_count as messageCount,
351
- s.created, s.modified, s.git_branch as gitBranch,
352
- s.project_path as projectPath, s.full_path as fullPath,
353
- s.starred, s.custom_name as customName, s.notes,
354
- s.agent_type as agentType
355
- FROM sessions s
356
- JOIN workspace_sessions ws ON ws.session_id = s.id
357
- LEFT JOIN projects p ON p.id = s.project_id
358
- WHERE ws.workspace_id = ?
359
- ORDER BY s.modified DESC
360
- `).all(workspaceId) as SessionWithMeta[];
361
-
362
- const tagStmt = db.prepare('SELECT t.name FROM tags t JOIN session_tags st ON st.tag_id = t.id WHERE st.session_id = ?');
363
- for (const row of rows) {
364
- row.tags = (tagStmt.all(row.id) as { name: string }[]).map(t => t.name);
365
- row.starred = !!row.starred;
366
- }
367
- return rows;
368
- }
369
-
370
- export function getSessionWorkspaces(sessionId: string): Workspace[] {
371
- const db = getDb();
372
- return db.prepare(`
373
- SELECT w.id, w.name, w.description, w.color, w.created, w.collaboration
374
- FROM workspaces w
375
- JOIN workspace_sessions ws ON ws.workspace_id = w.id
376
- WHERE ws.session_id = ?
377
- `).all(sessionId) as Workspace[];
378
- }
379
-
380
- // ─── Bulk Operations ────────────────────────────────────────
381
-
382
- export function bulkAddTag(sessionIds: string[], tagName: string) {
383
- const db = getDb();
384
- let tag = db.prepare('SELECT id FROM tags WHERE name = ?').get(tagName) as { id: number } | undefined;
385
- if (!tag) {
386
- const result = db.prepare('INSERT INTO tags (name) VALUES (?)').run(tagName);
387
- tag = { id: Number(result.lastInsertRowid) };
388
- }
389
- const stmt = db.prepare('INSERT OR IGNORE INTO session_tags (session_id, tag_id) VALUES (?, ?)');
390
- const run = db.transaction(() => {
391
- for (const id of sessionIds) stmt.run(id, tag!.id);
392
- });
393
- run();
394
- }
395
-
396
- export function bulkAddToWorkspace(sessionIds: string[], workspaceId: number) {
397
- const db = getDb();
398
- const stmt = db.prepare('INSERT OR IGNORE INTO workspace_sessions (workspace_id, session_id) VALUES (?, ?)');
399
- const run = db.transaction(() => {
400
- for (const id of sessionIds) stmt.run(workspaceId, id);
401
- });
402
- run();
403
- }
404
-
405
- export function bulkStar(sessionIds: string[], starred: boolean) {
406
- const db = getDb();
407
- const stmt = db.prepare('UPDATE sessions SET starred = ? WHERE id = ?');
408
- const run = db.transaction(() => {
409
- for (const id of sessionIds) stmt.run(starred ? 1 : 0, id);
410
- });
411
- run();
412
- }
413
-
414
- // ─── FTS Search ─────────────────────────────────────────────
415
-
416
- export function upsertFtsContent(sessionId: string, content: string) {
417
- const db = getDb();
418
- db.prepare('DELETE FROM sessions_fts WHERE session_id = ?').run(sessionId);
419
- db.prepare('INSERT INTO sessions_fts (session_id, content) VALUES (?, ?)').run(sessionId, content);
420
- }
421
-
422
- export function searchSessions(query: string, params: { projectId?: string; limit?: number; offset?: number } = {}): SearchResult[] {
423
- const db = getDb();
424
- const { projectId, limit = 20, offset = 0 } = params;
425
-
426
- let sql = `
427
- SELECT f.session_id as sessionId, snippet(sessions_fts, 1, '<mark>', '</mark>', '...', 40) as snippet,
428
- rank, p.name as projectName, s.first_prompt as firstPrompt, s.created
429
- FROM sessions_fts f
430
- JOIN sessions s ON s.id = f.session_id OR s.session_id = f.session_id
431
- LEFT JOIN projects p ON p.id = s.project_id
432
- WHERE sessions_fts MATCH ?
433
- `;
434
- const queryParams: (string | number)[] = [query];
435
-
436
- if (projectId) {
437
- sql += ' AND s.project_id = ?';
438
- queryParams.push(projectId);
439
- }
440
-
441
- sql += ' ORDER BY rank LIMIT ? OFFSET ?';
442
- queryParams.push(limit, offset);
443
-
444
- try {
445
- return db.prepare(sql).all(...queryParams) as SearchResult[];
446
- } catch {
447
- // Fallback to LIKE search if FTS fails
448
- return db.prepare(`
449
- SELECT s.id as sessionId, substr(s.first_prompt, 1, 200) as snippet,
450
- 0 as rank, p.name as projectName, s.first_prompt as firstPrompt, s.created
451
- FROM sessions s
452
- LEFT JOIN projects p ON p.id = s.project_id
453
- WHERE s.first_prompt LIKE ? OR s.summary LIKE ?
454
- LIMIT ? OFFSET ?
455
- `).all(`%${query}%`, `%${query}%`, limit, offset) as SearchResult[];
456
- }
457
- }
458
-
459
- // ─── Sync State ─────────────────────────────────────────────
460
-
461
- export function getSyncState(filePath: string): { mtime: number; byteOffset: number } | null {
462
- const db = getDb();
463
- const row = db.prepare('SELECT mtime, byte_offset as byteOffset FROM sync_state WHERE file_path = ?').get(filePath) as { mtime: number; byteOffset: number } | undefined;
464
- return row || null;
465
- }
466
-
467
- export function updateSyncState(filePath: string, mtime: number, byteOffset: number) {
468
- const db = getDb();
469
- db.prepare(`
470
- INSERT INTO sync_state (file_path, mtime, byte_offset, last_synced)
471
- VALUES (?, ?, ?, datetime('now'))
472
- ON CONFLICT(file_path) DO UPDATE SET mtime=excluded.mtime, byte_offset=excluded.byte_offset, last_synced=datetime('now')
473
- `).run(filePath, mtime, byteOffset);
474
- }
475
-
476
- // ─── Panes ─────────────────────────────────────────────────
477
-
478
- export interface PaneData {
479
- id: string;
480
- title: string;
481
- color: string;
482
- cwd: string;
483
- claudeSessionId: string | null;
484
- agentType: string;
485
- customCommand: string | null;
486
- gridCol: number;
487
- gridRow: number;
488
- sortOrder: number;
489
- shell: string | null;
490
- created: string;
491
- workspaceId: number | null;
492
- isPopout: boolean;
493
- winX: number | null;
494
- winY: number | null;
495
- winWidth: number | null;
496
- winHeight: number | null;
497
- nodeId: string | null;
498
- isCollaborating: boolean;
499
- diffBaselineSha: string | null;
500
- customModelId: string | null;
501
- }
502
-
503
- const PANE_SELECT = `
504
- id, title, color, cwd, claude_session_id as claudeSessionId,
505
- agent_type as agentType, custom_command as customCommand,
506
- grid_col as gridCol, grid_row as gridRow, sort_order as sortOrder,
507
- shell, created, workspace_id as workspaceId,
508
- is_popout as isPopout, win_x as winX, win_y as winY,
509
- win_width as winWidth, win_height as winHeight,
510
- node_id as nodeId,
511
- is_collaborating as isCollaborating,
512
- diff_baseline_sha as diffBaselineSha,
513
- custom_model_id as customModelId
514
- `;
515
-
516
- function mapPane(row: any): PaneData {
517
- return { ...row, isPopout: !!row.isPopout, isCollaborating: !!row.isCollaborating };
518
- }
519
-
520
- function findLatestSessionIdForPane(db: ReturnType<typeof getDb>, cwd: string, agentType: string): string | null {
521
- if (!cwd || !agentType || agentType === 'shell') return null;
522
-
523
- try {
524
- const resolved = path.resolve(cwd);
525
- const row = db.prepare(`
526
- SELECT s.session_id as sessionId
527
- FROM sessions s
528
- LEFT JOIN projects p ON p.id = s.project_id
529
- WHERE s.agent_type = ?
530
- AND (
531
- s.project_path = ? OR s.project_path = ?
532
- OR p.path = ? OR p.path = ?
533
- )
534
- ORDER BY s.modified DESC
535
- LIMIT 1
536
- `).get(agentType, cwd, resolved, cwd, resolved) as { sessionId: string } | undefined;
537
-
538
- if (row?.sessionId) return row.sessionId;
539
-
540
- if (agentType === 'codex') {
541
- const paths = getUserPaths(getCurrentUser());
542
- const latest = scanCodexSessions(paths.codexSessionsDir).find((session) => {
543
- try {
544
- return path.resolve(session.cwd) === resolved;
545
- } catch {
546
- return false;
547
- }
548
- });
549
- if (latest?.id) return latest.id;
550
- }
551
-
552
- // Pi stores sessions as JSONL in .pi/sessions/ (project) or ~/.pi/agent/sessions/ (global).
553
- // Check project-level first, then fall back to global.
554
- if (agentType === 'pi') {
555
- const fs = require('fs');
556
- const dirs = [
557
- path.join(resolved, '.pi', 'sessions'),
558
- path.join(require('os').homedir(), '.pi', 'agent', 'sessions'),
559
- ];
560
- for (const dir of dirs) {
561
- try {
562
- if (!fs.existsSync(dir)) continue;
563
- const files: string[] = fs.readdirSync(dir)
564
- .filter((f: string) => f.endsWith('.jsonl'))
565
- .sort((a: string, b: string) => {
566
- // Sort by modification time descending (most recent first)
567
- const aStat = fs.statSync(path.join(dir, a));
568
- const bStat = fs.statSync(path.join(dir, b));
569
- return bStat.mtimeMs - aStat.mtimeMs;
570
- });
571
- if (files.length > 0) {
572
- return path.basename(files[0], '.jsonl');
573
- }
574
- } catch { /* ignore */ }
575
- }
576
- }
577
-
578
- return null;
579
- } catch {
580
- return null;
581
- }
582
- }
583
-
584
- function normalizePane(row: any): PaneData {
585
- const pane = mapPane(row);
586
-
587
- if (!pane.claudeSessionId || pane.claudeSessionId === 'new') {
588
- const db = getDb();
589
- const sessionId = findLatestSessionIdForPane(db, pane.cwd, pane.agentType);
590
- if (sessionId) {
591
- pane.claudeSessionId = sessionId;
592
- try {
593
- db.prepare('UPDATE panes SET claude_session_id = ? WHERE id = ?').run(sessionId, pane.id);
594
- } catch {
595
- // Ignore best-effort backfill failures during reads.
596
- }
597
- }
598
- }
599
-
600
- return pane;
601
- }
602
-
603
- export function getPanesByWorkspace(workspaceId: number): PaneData[] {
604
- const db = getDb();
605
- const rows = db.prepare(`SELECT ${PANE_SELECT} FROM panes WHERE workspace_id = ? ORDER BY sort_order, created`).all(workspaceId);
606
- return rows.map(normalizePane) as PaneData[];
607
- }
608
-
609
- export function getAllPanes(): PaneData[] {
610
- const db = getDb();
611
- const rows = db.prepare(`SELECT ${PANE_SELECT} FROM panes ORDER BY sort_order, created`).all();
612
- return rows.map(normalizePane) as PaneData[];
613
- }
614
-
615
- export function getActivePanes(): PaneData[] {
616
- const db = getDb();
617
- const activeWs = db.prepare('SELECT id FROM workspaces WHERE is_active = 1').get() as { id: number } | undefined;
618
- if (!activeWs) return [];
619
- return getPanesByWorkspace(activeWs.id);
620
- }
621
-
622
- export function createPane(pane: {
623
- id: string;
624
- title: string;
625
- color: string;
626
- cwd: string;
627
- claudeSessionId?: string;
628
- agentType?: string;
629
- customCommand?: string;
630
- sortOrder?: number;
631
- workspaceId?: number;
632
- nodeId?: string;
633
- isCollaborating?: boolean;
634
- customModelId?: string | null;
635
- }): PaneData {
636
- const db = getDb();
637
- const maxOrder = db.prepare('SELECT MAX(sort_order) as m FROM panes').get() as { m: number | null };
638
- const order = pane.sortOrder ?? ((maxOrder.m ?? -1) + 1);
639
-
640
- // Default to active workspace if not specified
641
- let wsId = pane.workspaceId;
642
- if (wsId === undefined) {
643
- const activeWs = db.prepare('SELECT id FROM workspaces WHERE is_active = 1').get() as { id: number } | undefined;
644
- wsId = activeWs?.id;
645
- }
646
-
647
- // Capture git HEAD as diff baseline if cwd is a git repo
648
- let baselineSha: string | null = null;
649
- try {
650
- const { execFileSync } = require('child_process');
651
- baselineSha = execFileSync('git', ['rev-parse', 'HEAD'], { cwd: pane.cwd, encoding: 'utf-8', timeout: 3000 }).trim();
652
- } catch { /* not a git repo or git not available */ }
653
-
654
- // Automatically find the most recent session for this agent+project if not specified
655
- let sessId = pane.claudeSessionId || null;
656
- if (!sessId || sessId === 'new') {
657
- sessId = findLatestSessionIdForPane(db, pane.cwd, pane.agentType || 'shell');
658
- }
659
-
660
- db.prepare(`
661
- INSERT INTO panes (id, title, color, cwd, claude_session_id, agent_type, custom_command, sort_order, workspace_id, node_id, is_collaborating, diff_baseline_sha, custom_model_id)
662
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
663
- `).run(pane.id, pane.title, pane.color, pane.cwd, sessId, pane.agentType || 'shell', pane.customCommand || null, order, wsId || null, pane.nodeId || null, pane.isCollaborating ? 1 : 0, baselineSha, pane.customModelId || null);
664
-
665
- return getPaneById(pane.id)!;
666
- }
667
-
668
- export function getPaneById(id: string): PaneData | null {
669
- const db = getDb();
670
- const row = db.prepare(`SELECT ${PANE_SELECT} FROM panes WHERE id = ?`).get(id) as any | null;
671
- return row ? normalizePane(row) : null;
672
- }
673
-
674
- export function updatePane(id: string, data: {
675
- title?: string;
676
- color?: string;
677
- cwd?: string;
678
- claudeSessionId?: string | null;
679
- agentType?: string;
680
- customCommand?: string | null;
681
- gridCol?: number;
682
- gridRow?: number;
683
- sortOrder?: number;
684
- workspaceId?: number | null;
685
- isPopout?: boolean;
686
- winX?: number | null;
687
- winY?: number | null;
688
- winWidth?: number | null;
689
- winHeight?: number | null;
690
- isCollaborating?: boolean;
691
- diffBaselineSha?: string | null;
692
- customModelId?: string | null;
693
- }) {
694
- const db = getDb();
695
- const sets: string[] = [];
696
- const vals: any[] = [];
697
-
698
- if (data.title !== undefined) { sets.push('title = ?'); vals.push(data.title); }
699
- if (data.color !== undefined) { sets.push('color = ?'); vals.push(data.color); }
700
- if (data.cwd !== undefined) { sets.push('cwd = ?'); vals.push(data.cwd); }
701
- if (data.claudeSessionId !== undefined) { sets.push('claude_session_id = ?'); vals.push(data.claudeSessionId); }
702
- if (data.agentType !== undefined) { sets.push('agent_type = ?'); vals.push(data.agentType); }
703
- if (data.customCommand !== undefined) { sets.push('custom_command = ?'); vals.push(data.customCommand); }
704
- if (data.gridCol !== undefined) { sets.push('grid_col = ?'); vals.push(data.gridCol); }
705
- if (data.gridRow !== undefined) { sets.push('grid_row = ?'); vals.push(data.gridRow); }
706
- if (data.sortOrder !== undefined) { sets.push('sort_order = ?'); vals.push(data.sortOrder); }
707
- if (data.workspaceId !== undefined) { sets.push('workspace_id = ?'); vals.push(data.workspaceId); }
708
- if (data.isPopout !== undefined) { sets.push('is_popout = ?'); vals.push(data.isPopout ? 1 : 0); }
709
- if (data.winX !== undefined) { sets.push('win_x = ?'); vals.push(data.winX); }
710
- if (data.winY !== undefined) { sets.push('win_y = ?'); vals.push(data.winY); }
711
- if (data.winWidth !== undefined) { sets.push('win_width = ?'); vals.push(data.winWidth); }
712
- if (data.winHeight !== undefined) { sets.push('win_height = ?'); vals.push(data.winHeight); }
713
- if ((data as any).nodeId !== undefined) { sets.push('node_id = ?'); vals.push((data as any).nodeId); }
714
- if (data.isCollaborating !== undefined) { sets.push('is_collaborating = ?'); vals.push(data.isCollaborating ? 1 : 0); }
715
- if (data.diffBaselineSha !== undefined) { sets.push('diff_baseline_sha = ?'); vals.push(data.diffBaselineSha); }
716
- if (data.customModelId !== undefined) { sets.push('custom_model_id = ?'); vals.push(data.customModelId); }
717
-
718
- if (sets.length === 0) return;
719
- vals.push(id);
720
- db.prepare(`UPDATE panes SET ${sets.join(', ')} WHERE id = ?`).run(...vals);
721
- }
722
-
723
- export function deletePane(id: string) {
724
- const db = getDb();
725
- db.prepare('DELETE FROM panes WHERE id = ?').run(id);
726
- }
727
-
728
- export function deletePanesByNodeId(nodeId: string) {
729
- const db = getDb();
730
- db.prepare('DELETE FROM panes WHERE node_id = ?').run(nodeId);
731
- }
732
-
733
- // ─── Workspace-as-Layout Operations ────────────────────────
734
-
735
- export function getActiveWorkspace(): Workspace | null {
736
- const db = getDb();
737
- return db.prepare('SELECT id, name, description, color, created, is_active as isActive, collaboration FROM workspaces WHERE is_active = 1').get() as Workspace | null;
738
- }
739
-
740
- export function switchWorkspace(workspaceId: number) {
741
- const db = getDb();
742
- db.prepare('UPDATE workspaces SET is_active = 0').run();
743
- db.prepare('UPDATE workspaces SET is_active = 1 WHERE id = ?').run(workspaceId);
744
- }
745
-
746
- export function duplicateWorkspace(sourceId: number, newName: string, newColor?: string): { workspace: Workspace; panes: PaneData[] } {
747
- const db = getDb();
748
-
749
- // Create the new workspace
750
- const src = db.prepare('SELECT * FROM workspaces WHERE id = ?').get(sourceId) as any;
751
- const result = db.prepare(
752
- 'INSERT INTO workspaces (name, description, color, is_active) VALUES (?, ?, ?, 0)'
753
- ).run(newName, src?.description || '', newColor || src?.color || '#6366f1');
754
- const newWsId = Number(result.lastInsertRowid);
755
-
756
- // Clone all panes from source workspace
757
- const srcPanes = db.prepare('SELECT * FROM panes WHERE workspace_id = ?').all(sourceId) as any[];
758
- const cloneStmt = db.prepare(`
759
- INSERT INTO panes (id, title, color, cwd, claude_session_id, agent_type, custom_command, grid_col, grid_row, sort_order, shell, workspace_id, is_popout, win_x, win_y, win_width, win_height)
760
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
761
- `);
762
-
763
- const cloneMany = db.transaction(() => {
764
- for (const p of srcPanes) {
765
- const newId = crypto.randomUUID();
766
- cloneStmt.run(
767
- newId, p.title, p.color, p.cwd, p.claude_session_id, p.agent_type || 'shell', p.custom_command || null,
768
- p.grid_col, p.grid_row, p.sort_order, p.shell,
769
- newWsId, 0, p.win_x, p.win_y, p.win_width, p.win_height
770
- );
771
- }
772
- });
773
- cloneMany();
774
-
775
- const ws: Workspace = { id: newWsId, name: newName, description: src?.description || '', color: newColor || src?.color || '#6366f1', created: new Date().toISOString() };
776
- const panes = getPanesByWorkspace(newWsId);
777
- return { workspace: ws, panes };
778
- }
779
-
780
- export function deleteWorkspaceFull(workspaceId: number) {
781
- const db = getDb();
782
- // Delete all panes belonging to this workspace
783
- db.prepare('DELETE FROM panes WHERE workspace_id = ?').run(workspaceId);
784
- db.prepare('DELETE FROM workspaces WHERE id = ?').run(workspaceId);
785
-
786
- // If deleted the active workspace, activate another
787
- const anyActive = db.prepare('SELECT id FROM workspaces WHERE is_active = 1').get();
788
- if (!anyActive) {
789
- const first = db.prepare('SELECT id FROM workspaces ORDER BY id LIMIT 1').get() as { id: number } | undefined;
790
- if (first) {
791
- db.prepare('UPDATE workspaces SET is_active = 1 WHERE id = ?').run(first.id);
792
- }
793
- }
794
- }
795
-
796
- // ─── Analytics ──────────────────────────────────────────────
797
-
798
- export function getAnalyticsOverview() {
799
- const db = getDb();
800
- const totals = db.prepare(`
801
- SELECT COUNT(*) as totalSessions, COALESCE(SUM(message_count), 0) as totalMessages
802
- FROM sessions
803
- `).get() as { totalSessions: number; totalMessages: number };
804
-
805
- const projectCount = db.prepare('SELECT COUNT(*) as count FROM projects').get() as { count: number };
806
-
807
- return {
808
- totalSessions: totals.totalSessions,
809
- totalMessages: totals.totalMessages,
810
- totalProjects: projectCount.count,
811
- };
812
- }
813
-
814
- export function getDailyActivity(days = 30): { date: string; sessionCount: number; messageCount: number; toolCallCount: number }[] {
815
- const db = getDb();
816
- return db.prepare(`
817
- SELECT date(created) as date,
818
- COUNT(*) as sessionCount,
819
- COALESCE(SUM(message_count), 0) as messageCount,
820
- 0 as toolCallCount
821
- FROM sessions
822
- WHERE created >= date('now', ?)
823
- GROUP BY date(created)
824
- ORDER BY date(created)
825
- `).all(`-${days} days`) as any[];
826
- }
827
-
1
+ import crypto from 'crypto';
2
+ import { getDb } from './schema';
3
+ import type { SessionWithMeta, Project, Workspace, Tag, SearchResult } from '@/types/claude';
4
+
5
+ // ─── Projects ───────────────────────────────────────────────
6
+
7
+ export function upsertProject(project: { id: string; name: string; path: string; claudePath: string; agentType?: string }) {
8
+ const db = getDb();
9
+ db.prepare(`
10
+ INSERT INTO projects (id, name, path, claude_path, agent_path, agent_type)
11
+ VALUES (?, ?, ?, ?, ?, ?)
12
+ ON CONFLICT(id) DO UPDATE SET name=excluded.name, path=excluded.path, claude_path=excluded.claude_path, agent_path=excluded.agent_path, agent_type=excluded.agent_type
13
+ `).run(project.id, project.name, project.path, project.claudePath, project.claudePath, project.agentType || 'claude');
14
+ }
15
+
16
+ export function getAllProjects(): Project[] {
17
+ const db = getDb();
18
+ return db.prepare(`
19
+ SELECT p.id, p.name, p.path, p.claude_path as claudePath,
20
+ p.agent_type as agentType,
21
+ COUNT(s.id) as sessionCount,
22
+ MAX(s.modified) as lastActivity
23
+ FROM projects p
24
+ LEFT JOIN sessions s ON s.project_id = p.id
25
+ GROUP BY p.id
26
+ ORDER BY lastActivity DESC
27
+ `).all() as Project[];
28
+ }
29
+
30
+ // ─── Sessions ───────────────────────────────────────────────
31
+
32
+ export function upsertSession(session: {
33
+ id: string;
34
+ sessionId: string;
35
+ projectId: string;
36
+ firstPrompt: string;
37
+ summary: string;
38
+ messageCount: number;
39
+ created: string;
40
+ modified: string;
41
+ gitBranch: string;
42
+ projectPath: string;
43
+ fullPath: string;
44
+ agentType?: string;
45
+ }) {
46
+ const db = getDb();
47
+ db.prepare(`
48
+ INSERT INTO sessions (id, session_id, project_id, first_prompt, summary, message_count, created, modified, git_branch, project_path, full_path, agent_type)
49
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
50
+ ON CONFLICT(id) DO UPDATE SET
51
+ first_prompt = CASE WHEN excluded.first_prompt != '' THEN excluded.first_prompt ELSE sessions.first_prompt END,
52
+ summary = CASE WHEN excluded.summary != '' THEN excluded.summary ELSE sessions.summary END,
53
+ message_count = CASE WHEN excluded.message_count > sessions.message_count THEN excluded.message_count ELSE sessions.message_count END,
54
+ modified = CASE WHEN excluded.modified != '' THEN excluded.modified ELSE sessions.modified END,
55
+ git_branch = CASE WHEN excluded.git_branch != '' THEN excluded.git_branch ELSE sessions.git_branch END,
56
+ full_path = CASE WHEN excluded.full_path != '' THEN excluded.full_path ELSE sessions.full_path END,
57
+ agent_type=excluded.agent_type
58
+ `).run(
59
+ session.id, session.sessionId, session.projectId,
60
+ session.firstPrompt, session.summary, session.messageCount,
61
+ session.created, session.modified, session.gitBranch,
62
+ session.projectPath, session.fullPath, session.agentType || 'claude'
63
+ );
64
+ }
65
+
66
+ interface SessionQueryParams {
67
+ projectId?: string;
68
+ projectPath?: string;
69
+ starred?: boolean;
70
+ tagId?: number;
71
+ search?: string;
72
+ agentType?: string;
73
+ sortBy?: string;
74
+ sortDir?: string;
75
+ offset?: number;
76
+ limit?: number;
77
+ }
78
+
79
+ export function getSessions(params: SessionQueryParams = {}): { sessions: SessionWithMeta[]; total: number } {
80
+ const db = getDb();
81
+ const {
82
+ projectId,
83
+ projectPath,
84
+ starred,
85
+ tagId,
86
+ search,
87
+ sortBy = 'modified',
88
+ sortDir = 'DESC',
89
+ offset = 0,
90
+ limit = 50,
91
+ } = params;
92
+
93
+ const where: string[] = [];
94
+ const queryParams: (string | number)[] = [];
95
+
96
+ if (projectId) {
97
+ where.push('s.project_id = ?');
98
+ queryParams.push(projectId);
99
+ }
100
+ if (projectPath) {
101
+ where.push('s.project_path = ?');
102
+ queryParams.push(projectPath);
103
+ }
104
+ if (starred !== undefined) {
105
+ where.push('s.starred = ?');
106
+ queryParams.push(starred ? 1 : 0);
107
+ }
108
+ if (tagId) {
109
+ where.push('EXISTS (SELECT 1 FROM session_tags st WHERE st.session_id = s.id AND st.tag_id = ?)');
110
+ queryParams.push(tagId);
111
+ }
112
+ if (search) {
113
+ where.push('(s.first_prompt LIKE ? OR s.summary LIKE ? OR s.custom_name LIKE ?)');
114
+ const pattern = `%${search}%`;
115
+ queryParams.push(pattern, pattern, pattern);
116
+ }
117
+ if (params.agentType) {
118
+ where.push('s.agent_type = ?');
119
+ queryParams.push(params.agentType);
120
+ }
121
+
122
+ const whereClause = where.length > 0 ? `WHERE ${where.join(' AND ')}` : '';
123
+
124
+ const allowedSorts: Record<string, string> = {
125
+ created: 's.created',
126
+ modified: 's.modified',
127
+ messages: 's.message_count',
128
+ name: "COALESCE(s.custom_name, s.summary, s.first_prompt)",
129
+ };
130
+ const sortColumn = allowedSorts[sortBy] || 's.modified';
131
+ const direction = sortDir === 'ASC' ? 'ASC' : 'DESC';
132
+
133
+ const countRow = db.prepare(`SELECT COUNT(*) as total FROM sessions s ${whereClause}`).get(...queryParams) as { total: number };
134
+
135
+ const rows = db.prepare(`
136
+ SELECT s.id, s.session_id as sessionId, s.project_id as projectId,
137
+ p.name as projectName, s.first_prompt as firstPrompt,
138
+ s.summary, s.message_count as messageCount,
139
+ s.created, s.modified, s.git_branch as gitBranch,
140
+ s.project_path as projectPath, s.full_path as fullPath,
141
+ s.starred, s.custom_name as customName, s.notes,
142
+ s.agent_type as agentType
143
+ FROM sessions s
144
+ LEFT JOIN projects p ON p.id = s.project_id
145
+ ${whereClause}
146
+ ORDER BY ${sortColumn} ${direction}
147
+ LIMIT ? OFFSET ?
148
+ `).all(...queryParams, limit, offset) as SessionWithMeta[];
149
+
150
+ // Fetch tags and workspaces for each session
151
+ const tagStmt = db.prepare(`
152
+ SELECT t.name FROM tags t
153
+ JOIN session_tags st ON st.tag_id = t.id
154
+ WHERE st.session_id = ?
155
+ `);
156
+ const wsStmt = db.prepare(`
157
+ SELECT w.id, w.name, w.color FROM workspaces w
158
+ JOIN workspace_sessions ws ON ws.workspace_id = w.id
159
+ WHERE ws.session_id = ?
160
+ `);
161
+
162
+ for (const row of rows) {
163
+ const tags = tagStmt.all(row.id) as { name: string }[];
164
+ row.tags = tags.map(t => t.name);
165
+ row.workspaces = wsStmt.all(row.id) as { id: number; name: string; color: string }[];
166
+ row.starred = !!row.starred;
167
+ }
168
+
169
+ return { sessions: rows, total: countRow.total };
170
+ }
171
+
172
+ export function getSessionById(id: string): SessionWithMeta | null {
173
+ const db = getDb();
174
+ const row = db.prepare(`
175
+ SELECT s.id, s.session_id as sessionId, s.project_id as projectId,
176
+ p.name as projectName, s.first_prompt as firstPrompt,
177
+ s.summary, s.message_count as messageCount,
178
+ s.created, s.modified, s.git_branch as gitBranch,
179
+ s.project_path as projectPath, s.full_path as fullPath,
180
+ s.starred, s.custom_name as customName, s.notes,
181
+ s.agent_type as agentType
182
+ FROM sessions s
183
+ LEFT JOIN projects p ON p.id = s.project_id
184
+ WHERE s.id = ? OR s.session_id = ?
185
+ `).get(id, id) as SessionWithMeta | undefined;
186
+
187
+ if (!row) return null;
188
+
189
+ const tags = db.prepare(`
190
+ SELECT t.name FROM tags t
191
+ JOIN session_tags st ON st.tag_id = t.id
192
+ WHERE st.session_id = ?
193
+ `).all(row.id) as { name: string }[];
194
+
195
+ row.tags = tags.map(t => t.name);
196
+ row.starred = !!row.starred;
197
+
198
+ return row;
199
+ }
200
+
201
+ export function toggleStar(sessionId: string): boolean {
202
+ const db = getDb();
203
+ const current = db.prepare('SELECT starred FROM sessions WHERE id = ? OR session_id = ?').get(sessionId, sessionId) as { starred: number } | undefined;
204
+ if (!current) return false;
205
+ const newValue = current.starred ? 0 : 1;
206
+ db.prepare('UPDATE sessions SET starred = ? WHERE id = ? OR session_id = ?').run(newValue, sessionId, sessionId);
207
+ return !!newValue;
208
+ }
209
+
210
+ export function updateSessionNotes(sessionId: string, notes: string) {
211
+ const db = getDb();
212
+ db.prepare('UPDATE sessions SET notes = ? WHERE id = ? OR session_id = ?').run(notes, sessionId, sessionId);
213
+ }
214
+
215
+ // ─── Workspaces ─────────────────────────────────────────────
216
+
217
+ export function createWorkspace(name: string, description?: string, color?: string): Workspace {
218
+ const db = getDb();
219
+ const result = db.prepare('INSERT INTO workspaces (name, description, color) VALUES (?, ?, ?)').run(
220
+ name, description || '', color || '#6366f1'
221
+ );
222
+ return { id: Number(result.lastInsertRowid), name, description: description || '', color: color || '#6366f1', created: new Date().toISOString() };
223
+ }
224
+
225
+ export function getAllWorkspaces(): Workspace[] {
226
+ const db = getDb();
227
+ return db.prepare(`
228
+ SELECT w.*, COUNT(ws.session_id) as sessionCount
229
+ FROM workspaces w
230
+ LEFT JOIN workspace_sessions ws ON ws.workspace_id = w.id
231
+ GROUP BY w.id
232
+ ORDER BY w.created DESC
233
+ `).all() as Workspace[];
234
+ }
235
+
236
+ export function addSessionToWorkspace(workspaceId: number, sessionId: string) {
237
+ const db = getDb();
238
+ db.prepare('INSERT OR IGNORE INTO workspace_sessions (workspace_id, session_id) VALUES (?, ?)').run(workspaceId, sessionId);
239
+ }
240
+
241
+ export function removeSessionFromWorkspace(workspaceId: number, sessionId: string) {
242
+ const db = getDb();
243
+ db.prepare('DELETE FROM workspace_sessions WHERE workspace_id = ? AND session_id = ?').run(workspaceId, sessionId);
244
+ }
245
+
246
+ // ─── Tags ───────────────────────────────────────────────────
247
+
248
+ export function createTag(name: string, color?: string): Tag {
249
+ const db = getDb();
250
+ const result = db.prepare('INSERT OR IGNORE INTO tags (name, color) VALUES (?, ?)').run(name, color || '#8b5cf6');
251
+ return { id: Number(result.lastInsertRowid), name, color: color || '#8b5cf6' };
252
+ }
253
+
254
+ export function getAllTags(): Tag[] {
255
+ const db = getDb();
256
+ return db.prepare('SELECT * FROM tags ORDER BY name').all() as Tag[];
257
+ }
258
+
259
+ export function addTagToSession(sessionId: string, tagName: string) {
260
+ const db = getDb();
261
+ let tag = db.prepare('SELECT id FROM tags WHERE name = ?').get(tagName) as { id: number } | undefined;
262
+ if (!tag) {
263
+ const result = db.prepare('INSERT INTO tags (name) VALUES (?)').run(tagName);
264
+ tag = { id: Number(result.lastInsertRowid) };
265
+ }
266
+ db.prepare('INSERT OR IGNORE INTO session_tags (session_id, tag_id) VALUES (?, ?)').run(sessionId, tag.id);
267
+ }
268
+
269
+ export function removeTagFromSession(sessionId: string, tagId: number) {
270
+ const db = getDb();
271
+ db.prepare('DELETE FROM session_tags WHERE session_id = ? AND tag_id = ?').run(sessionId, tagId);
272
+ }
273
+
274
+ export function removeTagFromSessionByName(sessionId: string, tagName: string) {
275
+ const db = getDb();
276
+ const tag = db.prepare('SELECT id FROM tags WHERE name = ?').get(tagName) as { id: number } | undefined;
277
+ if (tag) {
278
+ db.prepare('DELETE FROM session_tags WHERE session_id = ? AND tag_id = ?').run(sessionId, tag.id);
279
+ }
280
+ }
281
+
282
+ export function deleteTag(tagId: number) {
283
+ const db = getDb();
284
+ db.prepare('DELETE FROM session_tags WHERE tag_id = ?').run(tagId);
285
+ db.prepare('DELETE FROM tags WHERE id = ?').run(tagId);
286
+ }
287
+
288
+ export function updateTagColor(tagId: number, color: string) {
289
+ const db = getDb();
290
+ db.prepare('UPDATE tags SET color = ? WHERE id = ?').run(color, tagId);
291
+ }
292
+
293
+ export function getSessionTags(sessionId: string): Tag[] {
294
+ const db = getDb();
295
+ return db.prepare(`
296
+ SELECT t.id, t.name, t.color FROM tags t
297
+ JOIN session_tags st ON st.tag_id = t.id
298
+ WHERE st.session_id = ?
299
+ ORDER BY t.name
300
+ `).all(sessionId) as Tag[];
301
+ }
302
+
303
+ export function renameSession(sessionId: string, customName: string) {
304
+ const db = getDb();
305
+ db.prepare('UPDATE sessions SET custom_name = ? WHERE id = ? OR session_id = ?').run(customName || null, sessionId, sessionId);
306
+ }
307
+
308
+ // ─── Workspace Extras ───────────────────────────────────────
309
+
310
+ export function deleteWorkspace(workspaceId: number) {
311
+ const db = getDb();
312
+ db.prepare('DELETE FROM workspace_sessions WHERE workspace_id = ?').run(workspaceId);
313
+ db.prepare('DELETE FROM workspaces WHERE id = ?').run(workspaceId);
314
+ }
315
+
316
+ export function updateWorkspace(workspaceId: number, data: { name?: string; description?: string; color?: string; collaboration?: boolean }) {
317
+ const db = getDb();
318
+ if (data.name !== undefined) db.prepare('UPDATE workspaces SET name = ? WHERE id = ?').run(data.name, workspaceId);
319
+ if (data.description !== undefined) db.prepare('UPDATE workspaces SET description = ? WHERE id = ?').run(data.description, workspaceId);
320
+ if (data.color !== undefined) db.prepare('UPDATE workspaces SET color = ? WHERE id = ?').run(data.color, workspaceId);
321
+ if (data.collaboration !== undefined) db.prepare('UPDATE workspaces SET collaboration = ? WHERE id = ?').run(data.collaboration ? 1 : 0, workspaceId);
322
+ }
323
+
324
+ export function getWorkspacesForSession(sessionId: string): { id: number; name: string; color: string }[] {
325
+ const db = getDb();
326
+ // Check workspace_sessions first (local sessions)
327
+ const fromWs = db.prepare(`
328
+ SELECT w.id, w.name, w.color FROM workspaces w
329
+ JOIN workspace_sessions ws ON ws.workspace_id = w.id
330
+ WHERE ws.session_id = ?
331
+ `).all(sessionId) as { id: number; name: string; color: string }[];
332
+ if (fromWs.length > 0) return fromWs;
333
+ // Fallback: check panes table (remote sessions stored via pane only)
334
+ return db.prepare(`
335
+ SELECT DISTINCT w.id, w.name, w.color FROM workspaces w
336
+ JOIN panes p ON p.workspace_id = w.id
337
+ WHERE p.claude_session_id = ?
338
+ `).all(sessionId) as { id: number; name: string; color: string }[];
339
+ }
340
+
341
+ export function getWorkspaceSessions(workspaceId: number): SessionWithMeta[] {
342
+ const db = getDb();
343
+ const rows = db.prepare(`
344
+ SELECT s.id, s.session_id as sessionId, s.project_id as projectId,
345
+ p.name as projectName, s.first_prompt as firstPrompt,
346
+ s.summary, s.message_count as messageCount,
347
+ s.created, s.modified, s.git_branch as gitBranch,
348
+ s.project_path as projectPath, s.full_path as fullPath,
349
+ s.starred, s.custom_name as customName, s.notes,
350
+ s.agent_type as agentType
351
+ FROM sessions s
352
+ JOIN workspace_sessions ws ON ws.session_id = s.id
353
+ LEFT JOIN projects p ON p.id = s.project_id
354
+ WHERE ws.workspace_id = ?
355
+ ORDER BY s.modified DESC
356
+ `).all(workspaceId) as SessionWithMeta[];
357
+
358
+ const tagStmt = db.prepare('SELECT t.name FROM tags t JOIN session_tags st ON st.tag_id = t.id WHERE st.session_id = ?');
359
+ for (const row of rows) {
360
+ row.tags = (tagStmt.all(row.id) as { name: string }[]).map(t => t.name);
361
+ row.starred = !!row.starred;
362
+ }
363
+ return rows;
364
+ }
365
+
366
+ export function getSessionWorkspaces(sessionId: string): Workspace[] {
367
+ const db = getDb();
368
+ return db.prepare(`
369
+ SELECT w.id, w.name, w.description, w.color, w.created, w.collaboration
370
+ FROM workspaces w
371
+ JOIN workspace_sessions ws ON ws.workspace_id = w.id
372
+ WHERE ws.session_id = ?
373
+ `).all(sessionId) as Workspace[];
374
+ }
375
+
376
+ // ─── Bulk Operations ────────────────────────────────────────
377
+
378
+ export function bulkAddTag(sessionIds: string[], tagName: string) {
379
+ const db = getDb();
380
+ let tag = db.prepare('SELECT id FROM tags WHERE name = ?').get(tagName) as { id: number } | undefined;
381
+ if (!tag) {
382
+ const result = db.prepare('INSERT INTO tags (name) VALUES (?)').run(tagName);
383
+ tag = { id: Number(result.lastInsertRowid) };
384
+ }
385
+ const stmt = db.prepare('INSERT OR IGNORE INTO session_tags (session_id, tag_id) VALUES (?, ?)');
386
+ const run = db.transaction(() => {
387
+ for (const id of sessionIds) stmt.run(id, tag!.id);
388
+ });
389
+ run();
390
+ }
391
+
392
+ export function bulkAddToWorkspace(sessionIds: string[], workspaceId: number) {
393
+ const db = getDb();
394
+ const stmt = db.prepare('INSERT OR IGNORE INTO workspace_sessions (workspace_id, session_id) VALUES (?, ?)');
395
+ const run = db.transaction(() => {
396
+ for (const id of sessionIds) stmt.run(workspaceId, id);
397
+ });
398
+ run();
399
+ }
400
+
401
+ export function bulkStar(sessionIds: string[], starred: boolean) {
402
+ const db = getDb();
403
+ const stmt = db.prepare('UPDATE sessions SET starred = ? WHERE id = ?');
404
+ const run = db.transaction(() => {
405
+ for (const id of sessionIds) stmt.run(starred ? 1 : 0, id);
406
+ });
407
+ run();
408
+ }
409
+
410
+ // ─── FTS Search ─────────────────────────────────────────────
411
+
412
+ export function upsertFtsContent(sessionId: string, content: string) {
413
+ const db = getDb();
414
+ db.prepare('DELETE FROM sessions_fts WHERE session_id = ?').run(sessionId);
415
+ db.prepare('INSERT INTO sessions_fts (session_id, content) VALUES (?, ?)').run(sessionId, content);
416
+ }
417
+
418
+ export function searchSessions(query: string, params: { projectId?: string; limit?: number; offset?: number } = {}): SearchResult[] {
419
+ const db = getDb();
420
+ const { projectId, limit = 20, offset = 0 } = params;
421
+
422
+ let sql = `
423
+ SELECT f.session_id as sessionId, snippet(sessions_fts, 1, '<mark>', '</mark>', '...', 40) as snippet,
424
+ rank, p.name as projectName, s.first_prompt as firstPrompt, s.created
425
+ FROM sessions_fts f
426
+ JOIN sessions s ON s.id = f.session_id OR s.session_id = f.session_id
427
+ LEFT JOIN projects p ON p.id = s.project_id
428
+ WHERE sessions_fts MATCH ?
429
+ `;
430
+ const queryParams: (string | number)[] = [query];
431
+
432
+ if (projectId) {
433
+ sql += ' AND s.project_id = ?';
434
+ queryParams.push(projectId);
435
+ }
436
+
437
+ sql += ' ORDER BY rank LIMIT ? OFFSET ?';
438
+ queryParams.push(limit, offset);
439
+
440
+ try {
441
+ return db.prepare(sql).all(...queryParams) as SearchResult[];
442
+ } catch {
443
+ // Fallback to LIKE search if FTS fails
444
+ return db.prepare(`
445
+ SELECT s.id as sessionId, substr(s.first_prompt, 1, 200) as snippet,
446
+ 0 as rank, p.name as projectName, s.first_prompt as firstPrompt, s.created
447
+ FROM sessions s
448
+ LEFT JOIN projects p ON p.id = s.project_id
449
+ WHERE s.first_prompt LIKE ? OR s.summary LIKE ?
450
+ LIMIT ? OFFSET ?
451
+ `).all(`%${query}%`, `%${query}%`, limit, offset) as SearchResult[];
452
+ }
453
+ }
454
+
455
+ // ─── Sync State ─────────────────────────────────────────────
456
+
457
+ export function getSyncState(filePath: string): { mtime: number; byteOffset: number } | null {
458
+ const db = getDb();
459
+ const row = db.prepare('SELECT mtime, byte_offset as byteOffset FROM sync_state WHERE file_path = ?').get(filePath) as { mtime: number; byteOffset: number } | undefined;
460
+ return row || null;
461
+ }
462
+
463
+ export function updateSyncState(filePath: string, mtime: number, byteOffset: number) {
464
+ const db = getDb();
465
+ db.prepare(`
466
+ INSERT INTO sync_state (file_path, mtime, byte_offset, last_synced)
467
+ VALUES (?, ?, ?, datetime('now'))
468
+ ON CONFLICT(file_path) DO UPDATE SET mtime=excluded.mtime, byte_offset=excluded.byte_offset, last_synced=datetime('now')
469
+ `).run(filePath, mtime, byteOffset);
470
+ }
471
+
472
+ // ─── Panes ─────────────────────────────────────────────────
473
+
474
+ export interface PaneData {
475
+ id: string;
476
+ title: string;
477
+ color: string;
478
+ cwd: string;
479
+ claudeSessionId: string | null;
480
+ agentType: string;
481
+ customCommand: string | null;
482
+ gridCol: number;
483
+ gridRow: number;
484
+ sortOrder: number;
485
+ shell: string | null;
486
+ created: string;
487
+ workspaceId: number | null;
488
+ isPopout: boolean;
489
+ winX: number | null;
490
+ winY: number | null;
491
+ winWidth: number | null;
492
+ winHeight: number | null;
493
+ nodeId: string | null;
494
+ isCollaborating: boolean;
495
+ diffBaselineSha: string | null;
496
+ customModelId: string | null;
497
+ }
498
+
499
+ const PANE_SELECT = `
500
+ id, title, color, cwd, claude_session_id as claudeSessionId,
501
+ agent_type as agentType, custom_command as customCommand,
502
+ grid_col as gridCol, grid_row as gridRow, sort_order as sortOrder,
503
+ shell, created, workspace_id as workspaceId,
504
+ is_popout as isPopout, win_x as winX, win_y as winY,
505
+ win_width as winWidth, win_height as winHeight,
506
+ node_id as nodeId,
507
+ is_collaborating as isCollaborating,
508
+ diff_baseline_sha as diffBaselineSha,
509
+ custom_model_id as customModelId
510
+ `;
511
+
512
+ function mapPane(row: any): PaneData {
513
+ return { ...row, isPopout: !!row.isPopout, isCollaborating: !!row.isCollaborating };
514
+ }
515
+
516
+ function normalizePane(row: any): PaneData {
517
+ return mapPane(row);
518
+ }
519
+
520
+ export function getPanesByWorkspace(workspaceId: number): PaneData[] {
521
+ const db = getDb();
522
+ const rows = db.prepare(`SELECT ${PANE_SELECT} FROM panes WHERE workspace_id = ? ORDER BY sort_order, created`).all(workspaceId);
523
+ return rows.map(normalizePane) as PaneData[];
524
+ }
525
+
526
+ export function getAllPanes(): PaneData[] {
527
+ const db = getDb();
528
+ const rows = db.prepare(`SELECT ${PANE_SELECT} FROM panes ORDER BY sort_order, created`).all();
529
+ return rows.map(normalizePane) as PaneData[];
530
+ }
531
+
532
+ export function getActivePanes(): PaneData[] {
533
+ const db = getDb();
534
+ const activeWs = db.prepare('SELECT id FROM workspaces WHERE is_active = 1').get() as { id: number } | undefined;
535
+ if (!activeWs) return [];
536
+ return getPanesByWorkspace(activeWs.id);
537
+ }
538
+
539
+ export function createPane(pane: {
540
+ id: string;
541
+ title: string;
542
+ color: string;
543
+ cwd: string;
544
+ claudeSessionId?: string;
545
+ agentType?: string;
546
+ customCommand?: string;
547
+ sortOrder?: number;
548
+ workspaceId?: number;
549
+ nodeId?: string;
550
+ isCollaborating?: boolean;
551
+ customModelId?: string | null;
552
+ }): PaneData {
553
+ const db = getDb();
554
+ const maxOrder = db.prepare('SELECT MAX(sort_order) as m FROM panes').get() as { m: number | null };
555
+ const order = pane.sortOrder ?? ((maxOrder.m ?? -1) + 1);
556
+
557
+ // Default to active workspace if not specified
558
+ let wsId = pane.workspaceId;
559
+ if (wsId === undefined) {
560
+ const activeWs = db.prepare('SELECT id FROM workspaces WHERE is_active = 1').get() as { id: number } | undefined;
561
+ wsId = activeWs?.id;
562
+ }
563
+
564
+ // Capture git HEAD as diff baseline if cwd is a git repo
565
+ let baselineSha: string | null = null;
566
+ try {
567
+ const { execFileSync } = require('child_process');
568
+ baselineSha = execFileSync('git', ['rev-parse', 'HEAD'], { cwd: pane.cwd, encoding: 'utf-8', timeout: 3000 }).trim();
569
+ } catch { /* not a git repo or git not available */ }
570
+
571
+ const sessId = (pane.claudeSessionId && pane.claudeSessionId !== 'new') ? pane.claudeSessionId : null;
572
+
573
+ db.prepare(`
574
+ INSERT INTO panes (id, title, color, cwd, claude_session_id, agent_type, custom_command, sort_order, workspace_id, node_id, is_collaborating, diff_baseline_sha, custom_model_id)
575
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
576
+ `).run(pane.id, pane.title, pane.color, pane.cwd, sessId, pane.agentType || 'shell', pane.customCommand || null, order, wsId || null, pane.nodeId || null, pane.isCollaborating ? 1 : 0, baselineSha, pane.customModelId || null);
577
+
578
+ return getPaneById(pane.id)!;
579
+ }
580
+
581
+ export function getPaneById(id: string): PaneData | null {
582
+ const db = getDb();
583
+ const row = db.prepare(`SELECT ${PANE_SELECT} FROM panes WHERE id = ?`).get(id) as any | null;
584
+ return row ? normalizePane(row) : null;
585
+ }
586
+
587
+ export function updatePane(id: string, data: {
588
+ title?: string;
589
+ color?: string;
590
+ cwd?: string;
591
+ claudeSessionId?: string | null;
592
+ agentType?: string;
593
+ customCommand?: string | null;
594
+ gridCol?: number;
595
+ gridRow?: number;
596
+ sortOrder?: number;
597
+ workspaceId?: number | null;
598
+ isPopout?: boolean;
599
+ winX?: number | null;
600
+ winY?: number | null;
601
+ winWidth?: number | null;
602
+ winHeight?: number | null;
603
+ isCollaborating?: boolean;
604
+ diffBaselineSha?: string | null;
605
+ customModelId?: string | null;
606
+ }) {
607
+ const db = getDb();
608
+ const sets: string[] = [];
609
+ const vals: any[] = [];
610
+
611
+ if (data.title !== undefined) { sets.push('title = ?'); vals.push(data.title); }
612
+ if (data.color !== undefined) { sets.push('color = ?'); vals.push(data.color); }
613
+ if (data.cwd !== undefined) { sets.push('cwd = ?'); vals.push(data.cwd); }
614
+ if (data.claudeSessionId !== undefined) { sets.push('claude_session_id = ?'); vals.push(data.claudeSessionId); }
615
+ if (data.agentType !== undefined) { sets.push('agent_type = ?'); vals.push(data.agentType); }
616
+ if (data.customCommand !== undefined) { sets.push('custom_command = ?'); vals.push(data.customCommand); }
617
+ if (data.gridCol !== undefined) { sets.push('grid_col = ?'); vals.push(data.gridCol); }
618
+ if (data.gridRow !== undefined) { sets.push('grid_row = ?'); vals.push(data.gridRow); }
619
+ if (data.sortOrder !== undefined) { sets.push('sort_order = ?'); vals.push(data.sortOrder); }
620
+ if (data.workspaceId !== undefined) { sets.push('workspace_id = ?'); vals.push(data.workspaceId); }
621
+ if (data.isPopout !== undefined) { sets.push('is_popout = ?'); vals.push(data.isPopout ? 1 : 0); }
622
+ if (data.winX !== undefined) { sets.push('win_x = ?'); vals.push(data.winX); }
623
+ if (data.winY !== undefined) { sets.push('win_y = ?'); vals.push(data.winY); }
624
+ if (data.winWidth !== undefined) { sets.push('win_width = ?'); vals.push(data.winWidth); }
625
+ if (data.winHeight !== undefined) { sets.push('win_height = ?'); vals.push(data.winHeight); }
626
+ if ((data as any).nodeId !== undefined) { sets.push('node_id = ?'); vals.push((data as any).nodeId); }
627
+ if (data.isCollaborating !== undefined) { sets.push('is_collaborating = ?'); vals.push(data.isCollaborating ? 1 : 0); }
628
+ if (data.diffBaselineSha !== undefined) { sets.push('diff_baseline_sha = ?'); vals.push(data.diffBaselineSha); }
629
+ if (data.customModelId !== undefined) { sets.push('custom_model_id = ?'); vals.push(data.customModelId); }
630
+
631
+ if (sets.length === 0) return;
632
+ vals.push(id);
633
+ db.prepare(`UPDATE panes SET ${sets.join(', ')} WHERE id = ?`).run(...vals);
634
+ }
635
+
636
+ export function deletePane(id: string) {
637
+ const db = getDb();
638
+ db.prepare('DELETE FROM panes WHERE id = ?').run(id);
639
+ }
640
+
641
+ export function deletePanesByNodeId(nodeId: string) {
642
+ const db = getDb();
643
+ db.prepare('DELETE FROM panes WHERE node_id = ?').run(nodeId);
644
+ }
645
+
646
+ // ─── Workspace-as-Layout Operations ────────────────────────
647
+
648
+ export function getActiveWorkspace(): Workspace | null {
649
+ const db = getDb();
650
+ return db.prepare('SELECT id, name, description, color, created, is_active as isActive, collaboration FROM workspaces WHERE is_active = 1').get() as Workspace | null;
651
+ }
652
+
653
+ export function switchWorkspace(workspaceId: number) {
654
+ const db = getDb();
655
+ db.prepare('UPDATE workspaces SET is_active = 0').run();
656
+ db.prepare('UPDATE workspaces SET is_active = 1 WHERE id = ?').run(workspaceId);
657
+ }
658
+
659
+ export function duplicateWorkspace(sourceId: number, newName: string, newColor?: string): { workspace: Workspace; panes: PaneData[] } {
660
+ const db = getDb();
661
+
662
+ // Create the new workspace
663
+ const src = db.prepare('SELECT * FROM workspaces WHERE id = ?').get(sourceId) as any;
664
+ const result = db.prepare(
665
+ 'INSERT INTO workspaces (name, description, color, is_active) VALUES (?, ?, ?, 0)'
666
+ ).run(newName, src?.description || '', newColor || src?.color || '#6366f1');
667
+ const newWsId = Number(result.lastInsertRowid);
668
+
669
+ // Clone all panes from source workspace
670
+ const srcPanes = db.prepare('SELECT * FROM panes WHERE workspace_id = ?').all(sourceId) as any[];
671
+ const cloneStmt = db.prepare(`
672
+ INSERT INTO panes (id, title, color, cwd, claude_session_id, agent_type, custom_command, grid_col, grid_row, sort_order, shell, workspace_id, is_popout, win_x, win_y, win_width, win_height)
673
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
674
+ `);
675
+
676
+ const cloneMany = db.transaction(() => {
677
+ for (const p of srcPanes) {
678
+ const newId = crypto.randomUUID();
679
+ cloneStmt.run(
680
+ newId, p.title, p.color, p.cwd, p.claude_session_id, p.agent_type || 'shell', p.custom_command || null,
681
+ p.grid_col, p.grid_row, p.sort_order, p.shell,
682
+ newWsId, 0, p.win_x, p.win_y, p.win_width, p.win_height
683
+ );
684
+ }
685
+ });
686
+ cloneMany();
687
+
688
+ const ws: Workspace = { id: newWsId, name: newName, description: src?.description || '', color: newColor || src?.color || '#6366f1', created: new Date().toISOString() };
689
+ const panes = getPanesByWorkspace(newWsId);
690
+ return { workspace: ws, panes };
691
+ }
692
+
693
+ export function deleteWorkspaceFull(workspaceId: number) {
694
+ const db = getDb();
695
+ // Delete all panes belonging to this workspace
696
+ db.prepare('DELETE FROM panes WHERE workspace_id = ?').run(workspaceId);
697
+ db.prepare('DELETE FROM workspaces WHERE id = ?').run(workspaceId);
698
+
699
+ // If deleted the active workspace, activate another
700
+ const anyActive = db.prepare('SELECT id FROM workspaces WHERE is_active = 1').get();
701
+ if (!anyActive) {
702
+ const first = db.prepare('SELECT id FROM workspaces ORDER BY id LIMIT 1').get() as { id: number } | undefined;
703
+ if (first) {
704
+ db.prepare('UPDATE workspaces SET is_active = 1 WHERE id = ?').run(first.id);
705
+ }
706
+ }
707
+ }
708
+
709
+ // ─── Analytics ──────────────────────────────────────────────
710
+
711
+ export function getAnalyticsOverview() {
712
+ const db = getDb();
713
+ const totals = db.prepare(`
714
+ SELECT COUNT(*) as totalSessions, COALESCE(SUM(message_count), 0) as totalMessages
715
+ FROM sessions
716
+ `).get() as { totalSessions: number; totalMessages: number };
717
+
718
+ const projectCount = db.prepare('SELECT COUNT(*) as count FROM projects').get() as { count: number };
719
+
720
+ return {
721
+ totalSessions: totals.totalSessions,
722
+ totalMessages: totals.totalMessages,
723
+ totalProjects: projectCount.count,
724
+ };
725
+ }
726
+
727
+ export function getDailyActivity(days = 30): { date: string; sessionCount: number; messageCount: number; toolCallCount: number }[] {
728
+ const db = getDb();
729
+ return db.prepare(`
730
+ SELECT date(created) as date,
731
+ COUNT(*) as sessionCount,
732
+ COALESCE(SUM(message_count), 0) as messageCount,
733
+ 0 as toolCallCount
734
+ FROM sessions
735
+ WHERE created >= date('now', ?)
736
+ GROUP BY date(created)
737
+ ORDER BY date(created)
738
+ `).all(`-${days} days`) as any[];
739
+ }
740
+