lua-cli 3.15.2 → 3.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (809) hide show
  1. package/dist/api-exports.d.ts +5029 -698
  2. package/dist/api-exports.js +6509 -772
  3. package/dist/api-exports.js.map +1 -1
  4. package/dist/index.d.ts +0 -1
  5. package/dist/index.js +41174 -82
  6. package/dist/index.js.map +1 -1
  7. package/dist/voice/test/index.d.ts +1217 -0
  8. package/dist/voice/test/index.js +386 -0
  9. package/dist/voice/test/index.js.map +1 -0
  10. package/dist/voice-exports.d.ts +40 -0
  11. package/dist/voice-exports.js +16 -0
  12. package/dist/voice-exports.js.map +1 -0
  13. package/docs/README.md +1 -1
  14. package/package.json +38 -19
  15. package/scripts/build-vendor.mjs +6 -3
  16. package/scripts/run-api-extractor.mjs +79 -0
  17. package/template/.gitignore +21 -0
  18. package/template/package.json +1 -1
  19. package/dist/api/agent.api.service.d.ts +0 -165
  20. package/dist/api/agent.api.service.d.ts.map +0 -1
  21. package/dist/api/agent.api.service.js +0 -207
  22. package/dist/api/agent.api.service.js.map +0 -1
  23. package/dist/api/agents.api.service.d.ts +0 -21
  24. package/dist/api/agents.api.service.d.ts.map +0 -1
  25. package/dist/api/agents.api.service.js +0 -51
  26. package/dist/api/agents.api.service.js.map +0 -1
  27. package/dist/api/ai.api.service.d.ts +0 -20
  28. package/dist/api/ai.api.service.d.ts.map +0 -1
  29. package/dist/api/ai.api.service.js +0 -40
  30. package/dist/api/ai.api.service.js.map +0 -1
  31. package/dist/api/auth.api.service.d.ts +0 -49
  32. package/dist/api/auth.api.service.d.ts.map +0 -1
  33. package/dist/api/auth.api.service.js +0 -55
  34. package/dist/api/auth.api.service.js.map +0 -1
  35. package/dist/api/backup.api.service.d.ts +0 -78
  36. package/dist/api/backup.api.service.d.ts.map +0 -1
  37. package/dist/api/backup.api.service.js +0 -115
  38. package/dist/api/backup.api.service.js.map +0 -1
  39. package/dist/api/basket.api.service.d.ts +0 -85
  40. package/dist/api/basket.api.service.d.ts.map +0 -1
  41. package/dist/api/basket.api.service.js +0 -160
  42. package/dist/api/basket.api.service.js.map +0 -1
  43. package/dist/api/cdn.api.service.d.ts +0 -21
  44. package/dist/api/cdn.api.service.d.ts.map +0 -1
  45. package/dist/api/cdn.api.service.js +0 -46
  46. package/dist/api/cdn.api.service.js.map +0 -1
  47. package/dist/api/chat.api.service.d.ts +0 -40
  48. package/dist/api/chat.api.service.d.ts.map +0 -1
  49. package/dist/api/chat.api.service.js +0 -121
  50. package/dist/api/chat.api.service.js.map +0 -1
  51. package/dist/api/credentials.d.ts +0 -25
  52. package/dist/api/credentials.d.ts.map +0 -1
  53. package/dist/api/credentials.js +0 -44
  54. package/dist/api/credentials.js.map +0 -1
  55. package/dist/api/custom.data.api.service.d.ts +0 -71
  56. package/dist/api/custom.data.api.service.d.ts.map +0 -1
  57. package/dist/api/custom.data.api.service.js +0 -126
  58. package/dist/api/custom.data.api.service.js.map +0 -1
  59. package/dist/api/developer.api.service.d.ts +0 -121
  60. package/dist/api/developer.api.service.d.ts.map +0 -1
  61. package/dist/api/developer.api.service.js +0 -162
  62. package/dist/api/developer.api.service.js.map +0 -1
  63. package/dist/api/device-trigger.api.service.d.ts +0 -136
  64. package/dist/api/device-trigger.api.service.d.ts.map +0 -1
  65. package/dist/api/device-trigger.api.service.js +0 -120
  66. package/dist/api/device-trigger.api.service.js.map +0 -1
  67. package/dist/api/device.api.service.d.ts +0 -61
  68. package/dist/api/device.api.service.d.ts.map +0 -1
  69. package/dist/api/device.api.service.js +0 -72
  70. package/dist/api/device.api.service.js.map +0 -1
  71. package/dist/api/http.client.d.ts +0 -90
  72. package/dist/api/http.client.d.ts.map +0 -1
  73. package/dist/api/http.client.js +0 -265
  74. package/dist/api/http.client.js.map +0 -1
  75. package/dist/api/job.api.service.d.ts +0 -154
  76. package/dist/api/job.api.service.d.ts.map +0 -1
  77. package/dist/api/job.api.service.js +0 -230
  78. package/dist/api/job.api.service.js.map +0 -1
  79. package/dist/api/lazy-instances.d.ts +0 -107
  80. package/dist/api/lazy-instances.d.ts.map +0 -1
  81. package/dist/api/lazy-instances.js +0 -220
  82. package/dist/api/lazy-instances.js.map +0 -1
  83. package/dist/api/logs.api.service.d.ts +0 -38
  84. package/dist/api/logs.api.service.d.ts.map +0 -1
  85. package/dist/api/logs.api.service.js +0 -50
  86. package/dist/api/logs.api.service.js.map +0 -1
  87. package/dist/api/marketplace.api.service.d.ts +0 -28
  88. package/dist/api/marketplace.api.service.d.ts.map +0 -1
  89. package/dist/api/marketplace.api.service.js +0 -112
  90. package/dist/api/marketplace.api.service.js.map +0 -1
  91. package/dist/api/order.api.service.d.ts +0 -53
  92. package/dist/api/order.api.service.d.ts.map +0 -1
  93. package/dist/api/order.api.service.js +0 -94
  94. package/dist/api/order.api.service.js.map +0 -1
  95. package/dist/api/persona.api.service.d.ts +0 -56
  96. package/dist/api/persona.api.service.d.ts.map +0 -1
  97. package/dist/api/persona.api.service.js +0 -90
  98. package/dist/api/persona.api.service.js.map +0 -1
  99. package/dist/api/postprocessor.api.service.d.ts +0 -151
  100. package/dist/api/postprocessor.api.service.d.ts.map +0 -1
  101. package/dist/api/postprocessor.api.service.js +0 -109
  102. package/dist/api/postprocessor.api.service.js.map +0 -1
  103. package/dist/api/preprocessor.api.service.d.ts +0 -155
  104. package/dist/api/preprocessor.api.service.d.ts.map +0 -1
  105. package/dist/api/preprocessor.api.service.js +0 -111
  106. package/dist/api/preprocessor.api.service.js.map +0 -1
  107. package/dist/api/products.api.service.d.ts +0 -80
  108. package/dist/api/products.api.service.d.ts.map +0 -1
  109. package/dist/api/products.api.service.js +0 -126
  110. package/dist/api/products.api.service.js.map +0 -1
  111. package/dist/api/resource.api.service.d.ts +0 -77
  112. package/dist/api/resource.api.service.d.ts.map +0 -1
  113. package/dist/api/resource.api.service.js +0 -74
  114. package/dist/api/resource.api.service.js.map +0 -1
  115. package/dist/api/skills.api.service.d.ts +0 -86
  116. package/dist/api/skills.api.service.d.ts.map +0 -1
  117. package/dist/api/skills.api.service.js +0 -112
  118. package/dist/api/skills.api.service.js.map +0 -1
  119. package/dist/api/tool.api.service.d.ts +0 -53
  120. package/dist/api/tool.api.service.d.ts.map +0 -1
  121. package/dist/api/tool.api.service.js +0 -74
  122. package/dist/api/tool.api.service.js.map +0 -1
  123. package/dist/api/unifiedto.api.service.d.ts +0 -133
  124. package/dist/api/unifiedto.api.service.d.ts.map +0 -1
  125. package/dist/api/unifiedto.api.service.js +0 -166
  126. package/dist/api/unifiedto.api.service.js.map +0 -1
  127. package/dist/api/user.data.api.service.d.ts +0 -69
  128. package/dist/api/user.data.api.service.d.ts.map +0 -1
  129. package/dist/api/user.data.api.service.js +0 -158
  130. package/dist/api/user.data.api.service.js.map +0 -1
  131. package/dist/api/webhook.api.service.d.ts +0 -163
  132. package/dist/api/webhook.api.service.d.ts.map +0 -1
  133. package/dist/api/webhook.api.service.js +0 -140
  134. package/dist/api/webhook.api.service.js.map +0 -1
  135. package/dist/api/whatsapp-templates.api.service.d.ts +0 -41
  136. package/dist/api/whatsapp-templates.api.service.d.ts.map +0 -1
  137. package/dist/api/whatsapp-templates.api.service.js +0 -79
  138. package/dist/api/whatsapp-templates.api.service.js.map +0 -1
  139. package/dist/api-exports.d.ts.map +0 -1
  140. package/dist/cli/command-definitions.d.ts +0 -29
  141. package/dist/cli/command-definitions.d.ts.map +0 -1
  142. package/dist/cli/command-definitions.js +0 -935
  143. package/dist/cli/command-definitions.js.map +0 -1
  144. package/dist/commands/admin.d.ts +0 -24
  145. package/dist/commands/admin.d.ts.map +0 -1
  146. package/dist/commands/admin.js +0 -44
  147. package/dist/commands/admin.js.map +0 -1
  148. package/dist/commands/agents.d.ts +0 -23
  149. package/dist/commands/agents.d.ts.map +0 -1
  150. package/dist/commands/agents.js +0 -83
  151. package/dist/commands/agents.js.map +0 -1
  152. package/dist/commands/apiKey.d.ts +0 -8
  153. package/dist/commands/apiKey.d.ts.map +0 -1
  154. package/dist/commands/apiKey.js +0 -43
  155. package/dist/commands/apiKey.js.map +0 -1
  156. package/dist/commands/channels.d.ts +0 -13
  157. package/dist/commands/channels.d.ts.map +0 -1
  158. package/dist/commands/channels.js +0 -747
  159. package/dist/commands/channels.js.map +0 -1
  160. package/dist/commands/chat-log-probe.d.ts +0 -59
  161. package/dist/commands/chat-log-probe.d.ts.map +0 -1
  162. package/dist/commands/chat-log-probe.js +0 -87
  163. package/dist/commands/chat-log-probe.js.map +0 -1
  164. package/dist/commands/chat.d.ts +0 -20
  165. package/dist/commands/chat.d.ts.map +0 -1
  166. package/dist/commands/chat.js +0 -618
  167. package/dist/commands/chat.js.map +0 -1
  168. package/dist/commands/chatClear.d.ts +0 -25
  169. package/dist/commands/chatClear.d.ts.map +0 -1
  170. package/dist/commands/chatClear.js +0 -71
  171. package/dist/commands/chatClear.js.map +0 -1
  172. package/dist/commands/compile.d.ts +0 -48
  173. package/dist/commands/compile.d.ts.map +0 -1
  174. package/dist/commands/compile.js +0 -216
  175. package/dist/commands/compile.js.map +0 -1
  176. package/dist/commands/completion.d.ts +0 -12
  177. package/dist/commands/completion.d.ts.map +0 -1
  178. package/dist/commands/completion.js +0 -211
  179. package/dist/commands/completion.js.map +0 -1
  180. package/dist/commands/configure.d.ts +0 -42
  181. package/dist/commands/configure.d.ts.map +0 -1
  182. package/dist/commands/configure.js +0 -76
  183. package/dist/commands/configure.js.map +0 -1
  184. package/dist/commands/deploy.d.ts +0 -14
  185. package/dist/commands/deploy.d.ts.map +0 -1
  186. package/dist/commands/deploy.js +0 -517
  187. package/dist/commands/deploy.js.map +0 -1
  188. package/dist/commands/destroy.d.ts +0 -8
  189. package/dist/commands/destroy.d.ts.map +0 -1
  190. package/dist/commands/destroy.js +0 -66
  191. package/dist/commands/destroy.js.map +0 -1
  192. package/dist/commands/devices.d.ts +0 -6
  193. package/dist/commands/devices.d.ts.map +0 -1
  194. package/dist/commands/devices.js +0 -265
  195. package/dist/commands/devices.js.map +0 -1
  196. package/dist/commands/docs.d.ts +0 -20
  197. package/dist/commands/docs.d.ts.map +0 -1
  198. package/dist/commands/docs.js +0 -33
  199. package/dist/commands/docs.js.map +0 -1
  200. package/dist/commands/env.d.ts +0 -34
  201. package/dist/commands/env.d.ts.map +0 -1
  202. package/dist/commands/env.js +0 -612
  203. package/dist/commands/env.js.map +0 -1
  204. package/dist/commands/evals.d.ts +0 -9
  205. package/dist/commands/evals.d.ts.map +0 -1
  206. package/dist/commands/evals.js +0 -27
  207. package/dist/commands/evals.js.map +0 -1
  208. package/dist/commands/features.d.ts +0 -13
  209. package/dist/commands/features.d.ts.map +0 -1
  210. package/dist/commands/features.js +0 -455
  211. package/dist/commands/features.js.map +0 -1
  212. package/dist/commands/governance.d.ts +0 -7
  213. package/dist/commands/governance.d.ts.map +0 -1
  214. package/dist/commands/governance.js +0 -258
  215. package/dist/commands/governance.js.map +0 -1
  216. package/dist/commands/index.d.ts +0 -38
  217. package/dist/commands/index.d.ts.map +0 -1
  218. package/dist/commands/index.js +0 -38
  219. package/dist/commands/index.js.map +0 -1
  220. package/dist/commands/init.d.ts +0 -53
  221. package/dist/commands/init.d.ts.map +0 -1
  222. package/dist/commands/init.js +0 -992
  223. package/dist/commands/init.js.map +0 -1
  224. package/dist/commands/integrations.d.ts +0 -18
  225. package/dist/commands/integrations.d.ts.map +0 -1
  226. package/dist/commands/integrations.js +0 -2666
  227. package/dist/commands/integrations.js.map +0 -1
  228. package/dist/commands/jobs.d.ts +0 -13
  229. package/dist/commands/jobs.d.ts.map +0 -1
  230. package/dist/commands/jobs.js +0 -736
  231. package/dist/commands/jobs.js.map +0 -1
  232. package/dist/commands/log-tip.d.ts +0 -79
  233. package/dist/commands/log-tip.d.ts.map +0 -1
  234. package/dist/commands/log-tip.js +0 -83
  235. package/dist/commands/log-tip.js.map +0 -1
  236. package/dist/commands/logs.d.ts +0 -13
  237. package/dist/commands/logs.d.ts.map +0 -1
  238. package/dist/commands/logs.js +0 -486
  239. package/dist/commands/logs.js.map +0 -1
  240. package/dist/commands/marketplace.d.ts +0 -34
  241. package/dist/commands/marketplace.d.ts.map +0 -1
  242. package/dist/commands/marketplace.js +0 -2105
  243. package/dist/commands/marketplace.js.map +0 -1
  244. package/dist/commands/mcp.d.ts +0 -32
  245. package/dist/commands/mcp.d.ts.map +0 -1
  246. package/dist/commands/mcp.js +0 -395
  247. package/dist/commands/mcp.js.map +0 -1
  248. package/dist/commands/models.d.ts +0 -18
  249. package/dist/commands/models.d.ts.map +0 -1
  250. package/dist/commands/models.js +0 -207
  251. package/dist/commands/models.js.map +0 -1
  252. package/dist/commands/persona.d.ts +0 -13
  253. package/dist/commands/persona.d.ts.map +0 -1
  254. package/dist/commands/persona.js +0 -560
  255. package/dist/commands/persona.js.map +0 -1
  256. package/dist/commands/postprocessors.d.ts +0 -13
  257. package/dist/commands/postprocessors.d.ts.map +0 -1
  258. package/dist/commands/postprocessors.js +0 -558
  259. package/dist/commands/postprocessors.js.map +0 -1
  260. package/dist/commands/preprocessors.d.ts +0 -13
  261. package/dist/commands/preprocessors.d.ts.map +0 -1
  262. package/dist/commands/preprocessors.js +0 -558
  263. package/dist/commands/preprocessors.js.map +0 -1
  264. package/dist/commands/production.d.ts +0 -13
  265. package/dist/commands/production.d.ts.map +0 -1
  266. package/dist/commands/production.js +0 -588
  267. package/dist/commands/production.js.map +0 -1
  268. package/dist/commands/push-helpers.d.ts +0 -42
  269. package/dist/commands/push-helpers.d.ts.map +0 -1
  270. package/dist/commands/push-helpers.js +0 -48
  271. package/dist/commands/push-helpers.js.map +0 -1
  272. package/dist/commands/push.d.ts +0 -19
  273. package/dist/commands/push.d.ts.map +0 -1
  274. package/dist/commands/push.js +0 -1145
  275. package/dist/commands/push.js.map +0 -1
  276. package/dist/commands/pushBackup.d.ts +0 -78
  277. package/dist/commands/pushBackup.d.ts.map +0 -1
  278. package/dist/commands/pushBackup.js +0 -274
  279. package/dist/commands/pushBackup.js.map +0 -1
  280. package/dist/commands/resources.d.ts +0 -13
  281. package/dist/commands/resources.d.ts.map +0 -1
  282. package/dist/commands/resources.js +0 -377
  283. package/dist/commands/resources.js.map +0 -1
  284. package/dist/commands/skills.d.ts +0 -13
  285. package/dist/commands/skills.d.ts.map +0 -1
  286. package/dist/commands/skills.js +0 -618
  287. package/dist/commands/skills.js.map +0 -1
  288. package/dist/commands/source.d.ts +0 -72
  289. package/dist/commands/source.d.ts.map +0 -1
  290. package/dist/commands/source.js +0 -134
  291. package/dist/commands/source.js.map +0 -1
  292. package/dist/commands/status.d.ts +0 -14
  293. package/dist/commands/status.d.ts.map +0 -1
  294. package/dist/commands/status.js +0 -731
  295. package/dist/commands/status.js.map +0 -1
  296. package/dist/commands/sync.d.ts +0 -28
  297. package/dist/commands/sync.d.ts.map +0 -1
  298. package/dist/commands/sync.js +0 -802
  299. package/dist/commands/sync.js.map +0 -1
  300. package/dist/commands/telemetry.d.ts +0 -6
  301. package/dist/commands/telemetry.d.ts.map +0 -1
  302. package/dist/commands/telemetry.js +0 -42
  303. package/dist/commands/telemetry.js.map +0 -1
  304. package/dist/commands/test-output.helpers.d.ts +0 -24
  305. package/dist/commands/test-output.helpers.d.ts.map +0 -1
  306. package/dist/commands/test-output.helpers.js +0 -62
  307. package/dist/commands/test-output.helpers.js.map +0 -1
  308. package/dist/commands/test.d.ts +0 -9
  309. package/dist/commands/test.d.ts.map +0 -1
  310. package/dist/commands/test.js +0 -787
  311. package/dist/commands/test.js.map +0 -1
  312. package/dist/commands/update.d.ts +0 -14
  313. package/dist/commands/update.d.ts.map +0 -1
  314. package/dist/commands/update.js +0 -97
  315. package/dist/commands/update.js.map +0 -1
  316. package/dist/commands/webhooks.d.ts +0 -13
  317. package/dist/commands/webhooks.d.ts.map +0 -1
  318. package/dist/commands/webhooks.js +0 -691
  319. package/dist/commands/webhooks.js.map +0 -1
  320. package/dist/compiler/agent-traverser.d.ts +0 -140
  321. package/dist/compiler/agent-traverser.d.ts.map +0 -1
  322. package/dist/compiler/agent-traverser.js +0 -420
  323. package/dist/compiler/agent-traverser.js.map +0 -1
  324. package/dist/compiler/bundler.d.ts +0 -43
  325. package/dist/compiler/bundler.d.ts.map +0 -1
  326. package/dist/compiler/bundler.js +0 -188
  327. package/dist/compiler/bundler.js.map +0 -1
  328. package/dist/compiler/compiler.d.ts +0 -208
  329. package/dist/compiler/compiler.d.ts.map +0 -1
  330. package/dist/compiler/compiler.js +0 -706
  331. package/dist/compiler/compiler.js.map +0 -1
  332. package/dist/compiler/index.d.ts +0 -38
  333. package/dist/compiler/index.d.ts.map +0 -1
  334. package/dist/compiler/index.js +0 -43
  335. package/dist/compiler/index.js.map +0 -1
  336. package/dist/compiler/plugins/agent.plugin.d.ts +0 -58
  337. package/dist/compiler/plugins/agent.plugin.d.ts.map +0 -1
  338. package/dist/compiler/plugins/agent.plugin.js +0 -161
  339. package/dist/compiler/plugins/agent.plugin.js.map +0 -1
  340. package/dist/compiler/plugins/base.d.ts +0 -334
  341. package/dist/compiler/plugins/base.d.ts.map +0 -1
  342. package/dist/compiler/plugins/base.js +0 -353
  343. package/dist/compiler/plugins/base.js.map +0 -1
  344. package/dist/compiler/plugins/device-trigger.plugin.d.ts +0 -38
  345. package/dist/compiler/plugins/device-trigger.plugin.d.ts.map +0 -1
  346. package/dist/compiler/plugins/device-trigger.plugin.js +0 -107
  347. package/dist/compiler/plugins/device-trigger.plugin.js.map +0 -1
  348. package/dist/compiler/plugins/device.plugin.d.ts +0 -39
  349. package/dist/compiler/plugins/device.plugin.d.ts.map +0 -1
  350. package/dist/compiler/plugins/device.plugin.js +0 -77
  351. package/dist/compiler/plugins/device.plugin.js.map +0 -1
  352. package/dist/compiler/plugins/job.plugin.d.ts +0 -34
  353. package/dist/compiler/plugins/job.plugin.d.ts.map +0 -1
  354. package/dist/compiler/plugins/job.plugin.js +0 -108
  355. package/dist/compiler/plugins/job.plugin.js.map +0 -1
  356. package/dist/compiler/plugins/mcp-server.plugin.d.ts +0 -38
  357. package/dist/compiler/plugins/mcp-server.plugin.d.ts.map +0 -1
  358. package/dist/compiler/plugins/mcp-server.plugin.js +0 -107
  359. package/dist/compiler/plugins/mcp-server.plugin.js.map +0 -1
  360. package/dist/compiler/plugins/postprocessor.plugin.d.ts +0 -21
  361. package/dist/compiler/plugins/postprocessor.plugin.d.ts.map +0 -1
  362. package/dist/compiler/plugins/postprocessor.plugin.js +0 -36
  363. package/dist/compiler/plugins/postprocessor.plugin.js.map +0 -1
  364. package/dist/compiler/plugins/preprocessor.plugin.d.ts +0 -21
  365. package/dist/compiler/plugins/preprocessor.plugin.d.ts.map +0 -1
  366. package/dist/compiler/plugins/preprocessor.plugin.js +0 -38
  367. package/dist/compiler/plugins/preprocessor.plugin.js.map +0 -1
  368. package/dist/compiler/plugins/processor-base.d.ts +0 -17
  369. package/dist/compiler/plugins/processor-base.d.ts.map +0 -1
  370. package/dist/compiler/plugins/processor-base.js +0 -27
  371. package/dist/compiler/plugins/processor-base.js.map +0 -1
  372. package/dist/compiler/plugins/registry.d.ts +0 -62
  373. package/dist/compiler/plugins/registry.d.ts.map +0 -1
  374. package/dist/compiler/plugins/registry.js +0 -113
  375. package/dist/compiler/plugins/registry.js.map +0 -1
  376. package/dist/compiler/plugins/skill.plugin.d.ts +0 -106
  377. package/dist/compiler/plugins/skill.plugin.d.ts.map +0 -1
  378. package/dist/compiler/plugins/skill.plugin.js +0 -316
  379. package/dist/compiler/plugins/skill.plugin.js.map +0 -1
  380. package/dist/compiler/plugins/tool.plugin.d.ts +0 -69
  381. package/dist/compiler/plugins/tool.plugin.d.ts.map +0 -1
  382. package/dist/compiler/plugins/tool.plugin.js +0 -262
  383. package/dist/compiler/plugins/tool.plugin.js.map +0 -1
  384. package/dist/compiler/plugins/webhook.plugin.d.ts +0 -38
  385. package/dist/compiler/plugins/webhook.plugin.d.ts.map +0 -1
  386. package/dist/compiler/plugins/webhook.plugin.js +0 -117
  387. package/dist/compiler/plugins/webhook.plugin.js.map +0 -1
  388. package/dist/compiler/source-writer.d.ts +0 -129
  389. package/dist/compiler/source-writer.d.ts.map +0 -1
  390. package/dist/compiler/source-writer.js +0 -329
  391. package/dist/compiler/source-writer.js.map +0 -1
  392. package/dist/compiler/types.d.ts +0 -391
  393. package/dist/compiler/types.d.ts.map +0 -1
  394. package/dist/compiler/types.js +0 -30
  395. package/dist/compiler/types.js.map +0 -1
  396. package/dist/compiler/utils/ast-helpers.d.ts +0 -106
  397. package/dist/compiler/utils/ast-helpers.d.ts.map +0 -1
  398. package/dist/compiler/utils/ast-helpers.js +0 -356
  399. package/dist/compiler/utils/ast-helpers.js.map +0 -1
  400. package/dist/compiler/utils/common.d.ts +0 -38
  401. package/dist/compiler/utils/common.d.ts.map +0 -1
  402. package/dist/compiler/utils/common.js +0 -94
  403. package/dist/compiler/utils/common.js.map +0 -1
  404. package/dist/compiler/utils/file-discovery.d.ts +0 -35
  405. package/dist/compiler/utils/file-discovery.d.ts.map +0 -1
  406. package/dist/compiler/utils/file-discovery.js +0 -60
  407. package/dist/compiler/utils/file-discovery.js.map +0 -1
  408. package/dist/compiler/utils/path-resolver.d.ts +0 -83
  409. package/dist/compiler/utils/path-resolver.d.ts.map +0 -1
  410. package/dist/compiler/utils/path-resolver.js +0 -162
  411. package/dist/compiler/utils/path-resolver.js.map +0 -1
  412. package/dist/compiler/utils/reference-resolver.d.ts +0 -196
  413. package/dist/compiler/utils/reference-resolver.d.ts.map +0 -1
  414. package/dist/compiler/utils/reference-resolver.js +0 -1026
  415. package/dist/compiler/utils/reference-resolver.js.map +0 -1
  416. package/dist/compiler/utils/schema-converter.d.ts +0 -52
  417. package/dist/compiler/utils/schema-converter.d.ts.map +0 -1
  418. package/dist/compiler/utils/schema-converter.js +0 -170
  419. package/dist/compiler/utils/schema-converter.js.map +0 -1
  420. package/dist/compiler/utils/workspace.d.ts +0 -35
  421. package/dist/compiler/utils/workspace.d.ts.map +0 -1
  422. package/dist/compiler/utils/workspace.js +0 -121
  423. package/dist/compiler/utils/workspace.js.map +0 -1
  424. package/dist/config/compile.constants.d.ts +0 -75
  425. package/dist/config/compile.constants.d.ts.map +0 -1
  426. package/dist/config/compile.constants.js +0 -95
  427. package/dist/config/compile.constants.js.map +0 -1
  428. package/dist/config/constants.d.ts +0 -49
  429. package/dist/config/constants.d.ts.map +0 -1
  430. package/dist/config/constants.js +0 -69
  431. package/dist/config/constants.js.map +0 -1
  432. package/dist/errors/auth.error.d.ts +0 -34
  433. package/dist/errors/auth.error.d.ts.map +0 -1
  434. package/dist/errors/auth.error.js +0 -29
  435. package/dist/errors/auth.error.js.map +0 -1
  436. package/dist/errors/index.d.ts +0 -5
  437. package/dist/errors/index.d.ts.map +0 -1
  438. package/dist/errors/index.js +0 -5
  439. package/dist/errors/index.js.map +0 -1
  440. package/dist/index.d.ts.map +0 -1
  441. package/dist/instances/basket.instance.d.ts +0 -82
  442. package/dist/instances/basket.instance.d.ts.map +0 -1
  443. package/dist/instances/basket.instance.js +0 -245
  444. package/dist/instances/basket.instance.js.map +0 -1
  445. package/dist/instances/data.entry.instance.d.ts +0 -50
  446. package/dist/instances/data.entry.instance.d.ts.map +0 -1
  447. package/dist/instances/data.entry.instance.js +0 -163
  448. package/dist/instances/data.entry.instance.js.map +0 -1
  449. package/dist/instances/job.instance.d.ts +0 -133
  450. package/dist/instances/job.instance.d.ts.map +0 -1
  451. package/dist/instances/job.instance.js +0 -180
  452. package/dist/instances/job.instance.js.map +0 -1
  453. package/dist/instances/order.instance.d.ts +0 -50
  454. package/dist/instances/order.instance.d.ts.map +0 -1
  455. package/dist/instances/order.instance.js +0 -199
  456. package/dist/instances/order.instance.js.map +0 -1
  457. package/dist/instances/product.instance.d.ts +0 -43
  458. package/dist/instances/product.instance.d.ts.map +0 -1
  459. package/dist/instances/product.instance.js +0 -145
  460. package/dist/instances/product.instance.js.map +0 -1
  461. package/dist/instances/product.pagination.instance.d.ts +0 -102
  462. package/dist/instances/product.pagination.instance.d.ts.map +0 -1
  463. package/dist/instances/product.pagination.instance.js +0 -156
  464. package/dist/instances/product.pagination.instance.js.map +0 -1
  465. package/dist/instances/product.search.instance.d.ts +0 -81
  466. package/dist/instances/product.search.instance.d.ts.map +0 -1
  467. package/dist/instances/product.search.instance.js +0 -121
  468. package/dist/instances/product.search.instance.js.map +0 -1
  469. package/dist/instances/user.instance.d.ts +0 -56
  470. package/dist/instances/user.instance.d.ts.map +0 -1
  471. package/dist/instances/user.instance.js +0 -188
  472. package/dist/instances/user.instance.js.map +0 -1
  473. package/dist/interfaces/admin.d.ts +0 -64
  474. package/dist/interfaces/admin.d.ts.map +0 -1
  475. package/dist/interfaces/admin.js +0 -6
  476. package/dist/interfaces/admin.js.map +0 -1
  477. package/dist/interfaces/agent.d.ts +0 -399
  478. package/dist/interfaces/agent.d.ts.map +0 -1
  479. package/dist/interfaces/agent.js +0 -6
  480. package/dist/interfaces/agent.js.map +0 -1
  481. package/dist/interfaces/backup.d.ts +0 -143
  482. package/dist/interfaces/backup.d.ts.map +0 -1
  483. package/dist/interfaces/backup.js +0 -8
  484. package/dist/interfaces/backup.js.map +0 -1
  485. package/dist/interfaces/baskets.d.ts +0 -80
  486. package/dist/interfaces/baskets.d.ts.map +0 -1
  487. package/dist/interfaces/baskets.js +0 -20
  488. package/dist/interfaces/baskets.js.map +0 -1
  489. package/dist/interfaces/cdn.d.ts +0 -25
  490. package/dist/interfaces/cdn.d.ts.map +0 -1
  491. package/dist/interfaces/cdn.js +0 -6
  492. package/dist/interfaces/cdn.js.map +0 -1
  493. package/dist/interfaces/chat.d.ts +0 -98
  494. package/dist/interfaces/chat.d.ts.map +0 -1
  495. package/dist/interfaces/chat.js +0 -6
  496. package/dist/interfaces/chat.js.map +0 -1
  497. package/dist/interfaces/common.d.ts +0 -64
  498. package/dist/interfaces/common.d.ts.map +0 -1
  499. package/dist/interfaces/common.js +0 -9
  500. package/dist/interfaces/common.js.map +0 -1
  501. package/dist/interfaces/custom.data.d.ts +0 -83
  502. package/dist/interfaces/custom.data.d.ts.map +0 -1
  503. package/dist/interfaces/custom.data.js +0 -6
  504. package/dist/interfaces/custom.data.js.map +0 -1
  505. package/dist/interfaces/deploy.d.ts +0 -15
  506. package/dist/interfaces/deploy.d.ts.map +0 -1
  507. package/dist/interfaces/deploy.js +0 -5
  508. package/dist/interfaces/deploy.js.map +0 -1
  509. package/dist/interfaces/dev.d.ts +0 -54
  510. package/dist/interfaces/dev.d.ts.map +0 -1
  511. package/dist/interfaces/dev.js +0 -6
  512. package/dist/interfaces/dev.js.map +0 -1
  513. package/dist/interfaces/device-triggers.d.ts +0 -80
  514. package/dist/interfaces/device-triggers.d.ts.map +0 -1
  515. package/dist/interfaces/device-triggers.js +0 -6
  516. package/dist/interfaces/device-triggers.js.map +0 -1
  517. package/dist/interfaces/devices.d.ts +0 -74
  518. package/dist/interfaces/devices.d.ts.map +0 -1
  519. package/dist/interfaces/devices.js +0 -5
  520. package/dist/interfaces/devices.js.map +0 -1
  521. package/dist/interfaces/index.d.ts +0 -15
  522. package/dist/interfaces/index.d.ts.map +0 -1
  523. package/dist/interfaces/index.js +0 -8
  524. package/dist/interfaces/index.js.map +0 -1
  525. package/dist/interfaces/init.d.ts +0 -42
  526. package/dist/interfaces/init.d.ts.map +0 -1
  527. package/dist/interfaces/init.js +0 -5
  528. package/dist/interfaces/init.js.map +0 -1
  529. package/dist/interfaces/jobs.d.ts +0 -149
  530. package/dist/interfaces/jobs.d.ts.map +0 -1
  531. package/dist/interfaces/jobs.js +0 -6
  532. package/dist/interfaces/jobs.js.map +0 -1
  533. package/dist/interfaces/logs.d.ts +0 -44
  534. package/dist/interfaces/logs.d.ts.map +0 -1
  535. package/dist/interfaces/logs.js +0 -6
  536. package/dist/interfaces/logs.js.map +0 -1
  537. package/dist/interfaces/lua.d.ts +0 -37
  538. package/dist/interfaces/lua.d.ts.map +0 -1
  539. package/dist/interfaces/lua.js +0 -6
  540. package/dist/interfaces/lua.js.map +0 -1
  541. package/dist/interfaces/marketplace.d.ts +0 -171
  542. package/dist/interfaces/marketplace.d.ts.map +0 -1
  543. package/dist/interfaces/marketplace.js +0 -3
  544. package/dist/interfaces/marketplace.js.map +0 -1
  545. package/dist/interfaces/mcp.d.ts +0 -96
  546. package/dist/interfaces/mcp.d.ts.map +0 -1
  547. package/dist/interfaces/mcp.js +0 -9
  548. package/dist/interfaces/mcp.js.map +0 -1
  549. package/dist/interfaces/message.d.ts +0 -16
  550. package/dist/interfaces/message.d.ts.map +0 -1
  551. package/dist/interfaces/message.js +0 -2
  552. package/dist/interfaces/message.js.map +0 -1
  553. package/dist/interfaces/orders.d.ts +0 -68
  554. package/dist/interfaces/orders.d.ts.map +0 -1
  555. package/dist/interfaces/orders.js +0 -20
  556. package/dist/interfaces/orders.js.map +0 -1
  557. package/dist/interfaces/persona.d.ts +0 -44
  558. package/dist/interfaces/persona.d.ts.map +0 -1
  559. package/dist/interfaces/persona.js +0 -6
  560. package/dist/interfaces/persona.js.map +0 -1
  561. package/dist/interfaces/postprocessors.d.ts +0 -15
  562. package/dist/interfaces/postprocessors.d.ts.map +0 -1
  563. package/dist/interfaces/postprocessors.js +0 -5
  564. package/dist/interfaces/postprocessors.js.map +0 -1
  565. package/dist/interfaces/preprocessors.d.ts +0 -15
  566. package/dist/interfaces/preprocessors.d.ts.map +0 -1
  567. package/dist/interfaces/preprocessors.js +0 -5
  568. package/dist/interfaces/preprocessors.js.map +0 -1
  569. package/dist/interfaces/product.d.ts +0 -92
  570. package/dist/interfaces/product.d.ts.map +0 -1
  571. package/dist/interfaces/product.js +0 -6
  572. package/dist/interfaces/product.js.map +0 -1
  573. package/dist/interfaces/push.d.ts +0 -27
  574. package/dist/interfaces/push.d.ts.map +0 -1
  575. package/dist/interfaces/push.js +0 -5
  576. package/dist/interfaces/push.js.map +0 -1
  577. package/dist/interfaces/skills.d.ts +0 -137
  578. package/dist/interfaces/skills.d.ts.map +0 -1
  579. package/dist/interfaces/skills.js +0 -6
  580. package/dist/interfaces/skills.js.map +0 -1
  581. package/dist/interfaces/test.d.ts +0 -37
  582. package/dist/interfaces/test.d.ts.map +0 -1
  583. package/dist/interfaces/test.js +0 -5
  584. package/dist/interfaces/test.js.map +0 -1
  585. package/dist/interfaces/unifiedto.d.ts +0 -141
  586. package/dist/interfaces/unifiedto.d.ts.map +0 -1
  587. package/dist/interfaces/unifiedto.js +0 -6
  588. package/dist/interfaces/unifiedto.js.map +0 -1
  589. package/dist/interfaces/user.d.ts +0 -75
  590. package/dist/interfaces/user.d.ts.map +0 -1
  591. package/dist/interfaces/user.js +0 -2
  592. package/dist/interfaces/user.js.map +0 -1
  593. package/dist/interfaces/webhooks.d.ts +0 -97
  594. package/dist/interfaces/webhooks.d.ts.map +0 -1
  595. package/dist/interfaces/webhooks.js +0 -6
  596. package/dist/interfaces/webhooks.js.map +0 -1
  597. package/dist/interfaces/whatsapp-templates.d.ts +0 -105
  598. package/dist/interfaces/whatsapp-templates.d.ts.map +0 -1
  599. package/dist/interfaces/whatsapp-templates.js +0 -6
  600. package/dist/interfaces/whatsapp-templates.js.map +0 -1
  601. package/dist/primitives/agent.handler.d.ts +0 -71
  602. package/dist/primitives/agent.handler.d.ts.map +0 -1
  603. package/dist/primitives/agent.handler.js +0 -226
  604. package/dist/primitives/agent.handler.js.map +0 -1
  605. package/dist/primitives/base.handler.d.ts +0 -229
  606. package/dist/primitives/base.handler.d.ts.map +0 -1
  607. package/dist/primitives/base.handler.js +0 -620
  608. package/dist/primitives/base.handler.js.map +0 -1
  609. package/dist/primitives/device-trigger.handler.d.ts +0 -56
  610. package/dist/primitives/device-trigger.handler.d.ts.map +0 -1
  611. package/dist/primitives/device-trigger.handler.js +0 -99
  612. package/dist/primitives/device-trigger.handler.js.map +0 -1
  613. package/dist/primitives/device.handler.d.ts +0 -57
  614. package/dist/primitives/device.handler.d.ts.map +0 -1
  615. package/dist/primitives/device.handler.js +0 -103
  616. package/dist/primitives/device.handler.js.map +0 -1
  617. package/dist/primitives/index.d.ts +0 -51
  618. package/dist/primitives/index.d.ts.map +0 -1
  619. package/dist/primitives/index.js +0 -75
  620. package/dist/primitives/index.js.map +0 -1
  621. package/dist/primitives/job.handler.d.ts +0 -53
  622. package/dist/primitives/job.handler.d.ts.map +0 -1
  623. package/dist/primitives/job.handler.js +0 -110
  624. package/dist/primitives/job.handler.js.map +0 -1
  625. package/dist/primitives/mcp-server.handler.d.ts +0 -93
  626. package/dist/primitives/mcp-server.handler.d.ts.map +0 -1
  627. package/dist/primitives/mcp-server.handler.js +0 -216
  628. package/dist/primitives/mcp-server.handler.js.map +0 -1
  629. package/dist/primitives/postprocessor.handler.d.ts +0 -44
  630. package/dist/primitives/postprocessor.handler.d.ts.map +0 -1
  631. package/dist/primitives/postprocessor.handler.js +0 -71
  632. package/dist/primitives/postprocessor.handler.js.map +0 -1
  633. package/dist/primitives/preprocessor.handler.d.ts +0 -44
  634. package/dist/primitives/preprocessor.handler.d.ts.map +0 -1
  635. package/dist/primitives/preprocessor.handler.js +0 -72
  636. package/dist/primitives/preprocessor.handler.js.map +0 -1
  637. package/dist/primitives/skill.handler.d.ts +0 -47
  638. package/dist/primitives/skill.handler.d.ts.map +0 -1
  639. package/dist/primitives/skill.handler.js +0 -229
  640. package/dist/primitives/skill.handler.js.map +0 -1
  641. package/dist/primitives/types.d.ts +0 -91
  642. package/dist/primitives/types.d.ts.map +0 -1
  643. package/dist/primitives/types.js +0 -17
  644. package/dist/primitives/types.js.map +0 -1
  645. package/dist/primitives/webhook.handler.d.ts +0 -47
  646. package/dist/primitives/webhook.handler.d.ts.map +0 -1
  647. package/dist/primitives/webhook.handler.js +0 -87
  648. package/dist/primitives/webhook.handler.js.map +0 -1
  649. package/dist/services/analytics.d.ts +0 -57
  650. package/dist/services/analytics.d.ts.map +0 -1
  651. package/dist/services/analytics.js +0 -317
  652. package/dist/services/analytics.js.map +0 -1
  653. package/dist/services/auth.d.ts +0 -72
  654. package/dist/services/auth.d.ts.map +0 -1
  655. package/dist/services/auth.js +0 -173
  656. package/dist/services/auth.js.map +0 -1
  657. package/dist/services/sandbox.service.d.ts +0 -105
  658. package/dist/services/sandbox.service.d.ts.map +0 -1
  659. package/dist/services/sandbox.service.js +0 -531
  660. package/dist/services/sandbox.service.js.map +0 -1
  661. package/dist/types/api-contracts.d.ts +0 -287
  662. package/dist/types/api-contracts.d.ts.map +0 -1
  663. package/dist/types/api-contracts.js +0 -2
  664. package/dist/types/api-contracts.js.map +0 -1
  665. package/dist/types/index.d.ts +0 -28
  666. package/dist/types/index.d.ts.map +0 -1
  667. package/dist/types/index.js +0 -30
  668. package/dist/types/index.js.map +0 -1
  669. package/dist/types/skill.d.ts +0 -1079
  670. package/dist/types/skill.d.ts.map +0 -1
  671. package/dist/types/skill.js +0 -688
  672. package/dist/types/skill.js.map +0 -1
  673. package/dist/types/tool-validation.d.ts +0 -35
  674. package/dist/types/tool-validation.d.ts.map +0 -1
  675. package/dist/types/tool-validation.js +0 -43
  676. package/dist/types/tool-validation.js.map +0 -1
  677. package/dist/types/yaml.types.d.ts +0 -91
  678. package/dist/types/yaml.types.d.ts.map +0 -1
  679. package/dist/types/yaml.types.js +0 -5
  680. package/dist/types/yaml.types.js.map +0 -1
  681. package/dist/utils/aliases.d.ts +0 -7
  682. package/dist/utils/aliases.d.ts.map +0 -1
  683. package/dist/utils/aliases.js +0 -492
  684. package/dist/utils/aliases.js.map +0 -1
  685. package/dist/utils/artifact-loader.d.ts +0 -152
  686. package/dist/utils/artifact-loader.d.ts.map +0 -1
  687. package/dist/utils/artifact-loader.js +0 -284
  688. package/dist/utils/artifact-loader.js.map +0 -1
  689. package/dist/utils/auth-flows.d.ts +0 -55
  690. package/dist/utils/auth-flows.d.ts.map +0 -1
  691. package/dist/utils/auth-flows.js +0 -246
  692. package/dist/utils/auth-flows.js.map +0 -1
  693. package/dist/utils/backup-helpers.d.ts +0 -290
  694. package/dist/utils/backup-helpers.d.ts.map +0 -1
  695. package/dist/utils/backup-helpers.js +0 -827
  696. package/dist/utils/backup-helpers.js.map +0 -1
  697. package/dist/utils/build-manifest-from-disk.d.ts +0 -17
  698. package/dist/utils/build-manifest-from-disk.d.ts.map +0 -1
  699. package/dist/utils/build-manifest-from-disk.js +0 -111
  700. package/dist/utils/build-manifest-from-disk.js.map +0 -1
  701. package/dist/utils/bundle-upload.d.ts +0 -42
  702. package/dist/utils/bundle-upload.d.ts.map +0 -1
  703. package/dist/utils/bundle-upload.js +0 -90
  704. package/dist/utils/bundle-upload.js.map +0 -1
  705. package/dist/utils/chat-attachments.d.ts +0 -15
  706. package/dist/utils/chat-attachments.d.ts.map +0 -1
  707. package/dist/utils/chat-attachments.js +0 -116
  708. package/dist/utils/chat-attachments.js.map +0 -1
  709. package/dist/utils/cli.d.ts +0 -62
  710. package/dist/utils/cli.d.ts.map +0 -1
  711. package/dist/utils/cli.js +0 -198
  712. package/dist/utils/cli.js.map +0 -1
  713. package/dist/utils/command-utils.d.ts +0 -46
  714. package/dist/utils/command-utils.d.ts.map +0 -1
  715. package/dist/utils/command-utils.js +0 -74
  716. package/dist/utils/command-utils.js.map +0 -1
  717. package/dist/utils/deploy-helpers.d.ts +0 -40
  718. package/dist/utils/deploy-helpers.d.ts.map +0 -1
  719. package/dist/utils/deploy-helpers.js +0 -76
  720. package/dist/utils/deploy-helpers.js.map +0 -1
  721. package/dist/utils/env-loader.utils.d.ts +0 -19
  722. package/dist/utils/env-loader.utils.d.ts.map +0 -1
  723. package/dist/utils/env-loader.utils.js +0 -90
  724. package/dist/utils/env-loader.utils.js.map +0 -1
  725. package/dist/utils/files.d.ts +0 -65
  726. package/dist/utils/files.d.ts.map +0 -1
  727. package/dist/utils/files.js +0 -193
  728. package/dist/utils/files.js.map +0 -1
  729. package/dist/utils/hints.d.ts +0 -81
  730. package/dist/utils/hints.d.ts.map +0 -1
  731. package/dist/utils/hints.js +0 -81
  732. package/dist/utils/hints.js.map +0 -1
  733. package/dist/utils/init-agent.d.ts +0 -86
  734. package/dist/utils/init-agent.d.ts.map +0 -1
  735. package/dist/utils/init-agent.js +0 -201
  736. package/dist/utils/init-agent.js.map +0 -1
  737. package/dist/utils/init-helpers.d.ts +0 -37
  738. package/dist/utils/init-helpers.d.ts.map +0 -1
  739. package/dist/utils/init-helpers.js +0 -78
  740. package/dist/utils/init-helpers.js.map +0 -1
  741. package/dist/utils/init-prompts.d.ts +0 -74
  742. package/dist/utils/init-prompts.d.ts.map +0 -1
  743. package/dist/utils/init-prompts.js +0 -256
  744. package/dist/utils/init-prompts.js.map +0 -1
  745. package/dist/utils/prompt-handler.d.ts +0 -17
  746. package/dist/utils/prompt-handler.d.ts.map +0 -1
  747. package/dist/utils/prompt-handler.js +0 -49
  748. package/dist/utils/prompt-handler.js.map +0 -1
  749. package/dist/utils/sandbox-storage.d.ts +0 -83
  750. package/dist/utils/sandbox-storage.d.ts.map +0 -1
  751. package/dist/utils/sandbox-storage.js +0 -211
  752. package/dist/utils/sandbox-storage.js.map +0 -1
  753. package/dist/utils/sandbox.d.ts +0 -76
  754. package/dist/utils/sandbox.d.ts.map +0 -1
  755. package/dist/utils/sandbox.js +0 -664
  756. package/dist/utils/sandbox.js.map +0 -1
  757. package/dist/utils/semver.d.ts +0 -40
  758. package/dist/utils/semver.d.ts.map +0 -1
  759. package/dist/utils/semver.js +0 -99
  760. package/dist/utils/semver.js.map +0 -1
  761. package/dist/utils/suggest.d.ts +0 -3
  762. package/dist/utils/suggest.d.ts.map +0 -1
  763. package/dist/utils/suggest.js +0 -32
  764. package/dist/utils/suggest.js.map +0 -1
  765. package/dist/utils/sync-display.d.ts +0 -28
  766. package/dist/utils/sync-display.d.ts.map +0 -1
  767. package/dist/utils/sync-display.js +0 -168
  768. package/dist/utils/sync-display.js.map +0 -1
  769. package/dist/utils/sync-fetch.d.ts +0 -108
  770. package/dist/utils/sync-fetch.d.ts.map +0 -1
  771. package/dist/utils/sync-fetch.js +0 -294
  772. package/dist/utils/sync-fetch.js.map +0 -1
  773. package/dist/utils/sync-helpers.d.ts +0 -7
  774. package/dist/utils/sync-helpers.d.ts.map +0 -1
  775. package/dist/utils/sync-helpers.js +0 -7
  776. package/dist/utils/sync-helpers.js.map +0 -1
  777. package/dist/utils/version-check.d.ts +0 -37
  778. package/dist/utils/version-check.d.ts.map +0 -1
  779. package/dist/utils/version-check.js +0 -117
  780. package/dist/utils/version-check.js.map +0 -1
  781. package/dist/utils/write-info.d.ts +0 -9
  782. package/dist/utils/write-info.d.ts.map +0 -1
  783. package/dist/utils/write-info.js +0 -11
  784. package/dist/utils/write-info.js.map +0 -1
  785. package/node_modules/@lua/shared-types/dist/index.d.mts +0 -606
  786. package/node_modules/@lua/shared-types/dist/index.d.ts +0 -606
  787. package/node_modules/@lua/shared-types/dist/index.js +0 -435
  788. package/node_modules/@lua/shared-types/dist/index.mjs +0 -394
  789. package/node_modules/@lua/shared-types/package.json +0 -26
  790. package/node_modules/@lua/shared-types/src/agent-config.types.ts +0 -45
  791. package/node_modules/@lua/shared-types/src/agent-invocation.types.ts +0 -73
  792. package/node_modules/@lua/shared-types/src/ai-generate.types.ts +0 -74
  793. package/node_modules/@lua/shared-types/src/ai-generate.utils.ts +0 -16
  794. package/node_modules/@lua/shared-types/src/channel.type.ts +0 -23
  795. package/node_modules/@lua/shared-types/src/chat-history.types.ts +0 -112
  796. package/node_modules/@lua/shared-types/src/chat-stream.types.ts +0 -11
  797. package/node_modules/@lua/shared-types/src/client-tools.types.ts +0 -47
  798. package/node_modules/@lua/shared-types/src/device.types.ts +0 -190
  799. package/node_modules/@lua/shared-types/src/index.ts +0 -15
  800. package/node_modules/@lua/shared-types/src/model-registry.ts +0 -20
  801. package/node_modules/@lua/shared-types/src/persona-defaults.ts +0 -59
  802. package/node_modules/@lua/shared-types/src/persona-text.type.ts +0 -92
  803. package/node_modules/@lua/shared-types/src/sandbox-contract.ts +0 -63
  804. package/node_modules/@lua/shared-types/src/unstructured-types.ts +0 -58
  805. package/node_modules/@lua/shared-types/src/vm-execution-log.types.ts +0 -41
  806. package/node_modules/@lua/shared-types/tsconfig.json +0 -12
  807. package/node_modules/@lua/shared-types/tsup.config.ts +0 -9
  808. package/scripts/resolve-workspace-deps.cjs +0 -61
  809. /package/dist/{compiler/utils/zod-runtime.mjs → zod-runtime.mjs} +0 -0
@@ -1,827 +0,0 @@
1
- /**
2
- * Backup Helper Utilities
3
- *
4
- * Utilities for project backup operations using S3 blob storage.
5
- * Content is stored in S3, keyed by content hash for deduplication.
6
- */
7
- import fs from 'fs';
8
- import path from 'path';
9
- import crypto from 'crypto';
10
- import zlib from 'zlib';
11
- // The compiler writes 16-char truncated SHA-256 hashes for project files into
12
- // `manifest.projectFiles[].hash`. Those hashes flow into the backup manifest
13
- // (via `prepareFileRefs`) and the local cache (via `writeBackupManifestCache`).
14
- // For the conflict detector to compare like-with-like, disk hashes must use
15
- // the same truncation. Importing the compiler's helper directly binds us to
16
- // that single source of truth — if the compiler ever changes the format, the
17
- // detector moves with it automatically. Do NOT swap this for the `hashContent`
18
- // defined below in this file, which returns full 64-char hashes for a
19
- // different purpose (project-level combined hash).
20
- import { hashContent as hashProjectFile } from '../compiler/utils/common.js';
21
- import { COMPILE_DIRS } from '../config/compile.constants.js';
22
- import { loadManifest, hasCompilationOutput } from './artifact-loader.js';
23
- import BackupApi from '../api/backup.api.service.js';
24
- import { BASE_URLS } from '../config/constants.js';
25
- // Cache records the file list + hashes from this machine's last successful
26
- // `lua push backup`. The server does not expose historical manifests, so
27
- // `lua sync --pull`'s conflict guard relies on this local record.
28
- const BACKUP_CACHE_FILENAME = 'backup-manifest.json';
29
- // =============================================================================
30
- // HASH CALCULATION
31
- // =============================================================================
32
- /**
33
- * Calculate a hash for a string content.
34
- *
35
- * @param content - The content to hash
36
- * @returns SHA-256 hash as hex string
37
- */
38
- export function hashContent(content) {
39
- return crypto.createHash('sha256').update(content, 'utf-8').digest('hex');
40
- }
41
- /**
42
- * Calculate combined project hash from all project files.
43
- * This hash is used to detect if the project has changed since last backup.
44
- *
45
- * @param projectFiles - Array of project files from the manifest
46
- * @returns Combined hash of all file hashes (sorted for determinism)
47
- */
48
- export function calculateProjectHash(projectFiles) {
49
- // Sort by relative path for deterministic ordering
50
- const sortedFiles = [...projectFiles].sort((a, b) => a.relativePath.localeCompare(b.relativePath));
51
- // Combine all individual file hashes
52
- const combinedHashes = sortedFiles.map((f) => f.hash).join('|');
53
- return hashContent(combinedHashes);
54
- }
55
- /**
56
- * Get the current project hash from the compilation manifest.
57
- * Returns null if no manifest exists.
58
- *
59
- * @param projectPath - Path to the project root
60
- * @returns The project hash or null
61
- */
62
- export function getCurrentProjectHash(projectPath = process.cwd()) {
63
- if (!hasCompilationOutput(projectPath))
64
- return null;
65
- const manifest = loadManifest(projectPath);
66
- return calculateProjectHash(manifest.projectFiles);
67
- }
68
- // =============================================================================
69
- // SOURCE LOADING
70
- // =============================================================================
71
- /**
72
- * Load all project source files from dist-v2/sources/ directory.
73
- *
74
- * @param manifest - The compilation manifest
75
- * @param projectPath - Path to the project root
76
- * @returns Map of relative path -> file content
77
- */
78
- export function loadProjectSources(manifest, projectPath = process.cwd()) {
79
- const sourcesDir = path.join(projectPath, COMPILE_DIRS.DIST_V2, 'sources');
80
- const sources = new Map();
81
- for (const file of manifest.projectFiles) {
82
- const ext = path.extname(file.relativePath) || '.txt';
83
- const sourcePath = path.join(sourcesDir, `${file.hash}${ext}`);
84
- if (fs.existsSync(sourcePath)) {
85
- const content = fs.readFileSync(sourcePath, 'utf-8');
86
- sources.set(file.relativePath, content);
87
- }
88
- }
89
- return sources;
90
- }
91
- /**
92
- * Load source content by hash from dist-v2/sources/ directory.
93
- *
94
- * @param hash - The content hash
95
- * @param relativePath - Original relative path (for extension)
96
- * @param projectPath - Path to the project root
97
- * @returns The file content or null if not found
98
- */
99
- export function loadSourceByHash(hash, relativePath, projectPath = process.cwd()) {
100
- const sourcesDir = path.join(projectPath, COMPILE_DIRS.DIST_V2, 'sources');
101
- const ext = path.extname(relativePath) || '.txt';
102
- const sourcePath = path.join(sourcesDir, `${hash}${ext}`);
103
- if (fs.existsSync(sourcePath)) {
104
- return fs.readFileSync(sourcePath, 'utf-8');
105
- }
106
- return null;
107
- }
108
- // =============================================================================
109
- // BLOB PREPARATION
110
- // =============================================================================
111
- /**
112
- * Prepare file references (manifest entries) from the compilation output.
113
- * No content included - just metadata for the manifest.
114
- *
115
- * @param projectPath - Path to the project root
116
- * @returns Array of file references ready for manifest
117
- */
118
- export function prepareFileRefs(projectPath = process.cwd()) {
119
- const manifest = loadManifest(projectPath);
120
- return manifest.projectFiles.map((file) => ({
121
- relativePath: file.relativePath,
122
- hash: file.hash,
123
- size: file.size,
124
- type: file.type,
125
- ...(file.external ? { external: true } : {}),
126
- }));
127
- }
128
- /**
129
- * Reconcile `manifest.projectFiles` and `dist-v2/sources/` with the
130
- * current on-disk state of each file. Fixes the pre-existing gap where
131
- * compile's yaml-sync step rewrites `lua.skill.yaml` on disk AFTER the
132
- * manifest was produced, leaving the manifest's hash for that file
133
- * one bump behind disk. `pushBackupCommand` calls this before using
134
- * the manifest so cache, uploaded blobs, and computed project hash all
135
- * describe disk-as-it-is-now.
136
- *
137
- * Approach: iterate manifest.projectFiles, re-hash each from disk. For
138
- * any file whose disk hash differs from the manifest hash, write a
139
- * matching blob into sources/ under the new hash (so uploadBlobsToS3
140
- * still finds content for the hash it's asked to upload) and update
141
- * the manifest entry. Persist the manifest to disk at the end if
142
- * anything changed. Orphaned old-hash files in sources/ are left in
143
- * place — they're gitignored and clean up naturally on the next
144
- * `npm run clean` or `lua compile`.
145
- *
146
- * Lenient: if a file in the manifest no longer exists on disk (user
147
- * deleted), skip it; the next compile will drop it from the manifest.
148
- */
149
- export function reconcileManifestWithDisk(projectPath = process.cwd()) {
150
- const manifestPath = path.join(projectPath, COMPILE_DIRS.DIST_V2, 'manifest.json');
151
- if (!fs.existsSync(manifestPath))
152
- return;
153
- const manifest = loadManifest(projectPath);
154
- const sourcesDir = path.join(projectPath, COMPILE_DIRS.DIST_V2, 'sources');
155
- fs.mkdirSync(sourcesDir, { recursive: true });
156
- let changed = false;
157
- for (const file of manifest.projectFiles) {
158
- // External files live outside `projectPath` and aren't rewritten by
159
- // compile's yaml-sync step, so there's nothing for the reconciler
160
- // to fix. Their hash was computed from disk at compile time and
161
- // already matches the manifest.
162
- if (file.external)
163
- continue;
164
- const absPath = path.join(projectPath, file.relativePath);
165
- if (!fs.existsSync(absPath))
166
- continue;
167
- let content;
168
- try {
169
- content = fs.readFileSync(absPath, 'utf-8');
170
- }
171
- catch {
172
- continue; // unreadable; let a later compile handle it
173
- }
174
- const freshHash = hashProjectFile(content);
175
- if (freshHash === file.hash)
176
- continue;
177
- // Drop new blob into sources/ under the fresh hash so the existing
178
- // upload pipeline (keyed by hash → sources/<hash>.<ext>) can find it.
179
- const ext = path.extname(file.relativePath) || '.txt';
180
- const sourceTargetPath = path.join(sourcesDir, `${freshHash}${ext}`);
181
- try {
182
- fs.writeFileSync(sourceTargetPath, content, 'utf-8');
183
- }
184
- catch {
185
- continue; // best-effort; skip this file
186
- }
187
- file.hash = freshHash;
188
- file.size = Buffer.byteLength(content, 'utf-8');
189
- changed = true;
190
- }
191
- if (changed) {
192
- fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2), 'utf-8');
193
- }
194
- }
195
- /**
196
- * Upload blobs directly to S3 using presigned URLs.
197
- * Compresses content with gzip before upload to reduce storage costs.
198
- *
199
- * @param uploadUrls - Map of hash -> presigned S3 PUT URL
200
- * @param manifest - The compilation manifest (for resolving hash → relativePath)
201
- * @param projectPath - Path to the project root
202
- * @param onProgress - Optional callback for progress updates
203
- * @param concurrency - Maximum parallel uploads (default: 10)
204
- * @returns Number of blobs uploaded
205
- */
206
- export async function uploadBlobsToS3(uploadUrls, manifest, projectPath = process.cwd(), onProgress, concurrency = 10) {
207
- const hashes = Object.keys(uploadUrls);
208
- const hashToRelativePath = buildHashToRelativePathMap(manifest);
209
- let uploaded = 0;
210
- for (let i = 0; i < hashes.length; i += concurrency) {
211
- const batch = hashes.slice(i, i + concurrency);
212
- await Promise.all(batch.map(async (hash) => {
213
- const relativePath = hashToRelativePath.get(hash);
214
- if (!relativePath) {
215
- throw new Error(`No file found in manifest for hash: ${hash}`);
216
- }
217
- const content = loadSourceByHash(hash, relativePath, projectPath);
218
- if (!content) {
219
- throw new Error(`Source file not found for hash: ${hash} (${relativePath})`);
220
- }
221
- // Gzip compress before upload
222
- const compressed = zlib.gzipSync(Buffer.from(content, 'utf-8'));
223
- // PUT directly to S3 presigned URL
224
- const response = await fetch(uploadUrls[hash], {
225
- method: 'PUT',
226
- body: compressed,
227
- headers: { 'Content-Type': 'application/octet-stream' },
228
- });
229
- if (!response.ok) {
230
- throw new Error(`S3 upload failed for ${hash.substring(0, 12)}...: ${response.status} ${response.statusText}`);
231
- }
232
- }));
233
- uploaded += batch.length;
234
- onProgress?.(uploaded, hashes.length);
235
- }
236
- return uploaded;
237
- }
238
- /**
239
- * Build a map from content hash to the first matching relative path.
240
- * Used by uploadBlobsToS3 to resolve file extensions for loadSourceByHash.
241
- */
242
- function buildHashToRelativePathMap(manifest) {
243
- const map = new Map();
244
- for (const file of manifest.projectFiles) {
245
- if (!map.has(file.hash)) {
246
- map.set(file.hash, file.relativePath);
247
- }
248
- }
249
- return map;
250
- }
251
- /**
252
- * Get all unique hashes from the manifest.
253
- *
254
- * @param projectPath - Path to the project root
255
- * @returns Array of unique content hashes
256
- */
257
- export function getAllFileHashes(projectPath = process.cwd()) {
258
- const manifest = loadManifest(projectPath);
259
- // Use Set to deduplicate (same content may appear multiple times)
260
- return [...new Set(manifest.projectFiles.map((f) => f.hash))];
261
- }
262
- // =============================================================================
263
- // BLOB DOWNLOAD
264
- // =============================================================================
265
- /**
266
- * Download a blob from a presigned URL.
267
- * Decompresses gzip content (blobs are stored compressed in S3).
268
- *
269
- * @param url - The presigned S3 URL
270
- * @returns The decompressed blob content as a Buffer
271
- */
272
- async function downloadBlobFromUrl(url) {
273
- const response = await fetch(url);
274
- if (!response.ok) {
275
- throw new Error(`Failed to download blob: ${response.status} ${response.statusText}`);
276
- }
277
- const arrayBuffer = await response.arrayBuffer();
278
- const buffer = Buffer.from(arrayBuffer);
279
- // Detect gzip via magic bytes (1f 8b). Most blobs are gzip-compressed
280
- // (CLI/server convention), but legacy/older uploads may be raw — fall
281
- // back to the raw buffer rather than throwing the whole restore.
282
- if (buffer.length >= 2 && buffer[0] === 0x1f && buffer[1] === 0x8b) {
283
- try {
284
- return zlib.gunzipSync(buffer);
285
- }
286
- catch {
287
- // Looked like gzip but failed to decompress — fall through to raw
288
- }
289
- }
290
- return buffer;
291
- }
292
- /**
293
- * Download multiple blobs in parallel from presigned URLs.
294
- *
295
- * @param urls - Map of hash -> presigned URL
296
- * @param concurrency - Maximum number of parallel downloads (default: 10)
297
- * @returns Map of hash -> content buffer
298
- */
299
- export async function downloadBlobsParallel(urls, concurrency = 10) {
300
- const results = new Map();
301
- const entries = Object.entries(urls);
302
- // Download in batches
303
- for (let i = 0; i < entries.length; i += concurrency) {
304
- const batch = entries.slice(i, i + concurrency);
305
- const batchResults = await Promise.all(batch.map(async ([hash, url]) => {
306
- const content = await downloadBlobFromUrl(url);
307
- return { hash, content };
308
- }));
309
- for (const { hash, content } of batchResults) {
310
- results.set(hash, content);
311
- }
312
- }
313
- return results;
314
- }
315
- // =============================================================================
316
- // PROJECT RESTORATION
317
- // =============================================================================
318
- /**
319
- * Restore project files from a backup manifest and downloaded blobs.
320
- * Creates all directories and files in the target directory.
321
- *
322
- * @param manifest - The backup manifest (file references)
323
- * @param blobs - Map of hash -> content buffer (downloaded blobs)
324
- * @param targetDir - Target directory to restore to
325
- * @param options - Optional settings
326
- */
327
- export function restoreProjectFromBackup(manifest, blobs, targetDir, options = {}) {
328
- const { overwrite = false } = options;
329
- for (const file of manifest.files) {
330
- const filePath = resolveBackupFileTarget(file, targetDir);
331
- const fileDir = path.dirname(filePath);
332
- // Skip if file exists and overwrite is false
333
- if (fs.existsSync(filePath) && !overwrite) {
334
- continue;
335
- }
336
- // Get blob content
337
- const content = blobs.get(file.hash);
338
- if (!content) {
339
- throw new Error(`Blob not found for hash: ${file.hash} (${file.relativePath})`);
340
- }
341
- fs.mkdirSync(fileDir, { recursive: true });
342
- fs.writeFileSync(filePath, content);
343
- }
344
- }
345
- /**
346
- * Resolve where a single backup entry should land on disk during restore.
347
- *
348
- * In-project entries are written at `targetDir/<relativePath>`. External
349
- * entries (cross-root workspace files captured for BAC-69) are sandboxed
350
- * under `targetDir/.lua/external/<relativePath>` — we never write them
351
- * back to their original workspace location, because:
352
- *
353
- * 1. The target dir might not even be a monorepo (`lua init --from-server`
354
- * clones the agent alone), in which case the original path doesn't
355
- * exist.
356
- * 2. Writing outside `targetDir` is a footgun: sibling packages may
357
- * still contain local edits we don't want to clobber.
358
- *
359
- * `.lua/external/` is a stable, gitignored mirror the compiler can read
360
- * from at rebuild time and the human can inspect to see what the backup
361
- * actually brought along.
362
- *
363
- * Defense-in-depth: we also reject paths that would escape `targetDir`
364
- * after sandboxing, so a malicious manifest with `../` segments can't
365
- * write outside the project tree.
366
- */
367
- export function resolveBackupFileTarget(file, targetDir) {
368
- const base = path.resolve(targetDir);
369
- const sandboxed = file.external
370
- ? path.join(base, '.lua', 'external', file.relativePath)
371
- : path.join(base, file.relativePath);
372
- const resolved = path.resolve(sandboxed);
373
- if (resolved !== base && !resolved.startsWith(base + path.sep)) {
374
- throw new Error(`Backup entry escapes target directory: ${file.relativePath}`);
375
- }
376
- return resolved;
377
- }
378
- /**
379
- * Check which files would be created/overwritten by restore.
380
- * Useful for showing user what will happen before restore.
381
- *
382
- * @param manifest - The backup manifest
383
- * @param targetDir - Target directory to check against
384
- * @returns Object with new files, existing files, and total count
385
- */
386
- export function checkRestoreConflicts(manifest, targetDir) {
387
- const newFiles = [];
388
- const existingFiles = [];
389
- for (const file of manifest.files) {
390
- const filePath = resolveBackupFileTarget(file, targetDir);
391
- if (fs.existsSync(filePath)) {
392
- existingFiles.push(file.relativePath);
393
- }
394
- else {
395
- newFiles.push(file.relativePath);
396
- }
397
- }
398
- return {
399
- newFiles,
400
- existingFiles,
401
- totalFiles: manifest.files.length,
402
- };
403
- }
404
- // =============================================================================
405
- // BACKUP TRACKING
406
- // =============================================================================
407
- /**
408
- * Check if project backup is out of sync (local changes not pushed).
409
- *
410
- * @param currentHash - Current project hash from manifest
411
- * @param tracking - Backup tracking from YAML
412
- * @returns true if backup is out of sync
413
- */
414
- export function isBackupOutOfSync(currentHash, tracking) {
415
- if (!tracking?.lastHash)
416
- return true;
417
- return tracking.lastHash !== currentHash;
418
- }
419
- /**
420
- * Create backup tracking object after successful push.
421
- *
422
- * @param projectHash - The hash of the pushed backup
423
- * @returns YamlConfigBackup object for storing in YAML
424
- */
425
- export function createBackupTracking(projectHash) {
426
- return {
427
- lastHash: projectHash,
428
- lastPushedAt: new Date().toISOString(),
429
- };
430
- }
431
- // =============================================================================
432
- // LOCAL BACKUP MANIFEST CACHE
433
- // =============================================================================
434
- export function getBackupCachePath(projectPath = process.cwd()) {
435
- return path.join(projectPath, '.lua', BACKUP_CACHE_FILENAME);
436
- }
437
- // Best-effort: a failed write must not fail the push that just succeeded
438
- // on the server. A missing cache degrades `lua sync --pull` to its
439
- // lenient "no-tracking" path.
440
- export function writeBackupManifestCache(cache, projectPath = process.cwd()) {
441
- const cachePath = getBackupCachePath(projectPath);
442
- try {
443
- fs.mkdirSync(path.dirname(cachePath), { recursive: true });
444
- fs.writeFileSync(cachePath, JSON.stringify(cache, null, 2), 'utf-8');
445
- }
446
- catch (error) {
447
- const message = error instanceof Error ? error.message : String(error);
448
- console.warn(`Could not write backup manifest cache: ${message}`);
449
- }
450
- }
451
- // Returns null when the cache is missing, unreadable, or malformed — the
452
- // conflict guard treats null as the "no-tracking" signal.
453
- export function readBackupManifestCache(projectPath = process.cwd()) {
454
- const cachePath = getBackupCachePath(projectPath);
455
- if (!fs.existsSync(cachePath))
456
- return null;
457
- try {
458
- const raw = fs.readFileSync(cachePath, 'utf-8');
459
- const parsed = JSON.parse(raw);
460
- // Guard against hand-edits or version skew, not against our own writer.
461
- if (typeof parsed.lastHash !== 'string' ||
462
- typeof parsed.lastPushedAt !== 'string' ||
463
- !Array.isArray(parsed.files) ||
464
- !parsed.files.every((f) => f && typeof f.relativePath === 'string' && typeof f.hash === 'string')) {
465
- return null;
466
- }
467
- return parsed;
468
- }
469
- catch {
470
- return null;
471
- }
472
- }
473
- // Files that `compileCommand()` silently rewrites as a side effect of
474
- // its server-sync step (currently just `lua.skill.yaml`, which the
475
- // handlers' `applySyncToYaml` bumps to match the server's active
476
- // primitive versions). `syncCommand` runs compile at the top, so when
477
- // the guard hashes disk after compile, yaml bytes already differ from
478
- // the last-push cache even if the user hasn't edited anything.
479
- //
480
- // Skipping yaml here avoids a false-positive `Refusing to pull` abort
481
- // on every multi-machine pull. The file is generated by compile, is
482
- // restored from backup during the pull, and any real divergence is
483
- // reconciled by `pushBackupCommand`'s `reconcileManifestWithDisk`
484
- // before the next backup is pushed.
485
- const COMPILE_MANAGED_FILES = new Set(['lua.skill.yaml']);
486
- // Algorithm matches spec 2026-04-15-sync-pull-conflict-guard-design.md.
487
- export function detectLocalConflictsForPull(incomingFiles, projectPath = process.cwd()) {
488
- const cache = readBackupManifestCache(projectPath);
489
- if (!cache) {
490
- return { conflicts: [], warning: 'no-tracking' };
491
- }
492
- const cachedByPath = new Map(cache.files.map((f) => [f.relativePath, f.hash]));
493
- const conflicts = new Set();
494
- const projectRoot = path.resolve(projectPath);
495
- for (const incoming of incomingFiles) {
496
- // Skip files compile silently rewrites; see COMPILE_MANAGED_FILES.
497
- if (COMPILE_MANAGED_FILES.has(incoming.relativePath))
498
- continue;
499
- // External (cross-root) files are restored into `.lua/external/`, not
500
- // back to their workspace origin, so they can never conflict with an
501
- // in-project file the user is editing. Skip them.
502
- if (incoming.external)
503
- continue;
504
- const absPath = path.resolve(projectRoot, incoming.relativePath);
505
- // Defense-in-depth: skip manifest entries whose path escapes the project
506
- // directory (e.g. via `../`). The restore step is the real vulnerability
507
- // surface here; silently skipping keeps the guard from hashing arbitrary
508
- // files outside the project.
509
- if (absPath !== projectRoot && !absPath.startsWith(projectRoot + path.sep)) {
510
- continue;
511
- }
512
- if (!fs.existsSync(absPath))
513
- continue;
514
- let diskHash;
515
- try {
516
- const bytes = fs.readFileSync(absPath, 'utf-8');
517
- // Must match the compiler's hash format — the cache and server manifest
518
- // both contain 16-char truncated hashes (see hashProjectFile import above).
519
- diskHash = hashProjectFile(bytes);
520
- }
521
- catch {
522
- // Unreadable: flag as conflict so we don't silently overwrite.
523
- conflicts.add(incoming.relativePath);
524
- continue;
525
- }
526
- const cachedHash = cachedByPath.get(incoming.relativePath);
527
- if (cachedHash !== undefined) {
528
- if (diskHash !== cachedHash) {
529
- conflicts.add(incoming.relativePath);
530
- }
531
- continue;
532
- }
533
- // Not in local cache — user created this file or pushed from a
534
- // different machine. Flag only if pulling would actually change it.
535
- if (diskHash !== incoming.hash) {
536
- conflicts.add(incoming.relativePath);
537
- }
538
- }
539
- return { conflicts: [...conflicts].sort(), warning: null };
540
- }
541
- // =============================================================================
542
- // SYNC HELPERS
543
- // =============================================================================
544
- // Fetch the current backup manifest for sync's pre-pull conflict guard.
545
- // Returns `fetched: null` when the request fails so the caller can warn
546
- // about lenient-mode fallback without pattern-matching on exceptions.
547
- export async function fetchBackupManifestForPull(apiKey, agentId) {
548
- try {
549
- const backupApi = new BackupApi(BASE_URLS.API, apiKey, agentId);
550
- const response = await backupApi.getBackupManifest();
551
- return { fetched: response.data ?? null };
552
- }
553
- catch {
554
- return { fetched: null };
555
- }
556
- }
557
- /**
558
- * Pure freshness-decision logic for `checkServerBackupNewerThanLocal`.
559
- * Exported so tests can exercise every branch (no-cache, server-fetch-
560
- * failed, server-newer, server-older) without mocking HTTP.
561
- *
562
- * Uses `projectHash` as the freshness signal, not `createdAt`: the
563
- * server's `BackupMetadata.createdAt` is the date the backup RECORD was
564
- * first created (often days/weeks ago), not the last time it was
565
- * updated. Comparing our local `lastPushedAt` to the record's
566
- * `createdAt` produces wrong answers; comparing the project hashes
567
- * answers the actual question ("did anyone push something I haven't
568
- * seen?").
569
- *
570
- * Lenient: missing local cache → proceed (no baseline); missing server
571
- * metadata → `checkFailed` so callers can warn-and-proceed rather than
572
- * block on transient server errors.
573
- */
574
- export function decideBackupFreshness(local, serverMetadata) {
575
- if (!local)
576
- return { serverNewer: false };
577
- if (!serverMetadata)
578
- return { serverNewer: false, checkFailed: true };
579
- // If the server's current backup hash differs from the hash we last
580
- // pushed, someone else pushed in between — refuse unless --force.
581
- // Equal hashes mean nothing has changed server-side; a re-push of
582
- // the same content is harmless (skipped by the later up-to-date
583
- // check anyway).
584
- const serverNewer = serverMetadata.projectHash !== local.lastHash;
585
- return {
586
- serverNewer,
587
- serverProjectHash: serverMetadata.projectHash,
588
- localLastHash: local.lastHash,
589
- };
590
- }
591
- /**
592
- * Compare the server's backup `createdAt` to this machine's local cache
593
- * `lastPushedAt`. Used to detect the "another machine pushed while I
594
- * wasn't looking" case before `lua push backup` uploads and overwrites
595
- * the server side.
596
- */
597
- export async function checkServerBackupNewerThanLocal(apiKey, agentId, projectPath = process.cwd()) {
598
- const local = readBackupManifestCache(projectPath);
599
- try {
600
- const api = new BackupApi(BASE_URLS.API, apiKey, agentId);
601
- const resp = await api.getBackupMetadata();
602
- const metadata = resp.success && resp.data ? { projectHash: resp.data.projectHash } : null;
603
- return decideBackupFreshness(local, metadata);
604
- }
605
- catch {
606
- return decideBackupFreshness(local, null);
607
- }
608
- }
609
- /**
610
- * Check whether a backup exists for the given agent.
611
- * Returns availability status along with basic metadata if a backup is found.
612
- *
613
- * @param apiKey - API key for authentication
614
- * @param agentId - The agent whose backup to check
615
- * @returns Object indicating availability and optional metadata
616
- */
617
- export async function checkBackupAvailability(apiKey, agentId) {
618
- try {
619
- const backupApi = new BackupApi(BASE_URLS.API, apiKey, agentId);
620
- const metadata = await backupApi.getBackupMetadata();
621
- if (metadata.data && metadata.data.fileCount > 0) {
622
- return {
623
- available: true,
624
- fileCount: metadata.data.fileCount,
625
- lastPushedAt: metadata.data.createdAt,
626
- };
627
- }
628
- return { available: false };
629
- }
630
- catch {
631
- return { available: false };
632
- }
633
- }
634
- /**
635
- * Restore project source files from the S3 backup for `lua sync --pull`.
636
- *
637
- * Differs from `restoreProjectFromBackup` by byte-comparing before writing
638
- * (so the caller can report what actually changed) and by classifying the
639
- * restored files against `expectedPrimitives` to report backup coverage.
640
- */
641
- export async function restoreFromBackupForSync(apiKey, agentId, expectedPrimitives = [], projectPath, preFetchedManifest) {
642
- const targetDir = projectPath || process.cwd();
643
- try {
644
- const backupApi = new BackupApi(BASE_URLS.API, apiKey, agentId);
645
- const manifest = preFetchedManifest ?? (await backupApi.getBackupManifest()).data ?? null;
646
- if (!manifest || !manifest.files?.length) {
647
- return {
648
- success: false,
649
- filesWritten: 0,
650
- filesUnchanged: 0,
651
- primitivesResolved: [],
652
- primitivesUnresolved: [...expectedPrimitives],
653
- backupAgeDays: null,
654
- error: 'No backup manifest found',
655
- };
656
- }
657
- const uniqueHashes = [...new Set(manifest.files.map((f) => f.hash))];
658
- const urlsResponse = await backupApi.getBlobUrls(uniqueHashes);
659
- if (!urlsResponse.data) {
660
- return {
661
- success: false,
662
- filesWritten: 0,
663
- filesUnchanged: 0,
664
- primitivesResolved: [],
665
- primitivesUnresolved: [...expectedPrimitives],
666
- backupAgeDays: computeBackupAgeDays(manifest),
667
- error: 'Failed to get download URLs',
668
- };
669
- }
670
- const blobs = await downloadBlobsParallel(urlsResponse.data.urls, 10);
671
- const { filesWritten, filesUnchanged, restoredContents } = writeBackupFilesWithByteCompare(manifest, blobs, targetDir);
672
- const { resolved, unresolved } = classifyPrimitiveCoverage(expectedPrimitives, restoredContents);
673
- // After a successful restore, disk contents now match the server
674
- // manifest we just pulled. Sync the local cache so subsequent
675
- // `lua sync --pull` runs don't mis-read the freshly-restored files
676
- // as "user edits since last push".
677
- updateCacheFromServerManifest(manifest, targetDir);
678
- return {
679
- success: true,
680
- filesWritten,
681
- filesUnchanged,
682
- primitivesResolved: resolved,
683
- primitivesUnresolved: unresolved,
684
- backupAgeDays: computeBackupAgeDays(manifest),
685
- };
686
- }
687
- catch (error) {
688
- const message = error instanceof Error ? error.message : 'Unknown error';
689
- return {
690
- success: false,
691
- filesWritten: 0,
692
- filesUnchanged: 0,
693
- primitivesResolved: [],
694
- primitivesUnresolved: [...expectedPrimitives],
695
- backupAgeDays: null,
696
- error: message,
697
- };
698
- }
699
- }
700
- /**
701
- * Write the local backup-manifest cache so it reflects the just-restored
702
- * server state. Used by `restoreFromBackupForSync` to keep the conflict
703
- * guard accurate on the next pull: without this, every file we just
704
- * restored would show up as "modified since last push" on the very next
705
- * `lua sync --pull` and trip the guard.
706
- *
707
- * Uses the server manifest's `createdAt` (when the backup was originally
708
- * pushed) rather than "now", so the cache records a timestamp consistent
709
- * with the state it's describing — not the moment we happened to pull it.
710
- */
711
- export function updateCacheFromServerManifest(manifest, projectPath = process.cwd()) {
712
- writeBackupManifestCache({
713
- lastHash: manifest.projectHash,
714
- lastPushedAt: manifest.createdAt,
715
- // See `pushBackup.ts` — external entries are sandboxed during restore
716
- // so the conflict guard never inspects them; keeping them out of the
717
- // cache keeps disk comparisons aligned with the files we actually
718
- // write back to their original location.
719
- files: manifest.files
720
- .filter((f) => !f.external)
721
- .map((f) => ({
722
- relativePath: f.relativePath,
723
- hash: f.hash,
724
- })),
725
- }, projectPath);
726
- }
727
- /**
728
- * Skip the write when disk bytes already match, so callers can distinguish
729
- * "9 files restored" from "9 files matched disk, 0 written."
730
- */
731
- function writeBackupFilesWithByteCompare(manifest, blobs, targetDir) {
732
- let filesWritten = 0;
733
- let filesUnchanged = 0;
734
- const restoredContents = new Map();
735
- for (const file of manifest.files) {
736
- const content = blobs.get(file.hash);
737
- if (!content) {
738
- throw new Error(`Blob not found for hash: ${file.hash} (${file.relativePath})`);
739
- }
740
- // Namespace by `external` so in-project and external entries with
741
- // the same relativePath (legitimately allowed by the M4 dedup fix)
742
- // coexist in the Map instead of one silently clobbering the other.
743
- // The consumer (classifyPrimitiveCoverage) is now aware of the
744
- // prefix and strips it before its extension check.
745
- restoredContents.set(makeRestoredContentsKey(file), content);
746
- const filePath = resolveBackupFileTarget(file, targetDir);
747
- if (fs.existsSync(filePath)) {
748
- const existing = fs.readFileSync(filePath);
749
- if (existing.equals(content)) {
750
- filesUnchanged++;
751
- continue;
752
- }
753
- }
754
- fs.mkdirSync(path.dirname(filePath), { recursive: true });
755
- fs.writeFileSync(filePath, content);
756
- filesWritten++;
757
- }
758
- return { filesWritten, filesUnchanged, restoredContents };
759
- }
760
- /**
761
- * Prefix the `relativePath` with a namespace derived from `file.external`
762
- * so the restoredContents Map can hold both copies when a manifest has
763
- * two entries sharing the same relativePath (M4 permits this — one
764
- * in-project, one external/workspace-relative). Without the namespacing
765
- * the second write silently clobbers the first in the Map, which
766
- * breaks the design intent even though both files land correctly on
767
- * disk (resolveBackupFileTarget uses `file.external`, not the Map key).
768
- *
769
- * `ext:` and `loc:` are deliberately short and unlikely to appear at
770
- * the start of any real relativePath. Consumers MUST strip the prefix
771
- * before interpreting the key as a filesystem-relative path.
772
- */
773
- function makeRestoredContentsKey(file) {
774
- return `${file.external ? 'ext:' : 'loc:'}${file.relativePath}`;
775
- }
776
- /**
777
- * Strip the `ext:` / `loc:` namespace prefix from a
778
- * restoredContents key, returning the raw relativePath. Safe to call
779
- * on unprefixed strings (returns them unchanged) for forward
780
- * compatibility with any older callers.
781
- */
782
- function stripRestoredContentsKey(key) {
783
- if (key.startsWith('ext:'))
784
- return key.slice(4);
785
- if (key.startsWith('loc:'))
786
- return key.slice(4);
787
- return key;
788
- }
789
- /**
790
- * Fuzzy "does the backup define this primitive?" check: match the name as a
791
- * quoted string literal in any restored .ts/.tsx/.js/.jsx file. Avoids pulling
792
- * in a TS parser for sync reporting; can mis-classify when a name is built from
793
- * a variable or appears in a string literal that isn't a primitive declaration.
794
- */
795
- function classifyPrimitiveCoverage(expected, restoredContents) {
796
- if (expected.length === 0) {
797
- return { resolved: [], unresolved: [] };
798
- }
799
- const haystack = Array.from(restoredContents.entries())
800
- // Strip the ext:/loc: namespace prefix the writer adds, then test
801
- // the extension on the actual relativePath suffix. Without this,
802
- // every prefixed key fails the regex and the haystack is empty.
803
- .filter(([key]) => /\.(ts|tsx|js|jsx)$/.test(stripRestoredContentsKey(key)))
804
- .map(([, buf]) => buf.toString('utf-8'))
805
- .join('\n');
806
- const resolved = [];
807
- const unresolved = [];
808
- for (const name of expected) {
809
- const quoted = haystack.includes(`'${name}'`) || haystack.includes(`"${name}"`) || haystack.includes(`\`${name}\``);
810
- if (quoted)
811
- resolved.push(name);
812
- else
813
- unresolved.push(name);
814
- }
815
- return { resolved, unresolved };
816
- }
817
- function computeBackupAgeDays(manifest) {
818
- const createdAt = manifest.createdAt;
819
- if (!createdAt)
820
- return null;
821
- const created = new Date(createdAt).getTime();
822
- if (!Number.isFinite(created))
823
- return null;
824
- const ageMs = Date.now() - created;
825
- return Math.max(0, Math.floor(ageMs / (1000 * 60 * 60 * 24)));
826
- }
827
- //# sourceMappingURL=backup-helpers.js.map