wicked-crew 0.18.19 → 0.18.20

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 (395) hide show
  1. package/README.md +9 -6
  2. package/dist/api/ask-paths.d.ts +2 -0
  3. package/dist/api/ask-paths.d.ts.map +1 -1
  4. package/dist/api/ask-paths.js +6 -0
  5. package/dist/api/ask-paths.js.map +1 -1
  6. package/dist/api/auth.d.ts +7 -5
  7. package/dist/api/auth.d.ts.map +1 -1
  8. package/dist/api/auth.js +23 -9
  9. package/dist/api/auth.js.map +1 -1
  10. package/dist/api/chat-attachments.d.ts.map +1 -1
  11. package/dist/api/chat-attachments.js +69 -19
  12. package/dist/api/chat-attachments.js.map +1 -1
  13. package/dist/api/chat-citations.d.ts.map +1 -1
  14. package/dist/api/chat-citations.js +22 -0
  15. package/dist/api/chat-citations.js.map +1 -1
  16. package/dist/api/chat-context.d.ts +4 -1
  17. package/dist/api/chat-context.d.ts.map +1 -1
  18. package/dist/api/chat-context.js +15 -9
  19. package/dist/api/chat-context.js.map +1 -1
  20. package/dist/api/chat-history.d.ts +13 -0
  21. package/dist/api/chat-history.d.ts.map +1 -1
  22. package/dist/api/chat-history.js +25 -0
  23. package/dist/api/chat-history.js.map +1 -1
  24. package/dist/api/chat-jobs.d.ts +13 -6
  25. package/dist/api/chat-jobs.d.ts.map +1 -1
  26. package/dist/api/chat-jobs.js +48 -19
  27. package/dist/api/chat-jobs.js.map +1 -1
  28. package/dist/api/chat-proposals.d.ts +30 -0
  29. package/dist/api/chat-proposals.d.ts.map +1 -1
  30. package/dist/api/chat-proposals.js +157 -21
  31. package/dist/api/chat-proposals.js.map +1 -1
  32. package/dist/api/chat-scope.d.ts +9 -9
  33. package/dist/api/chat-scope.d.ts.map +1 -1
  34. package/dist/api/chat-scope.js +29 -19
  35. package/dist/api/chat-scope.js.map +1 -1
  36. package/dist/api/cluster-status.js +1 -1
  37. package/dist/api/cluster-status.js.map +1 -1
  38. package/dist/api/codebase-archive.d.ts +4 -3
  39. package/dist/api/codebase-archive.d.ts.map +1 -1
  40. package/dist/api/codebase-archive.js +4 -3
  41. package/dist/api/codebase-archive.js.map +1 -1
  42. package/dist/api/gate-cache.d.ts +1 -0
  43. package/dist/api/gate-cache.d.ts.map +1 -1
  44. package/dist/api/gate-cache.js +19 -6
  45. package/dist/api/gate-cache.js.map +1 -1
  46. package/dist/api/governance-steering.d.ts +4 -4
  47. package/dist/api/mcp.d.ts +10 -2
  48. package/dist/api/mcp.d.ts.map +1 -1
  49. package/dist/api/mcp.js +53 -12
  50. package/dist/api/mcp.js.map +1 -1
  51. package/dist/api/product.d.ts +1 -1
  52. package/dist/api/proposal-onboard.d.ts +9 -1
  53. package/dist/api/proposal-onboard.d.ts.map +1 -1
  54. package/dist/api/proposal-onboard.js +41 -3
  55. package/dist/api/proposal-onboard.js.map +1 -1
  56. package/dist/api/recording.d.ts +1 -1
  57. package/dist/api/requirements.d.ts +2 -16
  58. package/dist/api/requirements.d.ts.map +1 -1
  59. package/dist/api/requirements.js.map +1 -1
  60. package/dist/api/retry-index.d.ts +2 -0
  61. package/dist/api/retry-index.d.ts.map +1 -1
  62. package/dist/api/retry-index.js +16 -8
  63. package/dist/api/retry-index.js.map +1 -1
  64. package/dist/api/roster-standing.d.ts +2 -0
  65. package/dist/api/roster-standing.d.ts.map +1 -1
  66. package/dist/api/roster-standing.js +8 -1
  67. package/dist/api/roster-standing.js.map +1 -1
  68. package/dist/api/routes.d.ts +23 -9
  69. package/dist/api/routes.d.ts.map +1 -1
  70. package/dist/api/routes.js +501 -153
  71. package/dist/api/routes.js.map +1 -1
  72. package/dist/api/run-documents.d.ts +9 -1
  73. package/dist/api/run-documents.d.ts.map +1 -1
  74. package/dist/api/run-documents.js +63 -5
  75. package/dist/api/run-documents.js.map +1 -1
  76. package/dist/api/run-timing-index.d.ts +2 -0
  77. package/dist/api/run-timing-index.d.ts.map +1 -1
  78. package/dist/api/run-timing-index.js +62 -86
  79. package/dist/api/run-timing-index.js.map +1 -1
  80. package/dist/api/seat-container-login.js +2 -2
  81. package/dist/api/seat-container-login.js.map +1 -1
  82. package/dist/api/server.d.ts.map +1 -1
  83. package/dist/api/server.js +79 -20
  84. package/dist/api/server.js.map +1 -1
  85. package/dist/api/stall-watchdog.d.ts +6 -0
  86. package/dist/api/stall-watchdog.d.ts.map +1 -1
  87. package/dist/api/stall-watchdog.js +28 -0
  88. package/dist/api/stall-watchdog.js.map +1 -1
  89. package/dist/api/system-snapshot.d.ts +5 -0
  90. package/dist/api/system-snapshot.d.ts.map +1 -1
  91. package/dist/api/system-snapshot.js +17 -7
  92. package/dist/api/system-snapshot.js.map +1 -1
  93. package/dist/api/testing.d.ts +2 -2
  94. package/dist/api/ui-text.js +2 -2
  95. package/dist/api/ui-text.js.map +1 -1
  96. package/dist/apps/actions/api-action.js +5 -2
  97. package/dist/apps/actions/api-action.js.map +1 -1
  98. package/dist/apps/actions/write-path.d.ts +9 -0
  99. package/dist/apps/actions/write-path.d.ts.map +1 -1
  100. package/dist/apps/actions/write-path.js +17 -9
  101. package/dist/apps/actions/write-path.js.map +1 -1
  102. package/dist/apps/exec/executor.d.ts +8 -15
  103. package/dist/apps/exec/executor.d.ts.map +1 -1
  104. package/dist/apps/exec/executor.js +10 -3
  105. package/dist/apps/exec/executor.js.map +1 -1
  106. package/dist/apps/exec/redescribe.d.ts +37 -0
  107. package/dist/apps/exec/redescribe.d.ts.map +1 -0
  108. package/dist/apps/exec/redescribe.js +86 -0
  109. package/dist/apps/exec/redescribe.js.map +1 -0
  110. package/dist/apps/exec/source-stage.d.ts +3 -1
  111. package/dist/apps/exec/source-stage.d.ts.map +1 -1
  112. package/dist/apps/exec/source-stage.js +13 -3
  113. package/dist/apps/exec/source-stage.js.map +1 -1
  114. package/dist/apps/exec/sources.d.ts +6 -0
  115. package/dist/apps/exec/sources.d.ts.map +1 -1
  116. package/dist/apps/exec/sources.js +8 -0
  117. package/dist/apps/exec/sources.js.map +1 -1
  118. package/dist/apps/publish/manifest.d.ts +6 -1
  119. package/dist/apps/publish/manifest.d.ts.map +1 -1
  120. package/dist/apps/publish/manifest.js +6 -0
  121. package/dist/apps/publish/manifest.js.map +1 -1
  122. package/dist/apps/publish/run.d.ts +4 -1
  123. package/dist/apps/publish/run.d.ts.map +1 -1
  124. package/dist/apps/publish/run.js +4 -1
  125. package/dist/apps/publish/run.js.map +1 -1
  126. package/dist/apps/routes.d.ts +1 -0
  127. package/dist/apps/routes.d.ts.map +1 -1
  128. package/dist/apps/routes.js +13 -0
  129. package/dist/apps/routes.js.map +1 -1
  130. package/dist/apps-server/Dockerfile +2 -2
  131. package/dist/apps-server/runners/sqlite-runner.mjs +28 -11
  132. package/dist/apps-server/server/lib/bundle/server.mjs +243 -149
  133. package/dist/cli/governance.d.ts +5 -2
  134. package/dist/cli/governance.d.ts.map +1 -1
  135. package/dist/cli/governance.js +8 -5
  136. package/dist/cli/governance.js.map +1 -1
  137. package/dist/cli/index.d.ts.map +1 -1
  138. package/dist/cli/index.js +6 -5
  139. package/dist/cli/index.js.map +1 -1
  140. package/dist/cli/service.d.ts +10 -6
  141. package/dist/cli/service.d.ts.map +1 -1
  142. package/dist/cli/service.js +39 -23
  143. package/dist/cli/service.js.map +1 -1
  144. package/dist/core/adapter.d.ts +38 -21
  145. package/dist/core/adapter.d.ts.map +1 -1
  146. package/dist/core/adapter.js +155 -57
  147. package/dist/core/adapter.js.map +1 -1
  148. package/dist/core/assurance.d.ts +37 -44
  149. package/dist/core/assurance.d.ts.map +1 -1
  150. package/dist/core/assurance.js +53 -69
  151. package/dist/core/assurance.js.map +1 -1
  152. package/dist/core/deliver-text.d.ts +12 -0
  153. package/dist/core/deliver-text.d.ts.map +1 -1
  154. package/dist/core/deliver-text.js +40 -2
  155. package/dist/core/deliver-text.js.map +1 -1
  156. package/dist/core/deliver.d.ts +23 -0
  157. package/dist/core/deliver.d.ts.map +1 -1
  158. package/dist/core/deliver.js +52 -7
  159. package/dist/core/deliver.js.map +1 -1
  160. package/dist/core/engine-roster.d.ts +2 -0
  161. package/dist/core/engine-roster.d.ts.map +1 -1
  162. package/dist/core/engine-roster.js +13 -0
  163. package/dist/core/engine-roster.js.map +1 -1
  164. package/dist/core/estate-mcp-client.d.ts +13 -14
  165. package/dist/core/estate-mcp-client.d.ts.map +1 -1
  166. package/dist/core/estate-mcp-client.js +47 -62
  167. package/dist/core/estate-mcp-client.js.map +1 -1
  168. package/dist/core/pr-checks-helper.d.ts +8 -4
  169. package/dist/core/pr-checks-helper.d.ts.map +1 -1
  170. package/dist/core/pr-checks-helper.js +39 -17
  171. package/dist/core/pr-checks-helper.js.map +1 -1
  172. package/dist/core/repoPaths.d.ts +2 -4
  173. package/dist/core/repoPaths.d.ts.map +1 -1
  174. package/dist/core/repoPaths.js +4 -6
  175. package/dist/core/repoPaths.js.map +1 -1
  176. package/dist/core/types.d.ts.map +1 -1
  177. package/dist/core/types.js +2 -0
  178. package/dist/core/types.js.map +1 -1
  179. package/dist/decisions/rules-brief.d.ts +2 -0
  180. package/dist/decisions/rules-brief.d.ts.map +1 -1
  181. package/dist/decisions/rules-brief.js.map +1 -1
  182. package/dist/editors/csp.d.ts +6 -0
  183. package/dist/editors/csp.d.ts.map +1 -1
  184. package/dist/editors/csp.js +10 -0
  185. package/dist/editors/csp.js.map +1 -1
  186. package/dist/editors/pack-install.d.ts.map +1 -1
  187. package/dist/editors/pack-install.js +1 -0
  188. package/dist/editors/pack-install.js.map +1 -1
  189. package/dist/editors/registry.d.ts +5 -1
  190. package/dist/editors/registry.d.ts.map +1 -1
  191. package/dist/editors/registry.js +16 -3
  192. package/dist/editors/registry.js.map +1 -1
  193. package/dist/editors/routes.d.ts +4 -2
  194. package/dist/editors/routes.d.ts.map +1 -1
  195. package/dist/editors/routes.js +23 -6
  196. package/dist/editors/routes.js.map +1 -1
  197. package/dist/evals/shape-corrections.js +1 -1
  198. package/dist/evals/shape-corrections.js.map +1 -1
  199. package/dist/evals/workflow.d.ts.map +1 -1
  200. package/dist/evals/workflow.js +1 -0
  201. package/dist/evals/workflow.js.map +1 -1
  202. package/dist/governance/rule-revision.d.ts +7 -0
  203. package/dist/governance/rule-revision.d.ts.map +1 -0
  204. package/dist/governance/rule-revision.js +23 -0
  205. package/dist/governance/rule-revision.js.map +1 -0
  206. package/dist/insights/review-service.d.ts +2 -0
  207. package/dist/insights/review-service.d.ts.map +1 -1
  208. package/dist/insights/review-service.js +27 -0
  209. package/dist/insights/review-service.js.map +1 -1
  210. package/dist/interactive/bridge-pool.d.ts +2 -0
  211. package/dist/interactive/bridge-pool.d.ts.map +1 -1
  212. package/dist/interactive/bridge-pool.js +12 -4
  213. package/dist/interactive/bridge-pool.js.map +1 -1
  214. package/dist/interactive/chat-events.d.ts +3 -0
  215. package/dist/interactive/chat-events.d.ts.map +1 -1
  216. package/dist/interactive/chat-events.js +13 -4
  217. package/dist/interactive/chat-events.js.map +1 -1
  218. package/dist/interactive/doc-delete-routes.d.ts +1 -0
  219. package/dist/interactive/doc-delete-routes.d.ts.map +1 -1
  220. package/dist/interactive/doc-delete-routes.js +126 -123
  221. package/dist/interactive/doc-delete-routes.js.map +1 -1
  222. package/dist/interactive/draft-events.d.ts +8 -7
  223. package/dist/interactive/draft-events.d.ts.map +1 -1
  224. package/dist/interactive/draft-events.js +24 -14
  225. package/dist/interactive/draft-events.js.map +1 -1
  226. package/dist/interactive/proposal-create.d.ts +9 -11
  227. package/dist/interactive/proposal-create.d.ts.map +1 -1
  228. package/dist/interactive/proposal-create.js +27 -21
  229. package/dist/interactive/proposal-create.js.map +1 -1
  230. package/dist/interactive/proposal-refine.d.ts +4 -4
  231. package/dist/interactive/proposal-refine.d.ts.map +1 -1
  232. package/dist/interactive/proposal-refine.js +25 -7
  233. package/dist/interactive/proposal-refine.js.map +1 -1
  234. package/dist/interactive/proxy-routes.d.ts +10 -5
  235. package/dist/interactive/proxy-routes.d.ts.map +1 -1
  236. package/dist/interactive/proxy-routes.js +108 -11
  237. package/dist/interactive/proxy-routes.js.map +1 -1
  238. package/dist/interactive/source-packet.d.ts +5 -1
  239. package/dist/interactive/source-packet.d.ts.map +1 -1
  240. package/dist/interactive/source-packet.js +62 -29
  241. package/dist/interactive/source-packet.js.map +1 -1
  242. package/dist/knowledge/adapters/toolbox/memory.d.ts +2 -0
  243. package/dist/knowledge/adapters/toolbox/memory.d.ts.map +1 -0
  244. package/dist/knowledge/adapters/toolbox/memory.js +43 -0
  245. package/dist/knowledge/adapters/toolbox/memory.js.map +1 -0
  246. package/dist/knowledge/adapters/toolbox/supervisor.d.ts +9 -3
  247. package/dist/knowledge/adapters/toolbox/supervisor.d.ts.map +1 -1
  248. package/dist/knowledge/adapters/toolbox/supervisor.js +40 -6
  249. package/dist/knowledge/adapters/toolbox/supervisor.js.map +1 -1
  250. package/dist/knowledge/gate/gate.d.ts.map +1 -1
  251. package/dist/knowledge/gate/gate.js +4 -1
  252. package/dist/knowledge/gate/gate.js.map +1 -1
  253. package/dist/knowledge/gate/record.d.ts +15 -2
  254. package/dist/knowledge/gate/record.d.ts.map +1 -1
  255. package/dist/knowledge/gate/record.js +108 -29
  256. package/dist/knowledge/gate/record.js.map +1 -1
  257. package/dist/knowledge/registry/entry.d.ts +7 -0
  258. package/dist/knowledge/registry/entry.d.ts.map +1 -1
  259. package/dist/knowledge/registry/entry.js +4 -0
  260. package/dist/knowledge/registry/entry.js.map +1 -1
  261. package/dist/learn/scheduler.d.ts.map +1 -1
  262. package/dist/learn/scheduler.js +2 -1
  263. package/dist/learn/scheduler.js.map +1 -1
  264. package/dist/learnings/estate.d.ts.map +1 -1
  265. package/dist/learnings/estate.js +3 -14
  266. package/dist/learnings/estate.js.map +1 -1
  267. package/dist/mcp/broker.js +1 -1
  268. package/dist/mcp/broker.js.map +1 -1
  269. package/dist/mcp/env.d.ts +12 -4
  270. package/dist/mcp/env.d.ts.map +1 -1
  271. package/dist/mcp/env.js +24 -4
  272. package/dist/mcp/env.js.map +1 -1
  273. package/dist/mcp/estate-relay.d.ts.map +1 -1
  274. package/dist/mcp/estate-relay.js +2 -4
  275. package/dist/mcp/estate-relay.js.map +1 -1
  276. package/dist/mcp/invoke.d.ts.map +1 -1
  277. package/dist/mcp/invoke.js +4 -3
  278. package/dist/mcp/invoke.js.map +1 -1
  279. package/dist/mcp/probe.d.ts +14 -1
  280. package/dist/mcp/probe.d.ts.map +1 -1
  281. package/dist/mcp/probe.js +55 -10
  282. package/dist/mcp/probe.js.map +1 -1
  283. package/dist/mcp/registry-store.d.ts +12 -0
  284. package/dist/mcp/registry-store.d.ts.map +1 -1
  285. package/dist/mcp/registry-store.js +10 -0
  286. package/dist/mcp/registry-store.js.map +1 -1
  287. package/dist/mcp/registry.d.ts +13 -5
  288. package/dist/mcp/registry.d.ts.map +1 -1
  289. package/dist/mcp/registry.js +61 -9
  290. package/dist/mcp/registry.js.map +1 -1
  291. package/dist/mcp/rest.js +1 -1
  292. package/dist/mcp/rest.js.map +1 -1
  293. package/dist/mcp/secrets.d.ts +1 -1
  294. package/dist/mcp/secrets.d.ts.map +1 -1
  295. package/dist/mcp/secrets.js +10 -11
  296. package/dist/mcp/secrets.js.map +1 -1
  297. package/dist/mcp/upstream-error.d.ts +1 -1
  298. package/dist/mcp/upstream-error.d.ts.map +1 -1
  299. package/dist/projects/graph.d.ts +10 -2
  300. package/dist/projects/graph.d.ts.map +1 -1
  301. package/dist/projects/graph.js +190 -10
  302. package/dist/projects/graph.js.map +1 -1
  303. package/dist/projects/repo-watch.d.ts +2 -2
  304. package/dist/projects/repo-watch.d.ts.map +1 -1
  305. package/dist/projects/repo-watch.js +26 -9
  306. package/dist/projects/repo-watch.js.map +1 -1
  307. package/dist/projects/routes.d.ts +2 -0
  308. package/dist/projects/routes.d.ts.map +1 -1
  309. package/dist/projects/routes.js +50 -1
  310. package/dist/projects/routes.js.map +1 -1
  311. package/dist/projects/state-home-registry.d.ts.map +1 -1
  312. package/dist/projects/state-home-registry.js +3 -0
  313. package/dist/projects/state-home-registry.js.map +1 -1
  314. package/dist/projects/state-home.d.ts +7 -0
  315. package/dist/projects/state-home.d.ts.map +1 -1
  316. package/dist/projects/state-home.js +11 -0
  317. package/dist/projects/state-home.js.map +1 -1
  318. package/dist/qe/author-workflow.d.ts +4 -0
  319. package/dist/qe/author-workflow.d.ts.map +1 -1
  320. package/dist/qe/author-workflow.js +4 -0
  321. package/dist/qe/author-workflow.js.map +1 -1
  322. package/dist/qe/test-sets.d.ts +4 -5
  323. package/dist/qe/test-sets.d.ts.map +1 -1
  324. package/dist/qe/test-sets.js +2 -1
  325. package/dist/qe/test-sets.js.map +1 -1
  326. package/dist/sources/ask.d.ts.map +1 -1
  327. package/dist/sources/ask.js +12 -12
  328. package/dist/sources/ask.js.map +1 -1
  329. package/dist/sources/dialer.d.ts +6 -1
  330. package/dist/sources/dialer.d.ts.map +1 -1
  331. package/dist/sources/dialer.js +53 -31
  332. package/dist/sources/dialer.js.map +1 -1
  333. package/dist/sources/drivers/mysql.d.ts +2 -0
  334. package/dist/sources/drivers/mysql.d.ts.map +1 -1
  335. package/dist/sources/drivers/mysql.js +18 -2
  336. package/dist/sources/drivers/mysql.js.map +1 -1
  337. package/dist/sources/drivers/postgres.d.ts +2 -0
  338. package/dist/sources/drivers/postgres.d.ts.map +1 -1
  339. package/dist/sources/drivers/postgres.js +10 -3
  340. package/dist/sources/drivers/postgres.js.map +1 -1
  341. package/dist/sources/drivers/sqlite.d.ts +22 -5
  342. package/dist/sources/drivers/sqlite.d.ts.map +1 -1
  343. package/dist/sources/drivers/sqlite.js +10 -9
  344. package/dist/sources/drivers/sqlite.js.map +1 -1
  345. package/dist/sources/drivers/types.d.ts +3 -1
  346. package/dist/sources/drivers/types.d.ts.map +1 -1
  347. package/dist/sources/drivers/types.js +3 -1
  348. package/dist/sources/drivers/types.js.map +1 -1
  349. package/dist/sources/uploads.d.ts +2 -15
  350. package/dist/sources/uploads.d.ts.map +1 -1
  351. package/dist/sources/uploads.js +30 -440
  352. package/dist/sources/uploads.js.map +1 -1
  353. package/dist/standing-orders/history.d.ts +5 -3
  354. package/dist/standing-orders/history.d.ts.map +1 -1
  355. package/dist/standing-orders/history.js +6 -2
  356. package/dist/standing-orders/history.js.map +1 -1
  357. package/dist/studio/apps-standalone/fixture.js +3 -3
  358. package/dist/studio/apps-standalone/runtime.js +1 -1
  359. package/dist/studio/assets/{KnowledgeGraph-DWw0I8RJ.js → KnowledgeGraph-dfq7Flyj.js} +1 -1
  360. package/dist/studio/assets/index-Bame65hj.js +1108 -0
  361. package/dist/studio/assets/index-CtB1BJRI.css +32 -0
  362. package/dist/studio/editors/wicked-apps/editor.json +1 -1
  363. package/dist/studio/editors/wicked-apps/index.html +2 -2
  364. package/dist/studio/editors/wicked-deck/editor.json +1 -1
  365. package/dist/studio/editors/wicked-deck/index.html +2 -2
  366. package/dist/studio/editors/wicked-doc/editor.json +1 -1
  367. package/dist/studio/editors/wicked-doc/index.html +1 -1
  368. package/dist/studio/editors/wicked-insights/editor.json +1 -1
  369. package/dist/studio/editors/wicked-insights/index.html +1 -1
  370. package/dist/studio/editors/wicked-page/editor.json +1 -1
  371. package/dist/studio/editors/wicked-page/index.html +1 -1
  372. package/dist/studio/editors/wicked-video/editor.json +1 -1
  373. package/dist/studio/editors/wicked-video/index.html +1 -1
  374. package/dist/studio/index.html +2 -2
  375. package/dist/studio/testid-inventory.json +402 -11
  376. package/dist/team/routes.d.ts +11 -1
  377. package/dist/team/routes.d.ts.map +1 -1
  378. package/dist/team/routes.js +6 -3
  379. package/dist/team/routes.js.map +1 -1
  380. package/dist/workflow-catalog/catalog-data-v2.d.ts +6 -2
  381. package/dist/workflow-catalog/catalog-data-v2.d.ts.map +1 -1
  382. package/dist/workflow-catalog/catalog-data-v2.js.map +1 -1
  383. package/dist/workflow-catalog/shape.d.ts +1 -1
  384. package/dist/working-doc/event-lines.d.ts +7 -0
  385. package/dist/working-doc/event-lines.d.ts.map +1 -1
  386. package/dist/working-doc/event-lines.js +24 -3
  387. package/dist/working-doc/event-lines.js.map +1 -1
  388. package/endpoint-manifest.json +89 -6
  389. package/evals/corpora/shape-v1.json +1 -1
  390. package/package.json +4 -4
  391. package/runners/sqlite-runner.mjs +28 -11
  392. package/runners/upload-parse.d.mts +13 -0
  393. package/runners/upload-parse.mjs +364 -0
  394. package/dist/studio/assets/index-C4Xj-zxa.css +0 -32
  395. package/dist/studio/assets/index-CrNY3d06.js +0 -1109
@@ -0,0 +1,364 @@
1
+ // Upload parsers live only in the killable runner child (crew#1289). Limits come from uploads.ts.
2
+ import { inflateRawSync } from 'node:zlib';
3
+
4
+ const refusal = (code, message) => ({ code, message });
5
+
6
+ // ── CSV ──────────────────────────────────────────────────────────────────────────────────────
7
+
8
+ function detectDelimiter(text) {
9
+ // The first record, with quoted fields taken out (a quoted field may hold any delimiter).
10
+ let first = '';
11
+ let quoted = false;
12
+ for (let i = 0; i < text.length && i < 1_000_000; i++) {
13
+ const c = text[i];
14
+ if (c === '"') quoted = !quoted;
15
+ else if (!quoted && (c === '\n' || c === '\r')) break;
16
+ else if (!quoted) first += c;
17
+ }
18
+ const counts = [',', ';', '\t'].map((d) => [d, first.split(d).length]);
19
+ return counts.sort((a, b) => b[1] - a[1])[0]?.[0] ?? ',';
20
+ }
21
+
22
+ /** RFC 4180 rows (quoted fields, doubled quotes, CRLF or LF), bounded by the limits. */
23
+ export function parseCsv(text, limits) {
24
+ const d = detectDelimiter(text);
25
+ const rows = [];
26
+ let row = [];
27
+ let field = '';
28
+ let i = 0;
29
+ let quoted = false;
30
+ const n = text.length;
31
+ const endRow = () => {
32
+ row.push(field);
33
+ field = '';
34
+ if (!(row.length === 1 && row[0] === '')) {
35
+ if (row.length > limits.columns) throw refusal('too_many_columns', `the file has more than ${limits.columns} columns`);
36
+ rows.push(row);
37
+ if (rows.length > limits.rows + 1) throw refusal('too_many_rows', `the file has more than ${limits.rows} rows`);
38
+ }
39
+ row = [];
40
+ };
41
+ while (i < n) {
42
+ const c = text[i];
43
+ if (quoted) {
44
+ if (c === '"') {
45
+ if (text[i + 1] === '"') {
46
+ field += '"';
47
+ i += 2;
48
+ continue;
49
+ }
50
+ quoted = false;
51
+ i++;
52
+ continue;
53
+ }
54
+ field += c;
55
+ i++;
56
+ continue;
57
+ }
58
+ if (c === '"' && field === '') {
59
+ quoted = true;
60
+ i++;
61
+ continue;
62
+ }
63
+ if (c === d) {
64
+ row.push(field);
65
+ field = '';
66
+ if (row.length > limits.columns) throw refusal('too_many_columns', `the file has more than ${limits.columns} columns`);
67
+ i++;
68
+ continue;
69
+ }
70
+ if (c === '\r' && text[i + 1] === '\n') {
71
+ endRow();
72
+ i += 2;
73
+ continue;
74
+ }
75
+ if (c === '\n' || c === '\r') {
76
+ endRow();
77
+ i++;
78
+ continue;
79
+ }
80
+ field += c;
81
+ i++;
82
+ }
83
+ if (quoted) throw refusal('bad_csv', 'the file ends inside a quoted field');
84
+ if (field !== '' || row.length > 0) endRow();
85
+ return rows;
86
+ }
87
+
88
+ // ── XLSX (a zip of XML) ──────────────────────────────────────────────────────────────────────
89
+
90
+ function zipEntries(buf) {
91
+ const min = Math.max(0, buf.length - 65_557);
92
+ let eocd = -1;
93
+ for (let i = buf.length - 22; i >= min; i--) {
94
+ if (buf.readUInt32LE(i) === 0x06054b50) {
95
+ eocd = i;
96
+ break;
97
+ }
98
+ }
99
+ if (eocd < 0) throw refusal('bad_xlsx', 'the file is not an XLSX workbook (no zip directory)');
100
+ const count = buf.readUInt16LE(eocd + 10);
101
+ const cdSize = buf.readUInt32LE(eocd + 12);
102
+ const cdOffset = buf.readUInt32LE(eocd + 16);
103
+ if (count === 0xffff || cdOffset === 0xffffffff || cdSize === 0xffffffff) throw refusal('bad_xlsx', 'zip64 workbooks are not supported');
104
+ if (cdOffset + cdSize > buf.length) throw refusal('bad_xlsx', 'the zip directory points past the end of the file');
105
+ const out = [];
106
+ let p = cdOffset;
107
+ for (let k = 0; k < count; k++) {
108
+ if (p + 46 > buf.length || buf.readUInt32LE(p) !== 0x02014b50) throw refusal('bad_xlsx', 'a damaged zip directory');
109
+ const flags = buf.readUInt16LE(p + 8);
110
+ const method = buf.readUInt16LE(p + 10);
111
+ const compressedSize = buf.readUInt32LE(p + 20);
112
+ const size = buf.readUInt32LE(p + 24);
113
+ const nameLen = buf.readUInt16LE(p + 28);
114
+ const extraLen = buf.readUInt16LE(p + 30);
115
+ const commentLen = buf.readUInt16LE(p + 32);
116
+ const localOffset = buf.readUInt32LE(p + 42);
117
+ const name = buf.subarray(p + 46, p + 46 + nameLen).toString('utf8');
118
+ out.push({ name, method, flags, compressedSize, size, localOffset });
119
+ p += 46 + nameLen + extraLen + commentLen;
120
+ }
121
+ return out;
122
+ }
123
+
124
+ class ZipReader {
125
+ expanded = 0;
126
+ constructor(buf, entries, limits) {
127
+ this.buf = buf;
128
+ this.entries = entries;
129
+ this.limits = limits;
130
+ }
131
+
132
+ has(name) {
133
+ return this.entries.some((e) => e.name === name);
134
+ }
135
+
136
+ /** One entry's bytes, inflated with the remaining expansion budget as a HARD cap. */
137
+ read(name) {
138
+ const e = this.entries.find((x) => x.name === name);
139
+ if (e === undefined) throw refusal('bad_xlsx', `the workbook has no ${name}`);
140
+ if ((e.flags & 0x1) !== 0) throw refusal('bad_xlsx', 'encrypted workbooks are not supported');
141
+ const p = e.localOffset;
142
+ if (p + 30 > this.buf.length || this.buf.readUInt32LE(p) !== 0x04034b50) throw refusal('bad_xlsx', 'a damaged zip entry');
143
+ const start = p + 30 + this.buf.readUInt16LE(p + 26) + this.buf.readUInt16LE(p + 28);
144
+ const data = this.buf.subarray(start, start + e.compressedSize);
145
+ const budget = this.limits.expandedBytes - this.expanded;
146
+ if (e.size > budget) throw refusal('too_large', `the workbook expands past ${this.limits.expandedBytes / (1024 * 1024)} MB`);
147
+ let bytes;
148
+ if (e.method === 0) bytes = Buffer.from(data);
149
+ else if (e.method === 8) {
150
+ try {
151
+ bytes = inflateRawSync(data, { maxOutputLength: Math.max(1, budget) });
152
+ } catch (err) {
153
+ const code = err.code;
154
+ if (code === 'ERR_BUFFER_TOO_LARGE' || /buffer|too large|maxOutputLength/i.test(String(err.message))) {
155
+ throw refusal('too_large', `the workbook expands past ${this.limits.expandedBytes / (1024 * 1024)} MB`);
156
+ }
157
+ throw refusal('bad_xlsx', `a zip entry could not be inflated: ${err.message}`);
158
+ }
159
+ } else throw refusal('bad_xlsx', `zip method ${e.method} is not supported`);
160
+ this.expanded += bytes.length;
161
+ if (this.expanded > this.limits.expandedBytes) throw refusal('too_large', `the workbook expands past ${this.limits.expandedBytes / (1024 * 1024)} MB`);
162
+ return bytes.toString('utf8');
163
+ }
164
+ }
165
+
166
+ function xmlText(s) {
167
+ return s
168
+ .replace(/&#x([0-9a-fA-F]+);/g, (_m, h) => String.fromCodePoint(parseInt(h, 16)))
169
+ .replace(/&#(\d+);/g, (_m, d) => String.fromCodePoint(Number(d)))
170
+ .replace(/&lt;/g, '<')
171
+ .replace(/&gt;/g, '>')
172
+ .replace(/&quot;/g, '"')
173
+ .replace(/&apos;/g, "'")
174
+ .replace(/&amp;/g, '&');
175
+ }
176
+
177
+ function attr(tag, name) {
178
+ const m = new RegExp(`\\s${name}="([^"]*)"`).exec(tag);
179
+ return m === null ? null : xmlText(m[1]);
180
+ }
181
+
182
+ function colIndex(ref) {
183
+ const letters = /^([A-Z]+)/.exec(ref)?.[1] ?? 'A';
184
+ let n = 0;
185
+ for (const ch of letters) n = n * 26 + (ch.charCodeAt(0) - 64);
186
+ return n - 1;
187
+ }
188
+
189
+ /**
190
+ * The bodies of `<tag …>…</tag>` (and `<tag …/>`) in order, scanned linearly. An element whose end
191
+ * never comes ends the scan. `withHead` also answers the opening tag (for attributes).
192
+ */
193
+ function* elements(xml, tag, withHead = false) {
194
+ const open = `<${tag}`;
195
+ const close = `</${tag}>`;
196
+ let at = 0;
197
+ for (;;) {
198
+ let i = xml.indexOf(open, at);
199
+ while (i >= 0 && !/[\s>/]/.test(xml[i + open.length] ?? '')) i = xml.indexOf(open, i + 1);
200
+ if (i < 0) return;
201
+ const headEnd = xml.indexOf('>', i);
202
+ if (headEnd < 0) return;
203
+ const head = xml.slice(i, headEnd + 1);
204
+ if (head.endsWith('/>')) {
205
+ yield withHead ? { head, body: '' } : '';
206
+ at = headEnd + 1;
207
+ continue;
208
+ }
209
+ const end = xml.indexOf(close, headEnd + 1);
210
+ if (end < 0) return;
211
+ const body = xml.slice(headEnd + 1, end);
212
+ yield withHead ? { head, body } : body;
213
+ at = end + close.length;
214
+ }
215
+ }
216
+
217
+ /** The concatenated text of every `<t>` in a fragment (a shared string's runs, an inline string). */
218
+ function texts(fragment) {
219
+ let out = '';
220
+ for (const t of elements(fragment, 't')) out += xmlText(t);
221
+ return out;
222
+ }
223
+
224
+ /** The first sheet of an XLSX workbook as rows of strings. */
225
+ export function parseXlsx(buf, limits) {
226
+ const zip = new ZipReader(buf, zipEntries(buf), limits);
227
+ const workbook = zip.read('xl/workbook.xml');
228
+ const sheetTag = /<sheet\b[^>]*>/.exec(workbook)?.[0];
229
+ if (sheetTag === undefined) throw refusal('bad_xlsx', 'the workbook has no sheet');
230
+ const rid = attr(sheetTag, 'r:id');
231
+ const rels = zip.read('xl/_rels/workbook.xml.rels');
232
+ let target = 'worksheets/sheet1.xml';
233
+ for (const m of rels.matchAll(/<Relationship\b[^>]*>/g)) if (attr(m[0], 'Id') === rid) target = attr(m[0], 'Target') ?? target;
234
+ const sheetPath = target.startsWith('/') ? target.slice(1) : `xl/${target.replace(/^\.\//, '')}`;
235
+ // Every scan below is linear (indexOf from a moving cursor, never a lazy regex over the rest of the
236
+ // text), so a hostile sheet of unclosed tags costs one pass, not one pass per tag.
237
+ const shared = [];
238
+ if (zip.has('xl/sharedStrings.xml')) {
239
+ const sst = zip.read('xl/sharedStrings.xml');
240
+ let sharedBytes = 0;
241
+ for (const si of elements(sst, 'si')) {
242
+ const t = texts(si);
243
+ sharedBytes += t.length;
244
+ if (sharedBytes > limits.expandedBytes) throw refusal('too_large', `the workbook's strings expand past ${limits.expandedBytes / (1024 * 1024)} MB`);
245
+ shared.push(t);
246
+ }
247
+ }
248
+ const sheet = zip.read(sheetPath);
249
+ const rows = [];
250
+ // Shared strings are referenced, not copied: count what the cells hold once resolved, so a small
251
+ // sheet repeating one large string cannot become a snapshot far past the expansion limit.
252
+ let cellBytes = 0;
253
+ for (const rowXml of elements(sheet, 'row')) {
254
+ const row = [];
255
+ for (const cell of elements(rowXml, 'c', true)) {
256
+ const ref = attr(cell.head, 'r');
257
+ const t = attr(cell.head, 't');
258
+ const inner = cell.body;
259
+ const vStart = inner.indexOf('<v>');
260
+ const vEnd = vStart < 0 ? -1 : inner.indexOf('</v>', vStart + 3);
261
+ const v = vStart < 0 || vEnd < 0 ? undefined : inner.slice(vStart + 3, vEnd);
262
+ let value = '';
263
+ if (t === 's') value = shared[Number(v)] ?? '';
264
+ else if (t === 'inlineStr') value = texts(inner);
265
+ else if (t === 'b') value = v === '1' ? 'true' : 'false';
266
+ else if (v !== undefined) value = xmlText(v);
267
+ const idx = ref === null ? row.length : colIndex(ref);
268
+ if (idx >= limits.columns) throw refusal('too_many_columns', `the sheet has more than ${limits.columns} columns`);
269
+ while (row.length < idx) row.push('');
270
+ row[idx] = value;
271
+ cellBytes += value.length;
272
+ if (cellBytes > limits.expandedBytes) throw refusal('too_large', `the sheet's values expand past ${limits.expandedBytes / (1024 * 1024)} MB`);
273
+ }
274
+ if (row.length > 0 && row.some((c) => c !== '')) rows.push(row);
275
+ if (rows.length > limits.rows + 1) throw refusal('too_many_rows', `the sheet has more than ${limits.rows} rows`);
276
+ }
277
+ return rows;
278
+ }
279
+
280
+ // ── Rows → a SQLite snapshot ─────────────────────────────────────────────────────────────────
281
+
282
+ const NUMBER = /^[+-]?(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?$/;
283
+ const DATEISH = /^\d{4}-\d{2}-\d{2}([ T]\d{2}:\d{2}(:\d{2}(\.\d+)?)?(Z|[+-]\d{2}:?\d{2})?)?$/;
284
+
285
+ /**
286
+ * Whether to take the first row as the header. Without the person's choice it must look like one AND
287
+ * differ in shape from the data under it (some column whose first cell is a word while its values
288
+ * are numbers or dates): an all-text first row could be a record — a name, an email — and column
289
+ * names are structure an agent sees. A human's explicit choice (`header=yes|no`) wins.
290
+ */
291
+ export function detectHeader(rows, choice) {
292
+ if (choice !== null) return choice === 'yes';
293
+ const first = rows[0] ?? [];
294
+ if (!looksLikeHeader(first) || rows.length < 2) return false;
295
+ const body = rows.slice(1, 201);
296
+ return first.some((_c, i) => {
297
+ const values = body.map((r) => (r[i] ?? '').trim()).filter((v) => v !== '');
298
+ return values.length > 0 && values.every((v) => NUMBER.test(v) || DATEISH.test(v) || /^(true|false)$/i.test(v));
299
+ });
300
+ }
301
+
302
+ /**
303
+ * A column name as people write one: a letter or `_` first, then letters, digits, spaces and a little
304
+ * punctuation (`Amount (USD)`, `Q3 %`, `order-id`), at most 64 characters. No `@`, `.`, `:` or `/`:
305
+ * an email address, a domain, a URL or a time is a value, never a name.
306
+ */
307
+ const NAME_LIKE = /^[\p{L}_][\p{L}\p{N}\p{Zs}_\-()%#&]{0,63}$/u;
308
+
309
+ /** A first row looks like a header when every cell is a distinct column name, none of them data-like. */
310
+ export function looksLikeHeader(first) {
311
+ if (first.length === 0) return false;
312
+ const seen = new Set();
313
+ for (const raw of first) {
314
+ const cell = raw.trim();
315
+ if (cell === '' || NUMBER.test(cell) || DATEISH.test(cell) || /^(true|false)$/i.test(cell) || !NAME_LIKE.test(cell)) return false;
316
+ const k = cell.toLowerCase();
317
+ if (seen.has(k)) return false;
318
+ seen.add(k);
319
+ }
320
+ return true;
321
+ }
322
+
323
+ export function columnNames(first, width, header) {
324
+ const names = [];
325
+ const taken = new Set(); // SQLite compares names case-insensitively
326
+ for (let i = 0; i < width; i++) {
327
+ let n = header ? (first[i] ?? '').trim().replace(/\s+/g, ' ').slice(0, 56) : '';
328
+ if (n === '') n = `col_${i + 1}`;
329
+ let unique = n;
330
+ for (let k = 2; taken.has(unique.toLowerCase()); k++) unique = `${n}_${k}`;
331
+ taken.add(unique.toLowerCase());
332
+ names.push(unique);
333
+ }
334
+ return names;
335
+ }
336
+
337
+ const INT64_MIN = -(2n ** 63n);
338
+ const INT64_MAX = 2n ** 63n - 1n;
339
+
340
+ function isInt64(v) {
341
+ if (!/^[+-]?\d{1,20}$/.test(v)) return false;
342
+ const b = BigInt(v);
343
+ return b >= INT64_MIN && b <= INT64_MAX;
344
+ }
345
+
346
+ /** INTEGER (stored exactly, as a 64-bit integer), REAL, or TEXT; an integer past int64 makes the column TEXT. */
347
+ export function inferType(values) {
348
+ let t = null;
349
+ for (const raw of values) {
350
+ const v = raw.trim();
351
+ if (v === '') continue;
352
+ if (/^[+-]?\d+$/.test(v)) {
353
+ if (!isInt64(v)) return 'TEXT';
354
+ t = t ?? 'INTEGER';
355
+ } else if (NUMBER.test(v) && Number.isFinite(Number(v))) t = t === 'TEXT' ? 'TEXT' : 'REAL';
356
+ else return 'TEXT';
357
+ }
358
+ return t ?? 'TEXT';
359
+ }
360
+
361
+ export function tableNameFor(filename) {
362
+ const base = filename.replace(/^.*[\\/]/, '').replace(/\.[^.]+$/, '').toLowerCase().replace(/[^a-z0-9_]+/g, '_').replace(/^_+|_+$/g, '');
363
+ return /^[a-z_]/.test(base) && base.length > 0 ? base.slice(0, 63) : `data${base === '' ? '' : `_${base}`}`.slice(0, 63);
364
+ }