@superblocksteam/vite-plugin-file-sync 2.0.129 → 2.0.130-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (356) hide show
  1. package/dist/ai-service/agent/middleware.d.ts.map +1 -1
  2. package/dist/ai-service/agent/middleware.js +51 -1
  3. package/dist/ai-service/agent/middleware.js.map +1 -1
  4. package/dist/ai-service/agent/prompts/build-base-system-prompt.d.ts.map +1 -1
  5. package/dist/ai-service/agent/prompts/build-base-system-prompt.js +44 -4
  6. package/dist/ai-service/agent/prompts/build-base-system-prompt.js.map +1 -1
  7. package/dist/ai-service/agent/subagents/coding/run-coding-subagent.d.ts.map +1 -1
  8. package/dist/ai-service/agent/subagents/coding/run-coding-subagent.js +25 -0
  9. package/dist/ai-service/agent/subagents/coding/run-coding-subagent.js.map +1 -1
  10. package/dist/ai-service/agent/tools/apis/build-api-artifact.d.ts.map +1 -1
  11. package/dist/ai-service/agent/tools/apis/build-api-artifact.js +4 -3
  12. package/dist/ai-service/agent/tools/apis/build-api-artifact.js.map +1 -1
  13. package/dist/ai-service/agent/tools/apis/test-api.d.ts.map +1 -1
  14. package/dist/ai-service/agent/tools/apis/test-api.js +22 -0
  15. package/dist/ai-service/agent/tools/apis/test-api.js.map +1 -1
  16. package/dist/ai-service/agent/tools/build-capture-screenshot.d.ts +25 -0
  17. package/dist/ai-service/agent/tools/build-capture-screenshot.d.ts.map +1 -1
  18. package/dist/ai-service/agent/tools/build-capture-screenshot.js +117 -11
  19. package/dist/ai-service/agent/tools/build-capture-screenshot.js.map +1 -1
  20. package/dist/ai-service/agent/tools/build-manage-checklist.d.ts.map +1 -1
  21. package/dist/ai-service/agent/tools/build-manage-checklist.js +22 -0
  22. package/dist/ai-service/agent/tools/build-manage-checklist.js.map +1 -1
  23. package/dist/ai-service/agent/tools/databases/dev-database-tasks.d.ts +291 -0
  24. package/dist/ai-service/agent/tools/databases/dev-database-tasks.d.ts.map +1 -0
  25. package/dist/ai-service/agent/tools/databases/dev-database-tasks.js +386 -0
  26. package/dist/ai-service/agent/tools/databases/dev-database-tasks.js.map +1 -0
  27. package/dist/ai-service/agent/tools/databases/dev-database-tools.d.ts +17 -0
  28. package/dist/ai-service/agent/tools/databases/dev-database-tools.d.ts.map +1 -0
  29. package/dist/ai-service/agent/tools/databases/dev-database-tools.js +19 -0
  30. package/dist/ai-service/agent/tools/databases/dev-database-tools.js.map +1 -0
  31. package/dist/ai-service/agent/tools/index.d.ts +0 -1
  32. package/dist/ai-service/agent/tools/index.d.ts.map +1 -1
  33. package/dist/ai-service/agent/tools/index.js +0 -1
  34. package/dist/ai-service/agent/tools/index.js.map +1 -1
  35. package/dist/ai-service/agent/tools/integrations/execute-request.d.ts +1 -1
  36. package/dist/ai-service/agent/tools/integrations/execute-request.d.ts.map +1 -1
  37. package/dist/ai-service/agent/tools/integrations/execute-request.js +20 -9
  38. package/dist/ai-service/agent/tools/integrations/execute-request.js.map +1 -1
  39. package/dist/ai-service/agent/tools/integrations/internal.d.ts +5 -1
  40. package/dist/ai-service/agent/tools/integrations/internal.d.ts.map +1 -1
  41. package/dist/ai-service/agent/tools/integrations/internal.js +2 -1
  42. package/dist/ai-service/agent/tools/integrations/internal.js.map +1 -1
  43. package/dist/ai-service/agent/tools/screenshot-selector.d.ts +22 -0
  44. package/dist/ai-service/agent/tools/screenshot-selector.d.ts.map +1 -0
  45. package/dist/ai-service/agent/tools/screenshot-selector.js +158 -0
  46. package/dist/ai-service/agent/tools/screenshot-selector.js.map +1 -0
  47. package/dist/ai-service/agent/tools.d.ts +17 -0
  48. package/dist/ai-service/agent/tools.d.ts.map +1 -1
  49. package/dist/ai-service/agent/tools.js +65 -6
  50. package/dist/ai-service/agent/tools.js.map +1 -1
  51. package/dist/ai-service/agent/tools2/access-control.d.ts.map +1 -1
  52. package/dist/ai-service/agent/tools2/access-control.js +6 -1
  53. package/dist/ai-service/agent/tools2/access-control.js.map +1 -1
  54. package/dist/ai-service/agent/tools2/tools/cancel-task.d.ts +20 -0
  55. package/dist/ai-service/agent/tools2/tools/cancel-task.d.ts.map +1 -0
  56. package/dist/ai-service/agent/tools2/tools/cancel-task.js +39 -0
  57. package/dist/ai-service/agent/tools2/tools/cancel-task.js.map +1 -0
  58. package/dist/ai-service/agent/tools2/tools/check-task.d.ts +37 -0
  59. package/dist/ai-service/agent/tools2/tools/check-task.d.ts.map +1 -0
  60. package/dist/ai-service/agent/tools2/tools/check-task.js +53 -0
  61. package/dist/ai-service/agent/tools2/tools/check-task.js.map +1 -0
  62. package/dist/ai-service/agent/tools2/tools/exit-plan-mode.d.ts.map +1 -1
  63. package/dist/ai-service/agent/tools2/tools/exit-plan-mode.js +10 -0
  64. package/dist/ai-service/agent/tools2/tools/exit-plan-mode.js.map +1 -1
  65. package/dist/ai-service/agent/tools2/tools/git.d.ts +1 -1
  66. package/dist/ai-service/agent/tools2/tools/git.js +1 -1
  67. package/dist/ai-service/agent/tools2/tools/git.js.map +1 -1
  68. package/dist/ai-service/agent/tools2/tools/grep.d.ts +6 -1
  69. package/dist/ai-service/agent/tools2/tools/grep.d.ts.map +1 -1
  70. package/dist/ai-service/agent/tools2/tools/grep.js +37 -13
  71. package/dist/ai-service/agent/tools2/tools/grep.js.map +1 -1
  72. package/dist/ai-service/agent/tools2/tools/index.d.ts +4 -0
  73. package/dist/ai-service/agent/tools2/tools/index.d.ts.map +1 -1
  74. package/dist/ai-service/agent/tools2/tools/index.js +8 -0
  75. package/dist/ai-service/agent/tools2/tools/index.js.map +1 -1
  76. package/dist/ai-service/agent/tools2/tools/list-tasks.d.ts +21 -0
  77. package/dist/ai-service/agent/tools2/tools/list-tasks.d.ts.map +1 -0
  78. package/dist/ai-service/agent/tools2/tools/list-tasks.js +35 -0
  79. package/dist/ai-service/agent/tools2/tools/list-tasks.js.map +1 -0
  80. package/dist/ai-service/agent/tools2/tools/wait-for-task.d.ts +46 -0
  81. package/dist/ai-service/agent/tools2/tools/wait-for-task.d.ts.map +1 -0
  82. package/dist/ai-service/agent/tools2/tools/wait-for-task.js +83 -0
  83. package/dist/ai-service/agent/tools2/tools/wait-for-task.js.map +1 -0
  84. package/dist/ai-service/agent/tools2/types.d.ts +3 -0
  85. package/dist/ai-service/agent/tools2/types.d.ts.map +1 -1
  86. package/dist/ai-service/agent/tools2/types.js.map +1 -1
  87. package/dist/ai-service/agent/utils.d.ts.map +1 -1
  88. package/dist/ai-service/agent/utils.js +37 -2
  89. package/dist/ai-service/agent/utils.js.map +1 -1
  90. package/dist/ai-service/app-interface/npm-package-lookup.d.ts +22 -0
  91. package/dist/ai-service/app-interface/npm-package-lookup.d.ts.map +1 -1
  92. package/dist/ai-service/app-interface/npm-package-lookup.js +88 -1
  93. package/dist/ai-service/app-interface/npm-package-lookup.js.map +1 -1
  94. package/dist/ai-service/app-interface/npm-registry.d.ts +7 -0
  95. package/dist/ai-service/app-interface/npm-registry.d.ts.map +1 -1
  96. package/dist/ai-service/app-interface/npm-registry.js +74 -4
  97. package/dist/ai-service/app-interface/npm-registry.js.map +1 -1
  98. package/dist/ai-service/app-interface/shell.d.ts +32 -1
  99. package/dist/ai-service/app-interface/shell.d.ts.map +1 -1
  100. package/dist/ai-service/app-interface/shell.js +86 -3
  101. package/dist/ai-service/app-interface/shell.js.map +1 -1
  102. package/dist/ai-service/app-skills/manager.d.ts +4 -1
  103. package/dist/ai-service/app-skills/manager.d.ts.map +1 -1
  104. package/dist/ai-service/app-skills/manager.js +16 -1
  105. package/dist/ai-service/app-skills/manager.js.map +1 -1
  106. package/dist/ai-service/chat/chat-session-store.d.ts +10 -0
  107. package/dist/ai-service/chat/chat-session-store.d.ts.map +1 -1
  108. package/dist/ai-service/chat/chat-session-store.js +55 -28
  109. package/dist/ai-service/chat/chat-session-store.js.map +1 -1
  110. package/dist/ai-service/context-download.d.ts.map +1 -1
  111. package/dist/ai-service/context-download.js +50 -40
  112. package/dist/ai-service/context-download.js.map +1 -1
  113. package/dist/ai-service/dev-database-client.d.ts +27 -4
  114. package/dist/ai-service/dev-database-client.d.ts.map +1 -1
  115. package/dist/ai-service/dev-database-client.js +35 -1
  116. package/dist/ai-service/dev-database-client.js.map +1 -1
  117. package/dist/ai-service/dev-database-file-sync.d.ts +41 -0
  118. package/dist/ai-service/dev-database-file-sync.d.ts.map +1 -0
  119. package/dist/ai-service/dev-database-file-sync.js +29 -0
  120. package/dist/ai-service/dev-database-file-sync.js.map +1 -0
  121. package/dist/ai-service/features.d.ts +14 -0
  122. package/dist/ai-service/features.d.ts.map +1 -1
  123. package/dist/ai-service/features.js +14 -0
  124. package/dist/ai-service/features.js.map +1 -1
  125. package/dist/ai-service/index.d.ts +136 -5
  126. package/dist/ai-service/index.d.ts.map +1 -1
  127. package/dist/ai-service/index.js +748 -99
  128. package/dist/ai-service/index.js.map +1 -1
  129. package/dist/ai-service/integrations/store.d.ts +2 -0
  130. package/dist/ai-service/integrations/store.d.ts.map +1 -1
  131. package/dist/ai-service/integrations/store.js +4 -0
  132. package/dist/ai-service/integrations/store.js.map +1 -1
  133. package/dist/ai-service/knowledge/knowledge-manager.d.ts +8 -10
  134. package/dist/ai-service/knowledge/knowledge-manager.d.ts.map +1 -1
  135. package/dist/ai-service/knowledge/knowledge-manager.js +135 -119
  136. package/dist/ai-service/knowledge/knowledge-manager.js.map +1 -1
  137. package/dist/ai-service/llm/chaos-fetch.d.ts.map +1 -1
  138. package/dist/ai-service/llm/chaos-fetch.js +7 -3
  139. package/dist/ai-service/llm/chaos-fetch.js.map +1 -1
  140. package/dist/ai-service/llm/client.d.ts.map +1 -1
  141. package/dist/ai-service/llm/client.js +23 -7
  142. package/dist/ai-service/llm/client.js.map +1 -1
  143. package/dist/ai-service/llm/context-v2/adapter.d.ts +3 -0
  144. package/dist/ai-service/llm/context-v2/adapter.d.ts.map +1 -1
  145. package/dist/ai-service/llm/context-v2/adapter.js +9 -0
  146. package/dist/ai-service/llm/context-v2/adapter.js.map +1 -1
  147. package/dist/ai-service/llm/context-v2/compaction/server-side.d.ts +2 -0
  148. package/dist/ai-service/llm/context-v2/compaction/server-side.d.ts.map +1 -1
  149. package/dist/ai-service/llm/context-v2/compaction/server-side.js +6 -2
  150. package/dist/ai-service/llm/context-v2/compaction/server-side.js.map +1 -1
  151. package/dist/ai-service/llm/context-v2/context-management.d.ts +3 -9
  152. package/dist/ai-service/llm/context-v2/context-management.d.ts.map +1 -1
  153. package/dist/ai-service/llm/context-v2/context-management.js +3 -9
  154. package/dist/ai-service/llm/context-v2/context-management.js.map +1 -1
  155. package/dist/ai-service/llm/context-v2/context-metrics.d.ts +23 -0
  156. package/dist/ai-service/llm/context-v2/context-metrics.d.ts.map +1 -0
  157. package/dist/ai-service/llm/context-v2/context-metrics.js +144 -0
  158. package/dist/ai-service/llm/context-v2/context-metrics.js.map +1 -0
  159. package/dist/ai-service/llm/context-v2/context.d.ts +16 -1
  160. package/dist/ai-service/llm/context-v2/context.d.ts.map +1 -1
  161. package/dist/ai-service/llm/context-v2/context.js +138 -26
  162. package/dist/ai-service/llm/context-v2/context.js.map +1 -1
  163. package/dist/ai-service/llm/context-v2/conversation-context.d.ts +26 -1
  164. package/dist/ai-service/llm/context-v2/conversation-context.d.ts.map +1 -1
  165. package/dist/ai-service/llm/context-v2/manager.d.ts +15 -1
  166. package/dist/ai-service/llm/context-v2/manager.d.ts.map +1 -1
  167. package/dist/ai-service/llm/context-v2/manager.js +97 -40
  168. package/dist/ai-service/llm/context-v2/manager.js.map +1 -1
  169. package/dist/ai-service/llm/context-v2/storage/local.d.ts.map +1 -1
  170. package/dist/ai-service/llm/context-v2/storage/local.js +3 -0
  171. package/dist/ai-service/llm/context-v2/storage/local.js.map +1 -1
  172. package/dist/ai-service/llm/context-v2/types.d.ts +27 -0
  173. package/dist/ai-service/llm/context-v2/types.d.ts.map +1 -1
  174. package/dist/ai-service/llm/context-v2/types.js +108 -23
  175. package/dist/ai-service/llm/context-v2/types.js.map +1 -1
  176. package/dist/ai-service/llm/error.d.ts +21 -0
  177. package/dist/ai-service/llm/error.d.ts.map +1 -1
  178. package/dist/ai-service/llm/error.js +72 -12
  179. package/dist/ai-service/llm/error.js.map +1 -1
  180. package/dist/ai-service/llm/stream/compaction-text-block.d.ts +14 -0
  181. package/dist/ai-service/llm/stream/compaction-text-block.d.ts.map +1 -0
  182. package/dist/ai-service/llm/stream/compaction-text-block.js +29 -0
  183. package/dist/ai-service/llm/stream/compaction-text-block.js.map +1 -0
  184. package/dist/ai-service/llm/stream/idle-monitor.d.ts.map +1 -1
  185. package/dist/ai-service/llm/stream/idle-monitor.js +12 -28
  186. package/dist/ai-service/llm/stream/idle-monitor.js.map +1 -1
  187. package/dist/ai-service/llm/stream/managed-stream.d.ts.map +1 -1
  188. package/dist/ai-service/llm/stream/managed-stream.js +22 -0
  189. package/dist/ai-service/llm/stream/managed-stream.js.map +1 -1
  190. package/dist/ai-service/llm/stream/observers/context.d.ts +4 -0
  191. package/dist/ai-service/llm/stream/observers/context.d.ts.map +1 -1
  192. package/dist/ai-service/llm/stream/observers/context.js +57 -5
  193. package/dist/ai-service/llm/stream/observers/context.js.map +1 -1
  194. package/dist/ai-service/policy-gate-step.d.ts +17 -0
  195. package/dist/ai-service/policy-gate-step.d.ts.map +1 -0
  196. package/dist/ai-service/policy-gate-step.js +52 -0
  197. package/dist/ai-service/policy-gate-step.js.map +1 -0
  198. package/dist/ai-service/quota-client.d.ts +28 -0
  199. package/dist/ai-service/quota-client.d.ts.map +1 -0
  200. package/dist/ai-service/quota-client.js +68 -0
  201. package/dist/ai-service/quota-client.js.map +1 -0
  202. package/dist/ai-service/security/index.d.ts +1 -1
  203. package/dist/ai-service/security/index.d.ts.map +1 -1
  204. package/dist/ai-service/security/index.js +1 -1
  205. package/dist/ai-service/security/index.js.map +1 -1
  206. package/dist/ai-service/security/safety-classifier.d.ts +9 -26
  207. package/dist/ai-service/security/safety-classifier.d.ts.map +1 -1
  208. package/dist/ai-service/security/safety-classifier.js +29 -44
  209. package/dist/ai-service/security/safety-classifier.js.map +1 -1
  210. package/dist/ai-service/skills/system/_registry.generated.d.ts.map +1 -1
  211. package/dist/ai-service/skills/system/_registry.generated.js +2 -0
  212. package/dist/ai-service/skills/system/_registry.generated.js.map +1 -1
  213. package/dist/ai-service/skills/system/common-import-issues/skill.generated.d.ts +2 -0
  214. package/dist/ai-service/skills/system/common-import-issues/skill.generated.d.ts.map +1 -0
  215. package/dist/ai-service/skills/system/common-import-issues/skill.generated.js +93 -0
  216. package/dist/ai-service/skills/system/common-import-issues/skill.generated.js.map +1 -0
  217. package/dist/ai-service/skills/system/superblocks-frontend/skill.generated.d.ts +1 -1
  218. package/dist/ai-service/skills/system/superblocks-frontend/skill.generated.d.ts.map +1 -1
  219. package/dist/ai-service/skills/system/superblocks-frontend/skill.generated.js +15 -0
  220. package/dist/ai-service/skills/system/superblocks-frontend/skill.generated.js.map +1 -1
  221. package/dist/ai-service/skills/system/superblocks-migration/skill.generated.d.ts +1 -1
  222. package/dist/ai-service/skills/system/superblocks-migration/skill.generated.d.ts.map +1 -1
  223. package/dist/ai-service/skills/system/superblocks-migration/skill.generated.js +7 -2
  224. package/dist/ai-service/skills/system/superblocks-migration/skill.generated.js.map +1 -1
  225. package/dist/ai-service/state-machine/clark-fsm.d.ts +74 -1
  226. package/dist/ai-service/state-machine/clark-fsm.d.ts.map +1 -1
  227. package/dist/ai-service/state-machine/clark-fsm.js +26 -7
  228. package/dist/ai-service/state-machine/clark-fsm.js.map +1 -1
  229. package/dist/ai-service/state-machine/handlers/agent-planning.d.ts.map +1 -1
  230. package/dist/ai-service/state-machine/handlers/agent-planning.js +223 -9
  231. package/dist/ai-service/state-machine/handlers/agent-planning.js.map +1 -1
  232. package/dist/ai-service/state-machine/handlers/idle.d.ts.map +1 -1
  233. package/dist/ai-service/state-machine/handlers/idle.js +42 -6
  234. package/dist/ai-service/state-machine/handlers/idle.js.map +1 -1
  235. package/dist/ai-service/state-machine/handlers/llm-generating.d.ts.map +1 -1
  236. package/dist/ai-service/state-machine/handlers/llm-generating.js +16 -6
  237. package/dist/ai-service/state-machine/handlers/llm-generating.js.map +1 -1
  238. package/dist/ai-service/state-machine/helpers/peer.d.ts.map +1 -1
  239. package/dist/ai-service/state-machine/helpers/peer.js +9 -1
  240. package/dist/ai-service/state-machine/helpers/peer.js.map +1 -1
  241. package/dist/ai-service/tasks/access.d.ts +23 -0
  242. package/dist/ai-service/tasks/access.d.ts.map +1 -0
  243. package/dist/ai-service/tasks/access.js +26 -0
  244. package/dist/ai-service/tasks/access.js.map +1 -0
  245. package/dist/ai-service/tasks/factory.d.ts +92 -0
  246. package/dist/ai-service/tasks/factory.d.ts.map +1 -0
  247. package/dist/ai-service/tasks/factory.js +54 -0
  248. package/dist/ai-service/tasks/factory.js.map +1 -0
  249. package/dist/ai-service/tasks/index.d.ts +8 -0
  250. package/dist/ai-service/tasks/index.d.ts.map +1 -0
  251. package/dist/ai-service/tasks/index.js +7 -0
  252. package/dist/ai-service/tasks/index.js.map +1 -0
  253. package/dist/ai-service/tasks/peer-push.d.ts +78 -0
  254. package/dist/ai-service/tasks/peer-push.d.ts.map +1 -0
  255. package/dist/ai-service/tasks/peer-push.js +74 -0
  256. package/dist/ai-service/tasks/peer-push.js.map +1 -0
  257. package/dist/ai-service/tasks/poll-loop.d.ts +55 -0
  258. package/dist/ai-service/tasks/poll-loop.d.ts.map +1 -0
  259. package/dist/ai-service/tasks/poll-loop.js +73 -0
  260. package/dist/ai-service/tasks/poll-loop.js.map +1 -0
  261. package/dist/ai-service/tasks/task-store.d.ts +106 -0
  262. package/dist/ai-service/tasks/task-store.d.ts.map +1 -0
  263. package/dist/ai-service/tasks/task-store.js +292 -0
  264. package/dist/ai-service/tasks/task-store.js.map +1 -0
  265. package/dist/ai-service/tasks/test-utils.d.ts +23 -0
  266. package/dist/ai-service/tasks/test-utils.d.ts.map +1 -0
  267. package/dist/ai-service/tasks/test-utils.js +53 -0
  268. package/dist/ai-service/tasks/test-utils.js.map +1 -0
  269. package/dist/ai-service/tasks/types.d.ts +205 -0
  270. package/dist/ai-service/tasks/types.d.ts.map +1 -0
  271. package/dist/ai-service/tasks/types.js +24 -0
  272. package/dist/ai-service/tasks/types.js.map +1 -0
  273. package/dist/ai-service/template-renderer.d.ts.map +1 -1
  274. package/dist/ai-service/template-renderer.js +1 -0
  275. package/dist/ai-service/template-renderer.js.map +1 -1
  276. package/dist/ai-service/test-utils/metrics-harness.d.ts +32 -0
  277. package/dist/ai-service/test-utils/metrics-harness.d.ts.map +1 -0
  278. package/dist/ai-service/test-utils/metrics-harness.js +67 -0
  279. package/dist/ai-service/test-utils/metrics-harness.js.map +1 -0
  280. package/dist/ai-service/test-utils/tracer-harness.d.ts +8 -0
  281. package/dist/ai-service/test-utils/tracer-harness.d.ts.map +1 -0
  282. package/dist/ai-service/test-utils/tracer-harness.js +26 -0
  283. package/dist/ai-service/test-utils/tracer-harness.js.map +1 -0
  284. package/dist/ai-service/transform/lucide-dynamic-type-imports/transformer.d.ts +40 -0
  285. package/dist/ai-service/transform/lucide-dynamic-type-imports/transformer.d.ts.map +1 -0
  286. package/dist/ai-service/transform/lucide-dynamic-type-imports/transformer.js +118 -0
  287. package/dist/ai-service/transform/lucide-dynamic-type-imports/transformer.js.map +1 -0
  288. package/dist/ai-service/util/llm-config-utils.d.ts +2 -6
  289. package/dist/ai-service/util/llm-config-utils.d.ts.map +1 -1
  290. package/dist/ai-service/util/llm-config-utils.js +2 -7
  291. package/dist/ai-service/util/llm-config-utils.js.map +1 -1
  292. package/dist/ai-service/util/rpc-timeout.d.ts +17 -7
  293. package/dist/ai-service/util/rpc-timeout.d.ts.map +1 -1
  294. package/dist/ai-service/util/rpc-timeout.js +17 -7
  295. package/dist/ai-service/util/rpc-timeout.js.map +1 -1
  296. package/dist/file-sync-vite-plugin.d.ts.map +1 -1
  297. package/dist/file-sync-vite-plugin.js +76 -6
  298. package/dist/file-sync-vite-plugin.js.map +1 -1
  299. package/dist/inject-index-vite-plugin.d.ts.map +1 -1
  300. package/dist/inject-index-vite-plugin.js +4 -0
  301. package/dist/inject-index-vite-plugin.js.map +1 -1
  302. package/dist/migration/migration-routes.d.ts +14 -0
  303. package/dist/migration/migration-routes.d.ts.map +1 -1
  304. package/dist/migration/migration-routes.js +284 -5
  305. package/dist/migration/migration-routes.js.map +1 -1
  306. package/dist/migration/migration-session-reconcile.d.ts +23 -0
  307. package/dist/migration/migration-session-reconcile.d.ts.map +1 -0
  308. package/dist/migration/migration-session-reconcile.js +129 -0
  309. package/dist/migration/migration-session-reconcile.js.map +1 -0
  310. package/dist/migration/restructure.d.ts.map +1 -1
  311. package/dist/migration/restructure.js +2 -0
  312. package/dist/migration/restructure.js.map +1 -1
  313. package/dist/migration-templates/app-fullstack/css.d.ts +3 -0
  314. package/dist/migration-templates/app-fullstack/package.json +2 -2
  315. package/dist/npm/normalize-workspace-protocol-for-npm.d.ts +15 -0
  316. package/dist/npm/normalize-workspace-protocol-for-npm.d.ts.map +1 -0
  317. package/dist/npm/normalize-workspace-protocol-for-npm.js +36 -0
  318. package/dist/npm/normalize-workspace-protocol-for-npm.js.map +1 -0
  319. package/dist/npm/prepare-package-json-for-cloud-npm.d.ts +21 -0
  320. package/dist/npm/prepare-package-json-for-cloud-npm.d.ts.map +1 -0
  321. package/dist/npm/prepare-package-json-for-cloud-npm.js +44 -0
  322. package/dist/npm/prepare-package-json-for-cloud-npm.js.map +1 -0
  323. package/dist/npm/rewrite-platform-workspace-deps.d.ts +17 -0
  324. package/dist/npm/rewrite-platform-workspace-deps.d.ts.map +1 -0
  325. package/dist/npm/rewrite-platform-workspace-deps.js +37 -0
  326. package/dist/npm/rewrite-platform-workspace-deps.js.map +1 -0
  327. package/dist/plugin-options.d.ts +8 -0
  328. package/dist/plugin-options.d.ts.map +1 -1
  329. package/dist/plugin-options.js.map +1 -1
  330. package/dist/policy-gate-run-registry.d.ts +28 -0
  331. package/dist/policy-gate-run-registry.d.ts.map +1 -0
  332. package/dist/policy-gate-run-registry.js +40 -0
  333. package/dist/policy-gate-run-registry.js.map +1 -0
  334. package/dist/policy-gate-runner.d.ts +2 -0
  335. package/dist/policy-gate-runner.d.ts.map +1 -1
  336. package/dist/policy-gate-runner.js +14 -1
  337. package/dist/policy-gate-runner.js.map +1 -1
  338. package/dist/socket-manager.d.ts.map +1 -1
  339. package/dist/socket-manager.js +55 -0
  340. package/dist/socket-manager.js.map +1 -1
  341. package/dist/sync-service/download.d.ts.map +1 -1
  342. package/dist/sync-service/download.js +6 -4
  343. package/dist/sync-service/download.js.map +1 -1
  344. package/dist/sync-service/draft-reconcile.d.ts +22 -0
  345. package/dist/sync-service/draft-reconcile.d.ts.map +1 -0
  346. package/dist/sync-service/draft-reconcile.js +24 -0
  347. package/dist/sync-service/draft-reconcile.js.map +1 -0
  348. package/dist/sync-service/index.d.ts +30 -5
  349. package/dist/sync-service/index.d.ts.map +1 -1
  350. package/dist/sync-service/index.js +59 -8
  351. package/dist/sync-service/index.js.map +1 -1
  352. package/package.json +10 -10
  353. package/dist/ai-service/agent/tools/databases/dev-database.d.ts +0 -103
  354. package/dist/ai-service/agent/tools/databases/dev-database.d.ts.map +0 -1
  355. package/dist/ai-service/agent/tools/databases/dev-database.js +0 -117
  356. package/dist/ai-service/agent/tools/databases/dev-database.js.map +0 -1
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Pre-call AI quota check (extracted from AiService for APPS-4708).
3
+ *
4
+ * One HTTP round-trip to the server per prompt, before generation starts.
5
+ * Fail-open by design: a missing JWT or a flaky quota endpoint must never
6
+ * block legitimate work, so every failure path returns `allowed: true`.
7
+ * The check runs inside a `quota.check` LLMObs span so the pre-LLM latency
8
+ * it adds is attributed in the trace.
9
+ */
10
+ import { type Logger } from "../util/logger.js";
11
+ import { LLMObsTracer } from "./llmobs/tracer.js";
12
+ export interface AiQuotaResult {
13
+ allowed: boolean;
14
+ reason?: string;
15
+ message?: string;
16
+ }
17
+ export interface CheckAiQuotaOptions {
18
+ superblocksBaseUrl: string;
19
+ /** Resolved auth token; the no-token case fails open without a request. */
20
+ jwt: string | undefined;
21
+ logger: Logger;
22
+ /** Injectable for tests; defaults to the global fetch. */
23
+ fetchFn?: typeof fetch;
24
+ /** Injectable for tests; defaults to the LLMObs singleton. */
25
+ tracer?: LLMObsTracer;
26
+ }
27
+ export declare function checkAiQuota(options: CheckAiQuotaOptions): Promise<AiQuotaResult>;
28
+ //# sourceMappingURL=quota-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quota-client.d.ts","sourceRoot":"","sources":["../../src/ai-service/quota-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAgB,KAAK,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,mBAAmB;IAClC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,2EAA2E;IAC3E,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,0DAA0D;IAC1D,OAAO,CAAC,EAAE,OAAO,KAAK,CAAC;IACvB,8DAA8D;IAC9D,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AAED,wBAAsB,YAAY,CAChC,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,aAAa,CAAC,CA2BxB"}
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Pre-call AI quota check (extracted from AiService for APPS-4708).
3
+ *
4
+ * One HTTP round-trip to the server per prompt, before generation starts.
5
+ * Fail-open by design: a missing JWT or a flaky quota endpoint must never
6
+ * block legitimate work, so every failure path returns `allowed: true`.
7
+ * The check runs inside a `quota.check` LLMObs span so the pre-LLM latency
8
+ * it adds is attributed in the trace.
9
+ */
10
+ import { getErrorMeta } from "../util/logger.js";
11
+ import { LLMObsTracer } from "./llmobs/tracer.js";
12
+ export async function checkAiQuota(options) {
13
+ const { superblocksBaseUrl, jwt, logger } = options;
14
+ const fetchFn = options.fetchFn ?? fetch;
15
+ const tracer = options.tracer ?? LLMObsTracer.instance;
16
+ if (!jwt) {
17
+ logger.warn("[ai-service] No JWT available for quota check, skipping");
18
+ return { allowed: true };
19
+ }
20
+ return tracer.trace({ kind: "task", name: "quota.check" }, async (span) => {
21
+ const startedAt = performance.now();
22
+ const result = await fetchQuota({
23
+ superblocksBaseUrl,
24
+ jwt,
25
+ logger,
26
+ fetchFn,
27
+ });
28
+ tracer.annotate(span, {
29
+ metadata: {
30
+ allowed: result.allowed,
31
+ durationMs: Math.round(performance.now() - startedAt),
32
+ ...(result.reason !== undefined ? { reason: result.reason } : {}),
33
+ },
34
+ });
35
+ return result;
36
+ });
37
+ }
38
+ async function fetchQuota({ superblocksBaseUrl, jwt, logger, fetchFn, }) {
39
+ try {
40
+ const url = `${superblocksBaseUrl}/api/v1/ai/quota`;
41
+ const response = await fetchFn(url, {
42
+ method: "GET",
43
+ headers: {
44
+ Authorization: `Bearer ${jwt}`,
45
+ "Content-Type": "application/json",
46
+ },
47
+ });
48
+ if (!response.ok) {
49
+ throw new Error(`Call to v1/ai/quota failed with status ${response.status}`);
50
+ }
51
+ const quota = (await response.json());
52
+ if (!quota.allowed) {
53
+ const reason = quota.reason ?? "token_limit_exceeded";
54
+ const message = reason === "trial_expired"
55
+ ? "Your AI trial period has ended."
56
+ : reason === "no_seat_assigned"
57
+ ? "You don't have an AI Builder license assigned. Ask your admin to assign a license."
58
+ : "Your organization has reached its AI usage limit.";
59
+ return { allowed: false, reason, message };
60
+ }
61
+ return { allowed: true };
62
+ }
63
+ catch (error) {
64
+ logger.warn("[ai-service] Quota check failed, allowing request", getErrorMeta(error));
65
+ return { allowed: true };
66
+ }
67
+ }
68
+ //# sourceMappingURL=quota-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quota-client.js","sourceRoot":"","sources":["../../src/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vailable, disposeSecretScanner, } from "./secret-scanner-service.js";
7
7
  export { formatSecretFindings, redactSecrets, SecretRedactor, type SecretFinding, type SecretScanOptions, type SecretScanResult, } from "./secret-scanner.js";
8
- export { classifyPromptSafety, createBlockedUserMessage, FAIL_OPEN_RESULT, FAIL_CLOSED_RESULT, type SafetyCategory, type SafetyClassificationResult, type SafetyClassificationOptions, type SafetyClassificationConfig, } from "./safety-classifier.js";
8
+ export { classifyPromptSafety, createBlockedUserMessage, FAIL_CLOSED_RESULT, FAIL_OPEN_RESULT, type SafetyCategory, type SafetyClassificationConfig, type SafetyClassificationOptions, type SafetyClassificationResult, } from "./safety-classifier.js";
9
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ai-service/security/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,oBAAoB,EACpB,aAAa,EACb,cAAc,EACd,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,GACtB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,cAAc,EACnB,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,EAChC,KAAK,0BAA0B,GAChC,MAAM,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ai-service/security/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,oBAAoB,EACpB,aAAa,EACb,cAAc,EACd,KAAK,aAAa,EAClB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,GACtB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,kBAAkB,EAClB,gBAAgB,EAChB,KAAK,cAAc,EACnB,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,EAChC,KAAK,0BAA0B,GAChC,MAAM,wBAAwB,CAAC"}
@@ -5,5 +5,5 @@
5
5
  */
6
6
  export { scanContentForSecrets, isTrufflehogAvailable, disposeSecretScanner, } from "./secret-scanner-service.js";
7
7
  export { formatSecretFindings, redactSecrets, SecretRedactor, } from "./secret-scanner.js";
8
- export { classifyPromptSafety, createBlockedUserMessage, FAIL_OPEN_RESULT, FAIL_CLOSED_RESULT, } from "./safety-classifier.js";
8
+ export { classifyPromptSafety, createBlockedUserMessage, FAIL_CLOSED_RESULT, FAIL_OPEN_RESULT, } from "./safety-classifier.js";
9
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ai-service/security/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,oBAAoB,EACpB,aAAa,EACb,cAAc,GAIf,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,gBAAgB,EAChB,kBAAkB,GAKnB,MAAM,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ai-service/security/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EACL,oBAAoB,EACpB,aAAa,EACb,cAAc,GAIf,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,kBAAkB,EAClB,gBAAgB,GAKjB,MAAM,wBAAwB,CAAC"}
@@ -1,27 +1,20 @@
1
1
  /**
2
- * Safety classification utilities.
2
+ * Safety classification utilities for Clark (the AI coding assistant).
3
3
  *
4
4
  * Provides functions for classifying user prompts as safe or unsafe
5
5
  * before they are processed by the main LLM model. Uses a fast LLM
6
6
  * model to perform binary classification with justification.
7
+ *
8
+ * Categories, result types, and default results are imported from
9
+ * `@superblocksteam/shared`. The system prompt is local because it
10
+ * is specific to Clark's conversational context.
7
11
  */
8
12
  import type { LanguageModelV3 } from "@ai-sdk/provider";
9
13
  import type { UserModelMessage } from "ai";
10
- /**
11
- * Categories of unsafe content that can be detected.
12
- */
13
- export type SafetyCategory = "harmful_instructions" | "illegal_activity" | "malicious_code" | "personal_data_extraction" | "prompt_injection" | "jailbreak_attempt" | "system_extraction" | "other";
14
- /**
15
- * Result of safety classification.
16
- */
17
- export interface SafetyClassificationResult {
18
- /** Whether the prompt is safe to process */
19
- safe: boolean;
20
- /** Brief justification for the classification */
21
- justification: string;
22
- /** Categories that triggered unsafe classification (only if unsafe) */
23
- categories?: SafetyCategory[];
24
- }
14
+ import { type SafetyCategory, type SafetyClassificationResult } from "@superblocksteam/shared";
15
+ export type { SafetyCategory, SafetyClassificationResult };
16
+ export declare const FAIL_OPEN_RESULT: SafetyClassificationResult;
17
+ export declare const FAIL_CLOSED_RESULT: SafetyClassificationResult;
25
18
  /**
26
19
  * Options for safety classification.
27
20
  */
@@ -48,16 +41,6 @@ export interface SafetyClassificationConfig {
48
41
  /** Which text parts to scan: "all" (default) or "last" (user prompt only) */
49
42
  scope?: "all" | "last";
50
43
  }
51
- /**
52
- * Default classification result for fail-open scenarios.
53
- * Returns safe=true to allow the request to proceed.
54
- */
55
- export declare const FAIL_OPEN_RESULT: SafetyClassificationResult;
56
- /**
57
- * Default classification result for fail-closed scenarios.
58
- * Returns safe=false to block the request.
59
- */
60
- export declare const FAIL_CLOSED_RESULT: SafetyClassificationResult;
61
44
  /**
62
45
  * Classifies a user prompt for safety.
63
46
  *
@@ -1 +1 @@
1
- {"version":3,"file":"safety-classifier.d.ts","sourceRoot":"","sources":["../../../src/ai-service/security/safety-classifier.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,IAAI,CAAC;AAM3C;;GAEG;AACH,MAAM,MAAM,cAAc,GACtB,sBAAsB,GACtB,kBAAkB,GAClB,gBAAgB,GAChB,0BAA0B,GAC1B,kBAAkB,GAClB,mBAAmB,GACnB,mBAAmB,GACnB,OAAO,CAAC;AAEZ;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,4CAA4C;IAC5C,IAAI,EAAE,OAAO,CAAC;IACd,iDAAiD;IACjD,aAAa,EAAE,MAAM,CAAC;IACtB,uEAAuE;IACvE,UAAU,CAAC,EAAE,cAAc,EAAE,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,0EAA0E;IAC1E,KAAK,EAAE,eAAe,CAAC;IACvB,8CAA8C;IAC9C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oCAAoC;IACpC,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,+CAA+C;IAC/C,OAAO,EAAE,OAAO,CAAC;IACjB,sCAAsC;IACtC,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,qDAAqD;IACrD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mGAAmG;IACnG,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,6EAA6E;IAC7E,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;CACxB;AAmFD;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,0BAI9B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,0BAKhC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,2BAA2B,GACnC,OAAO,CAAC,0BAA0B,CAAC,CA6CrC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,wBAAwB,CACtC,aAAa,EAAE,gBAAgB,EAC/B,cAAc,EAAE,0BAA0B,GACzC,gBAAgB,CAclB"}
1
+ {"version":3,"file":"safety-classifier.d.ts","sourceRoot":"","sources":["../../../src/ai-service/security/safety-classifier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,IAAI,CAAC;AAG3C,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,0BAA0B,EAChC,MAAM,yBAAyB,CAAC;AAKjC,YAAY,EAAE,cAAc,EAAE,0BAA0B,EAAE,CAAC;AAE3D,eAAO,MAAM,gBAAgB,EAAE,0BAI9B,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,0BAKhC,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,0EAA0E;IAC1E,KAAK,EAAE,eAAe,CAAC;IACvB,8CAA8C;IAC9C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oCAAoC;IACpC,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,+CAA+C;IAC/C,OAAO,EAAE,OAAO,CAAC;IACjB,sCAAsC;IACtC,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,qDAAqD;IACrD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mGAAmG;IACnG,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,6EAA6E;IAC7E,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;CACxB;AAqED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,2BAA2B,GACnC,OAAO,CAAC,0BAA0B,CAAC,CA6CrC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,wBAAwB,CACtC,aAAa,EAAE,gBAAgB,EAC/B,cAAc,EAAE,0BAA0B,GACzC,gBAAgB,CAclB"}
@@ -1,42 +1,28 @@
1
1
  /**
2
- * Safety classification utilities.
2
+ * Safety classification utilities for Clark (the AI coding assistant).
3
3
  *
4
4
  * Provides functions for classifying user prompts as safe or unsafe
5
5
  * before they are processed by the main LLM model. Uses a fast LLM
6
6
  * model to perform binary classification with justification.
7
+ *
8
+ * Categories, result types, and default results are imported from
9
+ * `@superblocksteam/shared`. The system prompt is local because it
10
+ * is specific to Clark's conversational context.
7
11
  */
8
12
  import { generateObject } from "ai";
9
13
  import { z } from "zod";
14
+ import { SAFETY_CATEGORIES, } from "@superblocksteam/shared";
10
15
  import { getLogger } from "../../util/logger.js";
11
16
  import llmobs from "../llmobs/index.js";
12
- /**
13
- * Zod schema for safety classification response.
14
- * Used with generateObject for structured output.
15
- */
16
- const SafetyClassificationSchema = z.object({
17
- safe: z
18
- .boolean()
19
- .describe("Whether the prompt is safe to process. True if safe, false if unsafe."),
20
- justification: z
21
- .string()
22
- .describe("Brief (1-2 sentence) justification for the classification decision."),
23
- categories: z
24
- .array(z.enum([
25
- "harmful_instructions",
26
- "illegal_activity",
27
- "malicious_code",
28
- "personal_data_extraction",
29
- "prompt_injection",
30
- "jailbreak_attempt",
31
- "system_extraction",
32
- "other",
33
- ]))
34
- .optional()
35
- .describe("Categories of unsafe content detected (only if unsafe)."),
36
- });
37
- /**
38
- * System prompt for safety classification.
39
- */
17
+ export const FAIL_OPEN_RESULT = {
18
+ safe: true,
19
+ justification: "Classification failed, allowing request to proceed (fail-open policy).",
20
+ };
21
+ export const FAIL_CLOSED_RESULT = {
22
+ safe: false,
23
+ justification: "Classification failed, blocking request (fail-closed policy).",
24
+ categories: ["other"],
25
+ };
40
26
  const SAFETY_CLASSIFICATION_SYSTEM_PROMPT = `You are a safety classifier for a low-code application builder AI assistant. Your task is to determine if a user's request is safe to process.
41
27
 
42
28
  ## Classification Criteria
@@ -83,22 +69,21 @@ A request is **SAFE** if it:
83
69
 
84
70
  Analyze the following user request and provide your classification.`;
85
71
  /**
86
- * Default classification result for fail-open scenarios.
87
- * Returns safe=true to allow the request to proceed.
88
- */
89
- export const FAIL_OPEN_RESULT = {
90
- safe: true,
91
- justification: "Classification failed, allowing request to proceed (fail-open policy).",
92
- };
93
- /**
94
- * Default classification result for fail-closed scenarios.
95
- * Returns safe=false to block the request.
72
+ * Zod schema for safety classification response.
73
+ * Derives its enum values from the shared SAFETY_CATEGORIES tuple.
96
74
  */
97
- export const FAIL_CLOSED_RESULT = {
98
- safe: false,
99
- justification: "Classification failed, blocking request (fail-closed policy).",
100
- categories: ["other"],
101
- };
75
+ const SafetyClassificationSchema = z.object({
76
+ safe: z
77
+ .boolean()
78
+ .describe("Whether the prompt is safe to process. True if safe, false if unsafe."),
79
+ justification: z
80
+ .string()
81
+ .describe("Brief (1-2 sentence) justification for the classification decision."),
82
+ categories: z
83
+ .array(z.enum(SAFETY_CATEGORIES))
84
+ .optional()
85
+ .describe("Categories of unsafe content detected (only if unsafe)."),
86
+ });
102
87
  /**
103
88
  * Classifies a user prompt for safety.
104
89
  *
@@ -1 +1 @@
1
- {"version":3,"file":"safety-classifier.js","sourceRoot":"","sources":["../../../src/ai-service/security/safety-classifier.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,IAAI,CAAC;AAEpC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,MAAM,MAAM,oBAAoB,CAAC;AAuDxC;;;GAGG;AACH,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC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IAAI,CAAC,GAAG;QACzD,CAAC,CAAC,EAAE,CAAC;IAET,MAAM,cAAc,GAClB,yEAAyE;QACzE,WAAW,cAAc,CAAC,aAAa,GAAG,WAAW,EAAE,CAAC;IAE1D,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,cAAc;KACxB,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"safety-classifier.js","sourceRoot":"","sources":["../../../src/ai-service/security/safety-classifier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,IAAI,CAAC;AAEpC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,iBAAiB,GAGlB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,MAAM,MAAM,oBAAoB,CAAC;AAIxC,MAAM,CAAC,MAAM,gBAAgB,GAA+B;IAC1D,IAAI,EAAE,IAAI;IACV,aAAa,EACX,wEAAwE;CAC3E,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAA+B;IAC5D,IAAI,EAAE,KAAK;IACX,aAAa,EACX,+DAA+D;IACjE,UAAU,EAAE,CAAC,OAAO,CAAC;CACtB,CAAC;AA8BF,MAAM,mCAAmC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oEA4CwB,CAAC;AAErE;;;GAGG;AACH,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,IAAI,EAAE,CAAC;SACJ,OAAO,EAAE;SACT,QAAQ,CACP,uEAAuE,CACxE;IACH,aAAa,EAAE,CAAC;SACb,MAAM,EAAE;SACR,QAAQ,CACP,qEAAqE,CACtE;IACH,UAAU,EAAE,CAAC;SACV,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;SAChC,QAAQ,EAAE;SACV,QAAQ,CAA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,CAAC,KAAK,CAAC,6CAA6C,EAAE;YAC1D,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,UAAU;SACX,CAAC,CAAC;QAEH,OAAO,MAAoC,CAAC;IAC9C,CAAC;YAAS,CAAC;QACT,YAAY,CAAC,SAAS,CAAC,CAAC;IAC1B,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,wBAAwB,CACtC,aAA+B,EAC/B,cAA0C;IAE1C,MAAM,WAAW,GACf,cAAc,CAAC,UAAU,IAAI,cAAc,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC;QAC/D,CAAC,CAAC,gBAAgB,cAAc,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG;QACzD,CAAC,CAAC,EAAE,CAAC;IAET,MAAM,cAAc,GAClB,yEAAyE;QACzE,WAAW,cAAc,CAAC,aAAa,GAAG,WAAW,EAAE,CAAC;IAE1D,OAAO;QACL,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,cAAc;KACxB,CAAC;AACJ,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"_registry.generated.d.ts","sourceRoot":"","sources":["../../../../src/ai-service/skills/system/_registry.generated.ts"],"names":[],"mappings":"AAmBA;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAgBhD,CAAC"}
1
+ {"version":3,"file":"_registry.generated.d.ts","sourceRoot":"","sources":["../../../../src/ai-service/skills/system/_registry.generated.ts"],"names":[],"mappings":"AAoBA;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAiBhD,CAAC"}
@@ -1,5 +1,6 @@
1
1
  // Auto-generated skills registry
2
2
  // Do not edit directly - run npm run generate-skills
3
+ import { content as common_import_issues_skill } from "./common-import-issues/skill.generated.js";
3
4
  import { content as superblocks_api_references_code_blocks } from "./superblocks-api/references/code-blocks.generated.js";
4
5
  import { content as superblocks_api_references_graphql } from "./superblocks-api/references/graphql.generated.js";
5
6
  import { content as superblocks_api_references_rest_apis } from "./superblocks-api/references/rest-apis.generated.js";
@@ -20,6 +21,7 @@ import { content as third_party_migration_v0 } from "./third-party-migration/v0.
20
21
  * Keys are relative paths from skills/system/ (e.g., "superblocks-frontend/SKILL.md")
21
22
  */
22
23
  export const SYSTEM_SKILLS = {
24
+ "common-import-issues/SKILL.md": common_import_issues_skill,
23
25
  "superblocks-api/SKILL.md": superblocks_api_skill,
24
26
  "superblocks-api/references/code-blocks.md": superblocks_api_references_code_blocks,
25
27
  "superblocks-api/references/graphql.md": superblocks_api_references_graphql,
@@ -1 +1 @@
1
- {"version":3,"file":"_registry.generated.js","sourceRoot":"","sources":["../../../../src/ai-service/skills/system/_registry.generated.ts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,qDAAqD;AAErD,OAAO,EAAE,OAAO,IAAI,sCAAsC,EAAE,MAAM,uDAAuD,CAAC;AAC1H,OAAO,EAAE,OAAO,IAAI,kCAAkC,EAAE,MAAM,mDAAmD,CAAC;AAClH,OAAO,EAAE,OAAO,IAAI,oCAAoC,EAAE,MAAM,qDAAqD,CAAC;AACtH,OAAO,EAAE,OAAO,IAAI,wCAAwC,EAAE,MAAM,yDAAyD,CAAC;AAC9H,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AACxF,OAAO,EAAE,OAAO,IAAI,yCAAyC,EAAE,MAAM,0DAA0D,CAAC;AAChI,OAAO,EAAE,OAAO,IAAI,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AAClG,OAAO,EAAE,OAAO,IAAI,8CAA8C,EAAE,MAAM,+DAA+D,CAAC;AAC1I,OAAO,EAAE,OAAO,IAAI,mDAAmD,EAAE,MAAM,oEAAoE,CAAC;AACpJ,OAAO,EAAE,OAAO,IAAI,2BAA2B,EAAE,MAAM,4CAA4C,CAAC;AACpG,OAAO,EAAE,OAAO,IAAI,mCAAmC,EAAE,MAAM,oDAAoD,CAAC;AACpH,OAAO,EAAE,OAAO,IAAI,6BAA6B,EAAE,MAAM,8CAA8C,CAAC;AACxG,OAAO,EAAE,OAAO,IAAI,4BAA4B,EAAE,MAAM,6CAA6C,CAAC;AACtG,OAAO,EAAE,OAAO,IAAI,2BAA2B,EAAE,MAAM,4CAA4C,CAAC;AACpG,OAAO,EAAE,OAAO,IAAI,wBAAwB,EAAE,MAAM,yCAAyC,CAAC;AAE9F;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAA2B;IACnD,0BAA0B,EAAE,qBAAqB;IACjD,2CAA2C,EAAE,sCAAsC;IACnF,uCAAuC,EAAE,kCAAkC;IAC3E,yCAAyC,EAAE,oCAAoC;IAC/E,6CAA6C,EAAE,wCAAwC;IACvF,+BAA+B,EAAE,0BAA0B;IAC3D,8CAA8C,EAAE,yCAAyC;IACzF,gCAAgC,EAAE,2BAA2B;IAC7D,mDAAmD,EAAE,8CAA8C;IACnG,wDAAwD,EAAE,mDAAmD;IAC7G,gCAAgC,EAAE,2BAA2B;IAC7D,wCAAwC,EAAE,mCAAmC;IAC7E,kCAAkC,EAAE,6BAA6B;IACjE,iCAAiC,EAAE,4BAA4B;IAC/D,6BAA6B,EAAE,wBAAwB;CACxD,CAAC"}
1
+ {"version":3,"file":"_registry.generated.js","sourceRoot":"","sources":["../../../../src/ai-service/skills/system/_registry.generated.ts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,qDAAqD;AAErD,OAAO,EAAE,OAAO,IAAI,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AAClG,OAAO,EAAE,OAAO,IAAI,sCAAsC,EAAE,MAAM,uDAAuD,CAAC;AAC1H,OAAO,EAAE,OAAO,IAAI,kCAAkC,EAAE,MAAM,mDAAmD,CAAC;AAClH,OAAO,EAAE,OAAO,IAAI,oCAAoC,EAAE,MAAM,qDAAqD,CAAC;AACtH,OAAO,EAAE,OAAO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iCAAiC,EAAE,4BAA4B;IAC/D,6BAA6B,EAAE,wBAAwB;CACxD,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const content = "---\nname: common-import-issues\ndescription: |\n Catalog of known import/module-resolution errors in Superblocks apps and their fixes.\n Load when a build error, runtime error, or blank/broken preview points at an import \u2014 e.g.\n \"does not provide an export named X\", \"Failed to resolve import\", or a module-not-found error.\nreadOnly: true\nmetadata:\n author: superblocks\n version: \"1.0\"\n---\n\n# Common Import Issues\n\nThis skill is a catalog of import and module-resolution errors that break Superblocks\napps, together with the exact fix for each. App code is transpiled per-file (esbuild/Vite),\nso an import mistake that a normal bundler would tolerate can crash the app at runtime and\nleave the preview blank \u2014 which then blocks UI verification (navigation/screenshot) entirely.\n\n## How to use this skill\n\n1. Read the error message and find the failing import.\n2. Match it against an entry below.\n3. Apply the fix, reload the file, and re-test.\n4. If the error is **not** in this catalog, debug it normally \u2014 do not guess a fix from a\n superficially similar entry.\n\nWhen you fix an import error, prevent it everywhere: scan the rest of the app for the same\nmistake rather than fixing only the file that happened to throw.\n\n---\n\n## Entry 1 \u2014 lucide-react/dynamic: `IconName` is type-only\n\n### Symptom\n\nThe app crashes at runtime (preview is blank, navigation/screenshot tools time out) with:\n\n```\nSyntaxError: The requested module '/node_modules/.vite/deps/lucide-react_dynamic.js'\ndoes not provide an export named 'IconName'\n```\n\n### Cause\n\nIn `lucide-react/dynamic`, `IconName` is a **type-only** export and `DynamicIcon` is the\n**value** export. Importing `IconName` as a value (no `type` keyword) leaves a runtime\nimport in the transpiled file. Because `lucide-react` (v0.540.0) ships no `exports` map for\nthe runtime entry, the import resolves to a module that has no `IconName` runtime binding,\nso the module fails to evaluate and the whole app fails to mount.\n\n```typescript\n// \u274C WRONG \u2014 value import of a type-only export crashes the app at runtime\nimport { IconName } from \"lucide-react/dynamic\";\n\n// \u274C ALSO WRONG \u2014 DynamicIcon is fine as a value, but IconName must still be a type\nimport { DynamicIcon, IconName } from \"lucide-react/dynamic\";\n```\n\n### Fix\n\nImport `IconName` with the `type` keyword. Keep `DynamicIcon` as a normal value import.\n\n```typescript\n// \u2705 CORRECT \u2014 IconName as a type, DynamicIcon as a value\nimport { DynamicIcon, type IconName } from \"lucide-react/dynamic\";\n\n// \u2705 ALSO CORRECT \u2014 separate type-only import\nimport { DynamicIcon } from \"lucide-react/dynamic\";\nimport type { IconName } from \"lucide-react/dynamic\";\n```\n\n`IconName` is still fully usable as a type (props, generics, `Prop.any<IconName>()`); only\nits runtime materialization is invalid. Unknown icon _names_ render gracefully (a `?`\nplaceholder) \u2014 they do not cause this crash. The crash is always the module import itself.\n\n---\n\n## Adding new entries\n\nThis catalog is meant to grow. When you (or a teammate) confirm a new recurring\nimport/module-resolution failure, add an entry with the same structure:\n\n- **Symptom** \u2014 the exact error string Clark will see, plus the user-visible effect.\n- **Cause** \u2014 why the per-file transpile makes it fail.\n- **Fix** \u2014 the corrected import, with a wrong/right code pair.\n\nKeep entries specific and verified. A vague entry is worse than none because it invites\nguessing.\n";
2
+ //# sourceMappingURL=skill.generated.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skill.generated.d.ts","sourceRoot":"","sources":["../../../../../src/ai-service/skills/system/common-import-issues/skill.generated.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,+gHAyFnB,CAAC"}
@@ -0,0 +1,93 @@
1
+ // Auto-generated from src/ai-service/skills/system/common-import-issues/SKILL.md
2
+ // Do not edit directly - edit the .md file instead
3
+ export const content = `---
4
+ name: common-import-issues
5
+ description: |
6
+ Catalog of known import/module-resolution errors in Superblocks apps and their fixes.
7
+ Load when a build error, runtime error, or blank/broken preview points at an import — e.g.
8
+ "does not provide an export named X", "Failed to resolve import", or a module-not-found error.
9
+ readOnly: true
10
+ metadata:
11
+ author: superblocks
12
+ version: "1.0"
13
+ ---
14
+
15
+ # Common Import Issues
16
+
17
+ This skill is a catalog of import and module-resolution errors that break Superblocks
18
+ apps, together with the exact fix for each. App code is transpiled per-file (esbuild/Vite),
19
+ so an import mistake that a normal bundler would tolerate can crash the app at runtime and
20
+ leave the preview blank — which then blocks UI verification (navigation/screenshot) entirely.
21
+
22
+ ## How to use this skill
23
+
24
+ 1. Read the error message and find the failing import.
25
+ 2. Match it against an entry below.
26
+ 3. Apply the fix, reload the file, and re-test.
27
+ 4. If the error is **not** in this catalog, debug it normally — do not guess a fix from a
28
+ superficially similar entry.
29
+
30
+ When you fix an import error, prevent it everywhere: scan the rest of the app for the same
31
+ mistake rather than fixing only the file that happened to throw.
32
+
33
+ ---
34
+
35
+ ## Entry 1 — lucide-react/dynamic: \`IconName\` is type-only
36
+
37
+ ### Symptom
38
+
39
+ The app crashes at runtime (preview is blank, navigation/screenshot tools time out) with:
40
+
41
+ \`\`\`
42
+ SyntaxError: The requested module '/node_modules/.vite/deps/lucide-react_dynamic.js'
43
+ does not provide an export named 'IconName'
44
+ \`\`\`
45
+
46
+ ### Cause
47
+
48
+ In \`lucide-react/dynamic\`, \`IconName\` is a **type-only** export and \`DynamicIcon\` is the
49
+ **value** export. Importing \`IconName\` as a value (no \`type\` keyword) leaves a runtime
50
+ import in the transpiled file. Because \`lucide-react\` (v0.540.0) ships no \`exports\` map for
51
+ the runtime entry, the import resolves to a module that has no \`IconName\` runtime binding,
52
+ so the module fails to evaluate and the whole app fails to mount.
53
+
54
+ \`\`\`typescript
55
+ // ❌ WRONG — value import of a type-only export crashes the app at runtime
56
+ import { IconName } from "lucide-react/dynamic";
57
+
58
+ // ❌ ALSO WRONG — DynamicIcon is fine as a value, but IconName must still be a type
59
+ import { DynamicIcon, IconName } from "lucide-react/dynamic";
60
+ \`\`\`
61
+
62
+ ### Fix
63
+
64
+ Import \`IconName\` with the \`type\` keyword. Keep \`DynamicIcon\` as a normal value import.
65
+
66
+ \`\`\`typescript
67
+ // ✅ CORRECT — IconName as a type, DynamicIcon as a value
68
+ import { DynamicIcon, type IconName } from "lucide-react/dynamic";
69
+
70
+ // ✅ ALSO CORRECT — separate type-only import
71
+ import { DynamicIcon } from "lucide-react/dynamic";
72
+ import type { IconName } from "lucide-react/dynamic";
73
+ \`\`\`
74
+
75
+ \`IconName\` is still fully usable as a type (props, generics, \`Prop.any<IconName>()\`); only
76
+ its runtime materialization is invalid. Unknown icon _names_ render gracefully (a \`?\`
77
+ placeholder) — they do not cause this crash. The crash is always the module import itself.
78
+
79
+ ---
80
+
81
+ ## Adding new entries
82
+
83
+ This catalog is meant to grow. When you (or a teammate) confirm a new recurring
84
+ import/module-resolution failure, add an entry with the same structure:
85
+
86
+ - **Symptom** — the exact error string Clark will see, plus the user-visible effect.
87
+ - **Cause** — why the per-file transpile makes it fail.
88
+ - **Fix** — the corrected import, with a wrong/right code pair.
89
+
90
+ Keep entries specific and verified. A vague entry is worse than none because it invites
91
+ guessing.
92
+ `;
93
+ //# sourceMappingURL=skill.generated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skill.generated.js","sourceRoot":"","sources":["../../../../../src/ai-service/skills/system/common-import-issues/skill.generated.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,mDAAmD;AAEnD,MAAM,CAAC,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyFtB,CAAC"}
@@ -1,2 +1,2 @@
1
- export declare const content = "---\nname: superblocks-frontend\ndescription: |\n Build frontend UI using React, Tailwind CSS, and Superblocks components. Essential for connecting Superblocks UIs with APIs.\n Use when creating pages, components, handling user interactions, or working with the design system.\nreadOnly: true\nmetadata:\n author: superblocks\n version: \"1.0\"\n---\n\n# Superblocks Frontend Development\n\nThis skill covers building frontend UI for Superblocks applications using React, Tailwind CSS v4, and the Superblocks component library.\n\n## Platform Overview\n\nThis is a React-based web application platform. Use standard React patterns:\n\n- `useState`, `useEffect`, `useCallback`, `useMemo`\n- Event handlers and controlled components\n- JSX with Tailwind CSS classes\n\n## Using APIs from Frontend\n\nThree primitives are available from `@superblocksteam/library`:\n\n- **`useApiData`** \u2014 declarative reads with SWR caching (preferred for data loading)\n- **`useApi`** \u2014 imperative mutations (for event-driven actions)\n- **`executeApi`** \u2014 plain Promise outside React (utility functions, event handlers without hooks)\n\n**Data loading** \u2014 auto-fetches on mount and when inputs change (preferred for reads):\n\n```typescript\nimport { useApiData } from \"@superblocksteam/library\";\n\n// Auto-fetches when email or name changes. No useEffect or HMR guards needed.\n// IMPORTANT: Always use `fetching` to show a loading indicator during refetches.\nconst { data, loading, fetching, isError, error } = useApiData(\"GetUsers\", {\n email,\n name,\n});\n```\n\n**Mutations** \u2014 call `run()` manually (for event-driven actions like form submissions):\n\n```typescript\nimport { useApi } from \"@superblocksteam/library\";\nimport { toast } from \"sonner\";\n\nconst { run: createOrder, loading } = useApi(\"CreateOrder\");\n\nconst handleSubmit = useCallback(async () => {\n try {\n await createOrder({ item, qty });\n } catch (error) {\n const message =\n error && typeof error === \"object\" && \"message\" in error\n ? String((error as { message: unknown }).message)\n : String(error);\n toast.error(\"Error creating order: \" + message);\n }\n}, [item, qty, createOrder]);\n```\n\n**Outside React** \u2014 call APIs as a plain Promise (utility functions, event handlers):\n\n```typescript\nimport { executeApi } from \"@superblocksteam/library\";\n\nconst result = await executeApi(\"GetUsers\", { email });\n```\n\n`useApiData` returns `{ data, loading, fetching, isError, isSuccess, isStale, error, status, fetchStatus, refetch, cancel }`. `data` persists across background refetches (stale-while-revalidate). `loading` is true on first fetch with no cached data. `fetching` is true during any fetch including background refetch. `status` is `\"pending\"` | `\"success\"` | `\"error\"`. `fetchStatus` is `\"idle\"` | `\"fetching\"`. `cancel()` is synchronous (returns `void`).\n\n`useApi` returns `{ run, cancel, reset, loading, data, error, status, variables }`. `data` persists across re-runs (shows previous result while loading). `error` holds the most recent failure, or `undefined` on success. `status` is `\"idle\"` | `\"pending\"` | `\"success\"` | `\"error\"`. `variables` holds the inputs from the most recent `run()`. `reset()` clears all state back to idle. HMR double-fetch prevention is built in \u2014 no `useRef` guard needed.\n\n### useApiData Options\n\n```typescript\nconst { data } = useApiData(\"GetUsers\", { email }, {\n enabled: true, // Skip fetching when false (conditional fetching)\n staleTime: 0, // Ms before cached data is considered stale (0 = always refetch)\n retry: 3, // Retry attempts on failure (false to disable)\n retryDelay: (n) => ..., // Custom delay strategy (default: exponential backoff, max 30s)\n refetchOnWindowFocus: false, // Refetch when tab regains focus\n refetchOnReconnect: true, // Refetch when network reconnects\n refetchInterval: false, // Polling interval in ms (false = disabled)\n structuralSharing: false, // Deep-compare to preserve object identity\n placeholderData: undefined, // Shown while the first fetch is in progress\n});\n```\n\n### Cache invalidation and optimistic updates\n\n**Same scope as the read**: After a mutation, prefer `refetch()` from the `useApiData` that loads the data (same component or wherever you can pass `refetch`).\n\n```typescript\nimport { useApi, useApiData } from \"@superblocksteam/library\";\nimport { toast } from \"sonner\";\n\nconst { data: orders, refetch } = useApiData(\"GetOrders\", { status });\nconst { run: createOrder } = useApi(\"CreateOrder\");\n\nconst handleSubmit = useCallback(async () => {\n try {\n await createOrder({ item, qty });\n await refetch();\n } catch (error) {\n const message =\n error && typeof error === \"object\" && \"message\" in error\n ? String((error as { message: unknown }).message)\n : String(error);\n toast.error(\"Error creating order: \" + message);\n }\n}, [item, qty, createOrder, refetch]);\n```\n\n**Cross-scope or broad invalidation**: Use `queryClient.invalidateQueries` when you cannot call that `refetch` (mutation in a different place than the `useApiData`, or you need every cached variant of an API to refetch). For **`queryClient.invalidateQueries`, `buildCacheKey`, `setQueryData`, and any other `queryClient` usage, always import `queryClient` from `@superblocksteam/library`**.\n\n```typescript\nimport { queryClient, useApi } from \"@superblocksteam/library\";\nimport { toast } from \"sonner\";\n\nconst { run: createOrder } = useApi(\"CreateOrder\");\n\nconst handleSubmit = useCallback(async () => {\n try {\n await createOrder({ item, qty });\n await queryClient.invalidateQueries(\"GetOrders\");\n } catch (error) {\n const message =\n error && typeof error === \"object\" && \"message\" in error\n ? String((error as { message: unknown }).message)\n : String(error);\n toast.error(\"Error creating order: \" + message);\n }\n}, [item, qty, createOrder]);\n```\n\n```typescript\n// Optimistic update: set cached data without refetching\nimport { queryClient } from \"@superblocksteam/library\";\n\nconst cacheKey = queryClient.buildCacheKey(\"GetOrders\", { status: \"active\" });\nqueryClient.setQueryData(cacheKey, (old) => ({\n ...old,\n orders: [...old.orders, newOrder],\n}));\n```\n\n### Critical API Rules\n\n1. **MUST call API by exact name**: Format is `<ApiName>` matching folder `apis/<ApiName>/api.yaml`\n2. **Use `useApiData` for data loading, `useApi` for mutations**: For data fetching, use `useApiData(\"GetUsers\", { email })`. Only use `useApi` for event-driven actions (button clicks, form submissions). Use `executeApi` for API calls outside React components.\n3. **Use the hook's state fields**: Do NOT create separate `useState` for loading or response data \u2014 the hooks manage this for you\n4. **ALWAYS check API interfaces**: NEVER guess the response structure\n5. **Include all parameters**: Even optional ones should be passed as `null`\n6. **ALWAYS use try/catch**: In imperative mode, APIs throw errors when they fail - wrap ALL `run()` calls in try/catch blocks. In declarative mode, check the `error` field for failure details.\n\n### File Handling\n\n**CRITICAL: Files must be wrapped in `{ files: [...] }` format:**\n\n```tsx\n// \u2705 CORRECT - Frontend: wrap files in { files: [...] }\nconst response = await runUploadApi({ userFile: { files: selectedFiles } });\n\n// \u274C WRONG - backend cannot process unwrapped files\nconst response = await runUploadApi({ userFile: selectedFiles });\n```\n\n## Platform Hooks and Functions\n\nAvailable hooks and functions from `@superblocksteam/library`:\n\n### User and Group Context\n\n```typescript\nimport {\n useSuperblocksUser,\n useSuperblocksGroups,\n} from \"@superblocksteam/library\";\n\n// Get current user info\nconst user = useSuperblocksUser();\n// user.name, user.email, user.id, user.groups, user.username, user.metadata\n\n// Get organization groups\nconst groups = useSuperblocksGroups();\n```\n\n### Environments and Data Tags\n\nConcepts & terminology:\n\n- `Data tags` are labels for different data segments, such as `Staging`, `Production`, or `us-east`.\n- `Profiles` is the legacy term for the same concept. If a user asks about profiles, treat that as data tags.\n- `Environments` are `Edit`, `Preview`, and `Production`, and each data tag is allowed in one or more of those environments.\n- Clark operates in `Edit` mode, so the data tags visible in app context represent the tags available in `Edit`; do not assume this is the same set that will be available in `Preview` or `Production`.\n- When implementing app code, prefer `useSuperblocksDataTags()`, `dataTags`, and `setDataTag()`.\n\nThe `DataTag` type has these fields (it is an alias for `Profile` from `@superblocksteam/shared`):\n\n```typescript\ntype DataTag = {\n id: string;\n key: string;\n displayName: string; // human-readable label \u2014 use this for display, NOT \"name\"\n description: string;\n type: \"RESERVED\" | \"CUSTOM\";\n};\n```\n\nRelevant hooks and functions:\n\n```typescript\nimport { useSuperblocksDataTags, getAppMode } from \"@superblocksteam/library\";\nimport type { DataTag, DataTags } from \"@superblocksteam/library\";\n\n// Manage data tags\nconst { dataTags, setDataTag } = useSuperblocksDataTags();\n// dataTags.available: DataTag[] \u2014 all tags in the current environment\n// dataTags.selected: DataTag | undefined \u2014 currently active tag (may be undefined)\n// dataTags.default: DataTag \u2014 the default tag\n// setDataTag(dataTag.key) \u2014 switch the active tag by key\n\n// Read the current app mode when reasoning about environment-specific behavior\nconst appMode = getAppMode();\n```\n\nExample \u2014 data tag switcher using a Select:\n\n```tsx\nconst { dataTags, setDataTag } = useSuperblocksDataTags();\n\n<Select value={dataTags?.selected?.key} onValueChange={setDataTag}>\n {dataTags?.available.map((tag) => (\n <SelectItem key={tag.key} value={tag.key}>\n {tag.displayName}\n </SelectItem>\n ))}\n</Select>;\n```\n\n### Embedded Applications\n\n**For embedded applications**, see the `references/embedding.md` file for `useEmbedProperties`, `useEmbedEvent`, and `useEmitEmbedEvent` hooks.\n\n## Logging Out of Integrations\n\nWhen building a \"Log out\" or \"Sign out\" button for apps that use OAuth-like integrations, use `logoutIntegrations` from the library to clear OAuth tokens:\n\n```typescript\nimport { logoutIntegrations } from \"@superblocksteam/library\";\n\nconst handleLogout = async () => {\n await logoutIntegrations();\n // Optionally redirect or show confirmation\n};\n```\n\n## Application Architecture\n\n### App.tsx Layout Structure\n\n**For single-page applications:**\n\n- Put all content in `pages/<pageName>/index.tsx`\n- Use components to compose and build the page\n- Keep `App.tsx` minimal with just `<AppProvider>` and `<Outlet />`\n\n**For multi-page applications:**\n\n- Put shared navigation/layout in `App.tsx` (sidebars, headers, footers)\n- Always include `<Outlet />` for page content\n- Always include `<AppProvider />` wrapper\n- Individual pages focus on content, not layout\n\n```tsx\n// \u2705 CORRECT - Multi-page App.tsx layout\n<AppProvider>\n <div className=\"flex flex-row size-screen\">\n {/* Sidebar - persistent across all pages */}\n <div className=\"flex bg-sidebar border-r w-[250px]\">\n <Navigation />\n </div>\n\n {/* Main content area */}\n <div className=\"flex flex-1 h-full flex-col\">\n {/* Header - persistent across all pages */}\n <div className=\"flex bg-header border-b h-[60px]\">\n <Header />\n </div>\n\n {/* Page content area */}\n <div className=\"flex p-4 flex-1 overflow-auto\">\n <Outlet />\n </div>\n </div>\n </div>\n</AppProvider>\n```\n\n**PROTECTED: NEVER remove `<AppProvider>` or `<Outlet />` from App.tsx!**\n\n### Page Structure\n\n```tsx\n// \u2705 CORRECT - Page focuses on content only\n<div className=\"flex flex-col gap-4 size-screen overflow-auto\">\n <h1 className=\"text-3xl font-bold\">Dashboard Content</h1>\n <Card>{/* Page-specific content */}</Card>\n</div>\n```\n\n**IMPORTANT**: The first div on the page must have `overflow-auto` so the user's page can scroll.\n\n## Routing\n\nUse `react-router@7` in data mode. Standard patterns apply:\n\n- `useNavigate()` for programmatic navigation\n- `useParams()` for route parameters\n- `useSearchParams()` for query strings\n\n**If you add new pages or rename files, you MUST update the router.**\n\n## Design System (Tailwind CSS v4)\n\n**All design tokens are defined in `index.css`**. Apps come with a professional black-and-white theme by default.\n\n### Semantic Tokens Rule\n\n**ALWAYS use semantic tokens** \u2014 NEVER raw Tailwind utilities:\n\n```tsx\n// \u2705 CORRECT\n<Card className=\"bg-background text-foreground border border-border\" />\n\n// \u274C WRONG\n<Card className=\"bg-white text-black border-gray-200\" />\n```\n\n### When to Modify index.css\n\nOnly modify when:\n\n- User explicitly requests branding/theme changes\n- Replicating a specific brand look (e.g., Yelp, Instacart)\n- Migrating an attached third-party app \u2014 see `skills/system/third-party-migration/SKILL.md` (its theme-port rules override the Modification Rules below \u2014 copy source tokens as-is, do not convert to OKLCH or trim the palette)\n- Feature requests (lists, filters, CRUD) do NOT require changes\n\n**Modification Rules:**\n\n- All colors must be in OKLCH format\n- Use semantic names (`--color-warning`, `--shadow-elevated`)\n- Do not remove or rename existing tokens\n- Limit color palette to 5 colors max\n- Avoid gradients unless explicitly requested\n- Minimal font sizes (3 max: body, section heading, main heading)\n\n### Component Variants\n\nUse or create variants instead of one-off styles:\n\n```tsx\n// \u274C WRONG - Hacky inline overrides\n<Button className=\"text-white border-white hover:bg-white\" />\n\n// \u2705 CORRECT - Use a variant\n<Button variant=\"secondary\" />\n```\n\n## Icons\n\nUse icons from Lucide React library:\n\n```tsx\nimport { Icon } from \"@/components/ui/icon\";\n<Icon icon=\"heart\" />;\n\nimport { Button } from \"@/components/ui/button\";\n<Button>\n <Icon icon=\"plus\" /> Add Item\n</Button>;\n```\n\n**Always use icons rather than emojis unless explicitly requested.**\n\nUse current Lucide icon names, not stale aliases: use `house` instead of `home`, `life-buoy` instead of `help-circle` or `circle-help`, and `chart-column-big` instead of `bar-chart-3`.\n\n## Custom Components\n\n**CRITICAL: Component composition is MANDATORY. DO NOT create monolithic pages.**\n\n### The Composition Rule\n\nWhen building ANY feature:\n\n1. **First**, identify reusable parts (list items, cards, forms, filters, headers)\n2. **Then**, create separate component files\n3. **Finally**, compose them together in the page\n\n### When to Create Components\n\n- **Rendering any list** - Extract to a component\n- **Building cards/complex UI** - Each card type is a component\n- **Creating forms** - Form sections are components\n- **Adding filters/headers** - These are components\n- **Page has >50 lines JSX** - Break it down\n\n### Component Boundary Rules\n\n**Inside a custom component:**\n\n- \u2705 Use React hooks (useState, useReducer, useEffect, etc.)\n- \u2705 Use local React state\n- \u2705 Use internal helper components\n- \u2705 Use other registered components\n- \u274C CANNOT call APIs - must pass data into the component\n\n### Example: Proper Component Structure\n\n```tsx\n// components/ProductCard/index.tsx - Extract to component\nimport { Card } from \"@/components/ui/card\";\nimport { Button } from \"@/components/ui/button\";\n\ntype ProductCardProps = {\n product: {\n id: string;\n name: string;\n image: string;\n };\n};\n\nexport default function ProductCard(props: ProductCardProps) {\n return (\n <Card>\n <img src={props.product.image} />\n <h3 className=\"text-lg font-semibold\">{props.product.name}</h3>\n <Button>Add</Button>\n </Card>\n );\n}\n\n// pages/Products/index.tsx - Clean composition\nimport ProductCard from \"@/components/ProductCard\";\n\nconst ProductsPage = () => {\n const [products, setProducts] = useState([]);\n\n return (\n <div className=\"grid grid-cols-3 gap-4\">\n {products.map((p) => (\n <ProductCard key={p.id} product={p} />\n ))}\n </div>\n );\n};\n```\n\n## Visual Excellence\n\n**Prioritize visual excellence from the start:**\n\n1. **Design System Enhancement**: Start by enhancing `index.css` with app-specific colors that match the target aesthetic\n2. **Professional Layout Architecture**: Use sophisticated layouts with proper spacing, responsive design\n3. **Rich Interactive Components**: Leverage advanced components with proper variants and states\n4. **Visual Polish**: Add shadows, smooth transitions, skeleton loaders, hover effects, typography hierarchy\n5. **Real-World UI Patterns**: Create layouts that feel like professional applications\n\n**Make applications that look and feel like real, polished products - not basic wireframes.**\n\n### Loading States\n\nLoading behavior must differ based on whether data has already been fetched:\n\n**Initial load (no data yet):** Show skeleton shimmers that mirror the shape of the final content. Never show a blank screen or a generic spinner.\n\n**Refetch / background refresh (data already exists):** Keep showing the existing data. Use `fetching` from `useApiData` to apply a subtle visual indicator: light opacity (e.g. `opacity-70`) to signal a refresh is in progress, plus a non-blocking label such as a small inline spinner, a thin progress bar, or an \"Updating\u2026\" label. **Do not** use `pointer-events-none` or otherwise disable the content \u2014 it must remain fully interactive during refetch.\n\nUse `loading` and `fetching` from `useApiData` to distinguish these states:\n\n```tsx\nconst { data, loading, fetching, isError, error } = useApiData(\"GetOrders\", {\n status: statusFilter,\n search,\n});\n\n// Initial load \u2014 no data yet \u2192 show skeleton placeholder\nif (loading) {\n return <OrderTableSkeleton />;\n}\n\nif (isError) return <ErrorBanner error={error} />;\n\n// Refetch \u2014 data exists \u2192 subtle opacity + indicator, table stays interactive\nreturn (\n <div>\n {fetching && <div className=\"text-xs text-muted-foreground\">Updating\u2026</div>}\n <div className={fetching ? \"opacity-70\" : \"\"}>\n <OrderTable orders={data.orders} />\n </div>\n </div>\n);\n```\n\n```tsx\n// \u274C WRONG \u2014 pointer-events-none disables the table, making it feel broken\nreturn (\n <div className={fetching ? \"pointer-events-none\" : \"\"}>\n <OrderTable orders={data.orders} />\n </div>\n);\n\n// \u274C WRONG \u2014 no loading feedback when filters change\nif (loading) return <Skeleton />;\nreturn <OrderTable orders={data.orders} />;\n```\n\n#### Table Loading Rules\n\n- **Do not** use `pointer-events-none` on a table during loading \u2014 this disables interaction and makes the UI feel broken. During refetch, apply a subtle opacity (e.g. `opacity-70`) plus a non-blocking indicator (e.g., an \"Updating\u2026\" label or a thin progress bar). The table must remain clickable, sortable, and scrollable.\n- **Do not** replace a populated table with a full skeleton on refetch \u2014 this causes disorienting content flashes.\n- **Skeleton tables are only for initial load** (`loading` is true) when there is no data to display yet. Build them to match the real table's column structure (header + a few placeholder rows).\n\n### Efficient Loading Patterns\n\n1. **Always show loading indicators on refetch**: When inputs change (e.g. filters, search), show a non-blocking visual indicator while new data loads. Use `fetching` from `useApiData`.\n2. **Loading State Hierarchy**:\n - No data yet (`loading`) \u2192 Full skeleton placeholder\n - Has data, refetching (`fetching` && !`loading`) \u2192 Keep showing current data with a subtle visual indicator: light opacity (e.g. `opacity-70`) plus a non-blocking label (e.g. \"Updating\u2026\" text, thin progress bar, inline spinner). Do not use `pointer-events-none` \u2014 the content must remain fully interactive.\n - Error state (`isError`) \u2192 Show error with retry option, optionally keep stale data visible\n3. **Debounce Rapid Requests**: Prevent multiple API calls in short succession\n4. **Use useApiData for automatic refetching**: `useApiData` auto-refetches when inputs change and supports `staleTime`, `refetchOnWindowFocus`, `refetchOnReconnect`, `refetchInterval`, and `retry` options.\n\n## Performance Rules\n\n### 1. ALWAYS Paginate Tables and Lists\n\n**NEVER render more than 50 rows without pagination.** Always add client-side pagination:\n\n```tsx\nfunction PaginatedTable({ data }: { data: any[] }) {\n const PAGE_SIZE = 20;\n const [page, setPage] = useState(0);\n const totalPages = Math.ceil(data.length / PAGE_SIZE);\n const pageData = useMemo(\n () => data.slice(page * PAGE_SIZE, (page + 1) * PAGE_SIZE),\n [data, page],\n );\n\n useEffect(() => {\n setPage(0);\n }, [data.length]);\n\n return (\n <>\n <Table>{/* render pageData rows */}</Table>\n <span>\n Page {page + 1} of {totalPages} ({data.length} total rows)\n </span>\n <Button\n onClick={() => setPage((p) => Math.max(0, p - 1))}\n disabled={page === 0}\n >\n Previous\n </Button>\n <Button\n onClick={() => setPage((p) => Math.min(totalPages - 1, p + 1))}\n disabled={page >= totalPages - 1}\n >\n Next\n </Button>\n </>\n );\n}\n```\n\nFor 200+ rows, prefer **server-side pagination**; use cursor/keyset pagination for high offsets instead of `LIMIT`/`OFFSET`.\n\nFor 500+ item lists where pagination doesn't fit the UX (chat messages, infinite scroll feeds, large dropdowns), use **virtualization** (`react-virtuoso` or `@tanstack/react-virtual`) to render only the items visible in the viewport.\n\n### 2. ALWAYS Debounce Input-Driven API Calls\n\n**NEVER call an API directly from onChange.** Debounce search/filter inputs with a 300ms timer:\n\n```tsx\nfunction DebouncedSearch({ onSearch }: { onSearch: (query: string) => void }) {\n const [localValue, setLocalValue] = useState(\"\");\n const timerRef = useRef<ReturnType<typeof setTimeout>>();\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n setLocalValue(e.target.value);\n clearTimeout(timerRef.current);\n timerRef.current = setTimeout(() => onSearch(e.target.value), 300);\n },\n [onSearch],\n );\n useEffect(() => () => clearTimeout(timerRef.current), []);\n\n return (\n <Input value={localValue} onChange={handleChange} placeholder=\"Search...\" />\n );\n}\n```\n\n### 3. Memoize Expensive Renders\n\nUse memoization (`memo()`, `useMemo`, `useCallback`) when it prevents measurable re-renders or expensive recomputation:\n\n```tsx\nconst OrderRow = memo(function OrderRow({\n order,\n onSelect,\n}: {\n order: Order;\n onSelect: (id: string) => void;\n}) {\n return (\n <TableRow onClick={() => onSelect(order.id)}>\n <TableCell>{order.id}</TableCell>...\n </TableRow>\n );\n});\n\nconst handleSelect = useCallback((id: string) => {\n setSelectedId(id);\n}, []);\n\nconst filtered = useMemo(\n () =>\n orders.filter((o) => o.status === status).sort((a, b) => b.total - a.total),\n [orders, status],\n);\n```\n\n### 4. ALWAYS Clean Up Side Effects\n\nClean up timers, event listeners, and subscriptions in `useEffect` return functions:\n\n```tsx\nuseEffect(() => {\n const handler = (e: KeyboardEvent) => {\n /* ... */\n };\n window.addEventListener(\"keydown\", handler);\n return () => window.removeEventListener(\"keydown\", handler);\n}, []);\n```\n\n### 5. Cancel In-Flight API Requests on Unmount\n\nFor search/filter patterns, prefer `useApiData` \u2014 it handles cancellation and cleanup automatically:\n\n```tsx\n// useApiData: auto-fetches and cancels on unmount/input change\nconst { data, fetching } = useApiData(\"SearchProducts\", { query });\n```\n\nFor imperative usage with manual cleanup, use the `cancel()` function:\n\n```tsx\nconst { run, cancel } = useApi(\"SearchProducts\");\n\nuseEffect(() => {\n if (!query) return;\n run({ query }).catch(console.error);\n return () => {\n cancel().catch(() => {});\n };\n}, [query, run, cancel]);\n```\n";
1
+ export declare const content = "---\nname: superblocks-frontend\ndescription: |\n Build frontend UI using React, Tailwind CSS, and Superblocks components. Essential for connecting Superblocks UIs with APIs.\n Use when creating pages, components, handling user interactions, or working with the design system.\nreadOnly: true\nmetadata:\n author: superblocks\n version: \"1.0\"\n---\n\n# Superblocks Frontend Development\n\nThis skill covers building frontend UI for Superblocks applications using React, Tailwind CSS v4, and the Superblocks component library.\n\n## Platform Overview\n\nThis is a React-based web application platform. Use standard React patterns:\n\n- `useState`, `useEffect`, `useCallback`, `useMemo`\n- Event handlers and controlled components\n- JSX with Tailwind CSS classes\n\n## Using APIs from Frontend\n\nThree primitives are available from `@superblocksteam/library`:\n\n- **`useApiData`** \u2014 declarative reads with SWR caching (preferred for data loading)\n- **`useApi`** \u2014 imperative mutations (for event-driven actions)\n- **`executeApi`** \u2014 plain Promise outside React (utility functions, event handlers without hooks)\n\n**Data loading** \u2014 auto-fetches on mount and when inputs change (preferred for reads):\n\n```typescript\nimport { useApiData } from \"@superblocksteam/library\";\n\n// Auto-fetches when email or name changes. No useEffect or HMR guards needed.\n// IMPORTANT: Always use `fetching` to show a loading indicator during refetches.\nconst { data, loading, fetching, isError, error } = useApiData(\"GetUsers\", {\n email,\n name,\n});\n```\n\n**Mutations** \u2014 call `run()` manually (for event-driven actions like form submissions):\n\n```typescript\nimport { useApi } from \"@superblocksteam/library\";\nimport { toast } from \"sonner\";\n\nconst { run: createOrder, loading } = useApi(\"CreateOrder\");\n\nconst handleSubmit = useCallback(async () => {\n try {\n await createOrder({ item, qty });\n } catch (error) {\n const message =\n error && typeof error === \"object\" && \"message\" in error\n ? String((error as { message: unknown }).message)\n : String(error);\n toast.error(\"Error creating order: \" + message);\n }\n}, [item, qty, createOrder]);\n```\n\n**Outside React** \u2014 call APIs as a plain Promise (utility functions, event handlers):\n\n```typescript\nimport { executeApi } from \"@superblocksteam/library\";\n\nconst result = await executeApi(\"GetUsers\", { email });\n```\n\n`useApiData` returns `{ data, loading, fetching, isError, isSuccess, isStale, error, status, fetchStatus, refetch, cancel }`. `data` persists across background refetches (stale-while-revalidate). `loading` is true on first fetch with no cached data. `fetching` is true during any fetch including background refetch. `status` is `\"pending\"` | `\"success\"` | `\"error\"`. `fetchStatus` is `\"idle\"` | `\"fetching\"`. `cancel()` is synchronous (returns `void`).\n\n`useApi` returns `{ run, cancel, reset, loading, data, error, status, variables }`. `data` persists across re-runs (shows previous result while loading). `error` holds the most recent failure, or `undefined` on success. `status` is `\"idle\"` | `\"pending\"` | `\"success\"` | `\"error\"`. `variables` holds the inputs from the most recent `run()`. `reset()` clears all state back to idle. HMR double-fetch prevention is built in \u2014 no `useRef` guard needed.\n\n### useApiData Options\n\n```typescript\nconst { data } = useApiData(\"GetUsers\", { email }, {\n enabled: true, // Skip fetching when false (conditional fetching)\n staleTime: 0, // Ms before cached data is considered stale (0 = always refetch)\n retry: 3, // Retry attempts on failure (false to disable)\n retryDelay: (n) => ..., // Custom delay strategy (default: exponential backoff, max 30s)\n refetchOnWindowFocus: false, // Refetch when tab regains focus\n refetchOnReconnect: true, // Refetch when network reconnects\n refetchInterval: false, // Polling interval in ms (false = disabled)\n structuralSharing: false, // Deep-compare to preserve object identity\n placeholderData: undefined, // Shown while the first fetch is in progress\n});\n```\n\n### Cache invalidation and optimistic updates\n\n**Same scope as the read**: After a mutation, prefer `refetch()` from the `useApiData` that loads the data (same component or wherever you can pass `refetch`).\n\n```typescript\nimport { useApi, useApiData } from \"@superblocksteam/library\";\nimport { toast } from \"sonner\";\n\nconst { data: orders, refetch } = useApiData(\"GetOrders\", { status });\nconst { run: createOrder } = useApi(\"CreateOrder\");\n\nconst handleSubmit = useCallback(async () => {\n try {\n await createOrder({ item, qty });\n await refetch();\n } catch (error) {\n const message =\n error && typeof error === \"object\" && \"message\" in error\n ? String((error as { message: unknown }).message)\n : String(error);\n toast.error(\"Error creating order: \" + message);\n }\n}, [item, qty, createOrder, refetch]);\n```\n\n**Cross-scope or broad invalidation**: Use `queryClient.invalidateQueries` when you cannot call that `refetch` (mutation in a different place than the `useApiData`, or you need every cached variant of an API to refetch). For **`queryClient.invalidateQueries`, `buildCacheKey`, `setQueryData`, and any other `queryClient` usage, always import `queryClient` from `@superblocksteam/library`**.\n\n```typescript\nimport { queryClient, useApi } from \"@superblocksteam/library\";\nimport { toast } from \"sonner\";\n\nconst { run: createOrder } = useApi(\"CreateOrder\");\n\nconst handleSubmit = useCallback(async () => {\n try {\n await createOrder({ item, qty });\n await queryClient.invalidateQueries(\"GetOrders\");\n } catch (error) {\n const message =\n error && typeof error === \"object\" && \"message\" in error\n ? String((error as { message: unknown }).message)\n : String(error);\n toast.error(\"Error creating order: \" + message);\n }\n}, [item, qty, createOrder]);\n```\n\n```typescript\n// Optimistic update: set cached data without refetching\nimport { queryClient } from \"@superblocksteam/library\";\n\nconst cacheKey = queryClient.buildCacheKey(\"GetOrders\", { status: \"active\" });\nqueryClient.setQueryData(cacheKey, (old) => ({\n ...old,\n orders: [...old.orders, newOrder],\n}));\n```\n\n### Critical API Rules\n\n1. **MUST call API by exact name**: Format is `<ApiName>` matching folder `apis/<ApiName>/api.yaml`\n2. **Use `useApiData` for data loading, `useApi` for mutations**: For data fetching, use `useApiData(\"GetUsers\", { email })`. Only use `useApi` for event-driven actions (button clicks, form submissions). Use `executeApi` for API calls outside React components.\n3. **Use the hook's state fields**: Do NOT create separate `useState` for loading or response data \u2014 the hooks manage this for you\n4. **ALWAYS check API interfaces**: NEVER guess the response structure\n5. **Include all parameters**: Even optional ones should be passed as `null`\n6. **ALWAYS use try/catch**: In imperative mode, APIs throw errors when they fail - wrap ALL `run()` calls in try/catch blocks. In declarative mode, check the `error` field for failure details.\n\n### File Handling\n\n**CRITICAL: Files must be wrapped in `{ files: [...] }` format:**\n\n```tsx\n// \u2705 CORRECT - Frontend: wrap files in { files: [...] }\nconst response = await runUploadApi({ userFile: { files: selectedFiles } });\n\n// \u274C WRONG - backend cannot process unwrapped files\nconst response = await runUploadApi({ userFile: selectedFiles });\n```\n\n## Platform Hooks and Functions\n\nAvailable hooks and functions from `@superblocksteam/library`:\n\n### User and Group Context\n\n```typescript\nimport {\n useSuperblocksUser,\n useSuperblocksGroups,\n} from \"@superblocksteam/library\";\n\n// Get current user info\nconst user = useSuperblocksUser();\n// user.name, user.email, user.id, user.groups, user.username, user.metadata\n\n// Get organization groups\nconst groups = useSuperblocksGroups();\n```\n\n### Environments and Data Tags\n\nConcepts & terminology:\n\n- `Data tags` are labels for different data segments, such as `Staging`, `Production`, or `us-east`.\n- `Profiles` is the legacy term for the same concept. If a user asks about profiles, treat that as data tags.\n- `Environments` are `Edit`, `Preview`, and `Production`, and each data tag is allowed in one or more of those environments.\n- Clark operates in `Edit` mode, so the data tags visible in app context represent the tags available in `Edit`; do not assume this is the same set that will be available in `Preview` or `Production`.\n- When implementing app code, prefer `useSuperblocksDataTags()`, `dataTags`, and `setDataTag()`.\n\nThe `DataTag` type has these fields (it is an alias for `Profile` from `@superblocksteam/shared`):\n\n```typescript\ntype DataTag = {\n id: string;\n key: string;\n displayName: string; // human-readable label \u2014 use this for display, NOT \"name\"\n description: string;\n type: \"RESERVED\" | \"CUSTOM\";\n};\n```\n\nRelevant hooks and functions:\n\n```typescript\nimport { useSuperblocksDataTags, getAppMode } from \"@superblocksteam/library\";\nimport type { DataTag, DataTags } from \"@superblocksteam/library\";\n\n// Manage data tags\nconst { dataTags, setDataTag } = useSuperblocksDataTags();\n// dataTags.available: DataTag[] \u2014 all tags in the current environment\n// dataTags.selected: DataTag | undefined \u2014 currently active tag (may be undefined)\n// dataTags.default: DataTag \u2014 the default tag\n// setDataTag(dataTag.key) \u2014 switch the active tag by key\n\n// Read the current app mode when reasoning about environment-specific behavior\nconst appMode = getAppMode();\n```\n\nExample \u2014 data tag switcher using a Select:\n\n```tsx\nconst { dataTags, setDataTag } = useSuperblocksDataTags();\n\n<Select value={dataTags?.selected?.key} onValueChange={setDataTag}>\n {dataTags?.available.map((tag) => (\n <SelectItem key={tag.key} value={tag.key}>\n {tag.displayName}\n </SelectItem>\n ))}\n</Select>;\n```\n\n### Embedded Applications\n\n**For embedded applications**, see the `references/embedding.md` file for `useEmbedProperties`, `useEmbedEvent`, and `useEmitEmbedEvent` hooks.\n\n## Logging Out of Integrations\n\nWhen building a \"Log out\" or \"Sign out\" button for apps that use OAuth-like integrations, use `logoutIntegrations` from the library to clear OAuth tokens:\n\n```typescript\nimport { logoutIntegrations } from \"@superblocksteam/library\";\n\nconst handleLogout = async () => {\n await logoutIntegrations();\n // Optionally redirect or show confirmation\n};\n```\n\n## Application Architecture\n\n### App.tsx Layout Structure\n\n**For single-page applications:**\n\n- Put all content in `pages/<pageName>/index.tsx`\n- Use components to compose and build the page\n- Keep `App.tsx` minimal with just `<AppProvider>` and `<Outlet />`\n\n**For multi-page applications:**\n\n- Put shared navigation/layout in `App.tsx` (sidebars, headers, footers)\n- Always include `<Outlet />` for page content\n- Always include `<AppProvider />` wrapper\n- Individual pages focus on content, not layout\n\n```tsx\n// \u2705 CORRECT - Multi-page App.tsx layout\n<AppProvider>\n <div className=\"flex flex-row size-screen\">\n {/* Sidebar - persistent across all pages */}\n <div className=\"flex bg-sidebar border-r w-[250px]\">\n <Navigation />\n </div>\n\n {/* Main content area */}\n <div className=\"flex flex-1 h-full flex-col\">\n {/* Header - persistent across all pages */}\n <div className=\"flex bg-header border-b h-[60px]\">\n <Header />\n </div>\n\n {/* Page content area */}\n <div className=\"flex p-4 flex-1 overflow-auto\">\n <Outlet />\n </div>\n </div>\n </div>\n</AppProvider>\n```\n\n**PROTECTED: NEVER remove `<AppProvider>` or `<Outlet />` from App.tsx!**\n\n### Page Structure\n\n```tsx\n// \u2705 CORRECT - Page focuses on content only\n<div className=\"flex flex-col gap-4 size-screen overflow-auto\">\n <h1 className=\"text-3xl font-bold\">Dashboard Content</h1>\n <Card>{/* Page-specific content */}</Card>\n</div>\n```\n\n**IMPORTANT**: The first div on the page must have `overflow-auto` so the user's page can scroll.\n\n## Routing\n\nUse `react-router@7` in data mode. Standard patterns apply:\n\n- `useNavigate()` for programmatic navigation\n- `useParams()` for route parameters\n- `useSearchParams()` for query strings\n\n**If you add new pages or rename files, you MUST update the router.**\n\n## Design System (Tailwind CSS v4)\n\n**All design tokens are defined in `index.css`**. Apps come with a professional black-and-white theme by default.\n\n### Semantic Tokens Rule\n\n**ALWAYS use semantic tokens** \u2014 NEVER raw Tailwind utilities:\n\n```tsx\n// \u2705 CORRECT\n<Card className=\"bg-background text-foreground border border-border\" />\n\n// \u274C WRONG\n<Card className=\"bg-white text-black border-gray-200\" />\n```\n\n### When to Modify index.css\n\nOnly modify when:\n\n- User explicitly requests branding/theme changes\n- Replicating a specific brand look (e.g., Yelp, Instacart)\n- Migrating an attached third-party app \u2014 see `skills/system/third-party-migration/SKILL.md` (its theme-port rules override the Modification Rules below \u2014 copy source tokens as-is, do not convert to OKLCH or trim the palette)\n- Feature requests (lists, filters, CRUD) do NOT require changes\n\n**Modification Rules:**\n\n- All colors must be in OKLCH format\n- Use semantic names (`--color-warning`, `--shadow-elevated`)\n- Do not remove or rename existing tokens\n- Limit color palette to 5 colors max\n- Avoid gradients unless explicitly requested\n- Minimal font sizes (3 max: body, section heading, main heading)\n\n### Component Variants\n\nUse or create variants instead of one-off styles:\n\n```tsx\n// \u274C WRONG - Hacky inline overrides\n<Button className=\"text-white border-white hover:bg-white\" />\n\n// \u2705 CORRECT - Use a variant\n<Button variant=\"secondary\" />\n```\n\n## Icons\n\nUse icons from Lucide React library:\n\n```tsx\nimport { Icon } from \"@/components/ui/icon\";\n<Icon icon=\"heart\" />;\n\nimport { Button } from \"@/components/ui/button\";\n<Button>\n <Icon icon=\"plus\" /> Add Item\n</Button>;\n```\n\n**Always use icons rather than emojis unless explicitly requested.**\n\nUse current Lucide icon names, not stale aliases: use `house` instead of `home`, `life-buoy` instead of `help-circle` or `circle-help`, and `chart-column-big` instead of `bar-chart-3`.\n\nWhen storing icon names as data (arrays/objects), type them with `IconName`. **`IconName` is a TYPE-only export \u2014 you MUST import it with the `type` keyword.** A value import compiles but CRASHES the app at runtime (`does not provide an export named 'IconName'`) and leaves the preview blank, which blocks UI verification. If you hit that error, read `skills/system/common-import-issues/SKILL.md`.\n\n```tsx\n// \u2705 CORRECT \u2014 type-only import\nimport type { IconName } from \"lucide-react/dynamic\";\n\nconst navItems: { icon: IconName; label: string }[] = [\n { icon: \"house\", label: \"Home\" },\n { icon: \"settings\", label: \"Settings\" },\n];\n\n// \u274C WRONG \u2014 value import crashes the app at runtime and blanks the preview\nimport { IconName } from \"lucide-react/dynamic\";\n```\n\n## Custom Components\n\n**CRITICAL: Component composition is MANDATORY. DO NOT create monolithic pages.**\n\n### The Composition Rule\n\nWhen building ANY feature:\n\n1. **First**, identify reusable parts (list items, cards, forms, filters, headers)\n2. **Then**, create separate component files\n3. **Finally**, compose them together in the page\n\n### When to Create Components\n\n- **Rendering any list** - Extract to a component\n- **Building cards/complex UI** - Each card type is a component\n- **Creating forms** - Form sections are components\n- **Adding filters/headers** - These are components\n- **Page has >50 lines JSX** - Break it down\n\n### Component Boundary Rules\n\n**Inside a custom component:**\n\n- \u2705 Use React hooks (useState, useReducer, useEffect, etc.)\n- \u2705 Use local React state\n- \u2705 Use internal helper components\n- \u2705 Use other registered components\n- \u274C CANNOT call APIs - must pass data into the component\n\n### Example: Proper Component Structure\n\n```tsx\n// components/ProductCard/index.tsx - Extract to component\nimport { Card } from \"@/components/ui/card\";\nimport { Button } from \"@/components/ui/button\";\n\ntype ProductCardProps = {\n product: {\n id: string;\n name: string;\n image: string;\n };\n};\n\nexport default function ProductCard(props: ProductCardProps) {\n return (\n <Card>\n <img src={props.product.image} />\n <h3 className=\"text-lg font-semibold\">{props.product.name}</h3>\n <Button>Add</Button>\n </Card>\n );\n}\n\n// pages/Products/index.tsx - Clean composition\nimport ProductCard from \"@/components/ProductCard\";\n\nconst ProductsPage = () => {\n const [products, setProducts] = useState([]);\n\n return (\n <div className=\"grid grid-cols-3 gap-4\">\n {products.map((p) => (\n <ProductCard key={p.id} product={p} />\n ))}\n </div>\n );\n};\n```\n\n## Visual Excellence\n\n**Prioritize visual excellence from the start:**\n\n1. **Design System Enhancement**: Start by enhancing `index.css` with app-specific colors that match the target aesthetic\n2. **Professional Layout Architecture**: Use sophisticated layouts with proper spacing, responsive design\n3. **Rich Interactive Components**: Leverage advanced components with proper variants and states\n4. **Visual Polish**: Add shadows, smooth transitions, skeleton loaders, hover effects, typography hierarchy\n5. **Real-World UI Patterns**: Create layouts that feel like professional applications\n\n**Make applications that look and feel like real, polished products - not basic wireframes.**\n\n### Loading States\n\nLoading behavior must differ based on whether data has already been fetched:\n\n**Initial load (no data yet):** Show skeleton shimmers that mirror the shape of the final content. Never show a blank screen or a generic spinner.\n\n**Refetch / background refresh (data already exists):** Keep showing the existing data. Use `fetching` from `useApiData` to apply a subtle visual indicator: light opacity (e.g. `opacity-70`) to signal a refresh is in progress, plus a non-blocking label such as a small inline spinner, a thin progress bar, or an \"Updating\u2026\" label. **Do not** use `pointer-events-none` or otherwise disable the content \u2014 it must remain fully interactive during refetch.\n\nUse `loading` and `fetching` from `useApiData` to distinguish these states:\n\n```tsx\nconst { data, loading, fetching, isError, error } = useApiData(\"GetOrders\", {\n status: statusFilter,\n search,\n});\n\n// Initial load \u2014 no data yet \u2192 show skeleton placeholder\nif (loading) {\n return <OrderTableSkeleton />;\n}\n\nif (isError) return <ErrorBanner error={error} />;\n\n// Refetch \u2014 data exists \u2192 subtle opacity + indicator, table stays interactive\nreturn (\n <div>\n {fetching && <div className=\"text-xs text-muted-foreground\">Updating\u2026</div>}\n <div className={fetching ? \"opacity-70\" : \"\"}>\n <OrderTable orders={data.orders} />\n </div>\n </div>\n);\n```\n\n```tsx\n// \u274C WRONG \u2014 pointer-events-none disables the table, making it feel broken\nreturn (\n <div className={fetching ? \"pointer-events-none\" : \"\"}>\n <OrderTable orders={data.orders} />\n </div>\n);\n\n// \u274C WRONG \u2014 no loading feedback when filters change\nif (loading) return <Skeleton />;\nreturn <OrderTable orders={data.orders} />;\n```\n\n#### Table Loading Rules\n\n- **Do not** use `pointer-events-none` on a table during loading \u2014 this disables interaction and makes the UI feel broken. During refetch, apply a subtle opacity (e.g. `opacity-70`) plus a non-blocking indicator (e.g., an \"Updating\u2026\" label or a thin progress bar). The table must remain clickable, sortable, and scrollable.\n- **Do not** replace a populated table with a full skeleton on refetch \u2014 this causes disorienting content flashes.\n- **Skeleton tables are only for initial load** (`loading` is true) when there is no data to display yet. Build them to match the real table's column structure (header + a few placeholder rows).\n\n### Efficient Loading Patterns\n\n1. **Always show loading indicators on refetch**: When inputs change (e.g. filters, search), show a non-blocking visual indicator while new data loads. Use `fetching` from `useApiData`.\n2. **Loading State Hierarchy**:\n - No data yet (`loading`) \u2192 Full skeleton placeholder\n - Has data, refetching (`fetching` && !`loading`) \u2192 Keep showing current data with a subtle visual indicator: light opacity (e.g. `opacity-70`) plus a non-blocking label (e.g. \"Updating\u2026\" text, thin progress bar, inline spinner). Do not use `pointer-events-none` \u2014 the content must remain fully interactive.\n - Error state (`isError`) \u2192 Show error with retry option, optionally keep stale data visible\n3. **Debounce Rapid Requests**: Prevent multiple API calls in short succession\n4. **Use useApiData for automatic refetching**: `useApiData` auto-refetches when inputs change and supports `staleTime`, `refetchOnWindowFocus`, `refetchOnReconnect`, `refetchInterval`, and `retry` options.\n\n## Performance Rules\n\n### 1. ALWAYS Paginate Tables and Lists\n\n**NEVER render more than 50 rows without pagination.** Always add client-side pagination:\n\n```tsx\nfunction PaginatedTable({ data }: { data: any[] }) {\n const PAGE_SIZE = 20;\n const [page, setPage] = useState(0);\n const totalPages = Math.ceil(data.length / PAGE_SIZE);\n const pageData = useMemo(\n () => data.slice(page * PAGE_SIZE, (page + 1) * PAGE_SIZE),\n [data, page],\n );\n\n useEffect(() => {\n setPage(0);\n }, [data.length]);\n\n return (\n <>\n <Table>{/* render pageData rows */}</Table>\n <span>\n Page {page + 1} of {totalPages} ({data.length} total rows)\n </span>\n <Button\n onClick={() => setPage((p) => Math.max(0, p - 1))}\n disabled={page === 0}\n >\n Previous\n </Button>\n <Button\n onClick={() => setPage((p) => Math.min(totalPages - 1, p + 1))}\n disabled={page >= totalPages - 1}\n >\n Next\n </Button>\n </>\n );\n}\n```\n\nFor 200+ rows, prefer **server-side pagination**; use cursor/keyset pagination for high offsets instead of `LIMIT`/`OFFSET`.\n\nFor 500+ item lists where pagination doesn't fit the UX (chat messages, infinite scroll feeds, large dropdowns), use **virtualization** (`react-virtuoso` or `@tanstack/react-virtual`) to render only the items visible in the viewport.\n\n### 2. ALWAYS Debounce Input-Driven API Calls\n\n**NEVER call an API directly from onChange.** Debounce search/filter inputs with a 300ms timer:\n\n```tsx\nfunction DebouncedSearch({ onSearch }: { onSearch: (query: string) => void }) {\n const [localValue, setLocalValue] = useState(\"\");\n const timerRef = useRef<ReturnType<typeof setTimeout>>();\n const handleChange = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n setLocalValue(e.target.value);\n clearTimeout(timerRef.current);\n timerRef.current = setTimeout(() => onSearch(e.target.value), 300);\n },\n [onSearch],\n );\n useEffect(() => () => clearTimeout(timerRef.current), []);\n\n return (\n <Input value={localValue} onChange={handleChange} placeholder=\"Search...\" />\n );\n}\n```\n\n### 3. Memoize Expensive Renders\n\nUse memoization (`memo()`, `useMemo`, `useCallback`) when it prevents measurable re-renders or expensive recomputation:\n\n```tsx\nconst OrderRow = memo(function OrderRow({\n order,\n onSelect,\n}: {\n order: Order;\n onSelect: (id: string) => void;\n}) {\n return (\n <TableRow onClick={() => onSelect(order.id)}>\n <TableCell>{order.id}</TableCell>...\n </TableRow>\n );\n});\n\nconst handleSelect = useCallback((id: string) => {\n setSelectedId(id);\n}, []);\n\nconst filtered = useMemo(\n () =>\n orders.filter((o) => o.status === status).sort((a, b) => b.total - a.total),\n [orders, status],\n);\n```\n\n### 4. ALWAYS Clean Up Side Effects\n\nClean up timers, event listeners, and subscriptions in `useEffect` return functions:\n\n```tsx\nuseEffect(() => {\n const handler = (e: KeyboardEvent) => {\n /* ... */\n };\n window.addEventListener(\"keydown\", handler);\n return () => window.removeEventListener(\"keydown\", handler);\n}, []);\n```\n\n### 5. Cancel In-Flight API Requests on Unmount\n\nFor search/filter patterns, prefer `useApiData` \u2014 it handles cancellation and cleanup automatically:\n\n```tsx\n// useApiData: auto-fetches and cancels on unmount/input change\nconst { data, fetching } = useApiData(\"SearchProducts\", { query });\n```\n\nFor imperative usage with manual cleanup, use the `cancel()` function:\n\n```tsx\nconst { run, cancel } = useApi(\"SearchProducts\");\n\nuseEffect(() => {\n if (!query) return;\n run({ query }).catch(console.error);\n return () => {\n cancel().catch(() => {});\n };\n}, [query, run, cancel]);\n```\n";
2
2
  //# sourceMappingURL=skill.generated.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"skill.generated.d.ts","sourceRoot":"","sources":["../../../../../src/ai-service/skills/system/superblocks-frontend/skill.generated.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,4qwBAmqBnB,CAAC"}
1
+ {"version":3,"file":"skill.generated.d.ts","sourceRoot":"","sources":["../../../../../src/ai-service/skills/system/superblocks-frontend/skill.generated.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,09xBAkrBnB,CAAC"}
@@ -392,6 +392,21 @@ import { Button } from "@/components/ui/button";
392
392
 
393
393
  Use current Lucide icon names, not stale aliases: use \`house\` instead of \`home\`, \`life-buoy\` instead of \`help-circle\` or \`circle-help\`, and \`chart-column-big\` instead of \`bar-chart-3\`.
394
394
 
395
+ When storing icon names as data (arrays/objects), type them with \`IconName\`. **\`IconName\` is a TYPE-only export — you MUST import it with the \`type\` keyword.** A value import compiles but CRASHES the app at runtime (\`does not provide an export named 'IconName'\`) and leaves the preview blank, which blocks UI verification. If you hit that error, read \`skills/system/common-import-issues/SKILL.md\`.
396
+
397
+ \`\`\`tsx
398
+ // ✅ CORRECT — type-only import
399
+ import type { IconName } from "lucide-react/dynamic";
400
+
401
+ const navItems: { icon: IconName; label: string }[] = [
402
+ { icon: "house", label: "Home" },
403
+ { icon: "settings", label: "Settings" },
404
+ ];
405
+
406
+ // ❌ WRONG — value import crashes the app at runtime and blanks the preview
407
+ import { IconName } from "lucide-react/dynamic";
408
+ \`\`\`
409
+
395
410
  ## Custom Components
396
411
 
397
412
  **CRITICAL: Component composition is MANDATORY. DO NOT create monolithic pages.**