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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (356) hide show
  1. package/dist/ai-service/agent/middleware.d.ts.map +1 -1
  2. package/dist/ai-service/agent/middleware.js +51 -1
  3. package/dist/ai-service/agent/middleware.js.map +1 -1
  4. package/dist/ai-service/agent/prompts/build-base-system-prompt.d.ts.map +1 -1
  5. package/dist/ai-service/agent/prompts/build-base-system-prompt.js +44 -4
  6. package/dist/ai-service/agent/prompts/build-base-system-prompt.js.map +1 -1
  7. package/dist/ai-service/agent/subagents/coding/run-coding-subagent.d.ts.map +1 -1
  8. package/dist/ai-service/agent/subagents/coding/run-coding-subagent.js +25 -0
  9. package/dist/ai-service/agent/subagents/coding/run-coding-subagent.js.map +1 -1
  10. package/dist/ai-service/agent/tools/apis/build-api-artifact.d.ts.map +1 -1
  11. package/dist/ai-service/agent/tools/apis/build-api-artifact.js +4 -3
  12. package/dist/ai-service/agent/tools/apis/build-api-artifact.js.map +1 -1
  13. package/dist/ai-service/agent/tools/apis/test-api.d.ts.map +1 -1
  14. package/dist/ai-service/agent/tools/apis/test-api.js +22 -0
  15. package/dist/ai-service/agent/tools/apis/test-api.js.map +1 -1
  16. package/dist/ai-service/agent/tools/build-capture-screenshot.d.ts +25 -0
  17. package/dist/ai-service/agent/tools/build-capture-screenshot.d.ts.map +1 -1
  18. package/dist/ai-service/agent/tools/build-capture-screenshot.js +117 -11
  19. package/dist/ai-service/agent/tools/build-capture-screenshot.js.map +1 -1
  20. package/dist/ai-service/agent/tools/build-manage-checklist.d.ts.map +1 -1
  21. package/dist/ai-service/agent/tools/build-manage-checklist.js +22 -0
  22. package/dist/ai-service/agent/tools/build-manage-checklist.js.map +1 -1
  23. package/dist/ai-service/agent/tools/databases/dev-database-tasks.d.ts +291 -0
  24. package/dist/ai-service/agent/tools/databases/dev-database-tasks.d.ts.map +1 -0
  25. package/dist/ai-service/agent/tools/databases/dev-database-tasks.js +386 -0
  26. package/dist/ai-service/agent/tools/databases/dev-database-tasks.js.map +1 -0
  27. package/dist/ai-service/agent/tools/databases/dev-database-tools.d.ts +17 -0
  28. package/dist/ai-service/agent/tools/databases/dev-database-tools.d.ts.map +1 -0
  29. package/dist/ai-service/agent/tools/databases/dev-database-tools.js +19 -0
  30. package/dist/ai-service/agent/tools/databases/dev-database-tools.js.map +1 -0
  31. package/dist/ai-service/agent/tools/index.d.ts +0 -1
  32. package/dist/ai-service/agent/tools/index.d.ts.map +1 -1
  33. package/dist/ai-service/agent/tools/index.js +0 -1
  34. package/dist/ai-service/agent/tools/index.js.map +1 -1
  35. package/dist/ai-service/agent/tools/integrations/execute-request.d.ts +1 -1
  36. package/dist/ai-service/agent/tools/integrations/execute-request.d.ts.map +1 -1
  37. package/dist/ai-service/agent/tools/integrations/execute-request.js +20 -9
  38. package/dist/ai-service/agent/tools/integrations/execute-request.js.map +1 -1
  39. package/dist/ai-service/agent/tools/integrations/internal.d.ts +5 -1
  40. package/dist/ai-service/agent/tools/integrations/internal.d.ts.map +1 -1
  41. package/dist/ai-service/agent/tools/integrations/internal.js +2 -1
  42. package/dist/ai-service/agent/tools/integrations/internal.js.map +1 -1
  43. package/dist/ai-service/agent/tools/screenshot-selector.d.ts +22 -0
  44. package/dist/ai-service/agent/tools/screenshot-selector.d.ts.map +1 -0
  45. package/dist/ai-service/agent/tools/screenshot-selector.js +158 -0
  46. package/dist/ai-service/agent/tools/screenshot-selector.js.map +1 -0
  47. package/dist/ai-service/agent/tools.d.ts +17 -0
  48. package/dist/ai-service/agent/tools.d.ts.map +1 -1
  49. package/dist/ai-service/agent/tools.js +65 -6
  50. package/dist/ai-service/agent/tools.js.map +1 -1
  51. package/dist/ai-service/agent/tools2/access-control.d.ts.map +1 -1
  52. package/dist/ai-service/agent/tools2/access-control.js +6 -1
  53. package/dist/ai-service/agent/tools2/access-control.js.map +1 -1
  54. package/dist/ai-service/agent/tools2/tools/cancel-task.d.ts +20 -0
  55. package/dist/ai-service/agent/tools2/tools/cancel-task.d.ts.map +1 -0
  56. package/dist/ai-service/agent/tools2/tools/cancel-task.js +39 -0
  57. package/dist/ai-service/agent/tools2/tools/cancel-task.js.map +1 -0
  58. package/dist/ai-service/agent/tools2/tools/check-task.d.ts +37 -0
  59. package/dist/ai-service/agent/tools2/tools/check-task.d.ts.map +1 -0
  60. package/dist/ai-service/agent/tools2/tools/check-task.js +53 -0
  61. package/dist/ai-service/agent/tools2/tools/check-task.js.map +1 -0
  62. package/dist/ai-service/agent/tools2/tools/exit-plan-mode.d.ts.map +1 -1
  63. package/dist/ai-service/agent/tools2/tools/exit-plan-mode.js +10 -0
  64. package/dist/ai-service/agent/tools2/tools/exit-plan-mode.js.map +1 -1
  65. package/dist/ai-service/agent/tools2/tools/git.d.ts +1 -1
  66. package/dist/ai-service/agent/tools2/tools/git.js +1 -1
  67. package/dist/ai-service/agent/tools2/tools/git.js.map +1 -1
  68. package/dist/ai-service/agent/tools2/tools/grep.d.ts +6 -1
  69. package/dist/ai-service/agent/tools2/tools/grep.d.ts.map +1 -1
  70. package/dist/ai-service/agent/tools2/tools/grep.js +37 -13
  71. package/dist/ai-service/agent/tools2/tools/grep.js.map +1 -1
  72. package/dist/ai-service/agent/tools2/tools/index.d.ts +4 -0
  73. package/dist/ai-service/agent/tools2/tools/index.d.ts.map +1 -1
  74. package/dist/ai-service/agent/tools2/tools/index.js +8 -0
  75. package/dist/ai-service/agent/tools2/tools/index.js.map +1 -1
  76. package/dist/ai-service/agent/tools2/tools/list-tasks.d.ts +21 -0
  77. package/dist/ai-service/agent/tools2/tools/list-tasks.d.ts.map +1 -0
  78. package/dist/ai-service/agent/tools2/tools/list-tasks.js +35 -0
  79. package/dist/ai-service/agent/tools2/tools/list-tasks.js.map +1 -0
  80. package/dist/ai-service/agent/tools2/tools/wait-for-task.d.ts +46 -0
  81. package/dist/ai-service/agent/tools2/tools/wait-for-task.d.ts.map +1 -0
  82. package/dist/ai-service/agent/tools2/tools/wait-for-task.js +83 -0
  83. package/dist/ai-service/agent/tools2/tools/wait-for-task.js.map +1 -0
  84. package/dist/ai-service/agent/tools2/types.d.ts +3 -0
  85. package/dist/ai-service/agent/tools2/types.d.ts.map +1 -1
  86. package/dist/ai-service/agent/tools2/types.js.map +1 -1
  87. package/dist/ai-service/agent/utils.d.ts.map +1 -1
  88. package/dist/ai-service/agent/utils.js +37 -2
  89. package/dist/ai-service/agent/utils.js.map +1 -1
  90. package/dist/ai-service/app-interface/npm-package-lookup.d.ts +22 -0
  91. package/dist/ai-service/app-interface/npm-package-lookup.d.ts.map +1 -1
  92. package/dist/ai-service/app-interface/npm-package-lookup.js +88 -1
  93. package/dist/ai-service/app-interface/npm-package-lookup.js.map +1 -1
  94. package/dist/ai-service/app-interface/npm-registry.d.ts +7 -0
  95. package/dist/ai-service/app-interface/npm-registry.d.ts.map +1 -1
  96. package/dist/ai-service/app-interface/npm-registry.js +74 -4
  97. package/dist/ai-service/app-interface/npm-registry.js.map +1 -1
  98. package/dist/ai-service/app-interface/shell.d.ts +32 -1
  99. package/dist/ai-service/app-interface/shell.d.ts.map +1 -1
  100. package/dist/ai-service/app-interface/shell.js +86 -3
  101. package/dist/ai-service/app-interface/shell.js.map +1 -1
  102. package/dist/ai-service/app-skills/manager.d.ts +4 -1
  103. package/dist/ai-service/app-skills/manager.d.ts.map +1 -1
  104. package/dist/ai-service/app-skills/manager.js +16 -1
  105. package/dist/ai-service/app-skills/manager.js.map +1 -1
  106. package/dist/ai-service/chat/chat-session-store.d.ts +10 -0
  107. package/dist/ai-service/chat/chat-session-store.d.ts.map +1 -1
  108. package/dist/ai-service/chat/chat-session-store.js +55 -28
  109. package/dist/ai-service/chat/chat-session-store.js.map +1 -1
  110. package/dist/ai-service/context-download.d.ts.map +1 -1
  111. package/dist/ai-service/context-download.js +50 -40
  112. package/dist/ai-service/context-download.js.map +1 -1
  113. package/dist/ai-service/dev-database-client.d.ts +27 -4
  114. package/dist/ai-service/dev-database-client.d.ts.map +1 -1
  115. package/dist/ai-service/dev-database-client.js +35 -1
  116. package/dist/ai-service/dev-database-client.js.map +1 -1
  117. package/dist/ai-service/dev-database-file-sync.d.ts +41 -0
  118. package/dist/ai-service/dev-database-file-sync.d.ts.map +1 -0
  119. package/dist/ai-service/dev-database-file-sync.js +29 -0
  120. package/dist/ai-service/dev-database-file-sync.js.map +1 -0
  121. package/dist/ai-service/features.d.ts +14 -0
  122. package/dist/ai-service/features.d.ts.map +1 -1
  123. package/dist/ai-service/features.js +14 -0
  124. package/dist/ai-service/features.js.map +1 -1
  125. package/dist/ai-service/index.d.ts +136 -5
  126. package/dist/ai-service/index.d.ts.map +1 -1
  127. package/dist/ai-service/index.js +748 -99
  128. package/dist/ai-service/index.js.map +1 -1
  129. package/dist/ai-service/integrations/store.d.ts +2 -0
  130. package/dist/ai-service/integrations/store.d.ts.map +1 -1
  131. package/dist/ai-service/integrations/store.js +4 -0
  132. package/dist/ai-service/integrations/store.js.map +1 -1
  133. package/dist/ai-service/knowledge/knowledge-manager.d.ts +8 -10
  134. package/dist/ai-service/knowledge/knowledge-manager.d.ts.map +1 -1
  135. package/dist/ai-service/knowledge/knowledge-manager.js +135 -119
  136. package/dist/ai-service/knowledge/knowledge-manager.js.map +1 -1
  137. package/dist/ai-service/llm/chaos-fetch.d.ts.map +1 -1
  138. package/dist/ai-service/llm/chaos-fetch.js +7 -3
  139. package/dist/ai-service/llm/chaos-fetch.js.map +1 -1
  140. package/dist/ai-service/llm/client.d.ts.map +1 -1
  141. package/dist/ai-service/llm/client.js +23 -7
  142. package/dist/ai-service/llm/client.js.map +1 -1
  143. package/dist/ai-service/llm/context-v2/adapter.d.ts +3 -0
  144. package/dist/ai-service/llm/context-v2/adapter.d.ts.map +1 -1
  145. package/dist/ai-service/llm/context-v2/adapter.js +9 -0
  146. package/dist/ai-service/llm/context-v2/adapter.js.map +1 -1
  147. package/dist/ai-service/llm/context-v2/compaction/server-side.d.ts +2 -0
  148. package/dist/ai-service/llm/context-v2/compaction/server-side.d.ts.map +1 -1
  149. package/dist/ai-service/llm/context-v2/compaction/server-side.js +6 -2
  150. package/dist/ai-service/llm/context-v2/compaction/server-side.js.map +1 -1
  151. package/dist/ai-service/llm/context-v2/context-management.d.ts +3 -9
  152. package/dist/ai-service/llm/context-v2/context-management.d.ts.map +1 -1
  153. package/dist/ai-service/llm/context-v2/context-management.js +3 -9
  154. package/dist/ai-service/llm/context-v2/context-management.js.map +1 -1
  155. package/dist/ai-service/llm/context-v2/context-metrics.d.ts +23 -0
  156. package/dist/ai-service/llm/context-v2/context-metrics.d.ts.map +1 -0
  157. package/dist/ai-service/llm/context-v2/context-metrics.js +144 -0
  158. package/dist/ai-service/llm/context-v2/context-metrics.js.map +1 -0
  159. package/dist/ai-service/llm/context-v2/context.d.ts +16 -1
  160. package/dist/ai-service/llm/context-v2/context.d.ts.map +1 -1
  161. package/dist/ai-service/llm/context-v2/context.js +138 -26
  162. package/dist/ai-service/llm/context-v2/context.js.map +1 -1
  163. package/dist/ai-service/llm/context-v2/conversation-context.d.ts +26 -1
  164. package/dist/ai-service/llm/context-v2/conversation-context.d.ts.map +1 -1
  165. package/dist/ai-service/llm/context-v2/manager.d.ts +15 -1
  166. package/dist/ai-service/llm/context-v2/manager.d.ts.map +1 -1
  167. package/dist/ai-service/llm/context-v2/manager.js +97 -40
  168. package/dist/ai-service/llm/context-v2/manager.js.map +1 -1
  169. package/dist/ai-service/llm/context-v2/storage/local.d.ts.map +1 -1
  170. package/dist/ai-service/llm/context-v2/storage/local.js +3 -0
  171. package/dist/ai-service/llm/context-v2/storage/local.js.map +1 -1
  172. package/dist/ai-service/llm/context-v2/types.d.ts +27 -0
  173. package/dist/ai-service/llm/context-v2/types.d.ts.map +1 -1
  174. package/dist/ai-service/llm/context-v2/types.js +108 -23
  175. package/dist/ai-service/llm/context-v2/types.js.map +1 -1
  176. package/dist/ai-service/llm/error.d.ts +21 -0
  177. package/dist/ai-service/llm/error.d.ts.map +1 -1
  178. package/dist/ai-service/llm/error.js +72 -12
  179. package/dist/ai-service/llm/error.js.map +1 -1
  180. package/dist/ai-service/llm/stream/compaction-text-block.d.ts +14 -0
  181. package/dist/ai-service/llm/stream/compaction-text-block.d.ts.map +1 -0
  182. package/dist/ai-service/llm/stream/compaction-text-block.js +29 -0
  183. package/dist/ai-service/llm/stream/compaction-text-block.js.map +1 -0
  184. package/dist/ai-service/llm/stream/idle-monitor.d.ts.map +1 -1
  185. package/dist/ai-service/llm/stream/idle-monitor.js +12 -28
  186. package/dist/ai-service/llm/stream/idle-monitor.js.map +1 -1
  187. package/dist/ai-service/llm/stream/managed-stream.d.ts.map +1 -1
  188. package/dist/ai-service/llm/stream/managed-stream.js +22 -0
  189. package/dist/ai-service/llm/stream/managed-stream.js.map +1 -1
  190. package/dist/ai-service/llm/stream/observers/context.d.ts +4 -0
  191. package/dist/ai-service/llm/stream/observers/context.d.ts.map +1 -1
  192. package/dist/ai-service/llm/stream/observers/context.js +57 -5
  193. package/dist/ai-service/llm/stream/observers/context.js.map +1 -1
  194. package/dist/ai-service/policy-gate-step.d.ts +17 -0
  195. package/dist/ai-service/policy-gate-step.d.ts.map +1 -0
  196. package/dist/ai-service/policy-gate-step.js +52 -0
  197. package/dist/ai-service/policy-gate-step.js.map +1 -0
  198. package/dist/ai-service/quota-client.d.ts +28 -0
  199. package/dist/ai-service/quota-client.d.ts.map +1 -0
  200. package/dist/ai-service/quota-client.js +68 -0
  201. package/dist/ai-service/quota-client.js.map +1 -0
  202. package/dist/ai-service/security/index.d.ts +1 -1
  203. package/dist/ai-service/security/index.d.ts.map +1 -1
  204. package/dist/ai-service/security/index.js +1 -1
  205. package/dist/ai-service/security/index.js.map +1 -1
  206. package/dist/ai-service/security/safety-classifier.d.ts +9 -26
  207. package/dist/ai-service/security/safety-classifier.d.ts.map +1 -1
  208. package/dist/ai-service/security/safety-classifier.js +29 -44
  209. package/dist/ai-service/security/safety-classifier.js.map +1 -1
  210. package/dist/ai-service/skills/system/_registry.generated.d.ts.map +1 -1
  211. package/dist/ai-service/skills/system/_registry.generated.js +2 -0
  212. package/dist/ai-service/skills/system/_registry.generated.js.map +1 -1
  213. package/dist/ai-service/skills/system/common-import-issues/skill.generated.d.ts +2 -0
  214. package/dist/ai-service/skills/system/common-import-issues/skill.generated.d.ts.map +1 -0
  215. package/dist/ai-service/skills/system/common-import-issues/skill.generated.js +93 -0
  216. package/dist/ai-service/skills/system/common-import-issues/skill.generated.js.map +1 -0
  217. package/dist/ai-service/skills/system/superblocks-frontend/skill.generated.d.ts +1 -1
  218. package/dist/ai-service/skills/system/superblocks-frontend/skill.generated.d.ts.map +1 -1
  219. package/dist/ai-service/skills/system/superblocks-frontend/skill.generated.js +15 -0
  220. package/dist/ai-service/skills/system/superblocks-frontend/skill.generated.js.map +1 -1
  221. package/dist/ai-service/skills/system/superblocks-migration/skill.generated.d.ts +1 -1
  222. package/dist/ai-service/skills/system/superblocks-migration/skill.generated.d.ts.map +1 -1
  223. package/dist/ai-service/skills/system/superblocks-migration/skill.generated.js +7 -2
  224. package/dist/ai-service/skills/system/superblocks-migration/skill.generated.js.map +1 -1
  225. package/dist/ai-service/state-machine/clark-fsm.d.ts +74 -1
  226. package/dist/ai-service/state-machine/clark-fsm.d.ts.map +1 -1
  227. package/dist/ai-service/state-machine/clark-fsm.js +26 -7
  228. package/dist/ai-service/state-machine/clark-fsm.js.map +1 -1
  229. package/dist/ai-service/state-machine/handlers/agent-planning.d.ts.map +1 -1
  230. package/dist/ai-service/state-machine/handlers/agent-planning.js +223 -9
  231. package/dist/ai-service/state-machine/handlers/agent-planning.js.map +1 -1
  232. package/dist/ai-service/state-machine/handlers/idle.d.ts.map +1 -1
  233. package/dist/ai-service/state-machine/handlers/idle.js +42 -6
  234. package/dist/ai-service/state-machine/handlers/idle.js.map +1 -1
  235. package/dist/ai-service/state-machine/handlers/llm-generating.d.ts.map +1 -1
  236. package/dist/ai-service/state-machine/handlers/llm-generating.js +16 -6
  237. package/dist/ai-service/state-machine/handlers/llm-generating.js.map +1 -1
  238. package/dist/ai-service/state-machine/helpers/peer.d.ts.map +1 -1
  239. package/dist/ai-service/state-machine/helpers/peer.js +9 -1
  240. package/dist/ai-service/state-machine/helpers/peer.js.map +1 -1
  241. package/dist/ai-service/tasks/access.d.ts +23 -0
  242. package/dist/ai-service/tasks/access.d.ts.map +1 -0
  243. package/dist/ai-service/tasks/access.js +26 -0
  244. package/dist/ai-service/tasks/access.js.map +1 -0
  245. package/dist/ai-service/tasks/factory.d.ts +92 -0
  246. package/dist/ai-service/tasks/factory.d.ts.map +1 -0
  247. package/dist/ai-service/tasks/factory.js +54 -0
  248. package/dist/ai-service/tasks/factory.js.map +1 -0
  249. package/dist/ai-service/tasks/index.d.ts +8 -0
  250. package/dist/ai-service/tasks/index.d.ts.map +1 -0
  251. package/dist/ai-service/tasks/index.js +7 -0
  252. package/dist/ai-service/tasks/index.js.map +1 -0
  253. package/dist/ai-service/tasks/peer-push.d.ts +78 -0
  254. package/dist/ai-service/tasks/peer-push.d.ts.map +1 -0
  255. package/dist/ai-service/tasks/peer-push.js +74 -0
  256. package/dist/ai-service/tasks/peer-push.js.map +1 -0
  257. package/dist/ai-service/tasks/poll-loop.d.ts +55 -0
  258. package/dist/ai-service/tasks/poll-loop.d.ts.map +1 -0
  259. package/dist/ai-service/tasks/poll-loop.js +73 -0
  260. package/dist/ai-service/tasks/poll-loop.js.map +1 -0
  261. package/dist/ai-service/tasks/task-store.d.ts +106 -0
  262. package/dist/ai-service/tasks/task-store.d.ts.map +1 -0
  263. package/dist/ai-service/tasks/task-store.js +292 -0
  264. package/dist/ai-service/tasks/task-store.js.map +1 -0
  265. package/dist/ai-service/tasks/test-utils.d.ts +23 -0
  266. package/dist/ai-service/tasks/test-utils.d.ts.map +1 -0
  267. package/dist/ai-service/tasks/test-utils.js +53 -0
  268. package/dist/ai-service/tasks/test-utils.js.map +1 -0
  269. package/dist/ai-service/tasks/types.d.ts +205 -0
  270. package/dist/ai-service/tasks/types.d.ts.map +1 -0
  271. package/dist/ai-service/tasks/types.js +24 -0
  272. package/dist/ai-service/tasks/types.js.map +1 -0
  273. package/dist/ai-service/template-renderer.d.ts.map +1 -1
  274. package/dist/ai-service/template-renderer.js +1 -0
  275. package/dist/ai-service/template-renderer.js.map +1 -1
  276. package/dist/ai-service/test-utils/metrics-harness.d.ts +32 -0
  277. package/dist/ai-service/test-utils/metrics-harness.d.ts.map +1 -0
  278. package/dist/ai-service/test-utils/metrics-harness.js +67 -0
  279. package/dist/ai-service/test-utils/metrics-harness.js.map +1 -0
  280. package/dist/ai-service/test-utils/tracer-harness.d.ts +8 -0
  281. package/dist/ai-service/test-utils/tracer-harness.d.ts.map +1 -0
  282. package/dist/ai-service/test-utils/tracer-harness.js +26 -0
  283. package/dist/ai-service/test-utils/tracer-harness.js.map +1 -0
  284. package/dist/ai-service/transform/lucide-dynamic-type-imports/transformer.d.ts +40 -0
  285. package/dist/ai-service/transform/lucide-dynamic-type-imports/transformer.d.ts.map +1 -0
  286. package/dist/ai-service/transform/lucide-dynamic-type-imports/transformer.js +118 -0
  287. package/dist/ai-service/transform/lucide-dynamic-type-imports/transformer.js.map +1 -0
  288. package/dist/ai-service/util/llm-config-utils.d.ts +2 -6
  289. package/dist/ai-service/util/llm-config-utils.d.ts.map +1 -1
  290. package/dist/ai-service/util/llm-config-utils.js +2 -7
  291. package/dist/ai-service/util/llm-config-utils.js.map +1 -1
  292. package/dist/ai-service/util/rpc-timeout.d.ts +17 -7
  293. package/dist/ai-service/util/rpc-timeout.d.ts.map +1 -1
  294. package/dist/ai-service/util/rpc-timeout.js +17 -7
  295. package/dist/ai-service/util/rpc-timeout.js.map +1 -1
  296. package/dist/file-sync-vite-plugin.d.ts.map +1 -1
  297. package/dist/file-sync-vite-plugin.js +76 -6
  298. package/dist/file-sync-vite-plugin.js.map +1 -1
  299. package/dist/inject-index-vite-plugin.d.ts.map +1 -1
  300. package/dist/inject-index-vite-plugin.js +4 -0
  301. package/dist/inject-index-vite-plugin.js.map +1 -1
  302. package/dist/migration/migration-routes.d.ts +14 -0
  303. package/dist/migration/migration-routes.d.ts.map +1 -1
  304. package/dist/migration/migration-routes.js +284 -5
  305. package/dist/migration/migration-routes.js.map +1 -1
  306. package/dist/migration/migration-session-reconcile.d.ts +23 -0
  307. package/dist/migration/migration-session-reconcile.d.ts.map +1 -0
  308. package/dist/migration/migration-session-reconcile.js +129 -0
  309. package/dist/migration/migration-session-reconcile.js.map +1 -0
  310. package/dist/migration/restructure.d.ts.map +1 -1
  311. package/dist/migration/restructure.js +2 -0
  312. package/dist/migration/restructure.js.map +1 -1
  313. package/dist/migration-templates/app-fullstack/css.d.ts +3 -0
  314. package/dist/migration-templates/app-fullstack/package.json +2 -2
  315. package/dist/npm/normalize-workspace-protocol-for-npm.d.ts +15 -0
  316. package/dist/npm/normalize-workspace-protocol-for-npm.d.ts.map +1 -0
  317. package/dist/npm/normalize-workspace-protocol-for-npm.js +36 -0
  318. package/dist/npm/normalize-workspace-protocol-for-npm.js.map +1 -0
  319. package/dist/npm/prepare-package-json-for-cloud-npm.d.ts +21 -0
  320. package/dist/npm/prepare-package-json-for-cloud-npm.d.ts.map +1 -0
  321. package/dist/npm/prepare-package-json-for-cloud-npm.js +44 -0
  322. package/dist/npm/prepare-package-json-for-cloud-npm.js.map +1 -0
  323. package/dist/npm/rewrite-platform-workspace-deps.d.ts +17 -0
  324. package/dist/npm/rewrite-platform-workspace-deps.d.ts.map +1 -0
  325. package/dist/npm/rewrite-platform-workspace-deps.js +37 -0
  326. package/dist/npm/rewrite-platform-workspace-deps.js.map +1 -0
  327. package/dist/plugin-options.d.ts +8 -0
  328. package/dist/plugin-options.d.ts.map +1 -1
  329. package/dist/plugin-options.js.map +1 -1
  330. package/dist/policy-gate-run-registry.d.ts +28 -0
  331. package/dist/policy-gate-run-registry.d.ts.map +1 -0
  332. package/dist/policy-gate-run-registry.js +40 -0
  333. package/dist/policy-gate-run-registry.js.map +1 -0
  334. package/dist/policy-gate-runner.d.ts +2 -0
  335. package/dist/policy-gate-runner.d.ts.map +1 -1
  336. package/dist/policy-gate-runner.js +14 -1
  337. package/dist/policy-gate-runner.js.map +1 -1
  338. package/dist/socket-manager.d.ts.map +1 -1
  339. package/dist/socket-manager.js +55 -0
  340. package/dist/socket-manager.js.map +1 -1
  341. package/dist/sync-service/download.d.ts.map +1 -1
  342. package/dist/sync-service/download.js +6 -4
  343. package/dist/sync-service/download.js.map +1 -1
  344. package/dist/sync-service/draft-reconcile.d.ts +22 -0
  345. package/dist/sync-service/draft-reconcile.d.ts.map +1 -0
  346. package/dist/sync-service/draft-reconcile.js +24 -0
  347. package/dist/sync-service/draft-reconcile.js.map +1 -0
  348. package/dist/sync-service/index.d.ts +30 -5
  349. package/dist/sync-service/index.d.ts.map +1 -1
  350. package/dist/sync-service/index.js +59 -8
  351. package/dist/sync-service/index.js.map +1 -1
  352. package/package.json +10 -10
  353. package/dist/ai-service/agent/tools/databases/dev-database.d.ts +0 -103
  354. package/dist/ai-service/agent/tools/databases/dev-database.d.ts.map +0 -1
  355. package/dist/ai-service/agent/tools/databases/dev-database.js +0 -117
  356. package/dist/ai-service/agent/tools/databases/dev-database.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"skill.generated.js","sourceRoot":"","sources":["../../../../../src/ai-service/skills/system/superblocks-frontend/skill.generated.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,mDAAmD;AAEnD,MAAM,CAAC,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkrBtB,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 `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";
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 (`apiInputs` / externally-declared parameters) and the v3 TS from step 3 (`input` schema on `run(ctx, input)`). Every name the caller must supply must appear as a top-level key in `inputs` with a realistic mock value matching its expected type. This includes two categories \u2014 do not conflate them:\n - **API parameters** \u2014 names declared in `apiInputs` (v2) or the v3 `input` shape (e.g. `sourceContext`, `currentDocument`, `messages`). Pass each parameter name directly as a key in `inputs`. These are what the frontend passes when it invokes the API; they are not unavailable \"runtime bindings.\"\n - **UI bindings and caller context** \u2014 values the API reads from the app that are not API parameters (component values like `Input1.value`/`Select1.selectedItem.id`, table selections like `Table1.selectedRow`, state variables, workflow `body`/`params` not declared as `apiInputs`). Mock each binding the API references that isn't produced by an earlier block.\n\n Both v2 and v3 receive the same `inputs`, so this is what makes the diff meaningful \u2014 `{}` for an API that expects parameters or bindings produces a vacuous `both_failed` that tells you nothing. Errors like `'sourceContext' is not defined` (v2) or v3 input-validation failures for missing required fields mean you omitted keys from `inputs`; synthesize mocks and retry. That is not an environmental failure.\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: {}` or omitted declared API parameters / bindings: synthesize real `inputs` (per the bullet above) and retry. Do NOT mark completed here \u2014 missing inputs caused this, not a real failure.\n - If the error names a symbol that appears in `apiInputs` or the v3 `input` schema: add that key to `inputs` with a realistic mock and retry. Do NOT classify this as environmental \u2014 the parameter is available; you did not supply it.\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,0w5BA8QnB,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,837BAmRnB,CAAC"}
@@ -192,7 +192,11 @@ For APIs you migrate yourself, or that you embed in a sub-agent's \`instructions
192
192
 
193
193
  Your job is to make v3 produce the same response as v2 — 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 — those buttons exist as escape hatches for situations the policy gate requires (mutations, denied integrations), not as a way for you to skip work.
194
194
 
195
- 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 \`{}\` for an API with bindings produces a vacuous \`both_failed\` that tells you nothing.
195
+ Synthesize \`inputs\` the same way you would for \`testApi\`. Inspect the v2 YAML from step 2 (\`apiInputs\` / externally-declared parameters) and the v3 TS from step 3 (\`input\` schema on \`run(ctx, input)\`). Every name the caller must supply must appear as a top-level key in \`inputs\` with a realistic mock value matching its expected type. This includes two categoriesdo not conflate them:
196
+ - **API parameters** — names declared in \`apiInputs\` (v2) or the v3 \`input\` shape (e.g. \`sourceContext\`, \`currentDocument\`, \`messages\`). Pass each parameter name directly as a key in \`inputs\`. These are what the frontend passes when it invokes the API; they are not unavailable "runtime bindings."
197
+ - **UI bindings and caller context** — values the API reads from the app that are not API parameters (component values like \`Input1.value\`/\`Select1.selectedItem.id\`, table selections like \`Table1.selectedRow\`, state variables, workflow \`body\`/\`params\` not declared as \`apiInputs\`). Mock each binding the API references that isn't produced by an earlier block.
198
+
199
+ Both v2 and v3 receive the same \`inputs\`, so this is what makes the diff meaningful — \`{}\` for an API that expects parameters or bindings produces a vacuous \`both_failed\` that tells you nothing. Errors like \`'sourceContext' is not defined\` (v2) or v3 input-validation failures for missing required fields mean you omitted keys from \`inputs\`; synthesize mocks and retry. That is not an environmental failure.
196
200
 
197
201
  Outcomes and how to resolve them:
198
202
  - **\`passed\`**: call \`build_manageChecklist\` with \`status: "completed"\`. Done.
@@ -203,7 +207,8 @@ For APIs you migrate yourself, or that you embed in a sub-agent's \`instructions
203
207
  - **\`v2_unrunnable\`**: the v2 backup itself couldn't execute, so there is no baseline to match. Call \`build_manageChecklist\` with \`status: "completed"\` and continue.
204
208
 
205
209
  - **\`both_failed\`**:
206
- - If you passed \`inputs: {}\` and the API references bindings: synthesize real \`inputs\` (per the bullet above) and retry. Do NOT mark completed here — empty inputs caused this, not a real failure.
210
+ - If you passed \`inputs: {}\` or omitted declared API parameters / bindings: synthesize real \`inputs\` (per the bullet above) and retry. Do NOT mark completed here — missing inputs caused this, not a real failure.
211
+ - If the error names a symbol that appears in \`apiInputs\` or the v3 \`input\` schema: add that key to \`inputs\` with a realistic mock and retry. Do NOT classify this as environmental — the parameter is available; you did not supply it.
207
212
  - 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 — 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 — revise inputs and retry).
208
213
 
209
214
  - **\`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.
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8QtB,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmRtB,CAAC"}
@@ -2,7 +2,7 @@ import type { LanguageModelV3 } from "@ai-sdk/provider";
2
2
  import type { FinishReason } from "ai";
3
3
  import type { ViteDevServer } from "vite";
4
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
- import type { AiPromptCostUsageEntry, TracedEventEmitter } from "@superblocksteam/shared";
5
+ import type { AiPromptCostUsageEntry, AiQuotaPaywallReason, 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";
@@ -26,6 +26,7 @@ import type { PlaywrightMcpServerManager } from "../mcp/playwright-server.js";
26
26
  import type { ClarkProfiler } from "../profiler/clark-profiler.js";
27
27
  import type { PromptInterpretTask } from "../prompt-builder-service/classifiers/prompt-interpret-task.js";
28
28
  import type { RecordingManager } from "../recording/index.js";
29
+ import type { TaskStore } from "../tasks/task-store.js";
29
30
  import type { TemplateRenderer } from "../template-renderer.js";
30
31
  import type { AiServiceConfig, AiServiceEvents, ChangeInfo, EditorClient, FileArtifact, UserChange } from "../types.js";
31
32
  import type { FSMOnTransitionParams, FSMTransitionHandlerFactory } from "./fsm.js";
@@ -103,6 +104,15 @@ export type ClarkEvent = {
103
104
  debugging?: boolean;
104
105
  /** True if this is an original user prompt (not a response to interactive message). Defaults to true. */
105
106
  isUserPrompt?: boolean;
107
+ /**
108
+ * Resuming after a credit-paywall pause. The user message in this case
109
+ * is wrapped with synthetic resume coaching that reliably trips the
110
+ * safety classifier as prompt injection, but it still contains the
111
+ * user's raw prompt text — so secret-redaction must stay ON even
112
+ * though the classifier is OFF. `isUserPrompt: false` turns BOTH off,
113
+ * so paywall-resume gets its own dedicated flag. (APPS-4080)
114
+ */
115
+ isPaywallResume?: boolean;
106
116
  knowledgeMessageId?: string;
107
117
  } | {
108
118
  type: typeof AGENT_REPORTED_ERROR_TO_USER;
@@ -115,6 +125,7 @@ export type ClarkEvent = {
115
125
  } | {
116
126
  type: typeof AGENT_CANCELED;
117
127
  advice?: string;
128
+ paywallReason?: AiQuotaPaywallReason;
118
129
  } | {
119
130
  type: typeof LLM_REQUESTED_CONTEXT;
120
131
  prompt: string;
@@ -332,6 +343,45 @@ export type ClarkContext = {
332
343
  */
333
344
  peer: EditorClient & ReconnectablePeer;
334
345
  hasSuggestions?: boolean;
346
+ /**
347
+ * Set when the previous run terminated via the mid-prompt quota gate
348
+ * (`AGENT_CANCELED` with a `paywallReason`). The next `USER_SENT_PROMPT`
349
+ * reads this and prepends a synthetic resume hint to the user's prompt
350
+ * so the model picks up from the prior tool results instead of asking
351
+ * clarifying questions, then clears the flag. See APPS-4080
352
+ * "resume-quality hardening" follow-up.
353
+ */
354
+ pausedForCreditsReason?: AiQuotaPaywallReason;
355
+ /**
356
+ * Set alongside `pausedForCreditsReason` when the failed turn was a
357
+ * response to a multi-choice question. The resume hint in `USER_SENT_PROMPT`
358
+ * uses these fields to re-state the original question and the user's
359
+ * specific selection so the model honors it instead of drifting to a
360
+ * different default. Without this, the model has been observed to
361
+ * re-decide the open question on its own (e.g. picking "Use sample data"
362
+ * after the user clicked "Connect a database"). See APPS-4080
363
+ * "resume-quality hardening — multi-choice variant".
364
+ */
365
+ pausedForCreditsMultiChoiceContext?: {
366
+ /** The original question from the multi_choice message. */
367
+ question: string;
368
+ /** Texts the user actually selected (empty if they typed free text). */
369
+ selectedChoiceTexts: string[];
370
+ /** Free-text response, if the user typed instead of selecting. */
371
+ userText?: string;
372
+ };
373
+ /**
374
+ * Captures the most recent `multi_choice_response` request in flight, so
375
+ * that if the LLM call fails with a paywall, `LLM_ERRORED` can promote
376
+ * this into `pausedForCreditsMultiChoiceContext` for the next turn's
377
+ * resume hint. Overwritten at the start of every `USER_SENT_PROMPT`
378
+ * (set to `undefined` for non-multi-choice prompts).
379
+ */
380
+ lastTurnMultiChoiceContext?: {
381
+ question: string;
382
+ selectedChoiceTexts: string[];
383
+ userText?: string;
384
+ };
335
385
  summaryMessages?: {
336
386
  role: "user" | "assistant";
337
387
  isDebugging: boolean;
@@ -349,6 +399,7 @@ export type ClarkContext = {
349
399
  runTimestamp?: string;
350
400
  jwt?: string;
351
401
  promptId?: string;
402
+ usageMetadata?: Record<string, unknown>;
352
403
  chatmessageId?: string;
353
404
  availableIntegrations?: PromptContextIntegration[];
354
405
  knowledgePromotionCapabilities?: KnowledgePromotionCapabilities;
@@ -401,6 +452,8 @@ export type ClarkContext = {
401
452
  lastGenerationState?: {
402
453
  state: AiGenerationState;
403
454
  hasSuggestions?: boolean;
455
+ hasError?: boolean;
456
+ paywallReason?: AiQuotaPaywallReason;
404
457
  };
405
458
  activeInteractiveMessage?: {
406
459
  id: string;
@@ -524,6 +577,26 @@ export type ClarkStateHandlerParams = AiServiceConfig & {
524
577
  mcpServerManager: PlaywrightMcpServerManager;
525
578
  viteServer?: ViteDevServer;
526
579
  recordingManager?: RecordingManager;
580
+ /**
581
+ * Per-session owner of background tasks (dev-DB provisioning today; Devin,
582
+ * CI, etc. future). Present only when `features.managedNativeDbEnabled`
583
+ * (the dev-DB feature rollout, since dev-DB provisioning is the only
584
+ * producer today) is on; stays `undefined` otherwise so the framework is
585
+ * invisible.
586
+ */
587
+ taskStore?: TaskStore;
588
+ /**
589
+ * Returns the current "owner" identity for any tool calls in this turn,
590
+ * used to stamp `ownerUserId` on background tasks at kickoff and to filter
591
+ * `listTasks` / gate `checkTask` / `waitForTask` / `cancelTask` to that
592
+ * caller. Returns `undefined` when no JWT-derived identity is available
593
+ * (anonymous reconnect, local dev), in which case stamped tasks remain
594
+ * accessible to anyone in the session — see `tasks/access.ts`.
595
+ *
596
+ * Only consumed by the four task tools today; wired through to
597
+ * `defineBackgroundTaskFactory` for kickoff stamping.
598
+ */
599
+ getCurrentOwnerId?: () => string | undefined;
527
600
  };
528
601
  /**
529
602
  * Options for Clark.streamText().
@@ -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,mBAAmB,EACnB,8BAA8B,EAC9B,0BAA0B,EAC1B,gBAAgB,EAChB,MAAM,EACN,WAAW,EAGX,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,cAAc,EACd,eAAe,EACf,YAAY,EACZ,oBAAoB,EACrB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,KAAK,EACV,sBAAsB,EACtB,kBAAkB,EACnB,MAAM,yBAAyB,CAA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AAE,IAAI,CAAC,CAClC,SAAQ,IAAI,CAAC,0BAA0B,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,gBAAgB,CAAC;IAC3E,iGAAiG;IACjG,KAAK,CAAC,EAAE,eAAe,CAAC;CACzB"}
@@ -5,7 +5,6 @@ import { selectContextManagementStrategy, } from "../llm/context-v2/context-mana
5
5
  import { computeContextUsed } from "../llm/context-v2/token-tracker.js";
6
6
  import { getActiveContext } from "../llm/context-v2/utils/get-loaded-context.js";
7
7
  import { processLLMConfig } from "../util/llm-config-utils.js";
8
- import { buildModeMessage } from "../util/mode-message.js";
9
8
  import { parseJwt } from "../util/parse-jwt.js";
10
9
  import { sendUserMessageChannel } from "./helpers/peer.js";
11
10
  import { TracedFSM, } from "./traced-fsm.js";
@@ -151,6 +150,32 @@ export class Clark extends TracedFSM {
151
150
  // markSdkApiAsUntestedIfNeeded can diff against the previous state
152
151
  // instead of treating every API as newly added.
153
152
  sdkApiRegistryEntryPoints: ctx.sdkApiRegistryEntryPoints,
153
+ // APPS-4080: preserve credit-paywall pause state across resets so
154
+ // the resume hint can fire on the next user prompt. Without this,
155
+ // the mid-stream paywall path (LLM_ERRORED -> AGENT_CANCELED ->
156
+ // doIdle which calls resetContext) wipes the flag before
157
+ // agent-planning.ts:USER_SENT_PROMPT reads it, and the synthetic
158
+ // "(Heads up: my prior turn got paused…)" wrap never fires. The
159
+ // pre-call paywall path doesn't transition through Idle so it
160
+ // was unaffected — this fix closes the mid-stream gap. The fields
161
+ // are cleared explicitly inside the USER_SENT_PROMPT handler once
162
+ // they've been consumed.
163
+ pausedForCreditsReason: ctx.pausedForCreditsReason,
164
+ pausedForCreditsMultiChoiceContext: ctx.pausedForCreditsMultiChoiceContext,
165
+ // APPS-4080: preserve the last generation-state snapshot across
166
+ // resets so reconnect replay in `handleUserConnected` can faithfully
167
+ // reproduce CANCELLED + paywallReason after a mid-stream credit
168
+ // paywall. Without this, the flow
169
+ // sendUserGenerationStateChannel writes lastGenerationState
170
+ // -> doIdle calls resetContext
171
+ // -> resetContext drops lastGenerationState
172
+ // -> reconnect finds no cached state, modal does not reopen
173
+ // leaves a refresh/reconnect after mid-prompt denial with a blank
174
+ // canvas. The snapshot is overwritten by every subsequent
175
+ // sendUserGenerationStateChannel call (e.g. a new prompt's
176
+ // AGENT_PLANNING), so this preservation does not leak stale state
177
+ // into later turns. (Cursor PR-19341 review.)
178
+ lastGenerationState: ctx.lastGenerationState,
154
179
  // clear debug-related state
155
180
  debugToolCalled: undefined,
156
181
  lastDebugTimestamp: undefined,
@@ -231,11 +256,6 @@ export class Clark extends TracedFSM {
231
256
  async streamText(services, options) {
232
257
  const { model: providedModel, context: contextConfig, logging: loggingConfig, enableFallback: enableFallbackOverride, ...streamOptions } = options;
233
258
  const model = providedModel ?? services.llmProvider.modelForTask("generateBroadEdit");
234
- // Build mode instructions for the compaction summarizer so it preserves
235
- // mode context (Build/Plan, approval status) when summarizing.
236
- const modeInstructions = this.context.currentMode
237
- ? `Preserve the following mode context in your summary: ${buildModeMessage(this.context.currentMode, this.context.planContext?.approved)}`
238
- : undefined;
239
259
  // Pick the compaction strategy. `serverContextManagement.enabled` (from
240
260
  // the `ai.server-context-management.options` LD flag) acts as the
241
261
  // kill-switch: setting it to `false` routes the conversation through
@@ -243,7 +263,6 @@ export class Clark extends TracedFSM {
243
263
  // managed `clear_tool_uses_20250919` / `compact_20260112` edits.
244
264
  const contextManagement = selectContextManagementStrategy({
245
265
  serverContextManagementEnabled: this.context.llmConfig?.serverContextManagement?.enabled,
246
- modeInstructions,
247
266
  summarizationModel: () => services.llmProvider.modelForTask("summarizeMessages"),
248
267
  });
249
268
  const { thinkingEnabled, thinkingBudgetTokens, interleavedThinking, maxOutputTokens, headers, providerOptions, } = processLLMConfig(this.context.llmConfig, undefined, undefined, contextManagement);
@@ -1 +1 @@
1
- {"version":3,"file":"clark-fsm.js","sourceRoot":"","sources":["../../../src/ai-service/state-machine/clark-fsm.ts"],"names":[],"mappings":"AACA,OAAO,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Q,CAAC,aAAa;SACtC,CAAC,CAAC;QACH,IAAI,UAAU,EAAE,CAAC;YACf,MAAM,UAAU,CAAC,WAAW,CAC1B,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,EAC/B,KAAK,CAAC,iBAAiB,CACxB,CAAC;QACJ,CAAC;IACH,CAAC;IAEO,eAAe,CAAC,KAAkC;QACxD,MAAM,WAAW,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;QAE9C,MAAM,YAAY,GAAG,CAAC,CAAS,EAAE,EAAE,CACjC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;QACnD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,YAAY,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;QAEtE,KAAK,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI;aACzB,iBAAiB,CAAC,EAAE,WAAW,EAAE,CAAC;aAClC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;YACtB,IAAI,CAAC,MAAM,CAAC,IAAI,CACd,6BAA6B,EAC7B,iBAAiB,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CACrC,CAAC;QACJ,CAAC,CAAC,CAAC;IACP,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"agent-planning.d.ts","sourceRoot":"","sources":["../../../../src/ai-service/state-machine/handlers/agent-planning.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAe3D,OAAO,KAAK,EAKV,KAAK,EACL,uBAAuB,EACvB,eAAe,EAChB,MAAM,iBAAiB,CAAC;AA4BzB;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,gBAAgB,GAAG,MAAM,CAsCvE;AAED,eAAO,MAAM,eAAe,GAC1B,OAAO,KAAK,EACZ,QAAQ,uBAAuB,MAqFjB,WAAW,eAAe,KAAG,OAAO,CAAC,IAAI,CA85BxD,CAAC"}
1
+ {"version":3,"file":"agent-planning.d.ts","sourceRoot":"","sources":["../../../../src/ai-service/state-machine/handlers/agent-planning.ts"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAe3D,OAAO,KAAK,EAKV,KAAK,EACL,uBAAuB,EACvB,eAAe,EAChB,MAAM,iBAAiB,CAAC;AA4BzB;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,gBAAgB,GAAG,MAAM,CAsCvE;AAED,eAAO,MAAM,eAAe,GAC1B,OAAO,KAAK,EACZ,QAAQ,uBAAuB,MAqFjB,WAAW,eAAe,KAAG,OAAO,CAAC,IAAI,CAsoCxD,CAAC"}