@superblocksteam/vite-plugin-file-sync 2.0.123 → 2.0.124-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 (271) hide show
  1. package/dist/ai-service/agent/prompts/build-base-system-prompt.d.ts +16 -1
  2. package/dist/ai-service/agent/prompts/build-base-system-prompt.d.ts.map +1 -1
  3. package/dist/ai-service/agent/prompts/build-base-system-prompt.js +27 -1
  4. package/dist/ai-service/agent/prompts/build-base-system-prompt.js.map +1 -1
  5. package/dist/ai-service/agent/prompts/build-security-scan-prompt.d.ts.map +1 -1
  6. package/dist/ai-service/agent/prompts/build-security-scan-prompt.js +3 -1
  7. package/dist/ai-service/agent/prompts/build-security-scan-prompt.js.map +1 -1
  8. package/dist/ai-service/agent/tools/apis/api-comparator.d.ts.map +1 -1
  9. package/dist/ai-service/agent/tools/apis/api-comparator.js +1 -4
  10. package/dist/ai-service/agent/tools/apis/api-comparator.js.map +1 -1
  11. package/dist/ai-service/agent/tools/apis/api-testing-state.js +7 -0
  12. package/dist/ai-service/agent/tools/apis/api-testing-state.js.map +1 -1
  13. package/dist/ai-service/agent/tools/apis/get-api-docs.d.ts +1 -1
  14. package/dist/ai-service/agent/tools/apis/write-api.d.ts +2 -2
  15. package/dist/ai-service/agent/tools/build-capture-screenshot.d.ts.map +1 -1
  16. package/dist/ai-service/agent/tools/build-capture-screenshot.js +11 -33
  17. package/dist/ai-service/agent/tools/build-capture-screenshot.js.map +1 -1
  18. package/dist/ai-service/agent/tools/build-copy-directory.d.ts +1 -1
  19. package/dist/ai-service/agent/tools/build-finalize.d.ts.map +1 -1
  20. package/dist/ai-service/agent/tools/build-finalize.js +11 -2
  21. package/dist/ai-service/agent/tools/build-finalize.js.map +1 -1
  22. package/dist/ai-service/agent/tools/build-install-packages.d.ts +41 -1
  23. package/dist/ai-service/agent/tools/build-install-packages.d.ts.map +1 -1
  24. package/dist/ai-service/agent/tools/build-install-packages.js +208 -0
  25. package/dist/ai-service/agent/tools/build-install-packages.js.map +1 -1
  26. package/dist/ai-service/agent/tools/build-lookup-npm-package.d.ts +28 -0
  27. package/dist/ai-service/agent/tools/build-lookup-npm-package.d.ts.map +1 -0
  28. package/dist/ai-service/agent/tools/build-lookup-npm-package.js +78 -0
  29. package/dist/ai-service/agent/tools/build-lookup-npm-package.js.map +1 -0
  30. package/dist/ai-service/agent/tools/build-manage-checklist.d.ts +4 -4
  31. package/dist/ai-service/agent/tools/build-navigate-preview.d.ts +16 -0
  32. package/dist/ai-service/agent/tools/build-navigate-preview.d.ts.map +1 -0
  33. package/dist/ai-service/agent/tools/build-navigate-preview.js +68 -0
  34. package/dist/ai-service/agent/tools/build-navigate-preview.js.map +1 -0
  35. package/dist/ai-service/agent/tools/build-write-file.d.ts +1 -1
  36. package/dist/ai-service/agent/tools/databases/dev-database.d.ts +9 -9
  37. package/dist/ai-service/agent/tools/index.d.ts +2 -0
  38. package/dist/ai-service/agent/tools/index.d.ts.map +1 -1
  39. package/dist/ai-service/agent/tools/index.js +2 -0
  40. package/dist/ai-service/agent/tools/index.js.map +1 -1
  41. package/dist/ai-service/agent/tools/integrations/execute-request.d.ts +3 -3
  42. package/dist/ai-service/agent/tools/report-security-findings.d.ts +11 -5
  43. package/dist/ai-service/agent/tools/report-security-findings.d.ts.map +1 -1
  44. package/dist/ai-service/agent/tools/report-security-findings.js +1 -0
  45. package/dist/ai-service/agent/tools/report-security-findings.js.map +1 -1
  46. package/dist/ai-service/agent/tools.d.ts.map +1 -1
  47. package/dist/ai-service/agent/tools.js +3 -1
  48. package/dist/ai-service/agent/tools.js.map +1 -1
  49. package/dist/ai-service/agent/tools2/tools/git.d.ts +2 -2
  50. package/dist/ai-service/agent/tools2/tools/grep.d.ts +2 -2
  51. package/dist/ai-service/agent/tools2/tools/update-test-case-status.d.ts +2 -2
  52. package/dist/ai-service/app-interface/npm-error-parser.d.ts +161 -0
  53. package/dist/ai-service/app-interface/npm-error-parser.d.ts.map +1 -0
  54. package/dist/ai-service/app-interface/npm-error-parser.js +510 -0
  55. package/dist/ai-service/app-interface/npm-error-parser.js.map +1 -0
  56. package/dist/ai-service/app-interface/npm-package-lookup.d.ts +286 -0
  57. package/dist/ai-service/app-interface/npm-package-lookup.d.ts.map +1 -0
  58. package/dist/ai-service/app-interface/npm-package-lookup.js +793 -0
  59. package/dist/ai-service/app-interface/npm-package-lookup.js.map +1 -0
  60. package/dist/ai-service/app-interface/npm-registry.d.ts +735 -47
  61. package/dist/ai-service/app-interface/npm-registry.d.ts.map +1 -1
  62. package/dist/ai-service/app-interface/npm-registry.js +1882 -153
  63. package/dist/ai-service/app-interface/npm-registry.js.map +1 -1
  64. package/dist/ai-service/app-interface/shell.d.ts +118 -1
  65. package/dist/ai-service/app-interface/shell.d.ts.map +1 -1
  66. package/dist/ai-service/app-interface/shell.js +579 -157
  67. package/dist/ai-service/app-interface/shell.js.map +1 -1
  68. package/dist/ai-service/app-skills/manager.d.ts +1 -1
  69. package/dist/ai-service/app-skills/manager.d.ts.map +1 -1
  70. package/dist/ai-service/app-skills/manager.js +39 -7
  71. package/dist/ai-service/app-skills/manager.js.map +1 -1
  72. package/dist/ai-service/checklist/api-migration-checklist-gate.d.ts +9 -0
  73. package/dist/ai-service/checklist/api-migration-checklist-gate.d.ts.map +1 -0
  74. package/dist/ai-service/checklist/api-migration-checklist-gate.js +30 -0
  75. package/dist/ai-service/checklist/api-migration-checklist-gate.js.map +1 -0
  76. package/dist/ai-service/checklist/api-migration-origins.d.ts +4 -0
  77. package/dist/ai-service/checklist/api-migration-origins.d.ts.map +1 -0
  78. package/dist/ai-service/checklist/api-migration-origins.js +8 -0
  79. package/dist/ai-service/checklist/api-migration-origins.js.map +1 -0
  80. package/dist/ai-service/checklist/persisted-checklist-store.d.ts +2 -3
  81. package/dist/ai-service/checklist/persisted-checklist-store.d.ts.map +1 -1
  82. package/dist/ai-service/checklist/persisted-checklist-store.js +6 -7
  83. package/dist/ai-service/checklist/persisted-checklist-store.js.map +1 -1
  84. package/dist/ai-service/context-archive-paths.d.ts +4 -0
  85. package/dist/ai-service/context-archive-paths.d.ts.map +1 -0
  86. package/dist/ai-service/context-archive-paths.js +28 -0
  87. package/dist/ai-service/context-archive-paths.js.map +1 -0
  88. package/dist/ai-service/context-download.d.ts +3 -1
  89. package/dist/ai-service/context-download.d.ts.map +1 -1
  90. package/dist/ai-service/context-download.js +48 -9
  91. package/dist/ai-service/context-download.js.map +1 -1
  92. package/dist/ai-service/context-upload.d.ts +3 -2
  93. package/dist/ai-service/context-upload.d.ts.map +1 -1
  94. package/dist/ai-service/context-upload.js +44 -26
  95. package/dist/ai-service/context-upload.js.map +1 -1
  96. package/dist/ai-service/dev-database-client.d.ts +3 -11
  97. package/dist/ai-service/dev-database-client.d.ts.map +1 -1
  98. package/dist/ai-service/dev-database-client.js.map +1 -1
  99. package/dist/ai-service/features.d.ts +4 -0
  100. package/dist/ai-service/features.d.ts.map +1 -1
  101. package/dist/ai-service/features.js +8 -0
  102. package/dist/ai-service/features.js.map +1 -1
  103. package/dist/ai-service/filter-disabled-tools-for-migration.d.ts.map +1 -1
  104. package/dist/ai-service/filter-disabled-tools-for-migration.js +4 -0
  105. package/dist/ai-service/filter-disabled-tools-for-migration.js.map +1 -1
  106. package/dist/ai-service/index.d.ts +94 -0
  107. package/dist/ai-service/index.d.ts.map +1 -1
  108. package/dist/ai-service/index.js +564 -17
  109. package/dist/ai-service/index.js.map +1 -1
  110. package/dist/ai-service/llm/client.d.ts +38 -3
  111. package/dist/ai-service/llm/client.d.ts.map +1 -1
  112. package/dist/ai-service/llm/client.js +73 -22
  113. package/dist/ai-service/llm/client.js.map +1 -1
  114. package/dist/ai-service/llm/context-v2/adapter.d.ts +3 -1
  115. package/dist/ai-service/llm/context-v2/adapter.d.ts.map +1 -1
  116. package/dist/ai-service/llm/context-v2/adapter.js +11 -11
  117. package/dist/ai-service/llm/context-v2/adapter.js.map +1 -1
  118. package/dist/ai-service/llm/context-v2/compaction/client-side.d.ts +44 -0
  119. package/dist/ai-service/llm/context-v2/compaction/client-side.d.ts.map +1 -0
  120. package/dist/ai-service/llm/context-v2/compaction/client-side.js +170 -0
  121. package/dist/ai-service/llm/context-v2/compaction/client-side.js.map +1 -0
  122. package/dist/ai-service/llm/context-v2/compaction/compaction-strategy.d.ts +56 -0
  123. package/dist/ai-service/llm/context-v2/compaction/compaction-strategy.d.ts.map +1 -0
  124. package/dist/ai-service/llm/context-v2/compaction/compaction-strategy.js +9 -0
  125. package/dist/ai-service/llm/context-v2/compaction/compaction-strategy.js.map +1 -0
  126. package/dist/ai-service/llm/context-v2/compaction/index.d.ts +5 -0
  127. package/dist/ai-service/llm/context-v2/compaction/index.d.ts.map +1 -0
  128. package/dist/ai-service/llm/context-v2/compaction/index.js +3 -0
  129. package/dist/ai-service/llm/context-v2/compaction/index.js.map +1 -0
  130. package/dist/ai-service/llm/context-v2/compaction/server-side.d.ts +30 -0
  131. package/dist/ai-service/llm/context-v2/compaction/server-side.d.ts.map +1 -0
  132. package/dist/ai-service/llm/context-v2/compaction/server-side.js +130 -0
  133. package/dist/ai-service/llm/context-v2/compaction/server-side.js.map +1 -0
  134. package/dist/ai-service/llm/context-v2/context-management.d.ts +203 -0
  135. package/dist/ai-service/llm/context-v2/context-management.d.ts.map +1 -0
  136. package/dist/ai-service/llm/context-v2/context-management.js +183 -0
  137. package/dist/ai-service/llm/context-v2/context-management.js.map +1 -0
  138. package/dist/ai-service/llm/context-v2/context.d.ts +64 -22
  139. package/dist/ai-service/llm/context-v2/context.d.ts.map +1 -1
  140. package/dist/ai-service/llm/context-v2/context.js +233 -157
  141. package/dist/ai-service/llm/context-v2/context.js.map +1 -1
  142. package/dist/ai-service/llm/context-v2/conversation-context.d.ts +24 -7
  143. package/dist/ai-service/llm/context-v2/conversation-context.d.ts.map +1 -1
  144. package/dist/ai-service/llm/context-v2/conversation-context.js +1 -1
  145. package/dist/ai-service/llm/context-v2/index.d.ts +0 -4
  146. package/dist/ai-service/llm/context-v2/index.d.ts.map +1 -1
  147. package/dist/ai-service/llm/context-v2/index.js +0 -4
  148. package/dist/ai-service/llm/context-v2/index.js.map +1 -1
  149. package/dist/ai-service/llm/context-v2/manager.d.ts +24 -3
  150. package/dist/ai-service/llm/context-v2/manager.d.ts.map +1 -1
  151. package/dist/ai-service/llm/context-v2/manager.js +146 -4
  152. package/dist/ai-service/llm/context-v2/manager.js.map +1 -1
  153. package/dist/ai-service/llm/context-v2/migrations/v1-to-v2.d.ts +2 -7
  154. package/dist/ai-service/llm/context-v2/migrations/v1-to-v2.d.ts.map +1 -1
  155. package/dist/ai-service/llm/context-v2/migrations/v1-to-v2.js +5 -73
  156. package/dist/ai-service/llm/context-v2/migrations/v1-to-v2.js.map +1 -1
  157. package/dist/ai-service/llm/context-v2/storage/event-store.d.ts +57 -0
  158. package/dist/ai-service/llm/context-v2/storage/event-store.d.ts.map +1 -0
  159. package/dist/ai-service/llm/context-v2/storage/event-store.js +10 -0
  160. package/dist/ai-service/llm/context-v2/storage/event-store.js.map +1 -0
  161. package/dist/ai-service/llm/context-v2/storage/event-types.d.ts +50 -0
  162. package/dist/ai-service/llm/context-v2/storage/event-types.d.ts.map +1 -0
  163. package/dist/ai-service/llm/context-v2/storage/event-types.js +10 -0
  164. package/dist/ai-service/llm/context-v2/storage/event-types.js.map +1 -0
  165. package/dist/ai-service/llm/context-v2/storage/jsonl-event-store.d.ts +87 -0
  166. package/dist/ai-service/llm/context-v2/storage/jsonl-event-store.d.ts.map +1 -0
  167. package/dist/ai-service/llm/context-v2/storage/jsonl-event-store.js +184 -0
  168. package/dist/ai-service/llm/context-v2/storage/jsonl-event-store.js.map +1 -0
  169. package/dist/ai-service/llm/context-v2/storage/migration.d.ts +49 -0
  170. package/dist/ai-service/llm/context-v2/storage/migration.d.ts.map +1 -0
  171. package/dist/ai-service/llm/context-v2/storage/migration.js +126 -0
  172. package/dist/ai-service/llm/context-v2/storage/migration.js.map +1 -0
  173. package/dist/ai-service/llm/context-v2/types.d.ts +16 -11
  174. package/dist/ai-service/llm/context-v2/types.d.ts.map +1 -1
  175. package/dist/ai-service/llm/context-v2/types.js +2 -2
  176. package/dist/ai-service/llm/context-v2/types.js.map +1 -1
  177. package/dist/ai-service/llm/impl/clark.d.ts +8 -0
  178. package/dist/ai-service/llm/impl/clark.d.ts.map +1 -1
  179. package/dist/ai-service/llm/impl/clark.js +8 -0
  180. package/dist/ai-service/llm/impl/clark.js.map +1 -1
  181. package/dist/ai-service/llm/interaction/adapters/vercel.d.ts.map +1 -1
  182. package/dist/ai-service/llm/interaction/adapters/vercel.js +17 -1
  183. package/dist/ai-service/llm/interaction/adapters/vercel.js.map +1 -1
  184. package/dist/ai-service/llm/provider.d.ts.map +1 -1
  185. package/dist/ai-service/llm/provider.js +1 -3
  186. package/dist/ai-service/llm/provider.js.map +1 -1
  187. package/dist/ai-service/llm/stream/observers/context.d.ts +23 -0
  188. package/dist/ai-service/llm/stream/observers/context.d.ts.map +1 -1
  189. package/dist/ai-service/llm/stream/observers/context.js +62 -0
  190. package/dist/ai-service/llm/stream/observers/context.js.map +1 -1
  191. package/dist/ai-service/llm/tool-context-integrity.d.ts +25 -0
  192. package/dist/ai-service/llm/tool-context-integrity.d.ts.map +1 -0
  193. package/dist/ai-service/llm/tool-context-integrity.js +141 -0
  194. package/dist/ai-service/llm/tool-context-integrity.js.map +1 -0
  195. package/dist/ai-service/skills/system/superblocks-migration/skill.generated.d.ts +1 -1
  196. package/dist/ai-service/skills/system/superblocks-migration/skill.generated.d.ts.map +1 -1
  197. package/dist/ai-service/skills/system/superblocks-migration/skill.generated.js +6 -1
  198. package/dist/ai-service/skills/system/superblocks-migration/skill.generated.js.map +1 -1
  199. package/dist/ai-service/skills/system/third-party-migration/skill.generated.d.ts +1 -1
  200. package/dist/ai-service/skills/system/third-party-migration/skill.generated.d.ts.map +1 -1
  201. package/dist/ai-service/skills/system/third-party-migration/skill.generated.js +3 -2
  202. package/dist/ai-service/skills/system/third-party-migration/skill.generated.js.map +1 -1
  203. package/dist/ai-service/state-machine/clark-fsm.d.ts +23 -2
  204. package/dist/ai-service/state-machine/clark-fsm.d.ts.map +1 -1
  205. package/dist/ai-service/state-machine/clark-fsm.js +37 -2
  206. package/dist/ai-service/state-machine/clark-fsm.js.map +1 -1
  207. package/dist/ai-service/state-machine/handlers/agent-planning.d.ts.map +1 -1
  208. package/dist/ai-service/state-machine/handlers/agent-planning.js +29 -2
  209. package/dist/ai-service/state-machine/handlers/agent-planning.js.map +1 -1
  210. package/dist/ai-service/state-machine/handlers/awaiting-user.d.ts.map +1 -1
  211. package/dist/ai-service/state-machine/handlers/awaiting-user.js +9 -0
  212. package/dist/ai-service/state-machine/handlers/awaiting-user.js.map +1 -1
  213. package/dist/ai-service/state-machine/handlers/llm-generating.d.ts.map +1 -1
  214. package/dist/ai-service/state-machine/handlers/llm-generating.js +25 -2
  215. package/dist/ai-service/state-machine/handlers/llm-generating.js.map +1 -1
  216. package/dist/ai-service/state-machine/helpers/fetch-with-reconnect-retry.d.ts +6 -0
  217. package/dist/ai-service/state-machine/helpers/fetch-with-reconnect-retry.d.ts.map +1 -0
  218. package/dist/ai-service/state-machine/helpers/fetch-with-reconnect-retry.js +36 -0
  219. package/dist/ai-service/state-machine/helpers/fetch-with-reconnect-retry.js.map +1 -0
  220. package/dist/ai-service/state-machine/helpers/stable-peer.d.ts +30 -1
  221. package/dist/ai-service/state-machine/helpers/stable-peer.d.ts.map +1 -1
  222. package/dist/ai-service/state-machine/helpers/stable-peer.js +85 -2
  223. package/dist/ai-service/state-machine/helpers/stable-peer.js.map +1 -1
  224. package/dist/ai-service/state-machine/helpers/user-preferences.d.ts +8 -0
  225. package/dist/ai-service/state-machine/helpers/user-preferences.d.ts.map +1 -0
  226. package/dist/ai-service/state-machine/helpers/user-preferences.js +11 -0
  227. package/dist/ai-service/state-machine/helpers/user-preferences.js.map +1 -0
  228. package/dist/ai-service/template-renderer.d.ts +18 -1
  229. package/dist/ai-service/template-renderer.d.ts.map +1 -1
  230. package/dist/ai-service/template-renderer.js +73 -12
  231. package/dist/ai-service/template-renderer.js.map +1 -1
  232. package/dist/ai-service/types.d.ts +157 -0
  233. package/dist/ai-service/types.d.ts.map +1 -1
  234. package/dist/ai-service/types.js +137 -0
  235. package/dist/ai-service/types.js.map +1 -1
  236. package/dist/ai-service/util/llm-config-utils.d.ts +21 -22
  237. package/dist/ai-service/util/llm-config-utils.d.ts.map +1 -1
  238. package/dist/ai-service/util/llm-config-utils.js +40 -67
  239. package/dist/ai-service/util/llm-config-utils.js.map +1 -1
  240. package/dist/file-sync-vite-plugin.d.ts.map +1 -1
  241. package/dist/file-sync-vite-plugin.js +5 -0
  242. package/dist/file-sync-vite-plugin.js.map +1 -1
  243. package/dist/file-system-helpers.d.ts +17 -0
  244. package/dist/file-system-helpers.d.ts.map +1 -1
  245. package/dist/file-system-helpers.js +22 -0
  246. package/dist/file-system-helpers.js.map +1 -1
  247. package/dist/git-service/index.d.ts.map +1 -1
  248. package/dist/git-service/index.js +15 -1
  249. package/dist/git-service/index.js.map +1 -1
  250. package/dist/migration/migration-routes.d.ts.map +1 -1
  251. package/dist/migration/migration-routes.js +26 -3
  252. package/dist/migration/migration-routes.js.map +1 -1
  253. package/dist/migration/translation-prompt.d.ts.map +1 -1
  254. package/dist/migration/translation-prompt.js +5 -0
  255. package/dist/migration/translation-prompt.js.map +1 -1
  256. package/dist/migration-templates/app-fullstack/package.json +2 -2
  257. package/dist/policy-gate-callback-mapper.d.ts +24 -0
  258. package/dist/policy-gate-callback-mapper.d.ts.map +1 -0
  259. package/dist/policy-gate-callback-mapper.js +61 -0
  260. package/dist/policy-gate-callback-mapper.js.map +1 -0
  261. package/dist/policy-gate-runner.d.ts +32 -0
  262. package/dist/policy-gate-runner.d.ts.map +1 -0
  263. package/dist/policy-gate-runner.js +191 -0
  264. package/dist/policy-gate-runner.js.map +1 -0
  265. package/dist/router-parser.d.ts.map +1 -1
  266. package/dist/router-parser.js +107 -11
  267. package/dist/router-parser.js.map +1 -1
  268. package/dist/sync-service/list-dir.d.ts.map +1 -1
  269. package/dist/sync-service/list-dir.js +13 -3
  270. package/dist/sync-service/list-dir.js.map +1 -1
  271. package/package.json +28 -10
@@ -0,0 +1,141 @@
1
+ import { createHash } from "node:crypto";
2
+ const DEFAULT_MAX_DETAILS = 10;
3
+ const EMPTY_TOOL_IDS = new Set();
4
+ const MAX_DIAGNOSTIC_STRING_LENGTH = 128;
5
+ const MAX_LOGGED_TOOL_REFERENCES = 10;
6
+ function getContentParts(msg) {
7
+ if (!Array.isArray(msg.content)) {
8
+ return [];
9
+ }
10
+ return msg.content.filter((part) => part && typeof part === "object");
11
+ }
12
+ function getToolName(part) {
13
+ return typeof part.toolName === "string" ? part.toolName : undefined;
14
+ }
15
+ function getToolCallId(part) {
16
+ return typeof part.toolCallId === "string" ? part.toolCallId : undefined;
17
+ }
18
+ function getMessageToolParts(msg) {
19
+ const parts = getContentParts(msg);
20
+ const toolCallIds = new Set();
21
+ const toolResultIds = new Set();
22
+ for (const part of parts) {
23
+ const toolCallId = getToolCallId(part);
24
+ if (!toolCallId) {
25
+ continue;
26
+ }
27
+ if (msg.role === "assistant" && part.type === "tool-call") {
28
+ toolCallIds.add(toolCallId);
29
+ }
30
+ if ((msg.role === "assistant" || msg.role === "tool") &&
31
+ part.type === "tool-result") {
32
+ toolResultIds.add(toolCallId);
33
+ }
34
+ }
35
+ return { parts, toolCallIds, toolResultIds };
36
+ }
37
+ function getMaxDetails(options) {
38
+ if (options.maxDetails === undefined) {
39
+ return DEFAULT_MAX_DETAILS;
40
+ }
41
+ if (!Number.isFinite(options.maxDetails)) {
42
+ return MAX_LOGGED_TOOL_REFERENCES;
43
+ }
44
+ return Math.min(Math.max(Math.floor(options.maxDetails), 0), MAX_LOGGED_TOOL_REFERENCES);
45
+ }
46
+ function toDiagnosticString(value) {
47
+ if (value.length <= MAX_DIAGNOSTIC_STRING_LENGTH) {
48
+ return value;
49
+ }
50
+ return `${value.slice(0, MAX_DIAGNOSTIC_STRING_LENGTH - 3)}...`;
51
+ }
52
+ function toDiagnosticToolCallId(value) {
53
+ return `sha256:${createHash("sha256").update(value).digest("hex").slice(0, 16)}`;
54
+ }
55
+ function toToolReference(messageIndex, toolCallId, part) {
56
+ const toolName = getToolName(part);
57
+ return {
58
+ messageIndex,
59
+ toolCallId: toDiagnosticToolCallId(toolCallId),
60
+ ...(toolName ? { toolName: toDiagnosticString(toolName) } : {}),
61
+ };
62
+ }
63
+ export function analyzeToolContextIntegrity(source, messages, options = {}) {
64
+ const maxDetails = getMaxDetails(options);
65
+ const orphanToolCalls = [];
66
+ const orphanToolResults = [];
67
+ let orphanToolCallCount = 0;
68
+ let orphanToolResultCount = 0;
69
+ const messageToolParts = messages.map(getMessageToolParts);
70
+ messages.forEach((msg, index) => {
71
+ const currentToolParts = messageToolParts[index];
72
+ if (msg.role === "assistant") {
73
+ const nextToolResultIds = messageToolParts[index + 1]?.toolResultIds ?? EMPTY_TOOL_IDS;
74
+ const validToolResultIds = new Set([
75
+ ...nextToolResultIds,
76
+ ...currentToolParts.toolResultIds,
77
+ ]);
78
+ for (const part of currentToolParts.parts) {
79
+ if (part.type !== "tool-call") {
80
+ continue;
81
+ }
82
+ const toolCallId = getToolCallId(part);
83
+ if (!toolCallId || validToolResultIds.has(toolCallId)) {
84
+ continue;
85
+ }
86
+ orphanToolCallCount++;
87
+ if (orphanToolCalls.length < maxDetails) {
88
+ orphanToolCalls.push(toToolReference(index, toolCallId, part));
89
+ }
90
+ }
91
+ }
92
+ if (msg.role === "tool") {
93
+ const previousToolCallIds = messageToolParts[index - 1]?.toolCallIds ?? EMPTY_TOOL_IDS;
94
+ for (const part of currentToolParts.parts) {
95
+ if (part.type !== "tool-result") {
96
+ continue;
97
+ }
98
+ const toolCallId = getToolCallId(part);
99
+ if (!toolCallId || previousToolCallIds.has(toolCallId)) {
100
+ continue;
101
+ }
102
+ orphanToolResultCount++;
103
+ if (orphanToolResults.length < maxDetails) {
104
+ orphanToolResults.push(toToolReference(index, toolCallId, part));
105
+ }
106
+ }
107
+ }
108
+ });
109
+ return {
110
+ source,
111
+ messageCount: messages.length,
112
+ orphanToolCallCount,
113
+ orphanToolResultCount,
114
+ orphanToolCalls,
115
+ orphanToolResults,
116
+ };
117
+ }
118
+ export function logToolContextIntegrityIssues(logger, source, messages) {
119
+ const messagesSnapshot = Array.isArray(messages) ? [...messages] : messages;
120
+ queueMicrotask(() => {
121
+ try {
122
+ const summary = analyzeToolContextIntegrity(source, messagesSnapshot);
123
+ if (summary.orphanToolCallCount === 0 &&
124
+ summary.orphanToolResultCount === 0) {
125
+ return;
126
+ }
127
+ logger.warn("[ai-service] tool context integrity issue", summary);
128
+ }
129
+ catch {
130
+ try {
131
+ logger.warn("[ai-service] tool context integrity analysis failed", {
132
+ source,
133
+ });
134
+ }
135
+ catch {
136
+ // Diagnostic logging must never disrupt the LLM request path.
137
+ }
138
+ }
139
+ });
140
+ }
141
+ //# sourceMappingURL=tool-context-integrity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-context-integrity.js","sourceRoot":"","sources":["../../../src/ai-service/llm/tool-context-integrity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAsCzC,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAC/B,MAAM,cAAc,GAAwB,IAAI,GAAG,EAAE,CAAC;AACtD,MAAM,4BAA4B,GAAG,GAAG,CAAC;AACzC,MAAM,0BAA0B,GAAG,EAAE,CAAC;AAEtC,SAAS,eAAe,CAAC,GAAiB;IACxC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;QAChC,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,OAAO,GAAG,CAAC,OAAO,CAAC,MAAM,CACvB,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,CACT,CAAC;AACtC,CAAC;AAED,SAAS,WAAW,CAAC,IA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E;oBACjE,MAAM;iBACP,CAAC,CAAC;YACL,CAAC;YAAC,MAAM,CAAC;gBACP,8DAA8D;YAChE,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1,2 +1,2 @@
1
- export declare const content = "---\nname: superblocks-migration\ndescription: |\n Convert legacy Superblocks 2.0 YAML APIs (\"block-chain\" format) to the new 3.0 sdk-api TypeScript format.\n Load when executing a v2\u2192v3 migration turn \u2014 the runtime prompt will tell you to.\nreadOnly: true\nmetadata:\n author: superblocks\n version: \"1.0\"\n---\n\n# v2 \u2192 v3 API Translation\n\nYou are converting **legacy Superblocks \"block-chain\" YAML APIs** into the **new code-mode `@superblocksteam/sdk-api` TypeScript format**. Each YAML file under `scratch/v2-backup/apis/<ApiName>/api.yaml` must be emitted as a single TypeScript file at `server/apis/<ApiName>/api.ts` that compiles, typechecks, and preserves behavior exactly.\n\n## Meta-rule: ZERO judgment calls\n\nIf any situation below is not resolved deterministically by this document, **STOP** for that API. Do **not** pick a default. Do **not** guess a factory, a shape, or an import. Skip it, continue with other APIs, and mark the checklist item as `failed` via `build_manageChecklist` with a short `failureReason` describing the exact ambiguity (failing rule, block name if any, what would be needed to proceed). This rule overrides everything else.\n\nCorollary: do not add `// TODO` comments that silently ship. Unresolved items live only as `failed` checklist entries.\n\nCorollary for `migration_page_route_verification_*`: see the _Page route verification_ section below \u2014 screenshot timeout/error \u2192 `failed`, never `completed`, never \"verified via router/source inspection.\" The full rule (including the hard-rule restatements) lives there to avoid drift.\n\n## Inputs and outputs\n\n- **Source tree:** `scratch/v2-backup/apis/<ApiName>/api.yaml`. Discover the actual set by listing the directory \u2014 do not hardcode a count or list.\n- **Target tree:** `server/apis/<ApiName>/api.ts`. Do not create scaffolding trees that do not already exist (see \"Registry registration\" below).\n- **Checklist:** the migration checklist has already been seeded with one item per API (id `api_<ApiName>`, origin `2.0-upgrade`, status `pending`, `clearOnFinalize: false`). Legacy in-flight runs may still have `origin: \"seed_api\"` for these API items. Pull the live set by calling `build_manageChecklist` with `action: \"get\"` and filtering to `status: \"pending\"` plus API-migration origins (`origin: \"2.0-upgrade\"` or legacy `origin: \"seed_api\"`) \u2014 that is your authoritative API list and count for this turn.\n\n## Required reading (read these BEFORE writing any output)\n\nAuthoritative. If a rule here conflicts with your priors, these win.\n\n1. `node_modules/@superblocksteam/sdk-api/README.md` \u2014 whole thing (api() contract, execution model, `ctx.*`, exports, error classes, performance best practices, `useApi` frontend hook, integration method table).\n2. `node_modules/@superblocksteam/sdk-api/src/index.ts` (the **barrel**) \u2014 the authoritative list of exported factory names. Integration factory names are whatever this file exports, not whatever the directory name is. Never invent or case-fold a factory name without confirming it here.\n3. The README for **every integration** referenced by the YAMLs you convert:\n - `node_modules/@superblocksteam/sdk-api/src/integrations/<kind>/README.md`\n - If a vendor-specific factory exists for the target service (e.g., a dedicated one for a given LLM provider), prefer it over a generic HTTP one.\n4. `skills/system/superblocks-migration/references/yaml-block-mapping.md` \u2014 full YAML \u2192 TS mapping for each legacy block type.\n\nThere is **no `javascript` integration** in sdk-api \u2014 inline JS/TS lives directly inside `run(ctx, input)`. Any block whose YAML key is `javascript:` becomes plain TypeScript in `run()`. The same applies to **`python:` blocks**: there is no `python` integration in sdk-api, so port the body to inline TypeScript inside `run(ctx, input)` (see \"Substituting unsupported integrations\" below and the Python section in `yaml-block-mapping.md`).\n\n## Substituting unsupported integrations\n\nThe pre-migration UI warns the user when an app references integrations whose v2 plugin is not present in sdk-api. The migration is **not** aborted on those APIs \u2014 they are still in your `seed_api` checklist and you are expected to make a best-effort port rather than immediately marking them `failed`.\n\nSubstitution rules (apply in order; first match wins):\n\n1. **`python:` step \u2192 inline TypeScript.** Re-write the Python body as equivalent TypeScript inside `run(ctx, input)`, exactly the way `javascript:` blocks are inlined. Translate Python idioms to JS/TS (e.g. `requests.get(...)` \u2192 `fetch(...)`, list comprehensions \u2192 `array.map`/`filter`, `len(x)` \u2192 `x.length`, dict access \u2192 object property access, `os.environ[...]` \u2192 `process.env[...]`, raise/except \u2192 `throw`/`try\u2026catch`). If the Python relied on a third-party PyPI package with no obvious JS equivalent, mark that one API `failed` with a `failureReason` naming the package \u2014 do not ship a guess.\n2. **HTTP-shaped vendor plugin \u2192 REST.** If an unsupported integration was effectively making REST calls (e.g. a thin wrapper around an HTTP API) and you can read the request shape from the YAML, port it to the `restApi` factory from sdk-api (or the dedicated vendor factory if one exists in the barrel \u2014 check `node_modules/@superblocksteam/sdk-api/src/index.ts`).\n3. **Otherwise, mark `failed`.** Per the meta-rule, do not invent a factory or fabricate behavior. Use `build_manageChecklist` with `status: \"failed\"` and a concrete `failureReason` (e.g. `\"unsupported integration <pluginId> with no JS-equivalent path\"`).\n\nDo **not** silently skip a step or replace it with a `// TODO` \u2014 every API still needs a deterministic outcome (`completed` or `failed`) on the checklist.\n\n## Preflight gate (MUST pass before any file edits)\n\nComplete this orientation sequence before writing or modifying any API file:\n\n0. **Install recommended user dependencies (before API work).** The platform restructure already computed exactly which v2 user-added packages the migrated client/server code imports, and persisted them at `scratch/migration-state.json` \u2192 `recommendedUserDeps` (each entry has `name`, `version`, and `dev`). Your job is to install that list \u2014 not to recompute it.\n - Mark `migration_dependency_verification` as `in_progress` via `build_manageChecklist`.\n - Read `scratch/migration-state.json` and extract `recommendedUserDeps`.\n - If `recommendedUserDeps` is missing or empty, mark `migration_dependency_verification` as `completed` and continue to step 1.\n - Otherwise, call `build_installPackages` **once** with every entry from `recommendedUserDeps` (passing `name`, `version`, and `dev` through unchanged). Do **not** skip because `node_modules` exists on disk; the platform never wrote these packages into `package.json`.\n - **Failure semantics (covers every non-success outcome \u2014 no judgment calls):**\n - On full success \u2192 mark `migration_dependency_verification` as `completed`.\n - On **any** failure \u2014 full, partial (some packages installed, others did not), structured registry error (`not_in_registry`, `registry_auth_failed`, `registry_unreachable`), or unstructured error \u2014 mark `migration_dependency_verification` as `failed` with a `failureReason` that lists the affected package names and the tool's verbatim error code or message. Treat partial success the same as full failure for checklist purposes; do not split into multiple checklist items. Then continue to step 1 so API translation can still proceed. The user/operator will repair the registry/packages and re-trigger the migration turn.\n - If `scratch/migration-state.json` also contains `recommendedUserDepsPinnedToLatest` (a string array of package names), include those names in the `failureReason` of `migration_dependency_verification` even on full success \u2014 phrased as \"pinned to latest, may need user confirmation: <names>\" \u2014 so the user can downgrade them before runtime if the latest major is incompatible. Use status `completed` in this case (the install succeeded), but the surfaced reason gives the user a checkpoint to act on.\n - Do **not** scan imports yourself, edit `package.json`, or add packages outside `recommendedUserDeps`. If you believe a package is missing from the list, that is a platform bug: mark `migration_dependency_verification` as `failed` with `failureReason: \"platform bug: <pkg> imported by <file> but absent from recommendedUserDeps\"` and continue with API work using the packages that did install. (`build_manageChecklist` has no `note` action \u2014 `failed` with a structured `failureReason` is the only way to record this.)\n1. Call `build_manageChecklist` with `action: \"get\"` and filter to `status: \"pending\"` and API-migration origins (`origin: \"2.0-upgrade\"` or legacy `origin: \"seed_api\"`) \u2014 this is your authoritative API list and count for this turn.\n2. Read `node_modules/@superblocksteam/sdk-api/src/index.ts` and treat it as the **only** source of truth for sdk-api export/factory names.\n3. Read `node_modules/@superblocksteam/sdk-api/README.md`.\n4. For each API, read only the integration README(s) needed for that API right before migrating it (just-in-time). Do **not** preload every integration README for the entire app.\n\nHard constraints:\n\n- Do **not** rely on prior conversation memory, \"knowledge\" summaries, or inferred export names.\n- Do **not** start editing API files until preflight steps 0\u20133 are complete.\n- If a required file cannot be read, mark that API's checklist item `failed` with a concrete `failureReason` that names the missing path.\n\n## File layout & exports\n\n- One API per file, default export: `export default api({ ... });`.\n- Use ESM-style relative `.js` specifiers in imports.\n- File path: `server/apis/<ApiName>/api.ts` where `<ApiName>` is the YAML `metadata.name` (for example, `GetFloors` \u2192 `server/apis/GetFloors/api.ts`).\n- The `api({ name })` string and the registry key must both equal the YAML `metadata.name` verbatim \u2014 frontends call `useApi(\"<metadata.name>\")`.\n\n### Registry registration (conditional)\n\n- If `server/apis/index.ts` exists in the target tree: add an import + entry for each new module. Do not reorder existing entries.\n- If it does **not** exist: do **not** create it, do not create scaffolding. Mark the checklist item `failed` with a `failureReason` noting the missing registry.\n\n## Critical rules\n\n1. **Integration IDs are opaque per-YAML.** Extract each distinct `step.integration` UUID to a named `const` at the top of the file. Never carry UUIDs across files.\n2. **SQL: parameterize always.** Zero `${\u2026}` interpolations may remain inside any SQL string. Dynamic lists use `= ANY($N::<type>[])` \u2014 never string-building `IN (\u2026)`.\n3. **`query` vs `execute`.** Rows returned \u2192 `query` with Zod schema. Nothing actionable \u2192 `execute`.\n4. **Output shape preservation.** Mirror the legacy API's externally-visible response exactly \u2014 shape, nullability, cardinality. Do not wrap in envelopes.\n5. **Default is sequential.** `TYPE_FOREACH` \u2192 `for ... of` with sequential `await`. `Promise.all` only when YAML explicitly used a `parallel:` block.\n6. **Determinism, no slop.** No retries, no caching, no extra logging beyond a single `ctx.log.info(\"<ApiName> start\", {...})` at the top of `run`. No narrative code comments.\n7. **Never invent client methods.** If the integration README only documents `apiRequest`, use `apiRequest`.\n\n## Security / user identity\n\n- `authorization.type: AUTHORIZATION_TYPE_APP_USERS` is enforced by the server; rely on `ctx.user` in TS.\n- If the YAML accepts `userId` / `email` / etc. as API input, remove that input and read from `ctx.user` instead.\n\n## Observability\n\n- One `ctx.log.info(\"<ApiName> start\", { <safe-ids> })` at the top of `run` is allowed. Never log secrets, tokens, or PII.\n\n## Verification before you hand off\n\nRuntime verification (required):\n\n1. `build_debug` passing is required but not sufficient. Do not treat compile/typecheck success as proof that runtime behavior is correct.\n2. Use risk-based runtime checks: run `testApi` for APIs with integrations (REST/vendor/SQL), multi-step control flow, transformed outputs, or any uncertainty. For obviously simple APIs, you may skip `testApi`.\n3. If `testApi` output appears stale or mismatched, run `build_reloadFile` once and re-test. If runtime still fails after documented-method verification + one reload/retest cycle, record a concrete `failureReason` and continue.\n\nPage route verification (required once per migration run):\n\n**Hard rule:** A route is verified only with **runtime visual evidence on that exact path**. Reading `client/router.tsx`, page source, or backup artifacts is orientation only \u2014 it **never** satisfies verification.\n\n**Hard rule:** `build_debug` passing and `get_runtime_errors` returning `count: 0` are **not sufficient** for route verification. Do not mark routes `completed` because \"only APIs changed\" or \"the frontend files are unchanged.\"\n\n**Hard rule:** If `build_captureScreenshot` errors or times out for a route, mark that `migration_page_route_verification_*` item `failed` with `failureReason` naming the path and outcome (prefix `page_route_screenshot_timeout:` or `page_route_screenshot_error:`). Do **not** mark `completed`. Do **not** substitute router/source inspection.\n\n### Evidence required per route\n\nMark `completed` only when **all** are true:\n\n1. The app preview is on **that route's path** (not merely the default route).\n2. `build_captureScreenshot` **succeeds** and returns an image you inspect.\n3. You **describe** what you see and confirm it is not a loading-only view (follow the screenshot tool's skeleton/spinner retry procedure first).\n4. Any route-specific runtime errors are resolved (re-check after fixes).\n\n### Procedure (one route at a time)\n\n1. Enumerate checklist items whose IDs start with `migration_page_route_verification_`.\n2. Enumerate paths from `scratch/v2-backup/router.tsx` (fallback: `scratch/v2-backup/pages/**/index.tsx` confirmed against `client/router.tsx`).\n3. For each route: set the matching item `in_progress` \u2192 navigate the preview to that path (`browser_playwright_action` when available; otherwise use the editor route picker / navigation mechanism \u2014 **do not** screenshot whatever route happens to be visible) \u2192 `build_captureScreenshot` \u2192 on success, `completed`.\n4. If the preview looks stale, `build_reloadFile` **once**, then retry screenshot. If capture still fails, `failed` with `failureReason` as above.\n5. Fix import/lazy-load/runtime failures, then repeat from step 3 for that route.\n\n### Forbidden shortcuts\n\n- Marking `completed` because `client/router.tsx` lists the path\n- Marking `completed` because the page module exists under `client/pages/`\n- Marking `completed` after screenshot timeout/error\n- Batch-marking all route items without per-route screenshot evidence\n\nFor each converted API, self-check:\n\n1. File default-exports exactly one `api({...})`; `name` matches `metadata.name`.\n2. Zero `${\u2026}` interpolations remain in any SQL string.\n3. No SQL `IN (\u2026)` built by concatenation; dynamic lists use `= ANY($N::<type>[])`.\n4. Every prior block's `.output` read is replaced by an actual result `const`.\n5. Input is the minimal union of identifiers the YAML references that are not produced by earlier blocks or `Variables`.\n6. Output shape exactly mirrors the legacy API's external response.\n7. If `server/apis/index.ts` exists, it registers the new module under `metadata.name`.\n\n## Parallelization policy\n\nCount pending APIs from the checklist (`build_manageChecklist` `action: \"get\"`, filter `status: \"pending\"` and API-migration origins: `origin: \"2.0-upgrade\"` or legacy `origin: \"seed_api\"`).\n\n- **If the pending count is `< 8`:** migrate the APIs yourself, sequentially. Do NOT call `spawnCodingSubagents`. Work through each API using the per-API procedure below.\n- **If the pending count is `>= 8`:** you **MUST spawn sub-agents** to migrate these APIs in parallel. There are too many APIs to migrate sequentially yourself. Do NOT attempt to migrate APIs yourself in this run \u2014 use `spawnCodingSubagents`.\n - Split the APIs into batches of ~5 (aim for 4\u20136 per batch), with a hard cap of **5 sub-agents total**. If more than 25 APIs remain, give later batches larger shares rather than spawning more than 5 workers.\n - For each batch, craft an `instructions` string that:\n - Names the exact `<ApiName>` values that sub-agent owns, verbatim, as a bulleted list.\n - Restates the per-API procedure below so the sub-agent is self-contained.\n - Reminds the sub-agent to update the shared checklist (id `api_<ApiName>`) for every item it owns.\n - **Also pass `apiNames: [\"<ApiName1>\", \"<ApiName2>\", \u2026]` for every sub-agent**, listing the same names that appear in its `instructions`. The spawn tool stamps each `api_<ApiName>` checklist item with that sub-agent's `id` as `workerId` BEFORE fan-out, which lets the migration UI render one batch row per sub-agent in the chat sidebar. Forgetting `apiNames` is non-fatal (the sub-agents still run) but the sidebar checklist will fall back to one row per API instead of one per batch.\n - **Call `spawnCodingSubagents` as the ONLY tool call in that turn.** Do not emit any other tool calls alongside it \u2014 no reads, no writes, no checklist updates. The tool blocks until every sub-agent finishes; you cannot do migration work \"while waiting\" because there is no waiting from your perspective \u2014 your next turn only begins after the tool returns. If you emit other tool calls in the same turn, you and the sub-agents will race on the shared checklist and corrupt state.\n - **After `spawnCodingSubagents` returns** \u2014 only in a subsequent turn \u2014 read the checklist via `build_manageChecklist` with `action: \"get\"`. For any `failed` items, review the `failureReason`. Retry small numbers of recoverable failures yourself (sequentially, using the per-API procedure below). Leave deterministic failures as `failed`.\n\n## Per-API procedure\n\nFor APIs you migrate yourself, or that you embed in a sub-agent's `instructions`:\n\n1. Call `build_manageChecklist` with `action: \"update\"`, `itemId: \"api_<ApiName>\"`, `status: \"in_progress\"`.\n2. Read `scratch/v2-backup/apis/<ApiName>/api.yaml` and any sibling files the blocks reference.\n3. Produce the TypeScript module at `server/apis/<ApiName>/api.ts`, overwriting the stub. Use the YAML block \u2192 TS mapping in `skills/system/superblocks-migration/references/yaml-block-mapping.md`.\n4. If `server/apis/index.ts` exists, update it to register the new module.\n5. Call `build_debug`. If it fails, fix and repeat until it passes. Do not proceed to step 6 until `build_debug` succeeds.\n6. **Call `runMigrationVerification({ apiName: \"<ApiName>\", inputs: <inputs> })` and resolve every divergence in this same chat.** The tool's response includes `attempt` and `maxAttempts` so you don't need to track an attempt counter yourself \u2014 the server reads it from on-disk history per API.\n\n Your job is to make v3 produce the same response as v2 \u2014 not to \"try a few times and punt to the user\". The user already lived with this API working on v2 with their real data; if v3 doesn't match, that's a regression you introduced, and you fix it here. NEVER leave a `diverged` API for the user to \"Accept divergence\" or \"Try one more attempt\" via the API calls panel \u2014 those buttons exist as escape hatches for situations the policy gate requires (mutations, denied integrations), not as a way for you to skip work.\n\n Synthesize `inputs` the same way you would for `testApi`: inspect the v2 YAML from step 2 and the v3 TS from step 3, enumerate every binding the API references that isn't produced by an earlier block (component values like `Input1.value`/`Select1.selectedItem.id`, table selections like `Table1.selectedRow`, state variables, workflow `body`/`params`), and pick a realistic mock value for each matching the binding's expected type. Both v2 and v3 receive the same `inputs`, so this is what makes the diff meaningful \u2014 `{}` for an API with bindings produces a vacuous `both_failed` that tells you nothing.\n\n Outcomes and how to resolve them:\n - **`passed`**: call `build_manageChecklist` with `status: \"completed\"`. Done.\n\n - **`skipped_mutation`**: this is a policy gate, not a deterministic pass. Do **NOT** mark the checklist item `completed` yet. Leave it unresolved (keep `in_progress`), continue processing other APIs, and resolve all skipped items in one grouped decision at the end of the run (see \"Mutation policy follow-up\" below).\n\n - **`v2_unrunnable`**: the v2 backup itself couldn't execute, so there is no baseline to match. Call `build_manageChecklist` with `status: \"completed\"` and continue.\n\n - **`both_failed`**:\n - If you passed `inputs: {}` and the API references bindings: synthesize real `inputs` (per the bullet above) and retry. Do NOT mark completed here \u2014 empty inputs caused this, not a real failure.\n - If you passed real inputs and v2 still failed: read v2's error. If it is environmental (auth/credentials/integration-unavailable: \"no integration configured\", \"401\", \"ECONNREFUSED\", \"missing API key\"), v2 cannot run in this verification context regardless of what you do \u2014 call `build_manageChecklist` with `status: \"completed\"` and continue; the user will verify manually. If it's a v2 runtime error that v3 also reproduces, treat as `diverged` (your inputs are wrong, or the API expects state that isn't reproducible here \u2014 revise inputs and retry).\n\n - **`error`**: a system error in the verification flow itself (cannot read v3 source, etc.). Fix what you can; if it persists across one retry, mark the item `failed` with `failureReason: \"<error detail>\"` and continue.\n\n- **`diverged`**: the API ran on both sides and the outputs differ. **Iterate until v3 matches v2 byte-for-byte (modulo the normalizations api-comparator already applies: identical ISO timestamps, near-now ISO timestamps within \u00B160s of each other and \u00B15min of \"now\", UUIDs, monotonic integer IDs differing by \u22641 on fields whose leaf ends with \"id\", floats within 1e-9 relative tolerance, and per-request opaque identifiers at leaves named `requestId`/`traceId`/`spanId`/`correlationId`/`sessionId`/`nonce`/`csrfToken`/`_id` \u2014 note: a bare leaf named `token` is intentionally NOT normalized, since auth/access-token divergence is a security-relevant signal we want to surface).**\n\n There is one bounded judgment exception: if both v2 and v3 executions succeeded, the output shape/types are equivalent, and the remaining diffs are value-level fields you reasonably infer are inherently non-deterministic outputs for this API, treat the migration as semantically complete for this run. In that case, mark the checklist item `completed` and continue.\n\n Use this exception only when all of the following are true:\n - The divergence is not structural (no missing/extra fields, no type mismatch, no changed nesting/cardinality, no changed error/status behavior).\n - The differing fields are expected to vary per invocation and do not change control flow decisions.\n - The API's functional contract remains intact for downstream consumers.\n\n If any of those conditions are not met, the divergence is semantic and must be fixed \u2014 do NOT add code purely to mask values the comparator already tolerates.\n\n For each `summaryForAgent` entry \u2014 every entry names the JSON path that diverged and the v2/v3 values \u2014 find the block in `server/apis/<ApiName>/api.ts` that produces that path and fix the discrepancy. Common causes, in rough order of frequency:\n - wrong column projection or missing field in a SELECT\n - missing transform / output shape mismatch (array vs object wrapper, single vs list)\n - off-by-one or wrong placeholder in a SQL parameter\n - mistyped binding key (case, plural, dotted path)\n - type coercion (string vs number, null vs undefined, boolean vs \"true\")\n - missing default value when the binding is undefined\n - wrong join order or implicit ordering of rows\n - filter/where condition different from v2\n - missing `LIMIT`, `OFFSET`, or pagination handling\n\n If a divergence stems from the `inputs` you passed (e.g. v2 echoes the input one way and v3 a different way because they normalize it differently), revise the inputs alongside the source.\n\n Then call `build_debug` (fix any failures), then `runMigrationVerification` again with the revised source/inputs.\n\n **There is no fixed retry budget \u2014 iterate until `passed` or until you have firm structural evidence that no v3 source change can reconcile v2 and v3.** Acceptable evidence for stopping: v2 references a YAML construct with no v3 SDK equivalent and the divergence is in that construct; v2 derives a value from runtime state v3 cannot observe (e.g. an env var that differs by environment). When you stop on structural grounds, mark the item `failed` with `failureReason: \"verification_diverged_irreconcilable: <one-paragraph reason naming the specific summaryForAgent entry and the structural reason> | summary: <JSON.stringify(summaryForAgent)>\"`.\n\n Guardrail against infinite loops (NOT a retry budget): if you have iterated 8 times on the same API and the set of divergences has not materially changed across the last 3 attempts (i.e. you are flailing, not converging), stop and mark `failed` with the same `failureReason` shape. If you ARE converging \u2014 fewer divergences each attempt, or the remaining ones look smaller \u2014 keep going past 8.\n\n## Run-level rules\n\n- Do NOT emit a free-text UNRESOLVED report \u2014 every unresolved item must be a `failed` checklist entry with a `failureReason`.\n- Do NOT stop the run because one API failed. Only stop once every API is either `completed` or `failed`.\n\n## Mutation policy follow-up (required once per run if any API returned `skipped_mutation`)\n\nAfter you've done everything deterministic (all non-skipped APIs settled), if one or more APIs ended with `skipped_mutation`, call **one** grouped `askMultiChoice` with exactly these options:\n\n- `Mark all untested APIs as complete`\n- `Test them, and you'll be prompted for permission`\n\nThen:\n\n1. If user picks **`Mark all untested APIs as complete`**:\n - For each skipped API checklist item, call `build_manageChecklist` update \u2192 `status: \"completed\"`.\n2. If user picks **`Test them, and you'll be prompted for permission`**:\n - Clear persisted write-policy first so `deny`/`ask` modal state does not keep forcing `skipped_mutation`:\n - read `scratch/migration-state.json`\n - remove the `integrationWritePolicy` field\n - write the file back\n - Then run `testApi` for each skipped API so the runtime can prompt the user for write approval in-context.\n - After user approvals and tests settle, update checklist status accordingly (`completed` on success, `failed` with concrete `failureReason` on deterministic blockers).\n\n## Post-batch re-verification\n\nAfter `spawnCodingSubagents` returns (or after all sequential APIs are settled), before updating the checklist overall status:\n\n1. Call `build_manageChecklist` with `action: \"get\"` and read all items.\n2. For any item where `verificationOutcome === \"auto_passed\"` and `lastVerificationAt` is older than any sibling item's `updatedAt` minus 60 seconds: this item may have drifted due to registry edits made by later sub-agents. Re-run `runMigrationVerification({ apiName, inputs: <inputs> })` for each such item \u2014 synthesize `inputs` the same way as in step 6 of the per-API procedure.\n3. If any re-verification produces `diverged`, apply the normal per-API diverge\u2192retry loop (no fixed retry budget; iterate until `passed` or firm structural-irreconcilability evidence, with the anti-flail guardrail at 8 iterations without convergence).\n4. Proceed to mark overall checklist completed/failed only after all re-verifications settle.\n";
1
+ export declare const content = "---\nname: superblocks-migration\ndescription: |\n Convert legacy Superblocks 2.0 YAML APIs (\"block-chain\" format) to the new 3.0 sdk-api TypeScript format.\n Load when executing a v2\u2192v3 migration turn \u2014 the runtime prompt will tell you to.\nreadOnly: true\nmetadata:\n author: superblocks\n version: \"1.0\"\n---\n\n# v2 \u2192 v3 API Translation\n\nYou are converting **legacy Superblocks \"block-chain\" YAML APIs** into the **new code-mode `@superblocksteam/sdk-api` TypeScript format**. Each YAML file under `scratch/v2-backup/apis/<ApiName>/api.yaml` must be emitted as a single TypeScript file at `server/apis/<ApiName>/api.ts` that compiles, typechecks, and preserves behavior exactly.\n\n## Meta-rule: ZERO judgment calls\n\nIf any situation below is not resolved deterministically by this document, **STOP** for that API. Do **not** pick a default. Do **not** guess a factory, a shape, or an import. Skip it, continue with other APIs, and mark the checklist item as `failed` via `build_manageChecklist` with a short `failureReason` describing the exact ambiguity (failing rule, block name if any, what would be needed to proceed). This rule overrides everything else.\n\nCorollary: do not add `// TODO` comments that silently ship. Unresolved items live only as `failed` checklist entries.\n\nCorollary for `migration_page_route_verification_*`: see the _Page route verification_ section below \u2014 screenshot timeout/error \u2192 `failed`, never `completed`, never \"verified via router/source inspection.\" The full rule (including the hard-rule restatements) lives there to avoid drift.\n\n## Inputs and outputs\n\n- **Source tree:** `scratch/v2-backup/apis/<ApiName>/api.yaml`. Discover the actual set by listing the directory \u2014 do not hardcode a count or list.\n- **Target tree:** `server/apis/<ApiName>/api.ts`. Do not create scaffolding trees that do not already exist (see \"Registry registration\" below).\n- **Checklist:** the migration checklist has already been seeded with one item per API (id `api_<ApiName>`, origin `2.0-upgrade`, status `pending`, `clearOnFinalize: false`). Legacy in-flight runs may still have `origin: \"seed_api\"` for these API items. Pull the live set by calling `build_manageChecklist` with `action: \"get\"` and filtering to `status: \"pending\"` plus API-migration origins (`origin: \"2.0-upgrade\"` or legacy `origin: \"seed_api\"`) \u2014 that is your authoritative API list and count for this turn.\n\n## Required reading (read these BEFORE writing any output)\n\nAuthoritative. If a rule here conflicts with your priors, these win.\n\n1. `node_modules/@superblocksteam/sdk-api/README.md` \u2014 whole thing (api() contract, execution model, `ctx.*`, exports, error classes, performance best practices, `useApi` frontend hook, integration method table).\n2. `node_modules/@superblocksteam/sdk-api/src/index.ts` (the **barrel**) \u2014 the authoritative list of exported factory names. Integration factory names are whatever this file exports, not whatever the directory name is. Never invent or case-fold a factory name without confirming it here.\n3. The README for **every integration** referenced by the YAMLs you convert:\n - `node_modules/@superblocksteam/sdk-api/src/integrations/<kind>/README.md`\n - If a vendor-specific factory exists for the target service (e.g., a dedicated one for a given LLM provider), prefer it over a generic HTTP one.\n4. `skills/system/superblocks-migration/references/yaml-block-mapping.md` \u2014 full YAML \u2192 TS mapping for each legacy block type.\n\nThere is **no `javascript` integration** in sdk-api \u2014 inline JS/TS lives directly inside `run(ctx, input)`. Any block whose YAML key is `javascript:` becomes plain TypeScript in `run()`. The same applies to **`python:` blocks**: there is no `python` integration in sdk-api, so port the body to inline TypeScript inside `run(ctx, input)` (see \"Substituting unsupported integrations\" below and the Python section in `yaml-block-mapping.md`).\n\n## Substituting unsupported integrations\n\nThe pre-migration UI warns the user when an app references integrations whose v2 plugin is not present in sdk-api. The migration is **not** aborted on those APIs \u2014 they are still in your `seed_api` checklist and you are expected to make a best-effort port rather than immediately marking them `failed`.\n\nSubstitution rules (apply in order; first match wins):\n\n1. **`python:` step \u2192 inline TypeScript.** Re-write the Python body as equivalent TypeScript inside `run(ctx, input)`, exactly the way `javascript:` blocks are inlined. Translate Python idioms to JS/TS (e.g. `requests.get(...)` \u2192 `fetch(...)`, list comprehensions \u2192 `array.map`/`filter`, `len(x)` \u2192 `x.length`, dict access \u2192 object property access, `os.environ[...]` \u2192 `process.env[...]`, raise/except \u2192 `throw`/`try\u2026catch`). If the Python relied on a third-party PyPI package with no obvious JS equivalent, mark that one API `failed` with a `failureReason` naming the package \u2014 do not ship a guess.\n2. **HTTP-shaped vendor plugin \u2192 REST.** If an unsupported integration was effectively making REST calls (e.g. a thin wrapper around an HTTP API) and you can read the request shape from the YAML, port it to the `restApi` factory from sdk-api (or the dedicated vendor factory if one exists in the barrel \u2014 check `node_modules/@superblocksteam/sdk-api/src/index.ts`).\n3. **Otherwise, mark `failed`.** Per the meta-rule, do not invent a factory or fabricate behavior. Use `build_manageChecklist` with `status: \"failed\"` and a concrete `failureReason` (e.g. `\"unsupported integration <pluginId> with no JS-equivalent path\"`).\n\nDo **not** silently skip a step or replace it with a `// TODO` \u2014 every API still needs a deterministic outcome (`completed` or `failed`) on the checklist.\n\n## Preflight gate (MUST pass before any file edits)\n\nComplete this orientation sequence before writing or modifying any API file:\n\n0. **Install recommended user dependencies (before API work).** The platform restructure already computed exactly which v2 user-added packages the migrated client/server code imports, and persisted them at `scratch/migration-state.json` \u2192 `recommendedUserDeps` (each entry has `name`, `version`, and `dev`). Your job is to install that list \u2014 not to recompute it.\n - Mark `migration_dependency_verification` as `in_progress` via `build_manageChecklist`.\n - Read `scratch/migration-state.json` and extract `recommendedUserDeps`.\n - If `recommendedUserDeps` is missing or empty, mark `migration_dependency_verification` as `completed` and continue to step 1.\n - Otherwise, call `build_installPackages` **once** with every entry from `recommendedUserDeps` (passing `name`, `version`, and `dev` through unchanged). Do **not** skip because `node_modules` exists on disk; the platform never wrote these packages into `package.json`.\n - **Failure semantics (covers every non-success outcome \u2014 no judgment calls):**\n - On full success \u2192 mark `migration_dependency_verification` as `completed`.\n - On **any** failure \u2014 full, partial (some packages installed, others did not), structured registry error (`not_in_registry`, `registry_auth_failed`, `registry_unreachable`), or unstructured error \u2014 mark `migration_dependency_verification` as `failed` with a `failureReason` that lists the affected package names and the tool's verbatim error code or message. Treat partial success the same as full failure for checklist purposes; do not split into multiple checklist items. Then continue to step 1 so API translation can still proceed. The user/operator will repair the registry/packages and re-trigger the migration turn.\n - If `scratch/migration-state.json` also contains `recommendedUserDepsPinnedToLatest` (a string array of package names), include those names in the `failureReason` of `migration_dependency_verification` even on full success \u2014 phrased as \"pinned to latest, may need user confirmation: <names>\" \u2014 so the user can downgrade them before runtime if the latest major is incompatible. Use status `completed` in this case (the install succeeded), but the surfaced reason gives the user a checkpoint to act on.\n - Do **not** scan imports yourself, edit `package.json`, or add packages outside `recommendedUserDeps`. If you believe a package is missing from the list, that is a platform bug: mark `migration_dependency_verification` as `failed` with `failureReason: \"platform bug: <pkg> imported by <file> but absent from recommendedUserDeps\"` and continue with API work using the packages that did install. (`build_manageChecklist` has no `note` action \u2014 `failed` with a structured `failureReason` is the only way to record this.)\n1. Call `build_manageChecklist` with `action: \"get\"` and filter to `status: \"pending\"` and API-migration origins (`origin: \"2.0-upgrade\"` or legacy `origin: \"seed_api\"`) \u2014 this is your authoritative API list and count for this turn.\n2. Read `node_modules/@superblocksteam/sdk-api/src/index.ts` and treat it as the **only** source of truth for sdk-api export/factory names.\n3. Read `node_modules/@superblocksteam/sdk-api/README.md`.\n4. For each API, read only the integration README(s) needed for that API right before migrating it (just-in-time). Do **not** preload every integration README for the entire app.\n\nHard constraints:\n\n- Do **not** rely on prior conversation memory, \"knowledge\" summaries, or inferred export names.\n- Do **not** start editing API files until preflight steps 0\u20133 are complete.\n- If a required file cannot be read, mark that API's checklist item `failed` with a concrete `failureReason` that names the missing path.\n\n## File layout & exports\n\n- One API per file, default export: `export default api({ ... });`.\n- Use ESM-style relative `.js` specifiers in imports.\n- File path: `server/apis/<ApiName>/api.ts` where `<ApiName>` is the YAML `metadata.name` (for example, `GetFloors` \u2192 `server/apis/GetFloors/api.ts`).\n- The `api({ name })` string and the registry key must both equal the YAML `metadata.name` verbatim \u2014 frontends call `useApi(\"<metadata.name>\")`.\n\n### Registry registration (conditional)\n\n- If `server/apis/index.ts` exists in the target tree: add an import + entry for each new module. Do not reorder existing entries.\n- If it does **not** exist: do **not** create it, do not create scaffolding. Mark the checklist item `failed` with a `failureReason` noting the missing registry.\n\n## Critical rules\n\n1. **Integration IDs are opaque per-YAML.** Extract each distinct `step.integration` UUID to a named `const` at the top of the file. Never carry UUIDs across files.\n2. **SQL: parameterize always.** Zero `${\u2026}` interpolations may remain inside any SQL string. Dynamic lists use `= ANY($N::<type>[])` \u2014 never string-building `IN (\u2026)`.\n3. **`query` vs `execute`.** Rows returned \u2192 `query` with Zod schema. Nothing actionable \u2192 `execute`.\n4. **Output shape preservation.** Mirror the legacy API's externally-visible response exactly \u2014 shape, nullability, cardinality. Do not wrap in envelopes.\n5. **Default is sequential.** `TYPE_FOREACH` \u2192 `for ... of` with sequential `await`. `Promise.all` only when YAML explicitly used a `parallel:` block.\n6. **Determinism, no slop.** No retries, no caching, no extra logging beyond a single `ctx.log.info(\"<ApiName> start\", {...})` at the top of `run`. No narrative code comments.\n7. **Never invent client methods.** If the integration README only documents `apiRequest`, use `apiRequest`.\n\n## Security / user identity\n\n- `authorization.type: AUTHORIZATION_TYPE_APP_USERS` is enforced by the server; rely on `ctx.user` in TS.\n- If the YAML accepts `userId` / `email` / etc. as API input, remove that input and read from `ctx.user` instead.\n\n## Observability\n\n- One `ctx.log.info(\"<ApiName> start\", { <safe-ids> })` at the top of `run` is allowed. Never log secrets, tokens, or PII.\n\n## Verification before you hand off\n\nRuntime verification (required):\n\n1. `build_debug` passing is required but not sufficient. Do not treat compile/typecheck success as proof that runtime behavior is correct.\n2. Use risk-based runtime checks: run `testApi` for APIs with integrations (REST/vendor/SQL), multi-step control flow, transformed outputs, or any uncertainty. For obviously simple APIs, you may skip `testApi`.\n3. If `testApi` output appears stale or mismatched, run `build_reloadFile` once and re-test. If runtime still fails after documented-method verification + one reload/retest cycle, record a concrete `failureReason` and continue.\n\nPage route verification (required once per migration run):\n\n**Hard rule:** A route is verified only with **runtime visual evidence on that exact path**. Reading `client/router.tsx`, page source, or backup artifacts is orientation only \u2014 it **never** satisfies verification.\n\n**Hard rule:** `build_debug` passing and `get_runtime_errors` returning `count: 0` are **not sufficient** for route verification. Do not mark routes `completed` because \"only APIs changed\" or \"the frontend files are unchanged.\"\n\n**Hard rule:** If `build_captureScreenshot` errors or times out for a route, mark that `migration_page_route_verification_*` item `failed` with `failureReason` naming the path and outcome (prefix `page_route_screenshot_timeout:` or `page_route_screenshot_error:`). Do **not** mark `completed`. Do **not** substitute router/source inspection.\n\n### Evidence required per route\n\nMark `completed` only when **all** are true:\n\n1. The app preview is on **that route's path** (not merely the default route).\n2. `build_captureScreenshot` **succeeds** and returns an image you inspect.\n3. You **describe** what you see and confirm it is not a loading-only view (follow the screenshot tool's skeleton/spinner retry procedure first).\n4. Any route-specific runtime errors are resolved (re-check after fixes).\n\n### Procedure (one route at a time)\n\n1. Enumerate checklist items whose IDs start with `migration_page_route_verification_`.\n2. Enumerate paths from `scratch/v2-backup/router.tsx` (fallback: `scratch/v2-backup/pages/**/index.tsx` confirmed against `client/router.tsx`).\n3. For each route: set the matching item `in_progress` \u2192 `build_navigatePreview` with that path \u2192 `build_captureScreenshot` \u2192 on success, `completed`.\n4. If the preview looks stale, `build_reloadFile` **once**, then retry screenshot. If capture still fails, `failed` with `failureReason` as above.\n5. Fix import/lazy-load/runtime failures, then repeat from step 3 for that route.\n\n### Forbidden shortcuts\n\n- Marking `completed` because `client/router.tsx` lists the path\n- Marking `completed` because the page module exists under `client/pages/`\n- Marking `completed` after screenshot timeout/error\n- Batch-marking all route items without per-route screenshot evidence\n\nFor each converted API, self-check:\n\n1. File default-exports exactly one `api({...})`; `name` matches `metadata.name`.\n2. Zero `${\u2026}` interpolations remain in any SQL string.\n3. No SQL `IN (\u2026)` built by concatenation; dynamic lists use `= ANY($N::<type>[])`.\n4. Every prior block's `.output` read is replaced by an actual result `const`.\n5. Input is the minimal union of identifiers the YAML references that are not produced by earlier blocks or `Variables`.\n6. Output shape exactly mirrors the legacy API's external response.\n7. If `server/apis/index.ts` exists, it registers the new module under `metadata.name`.\n8. **sdk-api integration wiring:** declare each integration in an `integrations: { \u2026 }` block and call it via `ctx.integrations.<key>` \u2014 never call `postgres(ID)` / `github(ID)` / etc. inside `run()` as if they were clients.\n9. **`input` / `output` schemas:** both are Zod schemas (`input: z.object({\u2026})`, `output: z.\u2026`). Do not use plain `{ field: { type: \"string\" } }` objects.\n10. **`run` signature:** `async run(ctx, input)` (or destructured input fields as the second argument). Never import `ctx` from the module scope.\n\n## Parallelization policy\n\nCount pending APIs from the checklist (`build_manageChecklist` `action: \"get\"`, filter `status: \"pending\"` and API-migration origins: `origin: \"2.0-upgrade\"` or legacy `origin: \"seed_api\"`).\n\n- **If the pending count is `< 8`:** migrate the APIs yourself, sequentially. Do NOT call `spawnCodingSubagents`. Work through each API using the per-API procedure below.\n- **If the pending count is `>= 8`:** you **MUST spawn sub-agents** to migrate these APIs in parallel. There are too many APIs to migrate sequentially yourself. Do NOT attempt to migrate APIs yourself in this run \u2014 use `spawnCodingSubagents`.\n - Split the APIs into batches of ~5 (aim for 4\u20136 per batch), with a hard cap of **5 sub-agents total**. If more than 25 APIs remain, give later batches larger shares rather than spawning more than 5 workers.\n - For each batch, craft an `instructions` string that:\n - Names the exact `<ApiName>` values that sub-agent owns, verbatim, as a bulleted list.\n - **Directs the sub-agent to `build_readFile` `skills/system/superblocks-migration/SKILL.md` (and the integration README(s) for the APIs it owns) before writing any files.** Do not inline a shortened sdk-api contract \u2014 keep a single source of truth.\n - Restates the per-API procedure below so the sub-agent is self-contained.\n - Reminds the sub-agent to update the shared checklist (id `api_<ApiName>`) for every item it owns.\n - **Also pass `apiNames: [\"<ApiName1>\", \"<ApiName2>\", \u2026]` for every sub-agent**, listing the same names that appear in its `instructions`. The spawn tool stamps each `api_<ApiName>` checklist item with that sub-agent's `id` as `workerId` BEFORE fan-out, which lets the migration UI render one batch row per sub-agent in the chat sidebar. Forgetting `apiNames` is non-fatal (the sub-agents still run) but the sidebar checklist will fall back to one row per API instead of one per batch.\n - **Call `spawnCodingSubagents` as the ONLY tool call in that turn.** Do not emit any other tool calls alongside it \u2014 no reads, no writes, no checklist updates. The tool blocks until every sub-agent finishes; you cannot do migration work \"while waiting\" because there is no waiting from your perspective \u2014 your next turn only begins after the tool returns. If you emit other tool calls in the same turn, you and the sub-agents will race on the shared checklist and corrupt state.\n - **After `spawnCodingSubagents` returns** \u2014 only in a subsequent turn \u2014 read the checklist via `build_manageChecklist` with `action: \"get\"`. For any `failed` items, review the `failureReason`. Retry small numbers of recoverable failures yourself (sequentially, using the per-API procedure below). Leave deterministic failures as `failed`.\n\n## Per-API procedure\n\nFor APIs you migrate yourself, or that you embed in a sub-agent's `instructions`:\n\n1. Call `build_manageChecklist` with `action: \"update\"`, `itemId: \"api_<ApiName>\"`, `status: \"in_progress\"`.\n2. Read `scratch/v2-backup/apis/<ApiName>/api.yaml` and any sibling files the blocks reference.\n3. Produce the TypeScript module at `server/apis/<ApiName>/api.ts`, overwriting the stub. Use the YAML block \u2192 TS mapping in `skills/system/superblocks-migration/references/yaml-block-mapping.md`.\n4. If `server/apis/index.ts` exists, update it to register the new module.\n5. Call `build_debug`. If it fails, fix and repeat until it passes. Do not proceed to step 6 until `build_debug` succeeds.\n6. **Call `runMigrationVerification({ apiName: \"<ApiName>\", inputs: <inputs> })` and resolve every divergence in this same chat.** The tool's response includes `attempt` and `maxAttempts` so you don't need to track an attempt counter yourself \u2014 the server reads it from on-disk history per API.\n\n Your job is to make v3 produce the same response as v2 \u2014 not to \"try a few times and punt to the user\". The user already lived with this API working on v2 with their real data; if v3 doesn't match, that's a regression you introduced, and you fix it here. NEVER leave a `diverged` API for the user to \"Accept divergence\" or \"Try one more attempt\" via the API calls panel \u2014 those buttons exist as escape hatches for situations the policy gate requires (mutations, denied integrations), not as a way for you to skip work.\n\n Synthesize `inputs` the same way you would for `testApi`: inspect the v2 YAML from step 2 and the v3 TS from step 3, enumerate every binding the API references that isn't produced by an earlier block (component values like `Input1.value`/`Select1.selectedItem.id`, table selections like `Table1.selectedRow`, state variables, workflow `body`/`params`), and pick a realistic mock value for each matching the binding's expected type. Both v2 and v3 receive the same `inputs`, so this is what makes the diff meaningful \u2014 `{}` for an API with bindings produces a vacuous `both_failed` that tells you nothing.\n\n Outcomes and how to resolve them:\n - **`passed`**: call `build_manageChecklist` with `status: \"completed\"`. Done.\n\n **Platform gate:** the checklist store rejects `status: \"completed\"` on `api_<ApiName>` items until verification has run at least once (`lastVerificationAt` is set \u2014 normally via this tool). You cannot bulk-mark APIs complete without calling `runMigrationVerification` per API.\n - **`skipped_mutation`**: this is a policy gate, not a deterministic pass. Do **NOT** mark the checklist item `completed` yet. Leave it unresolved (keep `in_progress`), continue processing other APIs, and resolve all skipped items in one grouped decision at the end of the run (see \"Mutation policy follow-up\" below).\n\n - **`v2_unrunnable`**: the v2 backup itself couldn't execute, so there is no baseline to match. Call `build_manageChecklist` with `status: \"completed\"` and continue.\n\n - **`both_failed`**:\n - If you passed `inputs: {}` and the API references bindings: synthesize real `inputs` (per the bullet above) and retry. Do NOT mark completed here \u2014 empty inputs caused this, not a real failure.\n - If you passed real inputs and v2 still failed: read v2's error. If it is environmental (auth/credentials/integration-unavailable: \"no integration configured\", \"401\", \"ECONNREFUSED\", \"missing API key\"), v2 cannot run in this verification context regardless of what you do \u2014 call `build_manageChecklist` with `status: \"completed\"` and continue; the user will verify manually. If it's a v2 runtime error that v3 also reproduces, treat as `diverged` (your inputs are wrong, or the API expects state that isn't reproducible here \u2014 revise inputs and retry).\n\n - **`error`**: a system error in the verification flow itself (cannot read v3 source, etc.). Fix what you can; if it persists across one retry, mark the item `failed` with `failureReason: \"<error detail>\"` and continue.\n\n- **`diverged`**: the API ran on both sides and the outputs differ. **Iterate until v3 matches v2 byte-for-byte (modulo the normalizations api-comparator already applies: identical ISO timestamps, near-now ISO timestamps within \u00B160s of each other and \u00B15min of \"now\", UUIDs, monotonic integer IDs differing by \u22641 on fields whose leaf ends with \"id\", floats within 1e-9 relative tolerance, and per-request opaque identifiers at leaves named `requestId`/`traceId`/`spanId`/`correlationId`/`sessionId`/`nonce`/`csrfToken`/`_id` \u2014 note: a bare leaf named `token` is intentionally NOT normalized, since auth/access-token divergence is a security-relevant signal we want to surface).**\n\n There is one bounded judgment exception: if both v2 and v3 executions succeeded, the output shape/types are equivalent, and the remaining diffs are value-level fields you reasonably infer are inherently non-deterministic outputs for this API, treat the migration as semantically complete for this run. In that case, mark the checklist item `completed` and continue.\n\n Use this exception only when all of the following are true:\n - The divergence is not structural (no missing/extra fields, no type mismatch, no changed nesting/cardinality, no changed error/status behavior).\n - The differing fields are expected to vary per invocation and do not change control flow decisions.\n - The API's functional contract remains intact for downstream consumers.\n\n If any of those conditions are not met, the divergence is semantic and must be fixed \u2014 do NOT add code purely to mask values the comparator already tolerates.\n\n For each `summaryForAgent` entry \u2014 every entry names the JSON path that diverged and the v2/v3 values \u2014 find the block in `server/apis/<ApiName>/api.ts` that produces that path and fix the discrepancy. Common causes, in rough order of frequency:\n - wrong column projection or missing field in a SELECT\n - missing transform / output shape mismatch (array vs object wrapper, single vs list)\n - off-by-one or wrong placeholder in a SQL parameter\n - mistyped binding key (case, plural, dotted path)\n - type coercion (string vs number, null vs undefined, boolean vs \"true\")\n - missing default value when the binding is undefined\n - wrong join order or implicit ordering of rows\n - filter/where condition different from v2\n - missing `LIMIT`, `OFFSET`, or pagination handling\n\n If a divergence stems from the `inputs` you passed (e.g. v2 echoes the input one way and v3 a different way because they normalize it differently), revise the inputs alongside the source.\n\n Then call `build_debug` (fix any failures), then `runMigrationVerification` again with the revised source/inputs.\n\n **There is no fixed retry budget \u2014 iterate until `passed` or until you have firm structural evidence that no v3 source change can reconcile v2 and v3.** Acceptable evidence for stopping: v2 references a YAML construct with no v3 SDK equivalent and the divergence is in that construct; v2 derives a value from runtime state v3 cannot observe (e.g. an env var that differs by environment). When you stop on structural grounds, mark the item `failed` with `failureReason: \"verification_diverged_irreconcilable: <one-paragraph reason naming the specific summaryForAgent entry and the structural reason> | summary: <JSON.stringify(summaryForAgent)>\"`.\n\n Guardrail against infinite loops (NOT a retry budget): if you have iterated 8 times on the same API and the set of divergences has not materially changed across the last 3 attempts (i.e. you are flailing, not converging), stop and mark `failed` with the same `failureReason` shape. If you ARE converging \u2014 fewer divergences each attempt, or the remaining ones look smaller \u2014 keep going past 8.\n\n## Run-level rules\n\n- Do NOT emit a free-text UNRESOLVED report \u2014 every unresolved item must be a `failed` checklist entry with a `failureReason`.\n- Do NOT stop the run because one API failed. Only stop once every API is either `completed` or `failed`.\n\n## Mutation policy follow-up (required once per run if any API returned `skipped_mutation`)\n\nAfter you've done everything deterministic (all non-skipped APIs settled), if one or more APIs ended with `skipped_mutation`, call **one** grouped `askMultiChoice` with exactly these options:\n\n- `Mark all untested APIs as complete`\n- `Test them, and you'll be prompted for permission`\n\nThen:\n\n1. If user picks **`Mark all untested APIs as complete`**:\n - For each skipped API checklist item, call `build_manageChecklist` update \u2192 `status: \"completed\"`.\n2. If user picks **`Test them, and you'll be prompted for permission`**:\n - Clear persisted write-policy first so `deny`/`ask` modal state does not keep forcing `skipped_mutation`:\n - read `scratch/migration-state.json`\n - remove the `integrationWritePolicy` field\n - write the file back\n - Then run `testApi` for each skipped API so the runtime can prompt the user for write approval in-context.\n - After user approvals and tests settle, update checklist status accordingly (`completed` on success, `failed` with concrete `failureReason` on deterministic blockers).\n\n## Post-batch re-verification\n\nAfter `spawnCodingSubagents` returns (or after all sequential APIs are settled), before updating the checklist overall status:\n\n1. Call `build_manageChecklist` with `action: \"get\"` and read all items.\n2. For any item where `verificationOutcome === \"auto_passed\"` and `lastVerificationAt` is older than any sibling item's `updatedAt` minus 60 seconds: this item may have drifted due to registry edits made by later sub-agents. Re-run `runMigrationVerification({ apiName, inputs: <inputs> })` for each such item \u2014 synthesize `inputs` the same way as in step 6 of the per-API procedure.\n3. If any re-verification produces `diverged`, apply the normal per-API diverge\u2192retry loop (no fixed retry budget; iterate until `passed` or firm structural-irreconcilability evidence, with the anti-flail guardrail at 8 iterations without convergence).\n4. Proceed to mark overall checklist completed/failed only after all re-verifications settle.\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-migration/skill.generated.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,s23BAyQnB,CAAC"}
1
+ {"version":3,"file":"skill.generated.d.ts","sourceRoot":"","sources":["../../../../../src/ai-service/skills/system/superblocks-migration/skill.generated.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,0w5BA8QnB,CAAC"}
@@ -139,7 +139,7 @@ Mark \`completed\` only when **all** are true:
139
139
 
140
140
  1. Enumerate checklist items whose IDs start with \`migration_page_route_verification_\`.
141
141
  2. Enumerate paths from \`scratch/v2-backup/router.tsx\` (fallback: \`scratch/v2-backup/pages/**/index.tsx\` confirmed against \`client/router.tsx\`).
142
- 3. For each route: set the matching item \`in_progress\` → navigate the preview to that path (\`browser_playwright_action\` when available; otherwise use the editor route picker / navigation mechanism — **do not** screenshot whatever route happens to be visible) → \`build_captureScreenshot\` → on success, \`completed\`.
142
+ 3. For each route: set the matching item \`in_progress\` → \`build_navigatePreview\` with that path → \`build_captureScreenshot\` → on success, \`completed\`.
143
143
  4. If the preview looks stale, \`build_reloadFile\` **once**, then retry screenshot. If capture still fails, \`failed\` with \`failureReason\` as above.
144
144
  5. Fix import/lazy-load/runtime failures, then repeat from step 3 for that route.
145
145
 
@@ -159,6 +159,9 @@ For each converted API, self-check:
159
159
  5. Input is the minimal union of identifiers the YAML references that are not produced by earlier blocks or \`Variables\`.
160
160
  6. Output shape exactly mirrors the legacy API's external response.
161
161
  7. If \`server/apis/index.ts\` exists, it registers the new module under \`metadata.name\`.
162
+ 8. **sdk-api integration wiring:** declare each integration in an \`integrations: { … }\` block and call it via \`ctx.integrations.<key>\` — never call \`postgres(ID)\` / \`github(ID)\` / etc. inside \`run()\` as if they were clients.
163
+ 9. **\`input\` / \`output\` schemas:** both are Zod schemas (\`input: z.object({…})\`, \`output: z.…\`). Do not use plain \`{ field: { type: "string" } }\` objects.
164
+ 10. **\`run\` signature:** \`async run(ctx, input)\` (or destructured input fields as the second argument). Never import \`ctx\` from the module scope.
162
165
 
163
166
  ## Parallelization policy
164
167
 
@@ -169,6 +172,7 @@ Count pending APIs from the checklist (\`build_manageChecklist\` \`action: "get"
169
172
  - Split the APIs into batches of ~5 (aim for 4–6 per batch), with a hard cap of **5 sub-agents total**. If more than 25 APIs remain, give later batches larger shares rather than spawning more than 5 workers.
170
173
  - For each batch, craft an \`instructions\` string that:
171
174
  - Names the exact \`<ApiName>\` values that sub-agent owns, verbatim, as a bulleted list.
175
+ - **Directs the sub-agent to \`build_readFile\` \`skills/system/superblocks-migration/SKILL.md\` (and the integration README(s) for the APIs it owns) before writing any files.** Do not inline a shortened sdk-api contract — keep a single source of truth.
172
176
  - Restates the per-API procedure below so the sub-agent is self-contained.
173
177
  - Reminds the sub-agent to update the shared checklist (id \`api_<ApiName>\`) for every item it owns.
174
178
  - **Also pass \`apiNames: ["<ApiName1>", "<ApiName2>", …]\` for every sub-agent**, listing the same names that appear in its \`instructions\`. The spawn tool stamps each \`api_<ApiName>\` checklist item with that sub-agent's \`id\` as \`workerId\` BEFORE fan-out, which lets the migration UI render one batch row per sub-agent in the chat sidebar. Forgetting \`apiNames\` is non-fatal (the sub-agents still run) but the sidebar checklist will fall back to one row per API instead of one per batch.
@@ -193,6 +197,7 @@ For APIs you migrate yourself, or that you embed in a sub-agent's \`instructions
193
197
  Outcomes and how to resolve them:
194
198
  - **\`passed\`**: call \`build_manageChecklist\` with \`status: "completed"\`. Done.
195
199
 
200
+ **Platform gate:** the checklist store rejects \`status: "completed"\` on \`api_<ApiName>\` items until verification has run at least once (\`lastVerificationAt\` is set — normally via this tool). You cannot bulk-mark APIs complete without calling \`runMigrationVerification\` per API.
196
201
  - **\`skipped_mutation\`**: this is a policy gate, not a deterministic pass. Do **NOT** mark the checklist item \`completed\` yet. Leave it unresolved (keep \`in_progress\`), continue processing other APIs, and resolve all skipped items in one grouped decision at the end of the run (see "Mutation policy follow-up" below).
197
202
 
198
203
  - **\`v2_unrunnable\`**: the v2 backup itself couldn't execute, so there is no baseline to match. Call \`build_manageChecklist\` with \`status: "completed"\` and continue.
@@ -1 +1 @@
1
- {"version":3,"file":"skill.generated.js","sourceRoot":"","sources":["../../../../../src/ai-service/skills/system/superblocks-migration/skill.generated.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,mDAAmD;AAEnD,MAAM,CAAC,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyQtB,CAAC"}
1
+ {"version":3,"file":"skill.generated.js","sourceRoot":"","sources":["../../../../../src/ai-service/skills/system/superblocks-migration/skill.generated.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,mDAAmD;AAEnD,MAAM,CAAC,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8QtB,CAAC"}
@@ -1,2 +1,2 @@
1
- export declare const content = "---\nname: third-party-migration\ndescription: |\n Migrate a third-party app (Replit, Lovable, v0, or similar) into a Superblocks 3.0 full-stack app.\n Load when the user asks to migrate, import, or port an external app \u2014 or when the source tree contains hallmarks of a supported platform (`replit.md` / `.replit`, `src/integrations/supabase/`, `supabase/functions/`, `lovable-tagger`, an `app/` directory with `next.config.*` and `\"use client\"` / `\"use server\"` directives, etc.) and the user wants it turned into a Superblocks app.\nreadOnly: true\nmetadata:\n author: superblocks\n version: \"1.0\"\n---\n\n# Third-Party App \u2192 Superblocks 3.0 Migration\n\nPort a user-provided external app into the Superblocks fullstack app you are running inside (template: `app-fullstack`). The source tree is **read-only material**. All edits land in the target app under `server/` and `client/`.\n\nThis file is the migration framework. **Per-platform mapping rules live in sibling files** \u2014 load the right one before you start mapping.\n\n## Checklist is mandatory\n\nChecklist discipline is required for every migration run:\n\n- Before any file edits, ensure migration checklist items are seeded via `build_manageChecklist`.\n- Before editing an item, mark it `in_progress`.\n- After the edit lands, mark it `completed`, or `failed` with a concrete `failureReason` if deterministic completion is impossible.\n- When you need an item to survive `build_finalize`, set `clearOnFinalize: false` on add/update. Use this only for migration-tracking items that must persist until explicit migration completion.\n- Do not continue implementation if checklist state is missing, stale, or inconsistent with the work you are doing. Fix checklist state first.\n- Free-text progress updates are never a substitute for checklist updates.\n\n## Identify the source platform\n\nMatch the source tree against these signals, then read the matching reference file in this folder. Read it once, up-front \u2014 it tells you what shapes to look for and how each maps to Superblocks.\n\n- **Replit** \u2014 `replit.md`, `.replit`, `artifacts/`, an Express server with an Orval-generated client. \u2192 load `replit.md`.\n- **Lovable** \u2014 `src/integrations/supabase/client.ts`, `supabase/config.toml`, `supabase/functions/`, `supabase/migrations/`, `lovable-tagger` in `vite.config.ts`. \u2192 load `lovable.md`.\n- **v0** \u2014 `app/<segment>/page.tsx` (Next.js App Router) plus `next.config.{js,mjs,ts}` and `next` in `package.json`, files with `\"use client\"` / `\"use server\"` directives, `next/link` / `next/navigation` imports, `components/ui/` with shadcn primitives. \u2192 load `v0.md`.\n- **Claude Design** \u2014 a small flat archive (no `package.json`, no `node_modules`, no build config) with one top-level `<Name>.html` plus sibling `app.jsx`, `data.js`, and `tweaks-panel.jsx`. The HTML loads React + ReactDOM + Babel from a CDN, uses `<html data-theme=\"...\">`, and references `var(--accent)` / `var(--ink)` CSS variables. The `.jsx` files contain `/*EDITMODE-BEGIN*/ ... /*EDITMODE-END*/` markers around defaults and use `useTweaks` / `TweaksPanel` / `TweakSection` / `TweakToggle` globals. \u2192 load `claude-design.md`.\n- **Ambiguous or neither** \u2014 stop and ask the user which platform the source came from. Do not guess. It is possible that it is No Platform. In this case, follow the general guidelines in this document and ask user questions for any ambiguity.\n\nThe framework below applies to every platform; the platform file fills in the source-specific mapping.\n\n## Target layout\n\nThe app you are running inside looks like this. Do not invent new top-level directories.\n\n```\nclient/\n App.tsx \u2014 root with <AppProvider> + <Outlet />\n router.tsx \u2014 react-router v7 data mode (`createBrowserRouter`); see Router shape below\n index.css \u2014 Tailwind v4 + theme tokens\n hooks/\n useApi.ts \u2014 typed wrapper around useTypedApi<ApiRegistry>\n useApiData.ts \u2014 typed wrapper around useTypedApiData<ApiRegistry>\n lib/executeApi.ts \u2014 non-React typed executeApi\n pages/<Name>/index.tsx\n components/ui/ \u2014 shadcn primitives (do not modify)\nserver/\n apis/\n index.ts \u2014 registry: `const apis = { ApiName: ... } as const;`\n <ApiName>/api.ts\n```\n\n## Universal mapping (applies to every source)\n\nThese hold regardless of source platform. Per-platform specifics layer on top.\n\n- APIs are addressed by `name` via the registry \u2014 there is no URL path. Within `api()`:\n - All inputs (whatever shape the source had \u2014 body, query, params, function args) \u2192 one unified `input` Zod schema; destructure inside `run(ctx, { ... })`.\n - The handler's response \u2192 `return { ... }` from `run`. The `output` schema validates it automatically; do not `safeParse` by hand.\n - Auth \u2192 `ctx.user` (`userId`, `email`, `name`, `groups`, `customClaims`). Auth is platform-managed; drop the source's auth flows entirely.\n - Errors \u2192 throw the `SdkError` subtypes the sdk-api README documents (`InputValidationError`, `OutputValidationError`, `IntegrationError`, `ExecutionError`). Never invent error classes or return HTTP status codes.\n - DB clients (`pg`, `knex`, `prisma`, Drizzle, `supabase.from(...)`) \u2192 declare in `integrations: { db: postgres(DB_INTEGRATION_ID) }` and call `ctx.integrations.db.query(sql, ZodSchema, params, { label: \"...\" })` / `.execute(...)`. Parameterized SQL only. Hold integration UUIDs in module-level `const`s, not literals scattered through `run`.\n - External HTTP (`axios`, `fetch`, third-party SDKs) \u2192 declared integration + `ctx.integrations.<name>.apiRequest({ method, path, body }, { response: ZodSchema })`.\n - `process.env.*` / `import.meta.env.*` / `Deno.env.get(...)` \u2192 `ctx.env`. Logging \u2192 `ctx.log.info/warn/error/debug(msg, data?)`.\n - Server bootstrapping (`app.listen`, CORS, route grouping, middleware setup, `Deno.serve`) \u2192 drop entirely. The platform handles it.\n- **Each frontend page \u2192 one Superblocks page** at `client/pages/<Name>/index.tsx`, wired into `client/router.tsx`.\n- **Each backend data source (DB, REST client, S3, ...) \u2192 one Superblocks integration** referenced by UUID. Credentials live on the integration, never in code.\n\n### Router shape (`client/router.tsx`)\n\nThe editor parses this file statically to build the page list and route table. **Use one of the supported page-component bindings \u2014 anything else silently drops every route and the editor shows a \"404 / route has been deleted\" overlay.**\n\nSupported page bindings (mix freely):\n\n```tsx\n// 1. Inline lazy on the route object (preferred \u2014 matches the template):\n{ path: \"about\", lazy: () => import(\"./pages/About/index.tsx\").then(m => ({ Component: m.default })) }\n\n// 2. Static default import + Component / element:\nimport About from \"./pages/About/index.tsx\";\n{ path: \"about\", Component: About }\n{ path: \"about\", element: <About /> }\n\n// 3. Top-level `const` bound to React.lazy + Component / element:\nconst About = lazy(() => import(\"./pages/About/index.tsx\"));\n{ path: \"about\", Component: About }\n```\n\nDo **not**: assign `Component` / `element` to identifiers bound by anything other than a static import or `lazy(() => import(\"...\"))` (no IIFEs, no helper wrappers, no conditional `lazy(...)`, no objects whose keys are computed from a loop). The parser only resolves the shapes above.\n\n## Authoritative references (read just-in-time, not up front)\n\n- `node_modules/@superblocksteam/sdk-api/README.md` and `src/index.ts` \u2014 the server `api()` contract and the full list of factory names. **Never invent factory names.** If a required file is missing, mark the affected checklist item `failed` with the missing path as the reason.\n- Per-integration READMEs under `node_modules/@superblocksteam/sdk-api/src/integrations/<kind>/` \u2014 read once, when you first emit an API that uses that integration.\n- `skills/system/superblocks-frontend/SKILL.md` \u2014 the client contract (`useApi` / `useApiData` / `executeApi` from `@superblocksteam/library`).\n\n> \u26A0\uFE0F **Never** load `skills/system/superblocks-api/SKILL.md`. It describes a different, block-based API pattern that is incompatible with the fullstack template's `sdk-api`. Mixing them produces code that does not compile.\n\n## Non-negotiables\n\n1. **Track everything in the checklist.** The **first tool call after exiting plan mode** or **during build mode, before building** is `build_manageChecklist` to seed. Before every per-item edit, `update <itemId> in_progress`; after, `update <itemId> completed` (or `failed` with a concrete `failureReason`). If you are about to write code and the checklist is empty, stale, or missing the item you are working on, **stop and fix the checklist first** \u2014 the orchestration depends on it. Free-text status reports are not a substitute.\n2. **Discover before you edit.** Inventory routes, pages, data sources, env vars, _and visual surface_ (theme tokens, `index.css`, custom CSS, font setup, layout shells) across the entire source tree before writing any code. The platform file tells you what shapes to look for.\n3. **Ask before guessing.** Multiple integrations of the same kind, missing integrations, unsupported data sources, or any platform-specific ambiguity \u2192 stop and `askMultiChoice`. Never pick for the user. The platform file lists ambiguities specific to that source.\n4. **Preserve visual identity.** The migrated app must be pixel-faithful to the source. Transfer these source details verbatim: copy strings (every label, heading, placeholder, helper text, button, empty state, error, alt text, tooltip, and aria-label), Tailwind class lists, CSS custom properties with original units and color space (no HSL\u2194OKLCH conversion), border-radius, spacing / padding / margin / gap, width / height literals including arbitrary values such as `w-[280px]` and `rounded-[14px]`, shadow tokens and values, typography (family, weight, size, line-height, and letter-spacing), icon identity (same lucide name or same inline SVG), inline SVG and image assets, breakpoints and responsive prefixes, animations and transitions, component breakdown, and JSX nesting. shadcn/ui components stay as-is. Do **not** redesign, restyle, or \"clean up\" while porting. A diff that goes beyond data hooks + auth + routing + framework directives is a regression \u2014 back it out.\n5. **Never copy secrets.** DSN strings, API keys, anon/service-role keys, JWT secrets, env-var lookups for credentials \u2014 none move into the target tree. Integration UUIDs replace them. Surface every leaked secret you find (especially client-side `VITE_*` / `NEXT_PUBLIC_*` keys) in the discovery summary so the user can rotate them.\n6. **No `// TODO`s.** Anything you can't finish deterministically becomes a `failed` checklist item with a concrete `failureReason`.\n7. **Don't scaffold.** If `server/apis/index.ts` or `client/router.tsx` doesn't already exist, you're in the wrong app \u2014 stop and surface this.\n8. **Don't fabricate a backend.** If the source is genuinely frontend-only, the migrated app should also be frontend-only. Don't invent APIs to \"complete\" the architecture.\n\n## Workflow\n\n1. **Locate the source.** If the user gave a path, use it. Otherwise look in the working tree for the platform signals listed above. If ambiguous, ask.\n2. **Load the platform guide.** Read `replit.md`, `lovable.md`, or `v0.md` based on what you found. Do not start mapping before you've read it \u2014 it documents the source's shape and how each piece translates.\n3. **Inventory.** Following the platform guide's discovery checklist, enumerate every route/handler, page, data source, env var, secret, and visual asset in the source tree. Surface a one-paragraph summary plus an itemized list of integrations and unsupported features before writing anything. If the source has bespoke styling, seed a `setup_theme` checklist item to port it.\n4. **Resolve integrations.** For each data source kind: call `searchIntegrations` (filter by `type`). One match \u2192 bind it. Multiple \u2192 ask the user which. Zero \u2192 ask whether to create one; if yes, use `listAvailableIntegrationTypes` (if needed) and `openIntegrationSetup`, then ask the user explicitly whether they saved or cancelled before re-searching. Resolution is **blocking** \u2014 the checklist cannot be seeded until every kind maps to a UUID, is explicitly deferred, or has been confirmed unsupported.\n5. **Seed the checklist** via `build_manageChecklist`. One `api_<ApiName>` per backend interaction, one `frontend_<PageName>` per page, plus `setup_router`, `setup_registry`, `setup_cleanup`, and any `setup_theme` / `setup_storage` / `unsupported_<feature>` items the platform guide tells you to add. Print the count as a sanity check; if it looks wrong, re-check discovery.\n6. **Execute.** Every item follows the same ritual \u2014 no exceptions:\n - **Before touching files:** `build_manageChecklist update <itemId> in_progress`.\n - **Classify the work** per _Before emitting code_ below \u2014 pick the right tool (copy / copy+edit / write) before you start typing.\n - **Emit / edit the files** for that item using the tool the classification selected.\n - **After the edit lands:** `build_manageChecklist update <itemId> completed` (or `failed` with a concrete `failureReason`).\n - You are not done with an item until its checklist entry has moved to a terminal state. Do not batch updates at the end; update as you go.\n - **For parallelizable work:** call `spawnCodingSubagents` with batches of tasks. Each batch's `instructions` must direct the sub-agent to `build_readFile` `skills/system/third-party-migration/SKILL.md` and the matching platform file (for example, `v0.md`) before touching any files. Do not inline the fidelity contract; keep a single source of truth. The instructions also name exact `itemId`s, include the integration-UUID map and source path, include any platform-specific context the sub-agent needs (e.g. RLS-replacement clauses for Lovable), and tell the sub-agent to follow the same `in_progress` \u2192 `completed`/`failed` ritual for every item it owns.\n - `spawnCodingSubagents` **must be the only tool call in that turn.** It blocks until every sub-agent finishes; there is no \"while waiting\" from your perspective. Other tool calls in the same turn race on the shared checklist and corrupt state. After it returns, read the checklist and handle `failed` items sequentially. If the tool itself errors, surface it and fall back to sequential \u2014 or fail the affected items with `sub-agent orchestration failed: <error>`.\n\n## Before emitting code\n\nPick the right tool **before** you start typing. The source tree is the source of truth; preserve it byte-for-byte wherever you can. `build_writeFile` is an escalation, not the primary tool \u2014 a rewritten file is only as faithful as the model's attention, while a copied file is faithful by construction.\n\nFor each checklist item, classify the target file(s) into the **lowest bucket that fits** and use the tool for that bucket:\n\n| Source vs. target needs | Tool | Examples |\n| -------------------------------------------------------------------------------------------------------------- | ----------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |\n| **Directory** of non-source files | `build_copyDirectory` \u2014 never per-file | `public/`, `static/`, `assets/`, `src/assets/`, fonts, image bundles |\n| **Identical** \u2014 byte-for-byte | `build_copyFile` | data modules, type files, JSON, fixtures, vendored utils, content/copy modules, shadcn primitives the source has already customized |\n| **Trivial edits only** \u2014 \u2264 3 distinct edit sites | `build_copyFile` then `build_editFile` per site | import-path swaps (`react-router-dom` \u2192 `react-router`), single hook rename, one-line constant fix, removing a single `\"use client\"` directive |\n| **Structural changes** \u2014 different component APIs, framework wrappers, routing overhaul, data-hook replacement | `build_writeFile` | page components whose data layer is being rewritten, server handlers being reshaped to `api(...)`, router file being regenerated |\n\n**Heuristic:** if you cannot name the specific lines that need to change before reading the file, you have not earned `build_writeFile` yet \u2014 `build_readFile` first, then re-classify.\n\n**Asset directories never get a per-file ruling.** If `public/` (or the platform's equivalent \u2014 see the per-platform guide) exists in the source, it ships as a single `build_copyDirectory` regardless of contents. Do not enumerate, do not skip, do not selectively copy \"the ones you think you'll need.\"\n\n## When emitting code\n\n- **Server.** Default-export one `api({ name, integrations, input, output, run })` from `@superblocksteam/sdk-api`. The `name` and the registry key in `server/apis/index.ts` must equal `<ApiName>` verbatim \u2014 the client calls `useApi(\"<ApiName>\")` by that exact string. Preserve the external response shape exactly so the migrated frontend keeps working. Use parameterized SQL only (`$N`); zero string interpolations. Throw the error classes the sdk-api README documents instead of returning HTTP status codes.\n- **Client.** Replace the source's data hooks with `useApiData` (reads) or `useApi` (mutations) keyed by `<ApiName>`. **Import the typed wrappers from the template, not the library directly:** `import { useApi } from \"@/hooks/useApi.js\"`, `import { useApiData } from \"@/hooks/useApiData.js\"`, `import { executeApi } from \"@/lib/executeApi.js\"`. They give compile-time inference from `ApiRegistry`. Drop the source's generated client packages, `QueryClientProvider`, base-URL or auth-token getters, and any auth-context plumbing \u2014 Superblocks handles all of that. shadcn/form + react-hook-form + zod stays. Follow the loading-state guidance in `superblocks-frontend/SKILL.md`.\n- **ESM imports.** Every relative import in emitted code uses an explicit `.js` extension (`./api.js`, `../hooks/useApi.js`) \u2014 even though the source is `.ts`. The template is ESM; bare specifiers fail at runtime.\n- **Theme port.** When carrying over the source's theme, copy the existing color values **as-is** into `client/index.css`'s `:root` block. HSL values written `hsl(222 47% 11%)` (CSS Color Level 4 space-separated form) work directly with the `@theme inline` mapping in Tailwind v4. **Do not convert to OKLCH** unless the source already uses OKLCH \u2014 converting introduces drift and is a common visual-regression source.\n- **Visual fidelity.** JSX structure, Tailwind classes, shadcn variants, custom CSS, theme tokens, fonts, and layout containers must transfer over **unchanged** from the source page. The only things that change in a page port are the data hooks, the auth touchpoints, and the router primitives. Do not \"improve\" markup, swap class names, or substitute components. If the diff between source and target page goes beyond data + auth + routing, you are over-editing \u2014 back out the cosmetic changes.\n- **Sub-agents must not** call `searchIntegrations`, `openIntegrationSetup`, or any integration-resolution tool. If they hit a kind missing from the map, fail the item with `unresolved integration kind: <kind>` and let the main agent handle it on return.\n\n## Done\n\nStop only when every checklist item is `completed` or `failed`. Report the counts plus any platform-specific findings the per-platform guide asks you to surface (e.g. leaked secrets, replaced RLS policies, unsupported realtime features). Do not claim success \u2014 defer verification to the user running the app.\n";
1
+ export declare const content = "---\nname: third-party-migration\ndescription: |\n Migrate a third-party app (Replit, Streamlit, Lovable, v0, or similar) into a Superblocks 3.0 full-stack app.\n Load when the user asks to migrate, import, or port an external app \u2014 or when the source tree contains hallmarks of a supported platform (`replit.md` / `.replit`, `streamlit_app.py`, `.streamlit/config.toml`, `import streamlit as st`, `src/integrations/supabase/`, `supabase/functions/`, `lovable-tagger`, an `app/` directory with `next.config.*` and `\"use client\"` / `\"use server\"` directives, etc.) and the user wants it turned into a Superblocks app.\nreadOnly: true\nmetadata:\n author: superblocks\n version: \"1.0\"\n---\n\n# Third-Party App \u2192 Superblocks 3.0 Migration\n\nPort a user-provided external app into the Superblocks fullstack app you are running inside (template: `app-fullstack`). The source tree is **read-only material**. All edits land in the target app under `server/` and `client/`.\n\nThis file is the migration framework. **Per-platform mapping rules live in sibling files** \u2014 load the right one before you start mapping.\n\n## Checklist is mandatory\n\nChecklist discipline is required for every migration run:\n\n- Before any file edits, ensure migration checklist items are seeded via `build_manageChecklist`.\n- Before editing an item, mark it `in_progress`.\n- After the edit lands, mark it `completed`, or `failed` with a concrete `failureReason` if deterministic completion is impossible.\n- When you need an item to survive `build_finalize`, set `clearOnFinalize: false` on add/update. Use this only for migration-tracking items that must persist until explicit migration completion.\n- Do not continue implementation if checklist state is missing, stale, or inconsistent with the work you are doing. Fix checklist state first.\n- Free-text progress updates are never a substitute for checklist updates.\n\n## Identify the source platform\n\nMatch the source tree against these signals, then read the matching reference file in this folder. Read it once, up-front \u2014 it tells you what shapes to look for and how each maps to Superblocks.\n\n- **Replit** \u2014 `replit.md`, `.replit`, `artifacts/`, an Express server with an Orval-generated client. \u2192 load `replit.md`.\n- **Streamlit** \u2014 `streamlit_app.py`, `.streamlit/config.toml`, dependency files containing `streamlit`, Python files with `import streamlit as st`, or a Python `pages/` multipage app structure. Follow the general guidelines in this document.\n- **Lovable** \u2014 `src/integrations/supabase/client.ts`, `supabase/config.toml`, `supabase/functions/`, `supabase/migrations/`, `lovable-tagger` in `vite.config.ts`. \u2192 load `lovable.md`.\n- **v0** \u2014 `app/<segment>/page.tsx` (Next.js App Router) plus `next.config.{js,mjs,ts}` and `next` in `package.json`, files with `\"use client\"` / `\"use server\"` directives, `next/link` / `next/navigation` imports, `components/ui/` with shadcn primitives. \u2192 load `v0.md`.\n- **Claude Design** \u2014 a small flat archive (no `package.json`, no `node_modules`, no build config) with one top-level `<Name>.html` plus sibling `app.jsx`, `data.js`, and `tweaks-panel.jsx`. The HTML loads React + ReactDOM + Babel from a CDN, uses `<html data-theme=\"...\">`, and references `var(--accent)` / `var(--ink)` CSS variables. The `.jsx` files contain `/*EDITMODE-BEGIN*/ ... /*EDITMODE-END*/` markers around defaults and use `useTweaks` / `TweaksPanel` / `TweakSection` / `TweakToggle` globals. \u2192 load `claude-design.md`.\n- **Ambiguous or neither** \u2014 stop and ask the user which platform the source came from. Do not guess. It is possible that it is No Platform. In this case, follow the general guidelines in this document and ask user questions for any ambiguity.\n\nThe framework below applies to every platform; the platform file fills in the source-specific mapping.\n\n## Target layout\n\nThe app you are running inside looks like this. Do not invent new top-level directories.\n\n```\nclient/\n App.tsx \u2014 root with <AppProvider> + <Outlet />\n router.tsx \u2014 react-router v7 data mode (`createBrowserRouter`); see Router shape below\n index.css \u2014 Tailwind v4 + theme tokens\n hooks/\n useApi.ts \u2014 typed wrapper around useTypedApi<ApiRegistry>\n useApiData.ts \u2014 typed wrapper around useTypedApiData<ApiRegistry>\n lib/executeApi.ts \u2014 non-React typed executeApi\n pages/<Name>/index.tsx\n components/ui/ \u2014 shadcn primitives (do not modify)\nserver/\n apis/\n index.ts \u2014 registry: `const apis = { ApiName: ... } as const;`\n <ApiName>/api.ts\n```\n\n## Universal mapping (applies to every source)\n\nThese hold regardless of source platform. Per-platform specifics layer on top.\n\n- APIs are addressed by `name` via the registry \u2014 there is no URL path. Within `api()`:\n - All inputs (whatever shape the source had \u2014 body, query, params, function args) \u2192 one unified `input` Zod schema; destructure inside `run(ctx, { ... })`.\n - The handler's response \u2192 `return { ... }` from `run`. The `output` schema validates it automatically; do not `safeParse` by hand.\n - Auth \u2192 `ctx.user` (`userId`, `email`, `name`, `groups`, `customClaims`). Auth is platform-managed; drop the source's auth flows entirely.\n - Errors \u2192 throw the `SdkError` subtypes the sdk-api README documents (`InputValidationError`, `OutputValidationError`, `IntegrationError`, `ExecutionError`). Never invent error classes or return HTTP status codes.\n - DB clients (`pg`, `knex`, `prisma`, Drizzle, `supabase.from(...)`) \u2192 declare in `integrations: { db: postgres(DB_INTEGRATION_ID) }` and call `ctx.integrations.db.query(sql, ZodSchema, params, { label: \"...\" })` / `.execute(...)`. Parameterized SQL only. Hold integration UUIDs in module-level `const`s, not literals scattered through `run`.\n - External HTTP (`axios`, `fetch`, third-party SDKs) \u2192 declared integration + `ctx.integrations.<name>.apiRequest({ method, path, body }, { response: ZodSchema })`.\n - `process.env.*` / `import.meta.env.*` / `Deno.env.get(...)` \u2192 `ctx.env`. Logging \u2192 `ctx.log.info/warn/error/debug(msg, data?)`.\n - Server bootstrapping (`app.listen`, CORS, route grouping, middleware setup, `Deno.serve`) \u2192 drop entirely. The platform handles it.\n- **Each frontend page \u2192 one Superblocks page** at `client/pages/<Name>/index.tsx`, wired into `client/router.tsx`.\n- **Each backend data source (DB, REST client, S3, ...) \u2192 one Superblocks integration** referenced by UUID. Credentials live on the integration, never in code.\n\n### Router shape (`client/router.tsx`)\n\nThe editor parses this file statically to build the page list and route table. **Use one of the supported page-component bindings \u2014 anything else silently drops every route and the editor shows a \"404 / route has been deleted\" overlay.**\n\nSupported page bindings (mix freely):\n\n```tsx\n// 1. Inline lazy on the route object (preferred \u2014 matches the template):\n{ path: \"about\", lazy: () => import(\"./pages/About/index.tsx\").then(m => ({ Component: m.default })) }\n\n// 2. Static default import + Component / element:\nimport About from \"./pages/About/index.tsx\";\n{ path: \"about\", Component: About }\n{ path: \"about\", element: <About /> }\n\n// 3. Top-level `const` bound to React.lazy + Component / element:\nconst About = lazy(() => import(\"./pages/About/index.tsx\"));\n{ path: \"about\", Component: About }\n```\n\nDo **not**: assign `Component` / `element` to identifiers bound by anything other than a static import or `lazy(() => import(\"...\"))` (no IIFEs, no helper wrappers, no conditional `lazy(...)`, no objects whose keys are computed from a loop). The parser only resolves the shapes above.\n\n## Authoritative references (read just-in-time, not up front)\n\n- `node_modules/@superblocksteam/sdk-api/README.md` and `src/index.ts` \u2014 the server `api()` contract and the full list of factory names. **Never invent factory names.** If a required file is missing, mark the affected checklist item `failed` with the missing path as the reason.\n- Per-integration READMEs under `node_modules/@superblocksteam/sdk-api/src/integrations/<kind>/` \u2014 read once, when you first emit an API that uses that integration.\n- `skills/system/superblocks-frontend/SKILL.md` \u2014 the client contract (`useApi` / `useApiData` / `executeApi` from `@superblocksteam/library`).\n\n> \u26A0\uFE0F **Never** load `skills/system/superblocks-api/SKILL.md`. It describes a different, block-based API pattern that is incompatible with the fullstack template's `sdk-api`. Mixing them produces code that does not compile.\n\n## Non-negotiables\n\n1. **Track everything in the checklist.** The **first tool call after exiting plan mode** or **during build mode, before building** is `build_manageChecklist` to seed. Before every per-item edit, `update <itemId> in_progress`; after, `update <itemId> completed` (or `failed` with a concrete `failureReason`). If you are about to write code and the checklist is empty, stale, or missing the item you are working on, **stop and fix the checklist first** \u2014 the orchestration depends on it. Free-text status reports are not a substitute.\n2. **Discover before you edit.** Inventory routes, pages, data sources, env vars, _and visual surface_ (theme tokens, `index.css`, custom CSS, font setup, layout shells) across the entire source tree before writing any code. The platform file tells you what shapes to look for.\n3. **Ask before guessing.** Multiple integrations of the same kind, missing integrations, unsupported data sources, or any platform-specific ambiguity \u2192 stop and `askMultiChoice`. Never pick for the user. The platform file lists ambiguities specific to that source.\n4. **Preserve visual identity.** The migrated app must be pixel-faithful to the source. Transfer these source details verbatim: copy strings (every label, heading, placeholder, helper text, button, empty state, error, alt text, tooltip, and aria-label), Tailwind class lists, CSS custom properties with original units and color space (no HSL\u2194OKLCH conversion), border-radius, spacing / padding / margin / gap, width / height literals including arbitrary values such as `w-[280px]` and `rounded-[14px]`, shadow tokens and values, typography (family, weight, size, line-height, and letter-spacing), icon identity (same lucide name or same inline SVG), inline SVG and image assets, breakpoints and responsive prefixes, animations and transitions, component breakdown, and JSX nesting. shadcn/ui components stay as-is. Do **not** redesign, restyle, or \"clean up\" while porting. A diff that goes beyond data hooks + auth + routing + framework directives is a regression \u2014 back it out.\n5. **Never copy secrets.** DSN strings, API keys, anon/service-role keys, JWT secrets, env-var lookups for credentials \u2014 none move into the target tree. Integration UUIDs replace them. Surface every leaked secret you find (especially client-side `VITE_*` / `NEXT_PUBLIC_*` keys) in the discovery summary so the user can rotate them.\n6. **No `// TODO`s.** Anything you can't finish deterministically becomes a `failed` checklist item with a concrete `failureReason`.\n7. **Don't scaffold.** If `server/apis/index.ts` or `client/router.tsx` doesn't already exist, you're in the wrong app \u2014 stop and surface this.\n8. **Don't fabricate a backend.** If the source is genuinely frontend-only, the migrated app should also be frontend-only. Don't invent APIs to \"complete\" the architecture.\n\n## Workflow\n\n1. **Locate the source.** If the user gave a path, use it. Otherwise look in the working tree for the platform signals listed above. If ambiguous, ask.\n2. **Load the platform guide.** Read `replit.md`, `lovable.md`, or `v0.md` based on what you found. Do not start mapping before you've read it \u2014 it documents the source's shape and how each piece translates.\n3. **Inventory.** Following the platform guide's discovery checklist, enumerate every route/handler, page, data source, env var, secret, and visual asset in the source tree. Surface a one-paragraph summary plus an itemized list of integrations and unsupported features before writing anything. If the source has bespoke styling, seed a `setup_theme` checklist item to port it.\n4. **Resolve integrations.** For each data source kind: call `searchIntegrations` (filter by `type`). One match \u2192 bind it. Multiple \u2192 ask the user which. Zero \u2192 ask whether to create one; if yes, use `listAvailableIntegrationTypes` (if needed) and `openIntegrationSetup`, then ask the user explicitly whether they saved or cancelled before re-searching. Resolution is **blocking** \u2014 the checklist cannot be seeded until every kind maps to a UUID, is explicitly deferred, or has been confirmed unsupported.\n5. **Seed the checklist** via `build_manageChecklist`. One `api_<ApiName>` per backend interaction, one `frontend_<PageName>` per page, plus `setup_router`, `setup_registry`, `setup_cleanup`, and any `setup_theme` / `setup_storage` / `unsupported_<feature>` items the platform guide tells you to add. Print the count as a sanity check; if it looks wrong, re-check discovery.\n6. **Execute.** Every item follows the same ritual \u2014 no exceptions:\n - **Before touching files:** `build_manageChecklist update <itemId> in_progress`.\n - **Classify the work** per _Before emitting code_ below \u2014 pick the right tool (copy / copy+edit / write) before you start typing.\n - **Emit / edit the files** for that item using the tool the classification selected.\n - **After the edit lands:** `build_manageChecklist update <itemId> completed` (or `failed` with a concrete `failureReason`).\n - You are not done with an item until its checklist entry has moved to a terminal state. Do not batch updates at the end; update as you go.\n - **For parallelizable work:** call `spawnCodingSubagents` with batches of tasks. Each batch's `instructions` must direct the sub-agent to `build_readFile` `skills/system/third-party-migration/SKILL.md` and the matching platform file (for example, `v0.md`) before touching any files. Do not inline the fidelity contract; keep a single source of truth. The instructions also name exact `itemId`s, include the integration-UUID map and source path, include any platform-specific context the sub-agent needs (e.g. RLS-replacement clauses for Lovable), and tell the sub-agent to follow the same `in_progress` \u2192 `completed`/`failed` ritual for every item it owns.\n - `spawnCodingSubagents` **must be the only tool call in that turn.** It blocks until every sub-agent finishes; there is no \"while waiting\" from your perspective. Other tool calls in the same turn race on the shared checklist and corrupt state. After it returns, read the checklist and handle `failed` items sequentially. If the tool itself errors, surface it and fall back to sequential \u2014 or fail the affected items with `sub-agent orchestration failed: <error>`.\n\n## Before emitting code\n\nPick the right tool **before** you start typing. The source tree is the source of truth; preserve it byte-for-byte wherever you can. `build_writeFile` is an escalation, not the primary tool \u2014 a rewritten file is only as faithful as the model's attention, while a copied file is faithful by construction.\n\nFor each checklist item, classify the target file(s) into the **lowest bucket that fits** and use the tool for that bucket:\n\n| Source vs. target needs | Tool | Examples |\n| -------------------------------------------------------------------------------------------------------------- | ----------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |\n| **Directory** of non-source files | `build_copyDirectory` \u2014 never per-file | `public/`, `static/`, `assets/`, `src/assets/`, fonts, image bundles |\n| **Identical** \u2014 byte-for-byte | `build_copyFile` | data modules, type files, JSON, fixtures, vendored utils, content/copy modules, shadcn primitives the source has already customized |\n| **Trivial edits only** \u2014 \u2264 3 distinct edit sites | `build_copyFile` then `build_editFile` per site | import-path swaps (`react-router-dom` \u2192 `react-router`), single hook rename, one-line constant fix, removing a single `\"use client\"` directive |\n| **Structural changes** \u2014 different component APIs, framework wrappers, routing overhaul, data-hook replacement | `build_writeFile` | page components whose data layer is being rewritten, server handlers being reshaped to `api(...)`, router file being regenerated |\n\n**Heuristic:** if you cannot name the specific lines that need to change before reading the file, you have not earned `build_writeFile` yet \u2014 `build_readFile` first, then re-classify.\n\n**Asset directories never get a per-file ruling.** If `public/` (or the platform's equivalent \u2014 see the per-platform guide) exists in the source, it ships as a single `build_copyDirectory` regardless of contents. Do not enumerate, do not skip, do not selectively copy \"the ones you think you'll need.\"\n\n## When emitting code\n\n- **Server.** Default-export one `api({ name, integrations, input, output, run })` from `@superblocksteam/sdk-api`. The `name` and the registry key in `server/apis/index.ts` must equal `<ApiName>` verbatim \u2014 the client calls `useApi(\"<ApiName>\")` by that exact string. Preserve the external response shape exactly so the migrated frontend keeps working. Use parameterized SQL only (`$N`); zero string interpolations. Throw the error classes the sdk-api README documents instead of returning HTTP status codes.\n- **Client.** Replace the source's data hooks with `useApiData` (reads) or `useApi` (mutations) keyed by `<ApiName>`. **Import the typed wrappers from the template, not the library directly:** `import { useApi } from \"@/hooks/useApi.js\"`, `import { useApiData } from \"@/hooks/useApiData.js\"`, `import { executeApi } from \"@/lib/executeApi.js\"`. They give compile-time inference from `ApiRegistry`. Drop the source's generated client packages, `QueryClientProvider`, base-URL or auth-token getters, and any auth-context plumbing \u2014 Superblocks handles all of that. shadcn/form + react-hook-form + zod stays. Follow the loading-state guidance in `superblocks-frontend/SKILL.md`.\n- **ESM imports.** Every relative import in emitted code uses an explicit `.js` extension (`./api.js`, `../hooks/useApi.js`) \u2014 even though the source is `.ts`. The template is ESM; bare specifiers fail at runtime.\n- **Theme port.** When carrying over the source's theme, copy the existing color values **as-is** into `client/index.css`'s `:root` block. HSL values written `hsl(222 47% 11%)` (CSS Color Level 4 space-separated form) work directly with the `@theme inline` mapping in Tailwind v4. **Do not convert to OKLCH** unless the source already uses OKLCH \u2014 converting introduces drift and is a common visual-regression source.\n- **Visual fidelity.** JSX structure, Tailwind classes, shadcn variants, custom CSS, theme tokens, fonts, and layout containers must transfer over **unchanged** from the source page. The only things that change in a page port are the data hooks, the auth touchpoints, and the router primitives. Do not \"improve\" markup, swap class names, or substitute components. If the diff between source and target page goes beyond data + auth + routing, you are over-editing \u2014 back out the cosmetic changes.\n- **Sub-agents must not** call `searchIntegrations`, `openIntegrationSetup`, or any integration-resolution tool. If they hit a kind missing from the map, fail the item with `unresolved integration kind: <kind>` and let the main agent handle it on return.\n\n## Done\n\nStop only when every checklist item is `completed` or `failed`. Report the counts plus any platform-specific findings the per-platform guide asks you to surface (e.g. leaked secrets, replaced RLS policies, unsupported realtime features). Do not claim success \u2014 defer verification to the user running the app.\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/third-party-migration/skill.generated.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,otoBAmKnB,CAAC"}
1
+ {"version":3,"file":"skill.generated.d.ts","sourceRoot":"","sources":["../../../../../src/ai-service/skills/system/third-party-migration/skill.generated.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,OAAO,gipBAoKnB,CAAC"}
@@ -3,8 +3,8 @@
3
3
  export const content = `---
4
4
  name: third-party-migration
5
5
  description: |
6
- Migrate a third-party app (Replit, Lovable, v0, or similar) into a Superblocks 3.0 full-stack app.
7
- Load when the user asks to migrate, import, or port an external app — or when the source tree contains hallmarks of a supported platform (\`replit.md\` / \`.replit\`, \`src/integrations/supabase/\`, \`supabase/functions/\`, \`lovable-tagger\`, an \`app/\` directory with \`next.config.*\` and \`"use client"\` / \`"use server"\` directives, etc.) and the user wants it turned into a Superblocks app.
6
+ Migrate a third-party app (Replit, Streamlit, Lovable, v0, or similar) into a Superblocks 3.0 full-stack app.
7
+ Load when the user asks to migrate, import, or port an external app — or when the source tree contains hallmarks of a supported platform (\`replit.md\` / \`.replit\`, \`streamlit_app.py\`, \`.streamlit/config.toml\`, \`import streamlit as st\`, \`src/integrations/supabase/\`, \`supabase/functions/\`, \`lovable-tagger\`, an \`app/\` directory with \`next.config.*\` and \`"use client"\` / \`"use server"\` directives, etc.) and the user wants it turned into a Superblocks app.
8
8
  readOnly: true
9
9
  metadata:
10
10
  author: superblocks
@@ -33,6 +33,7 @@ Checklist discipline is required for every migration run:
33
33
  Match the source tree against these signals, then read the matching reference file in this folder. Read it once, up-front — it tells you what shapes to look for and how each maps to Superblocks.
34
34
 
35
35
  - **Replit** — \`replit.md\`, \`.replit\`, \`artifacts/\`, an Express server with an Orval-generated client. → load \`replit.md\`.
36
+ - **Streamlit** — \`streamlit_app.py\`, \`.streamlit/config.toml\`, dependency files containing \`streamlit\`, Python files with \`import streamlit as st\`, or a Python \`pages/\` multipage app structure. Follow the general guidelines in this document.
36
37
  - **Lovable** — \`src/integrations/supabase/client.ts\`, \`supabase/config.toml\`, \`supabase/functions/\`, \`supabase/migrations/\`, \`lovable-tagger\` in \`vite.config.ts\`. → load \`lovable.md\`.
37
38
  - **v0** — \`app/<segment>/page.tsx\` (Next.js App Router) plus \`next.config.{js,mjs,ts}\` and \`next\` in \`package.json\`, files with \`"use client"\` / \`"use server"\` directives, \`next/link\` / \`next/navigation\` imports, \`components/ui/\` with shadcn primitives. → load \`v0.md\`.
38
39
  - **Claude Design** — a small flat archive (no \`package.json\`, no \`node_modules\`, no build config) with one top-level \`<Name>.html\` plus sibling \`app.jsx\`, \`data.js\`, and \`tweaks-panel.jsx\`. The HTML loads React + ReactDOM + Babel from a CDN, uses \`<html data-theme="...">\`, and references \`var(--accent)\` / \`var(--ink)\` CSS variables. The \`.jsx\` files contain \`/*EDITMODE-BEGIN*/ ... /*EDITMODE-END*/\` markers around defaults and use \`useTweaks\` / \`TweaksPanel\` / \`TweakSection\` / \`TweakToggle\` globals. → load \`claude-design.md\`.
@@ -1 +1 @@
1
- {"version":3,"file":"skill.generated.js","sourceRoot":"","sources":["../../../../../src/ai-service/skills/system/third-party-migration/skill.generated.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,mDAAmD;AAEnD,MAAM,CAAC,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmKtB,CAAC"}
1
+ {"version":3,"file":"skill.generated.js","sourceRoot":"","sources":["../../../../../src/ai-service/skills/system/third-party-migration/skill.generated.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,mDAAmD;AAEnD,MAAM,CAAC,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoKtB,CAAC"}
@@ -1,13 +1,14 @@
1
1
  import type { LanguageModelV3 } from "@ai-sdk/provider";
2
2
  import type { FinishReason } from "ai";
3
3
  import type { ViteDevServer } from "vite";
4
- import type { AiGenerateRequest, Attachment, LLMProviderConfig, PromptContextIntegration, PromptContext, PromptContextEntity, KnowledgePromotionCapabilities, RememberKnowledgeCandidate, RuntimeErrorData, AiMode, PlanContext, AiChatMessage, AiGenerationState, AiToolPermission, BrowserContext, ConsoleLogEntry, ApiRunRecord, KnowledgeSaveOutcome } from "@superblocksteam/library-shared/types";
4
+ import type { AiGenerateRequest, Attachment, LLMProviderConfig, PromptContextIntegration, PromptContext, PromptContextEntity, KnowledgePromotionCapabilities, RememberKnowledgeCandidate, RuntimeErrorData, AiMode, PlanContext, AiChatMessage, AiGenerationState, AiToolPermission, ClarkUserPreferences, BrowserContext, ConsoleLogEntry, ApiRunRecord, KnowledgeSaveOutcome } from "@superblocksteam/library-shared/types";
5
5
  import type { AiPromptCostUsageEntry, TracedEventEmitter } from "@superblocksteam/shared";
6
6
  import type { OperationQueue } from "../../util/operation-queue.js";
7
7
  import type { EntityPermissionStore } from "../agent/tools2/entity-permissions.js";
8
8
  import type { ToolRegistry } from "../agent/tools2/registry.js";
9
9
  import type { AccessControlContext, Tool } from "../agent/tools2/types.js";
10
10
  import type { FileSystemInterface } from "../app-interface/file-system-interface.js";
11
+ import type { NpmPackageLookup } from "../app-interface/npm-package-lookup.js";
11
12
  import type { AppShell } from "../app-interface/shell.js";
12
13
  import type { ChatSessionStore } from "../chat/chat-session-store.js";
13
14
  import type { AppContextStore } from "../context/app-context.js";
@@ -28,6 +29,7 @@ import type { RecordingManager } from "../recording/index.js";
28
29
  import type { TemplateRenderer } from "../template-renderer.js";
29
30
  import type { AiServiceConfig, AiServiceEvents, ChangeInfo, EditorClient, FileArtifact, UserChange } from "../types.js";
30
31
  import type { FSMOnTransitionParams, FSMTransitionHandlerFactory } from "./fsm.js";
32
+ import type { ReconnectablePeer } from "./helpers/stable-peer.js";
31
33
  import { TracedFSM, type TracedFSMStateSpanOptions, type TracedFSMTagProviderFactory } from "./traced-fsm.js";
32
34
  declare const $: {
33
35
  readonly Idle: "Idle";
@@ -323,8 +325,12 @@ export type ClarkContext = {
323
325
  *
324
326
  * The peer's identity token (`peerId`) lives on the proxy itself; read it
325
327
  * via `stablePeer.peerId` rather than tracking a separate context field.
328
+ *
329
+ * Typed as `ReconnectablePeer` too because the proxy always exposes the
330
+ * reconnect controls (`connectionGeneration`/`whenConnectedAfter`/
331
+ * `invalidateConnection`) that operation-level retry helpers depend on.
326
332
  */
327
- peer: EditorClient;
333
+ peer: EditorClient & ReconnectablePeer;
328
334
  hasSuggestions?: boolean;
329
335
  summaryMessages?: {
330
336
  role: "user" | "assistant";
@@ -409,6 +415,13 @@ export type ClarkContext = {
409
415
  */
410
416
  deliveredViaChannel?: boolean;
411
417
  };
418
+ /**
419
+ * User-controlled Clark preferences for the current prompt cycle. Populated
420
+ * from {@link AiGenerateRequest.userPreferences} in `handleAiGenerate`; read
421
+ * with `resolveUserPreferences(context.userPreferences)` so callers always
422
+ * see a fully-populated object with defaults applied.
423
+ */
424
+ userPreferences?: Partial<ClarkUserPreferences>;
412
425
  deferredInteractiveMessage?: {
413
426
  payload: AiChatMessage;
414
427
  };
@@ -488,6 +501,14 @@ export type ClarkContext = {
488
501
  export type ClarkStateHandlerParams = AiServiceConfig & {
489
502
  templateRenderer: TemplateRenderer;
490
503
  appShell: AppShell;
504
+ /**
505
+ * Process-lifetime `NpmPackageLookup` owned by the AiService. Reused across
506
+ * every `buildTools()` call so the `superblocks.npm.lookup.cache_size`
507
+ * `ObservableGauge` registers exactly once and the 60s TTL cache stays
508
+ * warm across LLM turns — see AiService's `npmPackageLookup` field for
509
+ * the OTel callback-leak rationale this replaces.
510
+ */
511
+ npmPackageLookup: NpmPackageLookup;
491
512
  signals: TracedEventEmitter<AiServiceEvents>;
492
513
  fileSystemInterface: FileSystemInterface;
493
514
  integrationStore: IntegrationStore;
@@ -1 +1 @@
1
- {"version":3,"file":"clark-fsm.d.ts","sourceRoot":"","sources":["../../../src/ai-service/state-machine/clark-fsm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD,OAAO,KAAK,EAAE,YAAY,EAAsB,MAAM,IAAI,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AAE1C,OAAO,KAAK,EACV,iBAAiB,EACjB,UAAU,EACV,iBAAiB,EACjB,wBAAwB,EACxB,aAAa,EACb,mBA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